@valiify/dashboard-ui 0.2.1 → 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 +92 -2
- package/CLAUDE.md +55 -9
- package/GETTING_STARTED.md +38 -0
- package/README.md +29 -0
- package/examples/daisyui-starter/package.json +1 -1
- package/examples/postcss-starter/package.json +1 -1
- package/examples/sveltekit-starter/package.json +1 -1
- package/examples/vite-starter/package.json +1 -1
- package/package.json +4 -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
|
package/CLAUDE.md
CHANGED
|
@@ -3325,11 +3325,16 @@ CSS-only — there is no Tailwind plugin to register, and no `tailwind.config.js
|
|
|
3325
3325
|
| `@valiify/dashboard-ui` (prebuilt) | `.vd-*` classes + tokens as CSS custom properties, **plus Preflight and an `html` rule** | token-derived utilities |
|
|
3326
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
|
|
@@ -3434,11 +3449,12 @@ Completed:
|
|
|
3434
3449
|
- ✅ Component generator (`npm run new:component`)
|
|
3435
3450
|
- ✅ Storybook 10 with interactive documentation
|
|
3436
3451
|
- ✅ TypeScript definitions
|
|
3437
|
-
- ✅ **
|
|
3452
|
+
- ✅ **Twelve verification gates**, eleven wired into CI
|
|
3438
3453
|
([.github/workflows/ci.yml](.github/workflows/ci.yml)): `build:theme:check`,
|
|
3439
3454
|
`verify:layers`, `verify:vocabulary`, `verify:bundle`, `verify:markup`,
|
|
3440
|
-
`verify:layer-defeat`, `verify:utility-precedence`, `verify:
|
|
3441
|
-
`verify:component`, `verify:visual` — plus the two
|
|
3455
|
+
`verify:layer-defeat`, `verify:utility-precedence`, `verify:reset`,
|
|
3456
|
+
`verify:package`, `audit`, `verify:component`, `verify:visual` — plus the two
|
|
3457
|
+
example host checks
|
|
3442
3458
|
(`examples/daisyui-starter`, `examples/sveltekit-starter`), which render the
|
|
3443
3459
|
prebuilt bundle inside Tailwind 3 + daisyUI 4 and SvelteKit.
|
|
3444
3460
|
`verify:a11y` exists and is deliberately **not** wired — it reports 182
|
|
@@ -3603,12 +3619,42 @@ as its canary.
|
|
|
3603
3619
|
> with the fingerprint named on all three controls, sveltekit 4/6. The previous
|
|
3604
3620
|
> daisyui check read 10/10 on the same file.
|
|
3605
3621
|
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
>
|
|
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.
|
|
3612
3658
|
|
|
3613
3659
|
## Storybook
|
|
3614
3660
|
|
package/GETTING_STARTED.md
CHANGED
|
@@ -231,6 +231,44 @@ Both clauses are measured, not asserted: `examples/daisyui-starter` (Tailwind 3
|
|
|
231
231
|
daisyUI, three load paths) and `examples/sveltekit-starter` (scoped styles, including
|
|
232
232
|
clause 2 asserted as a loss) — `npm run check` in each.
|
|
233
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
|
+
|
|
234
272
|
## Common Mistakes
|
|
235
273
|
|
|
236
274
|
### ❌ Importing from JavaScript
|
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ Open [http://localhost:5173](http://localhost:5173) - if you see styled componen
|
|
|
40
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,6 +53,34 @@ The generated list ships as `@valiify/dashboard-ui/manifest`.
|
|
|
52
53
|
@tailwind utilities;
|
|
53
54
|
```
|
|
54
55
|
|
|
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
|
+
|
|
55
84
|
`./styles.css` does not render "identically" to `./source`. Its contract is
|
|
56
85
|
narrower and checkable, in two clauses:
|
|
57
86
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valiify/dashboard-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Tailwind CSS component library for Valiify Dashboard applications",
|
|
5
5
|
"style": "dist/index.css",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
".": "./dist/index.css",
|
|
12
12
|
"./index.css": "./dist/index.css",
|
|
13
13
|
"./styles.css": "./dist/dashboard-ui.css",
|
|
14
|
+
"./reset.css": "./src/reset.css",
|
|
14
15
|
"./fonts": "./src/fonts.css",
|
|
15
16
|
"./source": "./src/library.css",
|
|
16
17
|
"./icons/sprite.svg": "./src/icons/sprite.svg",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"verify:utility-precedence": "node scripts/verify-utility-precedence.mjs",
|
|
54
55
|
"verify:vocabulary": "node scripts/verify-vocabulary.mjs",
|
|
55
56
|
"verify:bundle": "node scripts/verify-bundle.mjs",
|
|
57
|
+
"verify:reset": "node scripts/verify-reset.mjs",
|
|
56
58
|
"verify:markup": "node scripts/verify-markup.mjs",
|
|
57
59
|
"verify:package": "node scripts/verify-package.mjs",
|
|
58
60
|
"storybook": "storybook dev -p 6006",
|
|
@@ -91,7 +93,7 @@
|
|
|
91
93
|
"@storybook/addon-themes": "^10.5.10",
|
|
92
94
|
"@storybook/html-vite": "^10.5.10",
|
|
93
95
|
"@tailwindcss/postcss": "^4.3.3",
|
|
94
|
-
"@valiify/val-core": "^0.
|
|
96
|
+
"@valiify/val-core": "^0.7.0",
|
|
95
97
|
"chromatic": "^18.7.2",
|
|
96
98
|
"lucide-static": "^1.33.0",
|
|
97
99
|
"pixelmatch": "^7.2.0",
|
package/src/reset.css
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal reset for the prebuilt bundle — OPTIONAL and opt-in.
|
|
3
|
+
*
|
|
4
|
+
* @import "@valiify/dashboard-ui/reset.css"; <- FIRST
|
|
5
|
+
* @import "@valiify/dashboard-ui/styles.css";
|
|
6
|
+
*
|
|
7
|
+
* dist/dashboard-ui.css deliberately ships no preflight and no `html` rule, so it
|
|
8
|
+
* cannot fight the reset of a host that already has one (Tailwind 3 + daisyUI 4, a
|
|
9
|
+
* Svelte :global() reset, a house stylesheet). verify:bundle asserts that absence on
|
|
10
|
+
* every build and nothing here changes it — this is a SEPARATE file the bundle never
|
|
11
|
+
* imports and no entry pulls in for you.
|
|
12
|
+
*
|
|
13
|
+
* The cost of shipping no reset is that a page with no other stylesheet gets the
|
|
14
|
+
* browser defaults, and those break this library's geometry and typography. Measured
|
|
15
|
+
* on a bare page loading only the bundle, over every ```html example in CLAUDE.md
|
|
16
|
+
* plus tests/fixtures/generated-page.html — 479 of 582 elements rendered content-box,
|
|
17
|
+
* and 53 of 146 Figma-pinned dimensions were wrong:
|
|
18
|
+
*
|
|
19
|
+
* .vd-input-field.vd-input-sm 25px designed -> 38px (+11 padding, +2 hairline)
|
|
20
|
+
* .vd-toast-simple (height) 35px -> 57px
|
|
21
|
+
* .vd-data-row 38px -> 63px
|
|
22
|
+
* .vd-chip 20px -> 30px
|
|
23
|
+
* .vd-avatar-md 20px -> 22px
|
|
24
|
+
* .vd-switch 32x18 -> 36x22
|
|
25
|
+
* .vd-modal 480px wide -> 546px
|
|
26
|
+
* .vd-alert (height) 88.5px -> 137.5px (UA <p> margins)
|
|
27
|
+
* .vd-tooltip (height) 106.5px -> 190.5px
|
|
28
|
+
* .vd-tab-underline (width) 96.1px -> 100.1px (UA <button> border)
|
|
29
|
+
* html font-family Inter -> Times
|
|
30
|
+
* .vd-btn font-family Inter -> Arial
|
|
31
|
+
* a.vd-nav-title colour Content/Primary-> link blue
|
|
32
|
+
*
|
|
33
|
+
* This file is that floor and nothing more. It is NOT preflight. Every rule exists
|
|
34
|
+
* because a measured value was wrong without it, and the set was derived by rendering
|
|
35
|
+
* the documented markup against this bundle and against dist/index.css — the entry
|
|
36
|
+
* that DOES carry preflight — and keeping only the rules that closed a real gap.
|
|
37
|
+
* scripts/verify-reset.mjs re-measures the whole thing.
|
|
38
|
+
*
|
|
39
|
+
* What it deliberately does NOT touch, because nothing measured wrong: lists and
|
|
40
|
+
* their markers, tables, images, fieldsets, form-control appearance and placeholder
|
|
41
|
+
* colour (.vd-input and .vd-textarea zero their own), blockquote/figure/dl margins,
|
|
42
|
+
* b/strong weight, code family, sub/sup, [hidden] (.vd-dropdown-panel ships its own
|
|
43
|
+
* guard). A host is entitled to own all of it.
|
|
44
|
+
*
|
|
45
|
+
* Use it when the bundle is the ONLY stylesheet on the page. Inside an app that
|
|
46
|
+
* already resets, skip it — rules 1-7 would be redundant, and rule 8 would repaint a
|
|
47
|
+
* page the host owns.
|
|
48
|
+
*
|
|
49
|
+
* THIS FILE IS SUBJECT TO THE CASCADE LIKE ANY HOST RESET, and that is the whole
|
|
50
|
+
* risk. Every rule here is an unlayered element selector (0,0,1). Our sibling
|
|
51
|
+
* @valiify/shortapp-ui shipped the same file in 1.0.0 while its bundle's component
|
|
52
|
+
* rules still sat inside `@layer components` — and unlayered beats layered before
|
|
53
|
+
* specificity is consulted, so rule 4's `button { color: inherit }` beat
|
|
54
|
+
* `.va-btn-primary`'s white ink and every button-based component lost its font-size,
|
|
55
|
+
* line-height, letter-spacing and colour. 50 defeats; the fix for one problem was a
|
|
56
|
+
* live instance of the problem, and nothing they had could see it. This bundle has
|
|
57
|
+
* been unlayered since 0.2.1 (scripts/build-styles.mjs), so its classes (0,1,0)
|
|
58
|
+
* outrank these element rules (0,0,1) on specificity — but that is an invariant to be
|
|
59
|
+
* asserted, not assumed. scripts/verify-reset.mjs measures computed styles in a
|
|
60
|
+
* browser and fails if any rule here overrides a property the bundle declares on the
|
|
61
|
+
* same element. Do not add a rule to this file without running it.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* 1. border-box. The single load-bearing rule.
|
|
66
|
+
*
|
|
67
|
+
* Every fixed dimension in this library is authored border-box. Component heights
|
|
68
|
+
* include their own hairline — CLAUDE.md's rule is "size bordered components with
|
|
69
|
+
* `height`, not `min-height`", because Chrome rounds the 0.5px `--border-thin` up to
|
|
70
|
+
* a full 1px and a hairline therefore adds 2px. Under content-box each of those
|
|
71
|
+
* renders larger than designed by its own padding plus border: the sm input lands at
|
|
72
|
+
* 38px against a designed 25. Form controls already default to border-box in the UA
|
|
73
|
+
* stylesheet, which is why .vd-btn measured right and .vd-input-field did not.
|
|
74
|
+
*/
|
|
75
|
+
*,
|
|
76
|
+
::before,
|
|
77
|
+
::after {
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
* 2. The body's 8px UA margin. dist/index.css zeroes it through Preflight, so without
|
|
83
|
+
* this the two prebuilt entries lay out differently at the page edge. NavigationRail
|
|
84
|
+
* is the component that notices: it is `h-full` and expects a sized parent, not one
|
|
85
|
+
* inset from the viewport.
|
|
86
|
+
*/
|
|
87
|
+
body {
|
|
88
|
+
margin: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* 3. Document font and line box.
|
|
93
|
+
*
|
|
94
|
+
* The bundle defines --font-sans as a token but binds it to nothing — Preflight's
|
|
95
|
+
* `--default-font-family` is what normally applies it, and the bundle has no
|
|
96
|
+
* preflight — so text falls back to the UA serif. Measured: the document rendered in
|
|
97
|
+
* Times. Bound to the token rather than a literal, so a consumer overriding
|
|
98
|
+
* --font-sans still wins.
|
|
99
|
+
*
|
|
100
|
+
* The 1.5 line-height is Tailwind's document default, not a Figma value, and is here
|
|
101
|
+
* for parity with dist/index.css: every text style in the library carries its own
|
|
102
|
+
* line-height, so this governs only text the consumer writes. Without it bare copy
|
|
103
|
+
* sets at `normal` and lands ~6px shorter per line than on the preflight entry.
|
|
104
|
+
*/
|
|
105
|
+
html {
|
|
106
|
+
font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);
|
|
107
|
+
line-height: 1.5;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
* 4. Form controls do not inherit font or colour from their ancestors; the UA gives
|
|
112
|
+
* them its own. Our component classes set size and weight but never family, because
|
|
113
|
+
* preflight normally supplies the inheritance. Measured: .vd-btn rendered in Arial
|
|
114
|
+
* while the document was in Times — neither of them Inter.
|
|
115
|
+
*
|
|
116
|
+
* This is the rule that cost the sibling library 50 defeats. It is safe here only
|
|
117
|
+
* because the bundle is unlayered; verify:reset is what keeps it safe.
|
|
118
|
+
*/
|
|
119
|
+
button,
|
|
120
|
+
input,
|
|
121
|
+
optgroup,
|
|
122
|
+
select,
|
|
123
|
+
textarea {
|
|
124
|
+
font-family: inherit;
|
|
125
|
+
font-size: 100%;
|
|
126
|
+
line-height: inherit;
|
|
127
|
+
letter-spacing: inherit;
|
|
128
|
+
color: inherit;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/*
|
|
132
|
+
* 5. The UA's 2px outset border on <button>.
|
|
133
|
+
*
|
|
134
|
+
* CLAUDE.md already records this dependency from the other side: ".vd-tab must not set
|
|
135
|
+
* `border-none` … Preflight already gives buttons a 0-width border." Without preflight
|
|
136
|
+
* that is false, and the components which rely on it leak the UA frame — measured, an
|
|
137
|
+
* underline tab rendered 100.14px against a designed 96.14, and every segment and
|
|
138
|
+
* filter segment gained 2px per unstyled side.
|
|
139
|
+
*
|
|
140
|
+
* Scoped to <button> alone: input, select and textarea have the same UA border, but
|
|
141
|
+
* .vd-input and .vd-textarea zero their own, so a rule for them would be a defeat
|
|
142
|
+
* surface with nothing to fix.
|
|
143
|
+
*/
|
|
144
|
+
button {
|
|
145
|
+
border: 0 solid;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/*
|
|
149
|
+
* 6. Block margins on the elements the documented markup puts INSIDE components.
|
|
150
|
+
*
|
|
151
|
+
* Alert, Toast, Modal, Tooltip, Pagination, Stepper and Card all use <p> for their
|
|
152
|
+
* text parts and <h2> for their titles, and the UA gives each a 1em block margin that
|
|
153
|
+
* the component has no padding to absorb. Measured: .vd-alert 88.5px -> 137.5px,
|
|
154
|
+
* .vd-modal 288.5 -> 377.8, .vd-tooltip 106.5 -> 190.5.
|
|
155
|
+
*
|
|
156
|
+
* Headings are zeroed as a family rather than just h2: the slot takes whichever level
|
|
157
|
+
* the consumer's document outline needs, and a modal titled with an <h3> is correct
|
|
158
|
+
* markup.
|
|
159
|
+
*/
|
|
160
|
+
p,
|
|
161
|
+
h1,
|
|
162
|
+
h2,
|
|
163
|
+
h3,
|
|
164
|
+
h4,
|
|
165
|
+
h5,
|
|
166
|
+
h6,
|
|
167
|
+
hr {
|
|
168
|
+
margin: 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/*
|
|
172
|
+
* 7. <hr>'s own UA chrome. .vd-divider zeroes its border and margin; .vd-tooltip-divider
|
|
173
|
+
* zeroes only its border, and the UA's `color: gray` reaches both. Rules in this
|
|
174
|
+
* library are drawn as a 1px box with a background, never a border, so an inherited
|
|
175
|
+
* grey does nothing visible today — it is zeroed because an <hr> that carries UA ink
|
|
176
|
+
* into a component is a trap waiting for the first rule that uses currentColor.
|
|
177
|
+
*/
|
|
178
|
+
hr {
|
|
179
|
+
border: 0;
|
|
180
|
+
color: inherit;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
* 8. Anchor colour. Components built on <a> — .vd-nav-title, .vd-nav-item,
|
|
185
|
+
* .vd-breadcrumb — inherit the document ink; the UA gives them link blue instead.
|
|
186
|
+
* Measured: a.vd-nav-title rendered rgb(0, 0, 238). text-decoration needs no rule,
|
|
187
|
+
* measured: every link-shaped component already sets its own.
|
|
188
|
+
*/
|
|
189
|
+
a {
|
|
190
|
+
color: inherit;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/*
|
|
194
|
+
* 9. Document ink and ground — Content/Primary on Surface/Frame.
|
|
195
|
+
*
|
|
196
|
+
* This is the one rule the bundle could never carry. src/base/index.css sets exactly
|
|
197
|
+
* these two declarations, dist/index.css ships them, and dist/dashboard-ui.css is
|
|
198
|
+
* built without ../base precisely so it never repaints a host's page — verify:bundle
|
|
199
|
+
* fails the build on a single bare `html` rule in the bundle. None of that argues
|
|
200
|
+
* against the default existing SOMEWHERE for a page with no host, which is what this
|
|
201
|
+
* file is for. Measured without it: ink rgb(0, 0, 0) against Content/Primary #16161a,
|
|
202
|
+
* and a transparent ground where the surface stack's back layer is #f0f3f7 — so every
|
|
203
|
+
* Surface/Paper panel (.vd-dropdown-menu, .vd-modal, .vd-pagination-item) rendered
|
|
204
|
+
* white-on-white and lost its figure against the page.
|
|
205
|
+
*
|
|
206
|
+
* It is also why this file is not merely redundant inside a host: a host that paints
|
|
207
|
+
* its own page must either skip reset.css or load its own `html` rule after it, since
|
|
208
|
+
* the two have equal specificity and source order decides.
|
|
209
|
+
*/
|
|
210
|
+
html {
|
|
211
|
+
color: var(--color-content-primary);
|
|
212
|
+
background-color: var(--color-surface-frame);
|
|
213
|
+
}
|