@valiify/dashboard-ui 0.1.2 → 0.2.1
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.
- package/CHANGELOG.md +493 -4
- package/CLAUDE.md +884 -768
- package/COMPONENTS.md +520 -520
- package/GETTING_STARTED.md +63 -14
- package/QUICK_REFERENCE.md +22 -22
- package/README.md +45 -6
- package/TROUBLESHOOTING.md +46 -6
- package/class-manifest.json +664 -0
- package/design-methodology/dashboard.md +496 -0
- package/dist/dashboard-ui.css +4891 -0
- package/dist/index.css +502 -502
- package/examples/README.md +42 -0
- package/examples/basic/index.html +8 -8
- package/examples/daisyui-starter/README.md +58 -0
- package/examples/daisyui-starter/check-no-bleed.mjs +249 -0
- package/examples/daisyui-starter/index.html +72 -0
- package/examples/daisyui-starter/linked.html +74 -0
- package/examples/daisyui-starter/package-lock.json +2221 -0
- package/examples/daisyui-starter/package.json +22 -0
- package/examples/daisyui-starter/postcss.config.js +1 -0
- package/examples/daisyui-starter/src/host.css +14 -0
- package/examples/daisyui-starter/src/only-import.css +4 -0
- package/examples/daisyui-starter/src/styles.css +36 -0
- package/examples/daisyui-starter/tailwind.config.js +13 -0
- package/examples/postcss-starter/index.html +8 -8
- package/examples/postcss-starter/package.json +1 -1
- package/examples/sveltekit-starter/README.md +32 -0
- package/examples/sveltekit-starter/check-scoped-styles.mjs +103 -0
- package/examples/sveltekit-starter/package-lock.json +1300 -0
- package/examples/sveltekit-starter/package.json +24 -0
- package/examples/sveltekit-starter/src/app.css +17 -0
- package/examples/sveltekit-starter/src/app.html +11 -0
- package/examples/sveltekit-starter/src/lib/GlobalReset.svelte +20 -0
- package/examples/sveltekit-starter/src/lib/ScopedRemedy.svelte +27 -0
- package/examples/sveltekit-starter/src/lib/ScopedReset.svelte +22 -0
- package/examples/sveltekit-starter/src/routes/+layout.svelte +6 -0
- package/examples/sveltekit-starter/src/routes/+page.svelte +10 -0
- package/examples/sveltekit-starter/svelte.config.js +4 -0
- package/examples/sveltekit-starter/vite.config.js +6 -0
- package/examples/vite-starter/README.md +4 -4
- package/examples/vite-starter/package.json +1 -1
- package/examples/vite-starter/src/main.js +41 -41
- package/package.json +21 -4
- package/src/build/components.css +35 -0
- package/src/build/utilities.css +46 -0
- package/src/components/ICON-SYSTEM.md +39 -39
- package/src/components/alert.css +26 -26
- package/src/components/avatar.css +9 -9
- package/src/components/breadcrumbs.css +15 -15
- package/src/components/button.css +21 -21
- package/src/components/card.css +10 -10
- package/src/components/checkbox.css +21 -21
- package/src/components/chip.css +43 -43
- package/src/components/data-row.css +19 -19
- package/src/components/divider.css +23 -23
- package/src/components/dropdown-field.css +34 -34
- package/src/components/dropdown-menu.css +12 -12
- package/src/components/field-verification.css +25 -25
- package/src/components/filter-segment.css +20 -20
- package/src/components/icon-button.css +11 -11
- package/src/components/icon.css +18 -18
- package/src/components/input.css +29 -29
- package/src/components/link.css +28 -28
- package/src/components/loading-indicator.css +20 -20
- package/src/components/loading-inline.css +8 -8
- package/src/components/menu-item.css +28 -28
- package/src/components/modal.css +36 -36
- package/src/components/navigation-rail.css +95 -95
- package/src/components/pagination-item.css +22 -22
- package/src/components/pagination.css +24 -24
- package/src/components/pill.css +14 -14
- package/src/components/progress-bar.css +28 -28
- package/src/components/radio-select.css +13 -13
- package/src/components/section-marker.css +12 -12
- package/src/components/segment-selector.css +9 -9
- package/src/components/sensitive-data.css +8 -8
- package/src/components/skeleton.css +29 -29
- package/src/components/step.css +14 -14
- package/src/components/stepper.css +15 -15
- package/src/components/switch.css +12 -12
- package/src/components/tabs.css +40 -40
- package/src/components/tag.css +20 -20
- package/src/components/text-button.css +24 -24
- package/src/components/textarea.css +23 -23
- package/src/components/toast.css +29 -29
- package/src/components/tooltip.css +11 -11
- package/src/icons/README.md +16 -10
- package/src/icons/sprite.svg +1 -1
- package/src/themes/valiify-tokens.css +285 -0
- package/src/themes/valiify-type-prefixed.css +37 -0
- package/src/utilities/index.css +1 -1
- package/src/utility-surface.css +321 -0
- package/types/components.d.ts +235 -236
package/examples/README.md
CHANGED
|
@@ -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
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<!-- Example: Sign-in Form Card -->
|
|
40
|
-
<div class="card" style="max-width: 400px; width: 100%">
|
|
41
|
-
<h1 class="card-title" style="font-size: 24px; margin-bottom: 8px">
|
|
40
|
+
<div class="vd-card" style="max-width: 400px; width: 100%">
|
|
41
|
+
<h1 class="vd-card-title" style="font-size: 24px; margin-bottom: 8px">
|
|
42
42
|
Welcome Back
|
|
43
43
|
</h1>
|
|
44
|
-
<p class="card-body" style="margin-bottom: 24px">
|
|
44
|
+
<p class="vd-card-body" style="margin-bottom: 24px">
|
|
45
45
|
Sign in to your Valiify Dashboard account.
|
|
46
46
|
</p>
|
|
47
47
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</label>
|
|
62
62
|
<input
|
|
63
63
|
type="email"
|
|
64
|
-
class="input"
|
|
64
|
+
class="vd-input"
|
|
65
65
|
placeholder="Enter your email"
|
|
66
66
|
value="user@valiify.com"
|
|
67
67
|
/>
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
</label>
|
|
83
83
|
<input
|
|
84
84
|
type="password"
|
|
85
|
-
class="input"
|
|
85
|
+
class="vd-input"
|
|
86
86
|
placeholder="Enter your password"
|
|
87
87
|
/>
|
|
88
88
|
</div>
|
|
@@ -109,13 +109,13 @@
|
|
|
109
109
|
<!-- Action Buttons -->
|
|
110
110
|
<div style="display: flex; gap: 8px; margin-top: 8px">
|
|
111
111
|
<button
|
|
112
|
-
class="btn btn-primary"
|
|
112
|
+
class="vd-btn vd-btn-primary"
|
|
113
113
|
style="flex: 1"
|
|
114
114
|
onclick="alert('Sign in clicked')"
|
|
115
115
|
>
|
|
116
116
|
Sign In
|
|
117
117
|
</button>
|
|
118
|
-
<button class="btn btn-outline" onclick="alert('Cancel clicked')">
|
|
118
|
+
<button class="vd-btn vd-btn-outline" onclick="alert('Cancel clicked')">
|
|
119
119
|
Cancel
|
|
120
120
|
</button>
|
|
121
121
|
</div>
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
gap: 8px;
|
|
148
148
|
"
|
|
149
149
|
>
|
|
150
|
-
<button class="btn btn-sm btn-outline" onclick="alert('This is a demo!')">
|
|
150
|
+
<button class="vd-btn vd-btn-sm vd-btn-outline" onclick="alert('This is a demo!')">
|
|
151
151
|
View Demo Info
|
|
152
152
|
</button>
|
|
153
153
|
</div>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# dashboard-ui + Tailwind 3 + daisyUI 4
|
|
2
|
+
|
|
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.
|
|
6
|
+
|
|
7
|
+
`npm run check` renders the page in headless Chromium and asserts **computed
|
|
8
|
+
styles** in two directions. They are different bugs:
|
|
9
|
+
|
|
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.
|
|
24
|
+
|
|
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.
|
|
28
|
+
|
|
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.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install
|
|
53
|
+
npm run check
|
|
54
|
+
npm run dev
|
|
55
|
+
```
|
|
56
|
+
|
|
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.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* No-bleed assertion: dashboard-ui and Tailwind 3 + daisyUI 4 in one document.
|
|
4
|
+
*
|
|
5
|
+
* npm run check
|
|
6
|
+
*
|
|
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.
|
|
12
|
+
*
|
|
13
|
+
* Two directions, and they are different bugs:
|
|
14
|
+
*
|
|
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.
|
|
51
|
+
*/
|
|
52
|
+
import { readFileSync } from "node:fs";
|
|
53
|
+
import { chromium } from "playwright";
|
|
54
|
+
import { createServer } from "vite";
|
|
55
|
+
|
|
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" });
|
|
73
|
+
await server.listen();
|
|
74
|
+
const browser = await chromium.launch();
|
|
75
|
+
const page = await browser.newPage();
|
|
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
|
+
};
|
|
88
|
+
|
|
89
|
+
const style = (sel, prop) =>
|
|
90
|
+
page.evaluate(([s, p]) => {
|
|
91
|
+
const el = document.querySelector(s);
|
|
92
|
+
return el ? getComputedStyle(el).getPropertyValue(p) : null;
|
|
93
|
+
}, [sel, prop]);
|
|
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
|
+
|
|
106
|
+
const results = [];
|
|
107
|
+
const check = async (dir, label, sel, prop, assert, want, why) => {
|
|
108
|
+
const got = await style(sel, prop);
|
|
109
|
+
results.push({ dir, label, prop, got, want, ok: got !== null && assert(got), why });
|
|
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");
|
|
124
|
+
|
|
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" });
|
|
219
|
+
|
|
220
|
+
await browser.close();
|
|
221
|
+
await server.close();
|
|
222
|
+
|
|
223
|
+
console.log(`\n${BOLD}dashboard-ui inside Tailwind 3 + daisyUI 4${OFF}\n`);
|
|
224
|
+
let dir = "";
|
|
225
|
+
for (const r of results) {
|
|
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}`);
|
|
229
|
+
if (!r.ok && r.why) console.log(`${DIM} ${r.why}${OFF}`);
|
|
230
|
+
}
|
|
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`);
|
|
249
|
+
process.exit(failed.length ? 1 : 0);
|
|
@@ -0,0 +1,72 @@
|
|
|
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</title>
|
|
6
|
+
<link rel="stylesheet" href="/src/styles.css" />
|
|
7
|
+
</head>
|
|
8
|
+
<body class="p-8 space-y-8">
|
|
9
|
+
<!--
|
|
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.
|
|
16
|
+
-->
|
|
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>
|
|
44
|
+
</section>
|
|
45
|
+
|
|
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>
|
|
54
|
+
<span id="daisy-badge" class="badge badge-primary">daisyUI</span>
|
|
55
|
+
<span id="vd-badge" class="vd-badge vd-badge-primary">3</span>
|
|
56
|
+
<div id="daisy-card" class="card bg-base-200 p-4">daisyUI card</div>
|
|
57
|
+
<div id="vd-card" class="vd-card">dashboard-ui card</div>
|
|
58
|
+
<div id="daisy-alert" class="alert">daisyUI alert</div>
|
|
59
|
+
<div id="vd-alert" class="vd-alert vd-alert-info">dashboard-ui alert</div>
|
|
60
|
+
<input id="daisy-input" class="input input-bordered" value="daisyUI" />
|
|
61
|
+
<input id="daisy-checkbox" type="checkbox" class="checkbox" />
|
|
62
|
+
<span id="vd-tooltip" class="vd-tooltip"><p class="vd-tooltip-content">ours</p></span>
|
|
63
|
+
</section>
|
|
64
|
+
|
|
65
|
+
<!-- the utility layer: ours is vd:-prefixed, the host's is bare -->
|
|
66
|
+
<section class="space-y-3">
|
|
67
|
+
<h2 class="text-lg font-bold">utilities</h2>
|
|
68
|
+
<p id="host-util" class="text-center">host Tailwind 3 utility</p>
|
|
69
|
+
<p id="vd-util" class="vd:text-content-tertiary vd:type-label-l-bold">ours, prefixed</p>
|
|
70
|
+
</section>
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|
|
@@ -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>
|