@atomic-ui/design-tokens 0.0.0-stage → 0.1.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 +86 -2
- package/dist/chunk-6CBHZQ2Z.js +47 -0
- package/dist/chunk-6CBHZQ2Z.js.map +1 -0
- package/dist/contrast.d.ts +96 -0
- package/dist/css.d.ts +42 -0
- package/dist/css.js +17 -0
- package/dist/css.js.map +1 -0
- package/dist/derive.d.ts +18 -0
- package/dist/dtcg.d.ts +27 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +4434 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs.d.ts +285 -0
- package/dist/tailwind.d.ts +70 -0
- package/dist/tailwind.js +69 -0
- package/dist/tailwind.js.map +1 -0
- package/dist/validate.d.ts +23 -0
- package/package.json +41 -4
package/dist/inputs.d.ts
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brand inputs — everything a partner may set, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* The list is closed, and it is short on purpose. Stripe's Appearance API gets
|
|
5
|
+
* almost all of its brand expression from eight variables and derives the rest;
|
|
6
|
+
* Cloudscape allows typography, colour and border radius and refuses the
|
|
7
|
+
* question beyond that; the legacy Sanity CMS this replaces allowed everything
|
|
8
|
+
* and accumulated forty per-viewport override fields nobody could prune. The
|
|
9
|
+
* reasoning, with sources, is
|
|
10
|
+
* [ADR 0010](../../../docs/decisions/0010-what-a-brand-may-set.md).
|
|
11
|
+
*
|
|
12
|
+
* Two absences are the point of the whole file. There is no foreground colour
|
|
13
|
+
* anywhere — text on a surface is computed, so a partner cannot pin white text
|
|
14
|
+
* onto a mid-tone brand colour. And there is no focus colour — the ring keeps
|
|
15
|
+
* system values, because a focus indicator drawn in a partner's own brand
|
|
16
|
+
* colour on that partner's own background is where focus visibility dies.
|
|
17
|
+
*/
|
|
18
|
+
import { z } from 'zod';
|
|
19
|
+
/** A hex colour. The only colour form the inputs accept. */
|
|
20
|
+
export declare const HexColorSchema: z.ZodString;
|
|
21
|
+
/**
|
|
22
|
+
* The page background, which may be a gradient.
|
|
23
|
+
*
|
|
24
|
+
* It is the one exception and it is safe by construction rather than by
|
|
25
|
+
* exception: the page background never carries text directly — text sits on a
|
|
26
|
+
* card — so it is the only surface with nothing to contrast against. Northwind
|
|
27
|
+
* Plus's shell is a three-stop gradient, which is a real requirement and
|
|
28
|
+
* would otherwise need an escape hatch.
|
|
29
|
+
*/
|
|
30
|
+
export declare const SurfaceValueSchema: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
31
|
+
export declare const WebFontSchema: z.ZodObject<{
|
|
32
|
+
family: z.ZodString;
|
|
33
|
+
url: z.ZodString;
|
|
34
|
+
weight: z.ZodOptional<z.ZodString>;
|
|
35
|
+
style: z.ZodOptional<z.ZodString>;
|
|
36
|
+
display: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
family: string;
|
|
39
|
+
url: string;
|
|
40
|
+
weight?: string | undefined;
|
|
41
|
+
style?: string | undefined;
|
|
42
|
+
display?: string | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
family: string;
|
|
45
|
+
url: string;
|
|
46
|
+
weight?: string | undefined;
|
|
47
|
+
style?: string | undefined;
|
|
48
|
+
display?: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export type WebFont = z.infer<typeof WebFontSchema>;
|
|
51
|
+
/**
|
|
52
|
+
* The type ramp ratio.
|
|
53
|
+
*
|
|
54
|
+
* Bounded rather than free. Below 1.067 the ramp stops distinguishing levels
|
|
55
|
+
* and heading structure becomes invisible to a sighted reader even though the
|
|
56
|
+
* markup is correct; above 1.333 the top of the scale overflows a 360px
|
|
57
|
+
* viewport at 200% zoom, which fails 1.4.4. A partner who wants bigger headings
|
|
58
|
+
* raises the base size.
|
|
59
|
+
*/
|
|
60
|
+
export declare const TypeScaleSchema: z.ZodNumber;
|
|
61
|
+
/**
|
|
62
|
+
* Each group is `.strict()`.
|
|
63
|
+
*
|
|
64
|
+
* Zod strips unknown keys by default, so `color.onBrand` would validate, be
|
|
65
|
+
* dropped, and leave an editor looking at a brand that ignores a value they
|
|
66
|
+
* set. Rejecting it says what is actually true: there is nowhere to put a
|
|
67
|
+
* foreground colour, because foregrounds are measured.
|
|
68
|
+
*/
|
|
69
|
+
export declare const BrandInputsSchema: z.ZodObject<{
|
|
70
|
+
color: z.ZodObject<{
|
|
71
|
+
/** The partner's primary colour: actions, emphasis, selected states. */
|
|
72
|
+
brand: z.ZodString;
|
|
73
|
+
/** The secondary colour. Defaults to the brand colour when unset. */
|
|
74
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
75
|
+
/** The page behind everything. May be a gradient; carries no text. */
|
|
76
|
+
surfacePage: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
77
|
+
/** Where content actually sits, and what text is read against. */
|
|
78
|
+
surfaceCard: z.ZodString;
|
|
79
|
+
/** The header band. */
|
|
80
|
+
surfaceHeader: z.ZodString;
|
|
81
|
+
/** The footer band. */
|
|
82
|
+
surfaceFooter: z.ZodString;
|
|
83
|
+
/** Default body text, on `surfaceCard`. */
|
|
84
|
+
text: z.ZodString;
|
|
85
|
+
danger: z.ZodString;
|
|
86
|
+
warning: z.ZodString;
|
|
87
|
+
success: z.ZodString;
|
|
88
|
+
info: z.ZodString;
|
|
89
|
+
}, "strict", z.ZodTypeAny, {
|
|
90
|
+
brand: string;
|
|
91
|
+
surfacePage: string;
|
|
92
|
+
surfaceCard: string;
|
|
93
|
+
surfaceHeader: string;
|
|
94
|
+
surfaceFooter: string;
|
|
95
|
+
text: string;
|
|
96
|
+
danger: string;
|
|
97
|
+
warning: string;
|
|
98
|
+
success: string;
|
|
99
|
+
info: string;
|
|
100
|
+
accent?: string | undefined;
|
|
101
|
+
}, {
|
|
102
|
+
brand: string;
|
|
103
|
+
surfacePage: string;
|
|
104
|
+
surfaceCard: string;
|
|
105
|
+
surfaceHeader: string;
|
|
106
|
+
surfaceFooter: string;
|
|
107
|
+
text: string;
|
|
108
|
+
danger: string;
|
|
109
|
+
warning: string;
|
|
110
|
+
success: string;
|
|
111
|
+
info: string;
|
|
112
|
+
accent?: string | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
font: z.ZodObject<{
|
|
115
|
+
body: z.ZodString;
|
|
116
|
+
/** Defaults to `body` when unset — most brands have one typeface. */
|
|
117
|
+
heading: z.ZodOptional<z.ZodString>;
|
|
118
|
+
/** Root size in px. Everything else is `rem`, scaled from this. */
|
|
119
|
+
sizeBase: z.ZodDefault<z.ZodNumber>;
|
|
120
|
+
scale: z.ZodDefault<z.ZodNumber>;
|
|
121
|
+
/** Faces the shell must load. A partner brings its own typeface. */
|
|
122
|
+
webFonts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
123
|
+
family: z.ZodString;
|
|
124
|
+
url: z.ZodString;
|
|
125
|
+
weight: z.ZodOptional<z.ZodString>;
|
|
126
|
+
style: z.ZodOptional<z.ZodString>;
|
|
127
|
+
display: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
family: string;
|
|
130
|
+
url: string;
|
|
131
|
+
weight?: string | undefined;
|
|
132
|
+
style?: string | undefined;
|
|
133
|
+
display?: string | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
family: string;
|
|
136
|
+
url: string;
|
|
137
|
+
weight?: string | undefined;
|
|
138
|
+
style?: string | undefined;
|
|
139
|
+
display?: string | undefined;
|
|
140
|
+
}>, "many">>;
|
|
141
|
+
}, "strict", z.ZodTypeAny, {
|
|
142
|
+
body: string;
|
|
143
|
+
sizeBase: number;
|
|
144
|
+
scale: number;
|
|
145
|
+
webFonts: {
|
|
146
|
+
family: string;
|
|
147
|
+
url: string;
|
|
148
|
+
weight?: string | undefined;
|
|
149
|
+
style?: string | undefined;
|
|
150
|
+
display?: string | undefined;
|
|
151
|
+
}[];
|
|
152
|
+
heading?: string | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
body: string;
|
|
155
|
+
heading?: string | undefined;
|
|
156
|
+
sizeBase?: number | undefined;
|
|
157
|
+
scale?: number | undefined;
|
|
158
|
+
webFonts?: {
|
|
159
|
+
family: string;
|
|
160
|
+
url: string;
|
|
161
|
+
weight?: string | undefined;
|
|
162
|
+
style?: string | undefined;
|
|
163
|
+
display?: string | undefined;
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
}>;
|
|
166
|
+
shape: z.ZodObject<{
|
|
167
|
+
/** Corner rounding in px. Every radius derives from it. */
|
|
168
|
+
radiusBase: z.ZodDefault<z.ZodNumber>;
|
|
169
|
+
/** The spacing unit in px. All spacing is a multiple. */
|
|
170
|
+
spaceBase: z.ZodDefault<z.ZodNumber>;
|
|
171
|
+
/** Default border weight in px. */
|
|
172
|
+
borderWidth: z.ZodDefault<z.ZodNumber>;
|
|
173
|
+
}, "strict", z.ZodTypeAny, {
|
|
174
|
+
radiusBase: number;
|
|
175
|
+
spaceBase: number;
|
|
176
|
+
borderWidth: number;
|
|
177
|
+
}, {
|
|
178
|
+
radiusBase?: number | undefined;
|
|
179
|
+
spaceBase?: number | undefined;
|
|
180
|
+
borderWidth?: number | undefined;
|
|
181
|
+
}>;
|
|
182
|
+
assets: z.ZodObject<{
|
|
183
|
+
logo: z.ZodString;
|
|
184
|
+
logoAlt: z.ZodString;
|
|
185
|
+
/** For use on dark surfaces, where the main logo would disappear. */
|
|
186
|
+
logoDark: z.ZodOptional<z.ZodString>;
|
|
187
|
+
favicon: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, "strict", z.ZodTypeAny, {
|
|
189
|
+
logo: string;
|
|
190
|
+
logoAlt: string;
|
|
191
|
+
logoDark?: string | undefined;
|
|
192
|
+
favicon?: string | undefined;
|
|
193
|
+
}, {
|
|
194
|
+
logo: string;
|
|
195
|
+
logoAlt: string;
|
|
196
|
+
logoDark?: string | undefined;
|
|
197
|
+
favicon?: string | undefined;
|
|
198
|
+
}>;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
color: {
|
|
201
|
+
brand: string;
|
|
202
|
+
surfacePage: string;
|
|
203
|
+
surfaceCard: string;
|
|
204
|
+
surfaceHeader: string;
|
|
205
|
+
surfaceFooter: string;
|
|
206
|
+
text: string;
|
|
207
|
+
danger: string;
|
|
208
|
+
warning: string;
|
|
209
|
+
success: string;
|
|
210
|
+
info: string;
|
|
211
|
+
accent?: string | undefined;
|
|
212
|
+
};
|
|
213
|
+
font: {
|
|
214
|
+
body: string;
|
|
215
|
+
sizeBase: number;
|
|
216
|
+
scale: number;
|
|
217
|
+
webFonts: {
|
|
218
|
+
family: string;
|
|
219
|
+
url: string;
|
|
220
|
+
weight?: string | undefined;
|
|
221
|
+
style?: string | undefined;
|
|
222
|
+
display?: string | undefined;
|
|
223
|
+
}[];
|
|
224
|
+
heading?: string | undefined;
|
|
225
|
+
};
|
|
226
|
+
shape: {
|
|
227
|
+
radiusBase: number;
|
|
228
|
+
spaceBase: number;
|
|
229
|
+
borderWidth: number;
|
|
230
|
+
};
|
|
231
|
+
assets: {
|
|
232
|
+
logo: string;
|
|
233
|
+
logoAlt: string;
|
|
234
|
+
logoDark?: string | undefined;
|
|
235
|
+
favicon?: string | undefined;
|
|
236
|
+
};
|
|
237
|
+
}, {
|
|
238
|
+
color: {
|
|
239
|
+
brand: string;
|
|
240
|
+
surfacePage: string;
|
|
241
|
+
surfaceCard: string;
|
|
242
|
+
surfaceHeader: string;
|
|
243
|
+
surfaceFooter: string;
|
|
244
|
+
text: string;
|
|
245
|
+
danger: string;
|
|
246
|
+
warning: string;
|
|
247
|
+
success: string;
|
|
248
|
+
info: string;
|
|
249
|
+
accent?: string | undefined;
|
|
250
|
+
};
|
|
251
|
+
font: {
|
|
252
|
+
body: string;
|
|
253
|
+
heading?: string | undefined;
|
|
254
|
+
sizeBase?: number | undefined;
|
|
255
|
+
scale?: number | undefined;
|
|
256
|
+
webFonts?: {
|
|
257
|
+
family: string;
|
|
258
|
+
url: string;
|
|
259
|
+
weight?: string | undefined;
|
|
260
|
+
style?: string | undefined;
|
|
261
|
+
display?: string | undefined;
|
|
262
|
+
}[] | undefined;
|
|
263
|
+
};
|
|
264
|
+
shape: {
|
|
265
|
+
radiusBase?: number | undefined;
|
|
266
|
+
spaceBase?: number | undefined;
|
|
267
|
+
borderWidth?: number | undefined;
|
|
268
|
+
};
|
|
269
|
+
assets: {
|
|
270
|
+
logo: string;
|
|
271
|
+
logoAlt: string;
|
|
272
|
+
logoDark?: string | undefined;
|
|
273
|
+
favicon?: string | undefined;
|
|
274
|
+
};
|
|
275
|
+
}>;
|
|
276
|
+
export type BrandInputs = z.infer<typeof BrandInputsSchema>;
|
|
277
|
+
/**
|
|
278
|
+
* The house defaults — a complete, neutral, AA-passing brand.
|
|
279
|
+
*
|
|
280
|
+
* Every input is optional at the edges of the system because this exists: a
|
|
281
|
+
* site with no brand document still renders something legible rather than
|
|
282
|
+
* unstyled, which is what makes a missing brand a visible problem instead of a
|
|
283
|
+
* broken page.
|
|
284
|
+
*/
|
|
285
|
+
export declare const DEFAULT_BRAND_INPUTS: BrandInputs;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare const impktPreset: {
|
|
2
|
+
theme: {
|
|
3
|
+
extend: {
|
|
4
|
+
colors: {
|
|
5
|
+
brand: {
|
|
6
|
+
DEFAULT: string;
|
|
7
|
+
hover: string;
|
|
8
|
+
active: string;
|
|
9
|
+
subtle: string;
|
|
10
|
+
on: string;
|
|
11
|
+
};
|
|
12
|
+
accent: {
|
|
13
|
+
DEFAULT: string;
|
|
14
|
+
on: string;
|
|
15
|
+
};
|
|
16
|
+
surface: {
|
|
17
|
+
page: string;
|
|
18
|
+
card: string;
|
|
19
|
+
header: string;
|
|
20
|
+
footer: string;
|
|
21
|
+
subtle: string;
|
|
22
|
+
inset: string;
|
|
23
|
+
};
|
|
24
|
+
content: {
|
|
25
|
+
DEFAULT: string;
|
|
26
|
+
muted: string;
|
|
27
|
+
placeholder: string;
|
|
28
|
+
heading: string;
|
|
29
|
+
link: string;
|
|
30
|
+
};
|
|
31
|
+
line: {
|
|
32
|
+
DEFAULT: string;
|
|
33
|
+
strong: string;
|
|
34
|
+
};
|
|
35
|
+
danger: string;
|
|
36
|
+
warning: string;
|
|
37
|
+
success: string;
|
|
38
|
+
info: string;
|
|
39
|
+
};
|
|
40
|
+
fontFamily: {
|
|
41
|
+
sans: string;
|
|
42
|
+
heading: string;
|
|
43
|
+
};
|
|
44
|
+
fontSize: {
|
|
45
|
+
[k: string]: string;
|
|
46
|
+
};
|
|
47
|
+
borderRadius: {
|
|
48
|
+
none: string;
|
|
49
|
+
sm: string;
|
|
50
|
+
DEFAULT: string;
|
|
51
|
+
lg: string;
|
|
52
|
+
xl: string;
|
|
53
|
+
full: string;
|
|
54
|
+
};
|
|
55
|
+
spacing: {
|
|
56
|
+
[k: string]: string;
|
|
57
|
+
};
|
|
58
|
+
minWidth: {
|
|
59
|
+
target: string;
|
|
60
|
+
};
|
|
61
|
+
minHeight: {
|
|
62
|
+
target: string;
|
|
63
|
+
};
|
|
64
|
+
boxShadow: {
|
|
65
|
+
focus: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export default impktPreset;
|
package/dist/tailwind.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cssVarName
|
|
3
|
+
} from "./chunk-6CBHZQ2Z.js";
|
|
4
|
+
|
|
5
|
+
// packages/design-tokens/src/tailwind.ts
|
|
6
|
+
var v = (path, fallback) => fallback ? `var(${cssVarName(path)}, ${fallback})` : `var(${cssVarName(path)})`;
|
|
7
|
+
var impktPreset = {
|
|
8
|
+
theme: {
|
|
9
|
+
extend: {
|
|
10
|
+
colors: {
|
|
11
|
+
brand: {
|
|
12
|
+
DEFAULT: v("color.brand.default"),
|
|
13
|
+
hover: v("color.brand.hover"),
|
|
14
|
+
active: v("color.brand.active"),
|
|
15
|
+
subtle: v("color.brand.subtle"),
|
|
16
|
+
on: v("color.brand.on")
|
|
17
|
+
},
|
|
18
|
+
accent: { DEFAULT: v("color.accent.default"), on: v("color.accent.on") },
|
|
19
|
+
surface: {
|
|
20
|
+
page: v("color.surface.page"),
|
|
21
|
+
card: v("color.surface.card"),
|
|
22
|
+
header: v("color.surface.header"),
|
|
23
|
+
footer: v("color.surface.footer"),
|
|
24
|
+
subtle: v("color.surface.subtle"),
|
|
25
|
+
inset: v("color.surface.inset")
|
|
26
|
+
},
|
|
27
|
+
content: {
|
|
28
|
+
DEFAULT: v("color.text.default"),
|
|
29
|
+
muted: v("color.text.muted"),
|
|
30
|
+
placeholder: v("color.text.placeholder"),
|
|
31
|
+
heading: v("color.text.heading"),
|
|
32
|
+
link: v("color.text.link")
|
|
33
|
+
},
|
|
34
|
+
line: { DEFAULT: v("color.border.default"), strong: v("color.border.strong") },
|
|
35
|
+
danger: v("color.status.danger.default"),
|
|
36
|
+
warning: v("color.status.warning.default"),
|
|
37
|
+
success: v("color.status.success.default"),
|
|
38
|
+
info: v("color.status.info.default")
|
|
39
|
+
},
|
|
40
|
+
fontFamily: {
|
|
41
|
+
sans: v("font.family.body"),
|
|
42
|
+
heading: v("font.family.heading")
|
|
43
|
+
},
|
|
44
|
+
fontSize: Object.fromEntries(
|
|
45
|
+
["2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"].map((s) => [s, v(`font.size.${s}`)])
|
|
46
|
+
),
|
|
47
|
+
borderRadius: {
|
|
48
|
+
none: v("radius.none"),
|
|
49
|
+
sm: v("radius.sm"),
|
|
50
|
+
DEFAULT: v("radius.md"),
|
|
51
|
+
lg: v("radius.lg"),
|
|
52
|
+
xl: v("radius.xl"),
|
|
53
|
+
full: v("radius.full")
|
|
54
|
+
},
|
|
55
|
+
spacing: Object.fromEntries(
|
|
56
|
+
Array.from({ length: 11 }, (_, i) => [String(i), v(`space.${i}`)])
|
|
57
|
+
),
|
|
58
|
+
minWidth: { target: v("target.min") },
|
|
59
|
+
minHeight: { target: v("target.min") },
|
|
60
|
+
boxShadow: { focus: v("focus.ring.shadow") }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var tailwind_default = impktPreset;
|
|
65
|
+
export {
|
|
66
|
+
tailwind_default as default,
|
|
67
|
+
impktPreset
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=tailwind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tailwind.ts"],"sourcesContent":["/**\n * A Tailwind preset pointing at the custom properties.\n *\n * It maps Tailwind's scales onto `var(--impkt-*)` rather than onto values, so a\n * shell that still uses Tailwind picks up a brand change at runtime like\n * everything else. Shipping resolved values here would bake one brand into the\n * build and quietly reintroduce the per-brand stylesheet this is meant to\n * remove.\n *\n * Typed loosely on purpose: the package does not depend on Tailwind, and a\n * preset is a plain object.\n */\nimport { cssVarName } from './css';\n\nconst v = (path: string, fallback?: string): string =>\n fallback ? `var(${cssVarName(path)}, ${fallback})` : `var(${cssVarName(path)})`;\n\nexport const impktPreset = {\n theme: {\n extend: {\n colors: {\n brand: {\n DEFAULT: v('color.brand.default'),\n hover: v('color.brand.hover'),\n active: v('color.brand.active'),\n subtle: v('color.brand.subtle'),\n on: v('color.brand.on'),\n },\n accent: { DEFAULT: v('color.accent.default'), on: v('color.accent.on') },\n surface: {\n page: v('color.surface.page'),\n card: v('color.surface.card'),\n header: v('color.surface.header'),\n footer: v('color.surface.footer'),\n subtle: v('color.surface.subtle'),\n inset: v('color.surface.inset'),\n },\n content: {\n DEFAULT: v('color.text.default'),\n muted: v('color.text.muted'),\n placeholder: v('color.text.placeholder'),\n heading: v('color.text.heading'),\n link: v('color.text.link'),\n },\n line: { DEFAULT: v('color.border.default'), strong: v('color.border.strong') },\n danger: v('color.status.danger.default'),\n warning: v('color.status.warning.default'),\n success: v('color.status.success.default'),\n info: v('color.status.info.default'),\n },\n fontFamily: {\n sans: v('font.family.body'),\n heading: v('font.family.heading'),\n },\n fontSize: Object.fromEntries(\n ['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'].map((s) => [s, v(`font.size.${s}`)]),\n ),\n borderRadius: {\n none: v('radius.none'),\n sm: v('radius.sm'),\n DEFAULT: v('radius.md'),\n lg: v('radius.lg'),\n xl: v('radius.xl'),\n full: v('radius.full'),\n },\n spacing: Object.fromEntries(\n Array.from({ length: 11 }, (_, i) => [String(i), v(`space.${i}`)]),\n ),\n minWidth: { target: v('target.min') },\n minHeight: { target: v('target.min') },\n boxShadow: { focus: v('focus.ring.shadow') },\n },\n },\n};\n\nexport default impktPreset;\n"],"mappings":";;;;;AAcA,IAAM,IAAI,CAAC,MAAc,aACvB,WAAW,OAAO,WAAW,IAAI,CAAC,KAAK,QAAQ,MAAM,OAAO,WAAW,IAAI,CAAC;AAEvE,IAAM,cAAc;AAAA,EACzB,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,QAAQ;AAAA,QACN,OAAO;AAAA,UACL,SAAS,EAAE,qBAAqB;AAAA,UAChC,OAAO,EAAE,mBAAmB;AAAA,UAC5B,QAAQ,EAAE,oBAAoB;AAAA,UAC9B,QAAQ,EAAE,oBAAoB;AAAA,UAC9B,IAAI,EAAE,gBAAgB;AAAA,QACxB;AAAA,QACA,QAAQ,EAAE,SAAS,EAAE,sBAAsB,GAAG,IAAI,EAAE,iBAAiB,EAAE;AAAA,QACvE,SAAS;AAAA,UACP,MAAM,EAAE,oBAAoB;AAAA,UAC5B,MAAM,EAAE,oBAAoB;AAAA,UAC5B,QAAQ,EAAE,sBAAsB;AAAA,UAChC,QAAQ,EAAE,sBAAsB;AAAA,UAChC,QAAQ,EAAE,sBAAsB;AAAA,UAChC,OAAO,EAAE,qBAAqB;AAAA,QAChC;AAAA,QACA,SAAS;AAAA,UACP,SAAS,EAAE,oBAAoB;AAAA,UAC/B,OAAO,EAAE,kBAAkB;AAAA,UAC3B,aAAa,EAAE,wBAAwB;AAAA,UACvC,SAAS,EAAE,oBAAoB;AAAA,UAC/B,MAAM,EAAE,iBAAiB;AAAA,QAC3B;AAAA,QACA,MAAM,EAAE,SAAS,EAAE,sBAAsB,GAAG,QAAQ,EAAE,qBAAqB,EAAE;AAAA,QAC7E,QAAQ,EAAE,6BAA6B;AAAA,QACvC,SAAS,EAAE,8BAA8B;AAAA,QACzC,SAAS,EAAE,8BAA8B;AAAA,QACzC,MAAM,EAAE,2BAA2B;AAAA,MACrC;AAAA,MACA,YAAY;AAAA,QACV,MAAM,EAAE,kBAAkB;AAAA,QAC1B,SAAS,EAAE,qBAAqB;AAAA,MAClC;AAAA,MACA,UAAU,OAAO;AAAA,QACf,CAAC,OAAO,MAAM,MAAM,MAAM,MAAM,MAAM,OAAO,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;AAAA,MACzF;AAAA,MACA,cAAc;AAAA,QACZ,MAAM,EAAE,aAAa;AAAA,QACrB,IAAI,EAAE,WAAW;AAAA,QACjB,SAAS,EAAE,WAAW;AAAA,QACtB,IAAI,EAAE,WAAW;AAAA,QACjB,IAAI,EAAE,WAAW;AAAA,QACjB,MAAM,EAAE,aAAa;AAAA,MACvB;AAAA,MACA,SAAS,OAAO;AAAA,QACd,MAAM,KAAK,EAAE,QAAQ,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;AAAA,MACnE;AAAA,MACA,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE;AAAA,MACpC,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE;AAAA,MACrC,WAAW,EAAE,OAAO,EAAE,mBAAmB,EAAE;AAAA,IAC7C;AAAA,EACF;AACF;AAEA,IAAO,mBAAQ;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type TokenSet } from './derive';
|
|
2
|
+
import type { BrandInputs } from './inputs';
|
|
3
|
+
export interface ContrastIssue {
|
|
4
|
+
/** The token that fails, as an editor would be shown it. */
|
|
5
|
+
token: string;
|
|
6
|
+
foreground: string;
|
|
7
|
+
background: string;
|
|
8
|
+
ratio: number;
|
|
9
|
+
required: number;
|
|
10
|
+
/** The WCAG criterion, so the message can cite it. */
|
|
11
|
+
criterion: '1.4.3 Contrast (Minimum)' | '1.4.11 Non-text Contrast';
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ContrastReport {
|
|
15
|
+
ok: boolean;
|
|
16
|
+
issues: ContrastIssue[];
|
|
17
|
+
/** How many pairs were examined — the honest denominator. */
|
|
18
|
+
checked: number;
|
|
19
|
+
}
|
|
20
|
+
/** Check a derived token set. */
|
|
21
|
+
export declare function checkContrast(tokens: TokenSet): ContrastReport;
|
|
22
|
+
/** Check a brand before its tokens exist. What the CMS editor calls. */
|
|
23
|
+
export declare const checkBrandContrast: (input: BrandInputs) => ContrastReport;
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-ui/design-tokens",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The design tokens every Impkt component reads, and the derivation that turns a partner's handful of brand inputs into the whole set.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./css": {
|
|
14
|
+
"types": "./dist/css.d.ts",
|
|
15
|
+
"import": "./dist/css.js"
|
|
16
|
+
},
|
|
17
|
+
"./tailwind": {
|
|
18
|
+
"types": "./dist/tailwind.d.ts",
|
|
19
|
+
"import": "./dist/tailwind.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"zod": "^3.23.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"tsx": "^4.16.0",
|
|
27
|
+
"typescript": "^5.5.0",
|
|
28
|
+
"vitest": "^2.0.0"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc -p tsconfig.json",
|
|
39
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"emit": "tsx src/emit.ts"
|
|
42
|
+
}
|
|
43
|
+
}
|