@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.
Files changed (184) hide show
  1. package/README.md +16 -13
  2. package/dist/foundation.css +1 -1
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.cts +3 -2
  5. package/dist/index.d.ts +3 -2
  6. package/dist/index.js +1 -1
  7. package/dist/themes/AntDark.cjs +1 -1
  8. package/dist/themes/AntDark.d.cts +3 -8
  9. package/dist/themes/AntDark.d.ts +3 -8
  10. package/dist/themes/AntDark.js +1 -1
  11. package/dist/themes/{AntBrand.cjs → AntLight.cjs} +1 -1
  12. package/dist/themes/{AntBrand.d.cts → AntLight.d.cts} +1 -1
  13. package/dist/themes/{AntBrand.d.ts → AntLight.d.ts} +1 -1
  14. package/dist/themes/{AntBrand.js → AntLight.js} +1 -1
  15. package/dist/themes/CatppuccinLatte.cjs +1 -1
  16. package/dist/themes/CatppuccinLatte.d.cts +1 -7
  17. package/dist/themes/CatppuccinLatte.d.ts +1 -7
  18. package/dist/themes/CatppuccinLatte.js +1 -1
  19. package/dist/themes/CatppuccinMocha.cjs +1 -1
  20. package/dist/themes/CatppuccinMocha.d.cts +1 -7
  21. package/dist/themes/CatppuccinMocha.d.ts +1 -7
  22. package/dist/themes/CatppuccinMocha.js +1 -1
  23. package/dist/themes/ChakraDark.cjs +1 -1
  24. package/dist/themes/ChakraDark.d.cts +3 -8
  25. package/dist/themes/ChakraDark.d.ts +3 -8
  26. package/dist/themes/ChakraDark.js +1 -1
  27. package/dist/themes/{ChakraBrand.cjs → ChakraLight.cjs} +1 -1
  28. package/dist/themes/{ChakraBrand.d.cts → ChakraLight.d.cts} +1 -1
  29. package/dist/themes/{ChakraBrand.d.ts → ChakraLight.d.ts} +1 -1
  30. package/dist/themes/{ChakraBrand.js → ChakraLight.js} +1 -1
  31. package/dist/themes/CupcakeDark.cjs +1 -1
  32. package/dist/themes/CupcakeDark.d.cts +3 -5
  33. package/dist/themes/CupcakeDark.d.ts +3 -5
  34. package/dist/themes/CupcakeLight.cjs +1 -1
  35. package/dist/themes/CupcakeLight.d.cts +1 -8
  36. package/dist/themes/CupcakeLight.d.ts +1 -8
  37. package/dist/themes/CupcakeLight.js +1 -1
  38. package/dist/themes/DefaultTheme.cjs +1 -1
  39. package/dist/themes/DefaultTheme.d.cts +3 -14
  40. package/dist/themes/DefaultTheme.d.ts +3 -14
  41. package/dist/themes/DefaultTheme.js +1 -1
  42. package/dist/themes/DraculaLight.cjs +1 -1
  43. package/dist/themes/DraculaLight.d.cts +2 -1
  44. package/dist/themes/DraculaLight.d.ts +2 -1
  45. package/dist/themes/DraculaLight.js +1 -1
  46. package/dist/themes/EmeraldDark.cjs +1 -1
  47. package/dist/themes/EmeraldDark.d.cts +3 -8
  48. package/dist/themes/EmeraldDark.d.ts +3 -8
  49. package/dist/themes/EmeraldDark.js +1 -1
  50. package/dist/themes/{EmeraldBrand.cjs → EmeraldLight.cjs} +1 -1
  51. package/dist/themes/{EmeraldBrand.d.cts → EmeraldLight.d.cts} +1 -1
  52. package/dist/themes/{EmeraldBrand.d.ts → EmeraldLight.d.ts} +1 -1
  53. package/dist/themes/{EmeraldBrand.js → EmeraldLight.js} +1 -1
  54. package/dist/themes/EverforestDark.cjs +1 -1
  55. package/dist/themes/EverforestDark.js +1 -1
  56. package/dist/themes/EverforestLight.cjs +1 -1
  57. package/dist/themes/EverforestLight.d.cts +3 -5
  58. package/dist/themes/EverforestLight.d.ts +3 -5
  59. package/dist/themes/FluentDark.cjs +1 -1
  60. package/dist/themes/FluentDark.d.cts +3 -7
  61. package/dist/themes/FluentDark.d.ts +3 -7
  62. package/dist/themes/FluentDark.js +1 -1
  63. package/dist/themes/{FluentBrand.cjs → FluentLight.cjs} +1 -1
  64. package/dist/themes/{FluentBrand.d.cts → FluentLight.d.cts} +1 -1
  65. package/dist/themes/{FluentBrand.d.ts → FluentLight.d.ts} +1 -1
  66. package/dist/themes/{FluentBrand.js → FluentLight.js} +1 -1
  67. package/dist/themes/GraphiteDark.cjs +1 -1
  68. package/dist/themes/GraphiteDark.d.cts +3 -8
  69. package/dist/themes/GraphiteDark.d.ts +3 -8
  70. package/dist/themes/GraphiteDark.js +1 -1
  71. package/dist/themes/{GraphiteBrand.cjs → GraphiteLight.cjs} +1 -1
  72. package/dist/themes/{GraphiteBrand.d.cts → GraphiteLight.d.cts} +1 -1
  73. package/dist/themes/{GraphiteBrand.d.ts → GraphiteLight.d.ts} +1 -1
  74. package/dist/themes/{GraphiteBrand.js → GraphiteLight.js} +1 -1
  75. package/dist/themes/GruvboxDark.cjs +1 -1
  76. package/dist/themes/GruvboxDark.d.cts +1 -7
  77. package/dist/themes/GruvboxDark.d.ts +1 -7
  78. package/dist/themes/GruvboxDark.js +1 -1
  79. package/dist/themes/GruvboxLight.cjs +1 -1
  80. package/dist/themes/GruvboxLight.d.cts +3 -12
  81. package/dist/themes/GruvboxLight.d.ts +3 -12
  82. package/dist/themes/GruvboxLight.js +1 -1
  83. package/dist/themes/MaterialDark.cjs +1 -1
  84. package/dist/themes/MaterialDark.d.cts +3 -8
  85. package/dist/themes/MaterialDark.d.ts +3 -8
  86. package/dist/themes/MaterialDark.js +1 -1
  87. package/dist/themes/{MaterialBrand.cjs → MaterialLight.cjs} +1 -1
  88. package/dist/themes/{MaterialBrand.d.cts → MaterialLight.d.cts} +1 -1
  89. package/dist/themes/{MaterialBrand.d.ts → MaterialLight.d.ts} +1 -1
  90. package/dist/themes/{MaterialBrand.js → MaterialLight.js} +1 -1
  91. package/dist/themes/MidnightDark.cjs +1 -0
  92. package/dist/themes/MidnightDark.d.cts +3 -0
  93. package/dist/themes/MidnightDark.d.ts +3 -0
  94. package/dist/themes/{MidnightBrand.js → MidnightDark.js} +1 -1
  95. package/dist/themes/MidnightLight.cjs +1 -1
  96. package/dist/themes/MidnightLight.d.cts +2 -1
  97. package/dist/themes/MidnightLight.d.ts +2 -1
  98. package/dist/themes/MidnightLight.js +1 -1
  99. package/dist/themes/NordDark.cjs +1 -1
  100. package/dist/themes/NordDark.js +1 -1
  101. package/dist/themes/NordLight.cjs +1 -1
  102. package/dist/themes/NordLight.d.cts +3 -12
  103. package/dist/themes/NordLight.d.ts +3 -12
  104. package/dist/themes/NordLight.js +1 -1
  105. package/dist/themes/OneDark.cjs +1 -1
  106. package/dist/themes/OneDark.d.cts +1 -7
  107. package/dist/themes/OneDark.d.ts +1 -7
  108. package/dist/themes/OneDark.js +1 -1
  109. package/dist/themes/OneLight.cjs +1 -1
  110. package/dist/themes/OneLight.d.cts +3 -5
  111. package/dist/themes/OneLight.d.ts +3 -5
  112. package/dist/themes/OneLight.js +1 -1
  113. package/dist/themes/PrimerDark.cjs +1 -1
  114. package/dist/themes/PrimerDark.js +1 -1
  115. package/dist/themes/PrimerLight.d.cts +1 -7
  116. package/dist/themes/PrimerLight.d.ts +1 -7
  117. package/dist/themes/RosePine.cjs +1 -1
  118. package/dist/themes/RosePine.d.cts +1 -7
  119. package/dist/themes/RosePine.d.ts +1 -7
  120. package/dist/themes/RosePine.js +1 -1
  121. package/dist/themes/RosePineDawn.cjs +1 -1
  122. package/dist/themes/RosePineDawn.d.cts +3 -5
  123. package/dist/themes/RosePineDawn.d.ts +3 -5
  124. package/dist/themes/RosePineDawn.js +1 -1
  125. package/dist/themes/SkandaDark.cjs +1 -1
  126. package/dist/themes/SkandaDark.d.cts +2 -1
  127. package/dist/themes/SkandaDark.d.ts +2 -1
  128. package/dist/themes/SkandaDark.js +1 -1
  129. package/dist/themes/SkandaLight.cjs +1 -1
  130. package/dist/themes/SkandaLight.js +1 -1
  131. package/dist/themes/SolarizedDark.d.cts +1 -7
  132. package/dist/themes/SolarizedDark.d.ts +1 -7
  133. package/dist/themes/SolarizedLight.cjs +1 -1
  134. package/dist/themes/SolarizedLight.d.cts +1 -7
  135. package/dist/themes/SolarizedLight.d.ts +1 -7
  136. package/dist/themes/SolarizedLight.js +1 -1
  137. package/dist/themes/SynthwaveDark.d.cts +1 -7
  138. package/dist/themes/SynthwaveDark.d.ts +1 -7
  139. package/dist/themes/SynthwaveLight.cjs +1 -1
  140. package/dist/themes/SynthwaveLight.d.cts +3 -8
  141. package/dist/themes/SynthwaveLight.d.ts +3 -8
  142. package/dist/themes/SynthwaveLight.js +1 -1
  143. package/dist/themes/brands.cjs +1 -1
  144. package/dist/themes/brands.d.cts +3 -19
  145. package/dist/themes/brands.d.ts +3 -19
  146. package/dist/themes/brands.js +1 -1
  147. package/dist/themes/createBrandTheme.cjs +1 -1
  148. package/dist/themes/createBrandTheme.d.cts +3 -7
  149. package/dist/themes/createBrandTheme.d.ts +3 -7
  150. package/dist/themes/createBrandTheme.js +1 -1
  151. package/dist/themes/index.cjs +1 -1
  152. package/dist/themes/index.d.cts +10 -9
  153. package/dist/themes/index.d.ts +10 -9
  154. package/dist/themes/index.js +1 -1
  155. package/dist/themes.css +1 -1
  156. package/dist/tokens.css +1 -1
  157. package/dist/tokens.dtcg.json +14246 -0
  158. package/dist/utils/aliases.cjs +9 -3
  159. package/dist/utils/aliases.d.cts +13 -23
  160. package/dist/utils/aliases.d.ts +13 -23
  161. package/dist/utils/aliases.js +9 -3
  162. package/dist/utils/cssVars.cjs +2 -2
  163. package/dist/utils/cssVars.d.cts +11 -14
  164. package/dist/utils/cssVars.d.ts +11 -14
  165. package/dist/utils/cssVars.js +2 -2
  166. package/dist/utils/foundation.cjs +4 -4
  167. package/dist/utils/foundation.d.cts +19 -76
  168. package/dist/utils/foundation.d.ts +19 -76
  169. package/dist/utils/foundation.js +3 -3
  170. package/dist/utils/mode.cjs +1 -1
  171. package/dist/utils/mode.d.cts +7 -34
  172. package/dist/utils/mode.d.ts +7 -34
  173. package/dist/utils/mode.js +1 -1
  174. package/dist/utils/theme.cjs +1 -1
  175. package/dist/utils/theme.d.cts +24 -91
  176. package/dist/utils/theme.d.ts +24 -91
  177. package/dist/utils/toCss.cjs +5 -5
  178. package/dist/utils/toCss.d.cts +5 -4
  179. package/dist/utils/toCss.d.ts +5 -4
  180. package/dist/utils/toCss.js +5 -5
  181. package/package.json +5 -4
  182. package/dist/themes/MidnightBrand.cjs +0 -1
  183. package/dist/themes/MidnightBrand.d.cts +0 -8
  184. package/dist/themes/MidnightBrand.d.ts +0 -8
