@valiify/dashboard-ui 0.2.0 → 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 +82 -0
- package/CLAUDE.md +78 -3
- package/GETTING_STARTED.md +49 -0
- package/README.md +20 -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 +4 -2
- package/src/build/components.css +6 -0
- package/src/build/utilities.css +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -115,6 +115,88 @@ Worth stating precisely, because "the methodology is enforced" reads as one clai
|
|
|
115
115
|
|
|
116
116
|
Both are verified by injection, not by inspection.
|
|
117
117
|
|
|
118
|
+
### Fixed — the prebuilt bundle is now unlayered (the cascade-layer defeat)
|
|
119
|
+
|
|
120
|
+
`dist/dashboard-ui.css` (`./styles.css`) wrapped every component rule in three
|
|
121
|
+
`@layer components` blocks. Any UNLAYERED host rule beat them regardless of
|
|
122
|
+
specificity or source order: Tailwind 3 preflight (`* { border-width: 0 }`, `button {
|
|
123
|
+
background-color: transparent }`, `button, input, textarea { font-size: 100%;
|
|
124
|
+
line-height: inherit; color: inherit; padding: 0 }`), daisyUI 4, a Svelte
|
|
125
|
+
`:global(button)` reset. The `vd-` namespace could not fix this and did not; it is
|
|
126
|
+
not a name collision. Measured on the 0.2.0 artifact under a preflight-shaped host
|
|
127
|
+
reset placed *before* the bundle and at lower specificity: `.vd-btn-primary` lost its
|
|
128
|
+
fill, its white ink (the label inherited the page colour onto the blue), its hairline,
|
|
129
|
+
its padding and its 12.5px type; `.vd-input-field`, `.vd-textarea-field`,
|
|
130
|
+
`.vd-dropdown-field` and `.vd-checkbox-input` lost their hairlines; the textarea took
|
|
131
|
+
the host's type; the active underline tab lost its 2px rule. The fingerprint: a
|
|
132
|
+
control whose **focus ring survives while its border does not** — preflight never
|
|
133
|
+
touches `outline` and zeroes `border-width` on `*`.
|
|
134
|
+
|
|
135
|
+
**Why nothing saw it.** A host that `@import`s the bundle into the file carrying its
|
|
136
|
+
`@tailwind` directives has Tailwind 3 consume our `@layer components` blocks and
|
|
137
|
+
re-emit the rules unlayered, after preflight — the bug vanishes and the library looks
|
|
138
|
+
correct on the path most people test. It breaks on a raw `<link>` to the file, where
|
|
139
|
+
the layers reach the browser intact, and a lone `@import` through Tailwind 3's
|
|
140
|
+
PostCSS was **refused** outright (`@layer components` is used but no matching
|
|
141
|
+
`@tailwind components` directive is present). `examples/daisyui-starter`'s check
|
|
142
|
+
passed 10/10 with the bug present: it had one load path (the import), and it asserted
|
|
143
|
+
only heights, radii and the tooltip fill — properties preflight never touches.
|
|
144
|
+
|
|
145
|
+
**The fix** is a build-time unwrap of pass A in `scripts/build-styles.mjs`: the
|
|
146
|
+
`@layer components` blocks are replaced by their children. `src/components`,
|
|
147
|
+
`./source` and `dist/index.css` keep their layers — for a Tailwind v4 host the layer
|
|
148
|
+
IS the contract (`verify:layers`' original assertion, unchanged). Unlike the sibling
|
|
149
|
+
shortapp library's fix there was no `@layer base` to relocate: pass A never imported
|
|
150
|
+
the `html` default, so the bundle has carried no `html` rule since it was introduced;
|
|
151
|
+
the base check in the build is a guard. `build-manifest.mjs` read component classes
|
|
152
|
+
from inside `@layer components` bodies and would have refused to write the manifest
|
|
153
|
+
after the unwrap; it now walks every rule's selector, and the vocabulary it emits is
|
|
154
|
+
byte-identical.
|
|
155
|
+
|
|
156
|
+
**Behaviour change for consumers of `./styles.css`.** Previously any unlayered
|
|
157
|
+
consumer rule beat any component rule. Now a single-class override (`.my-btn {
|
|
158
|
+
height: 40px }`) still wins when it loads after the bundle — source order — but
|
|
159
|
+
overriding a compound state rule (`.vd-btn-primary:hover`, `.vd-input-md .vd-input`)
|
|
160
|
+
needs matching specificity. Correct for a library you deliberately import; a change
|
|
161
|
+
nonetheless. The library's own `vd:` utilities follow the same arithmetic: they beat
|
|
162
|
+
the 295 single-class component selectors by source order and lose to the 273 compound
|
|
163
|
+
ones. `verify:utility-precedence` (new, in CI) fails when generated markup relies on a
|
|
164
|
+
utility that a compound component selector outranks — none does today.
|
|
165
|
+
|
|
166
|
+
**What the bundle still cannot defend against**, now stated as contract in README,
|
|
167
|
+
GETTING_STARTED and CLAUDE.md: a host rule of HIGHER specificity. A Svelte scoped
|
|
168
|
+
`button { border: 0 }` compiles to `button.svelte-<hash>` (0,1,1) and outranks our
|
|
169
|
+
0,1,0. `examples/sveltekit-starter` asserts that loss on purpose and asserts the
|
|
170
|
+
remedy (`button:not([class*="vd-"])`, or class-scoped resets).
|
|
171
|
+
|
|
172
|
+
### Added — host verification: computed styles inside a foreign app
|
|
173
|
+
|
|
174
|
+
Every existing gate checked class names or the bundle's own text; none rendered the
|
|
175
|
+
bundle inside a host. These do, each with a canary, all in CI:
|
|
176
|
+
|
|
177
|
+
- `scripts/verify-layer-defeat.mjs` + `tests/fixtures/layer-defeat.html` — the repro
|
|
178
|
+
as a gate: one page, one host rule, one library rule toggled only by the `@layer`
|
|
179
|
+
wrapper, then the real bundle under an unlayered `button { border: 0 }`. 2/3 on the
|
|
180
|
+
0.2.0 artifact, 3/3 now.
|
|
181
|
+
- `scripts/verify-layers.mjs` — the inverse assertion on the prebuilt bundle: zero
|
|
182
|
+
`@layer components`, zero `@layer base`, only `@layer properties` may remain, with
|
|
183
|
+
the layered `dist/index.css` as the detector's canary.
|
|
184
|
+
- `scripts/verify-utility-precedence.mjs` — no `vd:` utility in generated markup
|
|
185
|
+
loses to a compound component selector; canaries for both a false negative and the
|
|
186
|
+
type-selector false positive.
|
|
187
|
+
- `examples/daisyui-starter` — rewritten. Tailwind 3 + daisyUI 4 host, computed-style
|
|
188
|
+
assertions per control (button, input, textarea, select-by-manifest) over three load
|
|
189
|
+
paths, naming the layer-defeat fingerprint when it sees it. 40/54 on the 0.2.0
|
|
190
|
+
artifact (26/26 import, 13/26 link, lone import refused); 54/54 now.
|
|
191
|
+
- `examples/sveltekit-starter` — Svelte 5 scoped styles: `:global` reset (must win),
|
|
192
|
+
scoped element selector (documented loss), the remedy. 4/6 on 0.2.0; 6/6 now.
|
|
193
|
+
|
|
194
|
+
Not ported from the sibling library: `verify:reset`. It audits a `reset.css` that
|
|
195
|
+
shortapp ships and that had 50 self-inflicted defeats against its own layered bundle.
|
|
196
|
+
dashboard-ui ships no reset and no `html` rule — the only unlayered non-`vd-` rules
|
|
197
|
+
in the bundle are the two `:root, :host` token blocks — so there is nothing for that
|
|
198
|
+
gate to measure and none was invented.
|
|
199
|
+
|
|
118
200
|
### Full class rename table
|
|
119
201
|
|
|
120
202
|
<details>
|
package/CLAUDE.md
CHANGED
|
@@ -3323,7 +3323,7 @@ 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
3328
|
|
|
3329
3329
|
```css
|
|
@@ -3346,6 +3346,46 @@ CSS-only — there is no Tailwind plugin to register, and no `tailwind.config.js
|
|
|
3346
3346
|
> `scripts/build-styles.mjs` as a separate artifact. `verify:bundle` asserts the
|
|
3347
3347
|
> absence of both, and `verify:package` re-asserts it on the packed tarball.
|
|
3348
3348
|
|
|
3349
|
+
> **The prebuilt bundle is UNLAYERED; source, `./source` and `dist/index.css`
|
|
3350
|
+
> keep their layers** (decided 2026-09-16). Inside `@layer components`, every
|
|
3351
|
+
> component rule loses to any unlayered host rule before specificity or source
|
|
3352
|
+
> order is consulted — Tailwind 3 preflight (`* { border-width: 0 }`, `button {
|
|
3353
|
+
> background-color: transparent }`, `input, textarea { color: inherit }`), daisyUI
|
|
3354
|
+
> 4, a Svelte `:global()` reset. Measured on the 0.2.0 artifact: `.vd-btn-primary`
|
|
3355
|
+
> lost its fill, ink, hairline, padding and type; every field lost its hairline;
|
|
3356
|
+
> the active tab lost its rule. The `vd-` rename could never have fixed this; it is
|
|
3357
|
+
> not a name collision. `build-styles.mjs` unwraps pass A at build time so
|
|
3358
|
+
> `src/components` stays layered for the Tailwind-v4 entries, where the layer IS
|
|
3359
|
+
> the contract (`verify:layers`' original assertion). There was no `@layer base`
|
|
3360
|
+
> to relocate — pass A never imported `../base`, and the build now fails if it
|
|
3361
|
+
> does. `build-manifest.mjs` walks every rule's selector instead of the bodies of
|
|
3362
|
+
> `@layer components`, which no longer exist in the bundle.
|
|
3363
|
+
>
|
|
3364
|
+
> **It was invisible on the common path.** A host that `@import`s the bundle into
|
|
3365
|
+
> its `@tailwind` file has Tailwind 3 consume the layer blocks and re-emit the
|
|
3366
|
+
> rules unlayered — the bug vanishes, the library looks correct. It broke on a raw
|
|
3367
|
+
> `<link>`, and Tailwind 3 refused a lone `@import` of the file outright.
|
|
3368
|
+
> `examples/daisyui-starter` passed 10/10 with the bug present because it tested
|
|
3369
|
+
> only the import path and only properties preflight never touches; it now tests
|
|
3370
|
+
> all three paths per control and fails the 0.2.0 artifact 40/54.
|
|
3371
|
+
>
|
|
3372
|
+
> **The two-clause host contract** (consumers: README, GETTING_STARTED):
|
|
3373
|
+
>
|
|
3374
|
+
> 1. _Defends against_ any host rule of lower specificity, wherever it sits in
|
|
3375
|
+
> source order, provided the bundle loads after the host's reset.
|
|
3376
|
+
> 2. _Cannot defend against_ a host rule of higher specificity — a Svelte scoped
|
|
3377
|
+
> `button { }` compiles to `button.svelte-hash` (0,1,1) and beats our 0,1,0 —
|
|
3378
|
+
> or a host that wraps its own CSS in a layer. Remedy: scope element resets by
|
|
3379
|
+
> class or exclude library controls (`button:not([class*="vd-"])`).
|
|
3380
|
+
> `examples/sveltekit-starter` asserts the limit as a loss on purpose.
|
|
3381
|
+
>
|
|
3382
|
+
> **Behaviour change for consumers**: a single-class override still wins by
|
|
3383
|
+
> source order when it loads after us; overriding a compound state rule now needs
|
|
3384
|
+
> matching specificity. Our own `vd:` utilities are consumers too — they beat the
|
|
3385
|
+
> 295 single-class component selectors by source order and lose to the 273
|
|
3386
|
+
> compound ones; `verify:utility-precedence` fails when generated markup relies on
|
|
3387
|
+
> the latter (today: none).
|
|
3388
|
+
|
|
3349
3389
|
> **The `vd:` utility set is CLOSED.** It is generated from
|
|
3350
3390
|
> `design-methodology/dashboard.md` by `build-utility-surface.mjs` — whatever the
|
|
3351
3391
|
> methodology does not cite is not emitted, so a page using it renders unstyled
|
|
@@ -3394,10 +3434,13 @@ Completed:
|
|
|
3394
3434
|
- ✅ Component generator (`npm run new:component`)
|
|
3395
3435
|
- ✅ Storybook 10 with interactive documentation
|
|
3396
3436
|
- ✅ TypeScript definitions
|
|
3397
|
-
- ✅ **
|
|
3437
|
+
- ✅ **Eleven verification gates**, ten wired into CI
|
|
3398
3438
|
([.github/workflows/ci.yml](.github/workflows/ci.yml)): `build:theme:check`,
|
|
3399
3439
|
`verify:layers`, `verify:vocabulary`, `verify:bundle`, `verify:markup`,
|
|
3400
|
-
`verify:
|
|
3440
|
+
`verify:layer-defeat`, `verify:utility-precedence`, `verify:package`, `audit`,
|
|
3441
|
+
`verify:component`, `verify:visual` — plus the two example host checks
|
|
3442
|
+
(`examples/daisyui-starter`, `examples/sveltekit-starter`), which render the
|
|
3443
|
+
prebuilt bundle inside Tailwind 3 + daisyUI 4 and SvelteKit.
|
|
3401
3444
|
`verify:a11y` exists and is deliberately **not** wired — it reports 182
|
|
3402
3445
|
pre-existing violation groups, identical to a pre-rename baseline, dominated by
|
|
3403
3446
|
the designer-blocked `Content/Tertiary` contrast pair. Wiring a permanently red
|
|
@@ -3535,6 +3578,38 @@ The two checks are complementary and neither replaces the other — this one
|
|
|
3535
3578
|
cannot see a 1px height error, and the visual harness cannot see a hardcoded
|
|
3536
3579
|
hex that happens to match its token.
|
|
3537
3580
|
|
|
3581
|
+
### Host verification — computed styles inside a foreign app
|
|
3582
|
+
|
|
3583
|
+
Every gate above checks class NAMES or the bundle's own text. None of them can
|
|
3584
|
+
see a host stylesheet win over a component rule, which is how 0.2.0 shipped a
|
|
3585
|
+
bundle whose every control lost its border to Tailwind 3 preflight. These render
|
|
3586
|
+
the bundle and read computed styles:
|
|
3587
|
+
|
|
3588
|
+
```bash
|
|
3589
|
+
npm run verify:layer-defeat # the 0.2.0 repro; tests/fixtures/layer-defeat.html
|
|
3590
|
+
npm run verify:utility-precedence # no vd: utility in generated markup loses to a compound selector
|
|
3591
|
+
cd examples/daisyui-starter && npm run check # Tailwind 3 + daisyUI 4, three load paths
|
|
3592
|
+
cd examples/sveltekit-starter && npm run check # Svelte scoped styles, incl. the documented limit
|
|
3593
|
+
```
|
|
3594
|
+
|
|
3595
|
+
All carry canaries and run in CI. `verify:layer-defeat` takes `--file <bundle>` so
|
|
3596
|
+
a released artifact can be re-measured; `verify:layers` asserts the inverse layer
|
|
3597
|
+
contract on `dist/dashboard-ui.css` every run, with the layered `dist/index.css`
|
|
3598
|
+
as its canary.
|
|
3599
|
+
|
|
3600
|
+
> **A test that cannot fail when the fix is reverted is not a test.** Each of
|
|
3601
|
+
> these was run against the saved 0.2.0 bundle before it was trusted:
|
|
3602
|
+
> verify:layer-defeat 2/3, verify:layers red on the inverse block, daisyui 40/54
|
|
3603
|
+
> with the fingerprint named on all three controls, sveltekit 4/6. The previous
|
|
3604
|
+
> daisyui check read 10/10 on the same file.
|
|
3605
|
+
|
|
3606
|
+
> **There is no `verify:reset` here, and no `reset.css`.** The sibling shortapp
|
|
3607
|
+
> library ships a reset that had 50 self-inflicted defeats against its own layered
|
|
3608
|
+
> bundle. This library ships no element reset and no `html` rule in the prebuilt
|
|
3609
|
+
> bundle — its only unlayered non-`vd-` rules are the `:root, :host` token blocks —
|
|
3610
|
+
> so there is nothing for that gate to measure. Do not add a reset to the bundle
|
|
3611
|
+
> without adding the gate.
|
|
3612
|
+
|
|
3538
3613
|
## Storybook
|
|
3539
3614
|
|
|
3540
3615
|
Run locally:
|
package/GETTING_STARTED.md
CHANGED
|
@@ -187,6 +187,50 @@ 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
|
+
|
|
190
234
|
## Common Mistakes
|
|
191
235
|
|
|
192
236
|
### ❌ Importing from JavaScript
|
|
@@ -299,6 +343,11 @@ import "./styles.css";
|
|
|
299
343
|
<button class="vd-btn vd-btn-primary">Click me</button>
|
|
300
344
|
```
|
|
301
345
|
|
|
346
|
+
> **Scoped styles and library controls.** A scoped `button { }` in a Svelte
|
|
347
|
+
> component compiles to `button.svelte-<hash>` and outranks the library's
|
|
348
|
+
> single-class rules even with the prebuilt bundle. Scope resets by class or exclude
|
|
349
|
+
> library controls (`button:not([class*="vd-"])`) — see "Without Tailwind v4" above.
|
|
350
|
+
|
|
302
351
|
### Next.js (App Router)
|
|
303
352
|
|
|
304
353
|
In `app/layout.js`:
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ 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
43
|
|
|
@@ -52,8 +52,25 @@ The generated list ships as `@valiify/dashboard-ui/manifest`.
|
|
|
52
52
|
@tailwind utilities;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
`./styles.css` does not render "identically" to `./source`. Its contract is
|
|
56
|
+
narrower and checkable, in two clauses:
|
|
57
|
+
|
|
58
|
+
1. **What it defends against.** The bundle is **unlayered**. Load it after your
|
|
59
|
+
reset and its component rules beat any host rule of *lower* specificity,
|
|
60
|
+
wherever that rule sits in source order — Tailwind 3 preflight, daisyUI's base,
|
|
61
|
+
a `:global(button)` reset in a Svelte component. (0.2.0 did not hold this: its
|
|
62
|
+
rules sat in `@layer components` and lost to every unlayered host rule. The
|
|
63
|
+
fingerprint was a control whose focus ring survived while its border, fill and
|
|
64
|
+
padding did not.)
|
|
65
|
+
2. **What it cannot defend against.** A host rule of *higher* specificity still
|
|
66
|
+
wins. A Svelte scoped `button { border: 0 }` compiles to `button.svelte-hash`
|
|
67
|
+
(0,1,1) and beats our single-class rules (0,1,0). A host that wraps its own CSS
|
|
68
|
+
in a cascade layer changes the arithmetic too. Scope element resets by class, or
|
|
69
|
+
exclude library controls: `button:not([class*="vd-"]) { border: 0 }`.
|
|
70
|
+
|
|
71
|
+
Both clauses are measured in `examples/daisyui-starter` (Tailwind 3 + daisyUI 4,
|
|
72
|
+
three load paths) and `examples/sveltekit-starter` (Svelte scoped styles, including
|
|
73
|
+
clause 2 asserted as a loss) — `npm run check` in each.
|
|
57
74
|
|
|
58
75
|
## Installation
|
|
59
76
|
|
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
|