feat(ui): migrate the page and section components, add the layout tour
Quality / quality (ubuntu-latest) (push) Failing after 12m21s
Quality / quality (windows-latest) (push) Canceled after 0s

Section, SectionHeader and PublicPageShell move onto wire-* classes with
local style blocks, variants as data attributes. SectionHeader loses 38
utility lines, and Section stops spending one line per variant and colour
pairing: tinted and solid now select on two attributes. PageHeader was already
on the convention and only needed the audit.

examples/basic-app/app/pages/layout.wrn composes the whole set into one page.

Building it surfaced a library-wide bug. Ten custom properties were referenced
by components and defined by nothing: --wire-color-focus, --wire-color-surface-soft,
--wire-color-on-danger, --wire-color-surface-subtle and the input-* family,
plus hover and contrast for every semantic colour except primary and
secondary. An undefined custom property does not warn, it resolves to nothing,
so focus rings drew with no colour and every soft surface rendered
transparent -- 27 components referenced surface-soft alone. They are derived
in the theme now, and a test checks every token a component references against
the rendered theme CSS rather than the source, since most are generated.

The semantic spread also had to move ahead of the primary and secondary
entries so the palette keeps winning for those two.

Known and unresolved: LayoutSplitter emits its sizeChange output and the
component does fire it, but a parent binding on the tag is not invoked. The
tour page therefore points at the handle aria-valuenow rather than wiring a
handler that would never update. Outputs work elsewhere, so this is narrower
than an outputs-are-broken problem and needs its own investigation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-08 15:50:33 +05:30
co-authored by Claude Opus 5
parent 8aa28205e0
commit c7ab605e85
18 changed files with 720 additions and 149 deletions
+42
View File
@@ -3,6 +3,7 @@ import { readFileSync } from "node:fs";
import { join } from "node:path";
import { compileWireFile, parse } from "../../compiler/src/index.ts";
import { mountHtml, renderComponent } from "../../test/src/index.ts";
import { renderThemeCss, resolveThemeConfig } from "../../styles/src/theme.ts";
// The filesystem helpers moved to the server-only `registry` subpath; the
// package entry deliberately stays free of node:* imports so it can be
// bundled for the browser.
@@ -2954,6 +2955,12 @@ test("layout splitter renders two panes and an operable separator", async () =>
*/
expect(source).toContain("data-wrn-splitter");
expect(source).toContain("data-wrn-splitter-handle");
/*
* The output is sizeChange, not resize. An output named after a native DOM
* event is emitted by the component but never reaches the parent binding.
*/
expect(source).toContain("sizeChange(payload:");
expect(source).not.toMatch(/^\s*resize\(payload:/m);
const html = await renderComponent(source, {
orientation: "horizontal",
@@ -3038,6 +3045,10 @@ test("layout components ship their own styles instead of Tailwind utilities", ()
"Kbd",
"LayoutSplitter",
"CustomScrollbar",
"Section",
"SectionHeader",
"PublicPageShell",
"PageHeader",
];
const utility =
/class:(grid-cols-|sm:|lg:|md:|max-w-|gap-[0-9]|px-[0-9]|py-[0-9]|border-l|bg-\[|h-0|text-xs|items-)/;
@@ -3058,3 +3069,34 @@ test("layout components ship their own styles instead of Tailwind utilities", ()
});
}
});
test("every wire color token a component references is defined by the theme", () => {
/*
* Ten tokens were referenced by components and defined by nothing:
* --wire-color-focus, --wire-color-surface-soft, --wire-color-on-danger and
* the input-* family. An undefined custom property does not warn, it simply
* resolves to nothing, so focus rings drew with no colour and soft surfaces
* rendered transparent.
*
* Checked against the rendered theme CSS rather than the source: most of
* these tokens are derived per palette, so they never appear as literals.
*/
const css = renderThemeCss(resolveThemeConfig());
const defined = new Set(
[...css.matchAll(/(--wire-color-[a-z0-9-]+)\s*:/g)].map((match) => match[1]!),
);
const missing = new Map<string, string[]>();
for (const name of uiComponentNames()) {
const source = readFileSync(uiComponentPath(name), "utf8");
for (const match of source.matchAll(/var\((--wire-color-[a-z0-9-]+)/g)) {
const token = match[1]!;
if (defined.has(token)) continue;
if (!missing.has(token)) missing.set(token, []);
const users = missing.get(token)!;
if (users.length < 4 && !users.includes(name)) users.push(name);
}
}
expect([...missing].map(([token, users]) => `${token} <- ${users.join(", ")}`)).toEqual([]);
});