@passui/tokens 0.1.2 → 0.1.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.
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Accent colors people can choose. Blush, the soft pink of the iPhone 15,
3
+ * is the default and Passui's own color; the others are calm, slightly
4
+ * muted tones that sit well on warm paper.
5
+ * Each sets the four accent roles for light and dark schemes.
6
+ */
7
+ export interface AccentColors {
8
+ accent: string;
9
+ onAccent: string;
10
+ accentText: string;
11
+ accentSoft: string;
12
+ }
13
+ export type AccentId = "blush" | "honey" | "sage" | "ocean" | "lavender" | "rose" | "graphite";
14
+ export interface Accent {
15
+ id: AccentId;
16
+ name: string;
17
+ /**
18
+ * The color that stands for this accent in pickers and on the brand. Usually
19
+ * the fill itself; Blush keeps its soft pink here while controls use a
20
+ * deeper shade that can be seen against white.
21
+ */
22
+ swatch: string;
23
+ light: AccentColors;
24
+ dark: AccentColors;
25
+ }
26
+ export declare const accents: Record<AccentId, Accent>;
27
+ export declare const defaultAccent: AccentId;
28
+ export declare function isAccentId(value: unknown): value is AccentId;
package/dist/accent.js ADDED
@@ -0,0 +1,127 @@
1
+ // src/accent.ts
2
+ const accents = {
3
+ blush: {
4
+ id: "blush",
5
+ name: "Blush",
6
+ swatch: "#f2d4d7",
7
+ light: {
8
+ accent: "#d16988",
9
+ onAccent: "#1c1c1e",
10
+ accentText: "#9e3b4f",
11
+ accentSoft: "#fbeff0"
12
+ },
13
+ dark: {
14
+ accent: "#e8b4bb",
15
+ onAccent: "#22131a",
16
+ accentText: "#efb3bc",
17
+ accentSoft: "#36242a"
18
+ }
19
+ },
20
+ honey: {
21
+ id: "honey",
22
+ name: "Honey",
23
+ swatch: "#efbd52",
24
+ light: {
25
+ accent: "#efbd52",
26
+ onAccent: "#1c1c1e",
27
+ accentText: "#835608",
28
+ accentSoft: "#f8eed6"
29
+ },
30
+ dark: {
31
+ accent: "#e2b04f",
32
+ onAccent: "#1c1c1e",
33
+ accentText: "#e8bf6c",
34
+ accentSoft: "#342b1a"
35
+ }
36
+ },
37
+ sage: {
38
+ id: "sage",
39
+ name: "Sage",
40
+ swatch: "#a9c29b",
41
+ light: {
42
+ accent: "#a9c29b",
43
+ onAccent: "#1c1c1e",
44
+ accentText: "#46653b",
45
+ accentSoft: "#e6ede0"
46
+ },
47
+ dark: {
48
+ accent: "#93b285",
49
+ onAccent: "#141812",
50
+ accentText: "#a9c79c",
51
+ accentSoft: "#232b20"
52
+ }
53
+ },
54
+ ocean: {
55
+ id: "ocean",
56
+ name: "Ocean",
57
+ swatch: "#9cc3e6",
58
+ light: {
59
+ accent: "#9cc3e6",
60
+ onAccent: "#1c1c1e",
61
+ accentText: "#2c6193",
62
+ accentSoft: "#e2ecf6"
63
+ },
64
+ dark: {
65
+ accent: "#79acdb",
66
+ onAccent: "#0f1720",
67
+ accentText: "#93bde4",
68
+ accentSoft: "#1d2834"
69
+ }
70
+ },
71
+ lavender: {
72
+ id: "lavender",
73
+ name: "Lavender",
74
+ swatch: "#c3b8ea",
75
+ light: {
76
+ accent: "#c3b8ea",
77
+ onAccent: "#1c1c1e",
78
+ accentText: "#5d4f9e",
79
+ accentSoft: "#ece8f7"
80
+ },
81
+ dark: {
82
+ accent: "#a99cdf",
83
+ onAccent: "#16131f",
84
+ accentText: "#bdb3ea",
85
+ accentSoft: "#282435"
86
+ }
87
+ },
88
+ rose: {
89
+ id: "rose",
90
+ name: "Rose",
91
+ swatch: "#efb3bb",
92
+ light: {
93
+ accent: "#efb3bb",
94
+ onAccent: "#1c1c1e",
95
+ accentText: "#a23f51",
96
+ accentSoft: "#f8e6e9"
97
+ },
98
+ dark: {
99
+ accent: "#e5949f",
100
+ onAccent: "#22131a",
101
+ accentText: "#efadb6",
102
+ accentSoft: "#36232a"
103
+ }
104
+ },
105
+ graphite: {
106
+ id: "graphite",
107
+ name: "Graphite",
108
+ swatch: "#3a3936",
109
+ light: {
110
+ accent: "#3a3936",
111
+ onAccent: "#ffffff",
112
+ accentText: "#4a4844",
113
+ accentSoft: "#ebe8e2"
114
+ },
115
+ dark: {
116
+ accent: "#d6d2ca",
117
+ onAccent: "#151413",
118
+ accentText: "#cfcbc3",
119
+ accentSoft: "#2e2c29"
120
+ }
121
+ }
122
+ };
123
+ const defaultAccent = "blush";
124
+ function isAccentId(value) {
125
+ return typeof value === "string" && value in accents;
126
+ }
127
+ export { accents, defaultAccent, isAccentId };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Semantic color roles. Warm "paper" neutrals with a blush accent: the feel
3
+ * of a well-made notebook, tuned to sit naturally beside Apple's system UI.
4
+ */
5
+ export interface ColorScheme {
6
+ /** Window background. */
7
+ background: string;
8
+ /** Sidebar and toolbars. */
9
+ sidebar: string;
10
+ /** Lists and secondary panes. */
11
+ surface: string;
12
+ /** Writing and reading surface. */
13
+ paper: string;
14
+ /** Cards, popovers and sheets. */
15
+ elevated: string;
16
+ /** Inputs, chips and pressed states. */
17
+ fill: string;
18
+ separator: string;
19
+ label: string;
20
+ labelSecondary: string;
21
+ labelTertiary: string;
22
+ /** Body text on paper. */
23
+ ink: string;
24
+ /** Selection, active items and primary fills. */
25
+ accent: string;
26
+ /** Text and icons placed on `accent`. */
27
+ onAccent: string;
28
+ /** Accent-colored text and icons on neutral backgrounds (AA contrast). */
29
+ accentText: string;
30
+ /** Subtle accent tint for selected rows. */
31
+ accentSoft: string;
32
+ highlight: string;
33
+ heart: string;
34
+ /** Floating toolbars and primary buttons. */
35
+ inverse: string;
36
+ onInverse: string;
37
+ success: string;
38
+ warning: string;
39
+ danger: string;
40
+ /** Glass materials: the lit top edge and the hairline rim. */
41
+ glassHighlight: string;
42
+ glassRim: string;
43
+ /** Clear glass: its faint tint, the specular edge light and the sheen across it. */
44
+ glassTint: string;
45
+ glassSpecular: string;
46
+ glassSheen: string;
47
+ /** Shadows under floating glass, and the deeper one under menus. */
48
+ shadowFloating: string;
49
+ shadowMenu: string;
50
+ }
51
+ export declare const light: ColorScheme;
52
+ export declare const dark: ColorScheme;
53
+ export declare const colors: {
54
+ readonly light: ColorScheme;
55
+ readonly dark: ColorScheme;
56
+ };
package/dist/color.js ADDED
@@ -0,0 +1,63 @@
1
+ import { accents, defaultAccent } from "./accent.js";
2
+ // src/color.ts
3
+ const light = {
4
+ background: "#ffffff",
5
+ sidebar: "#f3efe6",
6
+ surface: "#fdfcf9",
7
+ paper: "#fffdf8",
8
+ elevated: "#ffffff",
9
+ fill: "#efebe2",
10
+ separator: "#e3dccb",
11
+ label: "#1c1c1e",
12
+ labelSecondary: "#6b6458",
13
+ labelTertiary: "#8b8478",
14
+ ink: "#24221f",
15
+ ...accents[defaultAccent].light,
16
+ highlight: "#ffe58a",
17
+ heart: "#ff375f",
18
+ inverse: "#1c1c1e",
19
+ onInverse: "#ffffff",
20
+ success: "#248a3d",
21
+ warning: "#c93400",
22
+ danger: "#d70015",
23
+ glassHighlight: "rgb(255 255 255 / 0.55)",
24
+ glassRim: "rgb(118 108 92 / 0.22)",
25
+ glassTint: "rgb(243 239 230 / 0.42)",
26
+ glassSpecular: "rgb(255 255 255 / 0.85)",
27
+ glassSheen: "rgb(255 255 255 / 0.32)",
28
+ shadowFloating: "rgb(40 30 0 / 0.18)",
29
+ shadowMenu: "rgb(40 30 0 / 0.24)"
30
+ };
31
+ const dark = {
32
+ background: "#121110",
33
+ sidebar: "#1a1917",
34
+ surface: "#161514",
35
+ paper: "#1a1917",
36
+ elevated: "#24221f",
37
+ fill: "#2c2a26",
38
+ separator: "#3a3732",
39
+ label: "#f5f2ec",
40
+ labelSecondary: "#b5aea2",
41
+ labelTertiary: "#8f887b",
42
+ ink: "#ece6da",
43
+ ...accents[defaultAccent].dark,
44
+ highlight: "#7a5c00",
45
+ heart: "#ff375f",
46
+ inverse: "#f5f2ec",
47
+ onInverse: "#1c1c1e",
48
+ success: "#30d158",
49
+ warning: "#ff9f0a",
50
+ danger: "#ff453a",
51
+ glassHighlight: "rgb(255 255 255 / 0.1)",
52
+ glassRim: "rgb(255 250 240 / 0.06)",
53
+ glassTint: "rgb(26 25 23 / 0.5)",
54
+ glassSpecular: "rgb(255 250 240 / 0.12)",
55
+ glassSheen: "rgb(255 255 255 / 0.1)",
56
+ shadowFloating: "rgb(0 0 0 / 0.5)",
57
+ shadowMenu: "rgb(0 0 0 / 0.55)"
58
+ };
59
+ const colors = {
60
+ light,
61
+ dark
62
+ };
63
+ export { colors, dark, light };
@@ -0,0 +1,7 @@
1
+ import { Accent, AccentColors, AccentId, accents, defaultAccent, isAccentId } from "./accent.js";
2
+ import { ColorScheme, colors, dark, light } from "./color.js";
3
+ import { radius, space } from "./layout.js";
4
+ import { Spring, duration, easing, pageScale, springPosition, springSettleSeconds, springToLinear, springs } from "./motion.js";
5
+ import { renderThemeCss } from "./theme-css.js";
6
+ import { TextStyle, TextStyleName, fontFamily, minimumTextSize, textStyles } from "./typography.js";
7
+ export { Accent, AccentColors, AccentId, ColorScheme, Spring, TextStyle, TextStyleName, accents, colors, dark, defaultAccent, duration, easing, fontFamily, isAccentId, light, minimumTextSize, pageScale, radius, renderThemeCss, space, springPosition, springSettleSeconds, springToLinear, springs, textStyles };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { accents, defaultAccent, isAccentId } from "./accent.js";
2
+ import { colors, dark, light } from "./color.js";
3
+ import { radius, space } from "./layout.js";
4
+ import { duration, easing, pageScale, springPosition, springSettleSeconds, springToLinear, springs } from "./motion.js";
5
+ import { renderThemeCss } from "./theme-css.js";
6
+ import { fontFamily, minimumTextSize, textStyles } from "./typography.js";
7
+ export { accents, colors, dark, defaultAccent, duration, easing, fontFamily, isAccentId, light, minimumTextSize, pageScale, radius, renderThemeCss, space, springPosition, springSettleSeconds, springToLinear, springs, textStyles };
@@ -0,0 +1,33 @@
1
+ /** 4-point spacing grid. */
2
+ export declare const space: {
3
+ readonly 0: 0;
4
+ readonly 1: 4;
5
+ readonly 2: 8;
6
+ readonly 3: 12;
7
+ readonly 4: 16;
8
+ readonly 5: 20;
9
+ readonly 6: 24;
10
+ readonly 8: 32;
11
+ readonly 10: 40;
12
+ readonly 12: 48;
13
+ readonly 16: 64;
14
+ };
15
+ /**
16
+ * Corner radii, in 2 px steps while small (the eye notices every pixel
17
+ * there) and 4 px steps beyond. Nested shapes stay concentric: an inner
18
+ * radius is the outer radius minus the padding between them. Pair with
19
+ * `borderCurve: "continuous"` on iOS.
20
+ */
21
+ export declare const radius: {
22
+ readonly xs: 4;
23
+ readonly sm: 6;
24
+ readonly md: 8;
25
+ readonly lg: 10;
26
+ readonly xl: 12;
27
+ readonly "2xl": 14;
28
+ readonly "3xl": 16;
29
+ readonly "4xl": 20;
30
+ readonly "5xl": 24;
31
+ readonly sheet: 28;
32
+ readonly full: 9999;
33
+ };
package/dist/layout.js ADDED
@@ -0,0 +1,35 @@
1
+ // src/layout.ts
2
+ /** 4-point spacing grid. */
3
+ const space = {
4
+ 0: 0,
5
+ 1: 4,
6
+ 2: 8,
7
+ 3: 12,
8
+ 4: 16,
9
+ 5: 20,
10
+ 6: 24,
11
+ 8: 32,
12
+ 10: 40,
13
+ 12: 48,
14
+ 16: 64
15
+ };
16
+ /**
17
+ * Corner radii, in 2 px steps while small (the eye notices every pixel
18
+ * there) and 4 px steps beyond. Nested shapes stay concentric: an inner
19
+ * radius is the outer radius minus the padding between them. Pair with
20
+ * `borderCurve: "continuous"` on iOS.
21
+ */
22
+ const radius = {
23
+ xs: 4,
24
+ sm: 6,
25
+ md: 8,
26
+ lg: 10,
27
+ xl: 12,
28
+ "2xl": 14,
29
+ "3xl": 16,
30
+ "4xl": 20,
31
+ "5xl": 24,
32
+ sheet: 28,
33
+ full: 9999
34
+ };
35
+ export { radius, space };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Spring presets shared by motion/react and CSS so interactions feel the
3
+ * same on every platform. Values follow SwiftUI's defaults.
4
+ */
5
+ export interface Spring {
6
+ damping: number;
7
+ stiffness: number;
8
+ mass: number;
9
+ }
10
+ export declare const springs: {
11
+ /** Default UI transitions. */
12
+ readonly smooth: {
13
+ readonly damping: 26;
14
+ readonly stiffness: 240;
15
+ readonly mass: 1;
16
+ };
17
+ /** Buttons, toggles and small feedback. */
18
+ readonly snappy: {
19
+ readonly damping: 22;
20
+ readonly stiffness: 380;
21
+ readonly mass: 1;
22
+ };
23
+ /** Sheets, cards and playful moments. */
24
+ readonly bouncy: {
25
+ readonly damping: 14;
26
+ readonly stiffness: 220;
27
+ readonly mass: 1;
28
+ };
29
+ };
30
+ export declare const duration: {
31
+ readonly instant: 100;
32
+ readonly fast: 200;
33
+ readonly normal: 300;
34
+ readonly slow: 450;
35
+ /** Sheet and Drawer travel, paired with `easing.sheet`. */
36
+ readonly sheet: 500;
37
+ };
38
+ /** CSS easing approximating the `smooth` spring for non-spring contexts. */
39
+ export declare const easing: {
40
+ readonly standard: "cubic-bezier(0.2, 0.8, 0.2, 1)";
41
+ readonly emphasized: "cubic-bezier(0.3, 1.3, 0.4, 1)";
42
+ /** Sheet and Drawer curve, the same values Vaul uses. */
43
+ readonly sheet: "cubic-bezier(0.32, 0.72, 0, 1)";
44
+ };
45
+ /**
46
+ * How far the page behind a Drawer scales back, read from Vaul 1.1.2 (MIT):
47
+ * the scaled page ends `topOffset` px below the top of the screen, with
48
+ * corners rounded to `radius` px. Scale is (width - topOffset) / width.
49
+ */
50
+ export declare const pageScale: {
51
+ readonly topOffset: 26;
52
+ readonly radius: 8;
53
+ };
54
+ /** Position of a spring released from rest at 0 and heading to 1, at `t` seconds. */
55
+ export declare function springPosition(spring: Spring, t: number): number;
56
+ /** Seconds until the spring stays within tolerance of its target. */
57
+ export declare function springSettleSeconds(spring: Spring): number;
58
+ /**
59
+ * Samples a spring into a CSS `linear()` easing. Pair it with `durationMs`
60
+ * so the CSS transition runs exactly as long as the spring takes to settle.
61
+ */
62
+ export declare function springToLinear(spring: Spring): {
63
+ durationMs: number;
64
+ easing: string;
65
+ };
package/dist/motion.js ADDED
@@ -0,0 +1,90 @@
1
+ // src/motion.ts
2
+ const springs = {
3
+ /** Default UI transitions. */
4
+ smooth: {
5
+ damping: 26,
6
+ stiffness: 240,
7
+ mass: 1
8
+ },
9
+ /** Buttons, toggles and small feedback. */
10
+ snappy: {
11
+ damping: 22,
12
+ stiffness: 380,
13
+ mass: 1
14
+ },
15
+ /** Sheets, cards and playful moments. */
16
+ bouncy: {
17
+ damping: 14,
18
+ stiffness: 220,
19
+ mass: 1
20
+ }
21
+ };
22
+ const duration = {
23
+ instant: 100,
24
+ fast: 200,
25
+ normal: 300,
26
+ slow: 450,
27
+ /** Sheet and Drawer travel, paired with `easing.sheet`. */
28
+ sheet: 500
29
+ };
30
+ /** CSS easing approximating the `smooth` spring for non-spring contexts. */
31
+ const easing = {
32
+ standard: "cubic-bezier(0.2, 0.8, 0.2, 1)",
33
+ emphasized: "cubic-bezier(0.3, 1.3, 0.4, 1)",
34
+ /** Sheet and Drawer curve, the same values Vaul uses. */
35
+ sheet: "cubic-bezier(0.32, 0.72, 0, 1)"
36
+ };
37
+ /**
38
+ * How far the page behind a Drawer scales back, read from Vaul 1.1.2 (MIT):
39
+ * the scaled page ends `topOffset` px below the top of the screen, with
40
+ * corners rounded to `radius` px. Scale is (width - topOffset) / width.
41
+ */
42
+ const pageScale = {
43
+ topOffset: 26,
44
+ radius: 8
45
+ };
46
+ /** Where a spring counts as settled: within this distance of its target. */
47
+ const SETTLE_TOLERANCE = .001;
48
+ /** Samples per second when sampling a spring into a CSS easing. */
49
+ const SAMPLES_PER_SECOND = 60;
50
+ const MAX_SECONDS = 4;
51
+ /** Position of a spring released from rest at 0 and heading to 1, at `t` seconds. */
52
+ function springPosition(spring, t) {
53
+ const { stiffness, damping, mass } = spring;
54
+ const omega = Math.sqrt(stiffness / mass);
55
+ const zeta = damping / (2 * Math.sqrt(stiffness * mass));
56
+ if (zeta < 1) {
57
+ const wd = omega * Math.sqrt(1 - zeta * zeta);
58
+ return 1 - Math.exp(-zeta * omega * t) * (Math.cos(wd * t) + zeta * omega / wd * Math.sin(wd * t));
59
+ }
60
+ if (zeta === 1) return 1 - Math.exp(-omega * t) * (1 + omega * t);
61
+ const root = omega * Math.sqrt(zeta * zeta - 1);
62
+ const slow = -zeta * omega + root;
63
+ const fast = -zeta * omega - root;
64
+ return 1 - (fast * Math.exp(slow * t) - slow * Math.exp(fast * t)) / (fast - slow);
65
+ }
66
+ /** Seconds until the spring stays within tolerance of its target. */
67
+ function springSettleSeconds(spring) {
68
+ const step = 1 / SAMPLES_PER_SECOND;
69
+ let settled = 0;
70
+ for (let t = 0; t <= MAX_SECONDS; t += step) if (Math.abs(1 - springPosition(spring, t)) > SETTLE_TOLERANCE) settled = t + step;
71
+ return settled;
72
+ }
73
+ /**
74
+ * Samples a spring into a CSS `linear()` easing. Pair it with `durationMs`
75
+ * so the CSS transition runs exactly as long as the spring takes to settle.
76
+ */
77
+ function springToLinear(spring) {
78
+ const seconds = springSettleSeconds(spring);
79
+ const count = Math.max(2, Math.ceil(seconds * SAMPLES_PER_SECOND));
80
+ const points = [];
81
+ for (let i = 0; i <= count; i += 1) {
82
+ const value = i === count ? 1 : springPosition(spring, i / count * seconds);
83
+ points.push(String(Number(value.toFixed(4))));
84
+ }
85
+ return {
86
+ durationMs: Math.round(seconds * 1e3),
87
+ easing: `linear(${points.join(", ")})`
88
+ };
89
+ }
90
+ export { duration, easing, pageScale, springPosition, springSettleSeconds, springToLinear, springs };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Renders the tokens as a Tailwind v4 compatible stylesheet. Light values
3
+ * live in `@theme`; dark values apply with the system's dark appearance, or
4
+ * through `data-theme`. Like SwiftUI's `colorScheme` environment,
5
+ * `data-theme="dark"` or `"light"` works on any element, not only the root,
6
+ * so one part of a screen can keep its own appearance (an always-dark
7
+ * recorder, an always-white invoice). Accents other than the default apply
8
+ * through `data-accent` on the root element.
9
+ */
10
+ export declare function renderThemeCss(): string;
@@ -0,0 +1,92 @@
1
+ import { accents, defaultAccent } from "./accent.js";
2
+ import { dark, light } from "./color.js";
3
+ import { radius, space } from "./layout.js";
4
+ import { duration, easing, springToLinear, springs } from "./motion.js";
5
+ import { fontFamily, minimumTextSize, textStyles } from "./typography.js";
6
+ // src/theme-css.ts
7
+ const kebab = (key) => key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
8
+ /**
9
+ * Text styles scale together with `--type-scale` (set from the reader's text
10
+ * size), never below the smallest style. Line heights are separate
11
+ * `leading-*` utilities, so adopting a size never moves existing leading.
12
+ */
13
+ function textStyleVars() {
14
+ return Object.entries(textStyles).flatMap(([name, style]) => {
15
+ const scaled = (px) => `max(${Math.min(px, minimumTextSize)}px, calc(${px}px * var(--type-scale, 1)))`;
16
+ return [` --text-${kebab(name)}: ${scaled(style.size)};`, ` --leading-${kebab(name)}: ${scaled(style.lineHeight)};`];
17
+ });
18
+ }
19
+ function springVars() {
20
+ return Object.entries(springs).flatMap(([name, spring]) => {
21
+ const { durationMs, easing: curve } = springToLinear(spring);
22
+ return [` --spring-${name}: ${curve};`, ` --spring-${name}-duration: ${durationMs}ms;`];
23
+ });
24
+ }
25
+ function colorVars(scheme, backgroundShare = 0) {
26
+ return Object.entries(scheme).map(([key, value]) => {
27
+ if (key === "background" && backgroundShare) return ` --color-background: color-mix(in srgb, var(--color-accent-soft) ${backgroundShare}%, ${value});`;
28
+ return ` --color-${kebab(key)}: ${value};`;
29
+ }).join("\n");
30
+ }
31
+ /**
32
+ * Renders the tokens as a Tailwind v4 compatible stylesheet. Light values
33
+ * live in `@theme`; dark values apply with the system's dark appearance, or
34
+ * through `data-theme`. Like SwiftUI's `colorScheme` environment,
35
+ * `data-theme="dark"` or `"light"` works on any element, not only the root,
36
+ * so one part of a screen can keep its own appearance (an always-dark
37
+ * recorder, an always-white invoice). Accents other than the default apply
38
+ * through `data-accent` on the root element.
39
+ */
40
+ function renderThemeCss() {
41
+ const others = Object.values(accents).filter((accent) => accent.id !== defaultAccent);
42
+ return [
43
+ "/* Generated by @passui/tokens. Do not edit by hand. */",
44
+ "@theme static {",
45
+ colorVars(light, 6),
46
+ ...Object.entries(fontFamily).map(([k, v]) => ` --font-${k}: ${v};`),
47
+ ...textStyleVars(),
48
+ ...Object.entries(radius).map(([k, v]) => ` --radius-${k}: ${v}px;`),
49
+ ...Object.entries(space).map(([k, v]) => ` --space-${k}: ${v}px;`),
50
+ ...Object.entries(duration).map(([k, v]) => ` --duration-${k}: ${v}ms;`),
51
+ ...Object.entries(easing).map(([k, v]) => ` --ease-${k}: ${v};`),
52
+ ...springVars(),
53
+ "}",
54
+ "",
55
+ ":root { color-scheme: light dark; }",
56
+ "[data-theme=\"light\"] { color-scheme: light; }",
57
+ "[data-theme=\"dark\"] { color-scheme: dark; }",
58
+ "",
59
+ "@media (prefers-color-scheme: dark) {",
60
+ " :root:not([data-theme=\"light\"]) {",
61
+ colorVars(dark, 4).replace(/^/gm, " "),
62
+ " }",
63
+ "}",
64
+ "",
65
+ "[data-theme=\"dark\"] {",
66
+ colorVars(dark, 4),
67
+ "}",
68
+ "",
69
+ ":root [data-theme=\"light\"] {",
70
+ colorVars(light, 6),
71
+ "}",
72
+ "",
73
+ ...others.flatMap((accent) => {
74
+ const root = `:root[data-accent="${accent.id}"]`;
75
+ return [
76
+ `${root}, ${root} [data-theme="light"] {`,
77
+ colorVars(accent.light),
78
+ "}",
79
+ "@media (prefers-color-scheme: dark) {",
80
+ ` ${root}:not([data-theme="light"]) {`,
81
+ colorVars(accent.dark).replace(/^/gm, " "),
82
+ " }",
83
+ "}",
84
+ `${root}[data-theme="dark"], ${root} [data-theme="dark"] {`,
85
+ colorVars(accent.dark),
86
+ "}",
87
+ ""
88
+ ];
89
+ })
90
+ ].join("\n");
91
+ }
92
+ export { renderThemeCss };