@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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "valiify-dashboard-ui-sveltekit-starter",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
11
|
+
"check": "node check-scoped-styles.mjs"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@sveltejs/adapter-auto": "^7.0.1",
|
|
15
|
+
"@sveltejs/kit": "^2.63.0",
|
|
16
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
17
|
+
"playwright": "1.62.1",
|
|
18
|
+
"svelte": "^5.56.1",
|
|
19
|
+
"vite": "^8.0.16"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@valiify/dashboard-ui": "^0.2.1"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The app shell's load path — the prebuilt entry, standalone.
|
|
3
|
+
*
|
|
4
|
+
* Only the bundle. dashboard-ui ships no reset.css and no document default: the
|
|
5
|
+
* `./styles.css` entry carries no preflight and no `html` rule, so the host paints
|
|
6
|
+
* its own page (below) and owns its own reset. Import ONE of the library's three
|
|
7
|
+
* style entries, never two — `@valiify/dashboard-ui` (dist/index.css) would bring
|
|
8
|
+
* Tailwind 4's preflight into a host that did not ask for it.
|
|
9
|
+
*/
|
|
10
|
+
@import "@valiify/dashboard-ui/styles.css";
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 32px;
|
|
15
|
+
color: var(--color-content-primary);
|
|
16
|
+
background: var(--color-surface-frame);
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
%sveltekit.head%
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div style="display: contents">%sveltekit.body%</div>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Case 1 — a :global element reset from a Svelte component.
|
|
3
|
+
Compiles to a bare, UNLAYERED `button { border: 0 }` (0,0,1). This is the shape
|
|
4
|
+
of a house reset written inside a component, and it is the case the unlayered
|
|
5
|
+
bundle defends against: our class (0,1,0) beats it on specificity.
|
|
6
|
+
-->
|
|
7
|
+
<div class="row">
|
|
8
|
+
<button id="global-reset-trigger" class="vd-dropdown-field" type="button" aria-haspopup="listbox" aria-expanded="false">
|
|
9
|
+
<span class="vd-dropdown-field-placeholder">:global(button) reset in scope</span>
|
|
10
|
+
</button>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
:global(button) {
|
|
15
|
+
border: 0;
|
|
16
|
+
}
|
|
17
|
+
.row {
|
|
18
|
+
margin-bottom: 24px;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Case 3 — the remedy for case 2. Exclude library controls from the scoped element
|
|
3
|
+
selector: `button:not([class*="vd-"])`. The dev's own plain button still gets the
|
|
4
|
+
reset; ours is never matched, so specificity never enters into it. (Scoping the
|
|
5
|
+
reset by class — `.plain { }` — works the same way and reads better; this form
|
|
6
|
+
is shown because it is the mechanical edit to an existing element reset.)
|
|
7
|
+
-->
|
|
8
|
+
<div class="row">
|
|
9
|
+
<button id="remedy-trigger" class="vd-dropdown-field" type="button" aria-haspopup="listbox" aria-expanded="false">
|
|
10
|
+
<span class="vd-dropdown-field-placeholder">scoped reset that excludes [class*="vd-"]</span>
|
|
11
|
+
</button>
|
|
12
|
+
<button id="remedy-plain" type="button">the component's own plain button</button>
|
|
13
|
+
<button id="remedy-primary" class="vd-btn vd-btn-primary" type="button">Continue</button>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
button:not([class*="vd-"]) {
|
|
18
|
+
border: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
.row {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: 12px;
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Case 2 — a SCOPED element selector. THE CASE THE BUNDLE CANNOT DEFEND AGAINST.
|
|
3
|
+
Svelte scopes `button { }` to `button.svelte-<hash>` — specificity 0,1,1, which
|
|
4
|
+
outranks our single-class rule (0,1,0) whether or not the bundle is layered.
|
|
5
|
+
check-scoped-styles.mjs asserts that our border is LOST here on purpose: this
|
|
6
|
+
pins the contract's second clause (a host rule at higher specificity wins) to a
|
|
7
|
+
measurement, so the README / GETTING_STARTED text cannot drift from what is true.
|
|
8
|
+
-->
|
|
9
|
+
<div class="row">
|
|
10
|
+
<button id="scoped-trigger" class="vd-dropdown-field" type="button" aria-haspopup="listbox" aria-expanded="false">
|
|
11
|
+
<span class="vd-dropdown-field-placeholder">scoped element reset — wins over us</span>
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
button {
|
|
17
|
+
border: 0;
|
|
18
|
+
}
|
|
19
|
+
.row {
|
|
20
|
+
margin-bottom: 24px;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import GlobalReset from "$lib/GlobalReset.svelte";
|
|
3
|
+
import ScopedReset from "$lib/ScopedReset.svelte";
|
|
4
|
+
import ScopedRemedy from "$lib/ScopedRemedy.svelte";
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<h1>dashboard-ui inside SvelteKit — scoped styles vs component rules</h1>
|
|
8
|
+
<GlobalReset />
|
|
9
|
+
<ScopedReset />
|
|
10
|
+
<ScopedRemedy />
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { sveltekit } from "@sveltejs/kit/vite";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
|
|
4
|
+
// No Tailwind in this host at all. The library's prebuilt bundle is a plain
|
|
5
|
+
// stylesheet, and the thing under test is what SvelteKit itself does to CSS.
|
|
6
|
+
export default defineConfig({ plugins: [sveltekit()] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valiify/dashboard-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Tailwind CSS component library for Valiify Dashboard applications",
|
|
5
5
|
"style": "dist/index.css",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"new:component": "node scripts/new-component.mjs",
|
|
50
50
|
"verify:component": "node scripts/verify-component.mjs",
|
|
51
51
|
"verify:layers": "node scripts/verify-layers.mjs",
|
|
52
|
+
"verify:layer-defeat": "node scripts/verify-layer-defeat.mjs",
|
|
53
|
+
"verify:utility-precedence": "node scripts/verify-utility-precedence.mjs",
|
|
52
54
|
"verify:vocabulary": "node scripts/verify-vocabulary.mjs",
|
|
53
55
|
"verify:bundle": "node scripts/verify-bundle.mjs",
|
|
54
56
|
"verify:markup": "node scripts/verify-markup.mjs",
|
|
@@ -89,7 +91,7 @@
|
|
|
89
91
|
"@storybook/addon-themes": "^10.5.10",
|
|
90
92
|
"@storybook/html-vite": "^10.5.10",
|
|
91
93
|
"@tailwindcss/postcss": "^4.3.3",
|
|
92
|
-
"@valiify/val-core": "^0.
|
|
94
|
+
"@valiify/val-core": "^0.6.0",
|
|
93
95
|
"chromatic": "^18.7.2",
|
|
94
96
|
"lucide-static": "^1.33.0",
|
|
95
97
|
"pixelmatch": "^7.2.0",
|
package/src/build/components.css
CHANGED
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
* No utilities.css import either, so this pass emits ZERO utility classes — the
|
|
21
21
|
* prefixed ones come from pass B. theme.css does not declare the layer order, so it
|
|
22
22
|
* is declared here.
|
|
23
|
+
*
|
|
24
|
+
* The components then land in `@layer components`, which scripts/build-styles.mjs
|
|
25
|
+
* UNWRAPS — see there for why a layer is the bug in a bundle shipped into a foreign
|
|
26
|
+
* app. Source, ./source and dist/index.css keep their layers. Because ../base is not
|
|
27
|
+
* imported, there is no `@layer base` block to deal with; build-styles.mjs fails the
|
|
28
|
+
* build if one ever appears.
|
|
23
29
|
*/
|
|
24
30
|
@layer theme, base, components, utilities;
|
|
25
31
|
|
package/src/build/utilities.css
CHANGED
|
@@ -28,8 +28,12 @@
|
|
|
28
28
|
* `@layer utilities`. Unlayered is the safer shape for a layer shipped INTO a foreign
|
|
29
29
|
* app: unlayered rules beat layered ones before specificity is consulted, so a layered
|
|
30
30
|
* `vd:flex` would silently lose to any unlayered host rule touching the same property
|
|
31
|
-
* (daisyUI 4 is entirely unlayered).
|
|
32
|
-
*
|
|
31
|
+
* (daisyUI 4 is entirely unlayered). The SAME sentence governs pass A: build-styles.mjs
|
|
32
|
+
* unwraps the component classes too, because inside @layer components they lost to
|
|
33
|
+
* the host's preflight and to daisyUI (the 0.2.0 bug, scripts/verify-layer-defeat.mjs).
|
|
34
|
+
* With both passes unlayered, a vd: utility beats a component rule of equal specificity
|
|
35
|
+
* by source order (pass B follows pass A) and loses to a compound component selector —
|
|
36
|
+
* scripts/verify-utility-precedence.mjs asserts no generated markup relies on the latter.
|
|
33
37
|
*/
|
|
34
38
|
@layer theme, base, components, utilities;
|
|
35
39
|
|