@rozie-ui/dialog-svelte 0.0.0-stage → 0.2.4
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 +46 -0
- package/LICENSE +21 -0
- package/README.md +86 -2
- package/dist/Dialog.svelte +320 -0
- package/dist/Dialog.svelte.d.ts +50 -0
- package/dist/internal/scrollLock.d.ts +3 -0
- package/dist/internal/scrollLock.js +47 -0
- package/dist/themes/base.css +58 -0
- package/dist/themes/bootstrap.css +37 -0
- package/dist/themes/material.css +37 -0
- package/dist/themes/shadcn.css +38 -0
- package/package.json +70 -3
- package/src/Dialog.svelte +320 -0
- package/src/internal/scrollLock.ts +48 -0
- package/src/themes/base.css +58 -0
- package/src/themes/bootstrap.css +37 -0
- package/src/themes/material.css +37 -0
- package/src/themes/shadcn.css +38 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @rozie-ui/dialog — Material Design 3 bridge.
|
|
3
|
+
*
|
|
4
|
+
* Maps the dialog tokens onto the MD3 system color roles (`--md-sys-color-*`)
|
|
5
|
+
* emitted by material-web / @material/material-color-utilities theme builders.
|
|
6
|
+
* Falls back to the baseline M3 light palette when those vars are absent, so it
|
|
7
|
+
* renders correctly even without a generated theme.
|
|
8
|
+
*
|
|
9
|
+
* import '@rozie-ui/dialog-svelte/themes/material.css';
|
|
10
|
+
*
|
|
11
|
+
* M3 dialogs are heavily rounded (28dp), use the surface-container-high color,
|
|
12
|
+
* and a scrim at ~32% of the scrim color role.
|
|
13
|
+
*
|
|
14
|
+
* HOW IT MAPS. This bridge declares no public token: it re-declares the private wiring of
|
|
15
|
+
* each token it maps, with the design system's variable as the fallback
|
|
16
|
+
* (`--rdg-x: var(--rozie-dialog-x, <design-system variable>)`). The component reads every token
|
|
17
|
+
* public-first, so on all six targets:
|
|
18
|
+
* - a public `--rozie-dialog-*` token set on any ancestor (or on the component) wins;
|
|
19
|
+
* - otherwise the design system's variable applies, resolved AT the component (`.rozie-dialog`
|
|
20
|
+
* and the Lit host `rozie-dialog`), so a `.dark` / `data-bs-theme` wrapper narrower than
|
|
21
|
+
* <html> is followed;
|
|
22
|
+
* - a Lit component nested in another shadow root, which no document selector reaches,
|
|
23
|
+
* inherits the `:root` copy instead: there the design system's variables are read at
|
|
24
|
+
* the document root.
|
|
25
|
+
* This rule outranks base.css's `:where(:root)` wiring, so import order does not matter.
|
|
26
|
+
*/
|
|
27
|
+
:root,
|
|
28
|
+
.rozie-dialog,
|
|
29
|
+
rozie-dialog {
|
|
30
|
+
--rdg-bg: var(--rozie-dialog-bg, var(--md-sys-color-surface-container-high, #ece6f0));
|
|
31
|
+
--rdg-color: var(--rozie-dialog-color, var(--md-sys-color-on-surface, #1d1b20));
|
|
32
|
+
--rdg-border: var(--rozie-dialog-border, none);
|
|
33
|
+
--rdg-radius: var(--rozie-dialog-radius, 1.75rem);
|
|
34
|
+
|
|
35
|
+
--rdg-backdrop-bg: var(--rozie-dialog-backdrop-bg, color-mix(in srgb, var(--md-sys-color-scrim, #000) 32%, transparent));
|
|
36
|
+
--rdg-shadow: var(--rozie-dialog-shadow, 0 8px 12px 6px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.3));
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @rozie-ui/dialog — shadcn/ui (Radix) bridge.
|
|
3
|
+
*
|
|
4
|
+
* Maps the dialog tokens onto the shadcn/ui CSS variables defined on `:root`
|
|
5
|
+
* / `.dark` (the classic HSL-channel convention: `--background: 0 0% 100%`
|
|
6
|
+
* consumed as `hsl(var(--background))`). Because it reads those vars live, the
|
|
7
|
+
* dialog automatically follows light/dark theme switches.
|
|
8
|
+
*
|
|
9
|
+
* import '@rozie-ui/dialog-svelte/themes/shadcn.css';
|
|
10
|
+
*
|
|
11
|
+
* If your shadcn setup predates the `hsl()`-wrapping convention (Tailwind v4 /
|
|
12
|
+
* oklch tokens emit pre-formed colors), drop the `hsl(...)` wrappers below.
|
|
13
|
+
*
|
|
14
|
+
* HOW IT MAPS. This bridge declares no public token: it re-declares the private wiring of
|
|
15
|
+
* each token it maps, with the design system's variable as the fallback
|
|
16
|
+
* (`--rdg-x: var(--rozie-dialog-x, <design-system variable>)`). The component reads every token
|
|
17
|
+
* public-first, so on all six targets:
|
|
18
|
+
* - a public `--rozie-dialog-*` token set on any ancestor (or on the component) wins;
|
|
19
|
+
* - otherwise the design system's variable applies, resolved AT the component (`.rozie-dialog`
|
|
20
|
+
* and the Lit host `rozie-dialog`), so a `.dark` / `data-bs-theme` wrapper narrower than
|
|
21
|
+
* <html> is followed;
|
|
22
|
+
* - a Lit component nested in another shadow root, which no document selector reaches,
|
|
23
|
+
* inherits the `:root` copy instead: there the design system's variables are read at
|
|
24
|
+
* the document root.
|
|
25
|
+
* This rule outranks base.css's `:where(:root)` wiring, so import order does not matter.
|
|
26
|
+
*/
|
|
27
|
+
:root,
|
|
28
|
+
.rozie-dialog,
|
|
29
|
+
rozie-dialog {
|
|
30
|
+
--rdg-bg: var(--rozie-dialog-bg, hsl(var(--background, 0 0% 100%)));
|
|
31
|
+
--rdg-color: var(--rozie-dialog-color, hsl(var(--foreground, 222.2 84% 4.9%)));
|
|
32
|
+
--rdg-border: var(--rozie-dialog-border, 1px solid hsl(var(--border, 214.3 31.8% 91.4%)));
|
|
33
|
+
--rdg-radius: var(--rozie-dialog-radius, var(--radius, 0.5rem));
|
|
34
|
+
|
|
35
|
+
/* shadcn dialogs use a soft, low scrim */
|
|
36
|
+
--rdg-backdrop-bg: var(--rozie-dialog-backdrop-bg, hsl(var(--background, 0 0% 0%) / 0.8));
|
|
37
|
+
--rdg-shadow: var(--rozie-dialog-shadow, 0 10px 38px hsl(var(--foreground, 222.2 84% 4.9%) / 0.18));
|
|
38
|
+
}
|