Warning |
---|
This page is NOT documentation of the UI Options API. It is a working document. The UI Options API is currently undergoing revision, and there is no API documentation as yet. |
This page presents a proposal for a new API for User Interface Options. It lays out what we would like to expect of an integrator.
Guiding Principles
- A schema exists to define the settings, their defaults, ranges, etc.
- Any options that might be set should be top-level.
- Option names should make sense.
- Integrators should not have to create both a page enhancer and the fat panel individually; If they want the fat panel, the page enhancer would be assumed and should be instantiated on the page automatically.
- Integrators should be able to create a page enhancer without UIO (in the case of a full-page UIO available elsewhere, through a link).
The options shown here represent the minimal options that an integrator would have to provide. Other options will also be available.
Basic API
...
Section |
---|
Column |
---|
UIO + Page EnhancerOnly Code Block |
---|
|
fluid.uiOptions(container, {
gradeNames: [<gradenames of desired panels>],
pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/" <gradenames of schema for settings>],
siteThemeClassNamepathToTemplates: "foofer-doodle-thememy/sites/lib/infusion/templates/"
});
|
|
Column |
---|
Page Enhancer Only Code Block |
---|
|
fluid.pageEnhancer({
gradeNames: [<grade names forof desired enactors>,
<gradenames of schema for settings>],
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
|
|
If no grade names are specified, the default state of the components would be no panels, no settings. It's unlikely anyone would ever use it without grade names.
Basic API with schema support
Section |
---|
Column |
---|
UIO + Page Enhancer Code Block |
---|
|
fluid.uiOptionsuiOptionsPlusPageEnhancer(container, {
schemagradeNames: [<gradenames <pathof todesired schema, including filename>,panels>,
pathToTemplates: "my/sites/lib/infusion/templates/", <grade names of pathToTocTemplate: "my/sites/",desired enactors>,
siteThemeClassName: "foofer-doodle-theme" }); |
| Column |
---|
Page Enhancer Only Code Block |
---|
javascript | javascript | {code:javascript} fluid.pageEnhancer({ schema: <path<gradenames toof schema for settings>], including filename>
pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
|
|
If no grade names are specified, the default state of the components would be no panels, no settings. It's unlikely anyone would ever use it without grade names.
Use Case: 2nd Parties (Infusion-provided "starter-set" of panels and settings)
Add the provided "starter-set" of panels and settings included in Infusion using the default starter grades.
Section |
---|
Column |
---|
UIO + Page Enhancer (no schema)Only Code Block |
---|
|
fluid.uiOptions(container, {
gradeNames: ["fluid.uiOptions.defaultPanelsstarterSettings"],
pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
NOTE: The starterSettings grade combines the grades for the starter panels and the starter schema. |
Column |
---|
Page Enhancer Only (no schema) Code Block |
---|
|
fluid.pageEnhancer({
gradeNames: ["fluid.uiOptionsuiEnhancer.defaultSettings"starterSettings],
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
NOTE: The starterSettings grade combines the grades for the starter enactors and the starter schema. |
|
Section |
---|
Column |
---|
UIO + Page Enhancer (with schema) Code Block |
---|
|
fluid.uiOptionsuiOptionsPlusPageEnhancer(container, {
schemagradeNames: "my/sites/lib/infusion/defaultSchema.json"["fluid.uiOptions.starterSettings"],
pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
| Column |
---|
Page Enhancer Only (with schema) Code Block |
---|
| javascript | javascript |
fluid.pageEnhancer({
schema: "my/sites/lib/infusion/defaultSchema.json",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
NOTE: The starterSettings grade combines the grades for the starter enactors, panels and schema. QUESTION: What should we name this/these combined grades?
|
Use Case: 3rd Parties
...
Adding Panels To The Starter Set
Note: 3rd parties will have to define their own grades .
...
for new settings, panels, enactors.
Note: All further examples will only use the "UIO + Page Enhancer" version: fluid.uiOptionsPlusPageEnhancer()
. The pattern holds.
Section |
---|
Column |
---|
Code Block |
---|
|
/**
* Define a grade for extrathe panelsschema for * and their default your settings
*/
fluid.defaults("my.extra.panelssettingsSchema", {
defaultSiteSettingsschema: {...}
});
/**
* Define a grade for foofer:extra 7,panels
* and their default settings
doodle: true
},*/
fluid.defaults("my.extra.panels", {
components: {
foofer: {
funcName: "my.integration.fooferPanel",
options: {
// if necessary:
template: "myFooferPanel.html"
// why can't panels load their own templates?
}
// any other configuration as necessary
},
doodle: {
funcName: "my.integration.doodlePanel",
options: {
template: "myDoodlePanel.html"
// if necessary
}
// any other configuration as necessary
}
}
});
fluid.uiOptions(container, {
gradeNames: ["fluid.uiOptions.defaultPanels",
/**
* Define a grade for extra enactors
*/
fluid.defaults("my.extra.panelsenactors"], {
pathToTemplates components: "my/sites/lib/infusion/templates/", {
pathToTocTemplate: "my/sites/", foofer: {
siteThemeClassName: "foofer-doodle-theme" }); |
Alternatively, the extra grade could be added using demands: Code Block |
---|
javascript | javascript | fluid.demands("fluid.uiOptions", ["my.integrations"], { gradeNamesfuncName: ["my.extraintegration.panels"],
});
fluid.uiOptions(containerfooferEnactor",
{ gradeNames: ["fluid.uiOptions.defaultPanels"], pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",/ any other configuration as necessary
siteThemeClassName: "foofer-doodle-theme" });
|
| Column |
---|
Page Enhancer Code Block |
---|
javascript | javascript |
/**
* Define a grade for extra enactors
* and their default settings
*/
fluid.defaults("my.extra.settings", {,
doodle: {
funcName: "my.integration.doodleEnactor",
defaultSiteSettings: { // any other configuration foofer:as 7,necessary
doodle:}
true }
},);
/**
* A components:grade {that combines my enactors, panels and schema.
foofer:*/
fluid.defaults("my.extra.settings", {
funcNamegradeNames: ["my.integrationextra.fooferEnactorenactors",
// any other configuration as necessary
},
"my.extra.panels",
doodle: { funcName: "my.integrationextra.doodleEnactorsettingsSchema",]
});
/**
* Add the enactors, panels and schema
/*/
any other configuration as necessary
fluid.uiOptionsPlusPageEnhancer(container, {
gradeNames: ["fluid.uiOptions.starterSettings",
} } }); fluid.pageEnhancer({ gradeNames: ["fluidmy.uiOptionsextra.defaultSettingssettings"],
pathToTemplates: "my.extra.settings"]/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
|
|
Alternatively, the extra
...
grades could be added using demands:
Section |
---|
Column |
---|
Code Block |
---|
|
fluid.demands("fluid.pageEnhanceruiOptions", ["my.integrations"], {
gradeNames: ["my.extra.settings"],
});
fluid.pageEnhanceruiOptionsPlusPageEnhancer(container, {
gradeNames: ["fluid.uiOptions.defaultSettingsstarterSettings"],
pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
|
|
...
Use Case: 3rd Parties Wanting A Subset Of The Starter Set
There are three possible ways to do this:
- Cut-and-paste: Copy the code that defines the "starter" grades, rename the grades, delete the parts you don't want, and use these new grades instead of the starter grades (not really recommended).
- Empty subcomponents: Use the starter grades and override the excluded subcomponents with
fluid.emptySubcomponent
- Individual grades: Use the individual settings grades desired instead of the starter set.
The last two of these methods will be shown here, excluding the colour-and-contrast setting and the layout setting.
Section |
---|
Column |
---|
| UIOEmpty Subcomponents Code Block |
---|
|
// The grade definition would be the same as above
fluid.uiOptions(container, {fluid.uiOptionsPlusPageEnhancer(container, {
gradeNames: ["fluid.uiOptions.starterSettings"],
// XXXcomponents: Would custom schema{
include 'default' panels? schema: "my/sites/mySchema.json" Override the settings panels
pathToTemplates: "my/sites/lib/infusion/templates/", pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
| Column |
---|
Page Enhancer Code Block |
---|
javascript | javascript |
// The grade definition would be the same as above
fluid.pageEnhancer({ contrast: {
type: "fluid.emptySubcomponent"
// XXX: Would custom},
schema include 'default' panels? schemalayoutControls: "my/sites/mySchema.json" {
pathToTocTemplate: "my/sites/", siteThemeClassNametype: "foofer-doodle-themefluid.emptySubcomponent"
}); |
|
|
Using a subset of the included panels (no schema)
Section |
---|
Column |
---|
| UIO Code Block |
---|
javascript | javascript | /** * Define a grade including},
only
desired panels */ fluid.defaults("my.panels", { // Override components:the {enactors
textSizertheme: {
type: "fluid.uiOptions.textSizer",
// any other configuration as necessaryemptySubcomponent"
},
lineSpacertableOfContentsEnactor: {
type: "fluid.uiOptions.lineSpacer",
// any other configuration as necessaryemptySubcomponent"
}
}
});
fluid.uiOptions(container, {
gradeNames: ["my.panels"],
pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
|
Column | Page Enhancer |
---|
| Individual Grades Code Block |
---|
|
/**
* Define a grade including only desired enactors
*/
fluid.defaults("my.extra.settings", {
textSize: {
fluid.defaults("my.panelSet", {
gradeNames: [
// Specify each of the four desired panels directly
"fluid.uiOptions.textSizer",
type: "fluid.uiOptions.enactor.textSizerlineSpacer",
"fluid.uiOptions.textFont",
// any other configuration as necessary "fluid.uiOptions.linksControls",
}, // Specify textFont:each {of the four desired enactors directly
type: "fluid.uiOptionsuiEnhancer.enactor.classSwappertextSizer",
"fluid.uiEnhancer.lineSpacer",
// any other configuration as necessary "fluid.uiEnhancer.textFont",
}"fluid.uiEnhancer.linksControls",
} }); fluid.pageEnhancer({
gradeNames: ["my.settings"], pathToTocTemplate: "my/sites/", Use the full schema
siteThemeClassName: "foofer-doodle-theme" }); |
|
|
Using a subset of the included panels (with schema)
Section |
---|
Column |
---|
| UIO Code Block |
---|
javascript | javascript | // The grade definition would be the same as above
"fluid.uiOptions.starterSettingsSchema"
]
});
fluid.uiOptionsuiOptionsPlusPageEnhancer(container, {
schemagradeNames: ["my/sites/mySchema.jsonpanelSet"],
pathToTemplates: "my/sites/lib/infusion/templates/",
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
| Column |
---|
Page Enhancer Code Block |
---|
javascript | javascript |
// The grade definition would be the same as above
fluid.pageEnhancer({
schema: "my/sites/mySchema.json"
pathToTocTemplate: "my/sites/",
siteThemeClassName: "foofer-doodle-theme"
});
|
|
|
Use Case: 4th Parties (users of customized UIOs)