@skdx/tokens 0.26.0 → 0.28.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/LICENSE +21 -0
- package/README.md +77 -57
- package/dist/themes/AntDark.d.cts +3 -7
- package/dist/themes/AntDark.d.ts +3 -7
- package/dist/themes/ChakraDark.d.cts +3 -7
- package/dist/themes/ChakraDark.d.ts +3 -7
- package/dist/themes/DefaultTheme.d.cts +1 -2
- package/dist/themes/DefaultTheme.d.ts +1 -2
- package/dist/themes/DraculaLight.d.cts +1 -9
- package/dist/themes/DraculaLight.d.ts +1 -9
- package/dist/themes/EverforestDark.d.cts +1 -2
- package/dist/themes/EverforestDark.d.ts +1 -2
- package/dist/themes/EverforestLight.d.cts +4 -8
- package/dist/themes/EverforestLight.d.ts +4 -8
- package/dist/themes/FluentDark.d.cts +2 -6
- package/dist/themes/FluentDark.d.ts +2 -6
- package/dist/themes/GruvboxLight.d.cts +1 -2
- package/dist/themes/GruvboxLight.d.ts +1 -2
- package/dist/themes/MaterialBrand.d.cts +1 -1
- package/dist/themes/MaterialBrand.d.ts +1 -1
- package/dist/themes/MaterialDark.d.cts +3 -7
- package/dist/themes/MaterialDark.d.ts +3 -7
- package/dist/themes/MidnightBrand.d.cts +2 -5
- package/dist/themes/MidnightBrand.d.ts +2 -5
- package/dist/themes/MidnightLight.d.cts +2 -5
- package/dist/themes/MidnightLight.d.ts +2 -5
- package/dist/themes/NordLight.d.cts +1 -2
- package/dist/themes/NordLight.d.ts +1 -2
- package/dist/themes/OneLight.d.cts +4 -8
- package/dist/themes/OneLight.d.ts +4 -8
- package/dist/themes/PrimerDark.d.cts +0 -1
- package/dist/themes/PrimerDark.d.ts +0 -1
- package/dist/themes/RosePineDawn.d.cts +4 -8
- package/dist/themes/RosePineDawn.d.ts +4 -8
- package/dist/themes/SkandaDark.d.cts +3 -7
- package/dist/themes/SkandaDark.d.ts +3 -7
- package/dist/themes/SynthwaveLight.d.cts +3 -7
- package/dist/themes/SynthwaveLight.d.ts +3 -7
- package/dist/themes/brands.d.cts +7 -14
- package/dist/themes/brands.d.ts +7 -14
- package/dist/themes/createBrandTheme.d.cts +13 -21
- package/dist/themes/createBrandTheme.d.ts +13 -21
- package/dist/utils/aliases.d.cts +22 -92
- package/dist/utils/aliases.d.ts +22 -92
- package/dist/utils/contrast.d.cts +2 -17
- package/dist/utils/contrast.d.ts +2 -17
- package/dist/utils/cssVars.d.cts +7 -29
- package/dist/utils/cssVars.d.ts +7 -29
- package/dist/utils/foundation.d.cts +47 -143
- package/dist/utils/foundation.d.ts +47 -143
- package/dist/utils/mode.d.cts +31 -43
- package/dist/utils/mode.d.ts +31 -43
- package/dist/utils/theme.d.cts +83 -240
- package/dist/utils/theme.d.ts +83 -240
- package/dist/utils/toCss.d.cts +18 -57
- package/dist/utils/toCss.d.ts +18 -57
- package/package.json +1 -1
package/dist/utils/theme.d.cts
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* A theme is a plain JSON-serializable object, which makes it the natural
|
|
5
|
-
* output format for a visual theme builder: the builder edits a `Theme`,
|
|
6
|
-
* and `themeToCss()` turns it into CSS custom properties that the styled
|
|
7
|
-
* (branded) component layer consumes.
|
|
2
|
+
* A theme is a plain JSON-serializable object; `themeToCss()` turns it into CSS custom properties.
|
|
8
3
|
*/
|
|
9
4
|
/**
|
|
10
|
-
* The two resolved color modes a theme renders in
|
|
11
|
-
* per mode (see `brands`); `'system'` is a user *preference* consumers
|
|
12
|
-
* resolve to one of these via `prefers-color-scheme` before picking a theme.
|
|
13
|
-
*
|
|
5
|
+
* The two resolved color modes a theme renders in (resolved via `prefers-color-scheme`).
|
|
14
6
|
* @public
|
|
15
7
|
*/
|
|
16
8
|
export type ThemeColorMode = 'light' | 'dark';
|
|
17
9
|
/**
|
|
18
|
-
*
|
|
19
|
-
* Tailwind/Radix step convention. Each key renders as `--skdx-color-<name>-<step>`,
|
|
20
|
-
* e.g. `primary[600]` → `--skdx-color-primary-600`.
|
|
21
|
-
*
|
|
10
|
+
* 11-step color ramp, 50 (lightest) to 950 (darkest), rendered as `--skdx-color-<name>-<step>`.
|
|
22
11
|
* @public
|
|
23
12
|
*/
|
|
24
13
|
export interface ColorScale {
|
|
@@ -35,67 +24,57 @@ export interface ColorScale {
|
|
|
35
24
|
950: string;
|
|
36
25
|
}
|
|
37
26
|
/**
|
|
38
|
-
* Role-based colors
|
|
39
|
-
* these in component styling instead of a raw scale step, so swapping a
|
|
40
|
-
* theme's palette doesn't require touching component CSS.
|
|
41
|
-
*
|
|
27
|
+
* Role-based colors from {@link ThemeColors}; prefer these over raw scale steps in styling.
|
|
42
28
|
* @public
|
|
43
29
|
*/
|
|
44
30
|
export interface SemanticColors {
|
|
45
31
|
/** Page background. */
|
|
46
32
|
background: string;
|
|
47
|
-
/** Raised
|
|
33
|
+
/** Raised surfaces (cards, panels). */
|
|
48
34
|
surface: string;
|
|
49
|
-
/** Surface
|
|
35
|
+
/** Surface on hover. */
|
|
50
36
|
surfaceHover: string;
|
|
51
|
-
/** Overlay/scrim behind dialogs and drawers
|
|
37
|
+
/** Overlay/scrim behind dialogs and drawers. */
|
|
52
38
|
overlay: string;
|
|
53
|
-
/** Primary body text
|
|
39
|
+
/** Primary body text. */
|
|
54
40
|
text: string;
|
|
55
|
-
/** Secondary
|
|
41
|
+
/** Secondary text. */
|
|
56
42
|
textMuted: string;
|
|
57
|
-
/** Text
|
|
43
|
+
/** Text on filled/primary backgrounds. */
|
|
58
44
|
textInverted: string;
|
|
59
45
|
/** Default border color. */
|
|
60
46
|
border: string;
|
|
61
|
-
/** Higher-contrast border
|
|
47
|
+
/** Higher-contrast border (inputs on hover/focus). */
|
|
62
48
|
borderStrong: string;
|
|
63
|
-
/** Focus ring
|
|
49
|
+
/** Focus ring color. */
|
|
64
50
|
focusRing: string;
|
|
65
51
|
}
|
|
66
|
-
/**
|
|
52
|
+
/** Five color scales, each rendered as `--skdx-color-<name>-<step>`. @public */
|
|
67
53
|
export interface ThemeColors {
|
|
68
|
-
/** Brand/accent color
|
|
54
|
+
/** Brand/accent color (buttons, links, focus at 500–600). */
|
|
69
55
|
primary: ColorScale;
|
|
70
|
-
/**
|
|
56
|
+
/** Text, borders, and surface grays. */
|
|
71
57
|
neutral: ColorScale;
|
|
72
|
-
/**
|
|
58
|
+
/** Success/confirmation states. */
|
|
73
59
|
success: ColorScale;
|
|
74
|
-
/**
|
|
60
|
+
/** Warning/caution states. */
|
|
75
61
|
warning: ColorScale;
|
|
76
|
-
/**
|
|
62
|
+
/** Danger/error states. */
|
|
77
63
|
danger: ColorScale;
|
|
78
|
-
/** Role-based colors
|
|
64
|
+
/** Role-based colors from scales; components prefer these over raw steps. */
|
|
79
65
|
semantic: SemanticColors;
|
|
80
66
|
}
|
|
81
67
|
/**
|
|
82
|
-
* Font stacks,
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* **Not part of {@link Theme}** — typography is theme-invariant and lives once
|
|
86
|
-
* in `foundation.ts` (see {@link typography}). A theme selects colors; it does
|
|
87
|
-
* not get to resize the type scale out from under a layout. The two font
|
|
88
|
-
* *stacks* are the sole exception, and only for themes that impersonate a
|
|
89
|
-
* published design language — see {@link ThemeTypographyDeviation}.
|
|
90
|
-
*
|
|
68
|
+
* Font stacks, type scale, weight/line-height tokens, rendered as `--skdx-font-*`.
|
|
69
|
+
* Theme-invariant except the two font stacks (see {@link ThemeTypographyDeviation}).
|
|
91
70
|
* @public
|
|
92
71
|
*/
|
|
93
72
|
export interface ThemeTypography {
|
|
94
|
-
/** Body font stack
|
|
73
|
+
/** Body font stack. */
|
|
95
74
|
fontFamily: string;
|
|
96
|
-
/** Monospace stack for code
|
|
75
|
+
/** Monospace stack for code. */
|
|
97
76
|
fontFamilyMono: string;
|
|
98
|
-
/** Type scale
|
|
77
|
+
/** Type scale `xs` to `3xl`. */
|
|
99
78
|
fontSize: {
|
|
100
79
|
xs: string;
|
|
101
80
|
sm: string;
|
|
@@ -105,29 +84,21 @@ export interface ThemeTypography {
|
|
|
105
84
|
'2xl': string;
|
|
106
85
|
'3xl': string;
|
|
107
86
|
};
|
|
108
|
-
/**
|
|
87
|
+
/** Font weights: regular, medium, semibold, bold. */
|
|
109
88
|
fontWeight: {
|
|
110
89
|
regular: number;
|
|
111
90
|
medium: number;
|
|
112
91
|
semibold: number;
|
|
113
92
|
bold: number;
|
|
114
93
|
};
|
|
115
|
-
/**
|
|
116
|
-
* Unitless-or-CSS line-height values. `snug` is the control step — the
|
|
117
|
-
* leading a button, tab or menu label takes, tighter than body copy but not
|
|
118
|
-
* as clipped as `tight`, which is a display-heading value.
|
|
119
|
-
*/
|
|
94
|
+
/** Line heights. `snug` is the control step (tighter than body, looser than `tight`). */
|
|
120
95
|
lineHeight: {
|
|
121
96
|
tight: string;
|
|
122
97
|
snug: string;
|
|
123
98
|
normal: string;
|
|
124
99
|
relaxed: string;
|
|
125
100
|
};
|
|
126
|
-
/**
|
|
127
|
-
* Tracking scale, rendered as `--skdx-font-letter-spacing-<step>`. `tight`
|
|
128
|
-
* suits large display headings (which look loose at their default
|
|
129
|
-
* tracking); `wide`/`wider` suit small-caps, overlines and button labels.
|
|
130
|
-
*/
|
|
101
|
+
/** Tracking scale, rendered as `--skdx-font-letter-spacing-<step>`. */
|
|
131
102
|
letterSpacing: {
|
|
132
103
|
tight: string;
|
|
133
104
|
normal: string;
|
|
@@ -136,9 +107,8 @@ export interface ThemeTypography {
|
|
|
136
107
|
};
|
|
137
108
|
}
|
|
138
109
|
/**
|
|
139
|
-
* Spacing scale (margin, padding, gap)
|
|
140
|
-
*
|
|
141
|
-
* @public
|
|
110
|
+
* Spacing scale (margin, padding, gap), rendered as `--skdx-space-<step>`.
|
|
111
|
+
* Lives once in `foundation.ts` (see {@link space}). @public
|
|
142
112
|
*/
|
|
143
113
|
export interface ThemeSpace {
|
|
144
114
|
'1': string;
|
|
@@ -153,54 +123,27 @@ export interface ThemeSpace {
|
|
|
153
123
|
'16': string;
|
|
154
124
|
}
|
|
155
125
|
/**
|
|
156
|
-
* Border-radius scale
|
|
157
|
-
*
|
|
158
|
-
* @public
|
|
126
|
+
* Border-radius scale, rendered as `--skdx-radius-<size>`.
|
|
127
|
+
* Lives once in `foundation.ts` (see {@link radii}). @public
|
|
159
128
|
*/
|
|
160
129
|
export interface ThemeRadii {
|
|
161
130
|
sm: string;
|
|
162
|
-
/**
|
|
163
|
-
* The radius of a box nested *inside* a larger radiused surface — a menu row
|
|
164
|
-
* inside an overlay, a segment inside its well, a checkbox box. Sits between
|
|
165
|
-
* `sm` and `md` rather than at a ramp position of its own, because it is a
|
|
166
|
-
* relationship (inner to outer) and not a size step.
|
|
167
|
-
*/
|
|
131
|
+
/** Nested box radius (relationship between `sm` and `md`, not a size step). */
|
|
168
132
|
inner: string;
|
|
169
133
|
md: string;
|
|
170
134
|
lg: string;
|
|
171
135
|
xl: string;
|
|
172
|
-
/** Fully round,
|
|
136
|
+
/** Fully round, for pills and circular avatars. */
|
|
173
137
|
full: string;
|
|
174
138
|
}
|
|
175
139
|
/**
|
|
176
|
-
* Control geometry
|
|
177
|
-
*
|
|
178
|
-
* re-deciding what "md" means.
|
|
179
|
-
*
|
|
180
|
-
* **Not part of {@link Theme}** — lives once in `foundation.ts` (see
|
|
181
|
-
* {@link controls}), for the same reason {@link space} does: density is a
|
|
182
|
-
* property of the design system, not of the brand painted on top of it. A
|
|
183
|
-
* consumer retunes it by setting the emitted custom properties on a subtree:
|
|
184
|
-
*
|
|
185
|
-
* ```css
|
|
186
|
-
* .compact-form { --skdx-control-height-md: 2rem; }
|
|
187
|
-
* ```
|
|
188
|
-
*
|
|
189
|
-
* Values may reference other tokens (`var(--skdx-space-3)`) rather than restate
|
|
190
|
-
* a length, and several deliberately do — that is what keeps a control's
|
|
191
|
-
* padding on the spacing scale instead of beside it.
|
|
192
|
-
*
|
|
193
|
-
* @public
|
|
140
|
+
* Control geometry: metrics Button, Input and Select snap to.
|
|
141
|
+
* Lives once in `foundation.ts` (see {@link controls}). @public
|
|
194
142
|
*/
|
|
195
143
|
export interface ThemeControls {
|
|
196
|
-
/**
|
|
144
|
+
/** Vertical rhythm, inline padding and icon gap. */
|
|
197
145
|
control: {
|
|
198
|
-
/**
|
|
199
|
-
* `compact` is the odd one out and is not a ramp step: it is the square a
|
|
200
|
-
* pagination link or a SegmentedControl segment takes, which sits inside a
|
|
201
|
-
* strip rather than on a form row and is a step under `md` in both
|
|
202
|
-
* reference libraries surveyed.
|
|
203
|
-
*/
|
|
146
|
+
/** `compact`: pagination/segment square, step below `md` (not a ramp step). */
|
|
204
147
|
height: {
|
|
205
148
|
sm: string;
|
|
206
149
|
md: string;
|
|
@@ -218,19 +161,19 @@ export interface ThemeControls {
|
|
|
218
161
|
lg: string;
|
|
219
162
|
};
|
|
220
163
|
};
|
|
221
|
-
/** Glyph box
|
|
164
|
+
/** Glyph box size, proportional to control (not font size; unaffected by line-height). */
|
|
222
165
|
iconSize: {
|
|
223
166
|
sm: string;
|
|
224
167
|
md: string;
|
|
225
168
|
lg: string;
|
|
226
169
|
};
|
|
227
|
-
/** Selection indicators
|
|
170
|
+
/** Selection indicators: checkbox, radio, slider thumb. Switch sets own track; see `switch.css`. */
|
|
228
171
|
indicatorSize: {
|
|
229
172
|
sm: string;
|
|
230
173
|
md: string;
|
|
231
174
|
lg: string;
|
|
232
175
|
};
|
|
233
|
-
/** Collection
|
|
176
|
+
/** Collection row heights (menus, listbox, table) and gaps between. */
|
|
234
177
|
item: {
|
|
235
178
|
height: {
|
|
236
179
|
sm: string;
|
|
@@ -245,25 +188,19 @@ export interface ThemeControls {
|
|
|
245
188
|
radius: string;
|
|
246
189
|
minWidth: string;
|
|
247
190
|
};
|
|
248
|
-
/**
|
|
191
|
+
/** Label-to-control and control-to-help-text gaps. */
|
|
249
192
|
field: {
|
|
250
193
|
gap: string;
|
|
251
194
|
labelGap: string;
|
|
252
195
|
};
|
|
253
|
-
/** Minimum hit target
|
|
196
|
+
/** Minimum hit target: 24×24 CSS px (WCAG 2.2 §2.5.8); 44px for coarse pointers. */
|
|
254
197
|
target: {
|
|
255
198
|
min: string;
|
|
256
199
|
};
|
|
257
200
|
}
|
|
258
201
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
* Touch input gets larger targets, and `pointer: coarse` is the honest test —
|
|
262
|
-
* a small window on a desktop is still driven by a mouse, and a large tablet is
|
|
263
|
-
* still driven by a finger. Only sizes that are *hit* are listed: padding,
|
|
264
|
-
* gaps, radii and icon boxes are unchanged by how the user is pointing.
|
|
265
|
-
*
|
|
266
|
-
* @public
|
|
202
|
+
* {@link ThemeControls} overrides for coarse pointers. Only hit-target sizes;
|
|
203
|
+
* padding, gaps, radii, icons unchanged. @public
|
|
267
204
|
*/
|
|
268
205
|
export interface ThemeControlsCoarse {
|
|
269
206
|
control: {
|
|
@@ -286,206 +223,113 @@ export interface ThemeControlsCoarse {
|
|
|
286
223
|
};
|
|
287
224
|
}
|
|
288
225
|
/**
|
|
289
|
-
* Box-shadow scale,
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
* **Not part of {@link Theme}** — the *geometry* (offsets, blurs, spreads and
|
|
293
|
-
* base alphas) lives once in `foundation.ts` (see {@link shadows}), and each
|
|
294
|
-
* value defers its color to `var(--skdx-shadow-color)` /
|
|
295
|
-
* `var(--skdx-shadow-strength)`, which is what a theme supplies via
|
|
296
|
-
* {@link ThemeShadowColor}. Before this split every theme repeated the same
|
|
297
|
-
* three offsets purely because they were welded to a color literal in the same
|
|
298
|
-
* string.
|
|
299
|
-
*
|
|
226
|
+
* Box-shadow scale, rendered as `--skdx-shadow-<size>`. Geometry lives once
|
|
227
|
+
* in `foundation.ts` (see {@link shadows}); color defers to {@link ThemeShadowColor}.
|
|
300
228
|
* @public
|
|
301
229
|
*/
|
|
302
230
|
export interface ThemeShadows {
|
|
303
231
|
sm: string;
|
|
304
232
|
md: string;
|
|
305
233
|
lg: string;
|
|
306
|
-
/**
|
|
234
|
+
/** Elevated overlay surfaces (dialogs, popovers, dropdowns). */
|
|
307
235
|
overlay: string;
|
|
308
236
|
}
|
|
309
237
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* @public
|
|
238
|
+
* Shadow color: the only part of {@link shadows} a theme owns;
|
|
239
|
+
* geometry lives in the base. @public
|
|
314
240
|
*/
|
|
315
241
|
export interface ThemeShadowColor {
|
|
316
|
-
/**
|
|
317
|
-
* Space-separated sRGB channels, e.g. `'2 6 23'` — **not** a hex string. It
|
|
318
|
-
* is substituted into `rgb(<color> / <alpha>)`, which has no hex form.
|
|
319
|
-
*/
|
|
242
|
+
/** sRGB channels (e.g. `'2 6 23'`), substituted into `rgb(<color> / <alpha>)`. */
|
|
320
243
|
color: string;
|
|
321
244
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
* shadows exactly; dark themes run around `'5'` because a shadow has to work
|
|
325
|
-
* against a dark surface rather than a white page. This is the calibration
|
|
326
|
-
* knob — it is a look, not a measurement, and is meant to be tuned by eye.
|
|
245
|
+
* Multiplier for base alphas in {@link shadows}. `'1'` for light themes;
|
|
246
|
+
* dark themes ~`'5'` (shadow must work on dark surface).
|
|
327
247
|
*/
|
|
328
248
|
strength: string;
|
|
329
249
|
}
|
|
330
250
|
/**
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
* Deliberately just the two stacks. A theme that merely *looks* different has
|
|
335
|
-
* no business resizing the type scale: a layout that reflows when you switch
|
|
336
|
-
* brand was only ever designed against one scale, and every other brand was
|
|
337
|
-
* hoping. Impersonating a design language, though, means impersonating its
|
|
338
|
-
* typeface — which is why `fluent` and `material-you` declare this and nothing
|
|
339
|
-
* else does.
|
|
340
|
-
*
|
|
341
|
-
* Present on a theme = the deviation. There is no wrapper to opt into.
|
|
342
|
-
*
|
|
343
|
-
* @public
|
|
251
|
+
* Font stacks a theme may override (only part of {@link typography} not fixed).
|
|
252
|
+
* Only `fluent` and `material-you` declare it. @public
|
|
344
253
|
*/
|
|
345
254
|
export type ThemeTypographyDeviation = Partial<Pick<ThemeTypography, 'fontFamily' | 'fontFamilyMono'>>;
|
|
346
255
|
/**
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* deliberately unreachable: they exist to be uniform, and a theme that split
|
|
350
|
-
* an entrance curve from its matching exit would be shipping a mismatch, not a
|
|
351
|
-
* brand.
|
|
352
|
-
*
|
|
353
|
-
* See {@link ThemeMotion} for why motion is otherwise theme-invariant. Only
|
|
354
|
-
* `material-you`, `fluent` and `ant-daybreak` declare this (plus their dark
|
|
355
|
-
* counterparts, which inherit it through `createTheme`).
|
|
356
|
-
*
|
|
357
|
-
* @public
|
|
256
|
+
* Motion tokens a theme may retune. Optional ones (exit, staggers) stay uniform.
|
|
257
|
+
* Only `material-you`, `fluent` and `ant-daybreak` declare. @public
|
|
358
258
|
*/
|
|
359
259
|
export type ThemeMotionDeviation = Partial<Pick<ThemeMotion, 'durationFast' | 'durationNormal' | 'durationSlow' | 'easing'>>;
|
|
360
260
|
/**
|
|
361
|
-
* Animation durations,
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
* changes what the product *looks* like; it should not change how long the
|
|
366
|
-
* product makes you wait. Timing that shifts under you between brands reads
|
|
367
|
-
* as a bug, not as branding, and it silently changes the WCAG 2.3.3 surface
|
|
368
|
-
* (a 300ms curve and a 500ms curve are not equally forgiving to a vestibular
|
|
369
|
-
* user). Motion therefore lives once in `foundation.ts` (see {@link motion}),
|
|
370
|
-
* not on {@link Theme}. The three brand themes that *do* retune the base curve
|
|
371
|
-
* — `materialBrand`, `antBrand`, `fluentBrand` — declare it through
|
|
372
|
-
* {@link ThemeMotionDeviation}, the narrow escape hatch: each mirrors the
|
|
373
|
-
* published motion spec of the design language it impersonates, which is the
|
|
374
|
-
* whole point of those themes. Everything added below is left un-overridden by
|
|
375
|
-
* every bundled theme, and `ThemeMotionDeviation` cannot reach it.
|
|
376
|
-
*
|
|
377
|
-
* Every field beyond the original four is optional so that adding a token
|
|
378
|
-
* here never breaks a hand-written motion literal downstream;
|
|
379
|
-
* {@link defaultMotion} supplies the value that is actually emitted when one
|
|
380
|
-
* is omitted.
|
|
381
|
-
*
|
|
382
|
-
* @public
|
|
261
|
+
* Animation durations, easing curves, and staggers rendered as `--skdx-motion-*`.
|
|
262
|
+
* Theme-invariant by default (timing shift reads as bug, affects vestibular users).
|
|
263
|
+
* Lives once in `foundation.ts` (see {@link motion}). `materialBrand`, `antBrand`,
|
|
264
|
+
* `fluentBrand` retune via {@link ThemeMotionDeviation}. @public
|
|
383
265
|
*/
|
|
384
266
|
export interface ThemeMotion {
|
|
385
267
|
/**
|
|
386
|
-
* Zero
|
|
387
|
-
* re-rendering, a value updating). Named rather than hardcoded so "this is
|
|
388
|
-
* deliberately not animated" is legible at the call site.
|
|
268
|
+
* Zero for state changes that feel like data, not animation (value updates).
|
|
389
269
|
* @default '0ms'
|
|
390
270
|
*/
|
|
391
271
|
durationInstant?: string;
|
|
392
|
-
/** Hover
|
|
272
|
+
/** Hover/focus/press micro-interactions (direct manipulation). */
|
|
393
273
|
durationFast: string;
|
|
394
|
-
/** Open/close transitions for inline disclosure
|
|
274
|
+
/** Open/close transitions for inline disclosure (accordion, collapsible). */
|
|
395
275
|
durationNormal: string;
|
|
396
|
-
/**
|
|
276
|
+
/** Overlay transitions: dialogs, drawers, popovers. */
|
|
397
277
|
durationSlow: string;
|
|
398
|
-
/**
|
|
399
|
-
* The default curve: a fast start with a long, soft landing (an expo-style
|
|
400
|
-
* decelerate). Feels like something arriving and settling into place, so
|
|
401
|
-
* use it for anything entering the screen or growing open.
|
|
402
|
-
*/
|
|
278
|
+
/** Default curve: fast start, soft landing (for entering/opening). */
|
|
403
279
|
easing: string;
|
|
404
280
|
/**
|
|
405
|
-
* Mirror of {@link ThemeMotion.easing}
|
|
406
|
-
* Feels like something leaving rather than retreating, so use it for exits,
|
|
407
|
-
* dismissals and closes, where holding the user's attention on the way out
|
|
408
|
-
* is exactly what you do not want.
|
|
281
|
+
* Mirror of {@link ThemeMotion.easing} (slow start, accelerates). For exits.
|
|
409
282
|
* @default 'cubic-bezier(0.4, 0, 1, 1)'
|
|
410
283
|
*/
|
|
411
284
|
easingExit?: string;
|
|
412
285
|
/**
|
|
413
|
-
*
|
|
414
|
-
* value changing rather than an object moving, so use it for in-place state
|
|
415
|
-
* changes where nothing enters or leaves: colour swaps, toggles, theme
|
|
416
|
-
* changes, a control acknowledging that it was pressed.
|
|
286
|
+
* Symmetric ease-in-out, no overshoot (in-place: color swaps, toggles).
|
|
417
287
|
* @default 'cubic-bezier(0.4, 0, 0.2, 1)'
|
|
418
288
|
*/
|
|
419
289
|
easingSteady?: string;
|
|
420
290
|
/**
|
|
421
|
-
* Constant rate
|
|
422
|
-
* correct for indeterminate loops — a spinner or a shimmer easing at every
|
|
423
|
-
* cycle boundary reads as a stutter or a stall rather than as progress.
|
|
291
|
+
* Constant rate (indeterminate loops: spinner, shimmer).
|
|
424
292
|
* @default 'linear'
|
|
425
293
|
*/
|
|
426
294
|
easingLinear?: string;
|
|
427
295
|
/**
|
|
428
|
-
* Per-item delay
|
|
429
|
-
* that the whole set still reads as one gesture rather than as a sequence.
|
|
430
|
-
* Use it when the count is large or unbounded — a page-wide theme change, a
|
|
431
|
-
* grid of icons re-tinting.
|
|
296
|
+
* Per-item sweep delay (reads as one gesture for large/unbounded lists).
|
|
432
297
|
* @default '4ms'
|
|
433
298
|
*/
|
|
434
299
|
staggerTight?: string;
|
|
435
300
|
/**
|
|
436
|
-
* Per-item
|
|
437
|
-
* sequence, where each item arrives distinctly. Use it only for short,
|
|
438
|
-
* bounded lists — at a dozen items it is already a noticeable wait, and at
|
|
439
|
-
* fifty it is a loading screen.
|
|
301
|
+
* Per-item sequence delay (distinct arrival, short/bounded lists only).
|
|
440
302
|
* @default '40ms'
|
|
441
303
|
*/
|
|
442
304
|
staggerLoose?: string;
|
|
443
305
|
}
|
|
444
306
|
/**
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
* `--skdx-motion-*` surface — including the optional tokens no hand-written
|
|
448
|
-
* `Theme` literal declares. Keeping the values here rather than only in
|
|
449
|
-
* `defaultTheme` is what lets a theme opt out of a token without opting out
|
|
450
|
-
* of the CSS variable.
|
|
307
|
+
* Default motion values; merged under a theme's `motion` so every theme
|
|
308
|
+
* emits the complete `--skdx-motion-*` surface.
|
|
451
309
|
*/
|
|
452
310
|
export declare const defaultMotion: Required<ThemeMotion>;
|
|
453
311
|
/**
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* spacing scale, the radius scale, shadow geometry and motion timing are
|
|
459
|
-
* theme-invariant and live once in `foundation.ts`, emitted at `:root` by
|
|
460
|
-
* {@link foundationToCss}. Every bundled theme used to restate all of them
|
|
461
|
-
* identically — 38 copies of the same 62 lines — which made "what does this
|
|
462
|
-
* theme actually change?" unanswerable without a diff, and made adding a token
|
|
463
|
-
* a 38-file edit.
|
|
464
|
-
*
|
|
465
|
-
* The two escape hatches — `typography` and `motion` — are optional and
|
|
466
|
-
* narrow, for the themes that impersonate a published design language.
|
|
467
|
-
* Declaring one *is* the deviation; there is nothing to opt into.
|
|
468
|
-
*
|
|
469
|
-
* @public
|
|
312
|
+
* Complete theme object flowing through {@link createTheme}, {@link themeToCss},
|
|
313
|
+
* and {@link applyTheme}. Contains only colors; type scale, spacing, radii,
|
|
314
|
+
* shadow, motion are theme-invariant (see `foundation.ts`). `typography` and
|
|
315
|
+
* `motion` are escape hatches for impersonating design languages. @public
|
|
470
316
|
*/
|
|
471
317
|
export interface Theme {
|
|
472
|
-
/** Unique theme name
|
|
318
|
+
/** Unique theme name (e.g. `"skanda-light"`), used as `[data-skdx-theme="..."]` selector. */
|
|
473
319
|
name: string;
|
|
474
|
-
/**
|
|
320
|
+
/** Color mode this theme renders; emitted as `data-skdx-mode` by `applyTheme`. */
|
|
475
321
|
mode: ThemeColorMode;
|
|
476
322
|
colors: ThemeColors;
|
|
477
|
-
/**
|
|
323
|
+
/** Shadow color tint; see {@link ThemeShadowColor}. */
|
|
478
324
|
shadow: ThemeShadowColor;
|
|
479
|
-
/** Font-stack
|
|
325
|
+
/** Font-stack override (two bundled themes only); see {@link ThemeTypographyDeviation}. */
|
|
480
326
|
typography?: ThemeTypographyDeviation;
|
|
481
|
-
/** Motion
|
|
327
|
+
/** Motion override (three bundled themes only); see {@link ThemeMotionDeviation}. */
|
|
482
328
|
motion?: ThemeMotionDeviation;
|
|
483
329
|
}
|
|
484
330
|
/**
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
* {@link createTheme}, which deep-merges it onto a base theme.
|
|
488
|
-
*
|
|
331
|
+
* Partial {@link Theme} describing only what a brand changes. Passed to
|
|
332
|
+
* {@link createTheme}, which deep-merges onto a base theme.
|
|
489
333
|
* @example
|
|
490
334
|
* ```ts
|
|
491
335
|
* const override: ThemeOverride = {
|
|
@@ -493,7 +337,6 @@ export interface Theme {
|
|
|
493
337
|
* shadow: { strength: '5' },
|
|
494
338
|
* };
|
|
495
339
|
* ```
|
|
496
|
-
*
|
|
497
340
|
* @public
|
|
498
341
|
*/
|
|
499
342
|
export type ThemeOverride = {
|