@valiify/dashboard-ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +174 -2
  2. package/CLAUDE.md +124 -3
  3. package/GETTING_STARTED.md +87 -0
  4. package/README.md +49 -3
  5. package/TROUBLESHOOTING.md +40 -0
  6. package/dist/dashboard-ui.css +501 -507
  7. package/examples/README.md +42 -0
  8. package/examples/daisyui-starter/README.md +47 -24
  9. package/examples/daisyui-starter/check-no-bleed.mjs +216 -48
  10. package/examples/daisyui-starter/index.html +44 -17
  11. package/examples/daisyui-starter/linked.html +74 -0
  12. package/examples/daisyui-starter/package.json +1 -1
  13. package/examples/daisyui-starter/src/host.css +14 -0
  14. package/examples/daisyui-starter/src/only-import.css +4 -0
  15. package/examples/daisyui-starter/src/styles.css +21 -5
  16. package/examples/daisyui-starter/tailwind.config.js +7 -6
  17. package/examples/postcss-starter/package.json +1 -1
  18. package/examples/sveltekit-starter/README.md +32 -0
  19. package/examples/sveltekit-starter/check-scoped-styles.mjs +103 -0
  20. package/examples/sveltekit-starter/package-lock.json +1300 -0
  21. package/examples/sveltekit-starter/package.json +24 -0
  22. package/examples/sveltekit-starter/src/app.css +17 -0
  23. package/examples/sveltekit-starter/src/app.html +11 -0
  24. package/examples/sveltekit-starter/src/lib/GlobalReset.svelte +20 -0
  25. package/examples/sveltekit-starter/src/lib/ScopedRemedy.svelte +27 -0
  26. package/examples/sveltekit-starter/src/lib/ScopedReset.svelte +22 -0
  27. package/examples/sveltekit-starter/src/routes/+layout.svelte +6 -0
  28. package/examples/sveltekit-starter/src/routes/+page.svelte +10 -0
  29. package/examples/sveltekit-starter/svelte.config.js +4 -0
  30. package/examples/sveltekit-starter/vite.config.js +6 -0
  31. package/examples/vite-starter/package.json +1 -1
  32. package/package.json +6 -2
  33. package/src/build/components.css +6 -0
  34. package/src/build/utilities.css +6 -2
  35. package/src/reset.css +213 -0
@@ -59,6 +59,38 @@ Uses the **prebuilt** entry (`dist/index.css`), not `/source`.
59
59
 
60
60
  **When to use:** Only when you have no build tool at all.
61
61
 
62
+ ### [daisyui-starter/](daisyui-starter/) - The host-collision test
63
+
64
+ **Best for:** proving the prebuilt bundle inside the dashboard app's stack —
65
+ **Tailwind 3 + daisyUI 4**, no Tailwind 4 anywhere.
66
+
67
+ Imports `@valiify/dashboard-ui/styles.css` as a plain stylesheet. `npm run check`
68
+ renders the page in headless Chromium and asserts **computed styles**, which no
69
+ manifest-based gate can see, in two directions and over three load paths:
70
+
71
+ - **A — class-name collisions** (daisyUI's `btn` vs our `.vd-btn`), fixed by the `vd-` namespace.
72
+ - **B — the host's element reset** defeating our component rules: Tailwind 3
73
+ preflight's `* { border-width: 0 }`, `button { background-color: transparent }`,
74
+ `input, textarea { … }`. Asserted per control — button, input, select, textarea.
75
+ - Load paths: `@import` inside the host's `@tailwind` file (the host's Tailwind 3
76
+ consumes our `@layer` blocks and emits the rules unlayered), a raw `<link>` to
77
+ the bundle as shipped (layers intact — where 0.2.0 lost), and a lone `@import`
78
+ through the host PostCSS (which Tailwind 3 refused for 0.2.0).
79
+
80
+ The layer-defeat fingerprint the check names: the focus ring survives while the
81
+ border, fill and padding do not, on the same control.
82
+
83
+ ### [sveltekit-starter/](sveltekit-starter/) - The scoped-style test
84
+
85
+ **Best for:** proving the prebuilt bundle against **SvelteKit + Svelte 5** component
86
+ styles, which compile to unlayered CSS that Vite injects after the app stylesheet.
87
+
88
+ No Tailwind. `npm run check` asserts three real components against the compiled
89
+ selectors read off the served CSS: a `:global(button)` reset (the bundle must win),
90
+ a scoped `button { }` (compiles to `button.svelte-hash`, 0,1,1 — the bundle
91
+ **cannot** win; asserted as a loss so the contract's second clause stays pinned to a
92
+ measurement), and the remedy `button:not([class*="vd-"])`.
93
+
62
94
  ## How to Choose
63
95
 
64
96
  | You have... | Use... |
@@ -69,6 +101,8 @@ Uses the **prebuilt** entry (`dist/index.css`), not `/source`.
69
101
  | PostCSS CLI setup | [postcss-starter/](postcss-starter/) |
70
102
  | Plain HTML, no build | [basic/](basic/) |
71
103
  | Email template or static export | [basic/](basic/) |
104
+ | Tailwind 3 + daisyUI host | [daisyui-starter/](daisyui-starter/) — `./styles.css` |
105
+ | SvelteKit host, no Tailwind | [sveltekit-starter/](sveltekit-starter/) — `./styles.css` |
72
106
 
73
107
  ## Testing an Example Locally
74
108
 
@@ -101,6 +135,14 @@ npm run build # Build dist/index.css first
101
135
  open examples/basic/index.html
