@classic-homes/theme-tailwind-preset 0.9.0 → 0.10.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/index.js +17 -446
- package/package.json +3 -2
- package/theme.js +468 -0
package/index.js
CHANGED
|
@@ -18,108 +18,33 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* `addBase` output lands inside Tailwind's base output *after* preflight, so
|
|
35
|
-
* it wins on source order. Sizes and weights come from the `fontSize.h1..h6`
|
|
36
|
-
* scale below, so the utilities (`text-h1`) and the bare elements agree.
|
|
37
|
-
* Color and margins are left to base.css/preflight on purpose: this only
|
|
38
|
-
* restores what preflight resets.
|
|
39
|
-
*/
|
|
40
|
-
// Heading sizes for the typography scale (mirrors theme-styles base.css).
|
|
41
|
-
// h1 pairs with `font-serif italic` (Spectral 500); h2-h6 are Figtree 600.
|
|
42
|
-
// Exposed as `text-h1`..`text-h6` and emitted on the bare elements by
|
|
43
|
-
// `headingBase` below, so the two never drift.
|
|
44
|
-
const headingScale = {
|
|
45
|
-
// 2.75rem leading: a 2rem line on 40px type made wrapped titles overlap
|
|
46
|
-
h1: ['2.5rem', { lineHeight: '2.75rem', fontWeight: '500' }], // 40px
|
|
47
|
-
h2: ['1.75rem', { lineHeight: '2.25rem', fontWeight: '600' }], // 28px
|
|
48
|
-
h3: ['1.5rem', { lineHeight: '2rem', fontWeight: '600' }], // 24px
|
|
49
|
-
h4: ['1.25rem', { lineHeight: '1.75rem', fontWeight: '600' }], // 20px
|
|
50
|
-
h5: ['1.125rem', { lineHeight: '1.5rem', fontWeight: '600' }], // 18px
|
|
51
|
-
h6: ['1rem', { lineHeight: '1.5rem', fontWeight: '600' }], // 16px
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
function headingBase({ addBase, theme }) {
|
|
55
|
-
// Not theme('fontSize.h1'): Tailwind 3 resolves that to the size string alone
|
|
56
|
-
const heading = (level) => {
|
|
57
|
-
const [fontSize, { lineHeight, fontWeight }] = headingScale[level];
|
|
58
|
-
return { fontSize, lineHeight, fontWeight };
|
|
59
|
-
};
|
|
60
|
-
// theme() hands fontFamily back as a joined string in Tailwind 3, an array in 4
|
|
61
|
-
const stack = (key) => [].concat(theme(key)).join(', ');
|
|
62
|
-
const serif = stack('fontFamily.serif');
|
|
63
|
-
const sans = stack('fontFamily.sans');
|
|
64
|
-
addBase({
|
|
65
|
-
h1: {
|
|
66
|
-
fontFamily: `var(--font-serif, ${serif})`,
|
|
67
|
-
fontStyle: 'italic',
|
|
68
|
-
...heading('h1'),
|
|
69
|
-
},
|
|
70
|
-
h2: { fontFamily: `var(--font-sans, ${sans})`, ...heading('h2') },
|
|
71
|
-
h3: { fontFamily: `var(--font-sans, ${sans})`, ...heading('h3') },
|
|
72
|
-
h4: { fontFamily: `var(--font-sans, ${sans})`, ...heading('h4') },
|
|
73
|
-
h5: { fontFamily: `var(--font-sans, ${sans})`, ...heading('h5') },
|
|
74
|
-
h6: { fontFamily: `var(--font-sans, ${sans})`, ...heading('h6') },
|
|
75
|
-
});
|
|
21
|
+
const {
|
|
22
|
+
darkMode,
|
|
23
|
+
headingStyles,
|
|
24
|
+
responsiveBaseStyles,
|
|
25
|
+
tapTargetUtilities,
|
|
26
|
+
theme,
|
|
27
|
+
} = require('./theme.js');
|
|
28
|
+
|
|
29
|
+
// The theme and the styles below are plain data in ./theme.js, shared with
|
|
30
|
+
// the Tailwind 4 stylesheet in @classic-homes/theme-styles. Edit them there.
|
|
31
|
+
|
|
32
|
+
function headingBase({ addBase }) {
|
|
33
|
+
addBase(headingStyles);
|
|
76
34
|
}
|
|
77
35
|
|
|
78
|
-
/**
|
|
79
|
-
* `tap-target`: grows an element's hit area to at least 44×44px on coarse pointers
|
|
80
|
-
* (touch) with a centred, invisible ::after — layout and visuals don't change.
|
|
81
|
-
* For small icon buttons, chip removers, inline text buttons and sort headers.
|
|
82
|
-
*
|
|
83
|
-
* - Sets `position: relative` unless the element is already `absolute`/`fixed`/`sticky`.
|
|
84
|
-
* - Uses `::after`: don't combine with other `after:` utilities on the same element.
|
|
85
|
-
* - Neighbouring targets closer than 44px will overlap; the later one in the DOM wins.
|
|
86
|
-
*/
|
|
87
|
-
/**
|
|
88
|
-
* Base resets preflight leaves out that break narrow layouts and touch:
|
|
89
|
-
* - fieldset defaults to `min-inline-size: min-content`, so a fieldset holding a wide row
|
|
90
|
-
* (columns editor, radio grid) refuses to shrink and pushes the page sideways on phones.
|
|
91
|
-
* - <summary> toggles get vertical padding on coarse pointers.
|
|
92
|
-
*/
|
|
93
36
|
function responsiveBase({ addBase }) {
|
|
94
|
-
addBase(
|
|
95
|
-
fieldset: { minWidth: '0' },
|
|
96
|
-
// <details> toggles are usually one text line (16–20px); on touch give them a
|
|
97
|
-
// 36px+ row. Padding utilities on the summary still win (utilities layer).
|
|
98
|
-
'@media (pointer: coarse)': { summary: { paddingTop: '0.5rem', paddingBottom: '0.5rem' } },
|
|
99
|
-
});
|
|
37
|
+
addBase(responsiveBaseStyles);
|
|
100
38
|
}
|
|
101
39
|
|
|
102
40
|
function tapTarget({ addUtilities }) {
|
|
103
|
-
addUtilities(
|
|
104
|
-
'.tap-target:not(.absolute):not(.fixed):not(.sticky)': { position: 'relative' },
|
|
105
|
-
'@media (pointer: coarse)': {
|
|
106
|
-
'.tap-target::after': {
|
|
107
|
-
content: "''",
|
|
108
|
-
position: 'absolute',
|
|
109
|
-
top: '50%',
|
|
110
|
-
left: '50%',
|
|
111
|
-
width: 'max(100%, 44px)',
|
|
112
|
-
height: 'max(100%, 44px)',
|
|
113
|
-
transform: 'translate(-50%, -50%)',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
});
|
|
41
|
+
addUtilities(tapTargetUtilities);
|
|
117
42
|
}
|
|
118
43
|
|
|
119
44
|
/** @type {import('tailwindcss').Config} */
|
|
120
45
|
module.exports = {
|
|
121
46
|
// Enable dark mode via class on <html> element
|
|
122
|
-
darkMode
|
|
47
|
+
darkMode,
|
|
123
48
|
|
|
124
49
|
future: {
|
|
125
50
|
// Gate hover:/group-hover: styles behind @media (hover: hover) and (pointer: fine)
|
|
@@ -127,360 +52,6 @@ module.exports = {
|
|
|
127
52
|
hoverOnlyWhenSupported: true,
|
|
128
53
|
},
|
|
129
54
|
|
|
130
|
-
theme
|
|
131
|
-
// Container with brand max-widths
|
|
132
|
-
container: {
|
|
133
|
-
center: true,
|
|
134
|
-
padding: {
|
|
135
|
-
DEFAULT: '1rem',
|
|
136
|
-
sm: '2rem',
|
|
137
|
-
lg: '4rem',
|
|
138
|
-
xl: '5rem',
|
|
139
|
-
'2xl': '6rem',
|
|
140
|
-
},
|
|
141
|
-
screens: {
|
|
142
|
-
sm: '640px',
|
|
143
|
-
md: '768px',
|
|
144
|
-
lg: '1024px',
|
|
145
|
-
xl: '1280px',
|
|
146
|
-
'2xl': '1400px', // Intentionally narrower than the 2xl breakpoint (1536px) for better readability
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
extend: {
|
|
151
|
-
// Brand color palettes from tokens
|
|
152
|
-
// Each color includes shades (50-950) and a foreground color for text on colored backgrounds
|
|
153
|
-
colors: {
|
|
154
|
-
// Neutrals
|
|
155
|
-
gray: tokens.colors.gray,
|
|
156
|
-
|
|
157
|
-
// Core brand colors (foreground property included from tokens)
|
|
158
|
-
red: tokens.colors.red,
|
|
159
|
-
teal: tokens.colors.teal,
|
|
160
|
-
navy: tokens.colors.navy,
|
|
161
|
-
plum: tokens.colors.plum,
|
|
162
|
-
sage: tokens.colors.sage, // Note: sage does not include foreground (muted color)
|
|
163
|
-
|
|
164
|
-
// Collection colors (foreground property included from tokens)
|
|
165
|
-
stone: tokens.colors.stone,
|
|
166
|
-
forest: tokens.colors.forest,
|
|
167
|
-
lavender: tokens.colors.lavender,
|
|
168
|
-
sky: tokens.colors.sky,
|
|
169
|
-
deepTeal: tokens.colors.deepTeal,
|
|
170
|
-
charcoal: tokens.colors.charcoal,
|
|
171
|
-
|
|
172
|
-
// Semantic color utilities (using CSS variables for theming)
|
|
173
|
-
border: 'hsl(var(--border))',
|
|
174
|
-
input: 'hsl(var(--input))',
|
|
175
|
-
ring: 'hsl(var(--ring))',
|
|
176
|
-
outline: {
|
|
177
|
-
DEFAULT: 'hsl(var(--outline))',
|
|
178
|
-
hover: 'hsl(var(--outline-hover))',
|
|
179
|
-
},
|
|
180
|
-
toolbar: {
|
|
181
|
-
DEFAULT: 'hsl(var(--toolbar))',
|
|
182
|
-
foreground: 'hsl(var(--toolbar-foreground))',
|
|
183
|
-
muted: 'hsl(var(--toolbar-muted))',
|
|
184
|
-
border: 'hsl(var(--toolbar-border))',
|
|
185
|
-
},
|
|
186
|
-
background: {
|
|
187
|
-
DEFAULT: 'hsl(var(--background))',
|
|
188
|
-
hover: 'hsl(var(--background-hover))',
|
|
189
|
-
},
|
|
190
|
-
foreground: 'hsl(var(--foreground))',
|
|
191
|
-
|
|
192
|
-
primary: {
|
|
193
|
-
DEFAULT: 'hsl(var(--primary))',
|
|
194
|
-
foreground: 'hsl(var(--primary-foreground))',
|
|
195
|
-
hover: 'hsl(var(--primary-hover))',
|
|
196
|
-
},
|
|
197
|
-
secondary: {
|
|
198
|
-
DEFAULT: 'hsl(var(--secondary))',
|
|
199
|
-
foreground: 'hsl(var(--secondary-foreground))',
|
|
200
|
-
hover: 'hsl(var(--secondary-hover))',
|
|
201
|
-
border: 'hsl(var(--secondary-border))',
|
|
202
|
-
soft: 'hsl(var(--secondary-soft))',
|
|
203
|
-
},
|
|
204
|
-
destructive: {
|
|
205
|
-
DEFAULT: 'hsl(var(--destructive))',
|
|
206
|
-
foreground: 'hsl(var(--destructive-foreground))',
|
|
207
|
-
hover: 'hsl(var(--destructive-hover))',
|
|
208
|
-
},
|
|
209
|
-
muted: {
|
|
210
|
-
DEFAULT: 'hsl(var(--muted))',
|
|
211
|
-
foreground: 'hsl(var(--muted-foreground))',
|
|
212
|
-
hover: 'hsl(var(--muted-hover))',
|
|
213
|
-
},
|
|
214
|
-
accent: {
|
|
215
|
-
DEFAULT: 'hsl(var(--accent))',
|
|
216
|
-
foreground: 'hsl(var(--accent-foreground))',
|
|
217
|
-
hover: 'hsl(var(--accent-hover))',
|
|
218
|
-
},
|
|
219
|
-
popover: {
|
|
220
|
-
DEFAULT: 'hsl(var(--popover))',
|
|
221
|
-
foreground: 'hsl(var(--popover-foreground))',
|
|
222
|
-
},
|
|
223
|
-
card: {
|
|
224
|
-
DEFAULT: 'hsl(var(--card))',
|
|
225
|
-
foreground: 'hsl(var(--card-foreground))',
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
// Status colors (for alerts, notifications, feedback)
|
|
229
|
-
success: {
|
|
230
|
-
DEFAULT: 'hsl(var(--success))',
|
|
231
|
-
foreground: 'hsl(var(--success-foreground))',
|
|
232
|
-
},
|
|
233
|
-
warning: {
|
|
234
|
-
DEFAULT: 'hsl(var(--warning))',
|
|
235
|
-
foreground: 'hsl(var(--warning-foreground))',
|
|
236
|
-
},
|
|
237
|
-
info: {
|
|
238
|
-
DEFAULT: 'hsl(var(--info))',
|
|
239
|
-
foreground: 'hsl(var(--info-foreground))',
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
// Layout colors
|
|
243
|
-
'content-bg': 'hsl(var(--content-bg))',
|
|
244
|
-
'surface-border': 'hsl(var(--surface-border))',
|
|
245
|
-
|
|
246
|
-
// Sidebar colors
|
|
247
|
-
sidebar: {
|
|
248
|
-
DEFAULT: 'hsl(var(--sidebar-background))',
|
|
249
|
-
foreground: 'hsl(var(--sidebar-foreground))',
|
|
250
|
-
primary: 'hsl(var(--sidebar-primary))',
|
|
251
|
-
'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
|
|
252
|
-
accent: 'hsl(var(--sidebar-accent))',
|
|
253
|
-
'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
|
|
254
|
-
'accent-hover': 'hsl(var(--sidebar-accent-hover))',
|
|
255
|
-
border: 'hsl(var(--sidebar-border))',
|
|
256
|
-
ring: 'hsl(var(--sidebar-ring))',
|
|
257
|
-
},
|
|
258
|
-
|
|
259
|
-
// Chart colors
|
|
260
|
-
chart: {
|
|
261
|
-
1: 'hsl(var(--chart-1))',
|
|
262
|
-
2: 'hsl(var(--chart-2))',
|
|
263
|
-
3: 'hsl(var(--chart-3))',
|
|
264
|
-
4: 'hsl(var(--chart-4))',
|
|
265
|
-
5: 'hsl(var(--chart-5))',
|
|
266
|
-
},
|
|
267
|
-
|
|
268
|
-
// Brand colors (direct hex for exact matching)
|
|
269
|
-
brand: {
|
|
270
|
-
'red-logo': 'var(--color-red-logo)',
|
|
271
|
-
'red-primary': 'var(--color-red-primary)',
|
|
272
|
-
'grey-1': 'var(--color-grey-1)',
|
|
273
|
-
'grey-2': 'var(--color-grey-2)',
|
|
274
|
-
'core-1': 'var(--color-core-1)',
|
|
275
|
-
'core-2': 'var(--color-core-2)',
|
|
276
|
-
'core-3': 'var(--color-core-3)',
|
|
277
|
-
'core-4': 'var(--color-core-4)',
|
|
278
|
-
'core-4-tint': 'var(--color-core-4-tint)',
|
|
279
|
-
'collection-1': 'var(--color-collection-1)',
|
|
280
|
-
'collection-2': 'var(--color-collection-2)',
|
|
281
|
-
'collection-3': 'var(--color-collection-3)',
|
|
282
|
-
'collection-4': 'var(--color-collection-4)',
|
|
283
|
-
'collection-5': 'var(--color-collection-5)',
|
|
284
|
-
'collection-6': 'var(--color-collection-6)',
|
|
285
|
-
},
|
|
286
|
-
},
|
|
287
|
-
|
|
288
|
-
spacing: tokens.spacing,
|
|
289
|
-
|
|
290
|
-
fontFamily: tokens.fontFamily,
|
|
291
|
-
|
|
292
|
-
fontSize: {
|
|
293
|
-
...tokens.fontSize,
|
|
294
|
-
...headingScale,
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
fontWeight: tokens.fontWeight,
|
|
298
|
-
|
|
299
|
-
// Border radius uses token values directly for consistency
|
|
300
|
-
// The --radius CSS variable (0.5rem) is available for components that need dynamic theming
|
|
301
|
-
borderRadius: tokens.borderRadius,
|
|
302
|
-
|
|
303
|
-
boxShadow: tokens.boxShadow,
|
|
304
|
-
|
|
305
|
-
zIndex: tokens.zIndex,
|
|
306
|
-
|
|
307
|
-
aspectRatio: tokens.aspectRatio,
|
|
308
|
-
|
|
309
|
-
screens: tokens.breakpoints,
|
|
310
|
-
|
|
311
|
-
transitionDuration: tokens.transition.duration,
|
|
312
|
-
|
|
313
|
-
transitionTimingFunction: tokens.transition.timing,
|
|
314
|
-
|
|
315
|
-
keyframes: {
|
|
316
|
-
// Accordion animations (Radix/Bits UI)
|
|
317
|
-
'accordion-down': {
|
|
318
|
-
from: { height: '0' },
|
|
319
|
-
to: { height: 'var(--radix-accordion-content-height)' },
|
|
320
|
-
},
|
|
321
|
-
'accordion-up': {
|
|
322
|
-
from: { height: 'var(--radix-accordion-content-height)' },
|
|
323
|
-
to: { height: '0' },
|
|
324
|
-
},
|
|
325
|
-
// Collapsible animations
|
|
326
|
-
'collapsible-down': {
|
|
327
|
-
from: { height: '0' },
|
|
328
|
-
to: { height: 'var(--bits-collapsible-content-height)' },
|
|
329
|
-
},
|
|
330
|
-
'collapsible-up': {
|
|
331
|
-
from: { height: 'var(--bits-collapsible-content-height)' },
|
|
332
|
-
to: { height: '0' },
|
|
333
|
-
},
|
|
334
|
-
// Fade animations
|
|
335
|
-
'fade-in': {
|
|
336
|
-
from: { opacity: '0' },
|
|
337
|
-
to: { opacity: '1' },
|
|
338
|
-
},
|
|
339
|
-
'fade-out': {
|
|
340
|
-
from: { opacity: '1' },
|
|
341
|
-
to: { opacity: '0' },
|
|
342
|
-
},
|
|
343
|
-
// Slide animations
|
|
344
|
-
'slide-up': {
|
|
345
|
-
from: { opacity: '0', transform: 'translateY(10px)' },
|
|
346
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
347
|
-
},
|
|
348
|
-
'slide-down': {
|
|
349
|
-
from: { opacity: '0', transform: 'translateY(-10px)' },
|
|
350
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
351
|
-
},
|
|
352
|
-
'slide-left': {
|
|
353
|
-
from: { opacity: '0', transform: 'translateX(10px)' },
|
|
354
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
355
|
-
},
|
|
356
|
-
'slide-right': {
|
|
357
|
-
from: { opacity: '0', transform: 'translateX(-10px)' },
|
|
358
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
359
|
-
},
|
|
360
|
-
// Scale animations
|
|
361
|
-
'scale-in': {
|
|
362
|
-
from: { opacity: '0', transform: 'scale(0.95)' },
|
|
363
|
-
to: { opacity: '1', transform: 'scale(1)' },
|
|
364
|
-
},
|
|
365
|
-
'scale-out': {
|
|
366
|
-
from: { opacity: '1', transform: 'scale(1)' },
|
|
367
|
-
to: { opacity: '0', transform: 'scale(0.95)' },
|
|
368
|
-
},
|
|
369
|
-
// Spinner
|
|
370
|
-
'spin-slow': {
|
|
371
|
-
from: { transform: 'rotate(0deg)' },
|
|
372
|
-
to: { transform: 'rotate(360deg)' },
|
|
373
|
-
},
|
|
374
|
-
// Pulse
|
|
375
|
-
'pulse-subtle': {
|
|
376
|
-
'0%, 100%': { opacity: '1' },
|
|
377
|
-
'50%': { opacity: '0.7' },
|
|
378
|
-
},
|
|
379
|
-
// Progress bar indeterminate
|
|
380
|
-
'progress-indeterminate': {
|
|
381
|
-
'0%': { transform: 'translateX(-100%)' },
|
|
382
|
-
'100%': { transform: 'translateX(400%)' },
|
|
383
|
-
},
|
|
384
|
-
// Skeleton shimmer
|
|
385
|
-
shimmer: {
|
|
386
|
-
'0%': { backgroundPosition: '-200% 0' },
|
|
387
|
-
'100%': { backgroundPosition: '200% 0' },
|
|
388
|
-
},
|
|
389
|
-
// Logo trace animation
|
|
390
|
-
trace: {
|
|
391
|
-
to: { 'stroke-dashoffset': '-14' },
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
// DataPanel slide animations (from edges)
|
|
395
|
-
'panel-slide-in-left': {
|
|
396
|
-
from: { opacity: '0', transform: 'translateX(-100%)' },
|
|
397
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
398
|
-
},
|
|
399
|
-
'panel-slide-out-left': {
|
|
400
|
-
from: { opacity: '1', transform: 'translateX(0)' },
|
|
401
|
-
to: { opacity: '0', transform: 'translateX(-100%)' },
|
|
402
|
-
},
|
|
403
|
-
'panel-slide-in-right': {
|
|
404
|
-
from: { opacity: '0', transform: 'translateX(100%)' },
|
|
405
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
406
|
-
},
|
|
407
|
-
'panel-slide-out-right': {
|
|
408
|
-
from: { opacity: '1', transform: 'translateX(0)' },
|
|
409
|
-
to: { opacity: '0', transform: 'translateX(100%)' },
|
|
410
|
-
},
|
|
411
|
-
'panel-slide-in-top': {
|
|
412
|
-
from: { opacity: '0', transform: 'translateY(-100%)' },
|
|
413
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
414
|
-
},
|
|
415
|
-
'panel-slide-out-top': {
|
|
416
|
-
from: { opacity: '1', transform: 'translateY(0)' },
|
|
417
|
-
to: { opacity: '0', transform: 'translateY(-100%)' },
|
|
418
|
-
},
|
|
419
|
-
'panel-slide-in-bottom': {
|
|
420
|
-
from: { opacity: '0', transform: 'translateY(100%)' },
|
|
421
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
422
|
-
},
|
|
423
|
-
'panel-slide-out-bottom': {
|
|
424
|
-
from: { opacity: '1', transform: 'translateY(0)' },
|
|
425
|
-
to: { opacity: '0', transform: 'translateY(100%)' },
|
|
426
|
-
},
|
|
427
|
-
// DataPanel detach/attach animations
|
|
428
|
-
'panel-detach': {
|
|
429
|
-
from: { opacity: '0', transform: 'scale(0.95)' },
|
|
430
|
-
to: { opacity: '1', transform: 'scale(1)' },
|
|
431
|
-
},
|
|
432
|
-
'panel-attach': {
|
|
433
|
-
from: { opacity: '1', transform: 'scale(1)' },
|
|
434
|
-
to: { opacity: '0', transform: 'scale(0.95)' },
|
|
435
|
-
},
|
|
436
|
-
// DataPanel collapse/expand (for content area)
|
|
437
|
-
'panel-collapse': {
|
|
438
|
-
from: { height: 'var(--panel-content-height)', opacity: '1' },
|
|
439
|
-
to: { height: '0', opacity: '0' },
|
|
440
|
-
},
|
|
441
|
-
'panel-expand': {
|
|
442
|
-
from: { height: '0', opacity: '0' },
|
|
443
|
-
to: { height: 'var(--panel-content-height)', opacity: '1' },
|
|
444
|
-
},
|
|
445
|
-
},
|
|
446
|
-
|
|
447
|
-
animation: {
|
|
448
|
-
// Use token durations for single source of truth
|
|
449
|
-
'accordion-down': `accordion-down ${tokens.animation.duration.base} ease-out`,
|
|
450
|
-
'accordion-up': `accordion-up ${tokens.animation.duration.base} ease-out`,
|
|
451
|
-
'collapsible-down': `collapsible-down ${tokens.animation.duration.base} ease-out`,
|
|
452
|
-
'collapsible-up': `collapsible-up ${tokens.animation.duration.base} ease-out`,
|
|
453
|
-
'fade-in': `fade-in ${tokens.animation.duration.base} ease-out`,
|
|
454
|
-
'fade-out': `fade-out ${tokens.animation.duration.base} ease-out`,
|
|
455
|
-
'slide-up': `slide-up ${tokens.animation.duration.base} ease-out`,
|
|
456
|
-
'slide-down': `slide-down ${tokens.animation.duration.base} ease-out`,
|
|
457
|
-
'slide-left': `slide-left ${tokens.animation.duration.base} ease-out`,
|
|
458
|
-
'slide-right': `slide-right ${tokens.animation.duration.base} ease-out`,
|
|
459
|
-
'scale-in': `scale-in ${tokens.animation.duration.base} ease-out`,
|
|
460
|
-
'scale-out': `scale-out ${tokens.animation.duration.base} ease-out`,
|
|
461
|
-
// Looping animations take literal durations: the 500ms `slower` token made
|
|
462
|
-
// spin-slow twice as fast as Tailwind's 1s `spin` and the shimmer 4x too fast.
|
|
463
|
-
'spin-slow': 'spin-slow 2s linear infinite',
|
|
464
|
-
'pulse-subtle': `pulse-subtle ${tokens.transition.duration.slower} cubic-bezier(0.4, 0, 0.6, 1) infinite`,
|
|
465
|
-
'progress-indeterminate': 'progress-indeterminate 1.5s ease-in-out infinite',
|
|
466
|
-
shimmer: 'shimmer 2s linear infinite',
|
|
467
|
-
trace: `trace ${tokens.transition.duration.slower} linear infinite`,
|
|
468
|
-
|
|
469
|
-
// DataPanel animations
|
|
470
|
-
'panel-slide-in-left': `panel-slide-in-left ${tokens.animation.duration.base} ease-out`,
|
|
471
|
-
'panel-slide-out-left': `panel-slide-out-left ${tokens.animation.duration.base} ease-out`,
|
|
472
|
-
'panel-slide-in-right': `panel-slide-in-right ${tokens.animation.duration.base} ease-out`,
|
|
473
|
-
'panel-slide-out-right': `panel-slide-out-right ${tokens.animation.duration.base} ease-out`,
|
|
474
|
-
'panel-slide-in-top': `panel-slide-in-top ${tokens.animation.duration.base} ease-out`,
|
|
475
|
-
'panel-slide-out-top': `panel-slide-out-top ${tokens.animation.duration.base} ease-out`,
|
|
476
|
-
'panel-slide-in-bottom': `panel-slide-in-bottom ${tokens.animation.duration.base} ease-out`,
|
|
477
|
-
'panel-slide-out-bottom': `panel-slide-out-bottom ${tokens.animation.duration.base} ease-out`,
|
|
478
|
-
'panel-detach': `panel-detach ${tokens.animation.duration.base} ease-out`,
|
|
479
|
-
'panel-attach': `panel-attach ${tokens.animation.duration.base} ease-out`,
|
|
480
|
-
'panel-collapse': `panel-collapse ${tokens.animation.duration.base} ease-out`,
|
|
481
|
-
'panel-expand': `panel-expand ${tokens.animation.duration.base} ease-out`,
|
|
482
|
-
},
|
|
483
|
-
},
|
|
484
|
-
},
|
|
55
|
+
theme,
|
|
485
56
|
plugins: [headingBase, responsiveBase, tapTarget],
|
|
486
57
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classic-homes/theme-tailwind-preset",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Tailwind CSS preset for the Classic theme system",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"files": [
|
|
8
|
-
"index.js"
|
|
8
|
+
"index.js",
|
|
9
|
+
"theme.js"
|
|
9
10
|
],
|
|
10
11
|
"scripts": {
|
|
11
12
|
"build": "echo 'No build needed for tailwind-preset'",
|
package/theme.js
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The preset as plain data: theme, dark-mode strategy, base styles and
|
|
3
|
+
* utilities, with no Tailwind plugin API.
|
|
4
|
+
*
|
|
5
|
+
* Read by the Tailwind 3 preset (`index.js`) and by the generator of the
|
|
6
|
+
* Tailwind 4 stylesheet in `@classic-homes/theme-styles`
|
|
7
|
+
* (`packages/styles/scripts/build-tailwind-v4.mjs`), so the two cannot drift.
|
|
8
|
+
* Change the theme here, never in either output.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const tokens = require('@classic-homes/theme-tokens');
|
|
12
|
+
|
|
13
|
+
/** Dark mode: a `.dark` class on an ancestor (usually <html>). */
|
|
14
|
+
const darkMode = ['class'];
|
|
15
|
+
|
|
16
|
+
// Heading sizes for the typography scale (mirrors theme-styles base.css).
|
|
17
|
+
// h1 pairs with `font-serif italic` (Spectral 500); h2-h6 are Figtree 600.
|
|
18
|
+
// Exposed as `text-h1`..`text-h6` and emitted on the bare elements by
|
|
19
|
+
// `headingBase` below, so the two never drift.
|
|
20
|
+
const headingScale = {
|
|
21
|
+
// 2.75rem leading: a 2rem line on 40px type made wrapped titles overlap
|
|
22
|
+
h1: ['2.5rem', { lineHeight: '2.75rem', fontWeight: '500' }], // 40px
|
|
23
|
+
h2: ['1.75rem', { lineHeight: '2.25rem', fontWeight: '600' }], // 28px
|
|
24
|
+
h3: ['1.5rem', { lineHeight: '2rem', fontWeight: '600' }], // 24px
|
|
25
|
+
h4: ['1.25rem', { lineHeight: '1.75rem', fontWeight: '600' }], // 20px
|
|
26
|
+
h5: ['1.125rem', { lineHeight: '1.5rem', fontWeight: '600' }], // 18px
|
|
27
|
+
h6: ['1rem', { lineHeight: '1.5rem', fontWeight: '600' }], // 16px
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Base heading typography, emitted through `addBase`.
|
|
32
|
+
*
|
|
33
|
+
* theme-styles/base.css sets the same scale inside `@layer classic-theme.base`,
|
|
34
|
+
* but any consumer that runs `@tailwind base` also gets Tailwind preflight's
|
|
35
|
+
* `h1..h6 { font-size: inherit; font-weight: inherit }`. Preflight is
|
|
36
|
+
* unlayered, so it outranks the theme's layered rule by cascade semantics -
|
|
37
|
+
* and @csstools/postcss-cascade-layers (postcss-config) keeps that ordering
|
|
38
|
+
* with specificity boosts. Bare headings therefore rendered at body size with
|
|
39
|
+
* the inherited weight in every Tailwind app, including our own example apps.
|
|
40
|
+
*
|
|
41
|
+
* `addBase` output lands inside Tailwind's base output *after* preflight, so
|
|
42
|
+
* it wins on source order. Sizes and weights come from the `fontSize.h1..h6`
|
|
43
|
+
* scale below, so the utilities (`text-h1`) and the bare elements agree.
|
|
44
|
+
* Color and margins are left to base.css/preflight on purpose: this only
|
|
45
|
+
* restores what preflight resets.
|
|
46
|
+
*/
|
|
47
|
+
const stack = (fonts) => fonts.join(', ');
|
|
48
|
+
const headingStyles = Object.fromEntries(
|
|
49
|
+
Object.entries(headingScale).map(([level, [fontSize, { lineHeight, fontWeight }]]) => [
|
|
50
|
+
level,
|
|
51
|
+
level === 'h1'
|
|
52
|
+
? {
|
|
53
|
+
fontFamily: `var(--font-serif, ${stack(tokens.fontFamily.serif)})`,
|
|
54
|
+
fontStyle: 'italic',
|
|
55
|
+
fontSize,
|
|
56
|
+
lineHeight,
|
|
57
|
+
fontWeight,
|
|
58
|
+
}
|
|
59
|
+
: {
|
|
60
|
+
fontFamily: `var(--font-sans, ${stack(tokens.fontFamily.sans)})`,
|
|
61
|
+
fontSize,
|
|
62
|
+
lineHeight,
|
|
63
|
+
fontWeight,
|
|
64
|
+
},
|
|
65
|
+
])
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Base resets preflight leaves out that break narrow layouts and touch:
|
|
70
|
+
* - fieldset defaults to `min-inline-size: min-content`, so a fieldset holding a wide row
|
|
71
|
+
* (columns editor, radio grid) refuses to shrink and pushes the page sideways on phones.
|
|
72
|
+
* - <summary> toggles get vertical padding on coarse pointers.
|
|
73
|
+
*/
|
|
74
|
+
const responsiveBaseStyles = {
|
|
75
|
+
fieldset: { minWidth: '0' },
|
|
76
|
+
// <details> toggles are usually one text line (16–20px); on touch give them a
|
|
77
|
+
// 36px+ row. Padding utilities on the summary still win (utilities layer).
|
|
78
|
+
'@media (pointer: coarse)': { summary: { paddingTop: '0.5rem', paddingBottom: '0.5rem' } },
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* `tap-target`: grows an element's hit area to at least 44×44px on coarse pointers
|
|
83
|
+
* (touch) with a centred, invisible ::after — layout and visuals don't change.
|
|
84
|
+
* For small icon buttons, chip removers, inline text buttons and sort headers.
|
|
85
|
+
*
|
|
86
|
+
* - Sets `position: relative` unless the element is already `absolute`/`fixed`/`sticky`.
|
|
87
|
+
* - Uses `::after`: don't combine with other `after:` utilities on the same element.
|
|
88
|
+
* - Neighbouring targets closer than 44px will overlap; the later one in the DOM wins.
|
|
89
|
+
*/
|
|
90
|
+
const tapTargetUtilities = {
|
|
91
|
+
'.tap-target:not(.absolute):not(.fixed):not(.sticky)': { position: 'relative' },
|
|
92
|
+
'@media (pointer: coarse)': {
|
|
93
|
+
'.tap-target::after': {
|
|
94
|
+
content: "''",
|
|
95
|
+
position: 'absolute',
|
|
96
|
+
top: '50%',
|
|
97
|
+
left: '50%',
|
|
98
|
+
width: 'max(100%, 44px)',
|
|
99
|
+
height: 'max(100%, 44px)',
|
|
100
|
+
transform: 'translate(-50%, -50%)',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const theme = {
|
|
106
|
+
// Container with brand max-widths
|
|
107
|
+
container: {
|
|
108
|
+
center: true,
|
|
109
|
+
padding: {
|
|
110
|
+
DEFAULT: '1rem',
|
|
111
|
+
sm: '2rem',
|
|
112
|
+
lg: '4rem',
|
|
113
|
+
xl: '5rem',
|
|
114
|
+
'2xl': '6rem',
|
|
115
|
+
},
|
|
116
|
+
screens: {
|
|
117
|
+
sm: '640px',
|
|
118
|
+
md: '768px',
|
|
119
|
+
lg: '1024px',
|
|
120
|
+
xl: '1280px',
|
|
121
|
+
'2xl': '1400px', // Intentionally narrower than the 2xl breakpoint (1536px) for better readability
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
extend: {
|
|
126
|
+
// Brand color palettes from tokens
|
|
127
|
+
// Each color includes shades (50-950) and a foreground color for text on colored backgrounds
|
|
128
|
+
colors: {
|
|
129
|
+
// Neutrals
|
|
130
|
+
gray: tokens.colors.gray,
|
|
131
|
+
|
|
132
|
+
// Core brand colors (foreground property included from tokens)
|
|
133
|
+
red: tokens.colors.red,
|
|
134
|
+
teal: tokens.colors.teal,
|
|
135
|
+
navy: tokens.colors.navy,
|
|
136
|
+
plum: tokens.colors.plum,
|
|
137
|
+
sage: tokens.colors.sage, // Note: sage does not include foreground (muted color)
|
|
138
|
+
|
|
139
|
+
// Collection colors (foreground property included from tokens)
|
|
140
|
+
stone: tokens.colors.stone,
|
|
141
|
+
forest: tokens.colors.forest,
|
|
142
|
+
lavender: tokens.colors.lavender,
|
|
143
|
+
sky: tokens.colors.sky,
|
|
144
|
+
deepTeal: tokens.colors.deepTeal,
|
|
145
|
+
charcoal: tokens.colors.charcoal,
|
|
146
|
+
|
|
147
|
+
// Semantic color utilities (using CSS variables for theming)
|
|
148
|
+
border: 'hsl(var(--border))',
|
|
149
|
+
input: 'hsl(var(--input))',
|
|
150
|
+
ring: 'hsl(var(--ring))',
|
|
151
|
+
outline: {
|
|
152
|
+
DEFAULT: 'hsl(var(--outline))',
|
|
153
|
+
hover: 'hsl(var(--outline-hover))',
|
|
154
|
+
},
|
|
155
|
+
toolbar: {
|
|
156
|
+
DEFAULT: 'hsl(var(--toolbar))',
|
|
157
|
+
foreground: 'hsl(var(--toolbar-foreground))',
|
|
158
|
+
muted: 'hsl(var(--toolbar-muted))',
|
|
159
|
+
border: 'hsl(var(--toolbar-border))',
|
|
160
|
+
},
|
|
161
|
+
background: {
|
|
162
|
+
DEFAULT: 'hsl(var(--background))',
|
|
163
|
+
hover: 'hsl(var(--background-hover))',
|
|
164
|
+
},
|
|
165
|
+
foreground: 'hsl(var(--foreground))',
|
|
166
|
+
|
|
167
|
+
primary: {
|
|
168
|
+
DEFAULT: 'hsl(var(--primary))',
|
|
169
|
+
foreground: 'hsl(var(--primary-foreground))',
|
|
170
|
+
hover: 'hsl(var(--primary-hover))',
|
|
171
|
+
},
|
|
172
|
+
secondary: {
|
|
173
|
+
DEFAULT: 'hsl(var(--secondary))',
|
|
174
|
+
foreground: 'hsl(var(--secondary-foreground))',
|
|
175
|
+
hover: 'hsl(var(--secondary-hover))',
|
|
176
|
+
border: 'hsl(var(--secondary-border))',
|
|
177
|
+
soft: 'hsl(var(--secondary-soft))',
|
|
178
|
+
},
|
|
179
|
+
destructive: {
|
|
180
|
+
DEFAULT: 'hsl(var(--destructive))',
|
|
181
|
+
foreground: 'hsl(var(--destructive-foreground))',
|
|
182
|
+
hover: 'hsl(var(--destructive-hover))',
|
|
183
|
+
},
|
|
184
|
+
muted: {
|
|
185
|
+
DEFAULT: 'hsl(var(--muted))',
|
|
186
|
+
foreground: 'hsl(var(--muted-foreground))',
|
|
187
|
+
hover: 'hsl(var(--muted-hover))',
|
|
188
|
+
},
|
|
189
|
+
accent: {
|
|
190
|
+
DEFAULT: 'hsl(var(--accent))',
|
|
191
|
+
foreground: 'hsl(var(--accent-foreground))',
|
|
192
|
+
hover: 'hsl(var(--accent-hover))',
|
|
193
|
+
},
|
|
194
|
+
popover: {
|
|
195
|
+
DEFAULT: 'hsl(var(--popover))',
|
|
196
|
+
foreground: 'hsl(var(--popover-foreground))',
|
|
197
|
+
},
|
|
198
|
+
card: {
|
|
199
|
+
DEFAULT: 'hsl(var(--card))',
|
|
200
|
+
foreground: 'hsl(var(--card-foreground))',
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
// Status colors (for alerts, notifications, feedback)
|
|
204
|
+
success: {
|
|
205
|
+
DEFAULT: 'hsl(var(--success))',
|
|
206
|
+
foreground: 'hsl(var(--success-foreground))',
|
|
207
|
+
},
|
|
208
|
+
warning: {
|
|
209
|
+
DEFAULT: 'hsl(var(--warning))',
|
|
210
|
+
foreground: 'hsl(var(--warning-foreground))',
|
|
211
|
+
},
|
|
212
|
+
info: {
|
|
213
|
+
DEFAULT: 'hsl(var(--info))',
|
|
214
|
+
foreground: 'hsl(var(--info-foreground))',
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
// Layout colors
|
|
218
|
+
'content-bg': 'hsl(var(--content-bg))',
|
|
219
|
+
'surface-border': 'hsl(var(--surface-border))',
|
|
220
|
+
|
|
221
|
+
// Sidebar colors
|
|
222
|
+
sidebar: {
|
|
223
|
+
DEFAULT: 'hsl(var(--sidebar-background))',
|
|
224
|
+
foreground: 'hsl(var(--sidebar-foreground))',
|
|
225
|
+
primary: 'hsl(var(--sidebar-primary))',
|
|
226
|
+
'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
|
|
227
|
+
accent: 'hsl(var(--sidebar-accent))',
|
|
228
|
+
'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
|
|
229
|
+
'accent-hover': 'hsl(var(--sidebar-accent-hover))',
|
|
230
|
+
border: 'hsl(var(--sidebar-border))',
|
|
231
|
+
ring: 'hsl(var(--sidebar-ring))',
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
// Chart colors
|
|
235
|
+
chart: {
|
|
236
|
+
1: 'hsl(var(--chart-1))',
|
|
237
|
+
2: 'hsl(var(--chart-2))',
|
|
238
|
+
3: 'hsl(var(--chart-3))',
|
|
239
|
+
4: 'hsl(var(--chart-4))',
|
|
240
|
+
5: 'hsl(var(--chart-5))',
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// Brand colors (direct hex for exact matching)
|
|
244
|
+
brand: {
|
|
245
|
+
'red-logo': 'var(--color-red-logo)',
|
|
246
|
+
'red-primary': 'var(--color-red-primary)',
|
|
247
|
+
'grey-1': 'var(--color-grey-1)',
|
|
248
|
+
'grey-2': 'var(--color-grey-2)',
|
|
249
|
+
'core-1': 'var(--color-core-1)',
|
|
250
|
+
'core-2': 'var(--color-core-2)',
|
|
251
|
+
'core-3': 'var(--color-core-3)',
|
|
252
|
+
'core-4': 'var(--color-core-4)',
|
|
253
|
+
'core-4-tint': 'var(--color-core-4-tint)',
|
|
254
|
+
'collection-1': 'var(--color-collection-1)',
|
|
255
|
+
'collection-2': 'var(--color-collection-2)',
|
|
256
|
+
'collection-3': 'var(--color-collection-3)',
|
|
257
|
+
'collection-4': 'var(--color-collection-4)',
|
|
258
|
+
'collection-5': 'var(--color-collection-5)',
|
|
259
|
+
'collection-6': 'var(--color-collection-6)',
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
spacing: tokens.spacing,
|
|
264
|
+
|
|
265
|
+
fontFamily: tokens.fontFamily,
|
|
266
|
+
|
|
267
|
+
fontSize: {
|
|
268
|
+
...tokens.fontSize,
|
|
269
|
+
...headingScale,
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
fontWeight: tokens.fontWeight,
|
|
273
|
+
|
|
274
|
+
// Border radius uses token values directly for consistency
|
|
275
|
+
// The --radius CSS variable (0.5rem) is available for components that need dynamic theming
|
|
276
|
+
borderRadius: tokens.borderRadius,
|
|
277
|
+
|
|
278
|
+
boxShadow: tokens.boxShadow,
|
|
279
|
+
|
|
280
|
+
zIndex: tokens.zIndex,
|
|
281
|
+
|
|
282
|
+
aspectRatio: tokens.aspectRatio,
|
|
283
|
+
|
|
284
|
+
screens: tokens.breakpoints,
|
|
285
|
+
|
|
286
|
+
transitionDuration: tokens.transition.duration,
|
|
287
|
+
|
|
288
|
+
transitionTimingFunction: tokens.transition.timing,
|
|
289
|
+
|
|
290
|
+
keyframes: {
|
|
291
|
+
// Accordion animations (Radix/Bits UI)
|
|
292
|
+
'accordion-down': {
|
|
293
|
+
from: { height: '0' },
|
|
294
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
|
295
|
+
},
|
|
296
|
+
'accordion-up': {
|
|
297
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
298
|
+
to: { height: '0' },
|
|
299
|
+
},
|
|
300
|
+
// Collapsible animations
|
|
301
|
+
'collapsible-down': {
|
|
302
|
+
from: { height: '0' },
|
|
303
|
+
to: { height: 'var(--bits-collapsible-content-height)' },
|
|
304
|
+
},
|
|
305
|
+
'collapsible-up': {
|
|
306
|
+
from: { height: 'var(--bits-collapsible-content-height)' },
|
|
307
|
+
to: { height: '0' },
|
|
308
|
+
},
|
|
309
|
+
// Fade animations
|
|
310
|
+
'fade-in': {
|
|
311
|
+
from: { opacity: '0' },
|
|
312
|
+
to: { opacity: '1' },
|
|
313
|
+
},
|
|
314
|
+
'fade-out': {
|
|
315
|
+
from: { opacity: '1' },
|
|
316
|
+
to: { opacity: '0' },
|
|
317
|
+
},
|
|
318
|
+
// Slide animations
|
|
319
|
+
'slide-up': {
|
|
320
|
+
from: { opacity: '0', transform: 'translateY(10px)' },
|
|
321
|
+
to: { opacity: '1', transform: 'translateY(0)' },
|
|
322
|
+
},
|
|
323
|
+
'slide-down': {
|
|
324
|
+
from: { opacity: '0', transform: 'translateY(-10px)' },
|
|
325
|
+
to: { opacity: '1', transform: 'translateY(0)' },
|
|
326
|
+
},
|
|
327
|
+
'slide-left': {
|
|
328
|
+
from: { opacity: '0', transform: 'translateX(10px)' },
|
|
329
|
+
to: { opacity: '1', transform: 'translateX(0)' },
|
|
330
|
+
},
|
|
331
|
+
'slide-right': {
|
|
332
|
+
from: { opacity: '0', transform: 'translateX(-10px)' },
|
|
333
|
+
to: { opacity: '1', transform: 'translateX(0)' },
|
|
334
|
+
},
|
|
335
|
+
// Scale animations
|
|
336
|
+
'scale-in': {
|
|
337
|
+
from: { opacity: '0', transform: 'scale(0.95)' },
|
|
338
|
+
to: { opacity: '1', transform: 'scale(1)' },
|
|
339
|
+
},
|
|
340
|
+
'scale-out': {
|
|
341
|
+
from: { opacity: '1', transform: 'scale(1)' },
|
|
342
|
+
to: { opacity: '0', transform: 'scale(0.95)' },
|
|
343
|
+
},
|
|
344
|
+
// Spinner
|
|
345
|
+
'spin-slow': {
|
|
346
|
+
from: { transform: 'rotate(0deg)' },
|
|
347
|
+
to: { transform: 'rotate(360deg)' },
|
|
348
|
+
},
|
|
349
|
+
// Pulse
|
|
350
|
+
'pulse-subtle': {
|
|
351
|
+
'0%, 100%': { opacity: '1' },
|
|
352
|
+
'50%': { opacity: '0.7' },
|
|
353
|
+
},
|
|
354
|
+
// Progress bar indeterminate
|
|
355
|
+
'progress-indeterminate': {
|
|
356
|
+
'0%': { transform: 'translateX(-100%)' },
|
|
357
|
+
'100%': { transform: 'translateX(400%)' },
|
|
358
|
+
},
|
|
359
|
+
// Skeleton shimmer
|
|
360
|
+
shimmer: {
|
|
361
|
+
'0%': { backgroundPosition: '-200% 0' },
|
|
362
|
+
'100%': { backgroundPosition: '200% 0' },
|
|
363
|
+
},
|
|
364
|
+
// Logo trace animation
|
|
365
|
+
trace: {
|
|
366
|
+
to: { 'stroke-dashoffset': '-14' },
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
// DataPanel slide animations (from edges)
|
|
370
|
+
'panel-slide-in-left': {
|
|
371
|
+
from: { opacity: '0', transform: 'translateX(-100%)' },
|
|
372
|
+
to: { opacity: '1', transform: 'translateX(0)' },
|
|
373
|
+
},
|
|
374
|
+
'panel-slide-out-left': {
|
|
375
|
+
from: { opacity: '1', transform: 'translateX(0)' },
|
|
376
|
+
to: { opacity: '0', transform: 'translateX(-100%)' },
|
|
377
|
+
},
|
|
378
|
+
'panel-slide-in-right': {
|
|
379
|
+
from: { opacity: '0', transform: 'translateX(100%)' },
|
|
380
|
+
to: { opacity: '1', transform: 'translateX(0)' },
|
|
381
|
+
},
|
|
382
|
+
'panel-slide-out-right': {
|
|
383
|
+
from: { opacity: '1', transform: 'translateX(0)' },
|
|
384
|
+
to: { opacity: '0', transform: 'translateX(100%)' },
|
|
385
|
+
},
|
|
386
|
+
'panel-slide-in-top': {
|
|
387
|
+
from: { opacity: '0', transform: 'translateY(-100%)' },
|
|
388
|
+
to: { opacity: '1', transform: 'translateY(0)' },
|
|
389
|
+
},
|
|
390
|
+
'panel-slide-out-top': {
|
|
391
|
+
from: { opacity: '1', transform: 'translateY(0)' },
|
|
392
|
+
to: { opacity: '0', transform: 'translateY(-100%)' },
|
|
393
|
+
},
|
|
394
|
+
'panel-slide-in-bottom': {
|
|
395
|
+
from: { opacity: '0', transform: 'translateY(100%)' },
|
|
396
|
+
to: { opacity: '1', transform: 'translateY(0)' },
|
|
397
|
+
},
|
|
398
|
+
'panel-slide-out-bottom': {
|
|
399
|
+
from: { opacity: '1', transform: 'translateY(0)' },
|
|
400
|
+
to: { opacity: '0', transform: 'translateY(100%)' },
|
|
401
|
+
},
|
|
402
|
+
// DataPanel detach/attach animations
|
|
403
|
+
'panel-detach': {
|
|
404
|
+
from: { opacity: '0', transform: 'scale(0.95)' },
|
|
405
|
+
to: { opacity: '1', transform: 'scale(1)' },
|
|
406
|
+
},
|
|
407
|
+
'panel-attach': {
|
|
408
|
+
from: { opacity: '1', transform: 'scale(1)' },
|
|
409
|
+
to: { opacity: '0', transform: 'scale(0.95)' },
|
|
410
|
+
},
|
|
411
|
+
// DataPanel collapse/expand (for content area)
|
|
412
|
+
'panel-collapse': {
|
|
413
|
+
from: { height: 'var(--panel-content-height)', opacity: '1' },
|
|
414
|
+
to: { height: '0', opacity: '0' },
|
|
415
|
+
},
|
|
416
|
+
'panel-expand': {
|
|
417
|
+
from: { height: '0', opacity: '0' },
|
|
418
|
+
to: { height: 'var(--panel-content-height)', opacity: '1' },
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
|
|
422
|
+
animation: {
|
|
423
|
+
// Use token durations for single source of truth
|
|
424
|
+
'accordion-down': `accordion-down ${tokens.animation.duration.base} ease-out`,
|
|
425
|
+
'accordion-up': `accordion-up ${tokens.animation.duration.base} ease-out`,
|
|
426
|
+
'collapsible-down': `collapsible-down ${tokens.animation.duration.base} ease-out`,
|
|
427
|
+
'collapsible-up': `collapsible-up ${tokens.animation.duration.base} ease-out`,
|
|
428
|
+
'fade-in': `fade-in ${tokens.animation.duration.base} ease-out`,
|
|
429
|
+
'fade-out': `fade-out ${tokens.animation.duration.base} ease-out`,
|
|
430
|
+
'slide-up': `slide-up ${tokens.animation.duration.base} ease-out`,
|
|
431
|
+
'slide-down': `slide-down ${tokens.animation.duration.base} ease-out`,
|
|
432
|
+
'slide-left': `slide-left ${tokens.animation.duration.base} ease-out`,
|
|
433
|
+
'slide-right': `slide-right ${tokens.animation.duration.base} ease-out`,
|
|
434
|
+
'scale-in': `scale-in ${tokens.animation.duration.base} ease-out`,
|
|
435
|
+
'scale-out': `scale-out ${tokens.animation.duration.base} ease-out`,
|
|
436
|
+
// Looping animations take literal durations: the 500ms `slower` token made
|
|
437
|
+
// spin-slow twice as fast as Tailwind's 1s `spin` and the shimmer 4x too fast.
|
|
438
|
+
'spin-slow': 'spin-slow 2s linear infinite',
|
|
439
|
+
'pulse-subtle': `pulse-subtle ${tokens.transition.duration.slower} cubic-bezier(0.4, 0, 0.6, 1) infinite`,
|
|
440
|
+
'progress-indeterminate': 'progress-indeterminate 1.5s ease-in-out infinite',
|
|
441
|
+
shimmer: 'shimmer 2s linear infinite',
|
|
442
|
+
trace: `trace ${tokens.transition.duration.slower} linear infinite`,
|
|
443
|
+
|
|
444
|
+
// DataPanel animations
|
|
445
|
+
'panel-slide-in-left': `panel-slide-in-left ${tokens.animation.duration.base} ease-out`,
|
|
446
|
+
'panel-slide-out-left': `panel-slide-out-left ${tokens.animation.duration.base} ease-out`,
|
|
447
|
+
'panel-slide-in-right': `panel-slide-in-right ${tokens.animation.duration.base} ease-out`,
|
|
448
|
+
'panel-slide-out-right': `panel-slide-out-right ${tokens.animation.duration.base} ease-out`,
|
|
449
|
+
'panel-slide-in-top': `panel-slide-in-top ${tokens.animation.duration.base} ease-out`,
|
|
450
|
+
'panel-slide-out-top': `panel-slide-out-top ${tokens.animation.duration.base} ease-out`,
|
|
451
|
+
'panel-slide-in-bottom': `panel-slide-in-bottom ${tokens.animation.duration.base} ease-out`,
|
|
452
|
+
'panel-slide-out-bottom': `panel-slide-out-bottom ${tokens.animation.duration.base} ease-out`,
|
|
453
|
+
'panel-detach': `panel-detach ${tokens.animation.duration.base} ease-out`,
|
|
454
|
+
'panel-attach': `panel-attach ${tokens.animation.duration.base} ease-out`,
|
|
455
|
+
'panel-collapse': `panel-collapse ${tokens.animation.duration.base} ease-out`,
|
|
456
|
+
'panel-expand': `panel-expand ${tokens.animation.duration.base} ease-out`,
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
module.exports = {
|
|
462
|
+
darkMode,
|
|
463
|
+
headingScale,
|
|
464
|
+
headingStyles,
|
|
465
|
+
responsiveBaseStyles,
|
|
466
|
+
tapTargetUtilities,
|
|
467
|
+
theme,
|
|
468
|
+
};
|