@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.
- package/CHANGELOG.md +174 -2
- package/CLAUDE.md +124 -3
- package/GETTING_STARTED.md +87 -0
- package/README.md +49 -3
- package/TROUBLESHOOTING.md +40 -0
- package/dist/dashboard-ui.css +501 -507
- package/examples/README.md +42 -0
- package/examples/daisyui-starter/README.md +47 -24
- package/examples/daisyui-starter/check-no-bleed.mjs +216 -48
- package/examples/daisyui-starter/index.html +44 -17
- package/examples/daisyui-starter/linked.html +74 -0
- package/examples/daisyui-starter/package.json +1 -1
- 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 +21 -5
- package/examples/daisyui-starter/tailwind.config.js +7 -6
- 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/package.json +1 -1
- package/package.json +6 -2
- package/src/build/components.css +6 -0
- package/src/build/utilities.css +6 -2
- package/src/reset.css +213 -0
package/CHANGELOG.md
CHANGED
|
@@ -18,8 +18,8 @@ change quietly:
|
|
|
18
18
|
`--text-*`, `--shadow-*`, and `--ring-*` custom property, **and the Tailwind
|
|
19
19
|
utilities generated from them** (`bg-approved`, `rounded-control`,
|
|
20
20
|
`text-body-1`, …).
|
|
21
|
-
3. **Entry points** — `.`, `./index.css`, `./styles.css`, `./
|
|
22
|
-
`./icons/sprite.svg`, `./manifest`, `./types`.
|
|
21
|
+
3. **Entry points** — `.`, `./index.css`, `./styles.css`, `./reset.css`, `./source`,
|
|
22
|
+
`./fonts`, `./icons/sprite.svg`, `./manifest`, `./types`.
|
|
23
23
|
4. **Custom utilities** — `focus-ring`, `type-label-*`. Unprefixed on `./source`;
|
|
24
24
|
on `./styles.css` only the ones in the closed set, spelled `vd:`.
|
|
25
25
|
|
|
@@ -34,6 +34,96 @@ whole point of tokens. Changing its _name_ is.
|
|
|
34
34
|
When a rename is genuinely needed, ship the new name alongside the old one, note
|
|
35
35
|
the deprecation here, and remove the old name in a later release.
|
|
36
36
|
|
|
37
|
+
## 0.3.0
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- **`./reset.css` — an optional, opt-in reset for the prebuilt bundle.** Nothing
|
|
42
|
+
imports it for you; it is not part of `./styles.css`.
|
|
43
|
+
|
|
44
|
+
**Why.** `dist/dashboard-ui.css` ships no Preflight, which is what makes it safe to
|
|
45
|
+
drop into a host that already has a reset. The flip side had never been measured: a
|
|
46
|
+
page whose only stylesheet is the bundle gets the browser's defaults. Measured over
|
|
47
|
+
every documented example in CLAUDE.md plus `tests/fixtures/generated-page.html`,
|
|
48
|
+
**479 of 582 elements rendered `content-box`** and **52 of 146 Figma-pinned
|
|
49
|
+
dimensions were wrong**:
|
|
50
|
+
|
|
51
|
+
| Element | Designed | Bundle alone |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| `.vd-input-field.vd-input-sm` | 25px | 38px |
|
|
54
|
+
| `.vd-toast-simple` | 35px | 57px |
|
|
55
|
+
| `.vd-data-row` | 38px | 63px |
|
|
56
|
+
| `.vd-chip` | 20px | 30px |
|
|
57
|
+
| `.vd-avatar-md` | 20px | 22px |
|
|
58
|
+
| `.vd-switch` | 32×18 | 36×22 |
|
|
59
|
+
| `.vd-modal` (width) | 480px | 546px |
|
|
60
|
+
| `.vd-alert` | 88.5px | 137.5px (UA `<p>` margins) |
|
|
61
|
+
| `.vd-tooltip` | 106.5px | 190.5px |
|
|
62
|
+
| `.vd-tab-underline` (width) | 96.1px | 100.1px (UA `<button>` border) |
|
|
63
|
+
| document font | Inter | Times |
|
|
64
|
+
| `a.vd-nav-title` | Content/Primary | link blue |
|
|
65
|
+
|
|
66
|
+
Nine rules, about twenty lines: `border-box`; `body` margin; `html` font-family
|
|
67
|
+
(bound to `--font-sans`) and line-height; font/colour inheritance on form controls;
|
|
68
|
+
the UA border on `<button>`; block margins on `p`, `h1`–`h6` and `hr`; `<hr>`'s own
|
|
69
|
+
border and ink; anchor colour; and `html { color; background-color }` — the document
|
|
70
|
+
default `dist/index.css` already ships and the bundle deliberately cannot.
|
|
71
|
+
|
|
72
|
+
It is **not** a Preflight. Lists, tables, images, fieldsets, form-control appearance,
|
|
73
|
+
placeholder colour and `blockquote`/`figure`/`dl` margins are left alone, because
|
|
74
|
+
nothing measured wrong there and a host is entitled to own them.
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
@import "@valiify/dashboard-ui/reset.css"; /* first */
|
|
78
|
+
@import "@valiify/dashboard-ui/styles.css";
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Skip it inside an app that already resets: rules 1–8 are redundant there, and rule 9
|
|
82
|
+
would repaint a page the host owns.
|
|
83
|
+
|
|
84
|
+
- **`npm run verify:reset` — the gate that makes the above safe to ship**, wired into
|
|
85
|
+
CI. Two gates, both measuring computed styles in headless Chromium over the
|
|
86
|
+
documented markup, both with canaries.
|
|
87
|
+
|
|
88
|
+
**Gate 1: the reset must not defeat the bundle.** `reset.css` is unlayered element
|
|
89
|
+
selectors, and an unlayered rule beats a *layered* one before specificity is
|
|
90
|
+
consulted. Our sibling `@valiify/shortapp-ui` shipped this exact file in its 1.0.0
|
|
91
|
+
while its components were still inside `@layer components`, and its
|
|
92
|
+
`button { color: inherit }` beat `.va-btn-primary`'s white ink — 50 defeats, invisible
|
|
93
|
+
to every gate it had, because all of them checked class names rather than rendered
|
|
94
|
+
output. This bundle has been unlayered since 0.2.1, so its `0,1,0` classes outrank
|
|
95
|
+
these `0,0,1` element rules; the gate asserts it rather than assuming it. Run against
|
|
96
|
+
a deliberately re-layered copy of the bundle it reports **343** defeats.
|
|
97
|
+
|
|
98
|
+
**Gate 2: the reset must still close the gap it exists for.** Gate 1 alone is
|
|
99
|
+
one-sided — an empty file passes it. So the reset + bundle must render the documented
|
|
100
|
+
markup *identically* to `dist/index.css`, the entry that carries Preflight: 485
|
|
101
|
+
elements × 11 properties, currently 0 unexplained differences against 1024 without
|
|
102
|
+
the reset. Each of the nine rules was verified load-bearing by deleting it and
|
|
103
|
+
watching the gate go red.
|
|
104
|
+
|
|
105
|
+
One divergence is deliberate and asserted by name: **`<dialog>` keeps the UA's
|
|
106
|
+
`margin: auto`.** Preflight zeroes margin on `*, ::before, ::after, ::backdrop`,
|
|
107
|
+
which pins a `showModal()`ed `.vd-modal` to the top-left corner — measured in a
|
|
108
|
+
1200×800 viewport, `x=0, y=0` under `dist/index.css` against `x=360` (centred) with
|
|
109
|
+
the reset. Since the Modal docs promise the browser supplies centring, matching the
|
|
110
|
+
reference there would reproduce a defect. `KNOWN_DIVERGENCES` records it, and fails
|
|
111
|
+
in both directions: an unlisted difference fails the gate, and a listed one that
|
|
112
|
+
stops being observed fails it too.
|
|
113
|
+
|
|
114
|
+
- `verify:package` now asserts `./reset.css` reaches a consumer — present in the packed
|
|
115
|
+
tarball, non-empty, and named in the exports map.
|
|
116
|
+
|
|
117
|
+
### Notes
|
|
118
|
+
|
|
119
|
+
- No existing behaviour changes. The three previous entry points are byte-identical in
|
|
120
|
+
contract; `dist/dashboard-ui.css` still ships no Preflight and no `html` rule, and
|
|
121
|
+
`verify:bundle` still fails the build on either.
|
|
122
|
+
- **Reported, not fixed:** Tailwind Preflight's `dialog { margin: 0 }` means a
|
|
123
|
+
`showModal()`ed `.vd-modal` does **not** centre on the `@valiify/dashboard-ui` entry,
|
|
124
|
+
contradicting CLAUDE.md's Modal section. That is a pre-existing defect on that entry,
|
|
125
|
+
out of scope for this release.
|
|
126
|
+
|
|
37
127
|
## Unreleased
|
|
38
128
|
|
|
39
129
|
### Breaking
|
|
@@ -115,6 +205,88 @@ Worth stating precisely, because "the methodology is enforced" reads as one clai
|
|
|
115
205
|
|
|
116
206
|
Both are verified by injection, not by inspection.
|
|
117
207
|
|
|
208
|
+
### Fixed — the prebuilt bundle is now unlayered (the cascade-layer defeat)
|
|
209
|
+
|
|
210
|
+
`dist/dashboard-ui.css` (`./styles.css`) wrapped every component rule in three
|
|
211
|
+
`@layer components` blocks. Any UNLAYERED host rule beat them regardless of
|
|
212
|
+
specificity or source order: Tailwind 3 preflight (`* { border-width: 0 }`, `button {
|
|
213
|
+
background-color: transparent }`, `button, input, textarea { font-size: 100%;
|
|
214
|
+
line-height: inherit; color: inherit; padding: 0 }`), daisyUI 4, a Svelte
|
|
215
|
+
`:global(button)` reset. The `vd-` namespace could not fix this and did not; it is
|
|
216
|
+
not a name collision. Measured on the 0.2.0 artifact under a preflight-shaped host
|
|
217
|
+
reset placed *before* the bundle and at lower specificity: `.vd-btn-primary` lost its
|
|
218
|
+
fill, its white ink (the label inherited the page colour onto the blue), its hairline,
|
|
219
|
+
its padding and its 12.5px type; `.vd-input-field`, `.vd-textarea-field`,
|
|
220
|
+
`.vd-dropdown-field` and `.vd-checkbox-input` lost their hairlines; the textarea took
|
|
221
|
+
the host's type; the active underline tab lost its 2px rule. The fingerprint: a
|
|
222
|
+
control whose **focus ring survives while its border does not** — preflight never
|
|
223
|
+
touches `outline` and zeroes `border-width` on `*`.
|
|
224
|
+
|
|
225
|
+
**Why nothing saw it.** A host that `@import`s the bundle into the file carrying its
|
|
226
|
+
`@tailwind` directives has Tailwind 3 consume our `@layer components` blocks and
|
|
227
|
+
re-emit the rules unlayered, after preflight — the bug vanishes and the library looks
|
|
228
|
+
correct on the path most people test. It breaks on a raw `<link>` to the file, where
|
|
229
|
+
the layers reach the browser intact, and a lone `@import` through Tailwind 3's
|
|
230
|
+
PostCSS was **refused** outright (`@layer components` is used but no matching
|
|
231
|
+
`@tailwind components` directive is present). `examples/daisyui-starter`'s check
|
|
232
|
+
passed 10/10 with the bug present: it had one load path (the import), and it asserted
|
|
233
|
+
only heights, radii and the tooltip fill — properties preflight never touches.
|
|
234
|
+
|
|
235
|
+
**The fix** is a build-time unwrap of pass A in `scripts/build-styles.mjs`: the
|
|
236
|
+
`@layer components` blocks are replaced by their children. `src/components`,
|
|
237
|
+
`./source` and `dist/index.css` keep their layers — for a Tailwind v4 host the layer
|
|
238
|
+
IS the contract (`verify:layers`' original assertion, unchanged). Unlike the sibling
|
|
239
|
+
shortapp library's fix there was no `@layer base` to relocate: pass A never imported
|
|
240
|
+
the `html` default, so the bundle has carried no `html` rule since it was introduced;
|
|
241
|
+
the base check in the build is a guard. `build-manifest.mjs` read component classes
|
|
242
|
+
from inside `@layer components` bodies and would have refused to write the manifest
|
|
243
|
+
after the unwrap; it now walks every rule's selector, and the vocabulary it emits is
|
|
244
|
+
byte-identical.
|
|
245
|
+
|
|
246
|
+
**Behaviour change for consumers of `./styles.css`.** Previously any unlayered
|
|
247
|
+
consumer rule beat any component rule. Now a single-class override (`.my-btn {
|
|
248
|
+
height: 40px }`) still wins when it loads after the bundle — source order — but
|
|
249
|
+
overriding a compound state rule (`.vd-btn-primary:hover`, `.vd-input-md .vd-input`)
|
|
250
|
+
needs matching specificity. Correct for a library you deliberately import; a change
|
|
251
|
+
nonetheless. The library's own `vd:` utilities follow the same arithmetic: they beat
|
|
252
|
+
the 295 single-class component selectors by source order and lose to the 273 compound
|
|
253
|
+
ones. `verify:utility-precedence` (new, in CI) fails when generated markup relies on a
|
|
254
|
+
utility that a compound component selector outranks — none does today.
|
|
255
|
+
|
|
256
|
+
**What the bundle still cannot defend against**, now stated as contract in README,
|
|
257
|
+
GETTING_STARTED and CLAUDE.md: a host rule of HIGHER specificity. A Svelte scoped
|
|
258
|
+
`button { border: 0 }` compiles to `button.svelte-<hash>` (0,1,1) and outranks our
|
|
259
|
+
0,1,0. `examples/sveltekit-starter` asserts that loss on purpose and asserts the
|
|
260
|
+
remedy (`button:not([class*="vd-"])`, or class-scoped resets).
|
|
261
|
+
|
|
262
|
+
### Added — host verification: computed styles inside a foreign app
|
|
263
|
+
|
|
264
|
+
Every existing gate checked class names or the bundle's own text; none rendered the
|
|
265
|
+
bundle inside a host. These do, each with a canary, all in CI:
|
|
266
|
+
|
|
267
|
+
- `scripts/verify-layer-defeat.mjs` + `tests/fixtures/layer-defeat.html` — the repro
|
|
268
|
+
as a gate: one page, one host rule, one library rule toggled only by the `@layer`
|
|
269
|
+
wrapper, then the real bundle under an unlayered `button { border: 0 }`. 2/3 on the
|
|
270
|
+
0.2.0 artifact, 3/3 now.
|
|
271
|
+
- `scripts/verify-layers.mjs` — the inverse assertion on the prebuilt bundle: zero
|
|
272
|
+
`@layer components`, zero `@layer base`, only `@layer properties` may remain, with
|
|
273
|
+
the layered `dist/index.css` as the detector's canary.
|
|
274
|
+
- `scripts/verify-utility-precedence.mjs` — no `vd:` utility in generated markup
|
|
275
|
+
loses to a compound component selector; canaries for both a false negative and the
|
|
276
|
+
type-selector false positive.
|
|
277
|
+
- `examples/daisyui-starter` — rewritten. Tailwind 3 + daisyUI 4 host, computed-style
|
|
278
|
+
assertions per control (button, input, textarea, select-by-manifest) over three load
|
|
279
|
+
paths, naming the layer-defeat fingerprint when it sees it. 40/54 on the 0.2.0
|
|
280
|
+
artifact (26/26 import, 13/26 link, lone import refused); 54/54 now.
|
|
281
|
+
- `examples/sveltekit-starter` — Svelte 5 scoped styles: `:global` reset (must win),
|
|
282
|
+
scoped element selector (documented loss), the remedy. 4/6 on 0.2.0; 6/6 now.
|
|
283
|
+
|
|
284
|
+
Not ported from the sibling library: `verify:reset`. It audits a `reset.css` that
|
|
285
|
+
shortapp ships and that had 50 self-inflicted defeats against its own layered bundle.
|
|
286
|
+
dashboard-ui ships no reset and no `html` rule — the only unlayered non-`vd-` rules
|
|
287
|
+
in the bundle are the two `:root, :host` token blocks — so there is nothing for that
|
|
288
|
+
gate to measure and none was invented.
|
|
289
|
+
|
|
118
290
|
### Full class rename table
|
|
119
291
|
|
|
120
292
|
<details>
|
package/CLAUDE.md
CHANGED
|
@@ -3323,13 +3323,18 @@ CSS-only — there is no Tailwind plugin to register, and no `tailwind.config.js
|
|
|
3323
3323
|
| Entry | You get | You do NOT get |
|
|
3324
3324
|
| --------------------------------------- | --------------------------------------------------------------------------------- | ---------------------------------- |
|
|
3325
3325
|
| `@valiify/dashboard-ui` (prebuilt) | `.vd-*` classes + tokens as CSS custom properties, **plus Preflight and an `html` rule** | token-derived utilities |
|
|
3326
|
-
| `@valiify/dashboard-ui/styles.css` | `.vd-*` classes + tokens + a **closed** `vd:` utility set, **no Preflight, no `html` rule** | utilities outside the closed set |
|
|
3326
|
+
| `@valiify/dashboard-ui/styles.css` | `.vd-*` classes + tokens + a **closed** `vd:` utility set, **no Preflight, no `html` rule, unlayered** | utilities outside the closed set |
|
|
3327
3327
|
| `@valiify/dashboard-ui/source` | the classes **plus** every token utility — `bg-approved`, `rounded-pill`, `type-label-l`, … | — |
|
|
3328
|
+
| `@valiify/dashboard-ui/reset.css` | **optional, opt-in**: the ~20-line floor `./styles.css` needs on a page with no other stylesheet | anything a host is entitled to own |
|
|
3328
3329
|
|
|
3329
3330
|
```css
|
|
3330
3331
|
/* into a host app that already has a reset (Tailwind 3 + daisyUI, etc.) */
|
|
3331
3332
|
@import "@valiify/dashboard-ui/styles.css"; /* FIRST — CSS discards a later @import */
|
|
3332
3333
|
|
|
3334
|
+
/* a standalone page on the host-safe bundle — add the reset, in this order */
|
|
3335
|
+
@import "@valiify/dashboard-ui/reset.css";
|
|
3336
|
+
@import "@valiify/dashboard-ui/styles.css";
|
|
3337
|
+
|
|
3333
3338
|
/* standalone page, our Preflight is welcome */
|
|
3334
3339
|
@import "tailwindcss";
|
|
3335
3340
|
@import "@valiify/dashboard-ui";
|
|
@@ -3339,6 +3344,16 @@ CSS-only — there is no Tailwind plugin to register, and no `tailwind.config.js
|
|
|
3339
3344
|
@import "@valiify/dashboard-ui/source";
|
|
3340
3345
|
```
|
|
3341
3346
|
|
|
3347
|
+
> **`./reset.css` is opt-in and nothing pulls it in for you** (new in 0.3.0). It is
|
|
3348
|
+
> not part of `./styles.css`, because dropping Preflight from that bundle was the
|
|
3349
|
+
> whole point — a reset that arrives uninvited in a daisyUI app is the problem it was
|
|
3350
|
+
> built to avoid. Load it only when the bundle is the ONLY stylesheet on the page;
|
|
3351
|
+
> inside an app that already resets, its first eight rules are redundant and its
|
|
3352
|
+
> ninth (`html { color; background-color }`) would repaint a page the host owns.
|
|
3353
|
+
> Order matters: the reset first, so the bundle's `.vd-*` classes (0,1,0) sit after
|
|
3354
|
+
> and above its element rules (0,0,1). `verify:reset` measures both halves of that
|
|
3355
|
+
> claim in a browser; see **Host verification** below.
|
|
3356
|
+
|
|
3342
3357
|
> **`.` is not host-safe, and that is deliberate.** `dist/index.css` ships full
|
|
3343
3358
|
> Tailwind Preflight plus `html { color; background-color }`. Dropped into an app
|
|
3344
3359
|
> that has its own reset it zeroes every element's margin, padding and border and
|
|
@@ -3346,6 +3361,46 @@ CSS-only — there is no Tailwind plugin to register, and no `tailwind.config.js
|
|
|
3346
3361
|
> `scripts/build-styles.mjs` as a separate artifact. `verify:bundle` asserts the
|
|
3347
3362
|
> absence of both, and `verify:package` re-asserts it on the packed tarball.
|
|
3348
3363
|
|
|
3364
|
+
> **The prebuilt bundle is UNLAYERED; source, `./source` and `dist/index.css`
|
|
3365
|
+
> keep their layers** (decided 2026-09-16). Inside `@layer components`, every
|
|
3366
|
+
> component rule loses to any unlayered host rule before specificity or source
|
|
3367
|
+
> order is consulted — Tailwind 3 preflight (`* { border-width: 0 }`, `button {
|
|
3368
|
+
> background-color: transparent }`, `input, textarea { color: inherit }`), daisyUI
|
|
3369
|
+
> 4, a Svelte `:global()` reset. Measured on the 0.2.0 artifact: `.vd-btn-primary`
|
|
3370
|
+
> lost its fill, ink, hairline, padding and type; every field lost its hairline;
|
|
3371
|
+
> the active tab lost its rule. The `vd-` rename could never have fixed this; it is
|
|
3372
|
+
> not a name collision. `build-styles.mjs` unwraps pass A at build time so
|
|
3373
|
+
> `src/components` stays layered for the Tailwind-v4 entries, where the layer IS
|
|
3374
|
+
> the contract (`verify:layers`' original assertion). There was no `@layer base`
|
|
3375
|
+
> to relocate — pass A never imported `../base`, and the build now fails if it
|
|
3376
|
+
> does. `build-manifest.mjs` walks every rule's selector instead of the bodies of
|
|
3377
|
+
> `@layer components`, which no longer exist in the bundle.
|
|
3378
|
+
>
|
|
3379
|
+
> **It was invisible on the common path.** A host that `@import`s the bundle into
|
|
3380
|
+
> its `@tailwind` file has Tailwind 3 consume the layer blocks and re-emit the
|
|
3381
|
+
> rules unlayered — the bug vanishes, the library looks correct. It broke on a raw
|
|
3382
|
+
> `<link>`, and Tailwind 3 refused a lone `@import` of the file outright.
|
|
3383
|
+
> `examples/daisyui-starter` passed 10/10 with the bug present because it tested
|
|
3384
|
+
> only the import path and only properties preflight never touches; it now tests
|
|
3385
|
+
> all three paths per control and fails the 0.2.0 artifact 40/54.
|
|
3386
|
+
>
|
|
3387
|
+
> **The two-clause host contract** (consumers: README, GETTING_STARTED):
|
|
3388
|
+
>
|
|
3389
|
+
> 1. _Defends against_ any host rule of lower specificity, wherever it sits in
|
|
3390
|
+
> source order, provided the bundle loads after the host's reset.
|
|
3391
|
+
> 2. _Cannot defend against_ a host rule of higher specificity — a Svelte scoped
|
|
3392
|
+
> `button { }` compiles to `button.svelte-hash` (0,1,1) and beats our 0,1,0 —
|
|
3393
|
+
> or a host that wraps its own CSS in a layer. Remedy: scope element resets by
|
|
3394
|
+
> class or exclude library controls (`button:not([class*="vd-"])`).
|
|
3395
|
+
> `examples/sveltekit-starter` asserts the limit as a loss on purpose.
|
|
3396
|
+
>
|
|
3397
|
+
> **Behaviour change for consumers**: a single-class override still wins by
|
|
3398
|
+
> source order when it loads after us; overriding a compound state rule now needs
|
|
3399
|
+
> matching specificity. Our own `vd:` utilities are consumers too — they beat the
|
|
3400
|
+
> 295 single-class component selectors by source order and lose to the 273
|
|
3401
|
+
> compound ones; `verify:utility-precedence` fails when generated markup relies on
|
|
3402
|
+
> the latter (today: none).
|
|
3403
|
+
|
|
3349
3404
|
> **The `vd:` utility set is CLOSED.** It is generated from
|
|
3350
3405
|
> `design-methodology/dashboard.md` by `build-utility-surface.mjs` — whatever the
|
|
3351
3406
|
> methodology does not cite is not emitted, so a page using it renders unstyled
|
|
@@ -3394,10 +3449,14 @@ Completed:
|
|
|
3394
3449
|
- ✅ Component generator (`npm run new:component`)
|
|
3395
3450
|
- ✅ Storybook 10 with interactive documentation
|
|
3396
3451
|
- ✅ TypeScript definitions
|
|
3397
|
-
- ✅ **
|
|
3452
|
+
- ✅ **Twelve verification gates**, eleven wired into CI
|
|
3398
3453
|
([.github/workflows/ci.yml](.github/workflows/ci.yml)): `build:theme:check`,
|
|
3399
3454
|
`verify:layers`, `verify:vocabulary`, `verify:bundle`, `verify:markup`,
|
|
3400
|
-
`verify:
|
|
3455
|
+
`verify:layer-defeat`, `verify:utility-precedence`, `verify:reset`,
|
|
3456
|
+
`verify:package`, `audit`, `verify:component`, `verify:visual` — plus the two
|
|
3457
|
+
example host checks
|
|
3458
|
+
(`examples/daisyui-starter`, `examples/sveltekit-starter`), which render the
|
|
3459
|
+
prebuilt bundle inside Tailwind 3 + daisyUI 4 and SvelteKit.
|
|
3401
3460
|
`verify:a11y` exists and is deliberately **not** wired — it reports 182
|
|
3402
3461
|
pre-existing violation groups, identical to a pre-rename baseline, dominated by
|
|
3403
3462
|
the designer-blocked `Content/Tertiary` contrast pair. Wiring a permanently red
|
|
@@ -3535,6 +3594,68 @@ The two checks are complementary and neither replaces the other — this one
|
|
|
3535
3594
|
cannot see a 1px height error, and the visual harness cannot see a hardcoded
|
|
3536
3595
|
hex that happens to match its token.
|
|
3537
3596
|
|
|
3597
|
+
### Host verification — computed styles inside a foreign app
|
|
3598
|
+
|
|
3599
|
+
Every gate above checks class NAMES or the bundle's own text. None of them can
|
|
3600
|
+
see a host stylesheet win over a component rule, which is how 0.2.0 shipped a
|
|
3601
|
+
bundle whose every control lost its border to Tailwind 3 preflight. These render
|
|
3602
|
+
the bundle and read computed styles:
|
|
3603
|
+
|
|
3604
|
+
```bash
|
|
3605
|
+
npm run verify:layer-defeat # the 0.2.0 repro; tests/fixtures/layer-defeat.html
|
|
3606
|
+
npm run verify:utility-precedence # no vd: utility in generated markup loses to a compound selector
|
|
3607
|
+
cd examples/daisyui-starter && npm run check # Tailwind 3 + daisyUI 4, three load paths
|
|
3608
|
+
cd examples/sveltekit-starter && npm run check # Svelte scoped styles, incl. the documented limit
|
|
3609
|
+
```
|
|
3610
|
+
|
|
3611
|
+
All carry canaries and run in CI. `verify:layer-defeat` takes `--file <bundle>` so
|
|
3612
|
+
a released artifact can be re-measured; `verify:layers` asserts the inverse layer
|
|
3613
|
+
contract on `dist/dashboard-ui.css` every run, with the layered `dist/index.css`
|
|
3614
|
+
as its canary.
|
|
3615
|
+
|
|
3616
|
+
> **A test that cannot fail when the fix is reverted is not a test.** Each of
|
|
3617
|
+
> these was run against the saved 0.2.0 bundle before it was trusted:
|
|
3618
|
+
> verify:layer-defeat 2/3, verify:layers red on the inverse block, daisyui 40/54
|
|
3619
|
+
> with the fingerprint named on all three controls, sveltekit 4/6. The previous
|
|
3620
|
+
> daisyui check read 10/10 on the same file.
|
|
3621
|
+
|
|
3622
|
+
```bash
|
|
3623
|
+
npm run verify:reset # src/reset.css: 0 defeats, and it still closes the gap
|
|
3624
|
+
npm run verify:reset -- --file <bundle.css> # re-measure a released artifact
|
|
3625
|
+
```
|
|
3626
|
+
|
|
3627
|
+
> **The reset is still not IN the bundle, and that has not changed.**
|
|
3628
|
+
> `dist/dashboard-ui.css` ships no element reset and no `html` rule — its only
|
|
3629
|
+
> unlayered non-`vd-` rules are the `:root, :host` token blocks, and
|
|
3630
|
+
> `verify:bundle` fails the build on either. `src/reset.css` is a **separate,
|
|
3631
|
+
> optional, opt-in** file that no entry imports for you (0.3.0). It exists because
|
|
3632
|
+
> a page whose only stylesheet is the bundle gets the browser defaults, and those
|
|
3633
|
+
> break the library: measured over the documented markup, 479 of 582 elements
|
|
3634
|
+
> rendered content-box and 52 of 146 Figma-pinned dimensions were wrong — the sm
|
|
3635
|
+
> input at 38px against a designed 25, Alert 55% too tall on UA `<p>` margins, every
|
|
3636
|
+
> underline tab 4px too wide on the UA `<button>` border, the whole document in
|
|
3637
|
+
> Times.
|
|
3638
|
+
>
|
|
3639
|
+
> **It ships with `verify:reset`, and it could not ship without it.** The sibling
|
|
3640
|
+
> shortapp library shipped the same file in its 1.0.0 with 50 self-inflicted
|
|
3641
|
+
> defeats against its own layered bundle — its `button { color: inherit }` beat the
|
|
3642
|
+
> white ink on its own primary button, and nothing they owned could see it, because every
|
|
3643
|
+
> gate they had checked class names rather than computed styles. Gate 1 asserts the
|
|
3644
|
+
> reset overrides nothing the bundle declares; gate 2 asserts it still does its job,
|
|
3645
|
+
> by rendering the documented markup identically to `dist/index.css` — the entry
|
|
3646
|
+
> that carries Preflight. Both carry canaries, and each of the reset's nine rules
|
|
3647
|
+
> was proven load-bearing by deleting it and watching gate 2 go red. Run against a
|
|
3648
|
+
> deliberately re-layered copy of the bundle, gate 1 reports **343** defeats.
|
|
3649
|
+
>
|
|
3650
|
+
> One divergence from `dist/index.css` is deliberate and asserted by name:
|
|
3651
|
+
> `<dialog>` keeps the UA's `margin: auto`. Preflight zeroes it, which pins a
|
|
3652
|
+
> `showModal()`ed `.vd-modal` to the top-left corner (measured: x=0, y=0 against
|
|
3653
|
+
> x=360 centred) — contradicting what the Modal section promises. Matching the
|
|
3654
|
+
> reference there would reproduce a defect, so the reset leaves `<dialog>` alone and
|
|
3655
|
+
> `KNOWN_DIVERGENCES` in the gate records why. That list fails in both directions: an
|
|
3656
|
+
> unlisted difference fails the gate, and a listed one that stops being observed
|
|
3657
|
+
> fails it too.
|
|
3658
|
+
|
|
3538
3659
|
## Storybook
|
|
3539
3660
|
|
|
3540
3661
|
Run locally:
|
package/GETTING_STARTED.md
CHANGED
|
@@ -187,6 +187,88 @@ fetch(spriteUrl)
|
|
|
187
187
|
|
|
188
188
|
See [COMPONENTS.md](COMPONENTS.md) for complete markup examples of every component.
|
|
189
189
|
|
|
190
|
+
## Without Tailwind v4: the prebuilt bundle
|
|
191
|
+
|
|
192
|
+
If your host has no Tailwind v4 pipeline — the dashboard app is Tailwind 3 +
|
|
193
|
+
daisyUI 4 — import the prebuilt bundle instead of `/source`, and **not**
|
|
194
|
+
`@valiify/dashboard-ui` (`dist/index.css`), which ships Tailwind 4's Preflight and
|
|
195
|
+
an `html` rule and fights your reset:
|
|
196
|
+
|
|
197
|
+
```css
|
|
198
|
+
/* app.css — inside the file that carries your @tailwind directives */
|
|
199
|
+
@import "@valiify/dashboard-ui/styles.css"; /* MUST be the first line */
|
|
200
|
+
|
|
201
|
+
@tailwind base;
|
|
202
|
+
@tailwind components;
|
|
203
|
+
@tailwind utilities;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
A plain `<link>` to the file after your own stylesheet works too, and so does a
|
|
207
|
+
lone `@import` in its own file through your PostCSS. Import exactly one of `.`,
|
|
208
|
+
`./index.css`, `./styles.css`. Never two.
|
|
209
|
+
|
|
210
|
+
The bundle does not render "identically" to `/source`. Its contract is narrower and
|
|
211
|
+
checkable, in two clauses:
|
|
212
|
+
|
|
213
|
+
1. **What it defends against.** The bundle is **unlayered** and must load **after**
|
|
214
|
+
your reset. Its component rules then beat any host rule of *lower* specificity,
|
|
215
|
+
wherever that rule sits in source order: Tailwind 3 preflight (`* { border-width:
|
|
216
|
+
0 }`, `button { background-color: transparent }`, `input, textarea { color:
|
|
217
|
+
inherit }`), daisyUI's base, a `:global(button)` reset in a Svelte component.
|
|
218
|
+
Version 0.2.0 did **not** hold this — its rules sat in `@layer components` and
|
|
219
|
+
lost to every unlayered host rule. The fingerprint: a control whose focus ring
|
|
220
|
+
survives while its border, fill and padding do not.
|
|
221
|
+
2. **What it cannot defend against.** A host rule of *higher* specificity still wins,
|
|
222
|
+
and a Svelte scoped element selector is exactly that — `button { border: 0 }` in a
|
|
223
|
+
component's `<style>` compiles to `button.svelte-<hash>` (0,1,1), which outranks
|
|
224
|
+
our single-class rules (0,1,0). A host that wraps its own CSS in a cascade layer
|
|
225
|
+
changes the arithmetic too. **Instead:** scope element resets by class (`.plain {
|
|
226
|
+
}`) or exclude library controls — `button:not([class*="vd-"]) { border: 0 }` —
|
|
227
|
+
and never write a bare `button` / `input` / `textarea` selector inside a
|
|
228
|
+
component that renders a `vd-` control.
|
|
229
|
+
|
|
230
|
+
Both clauses are measured, not asserted: `examples/daisyui-starter` (Tailwind 3 +
|
|
231
|
+
daisyUI, three load paths) and `examples/sveltekit-starter` (scoped styles, including
|
|
232
|
+
clause 2 asserted as a loss) — `npm run check` in each.
|
|
233
|
+
|
|
234
|
+
### If the bundle is the only stylesheet on the page
|
|
235
|
+
|
|
236
|
+
Everything above is about coexisting with a host's reset. If there is no host —
|
|
237
|
+
a standalone page, a static export, a demo — there is no reset either, and the
|
|
238
|
+
browser's own defaults break the library. Measured over the documented markup with
|
|
239
|
+
only the bundle loaded: 479 of 582 elements were `content-box`, so every padded
|
|
240
|
+
component rendered larger than designed (`.vd-input-field.vd-input-sm` at 38px
|
|
241
|
+
against a designed 25, `.vd-modal` 546px wide against 480); `<p>` and `<h2>` carried
|
|
242
|
+
their 1em UA margin inside Alert, Toast, Modal and Tooltip (`.vd-alert` 137.5px
|
|
243
|
+
against 88.5); `<button>` carried its 2px UA border, so every underline tab was 4px
|
|
244
|
+
too wide; and the document rendered in Times, because the bundle defines
|
|
245
|
+
`--font-sans` but has no Preflight to bind it.
|
|
246
|
+
|
|
247
|
+
Opt into the reset, **before** the bundle:
|
|
248
|
+
|
|
249
|
+
```css
|
|
250
|
+
@import "@valiify/dashboard-ui/reset.css"; /* first */
|
|
251
|
+
@import "@valiify/dashboard-ui/styles.css";
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Order matters. The reset is unlayered element selectors (0,0,1) and the bundle's
|
|
255
|
+
component classes are (0,1,0), so specificity settles it either way — but loading
|
|
256
|
+
the reset second would put a UA-default rule after the classes it is meant to sit
|
|
257
|
+
beneath, which is exactly the shape that once had our sibling library's own reset
|
|
258
|
+
beating its own buttons.
|
|
259
|
+
|
|
260
|
+
**Do not load it inside an app that already has a reset.** Its first eight rules
|
|
261
|
+
would be redundant there, and its ninth sets `html { color; background-color }` — a
|
|
262
|
+
page default your app owns. Nothing imports this file for you; it is not part of
|
|
263
|
+
`./styles.css`, because shipping a reset in that bundle is precisely what makes a
|
|
264
|
+
stylesheet unsafe to drop into a host.
|
|
265
|
+
|
|
266
|
+
It is about twenty lines and deliberately not a Preflight. It leaves lists, tables,
|
|
267
|
+
images, fieldsets, form-control appearance, placeholder colour and
|
|
268
|
+
`blockquote`/`figure`/`dl` margins alone — a host is entitled to own all of that.
|
|
269
|
+
Every rule exists because a measured value was wrong without it, and `npm run
|
|
270
|
+
verify:reset` re-measures the whole file in a browser on every CI run.
|
|
271
|
+
|
|
190
272
|
## Common Mistakes
|
|
191
273
|
|
|
192
274
|
### ❌ Importing from JavaScript
|
|
@@ -299,6 +381,11 @@ import "./styles.css";
|
|
|
299
381
|
<button class="vd-btn vd-btn-primary">Click me</button>
|
|
300
382
|
```
|
|
301
383
|
|
|
384
|
+
> **Scoped styles and library controls.** A scoped `button { }` in a Svelte
|
|
385
|
+
> component compiles to `button.svelte-<hash>` and outranks the library's
|
|
386
|
+
> single-class rules even with the prebuilt bundle. Scope resets by class or exclude
|
|
387
|
+
> library controls (`button:not([class*="vd-"])`) — see "Without Tailwind v4" above.
|
|
388
|
+
|
|
302
389
|
### Next.js (App Router)
|
|
303
390
|
|
|
304
391
|
In `app/layout.js`:
|
package/README.md
CHANGED
|
@@ -37,9 +37,10 @@ Open [http://localhost:5173](http://localhost:5173) - if you see styled componen
|
|
|
37
37
|
|
|
38
38
|
| Import | Use it when |
|
|
39
39
|
| --- | --- |
|
|
40
|
-
| `@valiify/dashboard-ui/styles.css` | dropping the library into a host app that already has a reset — **no Preflight, no `html` rule**, closed `vd:` utility set |
|
|
40
|
+
| `@valiify/dashboard-ui/styles.css` | dropping the library into a host app that already has a reset — **no Preflight, no `html` rule, unlayered**, closed `vd:` utility set |
|
|
41
41
|
| `@valiify/dashboard-ui` | a standalone page where our Preflight is welcome |
|
|
42
42
|
| `@valiify/dashboard-ui/source` | your Tailwind compiles our `@theme`, giving every token utility |
|
|
43
|
+
| `@valiify/dashboard-ui/reset.css` | **optional** — pair it with `./styles.css` when that bundle is the ONLY stylesheet on the page |
|
|
43
44
|
|
|
44
45
|
Component classes are namespaced: `.vd-btn`, `.vd-card-title`, `.vd-input-field`.
|
|
45
46
|
The generated list ships as `@valiify/dashboard-ui/manifest`.
|
|
@@ -52,8 +53,53 @@ The generated list ships as `@valiify/dashboard-ui/manifest`.
|
|
|
52
53
|
@tailwind utilities;
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
### Do you need `./reset.css`?
|
|
57
|
+
|
|
58
|
+
`./styles.css` ships no Preflight, so it cannot fight your reset. The flip side is
|
|
59
|
+
that a page with **no** other stylesheet falls back to the browser's defaults, and
|
|
60
|
+
three of those break the library's geometry: elements are `content-box`, so every
|
|
61
|
+
padded component renders wider and taller than designed (the small input measures
|
|
62
|
+
38px against a designed 25); `<p>` and `<h2>` carry a 1em margin inside Alert,
|
|
63
|
+
Toast, Modal and Tooltip; `<button>` carries a 2px UA border. Text also falls back
|
|
64
|
+
to the UA serif, because the bundle defines `--font-sans` but has no Preflight to
|
|
65
|
+
bind it.
|
|
66
|
+
|
|
67
|
+
```css
|
|
68
|
+
/* a standalone page — the reset FIRST, then the bundle */
|
|
69
|
+
@import "@valiify/dashboard-ui/reset.css";
|
|
70
|
+
@import "@valiify/dashboard-ui/styles.css";
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Skip it inside an app that already has a reset.** Its first eight rules would be
|
|
74
|
+
redundant there, and its ninth sets `html { color; background-color }` — a page
|
|
75
|
+
default your app owns. Nothing imports this file for you.
|
|
76
|
+
|
|
77
|
+
It is about twenty lines and deliberately not a Preflight: no lists, tables,
|
|
78
|
+
images, fieldsets, form-control appearance or placeholder colour. Every rule is
|
|
79
|
+
there because a measured value was wrong without it, and both directions are gated
|
|
80
|
+
in CI (`npm run verify:reset`) — it must override nothing the bundle declares, and
|
|
81
|
+
it must still render the documented markup exactly as `@valiify/dashboard-ui` (the
|
|
82
|
+
Preflight-carrying entry) does.
|
|
83
|
+
|
|
84
|
+
`./styles.css` does not render "identically" to `./source`. Its contract is
|
|
85
|
+
narrower and checkable, in two clauses:
|
|
86
|
+
|
|
87
|
+
1. **What it defends against.** The bundle is **unlayered**. Load it after your
|
|
88
|
+
reset and its component rules beat any host rule of *lower* specificity,
|
|
89
|
+
wherever that rule sits in source order — Tailwind 3 preflight, daisyUI's base,
|
|
90
|
+
a `:global(button)` reset in a Svelte component. (0.2.0 did not hold this: its
|
|
91
|
+
rules sat in `@layer components` and lost to every unlayered host rule. The
|
|
92
|
+
fingerprint was a control whose focus ring survived while its border, fill and
|
|
93
|
+
padding did not.)
|
|
94
|
+
2. **What it cannot defend against.** A host rule of *higher* specificity still
|
|
95
|
+
wins. A Svelte scoped `button { border: 0 }` compiles to `button.svelte-hash`
|
|
96
|
+
(0,1,1) and beats our single-class rules (0,1,0). A host that wraps its own CSS
|
|
97
|
+
in a cascade layer changes the arithmetic too. Scope element resets by class, or
|
|
98
|
+
exclude library controls: `button:not([class*="vd-"]) { border: 0 }`.
|
|
99
|
+
|
|
100
|
+
Both clauses are measured in `examples/daisyui-starter` (Tailwind 3 + daisyUI 4,
|
|
101
|
+
three load paths) and `examples/sveltekit-starter` (Svelte scoped styles, including
|
|
102
|
+
clause 2 asserted as a loss) — `npm run check` in each.
|
|
57
103
|
|
|
58
104
|
## Installation
|
|
59
105
|
|
package/TROUBLESHOOTING.md
CHANGED
|
@@ -231,6 +231,46 @@ See [COMPONENTS.md](COMPONENTS.md) for the required markup structure of every co
|
|
|
231
231
|
2. Copy the example markup exactly
|
|
232
232
|
3. If that works, compare it to your code to find what's missing
|
|
233
233
|
|
|
234
|
+
## Borders, Fills and Padding Vanish Inside a Host App
|
|
235
|
+
|
|
236
|
+
### Symptom
|
|
237
|
+
|
|
238
|
+
Inside an app that has its own reset (Tailwind 3 preflight, daisyUI, a house
|
|
239
|
+
reset), buttons render transparent with the page's text colour, fields lose their
|
|
240
|
+
hairline, text takes the host's font-size — but the **focus ring still appears**
|
|
241
|
+
when you Tab to the control.
|
|
242
|
+
|
|
243
|
+
### Cause
|
|
244
|
+
|
|
245
|
+
A cascade-layer defeat. Unlayered CSS beats layered CSS before specificity or
|
|
246
|
+
source order is consulted, so a component rule inside `@layer components` loses to
|
|
247
|
+
a bare `button { }` or `* { border-width: 0 }` from the host. Preflight never
|
|
248
|
+
touches `outline`, which is why the ring survives while everything else goes.
|
|
249
|
+
|
|
250
|
+
Two ways to get here:
|
|
251
|
+
|
|
252
|
+
1. **You are on 0.2.0 of `./styles.css`.** That build wrapped every component rule
|
|
253
|
+
in `@layer components`. It looked fine when `@import`ed into the file carrying
|
|
254
|
+
your `@tailwind` directives (Tailwind 3 strips the layers by accident) and broke
|
|
255
|
+
on a `<link>` to the file. Upgrade; the bundle is unlayered now.
|
|
256
|
+
2. **You imported `@valiify/dashboard-ui/source` or `.` into a host that wraps its
|
|
257
|
+
own CSS in a cascade layer**, or a host rule at *higher* specificity is winning
|
|
258
|
+
— a Svelte scoped `button { border: 0 }` compiles to `button.svelte-<hash>`
|
|
259
|
+
(0,1,1), which outranks our single-class rules (0,1,0) on any entry.
|
|
260
|
+
|
|
261
|
+
### Fix
|
|
262
|
+
|
|
263
|
+
- Use `./styles.css` and load it **after** the host's reset.
|
|
264
|
+
- Never write a bare `button` / `input` / `textarea` selector in a component that
|
|
265
|
+
renders a `vd-` control. Scope resets by class, or exclude library controls:
|
|
266
|
+
`button:not([class*="vd-"]) { border: 0 }`.
|
|
267
|
+
- To confirm which case you have, open DevTools on the control: a rule shown as
|
|
268
|
+
struck through *below* a lower-specificity host rule is the layer; a
|
|
269
|
+
`button.svelte-…` rule winning is specificity.
|
|
270
|
+
|
|
271
|
+
`examples/daisyui-starter` and `examples/sveltekit-starter` measure both cases —
|
|
272
|
+
`npm run check` in each.
|
|
273
|
+
|
|
234
274
|
## Dropdown / Tabs / Modal Don't Work
|
|
235
275
|
|
|
236
276
|
### Symptom
|