102
136
  ```
103
137
 
138
+ **Host checks (daisyUI, SvelteKit):**
139
+
140
+ ```bash
141
+ npm run build # dist/dashboard-ui.css first
142
+ cd examples/daisyui-starter && npm install && npm run check
143
+ cd examples/sveltekit-starter && npm install && npm run check
144
+ ```
145
+
104
146
  ## What Each Example Shows
105
147
 
106
148
  ### vite-starter
@@ -1,35 +1,58 @@
1
- # dashboard-ui + daisyUI 4
1
+ # dashboard-ui + Tailwind 3 + daisyUI 4
2
2
 
3
- The collision test. This is the only example that exercises the reason
4
- `@valiify/dashboard-ui` is namespaced at all.
3
+ The host-collision test. The host runs **Tailwind 3 + daisyUI 4** — the dashboard
4
+ app's stack — and imports `@valiify/dashboard-ui/styles.css`, the prebuilt bundle,
5
+ as a plain stylesheet. No Tailwind 4 anywhere in this example; the bundle needs none.
5
6
 
6
- The host runs **Tailwind 3 + daisyUI 4** — the dashboard app's stack. daisyUI
7
- defines `.btn`, `.badge`, `.card`, `.input`, `.alert`, `.tab(s)`, `.modal`,
8
- `.toast`, `.tooltip`, `.avatar`, `.checkbox`, `.skeleton`, `.link`, `.divider`,
9
- `.step`, `.textarea`, `.dropdown` and `.breadcrumbs`. So do we — under `vd-`.
7
+ `npm run check` renders the page in headless Chromium and asserts **computed
8
+ styles** in two directions. They are different bugs:
10
9
 
11
- Two things make it safe, and the check proves both:
10
+ - **A — class-name collisions.** daisyUI owns `.btn`, `.badge`, `.card`, `.input`,
11
+ `.alert`, `.tab(s)`, `.modal`, `.toast`, `.tooltip`, `.avatar`, `.checkbox`,
12
+ `.skeleton`, `.link`, `.divider`, `.step`, `.textarea`, `.dropdown` and
13
+ `.breadcrumbs`; ours carry `vd-`. Each pair must keep its own look. The `vd-`
14
+ namespace (0.2.0) is what fixes this.
15
+ - **B — the host's element reset.** `@tailwind base` emits Tailwind 3's preflight,
16
+ unlayered and after our import: `* { border-width: 0 }`, `button {
17
+ background-color: transparent }`, `button, input, textarea { font-size: 100%;
18
+ line-height: inherit; color: inherit; padding: 0 }`. A component rule inside a
19
+ cascade layer loses to every one of those before specificity or source order is
20
+ consulted. This is asserted per control — **button, input, select, textarea** —
21
+ because those are the elements preflight touches. The library ships no select
22
+ component (DropdownField is a `<button>`); the check asserts that from the
23
+ manifest so the gap cannot go quiet when one lands.
12
24
 
13
- - **Components are namespaced.** `.btn` is daisyUI's, `.vd-btn` is ours. Order
14
- cannot rescue a shared name here: daisyUI 4 is unlayered and our rules sit in
15
- `@layer components`, so an unlayered host rule wins before specificity or order
16
- is consulted. Our `@import` has to come first — CSS discards an `@import` that
17
- follows other rules — but that does not soften the test: on any shared name
18
- daisyUI would win from either position.
19
- - **Utilities are prefixed.** We ship a closed `vd:` set compiled by Tailwind 4;
20
- the host compiles its own bare utilities with Tailwind 3, where `border` and
21
- `ring-1` mean different things. Neither can see the other.
25
+ The previous revision of this check asserted only direction A, on one load path,
26
+ and only properties preflight never touches. It passed 10/10 with the 0.2.0 layer
27
+ defeat present.
22
28
 
23
- We import `@valiify/dashboard-ui/styles.css`, not `/source`. That bundle carries
24
- **no preflight and no `html` rule** — the host owns its reset. Importing `.`
25
- (`dist/index.css`) here would be wrong: it ships full Preflight and would reset
26
- every element on the host's page.
29
+ Three load paths, because the answer depends on it:
30
+
31
+ | path | what the browser gets | layered bundle (0.2.0) |
32
+ | --- | --- | --- |
33
+ | `/` — `@import` inside the host's `@tailwind` file | Tailwind 3 consumes our `@layer components` blocks and re-emits the rules unlayered, after preflight | passes by accident |
34
+ | `/linked.html` — `<link>` to the bundle after the host CSS | the file exactly as shipped, layers intact | **fails** — every direction-B assertion |
35
+ | `src/only-import.css` — a lone `@import` through the host PostCSS | Tailwind 3 refuses any file carrying its layer names without a matching `@tailwind` directive | **refused** |
36
+
37
+ The fingerprint of a layer defeat, which this check names when it sees it:
38
+ preflight never touches `outline`, so the **focus ring survives while the border
39
+ does not**, on the same control.
40
+
41
+ The host body is deliberately set to 17px / line-height 2 / purple. Preflight makes
42
+ form controls inherit those, so if our input rule loses the input visibly reads
43
+ the host's values. With the library's own 13px there, the defeat would be
44
+ invisible by coincidence.
45
+
46
+ We import `@valiify/dashboard-ui/styles.css`, not `/source` and not `.`. That
47
+ bundle carries **no preflight and no `html` rule** — the host owns its reset.
48
+ Importing `.` (`dist/index.css`) here would be wrong: it ships full Preflight and
49
+ would reset every element on the host's page.
27
50
 
28
51
  ```bash
