@skdx/tokens 0.28.0 → 0.30.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 +16 -13
- package/dist/foundation.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/themes/AntDark.cjs +1 -1
- package/dist/themes/AntDark.d.cts +3 -8
- package/dist/themes/AntDark.d.ts +3 -8
- package/dist/themes/AntDark.js +1 -1
- package/dist/themes/{AntBrand.cjs → AntLight.cjs} +1 -1
- package/dist/themes/{AntBrand.d.cts → AntLight.d.cts} +1 -1
- package/dist/themes/{AntBrand.d.ts → AntLight.d.ts} +1 -1
- package/dist/themes/{AntBrand.js → AntLight.js} +1 -1
- package/dist/themes/CatppuccinLatte.cjs +1 -1
- package/dist/themes/CatppuccinLatte.d.cts +1 -7
- package/dist/themes/CatppuccinLatte.d.ts +1 -7
- package/dist/themes/CatppuccinLatte.js +1 -1
- package/dist/themes/CatppuccinMocha.cjs +1 -1
- package/dist/themes/CatppuccinMocha.d.cts +1 -7
- package/dist/themes/CatppuccinMocha.d.ts +1 -7
- package/dist/themes/CatppuccinMocha.js +1 -1
- package/dist/themes/ChakraDark.cjs +1 -1
- package/dist/themes/ChakraDark.d.cts +3 -8
- package/dist/themes/ChakraDark.d.ts +3 -8
- package/dist/themes/ChakraDark.js +1 -1
- package/dist/themes/{ChakraBrand.cjs → ChakraLight.cjs} +1 -1
- package/dist/themes/{ChakraBrand.d.cts → ChakraLight.d.cts} +1 -1
- package/dist/themes/{ChakraBrand.d.ts → ChakraLight.d.ts} +1 -1
- package/dist/themes/{ChakraBrand.js → ChakraLight.js} +1 -1
- package/dist/themes/CupcakeDark.cjs +1 -1
- package/dist/themes/CupcakeDark.d.cts +3 -5
- package/dist/themes/CupcakeDark.d.ts +3 -5
- package/dist/themes/CupcakeLight.cjs +1 -1
- package/dist/themes/CupcakeLight.d.cts +1 -8
- package/dist/themes/CupcakeLight.d.ts +1 -8
- package/dist/themes/CupcakeLight.js +1 -1
- package/dist/themes/DefaultTheme.cjs +1 -1
- package/dist/themes/DefaultTheme.d.cts +3 -14
- package/dist/themes/DefaultTheme.d.ts +3 -14
- package/dist/themes/DefaultTheme.js +1 -1
- package/dist/themes/DraculaLight.cjs +1 -1
- package/dist/themes/DraculaLight.d.cts +2 -1
- package/dist/themes/DraculaLight.d.ts +2 -1
- package/dist/themes/DraculaLight.js +1 -1
- package/dist/themes/EmeraldDark.cjs +1 -1
- package/dist/themes/EmeraldDark.d.cts +3 -8
- package/dist/themes/EmeraldDark.d.ts +3 -8
- package/dist/themes/EmeraldDark.js +1 -1
- package/dist/themes/{EmeraldBrand.cjs → EmeraldLight.cjs} +1 -1
- package/dist/themes/{EmeraldBrand.d.cts → EmeraldLight.d.cts} +1 -1
- package/dist/themes/{EmeraldBrand.d.ts → EmeraldLight.d.ts} +1 -1
- package/dist/themes/{EmeraldBrand.js → EmeraldLight.js} +1 -1
- package/dist/themes/EverforestDark.cjs +1 -1
- package/dist/themes/EverforestDark.js +1 -1
- package/dist/themes/EverforestLight.cjs +1 -1
- package/dist/themes/EverforestLight.d.cts +3 -5
- package/dist/themes/EverforestLight.d.ts +3 -5
- package/dist/themes/FluentDark.cjs +1 -1
- package/dist/themes/FluentDark.d.cts +3 -7
- package/dist/themes/FluentDark.d.ts +3 -7
- package/dist/themes/FluentDark.js +1 -1
- package/dist/themes/{FluentBrand.cjs → FluentLight.cjs} +1 -1
- package/dist/themes/{FluentBrand.d.cts → FluentLight.d.cts} +1 -1
- package/dist/themes/{FluentBrand.d.ts → FluentLight.d.ts} +1 -1
- package/dist/themes/{FluentBrand.js → FluentLight.js} +1 -1
- package/dist/themes/GraphiteDark.cjs +1 -1
- package/dist/themes/GraphiteDark.d.cts +3 -8
- package/dist/themes/GraphiteDark.d.ts +3 -8
- package/dist/themes/GraphiteDark.js +1 -1
- package/dist/themes/{GraphiteBrand.cjs → GraphiteLight.cjs} +1 -1
- package/dist/themes/{GraphiteBrand.d.cts → GraphiteLight.d.cts} +1 -1
- package/dist/themes/{GraphiteBrand.d.ts → GraphiteLight.d.ts} +1 -1
- package/dist/themes/{GraphiteBrand.js → GraphiteLight.js} +1 -1
- package/dist/themes/GruvboxDark.cjs +1 -1
- package/dist/themes/GruvboxDark.d.cts +1 -7
- package/dist/themes/GruvboxDark.d.ts +1 -7
- package/dist/themes/GruvboxDark.js +1 -1
- package/dist/themes/GruvboxLight.cjs +1 -1
- package/dist/themes/GruvboxLight.d.cts +3 -12
- package/dist/themes/GruvboxLight.d.ts +3 -12
- package/dist/themes/GruvboxLight.js +1 -1
- package/dist/themes/MaterialDark.cjs +1 -1
- package/dist/themes/MaterialDark.d.cts +3 -8
- package/dist/themes/MaterialDark.d.ts +3 -8
- package/dist/themes/MaterialDark.js +1 -1
- package/dist/themes/{MaterialBrand.cjs → MaterialLight.cjs} +1 -1
- package/dist/themes/{MaterialBrand.d.cts → MaterialLight.d.cts} +1 -1
- package/dist/themes/{MaterialBrand.d.ts → MaterialLight.d.ts} +1 -1
- package/dist/themes/{MaterialBrand.js → MaterialLight.js} +1 -1
- package/dist/themes/MidnightDark.cjs +1 -0
- package/dist/themes/MidnightDark.d.cts +3 -0
- package/dist/themes/MidnightDark.d.ts +3 -0
- package/dist/themes/{MidnightBrand.js → MidnightDark.js} +1 -1
- package/dist/themes/MidnightLight.cjs +1 -1
- package/dist/themes/MidnightLight.d.cts +2 -1
- package/dist/themes/MidnightLight.d.ts +2 -1
- package/dist/themes/MidnightLight.js +1 -1
- package/dist/themes/NordDark.cjs +1 -1
- package/dist/themes/NordDark.js +1 -1
- package/dist/themes/NordLight.cjs +1 -1
- package/dist/themes/NordLight.d.cts +3 -12
- package/dist/themes/NordLight.d.ts +3 -12
- package/dist/themes/NordLight.js +1 -1
- package/dist/themes/OneDark.cjs +1 -1
- package/dist/themes/OneDark.d.cts +1 -7
- package/dist/themes/OneDark.d.ts +1 -7
- package/dist/themes/OneDark.js +1 -1
- package/dist/themes/OneLight.cjs +1 -1
- package/dist/themes/OneLight.d.cts +3 -5
- package/dist/themes/OneLight.d.ts +3 -5
- package/dist/themes/OneLight.js +1 -1
- package/dist/themes/PrimerDark.cjs +1 -1
- package/dist/themes/PrimerDark.js +1 -1
- package/dist/themes/PrimerLight.d.cts +1 -7
- package/dist/themes/PrimerLight.d.ts +1 -7
- package/dist/themes/RosePine.cjs +1 -1
- package/dist/themes/RosePine.d.cts +1 -7
- package/dist/themes/RosePine.d.ts +1 -7
- package/dist/themes/RosePine.js +1 -1
- package/dist/themes/RosePineDawn.cjs +1 -1
- package/dist/themes/RosePineDawn.d.cts +3 -5
- package/dist/themes/RosePineDawn.d.ts +3 -5
- package/dist/themes/RosePineDawn.js +1 -1
- package/dist/themes/SkandaDark.cjs +1 -1
- package/dist/themes/SkandaDark.d.cts +2 -1
- package/dist/themes/SkandaDark.d.ts +2 -1
- package/dist/themes/SkandaDark.js +1 -1
- package/dist/themes/SkandaLight.cjs +1 -1
- package/dist/themes/SkandaLight.js +1 -1
- package/dist/themes/SolarizedDark.d.cts +1 -7
- package/dist/themes/SolarizedDark.d.ts +1 -7
- package/dist/themes/SolarizedLight.cjs +1 -1
- package/dist/themes/SolarizedLight.d.cts +1 -7
- package/dist/themes/SolarizedLight.d.ts +1 -7
- package/dist/themes/SolarizedLight.js +1 -1
- package/dist/themes/SynthwaveDark.d.cts +1 -7
- package/dist/themes/SynthwaveDark.d.ts +1 -7
- package/dist/themes/SynthwaveLight.cjs +1 -1
- package/dist/themes/SynthwaveLight.d.cts +3 -8
- package/dist/themes/SynthwaveLight.d.ts +3 -8
- package/dist/themes/SynthwaveLight.js +1 -1
- package/dist/themes/brands.cjs +1 -1
- package/dist/themes/brands.d.cts +3 -19
- package/dist/themes/brands.d.ts +3 -19
- package/dist/themes/brands.js +1 -1
- package/dist/themes/createBrandTheme.cjs +1 -1
- package/dist/themes/createBrandTheme.d.cts +3 -7
- package/dist/themes/createBrandTheme.d.ts +3 -7
- package/dist/themes/createBrandTheme.js +1 -1
- package/dist/themes/index.cjs +1 -1
- package/dist/themes/index.d.cts +10 -9
- package/dist/themes/index.d.ts +10 -9
- package/dist/themes/index.js +1 -1
- package/dist/themes.css +1 -1
- package/dist/tokens.css +1 -1
- package/dist/tokens.dtcg.json +14246 -0
- package/dist/utils/aliases.cjs +9 -3
- package/dist/utils/aliases.d.cts +13 -23
- package/dist/utils/aliases.d.ts +13 -23
- package/dist/utils/aliases.js +9 -3
- package/dist/utils/cssVars.cjs +2 -2
- package/dist/utils/cssVars.d.cts +11 -14
- package/dist/utils/cssVars.d.ts +11 -14
- package/dist/utils/cssVars.js +2 -2
- package/dist/utils/foundation.cjs +4 -4
- package/dist/utils/foundation.d.cts +19 -76
- package/dist/utils/foundation.d.ts +19 -76
- package/dist/utils/foundation.js +3 -3
- package/dist/utils/mode.cjs +1 -1
- package/dist/utils/mode.d.cts +7 -34
- package/dist/utils/mode.d.ts +7 -34
- package/dist/utils/mode.js +1 -1
- package/dist/utils/theme.cjs +1 -1
- package/dist/utils/theme.d.cts +24 -91
- package/dist/utils/theme.d.ts +24 -91
- package/dist/utils/toCss.cjs +5 -5
- package/dist/utils/toCss.d.cts +5 -4
- package/dist/utils/toCss.d.ts +5 -4
- package/dist/utils/toCss.js +5 -5
- package/package.json +5 -4
- package/dist/themes/MidnightBrand.cjs +0 -1
- package/dist/themes/MidnightBrand.d.cts +0 -8
- package/dist/themes/MidnightBrand.d.ts +0 -8
package/dist/utils/theme.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A theme is a plain JSON-serializable object; `themeToCss()` turns it into CSS custom properties.
|
|
3
|
-
*/
|
|
4
1
|
/**
|
|
5
2
|
* The two resolved color modes a theme renders in (resolved via `prefers-color-scheme`).
|
|
6
3
|
* @public
|
|
@@ -64,11 +61,7 @@ export interface ThemeColors {
|
|
|
64
61
|
/** Role-based colors from scales; components prefer these over raw steps. */
|
|
65
62
|
semantic: SemanticColors;
|
|
66
63
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Font stacks, type scale, weight/line-height tokens, rendered as `--skdx-font-*`.
|
|
69
|
-
* Theme-invariant except the two font stacks (see {@link ThemeTypographyDeviation}).
|
|
70
|
-
* @public
|
|
71
|
-
*/
|
|
64
|
+
/** Font stacks, type scale, weight/line-height tokens, rendered as `--skdx-font-*`; theme-invariant except the two font stacks (see {@link ThemeTypographyDeviation}). @public */
|
|
72
65
|
export interface ThemeTypography {
|
|
73
66
|
/** Body font stack. */
|
|
74
67
|
fontFamily: string;
|
|
@@ -106,10 +99,7 @@ export interface ThemeTypography {
|
|
|
106
99
|
wider: string;
|
|
107
100
|
};
|
|
108
101
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Spacing scale (margin, padding, gap), rendered as `--skdx-space-<step>`.
|
|
111
|
-
* Lives once in `foundation.ts` (see {@link space}). @public
|
|
112
|
-
*/
|
|
102
|
+
/** Spacing scale (margin, padding, gap), rendered as `--skdx-space-<step>`; lives once in `foundation.ts` (see {@link space}). @public */
|
|
113
103
|
export interface ThemeSpace {
|
|
114
104
|
'1': string;
|
|
115
105
|
'2': string;
|
|
@@ -122,10 +112,7 @@ export interface ThemeSpace {
|
|
|
122
112
|
'12': string;
|
|
123
113
|
'16': string;
|
|
124
114
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Border-radius scale, rendered as `--skdx-radius-<size>`.
|
|
127
|
-
* Lives once in `foundation.ts` (see {@link radii}). @public
|
|
128
|
-
*/
|
|
115
|
+
/** Border-radius scale, rendered as `--skdx-radius-<size>`; lives once in `foundation.ts` (see {@link radii}). @public */
|
|
129
116
|
export interface ThemeRadii {
|
|
130
117
|
sm: string;
|
|
131
118
|
/** Nested box radius (relationship between `sm` and `md`, not a size step). */
|
|
@@ -136,10 +123,7 @@ export interface ThemeRadii {
|
|
|
136
123
|
/** Fully round, for pills and circular avatars. */
|
|
137
124
|
full: string;
|
|
138
125
|
}
|
|
139
|
-
/**
|
|
140
|
-
* Control geometry: metrics Button, Input and Select snap to.
|
|
141
|
-
* Lives once in `foundation.ts` (see {@link controls}). @public
|
|
142
|
-
*/
|
|
126
|
+
/** Control geometry: metrics Button, Input and Select snap to, living once in `foundation.ts` (see {@link controls}). @public */
|
|
143
127
|
export interface ThemeControls {
|
|
144
128
|
/** Vertical rhythm, inline padding and icon gap. */
|
|
145
129
|
control: {
|
|
@@ -198,10 +182,7 @@ export interface ThemeControls {
|
|
|
198
182
|
min: string;
|
|
199
183
|
};
|
|
200
184
|
}
|
|
201
|
-
/**
|
|
202
|
-
* {@link ThemeControls} overrides for coarse pointers. Only hit-target sizes;
|
|
203
|
-
* padding, gaps, radii, icons unchanged. @public
|
|
204
|
-
*/
|
|
185
|
+
/** {@link ThemeControls} overrides for coarse pointers — only hit-target sizes; padding, gaps, radii, icons unchanged. @public */
|
|
205
186
|
export interface ThemeControlsCoarse {
|
|
206
187
|
control: {
|
|
207
188
|
height: {
|
|
@@ -222,11 +203,7 @@ export interface ThemeControlsCoarse {
|
|
|
222
203
|
min: string;
|
|
223
204
|
};
|
|
224
205
|
}
|
|
225
|
-
/**
|
|
226
|
-
* Box-shadow scale, rendered as `--skdx-shadow-<size>`. Geometry lives once
|
|
227
|
-
* in `foundation.ts` (see {@link shadows}); color defers to {@link ThemeShadowColor}.
|
|
228
|
-
* @public
|
|
229
|
-
*/
|
|
206
|
+
/** Box-shadow scale, rendered as `--skdx-shadow-<size>`; geometry lives once in `foundation.ts` (see {@link shadows}), color defers to {@link ThemeShadowColor}. @public */
|
|
230
207
|
export interface ThemeShadows {
|
|
231
208
|
sm: string;
|
|
232
209
|
md: string;
|
|
@@ -234,40 +211,20 @@ export interface ThemeShadows {
|
|
|
234
211
|
/** Elevated overlay surfaces (dialogs, popovers, dropdowns). */
|
|
235
212
|
overlay: string;
|
|
236
213
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Shadow color: the only part of {@link shadows} a theme owns;
|
|
239
|
-
* geometry lives in the base. @public
|
|
240
|
-
*/
|
|
214
|
+
/** Shadow color: the only part of {@link shadows} a theme owns; geometry lives in the base. @public */
|
|
241
215
|
export interface ThemeShadowColor {
|
|
242
216
|
/** sRGB channels (e.g. `'2 6 23'`), substituted into `rgb(<color> / <alpha>)`. */
|
|
243
217
|
color: string;
|
|
244
|
-
/**
|
|
245
|
-
* Multiplier for base alphas in {@link shadows}. `'1'` for light themes;
|
|
246
|
-
* dark themes ~`'5'` (shadow must work on dark surface).
|
|
247
|
-
*/
|
|
218
|
+
/** Multiplier for base alphas in {@link shadows}: `'1'` for light themes, ~`'5'` for dark. */
|
|
248
219
|
strength: string;
|
|
249
220
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Font stacks a theme may override (only part of {@link typography} not fixed).
|
|
252
|
-
* Only `fluent` and `material-you` declare it. @public
|
|
253
|
-
*/
|
|
221
|
+
/** Font stacks a theme may override — the only part of {@link typography} not fixed; only `fluent` and `material-you` declare it. @public */
|
|
254
222
|
export type ThemeTypographyDeviation = Partial<Pick<ThemeTypography, 'fontFamily' | 'fontFamilyMono'>>;
|
|
255
|
-
/**
|
|
256
|
-
* Motion tokens a theme may retune. Optional ones (exit, staggers) stay uniform.
|
|
257
|
-
* Only `material-you`, `fluent` and `ant-daybreak` declare. @public
|
|
258
|
-
*/
|
|
223
|
+
/** Motion tokens a theme may retune; only `material-you`, `fluent` and `ant-daybreak` declare. @public */
|
|
259
224
|
export type ThemeMotionDeviation = Partial<Pick<ThemeMotion, 'durationFast' | 'durationNormal' | 'durationSlow' | 'easing'>>;
|
|
260
|
-
/**
|
|
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
|
|
265
|
-
*/
|
|
225
|
+
/** Animation durations, easing curves, and staggers rendered as `--skdx-motion-*`; theme-invariant by default, lives once in `foundation.ts` (see {@link motion}). @public */
|
|
266
226
|
export interface ThemeMotion {
|
|
267
|
-
/**
|
|
268
|
-
* Zero for state changes that feel like data, not animation (value updates).
|
|
269
|
-
* @default '0ms'
|
|
270
|
-
*/
|
|
227
|
+
/** Zero for state changes that feel like data, not animation (value updates). @default '0ms' */
|
|
271
228
|
durationInstant?: string;
|
|
272
229
|
/** Hover/focus/press micro-interactions (direct manipulation). */
|
|
273
230
|
durationFast: string;
|
|
@@ -277,43 +234,20 @@ export interface ThemeMotion {
|
|
|
277
234
|
durationSlow: string;
|
|
278
235
|
/** Default curve: fast start, soft landing (for entering/opening). */
|
|
279
236
|
easing: string;
|
|
280
|
-
/**
|
|
281
|
-
* Mirror of {@link ThemeMotion.easing} (slow start, accelerates). For exits.
|
|
282
|
-
* @default 'cubic-bezier(0.4, 0, 1, 1)'
|
|
283
|
-
*/
|
|
237
|
+
/** Mirror of {@link ThemeMotion.easing} (slow start, accelerates), for exits. @default 'cubic-bezier(0.4, 0, 1, 1)' */
|
|
284
238
|
easingExit?: string;
|
|
285
|
-
/**
|
|
286
|
-
* Symmetric ease-in-out, no overshoot (in-place: color swaps, toggles).
|
|
287
|
-
* @default 'cubic-bezier(0.4, 0, 0.2, 1)'
|
|
288
|
-
*/
|
|
239
|
+
/** Symmetric ease-in-out, no overshoot (in-place: color swaps, toggles). @default 'cubic-bezier(0.4, 0, 0.2, 1)' */
|
|
289
240
|
easingSteady?: string;
|
|
290
|
-
/**
|
|
291
|
-
* Constant rate (indeterminate loops: spinner, shimmer).
|
|
292
|
-
* @default 'linear'
|
|
293
|
-
*/
|
|
241
|
+
/** Constant rate for indeterminate loops (spinner, shimmer). @default 'linear' */
|
|
294
242
|
easingLinear?: string;
|
|
295
|
-
/**
|
|
296
|
-
* Per-item sweep delay (reads as one gesture for large/unbounded lists).
|
|
297
|
-
* @default '4ms'
|
|
298
|
-
*/
|
|
243
|
+
/** Per-item sweep delay, reads as one gesture for large/unbounded lists. @default '4ms' */
|
|
299
244
|
staggerTight?: string;
|
|
300
|
-
/**
|
|
301
|
-
* Per-item sequence delay (distinct arrival, short/bounded lists only).
|
|
302
|
-
* @default '40ms'
|
|
303
|
-
*/
|
|
245
|
+
/** Per-item sequence delay, for distinct arrival on short/bounded lists only. @default '40ms' */
|
|
304
246
|
staggerLoose?: string;
|
|
305
247
|
}
|
|
306
|
-
/**
|
|
307
|
-
* Default motion values; merged under a theme's `motion` so every theme
|
|
308
|
-
* emits the complete `--skdx-motion-*` surface.
|
|
309
|
-
*/
|
|
248
|
+
/** Default motion values, merged under a theme's `motion` so every theme emits the complete `--skdx-motion-*` surface. */
|
|
310
249
|
export declare const defaultMotion: Required<ThemeMotion>;
|
|
311
|
-
/**
|
|
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
|
|
316
|
-
*/
|
|
250
|
+
/** Complete theme object flowing through {@link createTheme}, {@link themeToCss} and {@link applyTheme}; contains only colors, since the rest is theme-invariant (see `foundation.ts`). @public */
|
|
317
251
|
export interface Theme {
|
|
318
252
|
/** Unique theme name (e.g. `"skanda-light"`), used as `[data-skdx-theme="..."]` selector. */
|
|
319
253
|
name: string;
|
|
@@ -328,8 +262,7 @@ export interface Theme {
|
|
|
328
262
|
motion?: ThemeMotionDeviation;
|
|
329
263
|
}
|
|
330
264
|
/**
|
|
331
|
-
* Partial {@link Theme} describing only what a brand changes
|
|
332
|
-
* {@link createTheme}, which deep-merges onto a base theme.
|
|
265
|
+
* Partial {@link Theme} describing only what a brand changes, passed to {@link createTheme} which deep-merges it onto a base theme.
|
|
333
266
|
* @example
|
|
334
267
|
* ```ts
|
|
335
268
|
* const override: ThemeOverride = {
|
|
@@ -339,8 +272,8 @@ export interface Theme {
|
|
|
339
272
|
* ```
|
|
340
273
|
* @public
|
|
341
274
|
*/
|
|
342
|
-
export type ThemeOverride =
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
} : Theme[K];
|
|
275
|
+
export type ThemeOverride = DeepPartial<Theme>;
|
|
276
|
+
type DeepPartial<T> = {
|
|
277
|
+
[K in keyof T]?: (T[K] extends object ? DeepPartial<T[K]> : T[K]) | undefined;
|
|
346
278
|
};
|
|
279
|
+
export {};
|
package/dist/utils/toCss.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
2
|
-
${(0,r.varsToDeclarations)(
|
|
1
|
+
"use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var s in e)i(o,s,{get:e[s],enumerable:!0})},C=(o,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of f(e))!T.call(o,t)&&t!==s&&i(o,t,{get:()=>e[t],enumerable:!(n=u(e,t))||n.enumerable});return o};var h=o=>C(i({},"__esModule",{value:!0}),o);var V={};l(V,{applyTheme:()=>x,themeToCss:()=>y,themeToCssVars:()=>a});module.exports=h(V);var r=require("./cssVars.cjs"),m=require("./theme.cjs");function a(o){return(0,r.sectionsToCssVars)([["color",o.colors],["shadow",o.shadow],["font",o.typography],["motion",o.motion?{...m.defaultMotion,...o.motion}:void 0]])}function y(o,e={}){let s=e.selector??`[data-skdx-theme="${o.name}"]`,n=a(o),t=`${s} {
|
|
2
|
+
${(0,r.varsToDeclarations)(n)}
|
|
3
3
|
}
|
|
4
|
-
`,c=(0,r.reducedMotionVarNames)(
|
|
4
|
+
`,c=(0,r.reducedMotionVarNames)(n);if(c.length===0)return t;let d=c.map(p=>` ${p}: 0ms;`);return t+`@media (prefers-reduced-motion: reduce) {
|
|
5
5
|
${s} {
|
|
6
|
-
${
|
|
6
|
+
${d.join(`
|
|
7
7
|
`)}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
`}function
|
|
10
|
+
`}function x(o,e=document.documentElement){let s=a(o);for(let[n,t]of Object.entries(s))e.style.setProperty(n,t);e.setAttribute("data-skdx-theme",o.name),e.setAttribute("data-skdx-mode",o.mode)}0&&(module.exports={applyTheme,themeToCss,themeToCssVars});
|
package/dist/utils/toCss.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CssVar } from './cssVars.cjs';
|
|
1
2
|
import { type Theme } from './theme.cjs';
|
|
2
3
|
/**
|
|
3
4
|
* Flatten {@link Theme} into `{ '--skdx-…': value }` map. Colors only
|
|
@@ -9,7 +10,7 @@ import { type Theme } from './theme.cjs';
|
|
|
9
10
|
* ```
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
|
-
export declare function themeToCssVars(theme: Theme): Record<
|
|
13
|
+
export declare function themeToCssVars(theme: Theme): Record<CssVar, string>;
|
|
13
14
|
/** Options for {@link themeToCss}. @public */
|
|
14
15
|
export interface ThemeToCssOptions {
|
|
15
16
|
/**
|
|
@@ -44,9 +45,9 @@ export declare function themeToCss(theme: Theme, options?: ThemeToCssOptions): s
|
|
|
44
45
|
* @param element - Target element. @default document.documentElement
|
|
45
46
|
* @example
|
|
46
47
|
* ```ts
|
|
47
|
-
* import { applyTheme,
|
|
48
|
-
* applyTheme(
|
|
49
|
-
* applyTheme(
|
|
48
|
+
* import { applyTheme, midnightDark } from '@skdx/tokens';
|
|
49
|
+
* applyTheme(midnightDark); // whole page
|
|
50
|
+
* applyTheme(midnightDark, el); // scoped
|
|
50
51
|
* ```
|
|
51
52
|
* @public
|
|
52
53
|
*/
|
package/dist/utils/toCss.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CssVar } from './cssVars.js';
|
|
1
2
|
import { type Theme } from './theme.js';
|
|
2
3
|
/**
|
|
3
4
|
* Flatten {@link Theme} into `{ '--skdx-…': value }` map. Colors only
|
|
@@ -9,7 +10,7 @@ import { type Theme } from './theme.js';
|
|
|
9
10
|
* ```
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
|
-
export declare function themeToCssVars(theme: Theme): Record<
|
|
13
|
+
export declare function themeToCssVars(theme: Theme): Record<CssVar, string>;
|
|
13
14
|
/** Options for {@link themeToCss}. @public */
|
|
14
15
|
export interface ThemeToCssOptions {
|
|
15
16
|
/**
|
|
@@ -44,9 +45,9 @@ export declare function themeToCss(theme: Theme, options?: ThemeToCssOptions): s
|
|
|
44
45
|
* @param element - Target element. @default document.documentElement
|
|
45
46
|
* @example
|
|
46
47
|
* ```ts
|
|
47
|
-
* import { applyTheme,
|
|
48
|
-
* applyTheme(
|
|
49
|
-
* applyTheme(
|
|
48
|
+
* import { applyTheme, midnightDark } from '@skdx/tokens';
|
|
49
|
+
* applyTheme(midnightDark); // whole page
|
|
50
|
+
* applyTheme(midnightDark, el); // scoped
|
|
50
51
|
* ```
|
|
51
52
|
* @public
|
|
52
53
|
*/
|
package/dist/utils/toCss.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{reducedMotionVarNames as
|
|
2
|
-
${
|
|
1
|
+
import{reducedMotionVarNames as m,sectionsToCssVars as d,varsToDeclarations as p}from"./cssVars.js";import{defaultMotion as u}from"./theme.js";function i(o){return d([["color",o.colors],["shadow",o.shadow],["font",o.typography],["motion",o.motion?{...u,...o.motion}:void 0]])}function l(o,e={}){let t=e.selector??`[data-skdx-theme="${o.name}"]`,s=i(o),n=`${t} {
|
|
2
|
+
${p(s)}
|
|
3
3
|
}
|
|
4
|
-
`,r=
|
|
5
|
-
${
|
|
4
|
+
`,r=m(s);if(r.length===0)return n;let a=r.map(c=>` ${c}: 0ms;`);return n+`@media (prefers-reduced-motion: reduce) {
|
|
5
|
+
${t} {
|
|
6
6
|
${a.join(`
|
|
7
7
|
`)}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
`}function
|
|
10
|
+
`}function C(o,e=document.documentElement){let t=i(o);for(let[s,n]of Object.entries(t))e.style.setProperty(s,n);e.setAttribute("data-skdx-theme",o.name),e.setAttribute("data-skdx-mode",o.mode)}export{C as applyTheme,l as themeToCss,i as themeToCssVars};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skdx/tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "Theme contract and design tokens for the SkandaDX design system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">=24.15.0"
|
|
21
21
|
},
|
|
22
22
|
"main": "./dist/index.cjs",
|
|
23
23
|
"module": "./dist/index.js",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"./css": "./dist/tokens.css",
|
|
42
42
|
"./foundation.css": "./dist/foundation.css",
|
|
43
43
|
"./themes.css": "./dist/themes.css",
|
|
44
|
+
"./tokens.dtcg.json": "./dist/tokens.dtcg.json",
|
|
44
45
|
"./package.json": "./package.json"
|
|
45
46
|
},
|
|
46
47
|
"sideEffects": [
|
|
@@ -60,9 +61,9 @@
|
|
|
60
61
|
"vitest": "^4.1.10"
|
|
61
62
|
},
|
|
62
63
|
"scripts": {
|
|
63
|
-
"
|
|
64
|
+
"lint": "eslint . --cache --cache-location node_modules/.cache/eslint/",
|
|
65
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsup && tsc --emitDeclarationOnly -p tsconfig.build.json && node ../../scripts/declarations-cjs.mjs && node scripts/build-css.mjs && node scripts/build-dtcg.mjs && node ../../scripts/minify-css.mjs dist",
|
|
64
66
|
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo",
|
|
65
|
-
"export:dtcg": "node scripts/export-dtcg.mjs",
|
|
66
67
|
"test": "vitest run",
|
|
67
68
|
"test:watch": "vitest",
|
|
68
69
|
"test:coverage": "vitest run --coverage"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(e,r)=>{for(var m in r)o(e,m,{get:r[m],enumerable:!0})},u=(e,r,m,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of i(r))!h.call(e,a)&&a!==m&&o(e,a,{get:()=>r[a],enumerable:!(n=d(r,a))||n.enumerable});return e};var c=e=>u(o({},"__esModule",{value:!0}),e);var l={};p(l,{midnightBrand:()=>g});module.exports=c(l);var t=require("./createBrandTheme.cjs"),g=(0,t.createBrandTheme)({name:"midnight-brand",mode:"dark",primaryHue:271,primaryChroma:91,neutralHue:265,neutralChroma:25,override:{shadow:{color:"0 0 0",strength:"5.2"}}});0&&(module.exports={midnightBrand});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Midnight purple dark theme: violet actions on deep indigo surfaces.
|
|
3
|
-
* Generated from `BrandSeed` via {@link createBrandTheme}, which drives
|
|
4
|
-
* every WCAG AA pair to threshold. Shadow stack is hand-tuned.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare const midnightBrand: import("../index.cjs").Theme;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Midnight purple dark theme: violet actions on deep indigo surfaces.
|
|
3
|
-
* Generated from `BrandSeed` via {@link createBrandTheme}, which drives
|
|
4
|
-
* every WCAG AA pair to threshold. Shadow stack is hand-tuned.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare const midnightBrand: import("../index.js").Theme;
|