One declaration does three jobs: renders the panel, carries the defaults, names
the values that come back. A module writes no DOM and reads no DOM.
Validation refuses rather than repairs -- unknown type, a renderer its type does
not have, a label that is not text, a default outside its own bounds, a when
naming a key the module never declared. A module that is wrong does not get a
best-effort panel; it does not load, and says why once.
Ordering is by declared relation and stage, never priority numbers, and a cycle
drops only the modules in it. Compatibility is by trait, never model name.
The shell hands a module { composer, values, on, shell } and nothing else: no
node, no document, no kit internals. It cannot style anything because it is
never given anything that could.
catalogue/hide.html puts one good module and five broken ones through the real
shell and shows the result: one panel, five absent, no placeholders. The lint
fixtures make the scanner prove it catches each rule, so a clean scan means
something.
First slice: modules/system/appearance. Two settings, an optional ui.js, and
clicking Light actually turns the app light.
25 lines
836 B
JavaScript
25 lines
836 B
JavaScript
// What the app offers modules beyond the kit.
|
|
//
|
|
// Deliberately tiny and named one by one. The alternative -- letting a module
|
|
// reach for a global -- means the surface is "whatever happens to be on window",
|
|
// which nobody can review and nothing can keep stable.
|
|
|
|
import { applyDensity, normaliseCols, rememberCols } from "../composer/internals/density.js";
|
|
|
|
export const services = {
|
|
theme: {
|
|
set(choice) { window.ComposerTheme.apply(choice); },
|
|
get: () => window.ComposerTheme.get(),
|
|
resolved: () => window.ComposerTheme.resolved(),
|
|
},
|
|
density: {
|
|
/** Column count for every adaptive grid on the page. */
|
|
set(cols) {
|
|
const n = normaliseCols(cols);
|
|
for (const grid of document.querySelectorAll(".cx-gallery")) applyDensity(grid, n);
|
|
rememberCols("app", n);
|
|
return n;
|
|
},
|
|
},
|
|
};
|