sve-ui 0.1.2 → 0.2.0
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/dist/ThemeProvider.svelte +46 -0
- package/dist/ThemeProvider.svelte.d.ts +12 -0
- package/dist/ThemeProvider.svelte.d.ts.map +1 -0
- package/dist/components/Alert/AlertDescription.svelte +31 -0
- package/dist/components/Alert/AlertDescription.svelte.d.ts +10 -0
- package/dist/components/Alert/AlertDescription.svelte.d.ts.map +1 -0
- package/dist/components/Alert/AlertRoot.svelte +103 -0
- package/dist/components/Alert/AlertRoot.svelte.d.ts +29 -0
- package/dist/components/Alert/AlertRoot.svelte.d.ts.map +1 -0
- package/dist/components/Alert/AlertTitle.svelte +34 -0
- package/dist/components/Alert/AlertTitle.svelte.d.ts +12 -0
- package/dist/components/Alert/AlertTitle.svelte.d.ts.map +1 -0
- package/dist/components/Alert/index.d.ts +11 -0
- package/dist/components/Alert/index.d.ts.map +1 -0
- package/dist/components/Alert/index.js +10 -0
- package/dist/components/Avatar/AvatarFallback.svelte +33 -0
- package/dist/components/Avatar/AvatarFallback.svelte.d.ts +12 -0
- package/dist/components/Avatar/AvatarFallback.svelte.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarImage.svelte +27 -0
- package/dist/components/Avatar/AvatarImage.svelte.d.ts +12 -0
- package/dist/components/Avatar/AvatarImage.svelte.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarRoot.svelte +67 -0
- package/dist/components/Avatar/AvatarRoot.svelte.d.ts +16 -0
- package/dist/components/Avatar/AvatarRoot.svelte.d.ts.map +1 -0
- package/dist/components/Avatar/index.d.ts +15 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Avatar/index.js +14 -0
- package/dist/components/Badge/Badge.svelte +125 -0
- package/dist/components/Badge/Badge.svelte.d.ts +37 -0
- package/dist/components/Badge/Badge.svelte.d.ts.map +1 -0
- package/dist/components/Button/Button.svelte +296 -112
- package/dist/components/Button/Button.svelte.d.ts +34 -48
- package/dist/components/Button/Button.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardContent.svelte +33 -0
- package/dist/components/Card/CardContent.svelte.d.ts +10 -0
- package/dist/components/Card/CardContent.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardFooter.svelte +33 -0
- package/dist/components/Card/CardFooter.svelte.d.ts +10 -0
- package/dist/components/Card/CardFooter.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardHeader.svelte +33 -0
- package/dist/components/Card/CardHeader.svelte.d.ts +10 -0
- package/dist/components/Card/CardHeader.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardRoot.svelte +91 -0
- package/dist/components/Card/CardRoot.svelte.d.ts +28 -0
- package/dist/components/Card/CardRoot.svelte.d.ts.map +1 -0
- package/dist/components/Card/index.d.ts +13 -0
- package/dist/components/Card/index.d.ts.map +1 -0
- package/dist/components/Card/index.js +12 -0
- package/dist/components/Dialog/DialogContent.svelte +47 -0
- package/dist/components/Dialog/DialogContent.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogContent.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/DialogDescription.svelte +29 -0
- package/dist/components/Dialog/DialogDescription.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogDescription.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/DialogOverlay.svelte +32 -0
- package/dist/components/Dialog/DialogOverlay.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogOverlay.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/DialogTitle.svelte +30 -0
- package/dist/components/Dialog/DialogTitle.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogTitle.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/index.d.ts +21 -0
- package/dist/components/Dialog/index.d.ts.map +1 -0
- package/dist/components/Dialog/index.js +22 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.svelte +40 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuGroup.svelte +18 -0
- package/dist/components/DropdownMenu/DropdownMenuGroup.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuGroup.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.svelte +40 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.svelte +34 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.svelte +25 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/index.d.ts +31 -0
- package/dist/components/DropdownMenu/index.d.ts.map +1 -0
- package/dist/components/DropdownMenu/index.js +33 -0
- package/dist/components/Heading/Heading.svelte +72 -0
- package/dist/components/Heading/Heading.svelte.d.ts +18 -0
- package/dist/components/Heading/Heading.svelte.d.ts.map +1 -0
- package/dist/components/Input/Input.svelte +151 -0
- package/dist/components/Input/Input.svelte.d.ts +25 -0
- package/dist/components/Input/Input.svelte.d.ts.map +1 -0
- package/dist/components/Popover/PopoverContent.svelte +40 -0
- package/dist/components/Popover/PopoverContent.svelte.d.ts +10 -0
- package/dist/components/Popover/PopoverContent.svelte.d.ts.map +1 -0
- package/dist/components/Popover/index.d.ts +20 -0
- package/dist/components/Popover/index.d.ts.map +1 -0
- package/dist/components/Popover/index.js +21 -0
- package/dist/components/Spinner/Spinner.svelte +82 -0
- package/dist/components/Spinner/Spinner.svelte.d.ts +13 -0
- package/dist/components/Spinner/Spinner.svelte.d.ts.map +1 -0
- package/dist/components/Text/Text.svelte +84 -45
- package/dist/components/Text/Text.svelte.d.ts +20 -44
- package/dist/components/Text/Text.svelte.d.ts.map +1 -0
- package/dist/components/Tooltip/TooltipContent.svelte +41 -0
- package/dist/components/Tooltip/TooltipContent.svelte.d.ts +10 -0
- package/dist/components/Tooltip/TooltipContent.svelte.d.ts.map +1 -0
- package/dist/components/Tooltip/index.d.ts +19 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/Tooltip/index.js +20 -0
- package/dist/context.d.ts +14 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +16 -0
- package/dist/index.d.ts +28 -26
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -13
- package/dist/internal/variants.d.ts +44 -0
- package/dist/internal/variants.d.ts.map +1 -0
- package/dist/internal/variants.js +54 -0
- package/dist/theme/breakpoints.d.ts +1 -0
- package/dist/theme/breakpoints.d.ts.map +1 -0
- package/dist/theme/index.d.ts +12 -182
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +13 -19
- package/dist/theme/palette.d.ts +153 -0
- package/dist/theme/palette.d.ts.map +1 -0
- package/dist/theme/palette.js +85 -0
- package/dist/theme/radius.d.ts +1 -0
- package/dist/theme/radius.d.ts.map +1 -0
- package/dist/theme/sizes.d.ts +1 -0
- package/dist/theme/sizes.d.ts.map +1 -0
- package/dist/theme/spacing.d.ts +1 -0
- package/dist/theme/spacing.d.ts.map +1 -0
- package/dist/theme/theme.css +268 -0
- package/dist/theme/tokens.d.ts +108 -0
- package/dist/theme/tokens.d.ts.map +1 -0
- package/dist/theme/tokens.js +236 -0
- package/dist/theme/typography.d.ts +1 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/package.json +74 -67
- package/README.md +0 -94
- package/dist/components/Box/Box.svelte +0 -48
- package/dist/components/Box/Box.svelte.d.ts +0 -160
- package/dist/components/Center/Center.svelte +0 -15
- package/dist/components/Center/Center.svelte.d.ts +0 -25
- package/dist/components/Circle/Circle.svelte +0 -9
- package/dist/components/Circle/Circle.svelte.d.ts +0 -34
- package/dist/components/CodeExample/CodeExample.svelte +0 -128
- package/dist/components/CodeExample/CodeExample.svelte.d.ts +0 -46
- package/dist/components/Flex/Flex.svelte +0 -26
- package/dist/components/Flex/Flex.svelte.d.ts +0 -34
- package/dist/components/Grid/Grid.svelte +0 -16
- package/dist/components/Grid/Grid.svelte.d.ts +0 -44
- package/dist/components/GridItem/GridItem.svelte +0 -22
- package/dist/components/GridItem/GridItem.svelte.d.ts +0 -29
- package/dist/components/Loaders/DotPulse.svelte +0 -62
- package/dist/components/Loaders/DotPulse.svelte.d.ts +0 -40
- package/dist/components/Loaders/DotSpinner.svelte +0 -121
- package/dist/components/Loaders/DotSpinner.svelte.d.ts +0 -40
- package/dist/components/Loaders/DotWave.svelte +0 -67
- package/dist/components/Loaders/DotWave.svelte.d.ts +0 -40
- package/dist/components/Spacer/Spacer.svelte +0 -5
- package/dist/components/Spacer/Spacer.svelte.d.ts +0 -21
- package/dist/components/Square/Square.svelte +0 -17
- package/dist/components/Square/Square.svelte.d.ts +0 -34
- /package/{LICENCE → LICENSE} +0 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sve-ui theme CSS
|
|
3
|
+
*
|
|
4
|
+
* Import this file once in your app (e.g. `import 'sve-ui/theme.css'`) to
|
|
5
|
+
* establish all --sve-* custom properties at :root.
|
|
6
|
+
*
|
|
7
|
+
* Light values live at :root.
|
|
8
|
+
* Dark values live at :root.dark and in @media (prefers-color-scheme: dark).
|
|
9
|
+
* An explicit .dark / .light class on any element scopes the override to that
|
|
10
|
+
* subtree (ThemeProvider uses this mechanism).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/* =========================================================================
|
|
14
|
+
Light theme — :root defaults
|
|
15
|
+
========================================================================= */
|
|
16
|
+
:root {
|
|
17
|
+
/* --- Colors: primary --------------------------------------------------- */
|
|
18
|
+
--sve-color-primary: #f56565;
|
|
19
|
+
--sve-color-primary-foreground: #ffffff;
|
|
20
|
+
--sve-color-primary-surface: #fff5f5;
|
|
21
|
+
--sve-color-primary-border: #fc8181;
|
|
22
|
+
--sve-color-primary-hover: #e53e3e;
|
|
23
|
+
--sve-color-primary-active: #c53030;
|
|
24
|
+
|
|
25
|
+
/* --- Colors: secondary ------------------------------------------------- */
|
|
26
|
+
--sve-color-secondary: #ed8936;
|
|
27
|
+
--sve-color-secondary-foreground: #ffffff;
|
|
28
|
+
--sve-color-secondary-surface: #fffaf0;
|
|
29
|
+
--sve-color-secondary-border: #f6ad55;
|
|
30
|
+
--sve-color-secondary-hover: #dd6b20;
|
|
31
|
+
--sve-color-secondary-active: #c05621;
|
|
32
|
+
|
|
33
|
+
/* --- Colors: success --------------------------------------------------- */
|
|
34
|
+
--sve-color-success: #38a169;
|
|
35
|
+
--sve-color-success-foreground: #ffffff;
|
|
36
|
+
--sve-color-success-surface: #f0fff4;
|
|
37
|
+
--sve-color-success-border: #68d391;
|
|
38
|
+
--sve-color-success-hover: #2f855a;
|
|
39
|
+
--sve-color-success-active: #276749;
|
|
40
|
+
|
|
41
|
+
/* --- Colors: warning --------------------------------------------------- */
|
|
42
|
+
--sve-color-warning: #ecc94b;
|
|
43
|
+
--sve-color-warning-foreground: #1a202c;
|
|
44
|
+
--sve-color-warning-surface: #fffff0;
|
|
45
|
+
--sve-color-warning-border: #f6e05e;
|
|
46
|
+
--sve-color-warning-hover: #d69e2e;
|
|
47
|
+
--sve-color-warning-active: #b7791f;
|
|
48
|
+
|
|
49
|
+
/* --- Colors: danger ---------------------------------------------------- */
|
|
50
|
+
--sve-color-danger: #c53030;
|
|
51
|
+
--sve-color-danger-foreground: #ffffff;
|
|
52
|
+
--sve-color-danger-surface: #fff5f5;
|
|
53
|
+
--sve-color-danger-border: #fc8181;
|
|
54
|
+
--sve-color-danger-hover: #9b2c2c;
|
|
55
|
+
--sve-color-danger-active: #822727;
|
|
56
|
+
|
|
57
|
+
/* --- Colors: default --------------------------------------------------- */
|
|
58
|
+
--sve-color-default: #e2e8f0;
|
|
59
|
+
--sve-color-default-foreground: #1a202c;
|
|
60
|
+
--sve-color-default-surface: #f7fafc;
|
|
61
|
+
--sve-color-default-border: #cbd5e0;
|
|
62
|
+
--sve-color-default-hover: #cbd5e0;
|
|
63
|
+
--sve-color-default-active: #a0aec0;
|
|
64
|
+
|
|
65
|
+
/* --- Colors: overlay --------------------------------------------------- */
|
|
66
|
+
--sve-color-overlay: rgb(0 0 0 / 0.5);
|
|
67
|
+
|
|
68
|
+
/* --- Shadows ----------------------------------------------------------- */
|
|
69
|
+
--sve-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
70
|
+
--sve-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
71
|
+
|
|
72
|
+
/* --- Spacing ----------------------------------------------------------- */
|
|
73
|
+
--sve-space-1: 0.25rem;
|
|
74
|
+
--sve-space-2: 0.5rem;
|
|
75
|
+
--sve-space-3: 0.75rem;
|
|
76
|
+
--sve-space-4: 1rem;
|
|
77
|
+
--sve-space-5: 1.25rem;
|
|
78
|
+
--sve-space-6: 1.5rem;
|
|
79
|
+
--sve-space-8: 2rem;
|
|
80
|
+
--sve-space-10: 2.5rem;
|
|
81
|
+
--sve-space-12: 3rem;
|
|
82
|
+
--sve-space-16: 4rem;
|
|
83
|
+
|
|
84
|
+
/* --- Border radius ----------------------------------------------------- */
|
|
85
|
+
--sve-radius-none: 0;
|
|
86
|
+
--sve-radius-sm: 0.125rem;
|
|
87
|
+
--sve-radius-md: 0.375rem;
|
|
88
|
+
--sve-radius-lg: 0.5rem;
|
|
89
|
+
--sve-radius-full: 9999px;
|
|
90
|
+
|
|
91
|
+
/* --- Typography -------------------------------------------------------- */
|
|
92
|
+
--sve-font-family-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
93
|
+
--sve-font-size-xs: 0.75rem;
|
|
94
|
+
--sve-font-size-sm: 0.875rem;
|
|
95
|
+
--sve-font-size-md: 1rem;
|
|
96
|
+
--sve-font-size-lg: 1.125rem;
|
|
97
|
+
--sve-font-weight-normal: 400;
|
|
98
|
+
--sve-font-weight-medium: 500;
|
|
99
|
+
--sve-font-weight-bold: 700;
|
|
100
|
+
--sve-line-height-tight: 1.25;
|
|
101
|
+
--sve-line-height-normal: 1.5;
|
|
102
|
+
--sve-line-height-relaxed: 1.75;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* =========================================================================
|
|
106
|
+
Dark theme — media query fallback (colorScheme = "system")
|
|
107
|
+
========================================================================= */
|
|
108
|
+
@media (prefers-color-scheme: dark) {
|
|
109
|
+
:root {
|
|
110
|
+
/* Colors: primary */
|
|
111
|
+
--sve-color-primary: #f87171;
|
|
112
|
+
--sve-color-primary-foreground: #ffffff;
|
|
113
|
+
--sve-color-primary-surface: #742a2a;
|
|
114
|
+
--sve-color-primary-border: #c53030;
|
|
115
|
+
--sve-color-primary-hover: #fc8181;
|
|
116
|
+
--sve-color-primary-active: #feb2b2;
|
|
117
|
+
|
|
118
|
+
/* Colors: secondary */
|
|
119
|
+
--sve-color-secondary: #ed9e40;
|
|
120
|
+
--sve-color-secondary-foreground: #ffffff;
|
|
121
|
+
--sve-color-secondary-surface: #7b341e;
|
|
122
|
+
--sve-color-secondary-border: #c05621;
|
|
123
|
+
--sve-color-secondary-hover: #f6ad55;
|
|
124
|
+
--sve-color-secondary-active: #fbd38d;
|
|
125
|
+
|
|
126
|
+
/* Colors: success */
|
|
127
|
+
--sve-color-success: #48bb78;
|
|
128
|
+
--sve-color-success-foreground: #ffffff;
|
|
129
|
+
--sve-color-success-surface: #1c4532;
|
|
130
|
+
--sve-color-success-border: #276749;
|
|
131
|
+
--sve-color-success-hover: #68d391;
|
|
132
|
+
--sve-color-success-active: #9ae6b4;
|
|
133
|
+
|
|
134
|
+
/* Colors: warning */
|
|
135
|
+
--sve-color-warning: #f6e05e;
|
|
136
|
+
--sve-color-warning-foreground: #1a202c;
|
|
137
|
+
--sve-color-warning-surface: #5f370e;
|
|
138
|
+
--sve-color-warning-border: #975a16;
|
|
139
|
+
--sve-color-warning-hover: #faf089;
|
|
140
|
+
--sve-color-warning-active: #fefcbf;
|
|
141
|
+
|
|
142
|
+
/* Colors: danger */
|
|
143
|
+
--sve-color-danger: #e53e3e;
|
|
144
|
+
--sve-color-danger-foreground: #ffffff;
|
|
145
|
+
--sve-color-danger-surface: #3d0a0a;
|
|
146
|
+
--sve-color-danger-border: #9b2c2c;
|
|
147
|
+
--sve-color-danger-hover: #fc8181;
|
|
148
|
+
--sve-color-danger-active: #feb2b2;
|
|
149
|
+
|
|
150
|
+
/* Colors: default */
|
|
151
|
+
--sve-color-default: #4a5568;
|
|
152
|
+
--sve-color-default-foreground: #edf2f7;
|
|
153
|
+
--sve-color-default-surface: #1a202c;
|
|
154
|
+
--sve-color-default-border: #4a5568;
|
|
155
|
+
--sve-color-default-hover: #718096;
|
|
156
|
+
--sve-color-default-active: #a0aec0;
|
|
157
|
+
|
|
158
|
+
/* Colors: overlay */
|
|
159
|
+
--sve-color-overlay: rgb(0 0 0 / 0.7);
|
|
160
|
+
|
|
161
|
+
/* Shadows — stronger on dark surfaces so they remain visible */
|
|
162
|
+
--sve-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
|
|
163
|
+
--sve-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* =========================================================================
|
|
168
|
+
Dark theme — explicit class override (ThemeProvider colorScheme="dark")
|
|
169
|
+
Works at any nesting level — not just :root.
|
|
170
|
+
========================================================================= */
|
|
171
|
+
:where(.dark) {
|
|
172
|
+
--sve-color-primary: #f87171;
|
|
173
|
+
--sve-color-primary-foreground: #ffffff;
|
|
174
|
+
--sve-color-primary-surface: #742a2a;
|
|
175
|
+
--sve-color-primary-border: #c53030;
|
|
176
|
+
--sve-color-primary-hover: #fc8181;
|
|
177
|
+
--sve-color-primary-active: #feb2b2;
|
|
178
|
+
|
|
179
|
+
--sve-color-secondary: #ed9e40;
|
|
180
|
+
--sve-color-secondary-foreground: #ffffff;
|
|
181
|
+
--sve-color-secondary-surface: #7b341e;
|
|
182
|
+
--sve-color-secondary-border: #c05621;
|
|
183
|
+
--sve-color-secondary-hover: #f6ad55;
|
|
184
|
+
--sve-color-secondary-active: #fbd38d;
|
|
185
|
+
|
|
186
|
+
--sve-color-success: #48bb78;
|
|
187
|
+
--sve-color-success-foreground: #ffffff;
|
|
188
|
+
--sve-color-success-surface: #1c4532;
|
|
189
|
+
--sve-color-success-border: #276749;
|
|
190
|
+
--sve-color-success-hover: #68d391;
|
|
191
|
+
--sve-color-success-active: #9ae6b4;
|
|
192
|
+
|
|
193
|
+
--sve-color-warning: #f6e05e;
|
|
194
|
+
--sve-color-warning-foreground: #1a202c;
|
|
195
|
+
--sve-color-warning-surface: #5f370e;
|
|
196
|
+
--sve-color-warning-border: #975a16;
|
|
197
|
+
--sve-color-warning-hover: #faf089;
|
|
198
|
+
--sve-color-warning-active: #fefcbf;
|
|
199
|
+
|
|
200
|
+
--sve-color-danger: #e53e3e;
|
|
201
|
+
--sve-color-danger-foreground: #ffffff;
|
|
202
|
+
--sve-color-danger-surface: #3d0a0a;
|
|
203
|
+
--sve-color-danger-border: #9b2c2c;
|
|
204
|
+
--sve-color-danger-hover: #fc8181;
|
|
205
|
+
--sve-color-danger-active: #feb2b2;
|
|
206
|
+
|
|
207
|
+
--sve-color-default: #4a5568;
|
|
208
|
+
--sve-color-default-foreground: #edf2f7;
|
|
209
|
+
--sve-color-default-surface: #1a202c;
|
|
210
|
+
--sve-color-default-border: #4a5568;
|
|
211
|
+
--sve-color-default-hover: #718096;
|
|
212
|
+
--sve-color-default-active: #a0aec0;
|
|
213
|
+
|
|
214
|
+
--sve-color-overlay: rgb(0 0 0 / 0.7);
|
|
215
|
+
|
|
216
|
+
/* Shadows — stronger on dark surfaces so they remain visible */
|
|
217
|
+
--sve-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
|
|
218
|
+
--sve-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* =========================================================================
|
|
222
|
+
Light class override — for explicit colorScheme="light" inside a dark root
|
|
223
|
+
========================================================================= */
|
|
224
|
+
:where(.light) {
|
|
225
|
+
--sve-color-primary: #f56565;
|
|
226
|
+
--sve-color-primary-foreground: #ffffff;
|
|
227
|
+
--sve-color-primary-surface: #fff5f5;
|
|
228
|
+
--sve-color-primary-border: #fc8181;
|
|
229
|
+
--sve-color-primary-hover: #e53e3e;
|
|
230
|
+
--sve-color-primary-active: #c53030;
|
|
231
|
+
|
|
232
|
+
--sve-color-secondary: #ed8936;
|
|
233
|
+
--sve-color-secondary-foreground: #ffffff;
|
|
234
|
+
--sve-color-secondary-surface: #fffaf0;
|
|
235
|
+
--sve-color-secondary-border: #f6ad55;
|
|
236
|
+
--sve-color-secondary-hover: #dd6b20;
|
|
237
|
+
--sve-color-secondary-active: #c05621;
|
|
238
|
+
|
|
239
|
+
--sve-color-success: #38a169;
|
|
240
|
+
--sve-color-success-foreground: #ffffff;
|
|
241
|
+
--sve-color-success-surface: #f0fff4;
|
|
242
|
+
--sve-color-success-border: #68d391;
|
|
243
|
+
--sve-color-success-hover: #2f855a;
|
|
244
|
+
--sve-color-success-active: #276749;
|
|
245
|
+
|
|
246
|
+
--sve-color-warning: #ecc94b;
|
|
247
|
+
--sve-color-warning-foreground: #1a202c;
|
|
248
|
+
--sve-color-warning-surface: #fffff0;
|
|
249
|
+
--sve-color-warning-border: #f6e05e;
|
|
250
|
+
--sve-color-warning-hover: #d69e2e;
|
|
251
|
+
--sve-color-warning-active: #b7791f;
|
|
252
|
+
|
|
253
|
+
--sve-color-danger: #c53030;
|
|
254
|
+
--sve-color-danger-foreground: #ffffff;
|
|
255
|
+
--sve-color-danger-surface: #fff5f5;
|
|
256
|
+
--sve-color-danger-border: #fc8181;
|
|
257
|
+
--sve-color-danger-hover: #9b2c2c;
|
|
258
|
+
--sve-color-danger-active: #822727;
|
|
259
|
+
|
|
260
|
+
--sve-color-default: #e2e8f0;
|
|
261
|
+
--sve-color-default-foreground: #1a202c;
|
|
262
|
+
--sve-color-default-surface: #f7fafc;
|
|
263
|
+
--sve-color-default-border: #cbd5e0;
|
|
264
|
+
--sve-color-default-hover: #cbd5e0;
|
|
265
|
+
--sve-color-default-active: #a0aec0;
|
|
266
|
+
|
|
267
|
+
--sve-color-overlay: rgb(0 0 0 / 0.5);
|
|
268
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic token definitions and typed SveTheme interface.
|
|
3
|
+
* CSS custom properties use the naming convention: --sve-<category>-<name>[-<state>]
|
|
4
|
+
*/
|
|
5
|
+
export interface SveColorRole {
|
|
6
|
+
/** Primary fill color */
|
|
7
|
+
DEFAULT: string;
|
|
8
|
+
/** Text/icon color on that fill */
|
|
9
|
+
foreground: string;
|
|
10
|
+
/** Light tinted background */
|
|
11
|
+
surface: string;
|
|
12
|
+
/** Border or outline color */
|
|
13
|
+
border: string;
|
|
14
|
+
/** Hover state fill */
|
|
15
|
+
hover: string;
|
|
16
|
+
/** Active/pressed state fill */
|
|
17
|
+
active: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SveColors {
|
|
20
|
+
primary: SveColorRole;
|
|
21
|
+
secondary: SveColorRole;
|
|
22
|
+
success: SveColorRole;
|
|
23
|
+
warning: SveColorRole;
|
|
24
|
+
danger: SveColorRole;
|
|
25
|
+
default: SveColorRole;
|
|
26
|
+
/** Semi-transparent overlay used by Dialog backdrop */
|
|
27
|
+
overlay: string;
|
|
28
|
+
}
|
|
29
|
+
export interface SveSpacing {
|
|
30
|
+
1: string;
|
|
31
|
+
2: string;
|
|
32
|
+
3: string;
|
|
33
|
+
4: string;
|
|
34
|
+
5: string;
|
|
35
|
+
6: string;
|
|
36
|
+
8: string;
|
|
37
|
+
10: string;
|
|
38
|
+
12: string;
|
|
39
|
+
16: string;
|
|
40
|
+
}
|
|
41
|
+
export interface SveRadius {
|
|
42
|
+
none: string;
|
|
43
|
+
sm: string;
|
|
44
|
+
md: string;
|
|
45
|
+
lg: string;
|
|
46
|
+
full: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SveShadow {
|
|
49
|
+
sm: string;
|
|
50
|
+
md: string;
|
|
51
|
+
}
|
|
52
|
+
export interface SveTypography {
|
|
53
|
+
family: {
|
|
54
|
+
sans: string;
|
|
55
|
+
};
|
|
56
|
+
size: {
|
|
57
|
+
xs: string;
|
|
58
|
+
sm: string;
|
|
59
|
+
md: string;
|
|
60
|
+
lg: string;
|
|
61
|
+
};
|
|
62
|
+
weight: {
|
|
63
|
+
normal: string;
|
|
64
|
+
medium: string;
|
|
65
|
+
bold: string;
|
|
66
|
+
};
|
|
67
|
+
lineHeight: {
|
|
68
|
+
tight: string;
|
|
69
|
+
normal: string;
|
|
70
|
+
relaxed: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface SveTheme {
|
|
74
|
+
colors: SveColors;
|
|
75
|
+
spacing: SveSpacing;
|
|
76
|
+
radius: SveRadius;
|
|
77
|
+
shadow: SveShadow;
|
|
78
|
+
typography: SveTypography;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Deeply partial version of SveTheme — used for override props.
|
|
82
|
+
* Allows consumers to override any individual token without providing the full set.
|
|
83
|
+
*/
|
|
84
|
+
export type PartialSveTheme = {
|
|
85
|
+
colors?: {
|
|
86
|
+
[K in keyof SveColors]?: Partial<SveColorRole>;
|
|
87
|
+
};
|
|
88
|
+
spacing?: Partial<SveSpacing>;
|
|
89
|
+
radius?: Partial<SveRadius>;
|
|
90
|
+
shadow?: Partial<SveShadow>;
|
|
91
|
+
typography?: {
|
|
92
|
+
family?: Partial<SveTypography['family']>;
|
|
93
|
+
size?: Partial<SveTypography['size']>;
|
|
94
|
+
weight?: Partial<SveTypography['weight']>;
|
|
95
|
+
lineHeight?: Partial<SveTypography['lineHeight']>;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export declare const lightTokens: SveTheme;
|
|
99
|
+
export declare const darkTokens: SveTheme;
|
|
100
|
+
/**
|
|
101
|
+
* Serializes a partial SveTheme override into an inline CSS variable string
|
|
102
|
+
* suitable for setting as the `style` attribute on the ThemeProvider wrapper.
|
|
103
|
+
*
|
|
104
|
+
* Example: `themeToVars({ colors: { primary: { DEFAULT: '#ff0000' } } })`
|
|
105
|
+
* → `"--sve-color-primary:#ff0000;"`
|
|
106
|
+
*/
|
|
107
|
+
export declare function themeToVars(theme: PartialSveTheme): string;
|
|
108
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/lib/theme/tokens.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic token definitions and typed SveTheme interface.
|
|
3
|
+
* CSS custom properties use the naming convention: --sve-<category>-<name>[-<state>]
|
|
4
|
+
*/
|
|
5
|
+
import { primaryScale, secondaryScale, successScale, warningScale, dangerScale, defaultScale } from './palette';
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Light tokens
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
export const lightTokens = {
|
|
10
|
+
colors: {
|
|
11
|
+
primary: {
|
|
12
|
+
DEFAULT: primaryScale[500],
|
|
13
|
+
foreground: '#ffffff',
|
|
14
|
+
surface: primaryScale[50],
|
|
15
|
+
border: primaryScale[300],
|
|
16
|
+
hover: primaryScale[600],
|
|
17
|
+
active: primaryScale[700],
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
DEFAULT: secondaryScale[500],
|
|
21
|
+
foreground: '#ffffff',
|
|
22
|
+
surface: secondaryScale[50],
|
|
23
|
+
border: secondaryScale[300],
|
|
24
|
+
hover: secondaryScale[600],
|
|
25
|
+
active: secondaryScale[700],
|
|
26
|
+
},
|
|
27
|
+
success: {
|
|
28
|
+
DEFAULT: successScale[500],
|
|
29
|
+
foreground: '#ffffff',
|
|
30
|
+
surface: successScale[50],
|
|
31
|
+
border: successScale[300],
|
|
32
|
+
hover: successScale[600],
|
|
33
|
+
active: successScale[700],
|
|
34
|
+
},
|
|
35
|
+
warning: {
|
|
36
|
+
DEFAULT: warningScale[400],
|
|
37
|
+
foreground: '#1a202c',
|
|
38
|
+
surface: warningScale[50],
|
|
39
|
+
border: warningScale[300],
|
|
40
|
+
hover: warningScale[500],
|
|
41
|
+
active: warningScale[600],
|
|
42
|
+
},
|
|
43
|
+
danger: {
|
|
44
|
+
DEFAULT: dangerScale[500],
|
|
45
|
+
foreground: '#ffffff',
|
|
46
|
+
surface: dangerScale[50],
|
|
47
|
+
border: dangerScale[300],
|
|
48
|
+
hover: dangerScale[600],
|
|
49
|
+
active: dangerScale[700],
|
|
50
|
+
},
|
|
51
|
+
default: {
|
|
52
|
+
DEFAULT: defaultScale[200],
|
|
53
|
+
foreground: defaultScale[800],
|
|
54
|
+
surface: defaultScale[50],
|
|
55
|
+
border: defaultScale[300],
|
|
56
|
+
hover: defaultScale[300],
|
|
57
|
+
active: defaultScale[400],
|
|
58
|
+
},
|
|
59
|
+
overlay: 'rgb(0 0 0 / 0.5)',
|
|
60
|
+
},
|
|
61
|
+
spacing: {
|
|
62
|
+
1: '0.25rem',
|
|
63
|
+
2: '0.5rem',
|
|
64
|
+
3: '0.75rem',
|
|
65
|
+
4: '1rem',
|
|
66
|
+
5: '1.25rem',
|
|
67
|
+
6: '1.5rem',
|
|
68
|
+
8: '2rem',
|
|
69
|
+
10: '2.5rem',
|
|
70
|
+
12: '3rem',
|
|
71
|
+
16: '4rem',
|
|
72
|
+
},
|
|
73
|
+
radius: {
|
|
74
|
+
none: '0',
|
|
75
|
+
sm: '0.125rem',
|
|
76
|
+
md: '0.375rem',
|
|
77
|
+
lg: '0.5rem',
|
|
78
|
+
full: '9999px',
|
|
79
|
+
},
|
|
80
|
+
shadow: {
|
|
81
|
+
sm: '0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)',
|
|
82
|
+
md: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
83
|
+
},
|
|
84
|
+
typography: {
|
|
85
|
+
family: {
|
|
86
|
+
sans: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
87
|
+
},
|
|
88
|
+
size: {
|
|
89
|
+
xs: '0.75rem',
|
|
90
|
+
sm: '0.875rem',
|
|
91
|
+
md: '1rem',
|
|
92
|
+
lg: '1.125rem',
|
|
93
|
+
},
|
|
94
|
+
weight: {
|
|
95
|
+
normal: '400',
|
|
96
|
+
medium: '500',
|
|
97
|
+
bold: '700',
|
|
98
|
+
},
|
|
99
|
+
lineHeight: {
|
|
100
|
+
tight: '1.25',
|
|
101
|
+
normal: '1.5',
|
|
102
|
+
relaxed: '1.75',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
// Dark tokens
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
export const darkTokens = {
|
|
110
|
+
colors: {
|
|
111
|
+
primary: {
|
|
112
|
+
DEFAULT: primaryScale[400],
|
|
113
|
+
foreground: '#ffffff',
|
|
114
|
+
surface: primaryScale[900],
|
|
115
|
+
border: primaryScale[700],
|
|
116
|
+
hover: primaryScale[300],
|
|
117
|
+
active: primaryScale[200],
|
|
118
|
+
},
|
|
119
|
+
secondary: {
|
|
120
|
+
DEFAULT: secondaryScale[400],
|
|
121
|
+
foreground: '#ffffff',
|
|
122
|
+
surface: secondaryScale[900],
|
|
123
|
+
border: secondaryScale[700],
|
|
124
|
+
hover: secondaryScale[300],
|
|
125
|
+
active: secondaryScale[200],
|
|
126
|
+
},
|
|
127
|
+
success: {
|
|
128
|
+
DEFAULT: successScale[400],
|
|
129
|
+
foreground: '#ffffff',
|
|
130
|
+
surface: successScale[900],
|
|
131
|
+
border: successScale[700],
|
|
132
|
+
hover: successScale[300],
|
|
133
|
+
active: successScale[200],
|
|
134
|
+
},
|
|
135
|
+
warning: {
|
|
136
|
+
DEFAULT: warningScale[300],
|
|
137
|
+
foreground: '#1a202c',
|
|
138
|
+
surface: warningScale[900],
|
|
139
|
+
border: warningScale[700],
|
|
140
|
+
hover: warningScale[200],
|
|
141
|
+
active: warningScale[100],
|
|
142
|
+
},
|
|
143
|
+
danger: {
|
|
144
|
+
DEFAULT: dangerScale[400],
|
|
145
|
+
foreground: '#ffffff',
|
|
146
|
+
surface: dangerScale[900],
|
|
147
|
+
border: dangerScale[700],
|
|
148
|
+
hover: dangerScale[300],
|
|
149
|
+
active: dangerScale[200],
|
|
150
|
+
},
|
|
151
|
+
default: {
|
|
152
|
+
DEFAULT: defaultScale[600],
|
|
153
|
+
foreground: defaultScale[100],
|
|
154
|
+
surface: defaultScale[800],
|
|
155
|
+
border: defaultScale[600],
|
|
156
|
+
hover: defaultScale[500],
|
|
157
|
+
active: defaultScale[400],
|
|
158
|
+
},
|
|
159
|
+
overlay: 'rgb(0 0 0 / 0.7)',
|
|
160
|
+
},
|
|
161
|
+
spacing: lightTokens.spacing,
|
|
162
|
+
radius: lightTokens.radius,
|
|
163
|
+
shadow: {
|
|
164
|
+
sm: '0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4)',
|
|
165
|
+
md: '0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)',
|
|
166
|
+
},
|
|
167
|
+
typography: lightTokens.typography,
|
|
168
|
+
};
|
|
169
|
+
// Freeze shared sub-objects so mutating darkTokens.spacing cannot silently
|
|
170
|
+
// corrupt lightTokens.spacing (they share the same reference).
|
|
171
|
+
Object.freeze(lightTokens.spacing);
|
|
172
|
+
Object.freeze(lightTokens.radius);
|
|
173
|
+
Object.freeze(lightTokens.shadow);
|
|
174
|
+
Object.freeze(lightTokens.typography.family);
|
|
175
|
+
Object.freeze(lightTokens.typography.size);
|
|
176
|
+
Object.freeze(lightTokens.typography.weight);
|
|
177
|
+
Object.freeze(lightTokens.typography.lineHeight);
|
|
178
|
+
Object.freeze(lightTokens.typography);
|
|
179
|
+
Object.freeze(lightTokens);
|
|
180
|
+
Object.freeze(darkTokens);
|
|
181
|
+
function flattenToVars(obj, prefix) {
|
|
182
|
+
let result = '';
|
|
183
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
184
|
+
const cssKey = key === 'DEFAULT' ? prefix : `${prefix}-${camelToKebab(key)}`;
|
|
185
|
+
if (typeof value === 'string') {
|
|
186
|
+
result += `${cssKey}:${value};`;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
result += flattenToVars(value, cssKey);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
function camelToKebab(str) {
|
|
195
|
+
return str.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Serializes a partial SveTheme override into an inline CSS variable string
|
|
199
|
+
* suitable for setting as the `style` attribute on the ThemeProvider wrapper.
|
|
200
|
+
*
|
|
201
|
+
* Example: `themeToVars({ colors: { primary: { DEFAULT: '#ff0000' } } })`
|
|
202
|
+
* → `"--sve-color-primary:#ff0000;"`
|
|
203
|
+
*/
|
|
204
|
+
export function themeToVars(theme) {
|
|
205
|
+
let vars = '';
|
|
206
|
+
if (theme.colors) {
|
|
207
|
+
vars += flattenToVars(theme.colors, '--sve-color');
|
|
208
|
+
}
|
|
209
|
+
if (theme.spacing) {
|
|
210
|
+
vars += flattenToVars(theme.spacing, '--sve-space');
|
|
211
|
+
}
|
|
212
|
+
if (theme.radius) {
|
|
213
|
+
vars += flattenToVars(theme.radius, '--sve-radius');
|
|
214
|
+
}
|
|
215
|
+
if (theme.shadow) {
|
|
216
|
+
vars += flattenToVars(theme.shadow, '--sve-shadow');
|
|
217
|
+
}
|
|
218
|
+
if (theme.typography) {
|
|
219
|
+
// Each typography sub-group maps to a distinct CSS variable namespace.
|
|
220
|
+
// Handled individually so generated var names match theme.css exactly:
|
|
221
|
+
// family → --sve-font-family-*
|
|
222
|
+
// size → --sve-font-size-*
|
|
223
|
+
// weight → --sve-font-weight-*
|
|
224
|
+
// lineHeight → --sve-line-height-* (note: no "font" in this prefix)
|
|
225
|
+
const typo = theme.typography;
|
|
226
|
+
if (typo.family)
|
|
227
|
+
vars += flattenToVars(typo.family, '--sve-font-family');
|
|
228
|
+
if (typo.size)
|
|
229
|
+
vars += flattenToVars(typo.size, '--sve-font-size');
|
|
230
|
+
if (typo.weight)
|
|
231
|
+
vars += flattenToVars(typo.weight, '--sve-font-weight');
|
|
232
|
+
if (typo.lineHeight)
|
|
233
|
+
vars += flattenToVars(typo.lineHeight, '--sve-line-height');
|
|
234
|
+
}
|
|
235
|
+
return vars;
|
|
236
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/lib/theme/typography.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DtB,CAAA"}
|