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