@@ -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. Passed to
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
- [K in keyof Theme]?: Theme[K] extends object ? {
344
- [K2 in keyof Theme[K]]?: Theme[K][K2] extends object ? Partial<Theme[K][K2]> : Theme[K][K2];
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 {};
@@ -1,10 +1,10 @@
1
- "use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var l=(n,o)=>{for(var s in o)i(n,s,{get:o[s],enumerable:!0})},k=(n,o,s,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of f(o))!T.call(n,e)&&e!==s&&i(n,e,{get:()=>o[e],enumerable:!(t=p(o,e))||t.enumerable});return n};var g=n=>k(i({},"__esModule",{value:!0}),n);var x={};l(x,{applyTheme:()=>h,themeToCss:()=>w,themeToCssVars:()=>a});module.exports=g(x);var r=require("./cssVars.cjs"),d=require("./theme.cjs");function a(n){return(0,r.sectionsToCssVars)([["color",n.colors],["shadow",n.shadow],["font",n.typography],["motion",n.motion?{...d.defaultMotion,...n.motion}:void 0]])}function w(n,o={}){let s=o.selector??`[data-skdx-theme="${n.name}"]`,t=a(n),e=`${s} {
2
- ${(0,r.varsToDeclarations)(t)}
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)(t);if(c.length===0)return e;let m=c.map(u=>` ${u}: 0ms;`);return e+`@media (prefers-reduced-motion: reduce) {
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
- ${m.join(`
6
+ ${d.join(`
7
7
  `)}
