@classic-homes/theme-tailwind-preset 0.7.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/README.md +6 -0
- package/index.js +22 -410
- package/package.json +3 -2
- package/theme.js +468 -0
package/README.md
CHANGED
|
@@ -32,3 +32,9 @@ Dark mode is enabled with a `dark` class on `<html>`.
|
|
|
32
32
|
## Exports
|
|
33
33
|
|
|
34
34
|
The package has one entry, `@classic-homes/theme-tailwind-preset`, which exports the preset object (CommonJS `module.exports`; `import` works through Node's CJS interop).
|
|
35
|
+
|
|
36
|
+
## Touch and narrow-screen helpers
|
|
37
|
+
|
|
38
|
+
- **`tap-target`**: grows an element's hit area to at least 44×44px on coarse pointers (touch) with a centred, invisible `::after`. Layout and visuals don't change. Use it on small icon buttons, chip removers and inline text buttons. It sets `position: relative` unless the element is `absolute`/`fixed`/`sticky`, and it uses `::after`, so don't combine it with other `after:` utilities.
|
|
39
|
+
- **Base resets**: `fieldset { min-width: 0 }` (fieldsets default to min-content width and push phone layouts sideways). On coarse pointers, `<summary>` gets `0.5rem` vertical padding (padding utilities still win).
|
|
40
|
+
- **`--fab-bottom-inset`** (consumed by theme-svelte's `FloatingActionButton` and DataPanel launchers): set it on `:root` while a bottom bar is showing, and a bottom-corner launcher sits above it.
|
package/index.js
CHANGED
|
@@ -18,67 +18,33 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
const
|
|
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);
|
|
34
|
+
}
|
|
22
35
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* theme-styles/base.css sets the same scale inside `@layer classic-theme.base`,
|
|
27
|
-
* but any consumer that runs `@tailwind base` also gets Tailwind preflight's
|
|
28
|
-
* `h1..h6 { font-size: inherit; font-weight: inherit }`. Preflight is
|
|
29
|
-
* unlayered, so it outranks the theme's layered rule by cascade semantics -
|
|
30
|
-
* and @csstools/postcss-cascade-layers (postcss-config) keeps that ordering
|
|
31
|
-
* with specificity boosts. Bare headings therefore rendered at body size with
|
|
32
|
-
* the inherited weight in every Tailwind app, including our own example apps.
|
|
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
|
-
};
|
|
36
|
+
function responsiveBase({ addBase }) {
|
|
37
|
+
addBase(responsiveBaseStyles);
|
|
38
|
+
}
|
|
53
39
|
|
|
54
|
-
function
|
|
55
|
-
|
|
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
|
-
});
|
|
40
|
+
function tapTarget({ addUtilities }) {
|
|
41
|
+
addUtilities(tapTargetUtilities);
|
|
76
42
|
}
|
|
77
43
|
|
|
78
44
|
/** @type {import('tailwindcss').Config} */
|
|
79
45
|
module.exports = {
|
|
80
46
|
// Enable dark mode via class on <html> element
|
|
81
|
-
darkMode
|
|
47
|
+
darkMode,
|
|
82
48
|
|
|
83
49
|
future: {
|
|
84
50
|
// Gate hover:/group-hover: styles behind @media (hover: hover) and (pointer: fine)
|
|
@@ -86,360 +52,6 @@ module.exports = {
|
|
|
86
52
|
hoverOnlyWhenSupported: true,
|
|
87
53
|
},
|
|
88
54
|
|
|
89
|
-
theme
|
|
90
|
-
|
|
91
|
-
container: {
|
|
92
|
-
center: true,
|
|
93
|
-
padding: {
|
|
94
|
-
DEFAULT: '1rem',
|
|
95
|
-
sm: '2rem',
|
|
96
|
-
lg: '4rem',
|
|
97
|
-
xl: '5rem',
|
|
98
|
-
'2xl': '6rem',
|
|
99
|
-
},
|
|
100
|
-
screens: {
|
|
101
|
-
sm: '640px',
|
|
102
|
-
md: '768px',
|
|
103
|
-
lg: '1024px',
|
|
104
|
-
xl: '1280px',
|
|
105
|
-
'2xl': '1400px', // Intentionally narrower than the 2xl breakpoint (1536px) for better readability
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
extend: {
|
|
110
|
-
// Brand color palettes from tokens
|
|
111
|
-
// Each color includes shades (50-950) and a foreground color for text on colored backgrounds
|
|
112
|
-
colors: {
|
|
113
|
-
// Neutrals
|
|
114
|
-
gray: tokens.colors.gray,
|
|
115
|
-
|
|
116
|
-
// Core brand colors (foreground property included from tokens)
|
|
117
|
-
red: tokens.colors.red,
|
|
118
|
-
teal: tokens.colors.teal,
|
|
119
|
-
navy: tokens.colors.navy,
|
|
120
|
-
plum: tokens.colors.plum,
|
|
121
|
-
sage: tokens.colors.sage, // Note: sage does not include foreground (muted color)
|
|
122
|
-
|
|
123
|
-
// Collection colors (foreground property included from tokens)
|
|
124
|
-
stone: tokens.colors.stone,
|
|
125
|
-
forest: tokens.colors.forest,
|
|
126
|
-
lavender: tokens.colors.lavender,
|
|
127
|
-
sky: tokens.colors.sky,
|
|
128
|
-
deepTeal: tokens.colors.deepTeal,
|
|
129
|
-
charcoal: tokens.colors.charcoal,
|
|
130
|
-
|
|
131
|
-
// Semantic color utilities (using CSS variables for theming)
|
|
132
|
-
border: 'hsl(var(--border))',
|
|
133
|
-
input: 'hsl(var(--input))',
|
|
134
|
-
ring: 'hsl(var(--ring))',
|
|
135
|
-
outline: {
|
|
136
|
-
DEFAULT: 'hsl(var(--outline))',
|
|
137
|
-
hover: 'hsl(var(--outline-hover))',
|
|
138
|
-
},
|
|
139
|
-
toolbar: {
|
|
140
|
-
DEFAULT: 'hsl(var(--toolbar))',
|
|
141
|
-
foreground: 'hsl(var(--toolbar-foreground))',
|
|
142
|
-
muted: 'hsl(var(--toolbar-muted))',
|
|
143
|
-
border: 'hsl(var(--toolbar-border))',
|
|
144
|
-
},
|
|
145
|
-
background: {
|
|
146
|
-
DEFAULT: 'hsl(var(--background))',
|
|
147
|
-
hover: 'hsl(var(--background-hover))',
|
|
148
|
-
},
|
|
149
|
-
foreground: 'hsl(var(--foreground))',
|
|
150
|
-
|
|
151
|
-
primary: {
|
|
152
|
-
DEFAULT: 'hsl(var(--primary))',
|
|
153
|
-
foreground: 'hsl(var(--primary-foreground))',
|
|
154
|
-
hover: 'hsl(var(--primary-hover))',
|
|
155
|
-
},
|
|
156
|
-
secondary: {
|
|
157
|
-
DEFAULT: 'hsl(var(--secondary))',
|
|
158
|
-
foreground: 'hsl(var(--secondary-foreground))',
|
|
159
|
-
hover: 'hsl(var(--secondary-hover))',
|
|
160
|
-
border: 'hsl(var(--secondary-border))',
|
|
161
|
-
soft: 'hsl(var(--secondary-soft))',
|
|
162
|
-
},
|
|
163
|
-
destructive: {
|
|
164
|
-
DEFAULT: 'hsl(var(--destructive))',
|
|
165
|
-
foreground: 'hsl(var(--destructive-foreground))',
|
|
166
|
-
hover: 'hsl(var(--destructive-hover))',
|
|
167
|
-
},
|
|
168
|
-
muted: {
|
|
169
|
-
DEFAULT: 'hsl(var(--muted))',
|
|
170
|
-
foreground: 'hsl(var(--muted-foreground))',
|
|
171
|
-
hover: 'hsl(var(--muted-hover))',
|
|
172
|
-
},
|
|
173
|
-
accent: {
|
|
174
|
-
DEFAULT: 'hsl(var(--accent))',
|
|
175
|
-
foreground: 'hsl(var(--accent-foreground))',
|
|
176
|
-
hover: 'hsl(var(--accent-hover))',
|
|
177
|
-
},
|
|
178
|
-
popover: {
|
|
179
|
-
DEFAULT: 'hsl(var(--popover))',
|
|
180
|
-
foreground: 'hsl(var(--popover-foreground))',
|
|
181
|
-
},
|
|
182
|
-
card: {
|
|
183
|
-
DEFAULT: 'hsl(var(--card))',
|
|
184
|
-
foreground: 'hsl(var(--card-foreground))',
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
// Status colors (for alerts, notifications, feedback)
|
|
188
|
-
success: {
|
|
189
|
-
DEFAULT: 'hsl(var(--success))',
|
|
190
|
-
foreground: 'hsl(var(--success-foreground))',
|
|
191
|
-
},
|
|
192
|
-
warning: {
|
|
193
|
-
DEFAULT: 'hsl(var(--warning))',
|
|
194
|
-
foreground: 'hsl(var(--warning-foreground))',
|
|
195
|
-
},
|
|
196
|
-
info: {
|
|
197
|
-
DEFAULT: 'hsl(var(--info))',
|
|
198
|
-
foreground: 'hsl(var(--info-foreground))',
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
// Layout colors
|
|
202
|
-
'content-bg': 'hsl(var(--content-bg))',
|
|
203
|
-
'surface-border': 'hsl(var(--surface-border))',
|
|
204
|
-
|
|
205
|
-
// Sidebar colors
|
|
206
|
-
sidebar: {
|
|
207
|
-
DEFAULT: 'hsl(var(--sidebar-background))',
|
|
208
|
-
foreground: 'hsl(var(--sidebar-foreground))',
|
|
209
|
-
primary: 'hsl(var(--sidebar-primary))',
|
|
210
|
-
'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
|
|
211
|
-
accent: 'hsl(var(--sidebar-accent))',
|
|
212
|
-
'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
|
|
213
|
-
'accent-hover': 'hsl(var(--sidebar-accent-hover))',
|
|
214
|
-
border: 'hsl(var(--sidebar-border))',
|
|
215
|
-
ring: 'hsl(var(--sidebar-ring))',
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
// Chart colors
|
|
219
|
-
chart: {
|
|
220
|
-
1: 'hsl(var(--chart-1))',
|
|
221
|
-
2: 'hsl(var(--chart-2))',
|
|
222
|
-
3: 'hsl(var(--chart-3))',
|
|
223
|
-
4: 'hsl(var(--chart-4))',
|
|
224
|
-
5: 'hsl(var(--chart-5))',
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
// Brand colors (direct hex for exact matching)
|
|
228
|
-
brand: {
|
|
229
|
-
'red-logo': 'var(--color-red-logo)',
|
|
230
|
-
'red-primary': 'var(--color-red-primary)',
|
|
231
|
-
'grey-1': 'var(--color-grey-1)',
|
|
232
|
-
'grey-2': 'var(--color-grey-2)',
|
|
233
|
-
'core-1': 'var(--color-core-1)',
|
|
234
|
-
'core-2': 'var(--color-core-2)',
|
|
235
|
-
'core-3': 'var(--color-core-3)',
|
|
236
|
-
'core-4': 'var(--color-core-4)',
|
|
237
|
-
'core-4-tint': 'var(--color-core-4-tint)',
|
|
238
|
-
'collection-1': 'var(--color-collection-1)',
|
|
239
|
-
'collection-2': 'var(--color-collection-2)',
|
|
240
|
-
'collection-3': 'var(--color-collection-3)',
|
|
241
|
-
'collection-4': 'var(--color-collection-4)',
|
|
242
|
-
'collection-5': 'var(--color-collection-5)',
|
|
243
|
-
'collection-6': 'var(--color-collection-6)',
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
spacing: tokens.spacing,
|
|
248
|
-
|
|
249
|
-
fontFamily: tokens.fontFamily,
|
|
250
|
-
|
|
251
|
-
fontSize: {
|
|
252
|
-
...tokens.fontSize,
|
|
253
|
-
...headingScale,
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
fontWeight: tokens.fontWeight,
|
|
257
|
-
|
|
258
|
-
// Border radius uses token values directly for consistency
|
|
259
|
-
// The --radius CSS variable (0.5rem) is available for components that need dynamic theming
|
|
260
|
-
borderRadius: tokens.borderRadius,
|
|
261
|
-
|
|
262
|
-
boxShadow: tokens.boxShadow,
|
|
263
|
-
|
|
264
|
-
zIndex: tokens.zIndex,
|
|
265
|
-
|
|
266
|
-
aspectRatio: tokens.aspectRatio,
|
|
267
|
-
|
|
268
|
-
screens: tokens.breakpoints,
|
|
269
|
-
|
|
270
|
-
transitionDuration: tokens.transition.duration,
|
|
271
|
-
|
|
272
|
-
transitionTimingFunction: tokens.transition.timing,
|
|
273
|
-
|
|
274
|
-
keyframes: {
|
|
275
|
-
// Accordion animations (Radix/Bits UI)
|
|
276
|
-
'accordion-down': {
|
|
277
|
-
from: { height: '0' },
|
|
278
|
-
to: { height: 'var(--radix-accordion-content-height)' },
|
|
279
|
-
},
|
|
280
|
-
'accordion-up': {
|
|
281
|
-
from: { height: 'var(--radix-accordion-content-height)' },
|
|
282
|
-
to: { height: '0' },
|
|
283
|
-
},
|
|
284
|
-
// Collapsible animations
|
|
285
|
-
'collapsible-down': {
|
|
286
|
-
from: { height: '0' },
|
|
287
|
-
to: { height: 'var(--bits-collapsible-content-height)' },
|
|
288
|
-
},
|
|
289
|
-
'collapsible-up': {
|
|
290
|
-
from: { height: 'var(--bits-collapsible-content-height)' },
|
|
291
|
-
to: { height: '0' },
|
|
292
|
-
},
|
|
293
|
-
// Fade animations
|
|
294
|
-
'fade-in': {
|
|
295
|
-
from: { opacity: '0' },
|
|
296
|
-
to: { opacity: '1' },
|
|
297
|
-
},
|
|
298
|
-
'fade-out': {
|
|
299
|
-
from: { opacity: '1' },
|
|
300
|
-
to: { opacity: '0' },
|
|
301
|
-
},
|
|
302
|
-
// Slide animations
|
|
303
|
-
'slide-up': {
|
|
304
|
-
from: { opacity: '0', transform: 'translateY(10px)' },
|
|
305
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
306
|
-
},
|
|
307
|
-
'slide-down': {
|
|
308
|
-
from: { opacity: '0', transform: 'translateY(-10px)' },
|
|
309
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
310
|
-
},
|
|
311
|
-
'slide-left': {
|
|
312
|
-
from: { opacity: '0', transform: 'translateX(10px)' },
|
|
313
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
314
|
-
},
|
|
315
|
-
'slide-right': {
|
|
316
|
-
from: { opacity: '0', transform: 'translateX(-10px)' },
|
|
317
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
318
|
-
},
|
|
319
|
-
// Scale animations
|
|
320
|
-
'scale-in': {
|
|
321
|
-
from: { opacity: '0', transform: 'scale(0.95)' },
|
|
322
|
-
to: { opacity: '1', transform: 'scale(1)' },
|
|
323
|
-
},
|
|
324
|
-
'scale-out': {
|
|
325
|
-
from: { opacity: '1', transform: 'scale(1)' },
|
|
326
|
-
to: { opacity: '0', transform: 'scale(0.95)' },
|
|
327
|
-
},
|
|
328
|
-
// Spinner
|
|
329
|
-
'spin-slow': {
|
|
330
|
-
from: { transform: 'rotate(0deg)' },
|
|
331
|
-
to: { transform: 'rotate(360deg)' },
|
|
332
|
-
},
|
|
333
|
-
// Pulse
|
|
334
|
-
'pulse-subtle': {
|
|
335
|
-
'0%, 100%': { opacity: '1' },
|
|
336
|
-
'50%': { opacity: '0.7' },
|
|
337
|
-
},
|
|
338
|
-
// Progress bar indeterminate
|
|
339
|
-
'progress-indeterminate': {
|
|
340
|
-
'0%': { transform: 'translateX(-100%)' },
|
|
341
|
-
'100%': { transform: 'translateX(400%)' },
|
|
342
|
-
},
|
|
343
|
-
// Skeleton shimmer
|
|
344
|
-
shimmer: {
|
|
345
|
-
'0%': { backgroundPosition: '-200% 0' },
|
|
346
|
-
'100%': { backgroundPosition: '200% 0' },
|
|
347
|
-
},
|
|
348
|
-
// Logo trace animation
|
|
349
|
-
trace: {
|
|
350
|
-
to: { 'stroke-dashoffset': '-14' },
|
|
351
|
-
},
|
|
352
|
-
|
|
353
|
-
// DataPanel slide animations (from edges)
|
|
354
|
-
'panel-slide-in-left': {
|
|
355
|
-
from: { opacity: '0', transform: 'translateX(-100%)' },
|
|
356
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
357
|
-
},
|
|
358
|
-
'panel-slide-out-left': {
|
|
359
|
-
from: { opacity: '1', transform: 'translateX(0)' },
|
|
360
|
-
to: { opacity: '0', transform: 'translateX(-100%)' },
|
|
361
|
-
},
|
|
362
|
-
'panel-slide-in-right': {
|
|
363
|
-
from: { opacity: '0', transform: 'translateX(100%)' },
|
|
364
|
-
to: { opacity: '1', transform: 'translateX(0)' },
|
|
365
|
-
},
|
|
366
|
-
'panel-slide-out-right': {
|
|
367
|
-
from: { opacity: '1', transform: 'translateX(0)' },
|
|
368
|
-
to: { opacity: '0', transform: 'translateX(100%)' },
|
|
369
|
-
},
|
|
370
|
-
'panel-slide-in-top': {
|
|
371
|
-
from: { opacity: '0', transform: 'translateY(-100%)' },
|
|
372
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
373
|
-
},
|
|
374
|
-
'panel-slide-out-top': {
|
|
375
|
-
from: { opacity: '1', transform: 'translateY(0)' },
|
|
376
|
-
to: { opacity: '0', transform: 'translateY(-100%)' },
|
|
377
|
-
},
|
|
378
|
-
'panel-slide-in-bottom': {
|
|
379
|
-
from: { opacity: '0', transform: 'translateY(100%)' },
|
|
380
|
-
to: { opacity: '1', transform: 'translateY(0)' },
|
|
381
|
-
},
|
|
382
|
-
'panel-slide-out-bottom': {
|
|
383
|
-
from: { opacity: '1', transform: 'translateY(0)' },
|
|
384
|
-
to: { opacity: '0', transform: 'translateY(100%)' },
|
|
385
|
-
},
|
|
386
|
-
// DataPanel detach/attach animations
|
|
387
|
-
'panel-detach': {
|
|
388
|
-
from: { opacity: '0', transform: 'scale(0.95)' },
|
|
389
|
-
to: { opacity: '1', transform: 'scale(1)' },
|
|
390
|
-
},
|
|
391
|
-
'panel-attach': {
|
|
392
|
-
from: { opacity: '1', transform: 'scale(1)' },
|
|
393
|
-
to: { opacity: '0', transform: 'scale(0.95)' },
|
|
394
|
-
},
|
|
395
|
-
// DataPanel collapse/expand (for content area)
|
|
396
|
-
'panel-collapse': {
|
|
397
|
-
from: { height: 'var(--panel-content-height)', opacity: '1' },
|
|
398
|
-
to: { height: '0', opacity: '0' },
|
|
399
|
-
},
|
|
400
|
-
'panel-expand': {
|
|
401
|
-
from: { height: '0', opacity: '0' },
|
|
402
|
-
to: { height: 'var(--panel-content-height)', opacity: '1' },
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
|
|
406
|
-
animation: {
|
|
407
|
-
// Use token durations for single source of truth
|
|
408
|
-
'accordion-down': `accordion-down ${tokens.animation.duration.base} ease-out`,
|
|
409
|
-
'accordion-up': `accordion-up ${tokens.animation.duration.base} ease-out`,
|
|
410
|
-
'collapsible-down': `collapsible-down ${tokens.animation.duration.base} ease-out`,
|
|
411
|
-
'collapsible-up': `collapsible-up ${tokens.animation.duration.base} ease-out`,
|
|
412
|
-
'fade-in': `fade-in ${tokens.animation.duration.base} ease-out`,
|
|
413
|
-
'fade-out': `fade-out ${tokens.animation.duration.base} ease-out`,
|
|
414
|
-
'slide-up': `slide-up ${tokens.animation.duration.base} ease-out`,
|
|
415
|
-
'slide-down': `slide-down ${tokens.animation.duration.base} ease-out`,
|
|
416
|
-
'slide-left': `slide-left ${tokens.animation.duration.base} ease-out`,
|
|
417
|
-
'slide-right': `slide-right ${tokens.animation.duration.base} ease-out`,
|
|
418
|
-
'scale-in': `scale-in ${tokens.animation.duration.base} ease-out`,
|
|
419
|
-
'scale-out': `scale-out ${tokens.animation.duration.base} ease-out`,
|
|
420
|
-
// Looping animations take literal durations: the 500ms `slower` token made
|
|
421
|
-
// spin-slow twice as fast as Tailwind's 1s `spin` and the shimmer 4x too fast.
|
|
422
|
-
'spin-slow': 'spin-slow 2s linear infinite',
|
|
423
|
-
'pulse-subtle': `pulse-subtle ${tokens.transition.duration.slower} cubic-bezier(0.4, 0, 0.6, 1) infinite`,
|
|
424
|
-
'progress-indeterminate': 'progress-indeterminate 1.5s ease-in-out infinite',
|
|
425
|
-
shimmer: 'shimmer 2s linear infinite',
|
|
426
|
-
trace: `trace ${tokens.transition.duration.slower} linear infinite`,
|
|
427
|
-
|
|
428
|
-
// DataPanel animations
|
|
429
|
-
'panel-slide-in-left': `panel-slide-in-left ${tokens.animation.duration.base} ease-out`,
|
|
430
|
-
'panel-slide-out-left': `panel-slide-out-left ${tokens.animation.duration.base} ease-out`,
|
|
431
|
-
'panel-slide-in-right': `panel-slide-in-right ${tokens.animation.duration.base} ease-out`,
|
|
432
|
-
'panel-slide-out-right': `panel-slide-out-right ${tokens.animation.duration.base} ease-out`,
|
|
433
|
-
'panel-slide-in-top': `panel-slide-in-top ${tokens.animation.duration.base} ease-out`,
|
|
434
|
-
'panel-slide-out-top': `panel-slide-out-top ${tokens.animation.duration.base} ease-out`,
|
|
435
|
-
'panel-slide-in-bottom': `panel-slide-in-bottom ${tokens.animation.duration.base} ease-out`,
|
|
436
|
-
'panel-slide-out-bottom': `panel-slide-out-bottom ${tokens.animation.duration.base} ease-out`,
|
|
437
|
-
'panel-detach': `panel-detach ${tokens.animation.duration.base} ease-out`,
|
|
438
|
-
'panel-attach': `panel-attach ${tokens.animation.duration.base} ease-out`,
|
|
439
|
-
'panel-collapse': `panel-collapse ${tokens.animation.duration.base} ease-out`,
|
|
440
|
-
'panel-expand': `panel-expand ${tokens.animation.duration.base} ease-out`,
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
plugins: [headingBase],
|
|
55
|
+
theme,
|
|
56
|
+
plugins: [headingBase, responsiveBase, tapTarget],
|
|
445
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
|
+
};
|