@skdx/tokens 0.26.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 +439 -0
- package/dist/foundation.css +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -0
- package/dist/themes/AntBrand.cjs +1 -0
- package/dist/themes/AntBrand.d.cts +3 -0
- package/dist/themes/AntBrand.d.ts +3 -0
- package/dist/themes/AntBrand.js +1 -0
- package/dist/themes/AntDark.cjs +1 -0
- package/dist/themes/AntDark.d.cts +12 -0
- package/dist/themes/AntDark.d.ts +12 -0
- package/dist/themes/AntDark.js +1 -0
- package/dist/themes/CatppuccinLatte.cjs +1 -0
- package/dist/themes/CatppuccinLatte.d.cts +9 -0
- package/dist/themes/CatppuccinLatte.d.ts +9 -0
- package/dist/themes/CatppuccinLatte.js +1 -0
- package/dist/themes/CatppuccinMocha.cjs +1 -0
- package/dist/themes/CatppuccinMocha.d.cts +9 -0
- package/dist/themes/CatppuccinMocha.d.ts +9 -0
- package/dist/themes/CatppuccinMocha.js +1 -0
- package/dist/themes/ChakraBrand.cjs +1 -0
- package/dist/themes/ChakraBrand.d.cts +3 -0
- package/dist/themes/ChakraBrand.d.ts +3 -0
- package/dist/themes/ChakraBrand.js +1 -0
- package/dist/themes/ChakraDark.cjs +1 -0
- package/dist/themes/ChakraDark.d.cts +12 -0
- package/dist/themes/ChakraDark.d.ts +12 -0
- package/dist/themes/ChakraDark.js +1 -0
- package/dist/themes/CupcakeDark.cjs +1 -0
- package/dist/themes/CupcakeDark.d.cts +9 -0
- package/dist/themes/CupcakeDark.d.ts +9 -0
- package/dist/themes/CupcakeDark.js +1 -0
- package/dist/themes/CupcakeLight.cjs +1 -0
- package/dist/themes/CupcakeLight.d.cts +10 -0
- package/dist/themes/CupcakeLight.d.ts +10 -0
- package/dist/themes/CupcakeLight.js +1 -0
- package/dist/themes/DefaultTheme.cjs +1 -0
- package/dist/themes/DefaultTheme.d.cts +37 -0
- package/dist/themes/DefaultTheme.d.ts +37 -0
- package/dist/themes/DefaultTheme.js +1 -0
- package/dist/themes/DraculaDark.cjs +1 -0
- package/dist/themes/DraculaDark.d.cts +3 -0
- package/dist/themes/DraculaDark.d.ts +3 -0
- package/dist/themes/DraculaDark.js +1 -0
- package/dist/themes/DraculaLight.cjs +1 -0
- package/dist/themes/DraculaLight.d.cts +14 -0
- package/dist/themes/DraculaLight.d.ts +14 -0
- package/dist/themes/DraculaLight.js +1 -0
- package/dist/themes/EmeraldBrand.cjs +1 -0
- package/dist/themes/EmeraldBrand.d.cts +3 -0
- package/dist/themes/EmeraldBrand.d.ts +3 -0
- package/dist/themes/EmeraldBrand.js +1 -0
- package/dist/themes/EmeraldDark.cjs +1 -0
- package/dist/themes/EmeraldDark.d.cts +8 -0
- package/dist/themes/EmeraldDark.d.ts +8 -0
- package/dist/themes/EmeraldDark.js +1 -0
- package/dist/themes/EverforestDark.cjs +1 -0
- package/dist/themes/EverforestDark.d.cts +9 -0
- package/dist/themes/EverforestDark.d.ts +9 -0
- package/dist/themes/EverforestDark.js +1 -0
- package/dist/themes/EverforestLight.cjs +1 -0
- package/dist/themes/EverforestLight.d.cts +13 -0
- package/dist/themes/EverforestLight.d.ts +13 -0
- package/dist/themes/EverforestLight.js +1 -0
- package/dist/themes/FluentBrand.cjs +1 -0
- package/dist/themes/FluentBrand.d.cts +3 -0
- package/dist/themes/FluentBrand.d.ts +3 -0
- package/dist/themes/FluentBrand.js +1 -0
- package/dist/themes/FluentDark.cjs +1 -0
- package/dist/themes/FluentDark.d.cts +11 -0
- package/dist/themes/FluentDark.d.ts +11 -0
- package/dist/themes/FluentDark.js +1 -0
- package/dist/themes/GraphiteBrand.cjs +1 -0
- package/dist/themes/GraphiteBrand.d.cts +3 -0
- package/dist/themes/GraphiteBrand.d.ts +3 -0
- package/dist/themes/GraphiteBrand.js +1 -0
- package/dist/themes/GraphiteDark.cjs +1 -0
- package/dist/themes/GraphiteDark.d.cts +8 -0
- package/dist/themes/GraphiteDark.d.ts +8 -0
- package/dist/themes/GraphiteDark.js +1 -0
- package/dist/themes/GruvboxDark.cjs +1 -0
- package/dist/themes/GruvboxDark.d.cts +9 -0
- package/dist/themes/GruvboxDark.d.ts +9 -0
- package/dist/themes/GruvboxDark.js +1 -0
- package/dist/themes/GruvboxLight.cjs +1 -0
- package/dist/themes/GruvboxLight.d.cts +13 -0
- package/dist/themes/GruvboxLight.d.ts +13 -0
- package/dist/themes/GruvboxLight.js +1 -0
- package/dist/themes/MaterialBrand.cjs +1 -0
- package/dist/themes/MaterialBrand.d.cts +3 -0
- package/dist/themes/MaterialBrand.d.ts +3 -0
- package/dist/themes/MaterialBrand.js +1 -0
- package/dist/themes/MaterialDark.cjs +1 -0
- package/dist/themes/MaterialDark.d.cts +12 -0
- package/dist/themes/MaterialDark.d.ts +12 -0
- package/dist/themes/MaterialDark.js +1 -0
- package/dist/themes/MidnightBrand.cjs +1 -0
- package/dist/themes/MidnightBrand.d.cts +11 -0
- package/dist/themes/MidnightBrand.d.ts +11 -0
- package/dist/themes/MidnightBrand.js +1 -0
- package/dist/themes/MidnightLight.cjs +1 -0
- package/dist/themes/MidnightLight.d.cts +10 -0
- package/dist/themes/MidnightLight.d.ts +10 -0
- package/dist/themes/MidnightLight.js +1 -0
- package/dist/themes/NordDark.cjs +1 -0
- package/dist/themes/NordDark.d.cts +3 -0
- package/dist/themes/NordDark.d.ts +3 -0
- package/dist/themes/NordDark.js +1 -0
- package/dist/themes/NordLight.cjs +1 -0
- package/dist/themes/NordLight.d.cts +13 -0
- package/dist/themes/NordLight.d.ts +13 -0
- package/dist/themes/NordLight.js +1 -0
- package/dist/themes/OneDark.cjs +1 -0
- package/dist/themes/OneDark.d.cts +9 -0
- package/dist/themes/OneDark.d.ts +9 -0
- package/dist/themes/OneDark.js +1 -0
- package/dist/themes/OneLight.cjs +1 -0
- package/dist/themes/OneLight.d.cts +13 -0
- package/dist/themes/OneLight.d.ts +13 -0
- package/dist/themes/OneLight.js +1 -0
- package/dist/themes/PrimerDark.cjs +1 -0
- package/dist/themes/PrimerDark.d.cts +9 -0
- package/dist/themes/PrimerDark.d.ts +9 -0
- package/dist/themes/PrimerDark.js +1 -0
- package/dist/themes/PrimerLight.cjs +1 -0
- package/dist/themes/PrimerLight.d.cts +9 -0
- package/dist/themes/PrimerLight.d.ts +9 -0
- package/dist/themes/PrimerLight.js +1 -0
- package/dist/themes/RosePine.cjs +1 -0
- package/dist/themes/RosePine.d.cts +9 -0
- package/dist/themes/RosePine.d.ts +9 -0
- package/dist/themes/RosePine.js +1 -0
- package/dist/themes/RosePineDawn.cjs +1 -0
- package/dist/themes/RosePineDawn.d.cts +13 -0
- package/dist/themes/RosePineDawn.d.ts +13 -0
- package/dist/themes/RosePineDawn.js +1 -0
- package/dist/themes/SkandaDark.cjs +1 -0
- package/dist/themes/SkandaDark.d.cts +12 -0
- package/dist/themes/SkandaDark.d.ts +12 -0
- package/dist/themes/SkandaDark.js +1 -0
- package/dist/themes/SkandaLight.cjs +1 -0
- package/dist/themes/SkandaLight.d.cts +3 -0
- package/dist/themes/SkandaLight.d.ts +3 -0
- package/dist/themes/SkandaLight.js +1 -0
- package/dist/themes/SolarizedDark.cjs +1 -0
- package/dist/themes/SolarizedDark.d.cts +9 -0
- package/dist/themes/SolarizedDark.d.ts +9 -0
- package/dist/themes/SolarizedDark.js +1 -0
- package/dist/themes/SolarizedLight.cjs +1 -0
- package/dist/themes/SolarizedLight.d.cts +9 -0
- package/dist/themes/SolarizedLight.d.ts +9 -0
- package/dist/themes/SolarizedLight.js +1 -0
- package/dist/themes/SynthwaveDark.cjs +1 -0
- package/dist/themes/SynthwaveDark.d.cts +9 -0
- package/dist/themes/SynthwaveDark.d.ts +9 -0
- package/dist/themes/SynthwaveDark.js +1 -0
- package/dist/themes/SynthwaveLight.cjs +1 -0
- package/dist/themes/SynthwaveLight.d.cts +12 -0
- package/dist/themes/SynthwaveLight.d.ts +12 -0
- package/dist/themes/SynthwaveLight.js +1 -0
- package/dist/themes/brands.cjs +1 -0
- package/dist/themes/brands.d.cts +41 -0
- package/dist/themes/brands.d.ts +41 -0
- package/dist/themes/brands.js +1 -0
- package/dist/themes/createBrandTheme.cjs +1 -0
- package/dist/themes/createBrandTheme.d.cts +55 -0
- package/dist/themes/createBrandTheme.d.ts +55 -0
- package/dist/themes/createBrandTheme.js +1 -0
- package/dist/themes/index.cjs +1 -0
- package/dist/themes/index.d.cts +41 -0
- package/dist/themes/index.d.ts +41 -0
- package/dist/themes/index.js +1 -0
- package/dist/themes.css +1 -0
- package/dist/tokens.css +1 -0
- package/dist/utils/aliases.cjs +9 -0
- package/dist/utils/aliases.d.cts +121 -0
- package/dist/utils/aliases.d.ts +121 -0
- package/dist/utils/aliases.js +9 -0
- package/dist/utils/contrast.cjs +1 -0
- package/dist/utils/contrast.d.cts +27 -0
- package/dist/utils/contrast.d.ts +27 -0
- package/dist/utils/contrast.js +1 -0
- package/dist/utils/cssVars.cjs +2 -0
- package/dist/utils/cssVars.d.cts +37 -0
- package/dist/utils/cssVars.d.ts +37 -0
- package/dist/utils/cssVars.js +2 -0
- package/dist/utils/foundation.cjs +15 -0
- package/dist/utils/foundation.d.cts +300 -0
- package/dist/utils/foundation.d.ts +300 -0
- package/dist/utils/foundation.js +15 -0
- package/dist/utils/mode.cjs +1 -0
- package/dist/utils/mode.d.cts +89 -0
- package/dist/utils/mode.d.ts +89 -0
- package/dist/utils/mode.js +1 -0
- package/dist/utils/theme.cjs +1 -0
- package/dist/utils/theme.d.cts +503 -0
- package/dist/utils/theme.d.ts +503 -0
- package/dist/utils/theme.js +1 -0
- package/dist/utils/toCss.cjs +10 -0
- package/dist/utils/toCss.d.cts +92 -0
- package/dist/utils/toCss.d.ts +92 -0
- package/dist/utils/toCss.js +10 -0
- package/package.json +70 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The semantic alias layer: the vocabulary component skins are allowed to name.
|
|
3
|
+
*
|
|
4
|
+
* Why this file exists
|
|
5
|
+
* -------------------
|
|
6
|
+
* `@skdx/skins` is forbidden from containing a colour literal — every colour
|
|
7
|
+
* it declares must resolve through a token. But the surface a theme actually
|
|
8
|
+
* defines is small: five ramps (`primary`, `neutral`, `success`, `warning`,
|
|
9
|
+
* `danger`) and ten `semantic` entries. A button skin needs more than that. It
|
|
10
|
+
* needs to say "the background of a pressed primary action" and "the border of
|
|
11
|
+
* an invalid field", and neither exists as a theme-authored token.
|
|
12
|
+
*
|
|
13
|
+
* The naive fix is to add those names to `SemanticColors` and set them in all
|
|
14
|
+
* 38 themes. That is 38 files edited per alias added, and every one of those
|
|
15
|
+
* edits is a chance for a theme to drift out of step with the others.
|
|
16
|
+
*
|
|
17
|
+
* This layer takes the other option: aliases are **pure `var()` indirection**,
|
|
18
|
+
* declared once at `:root`, pointing at ramp steps and semantic entries the
|
|
19
|
+
* themes already define. No alias holds a colour — it holds the *name of* a
|
|
20
|
+
* colour. So when `[data-skdx-theme="nord-dark"]` redeclares
|
|
21
|
+
* `--skdx-color-primary-600` at its own higher-specificity selector, every alias
|
|
22
|
+
* pointing at that step re-resolves to Nord's value automatically. Adding a
|
|
23
|
+
* theme costs nothing here, and adding an alias costs one line rather than 38.
|
|
24
|
+
*
|
|
25
|
+
* This is also why the aliases are emitted at `:root` rather than inside each
|
|
26
|
+
* theme block: they must sit *below* the theme declarations in the cascade so a
|
|
27
|
+
* theme can still override an alias outright when the derivation is wrong for
|
|
28
|
+
* it. {@link darkColorAliases} is exactly that escape hatch in use: a ramp runs
|
|
29
|
+
* light-to-dark in every theme, so the aliases that put ink directly on the
|
|
30
|
+
* page need the opposite end in dark mode.
|
|
31
|
+
*
|
|
32
|
+
* Choosing the ramp step
|
|
33
|
+
* ----------------------
|
|
34
|
+
* A dark theme's ramp is authored for dark — `NordDark`'s `primary-600` is
|
|
35
|
+
* already a step that works as a filled background on a dark surface, the same
|
|
36
|
+
* way `DefaultTheme`'s is on a light one. So a single step choice per alias is
|
|
37
|
+
* correct in both modes for the *filled* aliases. It does not hold for aliases
|
|
38
|
+
* that put ink or a wash directly on the page — see {@link darkColorAliases},
|
|
39
|
+
* which was written after measuring 22 of 38 themes failing WCAG contrast.
|
|
40
|
+
*
|
|
41
|
+
* @see docs/architecture/skin-token-map.md for the per-property mapping table.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Every alias, as `[name, value]` pairs where `value` is always a `var()`
|
|
45
|
+
* reference — never a literal. Grouped by the question a skin author asks.
|
|
46
|
+
*
|
|
47
|
+
* Kept as data rather than a hand-written CSS string so
|
|
48
|
+
* `aliases.test.ts` can assert the no-literal rule mechanically over the whole
|
|
49
|
+
* set, which is the only thing standing between this file and the exact class
|
|
50
|
+
* of drift the skins package's Stylelint rule exists to prevent.
|
|
51
|
+
*/
|
|
52
|
+
export declare const colorAliases: ReadonlyArray<readonly [string, string]>;
|
|
53
|
+
/**
|
|
54
|
+
* The aliases a dark theme re-points, and what it re-points them to.
|
|
55
|
+
*
|
|
56
|
+
* Why this exists
|
|
57
|
+
* ---------------
|
|
58
|
+
* The base table above picks one ramp step per alias and claims that is correct
|
|
59
|
+
* in both modes. For most aliases it is: a theme authors its ramp for its own
|
|
60
|
+
* mode, so `primary-600` is a usable filled background whichever way the page
|
|
61
|
+
* faces.
|
|
62
|
+
*
|
|
63
|
+
* It is *not* true for the aliases that put ink directly on the page. A ramp
|
|
64
|
+
* runs light at 50 to dark at 950 in every theme, dark ones included — that is
|
|
65
|
+
* what makes a ramp a ramp. So `--skdx-color-text-danger: danger-700` is dark
|
|
66
|
+
* red: correct on a white page, and nearly invisible on a charcoal one. The
|
|
67
|
+
* same applies to every "wash + dark ink" status pairing, and to the neutral
|
|
68
|
+
* fills (`surface-sunken`, `track`, `skeleton`) that assume the page is lighter
|
|
69
|
+
* than they are.
|
|
70
|
+
*
|
|
71
|
+
* Measured before writing this: 22 of the 38 themes had at least one contrast
|
|
72
|
+
* failure, every one of them a dark theme, and every failure in this list.
|
|
73
|
+
* Input text sat at 1.07:1 and the tooltip at 1.00:1.
|
|
74
|
+
*
|
|
75
|
+
* The fix uses the escape hatch the base table was designed around — a theme
|
|
76
|
+
* may override an alias, because `[data-skdx-theme="…"]` outranks `:root`. These
|
|
77
|
+
* overrides are emitted automatically for every theme whose `mode` is `'dark'`,
|
|
78
|
+
* so the cost stays "one line per alias" rather than "one edit per theme", and
|
|
79
|
+
* a new dark theme is correct the day it lands without anyone remembering this
|
|
80
|
+
* file exists.
|
|
81
|
+
*
|
|
82
|
+
* Steps mirror around the middle of the ramp: 700 → 300, 800 → 200, 50 → 950.
|
|
83
|
+
* That keeps the light and dark treatments the same *distance* from their
|
|
84
|
+
* background rather than merely both legible.
|
|
85
|
+
*/
|
|
86
|
+
export declare const darkColorAliases: ReadonlyArray<readonly [string, string]>;
|
|
87
|
+
/**
|
|
88
|
+
* Renders {@link darkColorAliases} at `selector`, for a theme whose mode is dark.
|
|
89
|
+
*
|
|
90
|
+
* @param selector - The theme's own selector, e.g. `'[data-skdx-theme="nord-dark"]'`.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export declare function darkAliasesToCss(selector: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Renders {@link colorAliases} as a `:root` rule block.
|
|
96
|
+
*
|
|
97
|
+
* Emitted *after* `foundationToCss()` and *before* the theme blocks in
|
|
98
|
+
* `@skdx/tokens/css`. Order matters in one direction only: an alias must be
|
|
99
|
+
* able to be overridden by a theme, and `:root` loses to
|
|
100
|
+
* `[data-skdx-theme="…"]` on specificity regardless of source order, so the
|
|
101
|
+
* position here is for readability rather than correctness.
|
|
102
|
+
*
|
|
103
|
+
* @returns A CSS string, e.g. `':root {\n --skdx-color-action-primary-bg: var(--skdx-color-primary-600);\n …\n}\n'`.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { foundationToCss, aliasesToCss } from '@skdx/tokens';
|
|
108
|
+
*
|
|
109
|
+
* fs.writeFileSync('tokens.css', foundationToCss() + aliasesToCss());
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
export declare function aliasesToCss(): string;
|
|
115
|
+
/**
|
|
116
|
+
* {@link colorAliases} as a plain object, for consumers applying tokens through
|
|
117
|
+
* JS rather than a stylesheet (the alias counterpart to `themeToCssVars`).
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export declare function aliasesToCssVars(): Record<string, string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var c=[["--skdx-color-surface-inverse","var(--skdx-color-neutral-900)"],["--skdx-color-text-on-inverse","var(--skdx-color-neutral-50)"],["--skdx-color-surface-page","var(--skdx-color-semantic-background)"],["--skdx-color-surface-default","var(--skdx-color-semantic-surface)"],["--skdx-color-surface-hover","var(--skdx-color-semantic-surface-hover)"],["--skdx-color-surface-raised","var(--skdx-color-semantic-background)"],["--skdx-color-surface-sunken","var(--skdx-color-semantic-surface)"],["--skdx-color-surface-pressed","var(--skdx-color-neutral-200)"],["--skdx-color-surface-selected","var(--skdx-color-primary-50)"],["--skdx-color-surface-disabled","var(--skdx-color-neutral-100)"],["--skdx-color-surface-overlay","var(--skdx-color-semantic-overlay)"],["--skdx-color-text-default","var(--skdx-color-semantic-text)"],["--skdx-color-text-muted","var(--skdx-color-semantic-text-muted)"],["--skdx-color-text-on-accent","var(--skdx-color-semantic-text-inverted)"],["--skdx-color-text-accent","var(--skdx-color-primary-700)"],["--skdx-color-text-disabled","var(--skdx-color-neutral-600)"],["--skdx-color-text-placeholder","var(--skdx-color-semantic-text-muted)"],["--skdx-color-text-danger","var(--skdx-color-danger-700)"],["--skdx-color-text-success","var(--skdx-color-success-800)"],["--skdx-color-text-warning","var(--skdx-color-warning-900)"],["--skdx-color-text-info","var(--skdx-color-primary-700)"],["--skdx-color-border-default","var(--skdx-color-semantic-border)"],["--skdx-color-border-strong","var(--skdx-color-semantic-border-strong)"],["--skdx-color-border-subtle","var(--skdx-color-neutral-200)"],["--skdx-color-border-accent","var(--skdx-color-primary-600)"],["--skdx-color-border-disabled","var(--skdx-color-neutral-200)"],["--skdx-color-border-danger","var(--skdx-color-danger-600)"],["--skdx-color-border-success","var(--skdx-color-success-600)"],["--skdx-color-border-warning","var(--skdx-color-warning-600)"],["--skdx-color-action-primary-bg","var(--skdx-color-primary-600)"],["--skdx-color-action-primary-bg-hover","var(--skdx-color-primary-600)"],["--skdx-color-action-primary-bg-pressed","var(--skdx-color-primary-600)"],["--skdx-color-action-primary-border-hover","var(--skdx-color-primary-800)"],["--skdx-color-action-primary-text","var(--skdx-color-semantic-text-inverted)"],["--skdx-color-action-primary-border","var(--skdx-color-primary-600)"],["--skdx-color-action-secondary-bg","var(--skdx-color-semantic-surface)"],["--skdx-color-action-secondary-bg-hover","var(--skdx-color-semantic-surface-hover)"],["--skdx-color-action-secondary-bg-pressed","var(--skdx-color-neutral-300)"],["--skdx-color-action-secondary-text","var(--skdx-color-semantic-text)"],["--skdx-color-action-secondary-border","var(--skdx-color-semantic-border)"],["--skdx-color-action-outline-text","var(--skdx-color-semantic-text)"],["--skdx-color-action-outline-border","var(--skdx-color-semantic-border-strong)"],["--skdx-color-action-outline-bg-hover","var(--skdx-color-semantic-surface-hover)"],["--skdx-color-action-outline-bg-pressed","var(--skdx-color-neutral-200)"],["--skdx-color-action-ghost-text","var(--skdx-color-semantic-text)"],["--skdx-color-action-ghost-bg-hover","var(--skdx-color-semantic-surface-hover)"],["--skdx-color-action-ghost-bg-pressed","var(--skdx-color-neutral-200)"],["--skdx-color-action-danger-bg","var(--skdx-color-danger-700)"],["--skdx-color-action-danger-bg-hover","var(--skdx-color-danger-800)"],["--skdx-color-action-danger-bg-pressed","var(--skdx-color-danger-900)"],["--skdx-color-action-danger-text","var(--skdx-color-danger-50)"],["--skdx-color-action-danger-border","var(--skdx-color-danger-700)"],["--skdx-color-action-disabled-bg","var(--skdx-color-neutral-100)"],["--skdx-color-action-disabled-text","var(--skdx-color-neutral-700)"],["--skdx-color-action-disabled-border","var(--skdx-color-neutral-200)"],["--skdx-color-field-bg","var(--skdx-color-semantic-background)"],["--skdx-color-field-bg-hover","var(--skdx-color-semantic-surface-hover)"],["--skdx-color-field-bg-disabled","var(--skdx-color-neutral-100)"],["--skdx-color-field-bg-readonly","var(--skdx-color-neutral-50)"],["--skdx-color-field-border","var(--skdx-color-semantic-border-strong)"],["--skdx-color-field-border-hover","var(--skdx-color-neutral-500)"],["--skdx-color-field-border-focus","var(--skdx-color-primary-600)"],["--skdx-color-field-border-invalid","var(--skdx-color-danger-700)"],["--skdx-color-field-text","var(--skdx-color-semantic-text)"],["--skdx-color-selection-bg","var(--skdx-color-primary-600)"],["--skdx-color-selection-bg-hover","var(--skdx-color-primary-600)"],["--skdx-color-selection-mark","var(--skdx-color-semantic-text-inverted)"],["--skdx-color-highlight-bg","var(--skdx-color-semantic-surface-hover)"],["--skdx-color-highlight-text","var(--skdx-color-semantic-text)"],["--skdx-color-status-info-bg","var(--skdx-color-primary-50)"],["--skdx-color-status-info-border","var(--skdx-color-primary-200)"],["--skdx-color-status-info-text","var(--skdx-color-primary-800)"],["--skdx-color-status-info-icon","var(--skdx-color-primary-600)"],["--skdx-color-status-success-bg","var(--skdx-color-success-50)"],["--skdx-color-status-success-border","var(--skdx-color-success-200)"],["--skdx-color-status-success-text","var(--skdx-color-success-800)"],["--skdx-color-status-success-icon","var(--skdx-color-success-600)"],["--skdx-color-status-warning-bg","var(--skdx-color-warning-50)"],["--skdx-color-status-warning-border","var(--skdx-color-warning-200)"],["--skdx-color-status-warning-text","var(--skdx-color-warning-800)"],["--skdx-color-status-warning-icon","var(--skdx-color-warning-600)"],["--skdx-color-status-danger-bg","var(--skdx-color-danger-50)"],["--skdx-color-status-danger-border","var(--skdx-color-danger-200)"],["--skdx-color-status-danger-text","var(--skdx-color-danger-800)"],["--skdx-color-status-danger-icon","var(--skdx-color-danger-600)"],["--skdx-color-status-neutral-bg","var(--skdx-color-semantic-surface)"],["--skdx-color-status-neutral-border","var(--skdx-color-semantic-border)"],["--skdx-color-status-neutral-text","var(--skdx-color-semantic-text)"],["--skdx-color-status-neutral-icon","var(--skdx-color-semantic-text-muted)"],["--skdx-color-focus-ring","var(--skdx-color-semantic-focus-ring)"],["--skdx-color-focus-ring-offset","var(--skdx-color-semantic-background)"],["--skdx-color-separator","var(--skdx-color-semantic-border)"],["--skdx-color-track","var(--skdx-color-neutral-100)"],["--skdx-color-track-fill","var(--skdx-color-primary-600)"],["--skdx-color-skeleton","var(--skdx-color-neutral-200)"],["--skdx-color-skeleton-sheen","var(--skdx-color-neutral-100)"]],d=[["--skdx-color-text-accent","var(--skdx-color-primary-300)"],["--skdx-color-text-danger","var(--skdx-color-danger-300)"],["--skdx-color-text-success","var(--skdx-color-success-300)"],["--skdx-color-text-warning","var(--skdx-color-warning-300)"],["--skdx-color-text-info","var(--skdx-color-primary-300)"],["--skdx-color-text-disabled","var(--skdx-color-neutral-400)"],["--skdx-color-field-border-invalid","var(--skdx-color-danger-400)"],["--skdx-color-border-danger","var(--skdx-color-danger-400)"],["--skdx-color-border-success","var(--skdx-color-success-400)"],["--skdx-color-border-warning","var(--skdx-color-warning-400)"],["--skdx-color-surface-hover","var(--skdx-color-neutral-800)"],["--skdx-color-action-secondary-bg-hover","var(--skdx-color-neutral-800)"],["--skdx-color-action-outline-bg-hover","var(--skdx-color-neutral-800)"],["--skdx-color-action-ghost-bg-hover","var(--skdx-color-neutral-800)"],["--skdx-color-field-bg-hover","var(--skdx-color-neutral-800)"],["--skdx-color-highlight-bg","var(--skdx-color-neutral-800)"],["--skdx-color-surface-sunken","var(--skdx-color-neutral-800)"],["--skdx-color-surface-pressed","var(--skdx-color-neutral-700)"],["--skdx-color-surface-selected","var(--skdx-color-primary-950)"],["--skdx-color-surface-disabled","var(--skdx-color-neutral-800)"],["--skdx-color-action-disabled-bg","var(--skdx-color-neutral-800)"],["--skdx-color-action-disabled-text","var(--skdx-color-neutral-400)"],["--skdx-color-action-disabled-border","var(--skdx-color-neutral-700)"],["--skdx-color-action-secondary-bg-pressed","var(--skdx-color-neutral-600)"],["--skdx-color-action-outline-bg-pressed","var(--skdx-color-neutral-700)"],["--skdx-color-action-ghost-bg-pressed","var(--skdx-color-neutral-700)"],["--skdx-color-border-subtle","var(--skdx-color-neutral-800)"],["--skdx-color-border-disabled","var(--skdx-color-neutral-700)"],["--skdx-color-track","var(--skdx-color-neutral-900)"],["--skdx-color-skeleton","var(--skdx-color-neutral-800)"],["--skdx-color-skeleton-sheen","var(--skdx-color-neutral-700)"],["--skdx-color-field-bg-readonly","var(--skdx-color-neutral-900)"],["--skdx-color-field-bg-disabled","var(--skdx-color-neutral-800)"],["--skdx-color-status-info-bg","var(--skdx-color-primary-950)"],["--skdx-color-status-info-border","var(--skdx-color-primary-800)"],["--skdx-color-status-info-text","var(--skdx-color-primary-200)"],["--skdx-color-status-info-icon","var(--skdx-color-primary-400)"],["--skdx-color-status-success-bg","var(--skdx-color-success-950)"],["--skdx-color-status-success-border","var(--skdx-color-success-800)"],["--skdx-color-status-success-text","var(--skdx-color-success-200)"],["--skdx-color-status-success-icon","var(--skdx-color-success-400)"],["--skdx-color-status-warning-bg","var(--skdx-color-warning-950)"],["--skdx-color-status-warning-border","var(--skdx-color-warning-800)"],["--skdx-color-status-warning-text","var(--skdx-color-warning-200)"],["--skdx-color-status-warning-icon","var(--skdx-color-warning-400)"],["--skdx-color-status-danger-bg","var(--skdx-color-danger-950)"],["--skdx-color-status-danger-border","var(--skdx-color-danger-800)"],["--skdx-color-status-danger-text","var(--skdx-color-danger-200)"],["--skdx-color-status-danger-icon","var(--skdx-color-danger-400)"],["--skdx-color-surface-inverse","var(--skdx-color-neutral-100)"],["--skdx-color-text-on-inverse","var(--skdx-color-neutral-900)"]];function e(o){let r=d.map(([s,a])=>` ${s}: ${a};`);return`${o} {
|
|
2
|
+
${r.join(`
|
|
3
|
+
`)}
|
|
4
|
+
}
|
|
5
|
+
`}function l(){return`:root {
|
|
6
|
+
${c.map(([r,s])=>` ${r}: ${s};`).join(`
|
|
7
|
+
`)}
|
|
8
|
+
}
|
|
9
|
+
`}function t(){return Object.fromEntries(c.map(([o,r])=>[o,r]))}export{l as aliasesToCss,t as aliasesToCssVars,c as colorAliases,e as darkAliasesToCss,d as darkColorAliases};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(n,t)=>{for(var e in t)m(n,e,{get:t[e],enumerable:!0})},b=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!f.call(n,r)&&r!==e&&m(n,r,{get:()=>t[r],enumerable:!(s=h(t,r))||s.enumerable});return n};var w=n=>b(m({},"__esModule",{value:!0}),n);var R={};g(R,{contrastRatio:()=>k});module.exports=w(R);function k(n,t){let e=o=>{if(!/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(o))throw new TypeError(`contrastRatio() needs a hex color, got "${o}". Translucent and named colors cannot be measured without a backdrop \u2014 composite the value in the theme and state it as hex.`);let a=o.replace("#",""),p=a.length===3?a.split("").map(c=>c+c).join(""):a,i=Number.parseInt(p,16),l=[i>>16&255,i>>8&255,i&255].map(c=>{let u=c/255;return u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)});return .2126*l[0]+.7152*l[1]+.0722*l[2]},[s,r]=[e(n),e(t)].sort((o,a)=>a-o);return(s+.05)/(r+.05)}0&&(module.exports={contrastRatio});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WCAG 2.x relative-luminance contrast ratio between two `#rrggbb`/`#rgb`
|
|
3
|
+
* colors, per the standard formula (https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio).
|
|
4
|
+
* Returns a value from 1 (no contrast) to 21 (black on white).
|
|
5
|
+
*
|
|
6
|
+
* **Throws on anything that is not a hex color.** This used to coerce silently:
|
|
7
|
+
* `hex.replace('#','')` then `Number.parseInt(full, 16)` yields `NaN` for
|
|
8
|
+
* `rgb(0 0 0 / 0.45)`, and `(NaN >> 16) & 255` is `0`, so a translucent value
|
|
9
|
+
* was measured as opaque black. `ant-daybreak`'s `textMuted` scored a perfect
|
|
10
|
+
* 21:1 while rendering at 3.36:1 — a live AA failure passing as a perfect
|
|
11
|
+
* score, which is worse than no guard at all.
|
|
12
|
+
*
|
|
13
|
+
* Throwing rather than compositing is deliberate. Compositing would need a
|
|
14
|
+
* backdrop this function does not have and cannot infer, and it would let the
|
|
15
|
+
* next translucent value into the theme set silently. Rejecting forces every
|
|
16
|
+
* theme to state its colors as measurable values, which makes the whole set
|
|
17
|
+
* auditable by construction instead of by vigilance.
|
|
18
|
+
*
|
|
19
|
+
* `#rgba` and `#rrggbbaa` are rejected too: an alpha channel is exactly the
|
|
20
|
+
* thing that needs a backdrop, and the luminance math below would read those
|
|
21
|
+
* extra digits as colour.
|
|
22
|
+
*
|
|
23
|
+
* @throws {TypeError} if either argument is not `#rgb` or `#rrggbb`
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare function contrastRatio(hexA: string, hexB: string): number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WCAG 2.x relative-luminance contrast ratio between two `#rrggbb`/`#rgb`
|
|
3
|
+
* colors, per the standard formula (https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio).
|
|
4
|
+
* Returns a value from 1 (no contrast) to 21 (black on white).
|
|
5
|
+
*
|
|
6
|
+
* **Throws on anything that is not a hex color.** This used to coerce silently:
|
|
7
|
+
* `hex.replace('#','')` then `Number.parseInt(full, 16)` yields `NaN` for
|
|
8
|
+
* `rgb(0 0 0 / 0.45)`, and `(NaN >> 16) & 255` is `0`, so a translucent value
|
|
9
|
+
* was measured as opaque black. `ant-daybreak`'s `textMuted` scored a perfect
|
|
10
|
+
* 21:1 while rendering at 3.36:1 — a live AA failure passing as a perfect
|
|
11
|
+
* score, which is worse than no guard at all.
|
|
12
|
+
*
|
|
13
|
+
* Throwing rather than compositing is deliberate. Compositing would need a
|
|
14
|
+
* backdrop this function does not have and cannot infer, and it would let the
|
|
15
|
+
* next translucent value into the theme set silently. Rejecting forces every
|
|
16
|
+
* theme to state its colors as measurable values, which makes the whole set
|
|
17
|
+
* auditable by construction instead of by vigilance.
|
|
18
|
+
*
|
|
19
|
+
* `#rgba` and `#rrggbbaa` are rejected too: an alpha channel is exactly the
|
|
20
|
+
* thing that needs a backdrop, and the luminance math below would read those
|
|
21
|
+
* extra digits as colour.
|
|
22
|
+
*
|
|
23
|
+
* @throws {TypeError} if either argument is not `#rgb` or `#rrggbb`
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare function contrastRatio(hexA: string, hexB: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function p(c,i){let s=t=>{if(!/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(t))throw new TypeError(`contrastRatio() needs a hex color, got "${t}". Translucent and named colors cannot be measured without a backdrop \u2014 composite the value in the theme and state it as hex.`);let n=t.replace("#",""),m=n.length===3?n.split("").map(e=>e+e).join(""):n,r=Number.parseInt(m,16),o=[r>>16&255,r>>8&255,r&255].map(e=>{let a=e/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*o[0]+.7152*o[1]+.0722*o[2]},[l,u]=[s(c),s(i)].sort((t,n)=>n-t);return(l+.05)/(u+.05)}export{p as contrastRatio};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var k=(n,t)=>{for(var r in t)i(n,r,{get:t[r],enumerable:!0})},b=(n,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of d(t))!$.call(n,e)&&e!==r&&i(n,e,{get:()=>t[e],enumerable:!(o=g(t,e))||o.enumerable});return n};var l=n=>b(i({},"__esModule",{value:!0}),n);var y={};k(y,{reducedMotionVarNames:()=>w,sectionsToCssVars:()=>j,varsToDeclarations:()=>x});module.exports=l(y);var c="skdx";function p(n){return n!==null&&typeof n=="object"}function a(n,t,r){for(let[o,e]of Object.entries(n))e!==void 0&&(p(e)?a(e,[...t,o],r):r[[...t,o].join("-")]=String(e));return r}function R(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function j(n){let t={};for(let[r,o]of n)if(o)for(let[e,u]of Object.entries(a(o,[],{}))){let s=R(e),f=s.startsWith(`${r}-`)||s===r?s:`${r}-${s}`;t[`--${c}-${f}`]=u}return t}function x(n,t=" "){return Object.entries(n).map(([r,o])=>`${t}${r}: ${o};`).join(`
|
|
2
|
+
`)}function w(n){return Object.keys(n).filter(t=>t.startsWith(`--${c}-motion-duration-`)||t.startsWith(`--${c}-motion-stagger-`))}0&&(module.exports={reducedMotionVarNames,sectionsToCssVars,varsToDeclarations});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place `--skdx-*` custom property *names* are derived from token
|
|
3
|
+
* object keys.
|
|
4
|
+
*
|
|
5
|
+
* Both halves of the token system emit CSS variables — `themeToCssVars` for
|
|
6
|
+
* the per-theme colors, `foundationToCssVars` for everything shared — and they
|
|
7
|
+
* have to agree byte-for-byte, because a consumer writing
|
|
8
|
+
* `var(--skdx-font-size-md)` cannot tell (and should not care) which half
|
|
9
|
+
* declared it. Two copies of this naming logic would drift the first time
|
|
10
|
+
* someone added a camelCase token, and the failure mode is silent: the
|
|
11
|
+
* variable simply never resolves.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
/** A token group and the `--skdx-<prefix>-…` namespace its keys render under. @internal */
|
|
16
|
+
export type CssVarSection = [prefix: string, tokens: Record<string, unknown> | undefined];
|
|
17
|
+
/**
|
|
18
|
+
* Flattens token groups into a `{ '--skdx-…': value }` map.
|
|
19
|
+
*
|
|
20
|
+
* A section whose tokens are `undefined` contributes nothing — that is how an
|
|
21
|
+
* optional group (a theme's `typography` or `motion`) opts out without the caller
|
|
22
|
+
* needing a conditional.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function sectionsToCssVars(sections: CssVarSection[]): Record<string, string>;
|
|
27
|
+
/** Renders a var map as the indented declaration lines of a CSS rule block. @internal */
|
|
28
|
+
export declare function varsToDeclarations(vars: Record<string, string>, indent?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* The `--skdx-motion-*` variables that a `prefers-reduced-motion: reduce` block
|
|
31
|
+
* has to zero: every duration *and* every stagger. A stagger is a delay, so
|
|
32
|
+
* zeroing the durations without zeroing it would leave a still page that still
|
|
33
|
+
* arrives late.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare function reducedMotionVarNames(vars: Record<string, string>): string[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place `--skdx-*` custom property *names* are derived from token
|
|
3
|
+
* object keys.
|
|
4
|
+
*
|
|
5
|
+
* Both halves of the token system emit CSS variables — `themeToCssVars` for
|
|
6
|
+
* the per-theme colors, `foundationToCssVars` for everything shared — and they
|
|
7
|
+
* have to agree byte-for-byte, because a consumer writing
|
|
8
|
+
* `var(--skdx-font-size-md)` cannot tell (and should not care) which half
|
|
9
|
+
* declared it. Two copies of this naming logic would drift the first time
|
|
10
|
+
* someone added a camelCase token, and the failure mode is silent: the
|
|
11
|
+
* variable simply never resolves.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
/** A token group and the `--skdx-<prefix>-…` namespace its keys render under. @internal */
|
|
16
|
+
export type CssVarSection = [prefix: string, tokens: Record<string, unknown> | undefined];
|
|
17
|
+
/**
|
|
18
|
+
* Flattens token groups into a `{ '--skdx-…': value }` map.
|
|
19
|
+
*
|
|
20
|
+
* A section whose tokens are `undefined` contributes nothing — that is how an
|
|
21
|
+
* optional group (a theme's `typography` or `motion`) opts out without the caller
|
|
22
|
+
* needing a conditional.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function sectionsToCssVars(sections: CssVarSection[]): Record<string, string>;
|
|
27
|
+
/** Renders a var map as the indented declaration lines of a CSS rule block. @internal */
|
|
28
|
+
export declare function varsToDeclarations(vars: Record<string, string>, indent?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* The `--skdx-motion-*` variables that a `prefers-reduced-motion: reduce` block
|
|
31
|
+
* has to zero: every duration *and* every stagger. A stagger is a delay, so
|
|
32
|
+
* zeroing the durations without zeroing it would leave a still page that still
|
|
33
|
+
* arrives late.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare function reducedMotionVarNames(vars: Record<string, string>): string[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i="skdx";function f(n){return n!==null&&typeof n=="object"}function c(n,t,r){for(let[e,o]of Object.entries(n))o!==void 0&&(f(o)?c(o,[...t,e],r):r[[...t,e].join("-")]=String(o));return r}function g(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function d(n){let t={};for(let[r,e]of n)if(e)for(let[o,a]of Object.entries(c(e,[],{}))){let s=g(o),u=s.startsWith(`${r}-`)||s===r?s:`${r}-${s}`;t[`--${i}-${u}`]=a}return t}function $(n,t=" "){return Object.entries(n).map(([r,e])=>`${t}${r}: ${e};`).join(`
|
|
2
|
+
`)}function k(n){return Object.keys(n).filter(t=>t.startsWith(`--${i}-motion-duration-`)||t.startsWith(`--${i}-motion-stagger-`))}export{k as reducedMotionVarNames,d as sectionsToCssVars,$ as varsToDeclarations};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(o,e)=>{for(var n in e)i(o,n,{get:e[n],enumerable:!0})},z=(o,e,n,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!C.call(o,a)&&a!==n&&i(o,a,{get:()=>e[a],enumerable:!(m=$(e,a))||m.enumerable});return o};var M=o=>z(i({},"__esModule",{value:!0}),o);var V={};b(V,{borderWidth:()=>y,breakpoints:()=>F,coarsePointerToCssVars:()=>S,controls:()=>f,controlsCoarse:()=>w,focusRing:()=>h,foundationToCss:()=>I,foundationToCssVars:()=>T,motion:()=>x,opacity:()=>k,radii:()=>l,shadows:()=>g,space:()=>d,typography:()=>c,zIndex:()=>u});module.exports=M(V);var t=require("./cssVars.cjs"),p=require("./theme.cjs"),r="skdx",c={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontFamilyMono:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem"},fontWeight:{regular:400,medium:500,semibold:600,bold:700},lineHeight:{tight:"1.25",snug:"1.43",normal:"1.5",relaxed:"1.75"},letterSpacing:{tight:"-0.015em",normal:"0em",wide:"0.025em",wider:"0.05em"}},d={1:"0.25rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",10:"2.5rem",12:"3rem",16:"4rem"},l={sm:"0.25rem",inner:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem",full:"9999px"},g={sm:`0 1px 2px 0 ${s(.05)}`,md:`0 4px 6px -1px ${s(.1)}, 0 2px 4px -2px ${s(.1)}`,lg:`0 10px 15px -3px ${s(.1)}, 0 4px 6px -4px ${s(.1)}`,overlay:`0 25px 50px -12px ${s(.25)}`};function s(o){return`rgb(var(--${r}-shadow-color) / calc(${o} * var(--${r}-shadow-strength)))`}var x=p.defaultMotion,u={base:0,dropdown:10,sticky:20,overlay:30,modal:35,popover:40,toast:50,max:9999},h={width:"2px",offset:"2px",offsetInset:"calc(-1 * var(--skdx-focus-ring-width))"},y={thin:"1px",thick:"2px",thicker:"4px"},f={control:{height:{sm:"1.875rem",md:"2.25rem",lg:"2.625rem",compact:"2rem"},padding:{sm:"0.625rem",md:`var(--${r}-space-3)`,lg:`var(--${r}-space-4)`},gap:{sm:`var(--${r}-space-1)`,md:`var(--${r}-space-2)`,lg:`var(--${r}-space-2)`}},iconSize:{sm:"1rem",md:"1.25rem",lg:"1.5rem"},indicatorSize:{sm:"1rem",md:"1.25rem",lg:"1.5rem"},item:{height:{sm:"1.75rem",md:"2.25rem",lg:"2.5rem"},gap:"2px"},overlay:{padding:`var(--${r}-space-1)`,radius:`var(--${r}-radius-lg)`,minWidth:"7.5rem"},field:{gap:`var(--${r}-space-1)`,labelGap:`var(--${r}-space-1)`},target:{min:"24px"}},w={control:{height:{sm:"2.25rem",md:"2.75rem",lg:"3rem",compact:"2.75rem"}},item:{height:{sm:"2.25rem",md:"2.75rem",lg:"3rem"}},target:{min:"44px"}},k={disabled:"0.5",scrim:"0.6"},F={sm:640,md:768,lg:1024,xl:1280};function T(){return(0,t.sectionsToCssVars)([["font",c],["space",d],["radius",l],["shadow",g],["motion",x],["z-index",u],["focus-ring",h],["border-width",y],["opacity",k],...R(f)])}function R(o){let e=n=>o[n];return[["control",e("control")],["icon-size",e("iconSize")],["indicator-size",e("indicatorSize")],["item",e("item")],["overlay",e("overlay")],["field",e("field")],["target",e("target")]]}function S(){return(0,t.sectionsToCssVars)(R(w))}function I(){let o=T(),e=(0,t.reducedMotionVarNames)(o).map(n=>` ${n}: 0ms;`);return`:root {
|
|
2
|
+
${(0,t.varsToDeclarations)(o)}
|
|
3
|
+
}
|
|
4
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5
|
+
:root {
|
|
6
|
+
${e.join(`
|
|
7
|
+
`)}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
@media (pointer: coarse) {
|
|
11
|
+
:root {
|
|
12
|
+
${(0,t.varsToDeclarations)(S()," ")}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`}0&&(module.exports={borderWidth,breakpoints,coarsePointerToCssVars,controls,controlsCoarse,focusRing,foundationToCss,foundationToCssVars,motion,opacity,radii,shadows,space,typography,zIndex});
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { type ThemeControls, type ThemeControlsCoarse, type ThemeMotion, type ThemeRadii, type ThemeShadows, type ThemeSpace, type ThemeTypography } from './theme.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* The type system: one font stack, one scale, one set of weights,
|
|
4
|
+
* line-heights and tracking steps, shared by every theme.
|
|
5
|
+
*
|
|
6
|
+
* A theme picks colors. It does not get to resize the type scale, because a
|
|
7
|
+
* layout that reflows when you switch brand is a layout that was never
|
|
8
|
+
* designed — it was designed once, against one scale, and every other brand
|
|
9
|
+
* was hoping. The two font *stacks* are the only part a theme can override,
|
|
10
|
+
* and only through {@link ThemeTypographyDeviation}, because impersonating a
|
|
11
|
+
* design language means impersonating its typeface.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare const typography: ThemeTypography;
|
|
16
|
+
/**
|
|
17
|
+
* The spacing scale — a 4px base with the usual gaps (no `7`, no `9`) so the
|
|
18
|
+
* steps stay memorable rather than exhaustive. Structural: gap and padding are
|
|
19
|
+
* rhythm, and rhythm is a property of the design system, not of the brand
|
|
20
|
+
* painted on top of it.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare const space: ThemeSpace;
|
|
25
|
+
/**
|
|
26
|
+
* The corner-radius scale. Shared for the same reason {@link space} is: a
|
|
27
|
+
* component's silhouette is part of the system's shape language, and a brand
|
|
28
|
+
* that rounds its corners differently is a different component library
|
|
29
|
+
* wearing the same class names.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare const radii: ThemeRadii;
|
|
34
|
+
/**
|
|
35
|
+
* The elevation scale — geometry only. Every value defers its color to
|
|
36
|
+
* `var(--skdx-shadow-color)` and scales its alpha by
|
|
37
|
+
* `var(--skdx-shadow-strength)`, both of which a theme supplies (see
|
|
38
|
+
* {@link ThemeShadowColor}).
|
|
39
|
+
*
|
|
40
|
+
* This split is the whole reason shadows can be shared at all. A shadow is one
|
|
41
|
+
* CSS string that welds geometry to a color, so before this every theme
|
|
42
|
+
* restated `0 4px 6px -1px` purely to be able to change `rgb(…)` at the end of
|
|
43
|
+
* it — 38 copies of the same three offsets, and no way to tell a deliberate
|
|
44
|
+
* elevation change from a color change.
|
|
45
|
+
*
|
|
46
|
+
* The base alphas below are the original `skanda-light` values, so a theme
|
|
47
|
+
* with `strength: '1'` renders exactly what it did before the split.
|
|
48
|
+
* Substitution is lazy: these live at `:root`, but `var(--skdx-shadow-color)`
|
|
49
|
+
* resolves against the element the shadow is finally *used* on, so the active
|
|
50
|
+
* `[data-skdx-theme]` block wins. `calc()` is legal in the alpha slot, and an
|
|
51
|
+
* alpha above 1 clamps rather than erroring — which is what keeps a
|
|
52
|
+
* high-strength dark theme from being a footgun.
|
|
53
|
+
*
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export declare const shadows: ThemeShadows;
|
|
57
|
+
/**
|
|
58
|
+
* The shared animation timing — re-exported from {@link defaultMotion}, which
|
|
59
|
+
* remains the single source so that `themeToCssVars` can keep merging it under
|
|
60
|
+
* a theme's {@link Theme.motion} without importing this module.
|
|
61
|
+
*
|
|
62
|
+
* See {@link ThemeMotion} for why motion is theme-invariant.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare const motion: Required<ThemeMotion>;
|
|
67
|
+
/**
|
|
68
|
+
* A structural stacking-order scale for overlay-class UI (dropdowns, sticky
|
|
69
|
+
* headers, dialog/popover backdrops, floating content, toasts). Unlike the
|
|
70
|
+
* rest of the token system, z-index isn't a per-brand visual choice — every
|
|
71
|
+
* theme should stack the same way — so it's exported once here rather than
|
|
72
|
+
* duplicated into all 38 {@link Theme} objects. Consumers building an app
|
|
73
|
+
* with multiple concurrent overlay types (e.g. a `Select` opened from inside
|
|
74
|
+
* a `Dialog`, with a `Toast` on top of both) should coordinate their own
|
|
75
|
+
* z-indices against this scale instead of picking ad hoc numbers per
|
|
76
|
+
* component.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```css
|
|
80
|
+
* .dialog-overlay { z-index: var(--skdx-z-index-overlay); }
|
|
81
|
+
* .select-content { z-index: var(--skdx-z-index-popover); }
|
|
82
|
+
* .toast-viewport { z-index: var(--skdx-z-index-toast); }
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export declare const zIndex: {
|
|
88
|
+
readonly base: 0;
|
|
89
|
+
readonly dropdown: 10;
|
|
90
|
+
readonly sticky: 20;
|
|
91
|
+
/** The scrim behind a modal surface. */
|
|
92
|
+
readonly overlay: 30;
|
|
93
|
+
/** The modal surface itself — above its own scrim, below any popover opened from inside it. */
|
|
94
|
+
readonly modal: 35;
|
|
95
|
+
readonly popover: 40;
|
|
96
|
+
readonly toast: 50;
|
|
97
|
+
/**
|
|
98
|
+
* Escape hatch for the one thing that must sit above everything, e.g. a
|
|
99
|
+
* debug overlay or an "app is offline" banner. Deliberately far above
|
|
100
|
+
* `toast` so app code never has to guess a bigger number.
|
|
101
|
+
*/
|
|
102
|
+
readonly max: 9999;
|
|
103
|
+
};
|
|
104
|
+
/** The shape of the {@link zIndex} scale — a map of named stacking layers (`sticky`, `overlay`, `popover`, `toast`, …) to their numeric `z-index`. @public */
|
|
105
|
+
export type ZIndexScale = typeof zIndex;
|
|
106
|
+
/**
|
|
107
|
+
* Structural focus-ring geometry (width/offset) — the *color* half of the
|
|
108
|
+
* focus-ring contract is themed per brand ({@link SemanticColors.focusRing}),
|
|
109
|
+
* but the ring's thickness and offset are a layout constant every theme
|
|
110
|
+
* should share, so they live here rather than being repeated as identical
|
|
111
|
+
* values across all 38 bundled themes.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```css
|
|
115
|
+
* :focus-visible {
|
|
116
|
+
* outline: var(--skdx-focus-ring-width) solid var(--skdx-color-semantic-focus-ring);
|
|
117
|
+
* outline-offset: var(--skdx-focus-ring-offset);
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
export declare const focusRing: {
|
|
124
|
+
readonly width: "2px";
|
|
125
|
+
readonly offset: "2px";
|
|
126
|
+
/**
|
|
127
|
+
* The offset a *clipping* container hands down to its children.
|
|
128
|
+
*
|
|
129
|
+
* An outline is painted outward from the border edge and is clipped by an
|
|
130
|
+
* ancestor's `overflow` exactly like any other overflowing paint — which
|
|
131
|
+
* sliced the ring off inside every control group that rounds its corners by
|
|
132
|
+
* clipping. Because `outline-offset` is read from a custom property, such a
|
|
133
|
+
* container sets this on itself and every descendant ring moves *inside* the
|
|
134
|
+
* border box, where nothing can reach it. One declaration per clipping
|
|
135
|
+
* container, no per-part focus rules.
|
|
136
|
+
*
|
|
137
|
+
* Negative by exactly the ring width, which lands it flush against the
|
|
138
|
+
* inside of the edge rather than floating in from it.
|
|
139
|
+
*/
|
|
140
|
+
readonly offsetInset: "calc(-1 * var(--skdx-focus-ring-width))";
|
|
141
|
+
};
|
|
142
|
+
/** The shape of the {@link focusRing} geometry — the structural `width`/`offset` of the focus ring (its color is themed separately). @public */
|
|
143
|
+
export type FocusRingScale = typeof focusRing;
|
|
144
|
+
/**
|
|
145
|
+
* Border thicknesses. Structural for the same reason {@link focusRing}'s
|
|
146
|
+
* geometry is: a brand changes border *color* (see
|
|
147
|
+
* {@link SemanticColors.border}), not how many pixels thick a hairline is.
|
|
148
|
+
* Three steps only — a hairline, an emphasis weight (focus/selected/invalid
|
|
149
|
+
* outlines drawn without the focus ring), and a heavy weight for deliberate
|
|
150
|
+
* structural rules. There is no `0`: that's `border: none`, not a token.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```css
|
|
154
|
+
* .card { border: var(--skdx-border-width-thin) solid var(--skdx-color-semantic-border); }
|
|
155
|
+
* .card[data-invalid] { border-width: var(--skdx-border-width-thick); }
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
160
|
+
export declare const borderWidth: {
|
|
161
|
+
readonly thin: "1px";
|
|
162
|
+
readonly thick: "2px";
|
|
163
|
+
readonly thicker: "4px";
|
|
164
|
+
};
|
|
165
|
+
/** The shape of the {@link borderWidth} scale — `thin`/`thick`/`thicker` border thicknesses. @public */
|
|
166
|
+
export type BorderWidthScale = typeof borderWidth;
|
|
167
|
+
/**
|
|
168
|
+
* The shared control geometry — heights, paddings, icon boxes, row heights and
|
|
169
|
+
* overlay insets. See {@link ThemeControls} for why this is structural rather
|
|
170
|
+
* than per-brand, and for the retuning escape hatch.
|
|
171
|
+
*
|
|
172
|
+
* The ladder is an even 6px step (30/36/42) and every rung sits inside the
|
|
173
|
+
* range the two reference libraries surveyed occupy. Several values are
|
|
174
|
+
* `var()` references rather than lengths on purpose: a control's inline
|
|
175
|
+
* padding *is* a step of {@link space}, and restating `0.75rem` here would let
|
|
176
|
+
* the two drift. The exceptions are the four numbers that are deliberately off
|
|
177
|
+
* a scale — `padding.sm` (10px), `height.compact` (32px), `item.gap` (2px) and
|
|
178
|
+
* `target.min` (24px) — each documented where it is declared.
|
|
179
|
+
*
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
export declare const controls: ThemeControls;
|
|
183
|
+
/**
|
|
184
|
+
* What a coarse pointer overrides. Emitted by {@link foundationToCss} as a
|
|
185
|
+
* `@media (pointer: coarse)` block; see {@link ThemeControlsCoarse} for why
|
|
186
|
+
* only hit sizes are listed.
|
|
187
|
+
*
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
export declare const controlsCoarse: ThemeControlsCoarse;
|
|
191
|
+
/**
|
|
192
|
+
* The two opacities the system actually has an opinion about. Deliberately
|
|
193
|
+
* *not* a 0–100 ramp: an arbitrary ramp invents decisions nobody made, while
|
|
194
|
+
* these two are real, repeated cross-component choices — how faded a disabled
|
|
195
|
+
* control is, and how much a modal scrim dims the page behind it.
|
|
196
|
+
*
|
|
197
|
+
* Scrim *color* is themed ({@link SemanticColors.overlay}); this is the
|
|
198
|
+
* structural strength of the dim, so every brand's scrim occludes equally.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```css
|
|
202
|
+
* [data-disabled] { opacity: var(--skdx-opacity-disabled); }
|
|
203
|
+
* .dialog-overlay { background: var(--skdx-color-semantic-overlay); opacity: var(--skdx-opacity-scrim); }
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
export declare const opacity: {
|
|
209
|
+
readonly disabled: "0.5";
|
|
210
|
+
readonly scrim: "0.6";
|
|
211
|
+
};
|
|
212
|
+
/** The shape of the {@link opacity} scale — the `disabled` and `scrim` opacities. @public */
|
|
213
|
+
export type OpacityScale = typeof opacity;
|
|
214
|
+
/**
|
|
215
|
+
* Viewport widths, in pixels, as **TypeScript exports only** — deliberately
|
|
216
|
+
* not emitted as CSS custom properties by {@link foundationToCss}. A custom
|
|
217
|
+
* property cannot be used in a `@media` query's condition (`@media (min-width:
|
|
218
|
+
* var(--x))` is invalid CSS), so a `--skdx-breakpoint-*` variable would be a
|
|
219
|
+
* token that looks usable and isn't. Consume these from JS/TS, or from a
|
|
220
|
+
* build step that inlines the number into your own media queries.
|
|
221
|
+
*
|
|
222
|
+
* The components themselves are headless and ship no responsive behavior;
|
|
223
|
+
* this exists so consumers building a styled layer on top don't have to
|
|
224
|
+
* invent their own set.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* import { breakpoints } from '@skdx/tokens';
|
|
229
|
+
*
|
|
230
|
+
* const isDesktop = window.matchMedia(`(min-width: ${breakpoints.lg}px)`).matches;
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export declare const breakpoints: {
|
|
236
|
+
readonly sm: 640;
|
|
237
|
+
readonly md: 768;
|
|
238
|
+
readonly lg: 1024;
|
|
239
|
+
readonly xl: 1280;
|
|
240
|
+
};
|
|
241
|
+
/** The shape of the {@link breakpoints} scale — named viewport widths in pixels. @public */
|
|
242
|
+
export type BreakpointScale = typeof breakpoints;
|
|
243
|
+
/**
|
|
244
|
+
* Flattens every shared token into a map of CSS custom property names to
|
|
245
|
+
* values — the foundation's counterpart to `themeToCssVars`. Together the two
|
|
246
|
+
* maps are the complete `--skdx-*` surface, and they never overlap.
|
|
247
|
+
*
|
|
248
|
+
* {@link breakpoints} is not included — see its docs for why a breakpoint
|
|
249
|
+
* can't be a CSS custom property.
|
|
250
|
+
*
|
|
251
|
+
* @returns A plain object keyed by CSS custom property name (e.g. `'--skdx-space-4'`), unprefixed by any selector.
|
|
252
|
+
*
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
export declare function foundationToCssVars(): Record<string, string>;
|
|
256
|
+
/**
|
|
257
|
+
* The control metrics a coarse pointer overrides, as a var map — the
|
|
258
|
+
* `@media (pointer: coarse)` counterpart to {@link foundationToCssVars}.
|
|
259
|
+
*
|
|
260
|
+
* Exported because `@skdx/skins` renders its own no-tokens fallback copy of
|
|
261
|
+
* both blocks from these functions rather than restating the values, which is
|
|
262
|
+
* the only thing that keeps the two in step.
|
|
263
|
+
*
|
|
264
|
+
* @public
|
|
265
|
+
*/
|
|
266
|
+
export declare function coarsePointerToCssVars(): Record<string, string>;
|
|
267
|
+
/**
|
|
268
|
+
* Renders every shared token as a `:root`-scoped `--skdx-*` rule block — the
|
|
269
|
+
* theme-invariant counterpart to {@link themeToCss}. **Inject this exactly
|
|
270
|
+
* once**, then inject `themeToCss(theme)` per theme alongside it. Without it
|
|
271
|
+
* the type scale, spacing, radii, shadow geometry and motion are simply
|
|
272
|
+
* absent, because no theme declares them any more.
|
|
273
|
+
*
|
|
274
|
+
* Followed by a `@media (prefers-reduced-motion: reduce)` block that
|
|
275
|
+
* re-declares every `--skdx-motion-duration-*` and `--skdx-motion-stagger-*` as
|
|
276
|
+
* `0ms`. Components are headless and animate nothing themselves, so honoring
|
|
277
|
+
* the preference has to happen where the durations are *defined* rather than
|
|
278
|
+
* where they're used — this way a consumer who writes `transition-duration:
|
|
279
|
+
* var(--skdx-motion-duration-normal)` gets WCAG 2.3.3 behavior for free instead
|
|
280
|
+
* of having to remember the media query at every call site. The easing curve
|
|
281
|
+
* is left alone: it's a shape, not a duration, and is inert at `0ms`. A theme
|
|
282
|
+
* that retunes motion via `ThemeMotionDeviation` emits its own copy of this
|
|
283
|
+
* block, so the guarantee survives the escape hatch.
|
|
284
|
+
*
|
|
285
|
+
* Then a `@media (pointer: coarse)` block re-declaring the hit sizes from
|
|
286
|
+
* {@link controlsCoarse}, for the same reason: the preference has to be honored
|
|
287
|
+
* where the metric is *defined*, so a consumer who writes
|
|
288
|
+
* `block-size: var(--skdx-control-height-md)` gets a touch-sized control without
|
|
289
|
+
* having to remember the query.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```ts
|
|
293
|
+
* import { foundationToCss, themeToCss, themes } from '@skdx/tokens';
|
|
294
|
+
*
|
|
295
|
+
* const css = foundationToCss() + themes.map((t) => themeToCss(t)).join('');
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
300
|
+
export declare function foundationToCss(): string;
|