@valiify/dashboard-ui 0.3.0 → 0.5.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 +948 -10
- package/COMPONENTS.md +199 -79
- package/GETTING_STARTED.md +116 -54
- package/QUICK_REFERENCE.md +48 -30
- package/README.md +107 -85
- package/TROUBLESHOOTING.md +52 -34
- package/class-manifest.json +141 -71
- package/design-methodology/dashboard.md +92 -80
- package/dist/dashboard-ui.css +1529 -1078
- package/dist/index.css +1250 -732
- package/package.json +17 -10
- package/scripts/codemods/0.5.0-chip-sizes.mjs +437 -0
- package/src/build/utilities.css +7 -10
- package/src/components/_template.css +12 -8
- package/src/components/alert.css +35 -8
- package/src/components/avatar.css +42 -30
- package/src/components/breadcrumbs.css +39 -22
- package/src/components/button.css +84 -14
- package/src/components/card.css +2 -2
- package/src/components/checkbox.css +16 -11
- package/src/components/chip.css +155 -79
- package/src/components/composer.css +145 -0
- package/src/components/data-row.css +10 -6
- package/src/components/divider.css +17 -22
- package/src/components/dropdown-field.css +83 -43
- package/src/components/dropdown-menu.css +80 -14
- package/src/components/field-verification.css +21 -5
- package/src/components/filter-segment.css +27 -8
- package/src/components/icon-button.css +49 -10
- package/src/components/index.css +2 -0
- package/src/components/input.css +88 -32
- package/src/components/link.css +27 -16
- package/src/components/loading-inline.css +15 -21
- package/src/components/menu-item.css +149 -49
- package/src/components/modal.css +8 -5
- package/src/components/navigation-rail.css +67 -31
- package/src/components/pagination-item.css +29 -28
- package/src/components/pagination.css +9 -14
- package/src/components/pill.css +16 -10
- package/src/components/progress-bar.css +8 -10
- package/src/components/radio-select.css +9 -2
- package/src/components/recipient-input.css +119 -0
- package/src/components/section-marker.css +5 -5
- package/src/components/segment-selector.css +9 -3
- package/src/components/sensitive-data.css +7 -5
- package/src/components/skeleton.css +18 -6
- package/src/components/step.css +15 -4
- package/src/components/stepper.css +3 -2
- package/src/components/switch.css +7 -0
- package/src/components/tabs.css +122 -28
- package/src/components/tag.css +156 -51
- package/src/components/text-button.css +54 -59
- package/src/components/textarea.css +87 -22
- package/src/components/toast.css +41 -15
- package/src/components/tooltip.css +13 -2
- package/src/fonts.css +2 -1
- package/src/library.css +1 -1
- package/src/reset.css +1 -1
- package/src/themes/valiify-tokens.css +101 -126
- package/src/themes/valiify.css +258 -157
- package/src/utility-surface.css +51 -49
- package/types/components.d.ts +145 -25
- package/CLAUDE.md +0 -3740
- package/examples/README.md +0 -198
- package/examples/basic/index.html +0 -155
- package/examples/daisyui-starter/README.md +0 -58
- package/examples/daisyui-starter/check-no-bleed.mjs +0 -249
- package/examples/daisyui-starter/index.html +0 -72
- package/examples/daisyui-starter/linked.html +0 -74
- package/examples/daisyui-starter/package-lock.json +0 -2221
- package/examples/daisyui-starter/package.json +0 -22
- package/examples/daisyui-starter/postcss.config.js +0 -1
- package/examples/daisyui-starter/src/host.css +0 -14
- package/examples/daisyui-starter/src/only-import.css +0 -4
- package/examples/daisyui-starter/src/styles.css +0 -36
- package/examples/daisyui-starter/tailwind.config.js +0 -13
- package/examples/postcss-starter/README.md +0 -47
- package/examples/postcss-starter/index.html +0 -54
- package/examples/postcss-starter/package.json +0 -19
- package/examples/postcss-starter/postcss.config.js +0 -5
- package/examples/postcss-starter/src/styles.css +0 -17
- package/examples/sveltekit-starter/README.md +0 -32
- package/examples/sveltekit-starter/check-scoped-styles.mjs +0 -103
- package/examples/sveltekit-starter/package-lock.json +0 -1300
- package/examples/sveltekit-starter/package.json +0 -24
- package/examples/sveltekit-starter/src/app.css +0 -17
- package/examples/sveltekit-starter/src/app.html +0 -11
- package/examples/sveltekit-starter/src/lib/GlobalReset.svelte +0 -20
- package/examples/sveltekit-starter/src/lib/ScopedRemedy.svelte +0 -27
- package/examples/sveltekit-starter/src/lib/ScopedReset.svelte +0 -22
- package/examples/sveltekit-starter/src/routes/+layout.svelte +0 -6
- package/examples/sveltekit-starter/src/routes/+page.svelte +0 -10
- package/examples/sveltekit-starter/svelte.config.js +0 -4
- package/examples/sveltekit-starter/vite.config.js +0 -6
- package/examples/vite-starter/README.md +0 -125
- package/examples/vite-starter/index.html +0 -12
- package/examples/vite-starter/package.json +0 -19
- package/examples/vite-starter/src/main.js +0 -188
- package/examples/vite-starter/src/styles.css +0 -22
- package/examples/vite-starter/vite.config.js +0 -6
- package/src/themes/valiify-type-prefixed.css +0 -37
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "valiify-ui-daisyui-starter",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "vite build",
|
|
9
|
-
"check": "node check-no-bleed.mjs"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"daisyui": "^4.12.14",
|
|
13
|
-
"playwright": "^1.62.1",
|
|
14
|
-
"tailwindcss": "^3.4.17",
|
|
15
|
-
"postcss": "^8.5.26",
|
|
16
|
-
"autoprefixer": "^10.4.20",
|
|
17
|
-
"vite": "^5.4.11"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@valiify/dashboard-ui": "^0.3.0"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default { plugins: { tailwindcss: {}, autoprefixer: {} } };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The host's stylesheet ALONE — no @import of ours. linked.html pairs this with a
|
|
3
|
-
* <link> to the bundle file, so the bundle reaches the browser exactly as shipped:
|
|
4
|
-
* the host's Tailwind never sees it and cannot strip its cascade layers.
|
|
5
|
-
*/
|
|
6
|
-
@tailwind base;
|
|
7
|
-
@tailwind components;
|
|
8
|
-
@tailwind utilities;
|
|
9
|
-
|
|
10
|
-
body {
|
|
11
|
-
font-size: 17px;
|
|
12
|
-
line-height: 2;
|
|
13
|
-
color: rebeccapurple;
|
|
14
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/* Probe: our bundle as a SEPARATE file through the host's PostCSS — no @tailwind
|
|
2
|
-
directives in this file. Does Tailwind 3 strip the layers, pass them through, or
|
|
3
|
-
refuse? check-no-bleed.mjs reads the answer off the served CSS. */
|
|
4
|
-
@import "@valiify/dashboard-ui/styles.css";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The @import MUST come first.
|
|
3
|
-
*
|
|
4
|
-
* CSS requires every @import to precede all other rules, so putting it after the
|
|
5
|
-
* @tailwind directives — which expand into rules — gets it silently DISCARDED. That
|
|
6
|
-
* is the same trap CLAUDE.md documents for the font import, and it cost a debugging
|
|
7
|
-
* pass here: daisyUI rendered correctly while every vd- class fell back to unstyled,
|
|
8
|
-
* which reads exactly like a namespace failure and is not one.
|
|
9
|
-
*
|
|
10
|
-
* That order is also what makes this the honest test. `@tailwind base` expands to
|
|
11
|
-
* Tailwind 3's preflight, UNLAYERED and AFTER our bundle: `*, ::before, ::after {
|
|
12
|
-
* border-width: 0 }`, `button { background-color: transparent }`, `button, input,
|
|
13
|
-
* textarea { font-size: 100%; line-height: inherit; color: inherit; padding: 0 }`.
|
|
14
|
-
* A component rule that sits inside a cascade layer loses to every one of those
|
|
15
|
-
* before specificity or source order is consulted. A component rule that is
|
|
16
|
-
* unlayered wins on specificity (a class beats an element and beats `*`).
|
|
17
|
-
* check-no-bleed.mjs measures which of the two the shipped bundle is.
|
|
18
|
-
*/
|
|
19
|
-
@import "@valiify/dashboard-ui/styles.css";
|
|
20
|
-
|
|
21
|
-
@tailwind base;
|
|
22
|
-
@tailwind components;
|
|
23
|
-
@tailwind utilities;
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* The host's own body type — deliberately NOT the library's defaults. Preflight
|
|
27
|
-
* makes form controls inherit font-size, line-height and color from here; if our
|
|
28
|
-
* input rule loses, the input reads 17px / 34px / purple instead of the designed
|
|
29
|
-
* 13px / 19.5px / Content-Primary, and the check can see it. With the library's own
|
|
30
|
-
* values here, the defeat would be invisible by coincidence.
|
|
31
|
-
*/
|
|
32
|
-
body {
|
|
33
|
-
font-size: 17px;
|
|
34
|
-
line-height: 2;
|
|
35
|
-
color: rebeccapurple;
|
|
36
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tailwind 3 + daisyUI 4 — the host app's stack (the dashboard app), not ours.
|
|
3
|
-
*
|
|
4
|
-
* The library ships dist/dashboard-ui.css, compiled by Tailwind 4 and imported here
|
|
5
|
-
* as a plain stylesheet; this config never sees it. That is the point: a consumer's
|
|
6
|
-
* Tailwind major is irrelevant to a prebuilt bundle. What this config DOES do is
|
|
7
|
-
* emit Tailwind 3's preflight — `@tailwind base` — unlayered and after our import,
|
|
8
|
-
* which is exactly the host reset check-no-bleed.mjs measures our components under.
|
|
9
|
-
*/
|
|
10
|
-
export default {
|
|
11
|
-
content: ["./index.html", "./linked.html", "./src/**/*.{js,ts}"],
|
|
12
|
-
plugins: [require("daisyui")],
|
|
13
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Valiify Dashboard UI - PostCSS Starter
|
|
2
|
-
|
|
3
|
-
Minimal example using PostCSS CLI (no bundler).
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Install
|
|
9
|
-
npm install
|
|
10
|
-
|
|
11
|
-
# Build CSS
|
|
12
|
-
npm run build
|
|
13
|
-
|
|
14
|
-
# Watch mode
|
|
15
|
-
npm run watch
|
|
16
|
-
|
|
17
|
-
# Build and serve (requires serve: npm i -g serve)
|
|
18
|
-
npm run serve
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
> **Note:** If you copied this example from the GitHub repo, the `package.json` may reference `"file:../.."`. When installing from npm, this is automatically fixed to use the published version. If you see installation errors, check that the dependency is set to a version number like `"^0.1.0-alpha.2"`.
|
|
22
|
-
|
|
23
|
-
## Key Files
|
|
24
|
-
|
|
25
|
-
- `postcss.config.js` - PostCSS configuration with @tailwindcss/postcss
|
|
26
|
-
- `src/styles.css` - Source stylesheet
|
|
27
|
-
- `dist/styles.css` - Built stylesheet (generated)
|
|
28
|
-
- `index.html` - HTML file linking to built CSS
|
|
29
|
-
|
|
30
|
-
## Why @tailwindcss/postcss?
|
|
31
|
-
|
|
32
|
-
Tailwind v4 requires an integration package. For PostCSS, that's `@tailwindcss/postcss`.
|
|
33
|
-
|
|
34
|
-
Without it, `@import "tailwindcss"` does nothing and your styles are missing with no error.
|
|
35
|
-
|
|
36
|
-
## For webpack Users
|
|
37
|
-
|
|
38
|
-
Same setup, but install `@tailwindcss/webpack` instead of `@tailwindcss/postcss` and add it to your webpack config:
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
// webpack.config.js
|
|
42
|
-
import tailwindcss from "@tailwindcss/webpack";
|
|
43
|
-
|
|
44
|
-
export default {
|
|
45
|
-
plugins: [tailwindcss()],
|
|
46
|
-
};
|
|
47
|
-
```
|
|
@@ -1,54 +0,0 @@
|
|
|
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.0" />
|
|
6
|
-
<title>Valiify Dashboard UI - PostCSS Starter</title>
|
|
7
|
-
<link rel="stylesheet" href="dist/styles.css" />
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div style="max-width: 800px; margin: 0 auto">
|
|
11
|
-
<h1
|
|
12
|
-
style="
|
|
13
|
-
font-size: 32px;
|
|
14
|
-
font-weight: 600;
|
|
15
|
-
margin-bottom: 24px;
|
|
16
|
-
color: var(--color-content-primary);
|
|
17
|
-
"
|
|
18
|
-
>
|
|
19
|
-
PostCSS Setup Working
|
|
20
|
-
</h1>
|
|
21
|
-
|
|
22
|
-
<div style="display: flex; gap: 12px; margin-bottom: 24px">
|
|
23
|
-
<button class="vd-btn vd-btn-primary">Primary Button</button>
|
|
24
|
-
<button class="vd-btn vd-btn-outline">Outline Button</button>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<div class="vd-alert vd-alert-success" role="alert">
|
|
28
|
-
<div class="vd-alert-body">
|
|
29
|
-
<svg class="vd-alert-icon vd-icon vd-icon-size-18" aria-hidden="true">
|
|
30
|
-
<use href="#check-circle" />
|
|
31
|
-
</svg>
|
|
32
|
-
<div class="vd-alert-content">
|
|
33
|
-
<p class="vd-alert-title">Setup Complete</p>
|
|
34
|
-
<p class="vd-alert-message">
|
|
35
|
-
If you can see this styled alert, your PostCSS + Tailwind setup
|
|
36
|
-
is working correctly.
|
|
37
|
-
</p>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<!-- Load sprite (inline it for production) -->
|
|
44
|
-
<div style="display: none" id="sprite-container"></div>
|
|
45
|
-
<script type="module">
|
|
46
|
-
// In production, you'd inline this or use a bundler
|
|
47
|
-
fetch("../../src/icons/sprite.svg")
|
|
48
|
-
.then((r) => r.text())
|
|
49
|
-
.then((svg) => {
|
|
50
|
-
document.getElementById("sprite-container").innerHTML = svg;
|
|
51
|
-
});
|
|
52
|
-
</script>
|
|
53
|
-
</body>
|
|
54
|
-
</html>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "valiify-ui-postcss-starter",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "postcss src/styles.css -o dist/styles.css",
|
|
7
|
-
"watch": "postcss src/styles.css -o dist/styles.css --watch",
|
|
8
|
-
"serve": "npm run build && npx serve ."
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"@valiify/dashboard-ui": "^0.3.0"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"@tailwindcss/postcss": "^4.0.0",
|
|
15
|
-
"postcss": "^8.4.0",
|
|
16
|
-
"postcss-cli": "^11.0.0",
|
|
17
|
-
"tailwindcss": "^4.0.0"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PostCSS + Tailwind v4 setup for Valiify Dashboard UI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* Optional: Load fonts */
|
|
6
|
-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");
|
|
7
|
-
|
|
8
|
-
/* Required */
|
|
9
|
-
@import "tailwindcss";
|
|
10
|
-
@import "@valiify/dashboard-ui/source";
|
|
11
|
-
|
|
12
|
-
/* Custom styles */
|
|
13
|
-
body {
|
|
14
|
-
font-family: Inter, system-ui, sans-serif;
|
|
15
|
-
background: var(--color-surface-frame);
|
|
16
|
-
padding: 2rem;
|
|
17
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# dashboard-ui + SvelteKit (Svelte 5)
|
|
2
|
-
|
|
3
|
-
The scoped-style test. A Svelte component's `<style>` compiles to **unlayered**
|
|
4
|
-
CSS that Vite injects after the app stylesheet — a second source of the
|
|
5
|
-
cascade-layer defeat that `examples/daisyui-starter` measures with Tailwind 3
|
|
6
|
-
preflight, and one a plain Vite page never reproduces. A SvelteKit host has it.
|
|
7
|
-
|
|
8
|
-
No Tailwind here at all. The shell imports `styles.css` and nothing else; the
|
|
9
|
-
thing under test is what SvelteKit does to component CSS. (dashboard-ui ships no
|
|
10
|
-
reset.css — the host paints its own page in `src/app.css`.)
|
|
11
|
-
|
|
12
|
-
`npm run check` starts the dev server, renders the page and asserts computed
|
|
13
|
-
styles for three components in `src/lib`, reading the compiled selectors off the
|
|
14
|
-
served stylesheets rather than assuming them:
|
|
15
|
-
|
|
16
|
-
| case | scoped source | compiles to | bundle |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| 1 | `:global(button) { border: 0 }` | `button` — 0,0,1, unlayered | **must win** (this is the fix) |
|
|
19
|
-
| 2 | `button { border: 0 }` | `button.svelte-hash` — 0,1,1 | **cannot win** — asserted as a loss |
|
|
20
|
-
| 3 | `button:not([class*="vd-"]) { border: 0 }` | never matches ours | must win; the dev's plain button still resets |
|
|
21
|
-
|
|
22
|
-
Case 2 is the honest one. Unlayering the bundle fixes preflight, daisyUI and any
|
|
23
|
-
`:global` reset; it does not fix a host rule at higher specificity, and a scoped
|
|
24
|
-
element selector on the same element is exactly that. The remedy is case 3, or
|
|
25
|
-
scoping the reset by class. The assertion pins the limit to a measurement so the
|
|
26
|
-
README and GETTING_STARTED contract's second clause cannot drift from what is true.
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install
|
|
30
|
-
npm run check
|
|
31
|
-
npm run dev
|
|
32
|
-
```
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Scoped-style assertion: dashboard-ui inside SvelteKit + Svelte 5.
|
|
4
|
-
*
|
|
5
|
-
* npm run check
|
|
6
|
-
*
|
|
7
|
-
* A Svelte component's <style> compiles to UNLAYERED CSS that Vite injects after
|
|
8
|
-
* the app's stylesheet. That is a second source of the cascade-layer defeat the
|
|
9
|
-
* daisyui-starter measures — one a plain Vite page never reproduces, and one a
|
|
10
|
-
* SvelteKit host has. Three cases, each a real component in src/lib, each
|
|
11
|
-
* measured against the compiled output rather than the source:
|
|
12
|
-
*
|
|
13
|
-
* 1 :global(button) { border: 0 } → bare `button`, 0,0,1. Bundle MUST win.
|
|
14
|
-
* 2 button { border: 0 } → `button.svelte-h`, 0,1,1. Bundle CANNOT win.
|
|
15
|
-
* Asserted as a loss on purpose — see below.
|
|
16
|
-
* 3 button:not([class*="vd-"]) → never matches ours. Bundle MUST win,
|
|
17
|
-
* and the dev's plain button MUST still reset.
|
|
18
|
-
*
|
|
19
|
-
* Case 2 is asserted in the direction that is TRUE: our border is lost. Unlayering
|
|
20
|
-
* the bundle fixes preflight, daisyUI and case 1; it does not and cannot fix a host
|
|
21
|
-
* rule at higher specificity. Pinning that to a measurement keeps the docs' second
|
|
22
|
-
* clause honest — if this assertion ever flips, the contract text is stale.
|
|
23
|
-
*
|
|
24
|
-
* The scoping shape itself is read from the served CSS, not assumed.
|
|
25
|
-
*/
|
|
26
|
-
import { chromium } from "playwright";
|
|
27
|
-
import { createServer } from "vite";
|
|
28
|
-
|
|
29
|
-
const RED = "\x1b[31m", GRN = "\x1b[32m", DIM = "\x1b[2m", BOLD = "\x1b[1m", OFF = "\x1b[0m";
|
|
30
|
-
const server = await createServer({ server: { port: 5198 }, logLevel: "silent" });
|
|
31
|
-
await server.listen();
|
|
32
|
-
const browser = await chromium.launch();
|
|
33
|
-
const page = await browser.newPage();
|
|
34
|
-
await page.goto("http://localhost:5198/", { waitUntil: "networkidle" });
|
|
35
|
-
|
|
36
|
-
const style = (sel, prop) =>
|
|
37
|
-
page.evaluate(([s, p]) => {
|
|
38
|
-
const el = document.querySelector(s);
|
|
39
|
-
return el ? getComputedStyle(el).getPropertyValue(p) : null;
|
|
40
|
-
}, [sel, prop]);
|
|
41
|
-
const token = (name) =>
|
|
42
|
-
page.evaluate((n) => {
|
|
43
|
-
const probe = document.createElement("span");
|
|
44
|
-
probe.style.color = `var(${n})`;
|
|
45
|
-
document.body.append(probe);
|
|
46
|
-
const v = getComputedStyle(probe).color;
|
|
47
|
-
probe.remove();
|
|
48
|
-
return v;
|
|
49
|
-
}, name);
|
|
50
|
-
|
|
51
|
-
// Evidence, not assumption: how did Svelte actually scope the element selector?
|
|
52
|
-
const scoped = await page.evaluate(() => {
|
|
53
|
-
const out = [];
|
|
54
|
-
for (const sheet of document.styleSheets) {
|
|
55
|
-
let rules; try { rules = sheet.cssRules; } catch { continue; }
|
|
56
|
-
for (const r of rules) if (r.selectorText && /^button\.svelte-|^button:not|^button$/.test(r.selectorText)) out.push(r.selectorText);
|
|
57
|
-
}
|
|
58
|
-
return out;
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const results = [];
|
|
62
|
-
const check = async (label, sel, prop, want, why) => {
|
|
63
|
-
const got = await style(sel, prop);
|
|
64
|
-
results.push({ label, prop, got, want, ok: got === want, why });
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// The hairline is authored 0.5px; Chrome computes it as 1px (CLAUDE.md). 0px is the loss.
|
|
68
|
-
await check("case 1 · :global(button) reset — our hairline survives",
|
|
69
|
-
"#global-reset-trigger", "border-top-width", "1px",
|
|
70
|
-
"a bare unlayered `button { border: 0 }` beat our class. The bundle's rule is inside a cascade layer; unlayered, 0,1,0 beats 0,0,1.");
|
|
71
|
-
await check("case 2 · scoped button { } — our hairline is LOST (documented limit)",
|
|
72
|
-
"#scoped-trigger", "border-top-width", "0px",
|
|
73
|
-
"our border SURVIVED a 0,1,1 scoped element rule. That is not possible under CSS specificity — either Svelte changed its scoping (check the selectors printed below) or the bundle grew specificity. Update the docs' second clause; do not just flip this assertion.");
|
|
74
|
-
await check("case 3 · button:not([class*=\"vd-\"]) — our hairline survives",
|
|
75
|
-
"#remedy-trigger", "border-top-width", "1px",
|
|
76
|
-
"the excluded selector matched our control, or the bundle's rule lost anyway (layered).");
|
|
77
|
-
// Measured on padding, which only the remedy rule sets (case 1's :global reset touches
|
|
78
|
-
// border on every button on the page, so border alone could not tell the two apart).
|
|
79
|
-
await check("case 3 · the component's own plain button is still reset (padding, UA default 6px)",
|
|
80
|
-
"#remedy-plain", "padding-left", "0px",
|
|
81
|
-
"the remedy stopped resetting the dev's own controls — it must not be a no-op.");
|
|
82
|
-
await check("case 3 · our trigger keeps its 12px padding under the same rule",
|
|
83
|
-
"#remedy-trigger", "padding-left", "12px",
|
|
84
|
-
"the excluded selector matched our control.");
|
|
85
|
-
const contrast = await token("--color-content-contrast");
|
|
86
|
-
await check("case 3 · .vd-btn-primary keeps its Content/Contrast ink beside the :global reset",
|
|
87
|
-
"#remedy-primary", "color", contrast,
|
|
88
|
-
"the label inherited the page ink onto the blue fill — a `button { color: inherit }`-shaped host rule beat .vd-btn-primary.");
|
|
89
|
-
|
|
90
|
-
await browser.close();
|
|
91
|
-
await server.close();
|
|
92
|
-
|
|
93
|
-
console.log(`\n${BOLD}dashboard-ui inside SvelteKit + Svelte 5${OFF}\n`);
|
|
94
|
-
console.log(` ${DIM}compiled element selectors served to the page:${OFF}`);
|
|
95
|
-
for (const s of scoped) console.log(` ${DIM} ${s}${OFF}`);
|
|
96
|
-
console.log();
|
|
97
|
-
for (const r of results) {
|
|
98
|
-
console.log(` ${r.ok ? GRN + "PASS" : RED + "FAIL"}${OFF} ${r.label} ${DIM}${r.prop}=${r.got} (want ${r.want})${OFF}`);
|
|
99
|
-
if (!r.ok && r.why) for (const l of r.why.split("\n")) console.log(`${DIM} ${l}${OFF}`);
|
|
100
|
-
}
|
|
101
|
-
const failed = results.filter((r) => !r.ok);
|
|
102
|
-
console.log(`\n ${failed.length ? RED : GRN}${results.length - failed.length}/${results.length} passed${OFF}\n`);
|
|
103
|
-
process.exit(failed.length ? 1 : 0);
|