@foundrykit/tailwind 1.0.5 → 1.0.7
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 +12 -0
- package/README.md +22 -337
- package/package.json +7 -6
- package/src/globals.css +187 -44
- package/test/tokens.test.mjs +102 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @foundrykit/tailwind
|
|
2
2
|
|
|
3
|
+
## 1.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#129](https://github.com/umi-labs/foundry/pull/129) [`dad73bd`](https://github.com/umi-labs/foundry/commit/dad73bdf46b3de1b3b6db52ceb4465516ebdb7e1) Thanks [@sneddonisaac](https://github.com/sneddonisaac)! - Adds the `.theme-switching * { transition: none !important }` guard used by `ThemeToggle`. Documents the `@source "../node_modules/@foundrykit";` line pnpm sites must add to their `globals.css`: under pnpm this stylesheet resolves from inside `node_modules/.pnpm`, so it can't reach the site's installed FoundryKit packages on its own.
|
|
8
|
+
|
|
9
|
+
## 1.0.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#43](https://github.com/umi-labs/foundry/pull/43) [`b6fc94d`](https://github.com/umi-labs/foundry/commit/b6fc94d3b0f172aa309388f61bd5306af6405fdf) Thanks [@sneddonisaac](https://github.com/sneddonisaac)! - Package metadata now points at the `umi-labs/foundry` monorepo, and releases publish through npm trusted publishing.
|
|
14
|
+
|
|
3
15
|
## 1.0.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,362 +1,47 @@
|
|
|
1
1
|
# @foundrykit/tailwind
|
|
2
2
|
|
|
3
|
-
Tailwind CSS
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- **Design tokens** - Consistent colors, spacing, typography, and other design
|
|
10
|
-
values
|
|
11
|
-
- **Component utilities** - Pre-built utility classes for common component
|
|
12
|
-
patterns
|
|
13
|
-
- **Theme integration** - Seamless integration with your existing theme
|
|
14
|
-
- **CSS variables** - Modern CSS custom properties for dynamic theming
|
|
15
|
-
- **Tailwind v4** - Built for the latest Tailwind CSS version
|
|
3
|
+
Shared Tailwind CSS v4 theme for the FoundryKit design system. Ships a single
|
|
4
|
+
`globals.css` with design tokens (OKLCH color variables, light/dark theme),
|
|
5
|
+
`tailwindcss` and `tw-animate-css` imports, and workspace `@source` scanning.
|
|
16
6
|
|
|
17
7
|
## Installation
|
|
18
8
|
|
|
19
9
|
```bash
|
|
20
|
-
pnpm add @foundrykit/tailwind
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
|
-
|
|
25
|
-
### 1. Import the CSS
|
|
26
|
-
|
|
27
|
-
In your main CSS file (e.g., `globals.css`):
|
|
28
|
-
|
|
29
|
-
```css
|
|
30
|
-
@import '@foundrykit/tailwind/globals.css';
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### 2. Use in Components
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
import { Button } from '@foundrykit/primitives/button';
|
|
37
|
-
|
|
38
|
-
function MyComponent() {
|
|
39
|
-
return (
|
|
40
|
-
<Button className='bg-primary text-primary-foreground hover:bg-primary/90'>
|
|
41
|
-
Click me
|
|
42
|
-
</Button>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Design Tokens
|
|
48
|
-
|
|
49
|
-
### Colors
|
|
50
|
-
|
|
51
|
-
The package provides a comprehensive color system:
|
|
52
|
-
|
|
53
|
-
```css
|
|
54
|
-
/* Primary colors */
|
|
55
|
-
--color-primary: 222.2 84% 4.9%;
|
|
56
|
-
--color-primary-foreground: 210 40% 98%;
|
|
57
|
-
|
|
58
|
-
/* Secondary colors */
|
|
59
|
-
--color-secondary: 210 40% 96%;
|
|
60
|
-
--color-secondary-foreground: 222.2 84% 4.9%;
|
|
61
|
-
|
|
62
|
-
/* Accent colors */
|
|
63
|
-
--color-accent: 210 40% 96%;
|
|
64
|
-
--color-accent-foreground: 222.2 84% 4.9%;
|
|
65
|
-
|
|
66
|
-
/* Semantic colors */
|
|
67
|
-
--color-destructive: 0 84.2% 60.2%;
|
|
68
|
-
--color-destructive-foreground: 210 40% 98%;
|
|
69
|
-
--color-muted: 210 40% 96%;
|
|
70
|
-
--color-muted-foreground: 215.4 16.3% 46.9%;
|
|
71
|
-
--color-border: 214.3 31.8% 91.4%;
|
|
72
|
-
--color-input: 214.3 31.8% 91.4%;
|
|
73
|
-
--color-ring: 222.2 84% 4.9%;
|
|
74
|
-
--color-background: 0 0% 100%;
|
|
75
|
-
--color-foreground: 222.2 84% 4.9%;
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Spacing
|
|
79
|
-
|
|
80
|
-
Consistent spacing scale:
|
|
81
|
-
|
|
82
|
-
```css
|
|
83
|
-
--spacing-0: 0px;
|
|
84
|
-
--spacing-1: 0.25rem;
|
|
85
|
-
--spacing-2: 0.5rem;
|
|
86
|
-
--spacing-3: 0.75rem;
|
|
87
|
-
--spacing-4: 1rem;
|
|
88
|
-
--spacing-5: 1.25rem;
|
|
89
|
-
--spacing-6: 1.5rem;
|
|
90
|
-
--spacing-8: 2rem;
|
|
91
|
-
--spacing-10: 2.5rem;
|
|
92
|
-
--spacing-12: 3rem;
|
|
93
|
-
--spacing-16: 4rem;
|
|
94
|
-
--spacing-20: 5rem;
|
|
95
|
-
--spacing-24: 6rem;
|
|
96
|
-
--spacing-32: 8rem;
|
|
97
|
-
--spacing-40: 10rem;
|
|
98
|
-
--spacing-48: 12rem;
|
|
99
|
-
--spacing-56: 14rem;
|
|
100
|
-
--spacing-64: 16rem;
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Typography
|
|
104
|
-
|
|
105
|
-
Typography tokens for consistent text styling:
|
|
106
|
-
|
|
107
|
-
```css
|
|
108
|
-
/* Font families */
|
|
109
|
-
--font-sans: ui-sans-serif, system-ui, sans-serif;
|
|
110
|
-
--font-serif: ui-serif, Georgia, serif;
|
|
111
|
-
--font-mono: ui-monospace, SFMono-Regular, monospace;
|
|
112
|
-
|
|
113
|
-
/* Font sizes */
|
|
114
|
-
--font-size-xs: 0.75rem;
|
|
115
|
-
--font-size-sm: 0.875rem;
|
|
116
|
-
--font-size-base: 1rem;
|
|
117
|
-
--font-size-lg: 1.125rem;
|
|
118
|
-
--font-size-xl: 1.25rem;
|
|
119
|
-
--font-size-2xl: 1.5rem;
|
|
120
|
-
--font-size-3xl: 1.875rem;
|
|
121
|
-
--font-size-4xl: 2.25rem;
|
|
122
|
-
--font-size-5xl: 3rem;
|
|
123
|
-
--font-size-6xl: 3.75rem;
|
|
124
|
-
|
|
125
|
-
/* Font weights */
|
|
126
|
-
--font-weight-thin: 100;
|
|
127
|
-
--font-weight-extralight: 200;
|
|
128
|
-
--font-weight-light: 300;
|
|
129
|
-
--font-weight-normal: 400;
|
|
130
|
-
--font-weight-medium: 500;
|
|
131
|
-
--font-weight-semibold: 600;
|
|
132
|
-
--font-weight-bold: 700;
|
|
133
|
-
--font-weight-extrabold: 800;
|
|
134
|
-
--font-weight-black: 900;
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Border Radius
|
|
138
|
-
|
|
139
|
-
Consistent border radius values:
|
|
140
|
-
|
|
141
|
-
```css
|
|
142
|
-
--radius-none: 0px;
|
|
143
|
-
--radius-sm: 0.125rem;
|
|
144
|
-
--radius-base: 0.25rem;
|
|
145
|
-
--radius-md: 0.375rem;
|
|
146
|
-
--radius-lg: 0.5rem;
|
|
147
|
-
--radius-xl: 0.75rem;
|
|
148
|
-
--radius-2xl: 1rem;
|
|
149
|
-
--radius-3xl: 1.5rem;
|
|
150
|
-
--radius-full: 9999px;
|
|
10
|
+
pnpm add @foundrykit/tailwind tailwindcss tw-animate-css
|
|
151
11
|
```
|
|
152
12
|
|
|
153
13
|
## Usage
|
|
154
14
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
```tsx
|
|
158
|
-
import { Button } from '@foundrykit/primitives/button';
|
|
159
|
-
|
|
160
|
-
function StyledButton() {
|
|
161
|
-
return (
|
|
162
|
-
<Button
|
|
163
|
-
className='
|
|
164
|
-
bg-primary text-primary-foreground
|
|
165
|
-
hover:bg-primary/90
|
|
166
|
-
rounded-md px-4 py-2
|
|
167
|
-
font-medium transition-colors
|
|
168
|
-
'
|
|
169
|
-
>
|
|
170
|
-
Styled Button
|
|
171
|
-
</Button>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### Using Design Tokens
|
|
177
|
-
|
|
178
|
-
```tsx
|
|
179
|
-
function Card() {
|
|
180
|
-
return (
|
|
181
|
-
<div
|
|
182
|
-
className='
|
|
183
|
-
bg-background text-foreground
|
|
184
|
-
border-border rounded-lg border
|
|
185
|
-
p-6 shadow-sm
|
|
186
|
-
'
|
|
187
|
-
>
|
|
188
|
-
<h3 className='mb-2 text-lg font-semibold'>Card Title</h3>
|
|
189
|
-
<p className='text-muted-foreground'>Card content goes here</p>
|
|
190
|
-
</div>
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### Responsive Design
|
|
196
|
-
|
|
197
|
-
```tsx
|
|
198
|
-
function ResponsiveComponent() {
|
|
199
|
-
return (
|
|
200
|
-
<div
|
|
201
|
-
className='
|
|
202
|
-
grid grid-cols-1 gap-4 p-4
|
|
203
|
-
md:grid-cols-2 md:gap-6 md:p-6
|
|
204
|
-
lg:grid-cols-3 lg:gap-8 lg:p-8
|
|
205
|
-
'
|
|
206
|
-
>
|
|
207
|
-
{/* Content */}
|
|
208
|
-
</div>
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### Dark Mode Support
|
|
214
|
-
|
|
215
|
-
```tsx
|
|
216
|
-
function ThemeAwareComponent() {
|
|
217
|
-
return (
|
|
218
|
-
<div
|
|
219
|
-
className='
|
|
220
|
-
bg-background text-foreground
|
|
221
|
-
dark:bg-background dark:text-foreground
|
|
222
|
-
border-border dark:border-border border
|
|
223
|
-
'
|
|
224
|
-
>
|
|
225
|
-
<p className='text-muted-foreground dark:text-muted-foreground'>
|
|
226
|
-
This component adapts to light and dark themes
|
|
227
|
-
</p>
|
|
228
|
-
</div>
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Customization
|
|
234
|
-
|
|
235
|
-
### Extending the Theme
|
|
236
|
-
|
|
237
|
-
Create your own `globals.css` to extend the theme:
|
|
15
|
+
Import the stylesheet once at the root of your app (for example in your global
|
|
16
|
+
CSS entry):
|
|
238
17
|
|
|
239
18
|
```css
|
|
240
|
-
@import
|
|
241
|
-
|
|
242
|
-
/* Custom design tokens */
|
|
243
|
-
:root {
|
|
244
|
-
--color-brand: 220 14% 96%;
|
|
245
|
-
--color-brand-foreground: 220 9% 46%;
|
|
246
|
-
|
|
247
|
-
--font-size-custom: 1.1rem;
|
|
248
|
-
--spacing-custom: 1.75rem;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/* Custom utilities */
|
|
252
|
-
@utility custom-button {
|
|
253
|
-
@apply bg-brand text-brand-foreground px-custom rounded-md py-2;
|
|
254
|
-
}
|
|
19
|
+
@import "@foundrykit/tailwind/globals.css";
|
|
255
20
|
```
|
|
256
21
|
|
|
257
|
-
|
|
22
|
+
This pulls in Tailwind v4, the animation utilities, and the FoundryKit token
|
|
23
|
+
variables (`--background`, `--foreground`, `--primary`, chart colors, etc.),
|
|
24
|
+
which are consumed by FoundryKit components.
|
|
258
25
|
|
|
259
|
-
|
|
260
|
-
/* Custom component styles */
|
|
261
|
-
@utility button-primary {
|
|
262
|
-
@apply bg-primary text-primary-foreground hover:bg-primary/90;
|
|
263
|
-
}
|
|
26
|
+
### Scanning FoundryKit packages (pnpm)
|
|
264
27
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
@utility card-elevated {
|
|
270
|
-
@apply bg-background border-border rounded-lg border shadow-lg;
|
|
271
|
-
}
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Custom Color Palette
|
|
28
|
+
Tailwind does not scan `node_modules`, and under pnpm this stylesheet resolves
|
|
29
|
+
from `node_modules/.pnpm/...`, so it cannot point at your installed packages
|
|
30
|
+
itself. Add an `@source` line next to the import so the classes used inside
|
|
31
|
+
`@foundrykit/primitives`, `components`, `blocks` and friends are generated:
|
|
275
32
|
|
|
276
33
|
```css
|
|
277
|
-
|
|
278
|
-
:
|
|
279
|
-
|
|
280
|
-
--color-custom-green: 142 76% 36%;
|
|
281
|
-
--color-custom-purple: 262 83% 58%;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/* Use in components */
|
|
285
|
-
.custom-button {
|
|
286
|
-
background-color: hsl(var(--color-custom-blue));
|
|
287
|
-
color: white;
|
|
288
|
-
}
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Integration with Frameworks
|
|
292
|
-
|
|
293
|
-
### Next.js
|
|
294
|
-
|
|
295
|
-
In your `app/globals.css`:
|
|
296
|
-
|
|
297
|
-
```css
|
|
298
|
-
@import '@foundrykit/tailwind/globals.css';
|
|
299
|
-
|
|
300
|
-
/* Your custom styles */
|
|
34
|
+
@import "@foundrykit/tailwind/globals.css";
|
|
35
|
+
/* Path is relative to this CSS file: adjust the ../ depth to reach node_modules. */
|
|
36
|
+
@source "../node_modules/@foundrykit";
|
|
301
37
|
```
|
|
302
38
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
In your `src/index.css`:
|
|
306
|
-
|
|
307
|
-
```css
|
|
308
|
-
@import '@foundrykit/tailwind/globals.css';
|
|
309
|
-
|
|
310
|
-
/* Your custom styles */
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
### Vue
|
|
314
|
-
|
|
315
|
-
In your `src/assets/main.css`:
|
|
316
|
-
|
|
317
|
-
```css
|
|
318
|
-
@import '@foundrykit/tailwind/globals.css';
|
|
319
|
-
|
|
320
|
-
/* Your custom styles */
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
## Performance
|
|
324
|
-
|
|
325
|
-
### Optimized Bundle
|
|
326
|
-
|
|
327
|
-
- Tree-shakable CSS
|
|
328
|
-
- Minimal runtime overhead
|
|
329
|
-
- Efficient class generation
|
|
330
|
-
- Optimized for Tailwind v4
|
|
331
|
-
|
|
332
|
-
### Best Practices
|
|
333
|
-
|
|
334
|
-
```tsx
|
|
335
|
-
// ✅ Good - Use semantic class names
|
|
336
|
-
<div className="bg-background text-foreground p-4 rounded-lg">
|
|
337
|
-
|
|
338
|
-
// ❌ Avoid - Hard-coded values
|
|
339
|
-
<div className="bg-white text-black p-4 rounded-lg">
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
## Migration from Tailwind v3
|
|
343
|
-
|
|
344
|
-
If you're migrating from Tailwind v3:
|
|
345
|
-
|
|
346
|
-
1. **Update imports** - Use the new CSS import syntax
|
|
347
|
-
2. **Remove config files** - Tailwind v4 uses CSS-based configuration
|
|
348
|
-
3. **Update class names** - Some utilities may have changed
|
|
349
|
-
4. **Test thoroughly** - Verify all styles work as expected
|
|
350
|
-
|
|
351
|
-
## Contributing
|
|
39
|
+
Without it, components render unstyled wherever they use a class your own code
|
|
40
|
+
does not.
|
|
352
41
|
|
|
353
|
-
|
|
42
|
+
## Exports
|
|
354
43
|
|
|
355
|
-
|
|
356
|
-
2. Ensure accessibility compliance
|
|
357
|
-
3. Test with both light and dark themes
|
|
358
|
-
4. Update this README
|
|
359
|
-
5. Maintain backward compatibility
|
|
44
|
+
- `@foundrykit/tailwind/globals.css` — the complete Tailwind v4 theme and tokens.
|
|
360
45
|
|
|
361
46
|
## License
|
|
362
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foundrykit/tailwind",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,18 +16,19 @@
|
|
|
16
16
|
"tailwindcss": "^4.1.1",
|
|
17
17
|
"tw-animate-css": "^1.2.0"
|
|
18
18
|
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"eslint": "^9.0.0",
|
|
21
|
-
"@foundrykit/eslint-config": "1.0.5"
|
|
22
|
-
},
|
|
23
19
|
"peerDependencies": {
|
|
24
20
|
"tailwindcss": "^4.1.1",
|
|
25
21
|
"tw-animate-css": "^1.2.0"
|
|
26
22
|
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/umi-labs/foundry.git",
|
|
26
|
+
"directory": "packages/tailwind"
|
|
27
|
+
},
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "echo 'No build required for CSS package'",
|
|
29
30
|
"dev": "echo 'No dev build required for CSS package'",
|
|
30
|
-
"lint": "
|
|
31
|
+
"lint": "echo 'No lintable files in CSS package'",
|
|
31
32
|
"type-check": "echo 'No TypeScript files to check'"
|
|
32
33
|
}
|
|
33
34
|
}
|
package/src/globals.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
@import
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
3
|
@source "../../../apps/**/*.{ts,tsx}";
|
|
4
4
|
@source "../../../components/**/*.{ts,tsx}";
|
|
5
5
|
@source "../**/*.{ts,tsx}";
|
|
@@ -7,33 +7,154 @@
|
|
|
7
7
|
/* Scan every workspace package: primitives, blocks, components, etc. */
|
|
8
8
|
@source "../../*/{src,dist}/**/*.{ts,tsx,js,jsx,mjs,cjs}";
|
|
9
9
|
|
|
10
|
-
/* When consumed from npm
|
|
10
|
+
/* When consumed from npm with a flat node_modules (npm, yarn). Under pnpm this
|
|
11
|
+
file resolves inside node_modules/.pnpm, so no relative path from here reaches
|
|
12
|
+
the site's packages: pnpm sites must add
|
|
13
|
+
`@source "../node_modules/@foundrykit";` to their own globals.css (see README). */
|
|
11
14
|
@source "../../../node_modules/@foundrykit/**/*.{ts,tsx,js,jsx,mjs,cjs}";
|
|
12
15
|
|
|
13
|
-
@import 'tw-animate-css';
|
|
14
|
-
|
|
15
16
|
@custom-variant dark (&:is(.dark *));
|
|
16
17
|
|
|
18
|
+
/* ---------------------------------------------------------------------------
|
|
19
|
+
Tier 1 — primitive color scales (Umi palette). Constant across light/dark.
|
|
20
|
+
50 = lightest, 950 = darkest, 500 = brand base. Defined in @theme so they
|
|
21
|
+
generate utilities (bg-primary-500, text-accent-200, border-warning-700, …).
|
|
22
|
+
--------------------------------------------------------------------------- */
|
|
23
|
+
@theme {
|
|
24
|
+
/* primary — Umi Blue #368DB1 */
|
|
25
|
+
--color-primary-50: oklch(0.985 0.0176 229.12);
|
|
26
|
+
--color-primary-100: oklch(0.9094 0.0294 229.12);
|
|
27
|
+
--color-primary-200: oklch(0.8337 0.049 229.12);
|
|
28
|
+
--color-primary-300: oklch(0.7581 0.0686 229.12);
|
|
29
|
+
--color-primary-400: oklch(0.6824 0.0882 229.12);
|
|
30
|
+
--color-primary-500: oklch(0.6068 0.0981 229.12);
|
|
31
|
+
--color-primary-600: oklch(0.5254 0.0981 229.12);
|
|
32
|
+
--color-primary-700: oklch(0.4441 0.0931 229.12);
|
|
33
|
+
--color-primary-800: oklch(0.3627 0.0833 229.12);
|
|
34
|
+
--color-primary-900: oklch(0.2814 0.0706 229.12);
|
|
35
|
+
--color-primary-950: oklch(0.2 0.0637 229.12);
|
|
36
|
+
|
|
37
|
+
/* secondary — Umi Black #313E4E */
|
|
38
|
+
--color-secondary-50: oklch(0.985 0.0059 253.87);
|
|
39
|
+
--color-secondary-100: oklch(0.8598 0.0098 253.87);
|
|
40
|
+
--color-secondary-200: oklch(0.7347 0.0164 253.87);
|
|
41
|
+
--color-secondary-300: oklch(0.6095 0.0229 253.87);
|
|
42
|
+
--color-secondary-400: oklch(0.4843 0.0295 253.87);
|
|
43
|
+
--color-secondary-500: oklch(0.3591 0.0327 253.87);
|
|
44
|
+
--color-secondary-600: oklch(0.3273 0.0327 253.87);
|
|
45
|
+
--color-secondary-700: oklch(0.2955 0.0311 253.87);
|
|
46
|
+
--color-secondary-800: oklch(0.2637 0.0278 253.87);
|
|
47
|
+
--color-secondary-900: oklch(0.2318 0.0236 253.87);
|
|
48
|
+
--color-secondary-950: oklch(0.2 0.0213 253.87);
|
|
49
|
+
|
|
50
|
+
/* tertiary — Umi Yellow #FFE48C */
|
|
51
|
+
--color-tertiary-50: oklch(0.985 0.0201 92.92);
|
|
52
|
+
--color-tertiary-100: oklch(0.9725 0.0335 92.92);
|
|
53
|
+
--color-tertiary-200: oklch(0.9599 0.0559 92.92);
|
|
54
|
+
--color-tertiary-300: oklch(0.9474 0.0783 92.92);
|
|
55
|
+
--color-tertiary-400: oklch(0.9349 0.1006 92.92);
|
|
56
|
+
--color-tertiary-500: oklch(0.9224 0.1118 92.92);
|
|
57
|
+
--color-tertiary-600: oklch(0.7779 0.1118 92.92);
|
|
58
|
+
--color-tertiary-700: oklch(0.6334 0.1062 92.92);
|
|
59
|
+
--color-tertiary-800: oklch(0.4889 0.0951 92.92);
|
|
60
|
+
--color-tertiary-900: oklch(0.3445 0.0805 92.92);
|
|
61
|
+
--color-tertiary-950: oklch(0.2 0.0727 92.92);
|
|
62
|
+
|
|
63
|
+
/* accent — Umi Light Blue #90DEE6 */
|
|
64
|
+
--color-accent-50: oklch(0.985 0.0139 204.05);
|
|
65
|
+
--color-accent-100: oklch(0.9586 0.0232 204.05);
|
|
66
|
+
--color-accent-200: oklch(0.9322 0.0387 204.05);
|
|
67
|
+
--color-accent-300: oklch(0.9057 0.0542 204.05);
|
|
68
|
+
--color-accent-400: oklch(0.8793 0.0697 204.05);
|
|
69
|
+
--color-accent-500: oklch(0.8529 0.0774 204.05);
|
|
70
|
+
--color-accent-600: oklch(0.7223 0.0774 204.05);
|
|
71
|
+
--color-accent-700: oklch(0.5917 0.0736 204.05);
|
|
72
|
+
--color-accent-800: oklch(0.4612 0.0658 204.05);
|
|
73
|
+
--color-accent-900: oklch(0.3306 0.0557 204.05);
|
|
74
|
+
--color-accent-950: oklch(0.2 0.0503 204.05);
|
|
75
|
+
|
|
76
|
+
/* destructive — Error #B42318 */
|
|
77
|
+
--color-destructive-50: oklch(0.985 0.0328 29.51);
|
|
78
|
+
--color-destructive-100: oklch(0.8881 0.0546 29.51);
|
|
79
|
+
--color-destructive-200: oklch(0.7911 0.091 29.51);
|
|
80
|
+
--color-destructive-300: oklch(0.6942 0.1274 29.51);
|
|
81
|
+
--color-destructive-400: oklch(0.5973 0.1638 29.51);
|
|
82
|
+
--color-destructive-500: oklch(0.5003 0.1821 29.51);
|
|
83
|
+
--color-destructive-600: oklch(0.4403 0.1821 29.51);
|
|
84
|
+
--color-destructive-700: oklch(0.3802 0.1729 29.51);
|
|
85
|
+
--color-destructive-800: oklch(0.3201 0.1547 29.51);
|
|
86
|
+
--color-destructive-900: oklch(0.2601 0.1311 29.51);
|
|
87
|
+
--color-destructive-950: oklch(0.2 0.1183 29.51);
|
|
88
|
+
|
|
89
|
+
/* success — Success #027A48 */
|
|
90
|
+
--color-success-50: oklch(0.985 0.0219 156.56);
|
|
91
|
+
--color-success-100: oklch(0.89 0.0365 156.56);
|
|
92
|
+
--color-success-200: oklch(0.795 0.0609 156.56);
|
|
93
|
+
--color-success-300: oklch(0.7 0.0853 156.56);
|
|
94
|
+
--color-success-400: oklch(0.605 0.1096 156.56);
|
|
95
|
+
--color-success-500: oklch(0.51 0.1218 156.56);
|
|
96
|
+
--color-success-600: oklch(0.448 0.1218 156.56);
|
|
97
|
+
--color-success-700: oklch(0.386 0.1157 156.56);
|
|
98
|
+
--color-success-800: oklch(0.324 0.1036 156.56);
|
|
99
|
+
--color-success-900: oklch(0.262 0.0877 156.56);
|
|
100
|
+
--color-success-950: oklch(0.2 0.0792 156.56);
|
|
101
|
+
|
|
102
|
+
/* warning — Warning #FF9800 */
|
|
103
|
+
--color-warning-50: oklch(0.985 0.0313 64.05);
|
|
104
|
+
--color-warning-100: oklch(0.9421 0.0522 64.05);
|
|
105
|
+
--color-warning-200: oklch(0.8991 0.0871 64.05);
|
|
106
|
+
--color-warning-300: oklch(0.8562 0.1219 64.05);
|
|
107
|
+
--color-warning-400: oklch(0.8132 0.1567 64.05);
|
|
108
|
+
--color-warning-500: oklch(0.7703 0.1741 64.05);
|
|
109
|
+
--color-warning-600: oklch(0.6562 0.1741 64.05);
|
|
110
|
+
--color-warning-700: oklch(0.5422 0.1654 64.05);
|
|
111
|
+
--color-warning-800: oklch(0.4281 0.148 64.05);
|
|
112
|
+
--color-warning-900: oklch(0.3141 0.1254 64.05);
|
|
113
|
+
--color-warning-950: oklch(0.2 0.1132 64.05);
|
|
114
|
+
|
|
115
|
+
/* neutral — cool grey (Umi Black family); drives surfaces/text/borders */
|
|
116
|
+
--color-neutral-50: oklch(0.985 0.0042 250.59);
|
|
117
|
+
--color-neutral-100: oklch(0.8883 0.007 250.59);
|
|
118
|
+
--color-neutral-200: oklch(0.7917 0.0117 250.59);
|
|
119
|
+
--color-neutral-300: oklch(0.695 0.0164 250.59);
|
|
120
|
+
--color-neutral-400: oklch(0.5984 0.0211 250.59);
|
|
121
|
+
--color-neutral-500: oklch(0.5017 0.0235 250.59);
|
|
122
|
+
--color-neutral-600: oklch(0.4414 0.0235 250.59);
|
|
123
|
+
--color-neutral-700: oklch(0.381 0.0223 250.59);
|
|
124
|
+
--color-neutral-800: oklch(0.3207 0.02 250.59);
|
|
125
|
+
--color-neutral-900: oklch(0.2603 0.0169 250.59);
|
|
126
|
+
--color-neutral-950: oklch(0.2 0.0153 250.59);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ---------------------------------------------------------------------------
|
|
130
|
+
Tier 2 — semantic roles (light). Reference Tier-1 steps; flip in .dark.
|
|
131
|
+
--------------------------------------------------------------------------- */
|
|
17
132
|
:root {
|
|
18
|
-
--background:
|
|
19
|
-
--foreground:
|
|
20
|
-
--card:
|
|
21
|
-
--card-foreground:
|
|
22
|
-
--popover:
|
|
23
|
-
--popover-foreground:
|
|
24
|
-
--primary:
|
|
25
|
-
--primary-foreground:
|
|
26
|
-
--secondary:
|
|
27
|
-
--secondary-foreground:
|
|
28
|
-
--
|
|
29
|
-
--
|
|
30
|
-
--accent:
|
|
31
|
-
--accent-foreground:
|
|
32
|
-
--
|
|
33
|
-
--
|
|
34
|
-
--
|
|
35
|
-
--
|
|
36
|
-
--
|
|
133
|
+
--background: var(--color-neutral-50);
|
|
134
|
+
--foreground: var(--color-neutral-900);
|
|
135
|
+
--card: var(--color-neutral-50);
|
|
136
|
+
--card-foreground: var(--color-neutral-900);
|
|
137
|
+
--popover: var(--color-neutral-50);
|
|
138
|
+
--popover-foreground: var(--color-neutral-900);
|
|
139
|
+
--primary: var(--color-primary-600);
|
|
140
|
+
--primary-foreground: var(--color-primary-50);
|
|
141
|
+
--secondary: var(--color-secondary-500);
|
|
142
|
+
--secondary-foreground: var(--color-secondary-50);
|
|
143
|
+
--tertiary: var(--color-tertiary-500);
|
|
144
|
+
--tertiary-foreground: var(--color-tertiary-950);
|
|
145
|
+
--accent: var(--color-accent-100);
|
|
146
|
+
--accent-foreground: var(--color-accent-900);
|
|
147
|
+
--muted: var(--color-neutral-100);
|
|
148
|
+
--muted-foreground: var(--color-neutral-600);
|
|
149
|
+
--destructive: var(--color-destructive-500);
|
|
150
|
+
--destructive-foreground: var(--color-destructive-50);
|
|
151
|
+
--success: var(--color-success-500);
|
|
152
|
+
--success-foreground: var(--color-success-50);
|
|
153
|
+
--warning: var(--color-warning-500);
|
|
154
|
+
--warning-foreground: var(--color-warning-950);
|
|
155
|
+
--border: var(--color-neutral-200);
|
|
156
|
+
--input: var(--color-neutral-200);
|
|
157
|
+
--ring: var(--color-primary-500);
|
|
37
158
|
--chart-1: oklch(0.646 0.222 41.116);
|
|
38
159
|
--chart-2: oklch(0.6 0.118 184.704);
|
|
39
160
|
--chart-3: oklch(0.398 0.07 227.392);
|
|
@@ -51,25 +172,31 @@
|
|
|
51
172
|
}
|
|
52
173
|
|
|
53
174
|
.dark {
|
|
54
|
-
--background:
|
|
55
|
-
--foreground:
|
|
56
|
-
--card:
|
|
57
|
-
--card-foreground:
|
|
58
|
-
--popover:
|
|
59
|
-
--popover-foreground:
|
|
60
|
-
--primary:
|
|
61
|
-
--primary-foreground:
|
|
62
|
-
--secondary:
|
|
63
|
-
--secondary-foreground:
|
|
64
|
-
--
|
|
65
|
-
--
|
|
66
|
-
--accent:
|
|
67
|
-
--accent-foreground:
|
|
68
|
-
--
|
|
69
|
-
--
|
|
70
|
-
--
|
|
71
|
-
--
|
|
72
|
-
--
|
|
175
|
+
--background: var(--color-neutral-950);
|
|
176
|
+
--foreground: var(--color-neutral-50);
|
|
177
|
+
--card: var(--color-neutral-900);
|
|
178
|
+
--card-foreground: var(--color-neutral-50);
|
|
179
|
+
--popover: var(--color-neutral-900);
|
|
180
|
+
--popover-foreground: var(--color-neutral-50);
|
|
181
|
+
--primary: var(--color-primary-400);
|
|
182
|
+
--primary-foreground: var(--color-primary-950);
|
|
183
|
+
--secondary: var(--color-secondary-700);
|
|
184
|
+
--secondary-foreground: var(--color-secondary-50);
|
|
185
|
+
--tertiary: var(--color-tertiary-500);
|
|
186
|
+
--tertiary-foreground: var(--color-tertiary-950);
|
|
187
|
+
--accent: var(--color-accent-900);
|
|
188
|
+
--accent-foreground: var(--color-accent-50);
|
|
189
|
+
--muted: var(--color-neutral-800);
|
|
190
|
+
--muted-foreground: var(--color-neutral-400);
|
|
191
|
+
--destructive: var(--color-destructive-500);
|
|
192
|
+
--destructive-foreground: var(--color-destructive-50);
|
|
193
|
+
--success: var(--color-success-500);
|
|
194
|
+
--success-foreground: var(--color-success-50);
|
|
195
|
+
--warning: var(--color-warning-500);
|
|
196
|
+
--warning-foreground: var(--color-warning-950);
|
|
197
|
+
--border: var(--color-neutral-800);
|
|
198
|
+
--input: var(--color-neutral-800);
|
|
199
|
+
--ring: var(--color-primary-400);
|
|
73
200
|
--chart-1: oklch(0.488 0.243 264.376);
|
|
74
201
|
--chart-2: oklch(0.696 0.17 162.48);
|
|
75
202
|
--chart-3: oklch(0.769 0.188 70.08);
|
|
@@ -85,6 +212,9 @@
|
|
|
85
212
|
--sidebar-ring: oklch(0.439 0 0);
|
|
86
213
|
}
|
|
87
214
|
|
|
215
|
+
/* ---------------------------------------------------------------------------
|
|
216
|
+
Re-expose semantic roles as Tailwind color utilities, reactive to .dark.
|
|
217
|
+
--------------------------------------------------------------------------- */
|
|
88
218
|
@theme inline {
|
|
89
219
|
--color-background: var(--background);
|
|
90
220
|
--color-foreground: var(--foreground);
|
|
@@ -96,12 +226,18 @@
|
|
|
96
226
|
--color-primary-foreground: var(--primary-foreground);
|
|
97
227
|
--color-secondary: var(--secondary);
|
|
98
228
|
--color-secondary-foreground: var(--secondary-foreground);
|
|
229
|
+
--color-tertiary: var(--tertiary);
|
|
230
|
+
--color-tertiary-foreground: var(--tertiary-foreground);
|
|
99
231
|
--color-muted: var(--muted);
|
|
100
232
|
--color-muted-foreground: var(--muted-foreground);
|
|
101
233
|
--color-accent: var(--accent);
|
|
102
234
|
--color-accent-foreground: var(--accent-foreground);
|
|
103
235
|
--color-destructive: var(--destructive);
|
|
104
236
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
237
|
+
--color-success: var(--success);
|
|
238
|
+
--color-success-foreground: var(--success-foreground);
|
|
239
|
+
--color-warning: var(--warning);
|
|
240
|
+
--color-warning-foreground: var(--warning-foreground);
|
|
105
241
|
--color-border: var(--border);
|
|
106
242
|
--color-input: var(--input);
|
|
107
243
|
--color-ring: var(--ring);
|
|
@@ -133,7 +269,14 @@
|
|
|
133
269
|
}
|
|
134
270
|
|
|
135
271
|
button:not(:disabled),
|
|
136
|
-
[role=
|
|
272
|
+
[role="button"]:not(:disabled) {
|
|
137
273
|
cursor: pointer;
|
|
138
274
|
}
|
|
139
275
|
}
|
|
276
|
+
|
|
277
|
+
/* Set on <html> while the theme flips (see ThemeToggle) so colours swap in one
|
|
278
|
+
frame instead of every element transitioning at its own speed. */
|
|
279
|
+
.theme-switching * {
|
|
280
|
+
/* biome-ignore lint/complexity/noImportantStyles: must beat every component's own transition */
|
|
281
|
+
transition: none !important;
|
|
282
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { test } from 'node:test';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const css = readFileSync(
|
|
7
|
+
fileURLToPath(new URL('../src/globals.css', import.meta.url)),
|
|
8
|
+
'utf8'
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
const ROLES = [
|
|
12
|
+
'primary',
|
|
13
|
+
'secondary',
|
|
14
|
+
'tertiary',
|
|
15
|
+
'accent',
|
|
16
|
+
'destructive',
|
|
17
|
+
'success',
|
|
18
|
+
'warning',
|
|
19
|
+
'neutral',
|
|
20
|
+
];
|
|
21
|
+
const STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
22
|
+
|
|
23
|
+
test('every scale defines all 11 steps', () => {
|
|
24
|
+
for (const role of ROLES) {
|
|
25
|
+
for (const step of STEPS) {
|
|
26
|
+
assert.match(
|
|
27
|
+
css,
|
|
28
|
+
new RegExp(`--color-${role}-${step}:\\s*oklch\\(`),
|
|
29
|
+
`missing --color-${role}-${step}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('each scale lightness is strictly decreasing 50 -> 950', () => {
|
|
36
|
+
for (const role of ROLES) {
|
|
37
|
+
const ls = STEPS.map(step => {
|
|
38
|
+
const m = css.match(
|
|
39
|
+
new RegExp(`--color-${role}-${step}:\\s*oklch\\(([0-9.]+)`)
|
|
40
|
+
);
|
|
41
|
+
assert.ok(m, `no oklch lightness for --color-${role}-${step}`);
|
|
42
|
+
return Number(m[1]);
|
|
43
|
+
});
|
|
44
|
+
for (let i = 1; i < ls.length; i++) {
|
|
45
|
+
assert.ok(
|
|
46
|
+
ls[i] < ls[i - 1],
|
|
47
|
+
`${role}: L[${STEPS[i]}]=${ls[i]} not < L[${STEPS[i - 1]}]=${ls[i - 1]}`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('all semantic roles and their foregrounds are defined', () => {
|
|
54
|
+
const SEMANTIC = [
|
|
55
|
+
'primary',
|
|
56
|
+
'secondary',
|
|
57
|
+
'tertiary',
|
|
58
|
+
'accent',
|
|
59
|
+
'destructive',
|
|
60
|
+
'success',
|
|
61
|
+
'warning',
|
|
62
|
+
];
|
|
63
|
+
for (const role of SEMANTIC) {
|
|
64
|
+
assert.match(
|
|
65
|
+
css,
|
|
66
|
+
new RegExp(`(?<!-)--${role}:\\s*var\\(`),
|
|
67
|
+
`missing --${role}`
|
|
68
|
+
);
|
|
69
|
+
assert.match(
|
|
70
|
+
css,
|
|
71
|
+
new RegExp(`--${role}-foreground:\\s*var\\(`),
|
|
72
|
+
`missing --${role}-foreground`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
for (const t of [
|
|
76
|
+
'background',
|
|
77
|
+
'foreground',
|
|
78
|
+
'muted',
|
|
79
|
+
'border',
|
|
80
|
+
'input',
|
|
81
|
+
'ring',
|
|
82
|
+
]) {
|
|
83
|
+
assert.match(css, new RegExp(`--${t}:\\s*var\\(`), `missing --${t}`);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('new roles are exposed as Tailwind utilities via @theme inline', () => {
|
|
88
|
+
for (const role of ['tertiary', 'success', 'warning']) {
|
|
89
|
+
assert.match(
|
|
90
|
+
css,
|
|
91
|
+
new RegExp(`--color-${role}:\\s*var\\(--${role}\\)`),
|
|
92
|
+
`missing @theme inline mapping for --color-${role}`
|
|
93
|
+
);
|
|
94
|
+
assert.match(
|
|
95
|
+
css,
|
|
96
|
+
new RegExp(
|
|
97
|
+
`--color-${role}-foreground:\\s*var\\(--${role}-foreground\\)`
|
|
98
|
+
),
|
|
99
|
+
`missing @theme inline mapping for --color-${role}-foreground`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
});
|