29
52
  npm install
30
- npm run check # headless assertion, no bleed either way
53
+ npm run check
31
54
  npm run dev
32
55
  ```
33
56
 
34
- `npm run check` fails if a daisyUI control picks up any of our declarations, if
35
- one of ours picks up daisyUI's, or if our prefixed utilities stop resolving.
57
+ The `@import` must come first in `src/styles.css`; CSS discards an `@import` that
58
+ follows other rules, and the symptom looks exactly like a namespace failure.
@@ -1,32 +1,90 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * No-bleed assertion: dashboard-ui and daisyUI 4 in one document.
3
+ * No-bleed assertion: dashboard-ui and Tailwind 3 + daisyUI 4 in one document.
4
4
  *
5
5
  * npm run check
6
6
  *
7
- * verify:bundle asserts things about the bundle's own text. This renders it beside
8
- * the library it was namespaced to avoid and measures COMPUTED styles, which is the
9
- * only way to observe a collision — a shared class name does not error, it silently
10
- * gives one library's node the other's declarations.
7
+ * Every other gate in the library checks class NAMES against a manifest. This one
8
+ * renders the bundle inside the host stack it was built for and measures COMPUTED
9
+ * styles — the only way to observe either kind of collision, because neither
10
+ * errors: a shared name silently hands one library's node the other's declarations,
11
+ * and a cascade layer silently hands a host element reset the win over our class.
11
12
  *
12
- * Three claims:
13
- * 1 a daisyUI control keeps daisyUI's look (we do not bleed into the host)
14
- * 2 one of ours keeps ours (the host does not bleed into us)
15
- * 3 our prefixed utilities still resolve (the vd: layer survives Tailwind 3)
13
+ * Two directions, and they are different bugs:
16
14
  *
17
- * Claim 2 is the load-bearing one. daisyUI 4 is UNLAYERED and our components sit in
18
- * @layer components, so on any shared name daisyUI wins regardless of import order —
19
- * which is why src/styles.css loads it first. Only the namespace separates them.
15
+ * A class-name collision — daisyUI's `.btn` vs our `.vd-btn`. Fixed by the vd-
16
+ * namespace (0.2.0). Asserted both ways.
17
+ *
18
+ * B host ELEMENT RESET defeating our component — Tailwind 3 preflight's
19
+ * `* { border-width: 0 }`, `button { background-color: transparent }`,
20
+ * `button, input, textarea { font-size: 100%; line-height: inherit; color:
21
+ * inherit; padding: 0 }`. Unlayered, and it loads after our bundle. A component
22
+ * rule inside `@layer components` loses to all of it regardless of specificity
23
+ * or order; an unlayered one wins on specificity. The rename could not fix this
24
+ * and did not. Asserted per control: button, input, select, textarea — the
25
+ * elements preflight touches.
26
+ *
27
+ * The previous revision of this check asserted only direction A, on one load path,
28
+ * and only properties preflight never touches (height, radius, the tooltip fill). It
29
+ * passed 10/10 with the 0.2.0 layer defeat present. It could not fail on that bug.
30
+ *
31
+ * TWO LOAD PATHS, because the answer depends on it (measured, not assumed):
32
+ *
33
+ * / src/styles.css `@import`s the bundle INTO the host's Tailwind 3
34
+ * stylesheet. Tailwind 3 treats `@layer components { }` as its own
35
+ * directive, hoists the rules to its `@tailwind components` slot and
36
+ * emits them UNLAYERED — after preflight. The host's pipeline strips
37
+ * our layers by accident, so a layered bundle passes here.
38
+ * /linked.html <link> to the bundle file after the host's compiled CSS. The bundle
39
+ * reaches the browser exactly as shipped, layers intact. This is the
40
+ * path a host that "never compiles our classes" is most likely to use,
41
+ * and the one where a layered bundle loses.
42
+ *
43
+ * A third shape — the bundle as its own CSS file through the host's PostCSS with
44
+ * no @tailwind directives — is probed and asserted: a bundle Tailwind 3 refuses to
45
+ * process cannot be the host's own CSS entry.
46
+ *
47
+ * The fingerprint that identifies a layer defeat: preflight never touches
48
+ * `outline`, so under a layer defeat the focus ring SURVIVES while the border,
49
+ * fill and padding do not. The check reads both on every control and names the
50
+ * signature when it sees it.
20
51
  */
52
+ import { readFileSync } from "node:fs";
21
53
  import { chromium } from "playwright";
22
54
  import { createServer } from "vite";
23
55
 
24
- const RED = "\x1b[31m", GRN = "\x1b[32m", DIM = "\x1b[2m", OFF = "\x1b[0m";
25
- const server = await createServer({ server: { port: 5199 }, logLevel: "silent" });
56
+ const RED = "\x1b[31m", GRN = "\x1b[32m", YEL = "\x1b[33m", DIM = "\x1b[2m", BOLD = "\x1b[1m", OFF = "\x1b[0m";
57
+ // Vite runs every .css request through its pipeline — including the host's Tailwind 3,
58
+ // which would consume (or refuse) a file carrying its layer names. So /bundle.css is
59
+ // served RAW from disk: the bundle exactly as the package ships it.
60
+ const PKG = new URL("./node_modules/@valiify/dashboard-ui/", import.meta.url);
61
+ const BUNDLE = new URL("./dist/dashboard-ui.css", PKG);
62
+ const rawBundle = {
63
+ name: "serve-bundle-as-shipped",
64
+ configureServer(s) {
65
+ s.middlewares.use((req, res, next) => {
66
+ if (req.url !== "/bundle.css") return next();
67
+ res.setHeader("content-type", "text/css");
68
+ res.end(readFileSync(BUNDLE));
69
+ });
70
+ },
71
+ };
72
+ const server = await createServer({ plugins: [rawBundle], server: { port: 5199 }, logLevel: "silent" });
26
73
  await server.listen();
27
74
  const browser = await chromium.launch();
28
75
  const page = await browser.newPage();
29
- await page.goto("http://localhost:5199/", { waitUntil: "networkidle" });
76
+
77
+ const PAGES = [
78
+ { path: "/", tag: "import", label: "@import through the host's Tailwind 3 pipeline (host strips our layers)" },
79
+ { path: "/linked.html", tag: "link", label: "<link> to the bundle as shipped, after the host's CSS (layers intact)" },
80
+ ];
81
+
82
+ // Probe the third shape and record what the host pipeline does to a lone import.
83
+ const probe = async (url) => {
84
+ const css = await (await fetch(`http://localhost:5199${url}`, { headers: { accept: "text/css" } })).text();
85
+ const err = css.match(/"message"\s*:\s*"((?:[^"\\]|\\.)*)"/);
86
+ return { layers: (css.match(/@layer (components|base)\s*\{/g) || []).length, bytes: css.length, error: err ? JSON.parse(`"${err[1]}"`).split("\n")[0] : null };
87
+ };
30
88
 
