feat: give every Ekklesia screen one set of design tokens and elements
Modules have owned their own UI since ADR 0021, but the platform has never said what that UI should look like. Every screen here — the Dashboard shell, the display host, the module template — invented its own hex colours, font stack, spacing, and radii, and they already disagreed. A module author had no vocabulary for "the ordinary panel background", so the only available answer was to invent one, and two modules would invent two. Add `@ekklesia/design-tokens`: one validated, enumerable registry of semantic tokens. A token declares a name, label, description, and default value; its category and `--ekklesia-*` identifier are derived from the name, so it can never claim one category while being named for another. Construction rejects duplicates, malformed names, unknown categories, empty or overlong text, and any value that is not a bounded literal — no declaration terminator, rule block, comment, at-rule, `url(`, `!important`, escape, control character, or markup. A registry that constructs can therefore be emitted as CSS without escaping, because nothing needing escaping can be in it. That validation is also what makes a future theme editor implementable rather than aspirational. Add `@ekklesia/ui`: button, icon button, text input, select, checkbox, field wrapper, panel, dialog, tabs, table and list primitives, badge, toast, and empty/error/loading states — every value a token reference, with real `:focus-visible` treatment and status that never depends on colour alone. Deliberately small: an element earns its place when two consumers need it. The stylesheet is a string rather than a `.css` file so the identical bytes install into a document or an isolated artifact root, and so hover, disabled, and focus-visible are real CSS rather than JavaScript approximations of them. `pnpm boundaries` opens exactly two shared roles to modules, by name — every other role stays rejected — and pins both design packages to the bottom of the presentation stack. Both are browser-safe by construction, proven by a real compile of module-shaped source in which `process.env` must fail to typecheck. The shell installs the defaults at its document root for the Dashboard and the display; custom properties inherit into module artifacts, so a module reads `var(--ekklesia-…)` with nothing to import at run time and nothing for a host to forget to pass. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b14613decd
commit
e03d38fcab
@@ -220,9 +220,24 @@ function boundaryRule(from: Location, to: Location): string | undefined {
|
||||
if (to.layer === "module" && from.owner !== to.owner) {
|
||||
return "modules-do-not-import-other-modules";
|
||||
}
|
||||
// The approved shared roles a module may reach, and nothing else. `design-tokens` and `ui` are
|
||||
// named individually rather than by opening "browser-safe shared packages" generally: a module
|
||||
// may consume Ekklesia's global semantic tokens and foundational elements (ADR 0039) precisely
|
||||
// so two modules' screens look like one product, but it still may not reach `api-client`,
|
||||
// `auth-client`, `surface-sdk`, `module-ui-host`, or any other shared role. Both approved
|
||||
// packages are browser-safe by construction — neither has a backend dependency — so this adds
|
||||
// no path from module UI to Node's globals.
|
||||
if (
|
||||
to.layer === "shared" &&
|
||||
!["contracts", "module-sdk", "module-ui-sdk", "testing", "tooling"].includes(to.role ?? "")
|
||||
![
|
||||
"contracts",
|
||||
"design-tokens",
|
||||
"module-sdk",
|
||||
"module-ui-sdk",
|
||||
"testing",
|
||||
"tooling",
|
||||
"ui",
|
||||
].includes(to.role ?? "")
|
||||
) {
|
||||
return "modules-use-public-platform-contracts";
|
||||
}
|
||||
@@ -287,6 +302,14 @@ function boundaryRule(from: Location, to: Location): string | undefined {
|
||||
return "sdks-do-not-depend-on-implementations";
|
||||
}
|
||||
|
||||
if (
|
||||
from.layer === "shared" &&
|
||||
["design-tokens", "ui"].includes(from.role ?? "") &&
|
||||
["app", "builder", "core", "module", "surface"].includes(to.layer)
|
||||
) {
|
||||
return "design-packages-depend-downward-only";
|
||||
}
|
||||
|
||||
if (from.layer === "shared" && to.layer === "shared") {
|
||||
if (from.role === "contracts" && to.role !== "contracts") {
|
||||
return "contracts-do-not-depend-upward";
|
||||
@@ -307,6 +330,18 @@ function boundaryRule(from: Location, to: Location): string | undefined {
|
||||
if (from.role === "builder-sdk" && !["contracts", "surface-sdk"].includes(to.role ?? "")) {
|
||||
return "sdks-do-not-depend-on-implementations";
|
||||
}
|
||||
// The design contract is the bottom of the presentation stack: it depends on nothing, exactly
|
||||
// like `module-ui-sdk`, so importing it can never drag another package's type graph into a
|
||||
// browser program. The shared elements sit one layer above it and may reach it and nothing
|
||||
// else — a shared element package that could reach an API client, an auth client, or the
|
||||
// backend contracts barrel would put all three inside every module artifact that renders a
|
||||
// button (ADR 0039).
|
||||
if (from.role === "design-tokens" && to.role !== "tooling") {
|
||||
return "design-packages-depend-downward-only";
|
||||
}
|
||||
if (from.role === "ui" && !["design-tokens", "tooling"].includes(to.role ?? "")) {
|
||||
return "design-packages-depend-downward-only";
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user