8
8
  }
9
9
  }
10
- `}function h(n,o=document.documentElement){let s=a(n);for(let[t,e]of Object.entries(s))o.style.setProperty(t,e);o.setAttribute("data-skdx-theme",n.name),o.setAttribute("data-skdx-mode",n.mode)}0&&(module.exports={applyTheme,themeToCss,themeToCssVars});
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});
@@ -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<string, string>;
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, midnightBrand } from '@skdx/tokens';
48
- * applyTheme(midnightBrand); // whole page
49
- * applyTheme(midnightBrand, el); // scoped
48
+ * import { applyTheme, midnightDark } from '@skdx/tokens';
49
+ * applyTheme(midnightDark); // whole page
50
+ * applyTheme(midnightDark, el); // scoped
50
51
  * ```
51
52
  * @public
52
53
  */
@@ -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<string, string>;
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, midnightBrand } from '@skdx/tokens';
48
- * applyTheme(midnightBrand); // whole page
49
- * applyTheme(midnightBrand, el); // scoped
48
+ * import { applyTheme, midnightDark } from '@skdx/tokens';
49
+ * applyTheme(midnightDark); // whole page
50
+ * applyTheme(midnightDark, el); // scoped
50
51
  * ```
51
52
  * @public
52
53
  */
@@ -1,10 +1,10 @@
1
- import{reducedMotionVarNames as d,sectionsToCssVars as m,varsToDeclarations as u}from"./cssVars.js";import{defaultMotion as p}from"./theme.js";function i(n){return m([["color",n.colors],["shadow",n.shadow],["font",n.typography],["motion",n.motion?{...p,...n.motion}:void 0]])}function l(n,o={}){let e=o.selector??`[data-skdx-theme="${n.name}"]`,s=i(n),t=`${e} {
2
- ${u(s)}
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=d(s);if(r.length===0)return t;let a=r.map(c=>` ${c}: 0ms;`);return t+`@media (prefers-reduced-motion: reduce) {
5
- ${e} {
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 k(n,o=document.documentElement){let e=i(n);for(let[s,t]of Object.entries(e))o.style.setProperty(s,t);o.setAttribute("data-skdx-theme",n.name),o.setAttribute("data-skdx-mode",n.mode)}export{k as applyTheme,l as themeToCss,i as themeToCssVars};
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.28.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": ">=18.18.0"
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
- "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/minify-css.mjs dist",
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;