31
89
  const style = (sel, prop) =>
32
90
  page.evaluate(([s, p]) => {
@@ -34,48 +92,158 @@ const style = (sel, prop) =>
34
92
  return el ? getComputedStyle(el).getPropertyValue(p) : null;
35
93
  }, [sel, prop]);
36
94
 
95
+ /** The computed colour a token resolves to on this page — never a literal. */
96
+ const token = (name) =>
97
+ page.evaluate((n) => {
98
+ const probe = document.createElement("span");
99
+ probe.style.color = `var(${n})`;
100
+ document.body.append(probe);
101
+ const v = getComputedStyle(probe).color;
102
+ probe.remove();
103
+ return v;
104
+ }, name);
105
+
37
106
  const results = [];
38
- const check = async (label, sel, prop, assert, why) => {
107
+ const check = async (dir, label, sel, prop, assert, want, why) => {
39
108
  const got = await style(sel, prop);
40
- const ok = got !== null && assert(got);
41
- results.push({ label, sel, prop, got, ok, why });
109
+ results.push({ dir, label, prop, got, want, ok: got !== null && assert(got), why });
42
110
  };
111
+ const eq = (want) => (v) => v === want;
112
+ const px = (want) => (v) => Math.abs(parseFloat(v) - want) < 0.5;
113
+
114
+ // Let a transition settle before reading a colour or an outline (CLAUDE.md).
115
+ const settle = () => page.waitForTimeout(400);
116
+
117
+ for (const pg of PAGES) {
118
+ await page.goto(`http://localhost:5199${pg.path}`, { waitUntil: "networkidle" });
119
+ results.push({ dir: "", label: `── ${pg.label}`, heading: true, ok: true });
120
+ // ── B host element reset vs our controls ────────────────────────────────────
121
+ const primary = await token("--color-primary");
122
+ const inkPrimary = await token("--color-content-primary");
123
+ const contrast = await token("--color-content-contrast");
43
124
 
44
- // 1 — the host's controls are untouched by us. Our .vd-btn sets its own height and
45
- // radius; if any of it reached `.btn`, these would move.
46
- await check("daisyUI .btn keeps its own background", "#daisy-btn", "background-color",
47
- (v) => v !== "rgba(0, 0, 0, 0)", "a transparent daisyUI button means our .vd-btn rules reached it");
48
- await check("daisyUI .badge is not our 15px circle", "#daisy-badge", "height",
49
- (v) => parseFloat(v) !== 15, "15px is .vd-badge's height — ours bled into daisyUI's badge");
50
- await check("daisyUI .input is not our 35px field", "#daisy-input", "height",
51
- (v) => parseFloat(v) !== 35, "35px is .vd-input-field's lg height");
52
- await check("daisyUI .alert keeps a fill", "#daisy-alert", "background-color",
53
- (v) => v !== "rgba(0, 0, 0, 0)", "a bare .vd-alert is transparent — ours reached the host's alert");
54
-
55
- // 2 — ours are untouched by the host.
56
- await check("our .vd-btn is 28px (Figma medium)", "#vd-btn", "height",
57
- (v) => Math.abs(parseFloat(v) - 28) < 1.5, "daisyUI's .btn is 48px; if we read ~48 the host reached us");
58
- await check("our .vd-badge is a 15px circle", "#vd-badge", "height",
59
- (v) => Math.abs(parseFloat(v) - 15) < 1.5, "daisyUI's .badge is taller");
60
- await check("our .vd-card has our radius", "#vd-card", "border-radius",
61
- (v) => v !== "0px", "");
62
- await check("our .vd-tooltip is the dark surface", "#vd-tooltip", "background-color",
63
- (v) => v !== "rgba(0, 0, 0, 0)", "the only dark surface in the library");
64
-
65
- // 3 — the prefixed utility layer resolves, including the custom ones.
66
- await check("vd:type-label-l-bold applies uppercase", "#vd-util", "text-transform",
67
- (v) => v === "uppercase",
68
- "the methodology uses this utility precisely so nobody writes a bare vd:uppercase");
69
- await check("host's bare `text-center` still works", "#host-util", "text-align",
70
- (v) => v === "center", "our prefix must not disturb the host's own utilities");
125
+ // button — .vd-dropdown-field and .vd-btn-primary. The hairline is authored 0.5px;
126
+ // Chrome computes it as 1px (CLAUDE.md, the hairline trap). 0px is the defeat.
127
+ await check(`${pg.tag} B/button`, ".vd-dropdown-field keeps its hairline", "#vd-trigger", "border-top-width", px(1), "1px",
128
+ "preflight `* { border-width: 0 }` won — the bundle's rule is inside a cascade layer");
129
+ await check(`${pg.tag} B/button`, ".vd-dropdown-field keeps its 12px x-padding", "#vd-trigger", "padding-left", px(12), "12px",
130
+ "preflight `button { padding: 0 }` won — layer defeat");
131
+ await check(`${pg.tag} B/button`, ".vd-btn-primary keeps its Primary/Main fill", "#vd-btn-primary", "background-color", eq(primary), primary,
132
+ "preflight `button { background-color: transparent }` won — layer defeat");
133
+ await check(`${pg.tag} B/button`, ".vd-btn-primary keeps its Content/Contrast ink", "#vd-btn-primary", "color", eq(contrast), contrast,
134
+ "preflight `button { color: inherit }` won — the label inherited the host's purple onto the blue fill");
135
+ await check(`${pg.tag} B/button`, ".vd-btn-primary is 12.5px Action M, not the host body's 17px", "#vd-btn-primary", "font-size", px(12.5), "12.5px",
136
+ "preflight `button { font-size: 100% }` won — layer defeat");
137
+
138
+ // input — .vd-input inside .vd-input-field. The host body is 17px / 2 / purple.
139
+ await check(`${pg.tag} B/input`, ".vd-input is 13px Body 1, not the host body's 17px", "#vd-input", "font-size", px(13), "13px",
140
+ "preflight `input { font-size: 100% }` won — layer defeat (or the field wrapper lost its own type, which the input inherits)");
141
+ await check(`${pg.tag} B/input`, ".vd-input line-height is 19.5px, not the host's 34px", "#vd-input", "line-height", px(19.5), "19.5px",
142
+ "preflight `input { line-height: inherit }` won — layer defeat");
143
+ await check(`${pg.tag} B/input`, ".vd-input ink is Content/Primary, not the host's purple", "#vd-input", "color", eq(inkPrimary), inkPrimary,
144
+ "preflight `input { color: inherit }` won — layer defeat");
145
+ await check(`${pg.tag} B/input`, ".vd-input-field keeps its hairline", "#vd-input-box", "border-top-width", px(1), "1px",
146
+ "preflight `* { border-width: 0 }` won — layer defeat");
147
+
148
+ // textarea — .vd-textarea inside .vd-textarea-field
149
+ await check(`${pg.tag} B/textarea`, ".vd-textarea-field keeps its hairline", "#vd-textarea-box", "border-top-width", px(1), "1px",
150
+ "preflight `* { border-width: 0 }` won — layer defeat");
151
+ await check(`${pg.tag} B/textarea`, ".vd-textarea is 13px Body 1, not the host body's 17px", "#vd-textarea", "font-size", px(13), "13px",
152
+ "preflight `textarea { font-size: 100% }` won — layer defeat");
153
+ await check(`${pg.tag} B/textarea`, ".vd-textarea line-height is 19.5px, not the host's 34px", "#vd-textarea", "line-height", px(19.5), "19.5px",
154
+ "preflight `textarea { line-height: inherit }` won — layer defeat");
155
+ await check(`${pg.tag} B/textarea`, ".vd-textarea ink is Content/Primary, not the host's purple", "#vd-textarea", "color", eq(inkPrimary), inkPrimary,
156
+ "preflight `textarea { color: inherit }` won — layer defeat");
157
+
158
+ // select — the library ships no <select> component (DropdownField is a <button>), so
159
+ // there is nothing preflight can defeat. Assert THAT from the manifest, so this line
160
+ // fails the day one lands and demands a real assertion here instead of silently
161
+ // leaving select uncovered.
162
+ if (pg.tag === "import") {
163
+ const manifest = JSON.parse(readFileSync(new URL("./class-manifest.json", PKG), "utf8"));
164
+ const KNOWN_NOT_SELECTS = /^vd-(radio-select|segment-selector)(-|$)/; // a <label> radio and a <div> radiogroup frame
165
+ const selectish = manifest.components.filter((n) => /select/.test(n) && !KNOWN_NOT_SELECTS.test(n));
166
+ results.push({ dir: "import B/select", label: "no shipped component targets a native <select> (manifest scan)", prop: "manifest",
167
+ got: selectish.length ? selectish.join(" ") : "none", want: "none", ok: selectish.length === 0,
168
+ why: "a select component now exists — add its border/padding/font assertions to this check before shipping it" });
169
+ }
170
+
171
+ // The fingerprint — Tab through the three controls and read the ring where each
172
+ // component paints it. Preflight never touches outline, so the ring survives even
173
+ // when the border does not; seeing both on one control is the layer-defeat signature.
174
+ await page.click("body", { position: { x: 1, y: 1 } });
175
+ const rings = [
176
+ ["button", "#vd-trigger", ".vd-dropdown-field:focus-visible ring"],
177
+ ["input", "#vd-input-box", ".vd-input-field:focus-within ring"],
178
+ ["textarea", "#vd-textarea-box", ".vd-textarea-field:focus-within ring"],
179
+ ];
180
+ for (const [ctrl, sel, label] of rings) {
181
+ await page.keyboard.press("Tab");
182
+ await settle();
183
+ await check(`${pg.tag} B/${ctrl}`, `${label} is 2px`, sel, "outline-width", px(2), "2px",
184
+ "the focus ring itself is missing — a different bug from the layer defeat");
185
+ }
186
+
187
+ // ── A class-name collisions, both ways ──────────────────────────────────────
188
+ await check(`${pg.tag} A`, "daisyUI .btn keeps its own fill", "#daisy-btn", "background-color", (v) => v !== "rgba(0, 0, 0, 0)", "not transparent",
189
+ "a transparent daisyUI button means our .vd-btn rules reached it");
190
+ await check(`${pg.tag} A`, "daisyUI .badge is not our 15px circle", "#daisy-badge", "height", (v) => !px(15)(v), "≠15px",
191
+ "15px is .vd-badge's height — ours bled into daisyUI's badge");
192
+ await check(`${pg.tag} A`, "daisyUI .input is not our 35px field", "#daisy-input", "height", (v) => !px(35)(v), "≠35px",
193
+ "35px is .vd-input-field's lg height");
194
+ await check(`${pg.tag} A`, "daisyUI .alert keeps a fill", "#daisy-alert", "background-color", (v) => v !== "rgba(0, 0, 0, 0)", "not transparent",
195
+ "a bare .vd-alert is transparent — ours reached the host's alert");
196
+ await check(`${pg.tag} A`, "our .vd-btn is 28px (Figma medium), not daisyUI's 48px", "#vd-btn", "height", px(28), "28px",
197
+ "daisyUI's .btn is 48px; if we read ~48 the host reached us");
198
+ await check(`${pg.tag} A`, "our .vd-badge is a 15px circle", "#vd-badge", "height", px(15), "15px", "daisyUI's .badge is taller");
199
+ await check(`${pg.tag} A`, "our .vd-card has our radius", "#vd-card", "border-radius", (v) => v !== "0px", "≠0px", "");
200
+ await check(`${pg.tag} A`, "our .vd-tooltip is the dark surface", "#vd-tooltip", "background-color", (v) => v !== "rgba(0, 0, 0, 0)", "not transparent",
201
+ "the only dark surface in the library");
202
+
203
+ // ── the prefixed utility layer resolves, and the host's does too ─────────────
204
+ await check(`${pg.tag} utils`, "vd:type-label-l-bold applies uppercase", "#vd-util", "text-transform", eq("uppercase"), "uppercase",
205
+ "the methodology uses this utility precisely so nobody writes a bare vd:uppercase");
206
+ await check(`${pg.tag} utils`, "host's bare `text-center` still works", "#host-util", "text-align", eq("center"), "center",
207
+ "our prefix must not disturb the host's own utilities");
208
+ }
209
+
210
+ const probes = { styles: await probe("/src/styles.css"), linked: await probe("/bundle.css"), onlyImport: await probe("/src/only-import.css") };
211
+ // The third load path, asserted: the bundle as the host's OWN CSS entry through
212
+ // Tailwind 3's PostCSS. Tailwind 3 refuses a file carrying `@layer components {` or
213
+ // `@layer base {` without the matching `@tailwind` directive — so a layered bundle
214
+ // cannot be imported on its own at all.
215
+ results.push({ dir: "", label: "── the bundle as a lone @import through the host's PostCSS (no @tailwind directives)", heading: true, ok: true });
216
+ results.push({ dir: "lone import", label: "Tailwind 3 processes the file instead of refusing it", prop: "postcss",
217
+ got: probes.onlyImport.error ? `REFUSED — ${probes.onlyImport.error}` : `${probes.onlyImport.bytes} B served`, want: "served", ok: !probes.onlyImport.error,
218
+ why: "the bundle carries a Tailwind-3 layer name (`@layer components {` / `@layer base {`) with no matching @tailwind directive, so it cannot be the host's own CSS entry" });
71
219
 
72
220
  await browser.close();
73
221
  await server.close();
74
222
 
75
- const failed = results.filter((r) => !r.ok);
223
+ console.log(`\n${BOLD}dashboard-ui inside Tailwind 3 + daisyUI 4${OFF}\n`);
224
+ let dir = "";
76
225
  for (const r of results) {
77
- console.log(` ${r.ok ? GRN + "PASS" : RED + "FAIL"}${OFF} ${r.label} ${DIM}${r.prop}=${r.got}${OFF}`);
226
+ if (r.heading) { console.log(`\n ${BOLD}${r.label}${OFF}`); dir = ""; continue; }
227
+ if (r.dir !== dir) { dir = r.dir; console.log(` ${DIM}${dir}${OFF}`); }
228
+ console.log(` ${r.ok ? GRN + "PASS" : RED + "FAIL"}${OFF} ${r.label} ${DIM}${r.prop}=${r.got} (want ${r.want})${OFF}`);
78
229
  if (!r.ok && r.why) console.log(`${DIM} ${r.why}${OFF}`);
79
230
  }
80
- console.log(`\n ${failed.length ? RED : GRN}${results.length - failed.length}/${results.length} passed${OFF}\n`);
231
+
232
+ console.log(`\n ${DIM}what reached the browser:${OFF}`);
233
+ console.log(` ${DIM} /src/styles.css import inside the @tailwind file → ${probes.styles.layers} native @layer components/base block(s), ${probes.styles.bytes} B${OFF}`);
234
+ console.log(` ${DIM} /bundle.css <link>, served raw → ${probes.linked.layers} native @layer components/base block(s), ${probes.linked.bytes} B${OFF}`);
235
+ console.log(` ${DIM} /src/only-import.css lone import through the pipeline → ${probes.onlyImport.error ? "REFUSED — " + probes.onlyImport.error : probes.onlyImport.layers + " native @layer components/base block(s), " + probes.onlyImport.bytes + " B"}${OFF}`);
236
+
237
+ // Name the signature when it is present: ring intact, border gone, same control.
238
+ for (const pg of PAGES) for (const ctrl of ["button", "input", "textarea"]) {
239
+ const mine = results.filter((r) => r.dir === `${pg.tag} B/${ctrl}`);
240
+ const ring = mine.find((r) => r.prop === "outline-width");
241
+ const border = mine.find((r) => r.prop === "border-top-width");
242
+ if (ring?.ok && border && !border.ok)
243
+ console.log(`\n ${YEL}layer-defeat signature on ${ctrl} (${pg.tag}):${OFF} focus ring survives (${ring.got}) while the border is gone (${border.got}). Preflight never touches outline; it zeroes border-width on \`*\`. The component rule is inside a cascade layer.`);
244
+ }
245
+
246
+ const real = results.filter((r) => !r.heading);
247
+ const failed = real.filter((r) => !r.ok);
248
+ console.log(`\n ${failed.length ? RED : GRN}${real.length - failed.length}/${real.length} passed${OFF}\n`);
81
249
  process.exit(failed.length ? 1 : 0);
@@ -2,41 +2,68 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <title>dashboard-ui + daisyUI — collision check</title>
5
+ <title>dashboard-ui + Tailwind 3 + daisyUI 4 — no-bleed check</title>
6
6
  <link rel="stylesheet" href="/src/styles.css" />
7
7
  </head>
8
- <body class="p-8 space-y-6">
8
+ <body class="p-8 space-y-8">
9
9
  <!--
10
- Every pair below is a name both libraries own. daisyUI keeps the bare
11
- spelling; ours carries vd-. If the namespace works, each pair renders as two
12
- visibly different controls and neither library's rules touch the other's node.
10
+ DIRECTION B — the host's ELEMENT RESET must not defeat our component rules.
11
+ Tailwind 3 preflight touches button, input, select and textarea (and `*` for
12
+ border-width). These controls come FIRST in the DOM so the check can Tab
13
+ through them in order and read the focus ring where each component paints it.
14
+ The fingerprint of a cascade-layer defeat: the outline survives (preflight never
15
+ touches outline) while the border does not.
13
16
  -->
14
- <section class="space-y-2">
15
- <h2 class="text-lg font-bold">btn</h2>
16
- <button id="daisy-btn" class="btn btn-primary">daisyUI</button>
17
- <button id="vd-btn" class="vd-btn vd-btn-primary">dashboard-ui</button>
17
+ <section class="space-y-3">
18
+ <h2 class="text-lg font-bold">host element reset vs our controls</h2>
19
+
20
+ <!-- button -->
21
+ <button id="vd-trigger" class="vd-dropdown-field" type="button" aria-haspopup="listbox" aria-expanded="false">
22
+ <span class="vd-dropdown-field-placeholder">Select a frequency</span>
23
+ </button>
24
+
25
+ <!-- input (the ring is painted on the field box) -->
26
+ <div class="vd-input-container">
27
+ <div id="vd-input-box" class="vd-input-field">
28
+ <input id="vd-input" class="vd-input" type="text" value="Jane" />
29
+ </div>
30
+ </div>
31
+
32
+ <!-- textarea (the ring is painted on the field box) -->
33
+ <div class="vd-textarea-container">
34
+ <div id="vd-textarea-box" class="vd-textarea-field">
35
+ <textarea id="vd-textarea" class="vd-textarea" rows="2">Anything else?</textarea>
36
+ </div>
37
+ </div>
38
+
39
+ <!-- select: the library ships NO select component. The check asserts that from
40
+ the manifest, so the day one lands this section fails until it is covered. -->
41
+ <select id="host-select" class="select select-bordered"><option>daisyUI select</option></select>
42
+
43
+ <button id="vd-btn-primary" class="vd-btn vd-btn-primary" type="button">Continue</button>
18
44
  </section>
19
45
 
20
- <section class="space-y-2">
21
- <h2 class="text-lg font-bold">badge / card / alert</h2>
46
+ <!--
47
+ DIRECTION A — class-name collisions. Every pair is a name daisyUI owns; ours
48
+ carries vd-. Both must keep their own look.
49
+ -->
50
+ <section class="space-y-3">
51
+ <h2 class="text-lg font-bold">daisyUI names vs ours</h2>
52
+ <button id="daisy-btn" class="btn btn-primary">daisyUI</button>
53
+ <button id="vd-btn" class="vd-btn vd-btn-outline" type="button">dashboard-ui</button>
22
54
  <span id="daisy-badge" class="badge badge-primary">daisyUI</span>
23
55
  <span id="vd-badge" class="vd-badge vd-badge-primary">3</span>
24
56
  <div id="daisy-card" class="card bg-base-200 p-4">daisyUI card</div>
25
57
  <div id="vd-card" class="vd-card">dashboard-ui card</div>
26
58
  <div id="daisy-alert" class="alert">daisyUI alert</div>
27
59
  <div id="vd-alert" class="vd-alert vd-alert-info">dashboard-ui alert</div>
28
- </section>
29
-
30
- <section class="space-y-2">
31
- <h2 class="text-lg font-bold">input / checkbox / tooltip</h2>
32
60
  <input id="daisy-input" class="input input-bordered" value="daisyUI" />
33
- <div class="vd-input-field"><input id="vd-input" class="vd-input" value="dashboard-ui" /></div>
34
61
  <input id="daisy-checkbox" type="checkbox" class="checkbox" />
35
62
  <span id="vd-tooltip" class="vd-tooltip"><p class="vd-tooltip-content">ours</p></span>
36
63
  </section>
37
64
 
38
65
  <!-- the utility layer: ours is vd:-prefixed, the host's is bare -->
39
- <section class="space-y-2">
66
+ <section class="space-y-3">
40
67
  <h2 class="text-lg font-bold">utilities</h2>
41
68
  <p id="host-util" class="text-center">host Tailwind 3 utility</p>
42
69
  <p id="vd-util" class="vd:text-content-tertiary vd:type-label-l-bold">ours, prefixed</p>
@@ -0,0 +1,74 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>dashboard-ui + Tailwind 3 + daisyUI 4 — no-bleed check (linked bundle)</title>
6
+ <link rel="stylesheet" href="/src/host.css" />
7
+ <!-- the bundle AS SHIPPED, after the host reset, untouched by the host pipeline -->
8
+ <link rel="stylesheet" href="/bundle.css" />
9
+ </head>
10
+ <body class="p-8 space-y-8">
11
+ <!--
12
+ DIRECTION B — the host's ELEMENT RESET must not defeat our component rules.
13
+ Tailwind 3 preflight touches button, input, select and textarea (and `*` for
14
+ border-width). These controls come FIRST in the DOM so the check can Tab
15
+ through them in order and read the focus ring where each component paints it.
16
+ The fingerprint of a cascade-layer defeat: the outline survives (preflight never
17
+ touches outline) while the border does not.
18
+ -->
19
+ <section class="space-y-3">
20
+ <h2 class="text-lg font-bold">host element reset vs our controls</h2>
21
+
22
+ <!-- button -->
23
+ <button id="vd-trigger" class="vd-dropdown-field" type="button" aria-haspopup="listbox" aria-expanded="false">
24
+ <span class="vd-dropdown-field-placeholder">Select a frequency</span>
25
+ </button>
26
+
27
+ <!-- input (the ring is painted on the field box) -->
28
+ <div class="vd-input-container">
29
+ <div id="vd-input-box" class="vd-input-field">
30
+ <input id="vd-input" class="vd-input" type="text" value="Jane" />
31
+ </div>
32
+ </div>
33
+
34
+ <!-- textarea (the ring is painted on the field box) -->
35
+ <div class="vd-textarea-container">
36
+ <div id="vd-textarea-box" class="vd-textarea-field">
37
+ <textarea id="vd-textarea" class="vd-textarea" rows="2">Anything else?</textarea>
38
+ </div>
39
+ </div>
40
+
41
+ <!-- select: the library ships NO select component. The check asserts that from
42
+ the manifest, so the day one lands this section fails until it is covered. -->
43
+ <select id="host-select" class="select select-bordered"><option>daisyUI select</option></select>
44
+
45
+ <button id="vd-btn-primary" class="vd-btn vd-btn-primary" type="button">Continue</button>
46
+ </section>
47
+
48
+ <!--
49
+ DIRECTION A — class-name collisions. Every pair is a name daisyUI owns; ours
50
+ carries vd-. Both must keep their own look.
51
+ -->
52
+ <section class="space-y-3">
53
+ <h2 class="text-lg font-bold">daisyUI names vs ours</h2>
54
+ <button id="daisy-btn" class="btn btn-primary">daisyUI</button>
55
+ <button id="vd-btn" class="vd-btn vd-btn-outline" type="button">dashboard-ui</button>
56
+ <span id="daisy-badge" class="badge badge-primary">daisyUI</span>
57
+ <span id="vd-badge" class="vd-badge vd-badge-primary">3</span>
58
+ <div id="daisy-card" class="card bg-base-200 p-4">daisyUI card</div>
59
+ <div id="vd-card" class="vd-card">dashboard-ui card</div>
60
+ <div id="daisy-alert" class="alert">daisyUI alert</div>
61
+ <div id="vd-alert" class="vd-alert vd-alert-info">dashboard-ui alert</div>
62
+ <input id="daisy-input" class="input input-bordered" value="daisyUI" />
63
+ <input id="daisy-checkbox" type="checkbox" class="checkbox" />
64
+ <span id="vd-tooltip" class="vd-tooltip"><p class="vd-tooltip-content">ours</p></span>
65
+ </section>
66
+
67
+ <!-- the utility layer: ours is vd:-prefixed, the host's is bare -->
68
+ <section class="space-y-3">
69
+ <h2 class="text-lg font-bold">utilities</h2>
70
+ <p id="host-util" class="text-center">host Tailwind 3 utility</p>
71
+ <p id="vd-util" class="vd:text-content-tertiary vd:type-label-l-bold">ours, prefixed</p>
72
+ </section>
73
+ </body>
74
+ </html>