@atom63/styles 0.1.0-beta.5 → 0.1.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +14 -8
  2. package/generated/atom63.figma-sync.json +3763 -1108
  3. package/generated/atom63.tokens.json +3809 -829
  4. package/package.json +5 -6
  5. package/src/compat/a63-from-shadcn.css +10 -0
  6. package/src/contracts/action.css +4 -3
  7. package/src/contracts/action.native.css +11 -0
  8. package/src/contracts/action.tokens.json +66 -0
  9. package/src/contracts/badge.css +28 -19
  10. package/src/contracts/badge.resolver.json +366 -0
  11. package/src/contracts/choice.css +4 -1
  12. package/src/contracts/choice.native.css +9 -0
  13. package/src/contracts/choice.tokens.json +66 -0
  14. package/src/contracts/control.css +43 -52
  15. package/src/contracts/control.native.css +13 -0
  16. package/src/contracts/control.tokens.json +245 -0
  17. package/src/contracts/environment.css +45 -49
  18. package/src/contracts/environment.native.css +23 -0
  19. package/src/contracts/environment.resolver.json +569 -0
  20. package/src/contracts/field.css +3 -1
  21. package/src/contracts/field.tokens.json +40 -0
  22. package/src/contracts/marker.css +6 -4
  23. package/src/contracts/marker.tokens.json +15 -0
  24. package/src/contracts/menu.css +25 -61
  25. package/src/contracts/menu.native.css +10 -0
  26. package/src/contracts/menu.resolver.json +122 -0
  27. package/src/contracts/overlay.css +11 -13
  28. package/src/contracts/overlay.native.css +13 -0
  29. package/src/contracts/overlay.tokens.json +103 -0
  30. package/src/contracts/segment.css +22 -68
  31. package/src/contracts/segment.tokens.json +19 -0
  32. package/src/contracts/selection.css +3 -1
  33. package/src/contracts/selection.tokens.json +37 -0
  34. package/src/contracts/skeleton.css +3 -0
  35. package/src/contracts/skeleton.resolver.json +66 -0
  36. package/src/contracts/surface.css +13 -24
  37. package/src/contracts/surface.native.css +17 -0
  38. package/src/contracts/surface.tokens.json +97 -0
  39. package/src/contracts/toggle.css +3 -1
  40. package/src/contracts/toggle.tokens.json +49 -0
  41. package/src/contracts/track.css +3 -1
  42. package/src/contracts/track.tokens.json +39 -0
  43. package/src/contracts/trigger.css +5 -2
  44. package/src/contracts/trigger.native.css +9 -0
  45. package/src/contracts/trigger.tokens.json +58 -0
  46. package/src/contracts/widget.css +41 -51
  47. package/src/contracts/widget.native.css +23 -0
  48. package/src/contracts/widget.resolver.json +1104 -0
  49. package/src/tailwind/theme.css +0 -2
  50. package/src/themes/aqua.css +24 -89
  51. package/src/themes/aqua.native.css +80 -0
  52. package/src/themes/aqua.resolver.json +1292 -0
  53. package/src/themes/modern.css +10 -14
  54. package/src/themes/modern.native.css +16 -0
  55. package/src/themes/modern.resolver.json +350 -0
  56. package/src/themes/retro.css +21 -26
  57. package/src/themes/retro.native.css +16 -0
  58. package/src/themes/retro.resolver.json +788 -0
  59. package/src/themes/terminal.css +34 -41
  60. package/src/themes/terminal.native.css +22 -0
  61. package/src/themes/terminal.resolver.json +517 -0
  62. package/src/tokens/brand-action.css +50 -0
  63. package/src/tokens/brand-action.resolver.json +118 -0
  64. package/src/tokens/brand-ramp.css +108 -0
  65. package/src/tokens/brand-ramp.resolver.json +418 -0
  66. package/src/tokens/brand.css +6 -146
  67. package/src/tokens/color-mix-space.browser.test.ts +79 -0
  68. package/src/tokens/contrast.browser.test.ts +47 -3
  69. package/src/tokens/figma-parity.browser.test.ts +257 -0
  70. package/src/tokens/font.css +6 -0
  71. package/src/tokens/font.resolver.json +107 -0
  72. package/src/tokens/foundation/effects.css +13 -13
  73. package/src/tokens/foundation/effects.resolver.json +433 -0
  74. package/src/tokens/foundation/fonts.css +3 -1
  75. package/src/tokens/foundation/fonts.tokens.json +6 -1
  76. package/src/tokens/foundation/radius.css +6 -9
  77. package/src/tokens/foundation/radius.tokens.json +100 -0
  78. package/src/tokens/foundation/typography.css +25 -12
  79. package/src/tokens/foundation/typography.native.css +11 -0
  80. package/src/tokens/foundation/typography.resolver.json +936 -0
  81. package/src/tokens/foundation.css +0 -1
  82. package/src/tokens/motion.css +3 -1
  83. package/src/tokens/motion.resolver.json +135 -0
  84. package/src/tokens/native-values.json +38 -0
  85. package/src/tokens/personalization-axes.browser.test.ts +5 -3
  86. package/src/tokens/radius.css +12 -8
  87. package/src/tokens/radius.resolver.json +138 -0
  88. package/src/tokens/semantics.css +59 -43
  89. package/src/tokens/semantics.resolver.json +402 -0
  90. package/src/tokens/space.css +8 -6
  91. package/src/tokens/space.tokens.json +78 -0
  92. package/src/tokens/swift-parity.browser.test.ts +137 -0
  93. package/src/tokens/type-scale.css +6 -0
  94. package/src/tokens/type-scale.resolver.json +67 -0
  95. package/generated/atom63.figma-tokens.json +0 -21661
  96. package/src/tokens/foundation/aliases.css +0 -32
  97. package/src/tokens/foundation/aliases.tokens.json +0 -105
@@ -0,0 +1,79 @@
1
+ import { afterEach, describe, expect, it } from 'vitest'
2
+ import manifest from '../../generated/atom63.tokens.json'
3
+ import { resetRoot, root } from '../test/apply-styles'
4
+
5
+ /*
6
+ * An oklch color-mix() interpolates hue. When one operand is a slightly tinted
7
+ * neutral (the n2–n6 surface palettes), engines disagree on that operand's hue:
8
+ * Chromium treats a hue this close to gray as powerless and takes the other
9
+ * operand's hue, while Firefox and WebKit interpolate from it, so the same mix
10
+ * renders a different color per browser (up to 170/255 apart on a theme). oklab
11
+ * has no hue, so every engine agrees. CSS Color 4 makes an oklch hue powerless
12
+ * only at C <= 0.000004, so Firefox and WebKit follow the spec and Chromium's
13
+ * wider threshold is the bug. The rule: an oklch mix may not take an operand
14
+ * whose chroma is above that epsilon but low (a tinted neutral) under any
15
+ * surface or mode; mix those in oklab. Exact grays, black and white fall under
16
+ * the epsilon, have no hue in any engine, and are fine.
17
+ */
18
+
19
+ const lowChroma = { min: 0.000004, max: 0.04 }
20
+
21
+ const mixes = (
22
+ manifest as { entries: { cssVar: string; type: string; value: string; scope: string }[] }
23
+ ).entries.filter(entry => entry.type === 'color' && /color-mix\(\s*in oklch/.test(entry.value))
24
+
25
+ const probe = document.createElement('div')
26
+ document.body.append(probe)
27
+
28
+ /** oklch chroma of a CSS color, or null when it does not parse. */
29
+ function chroma(color: string): number | null {
30
+ probe.style.color = ''
31
+ probe.style.color = `oklch(from ${color} l c h)`
32
+ if (!probe.style.color) return null
33
+ const match = /^oklch\(([-\d.e]+) ([-\d.e]+)/.exec(getComputedStyle(probe).color)
34
+ return match ? Number(match[2]) : null
35
+ }
36
+
37
+ /** The var() operands of a color-mix(), in order. */
38
+ function operands(value: string): string[] {
39
+ return [...value.matchAll(/var\((--[\w-]+)\)/g)].map(match => match[1])
40
+ }
41
+
42
+ afterEach(() => {
43
+ resetRoot()
44
+ for (const attribute of ['data-a63-theme', 'data-a63-surface', 'data-a63-mode'])
45
+ root().removeAttribute(attribute)
46
+ root().classList.remove('light', 'dark')
47
+ })
48
+
49
+ describe('color-mix interpolation space', () => {
50
+ it('finds the oklch mixes', () => {
51
+ expect(mixes.length).toBeGreaterThan(0)
52
+ })
53
+
54
+ it('never mixes a tinted neutral in oklch', () => {
55
+ const violations = new Set<string>()
56
+ for (const theme of ['modern', 'aqua', 'retro', 'terminal'])
57
+ for (const surface of ['n1', 'n2', 'n3', 'n4', 'n5', 'n6'])
58
+ for (const mode of ['light', 'dark']) {
59
+ const element = root()
60
+ element.setAttribute('data-a63-theme', theme)
61
+ element.setAttribute('data-a63-surface', surface)
62
+ element.setAttribute('data-a63-mode', mode)
63
+ element.classList.remove('light', 'dark')
64
+ element.classList.add(mode)
65
+ const styles = getComputedStyle(element)
66
+ for (const entry of mixes) {
67
+ for (const operand of operands(entry.value)) {
68
+ const value = styles.getPropertyValue(operand).trim()
69
+ const c = value && chroma(value)
70
+ if (typeof c === 'number' && c >= lowChroma.min && c < lowChroma.max)
71
+ violations.add(
72
+ `${entry.cssVar} [${entry.scope.replace(/\s+/g, ' ')}] via ${operand}`
73
+ )
74
+ }
75
+ }
76
+ }
77
+ expect([...violations].sort()).toEqual([])
78
+ })
79
+ })
@@ -13,15 +13,26 @@ const textPairs = [
13
13
  { fg: '--a63-text-primary', bg: '--a63-surface-page', min: AA_TEXT },
14
14
  { fg: '--a63-text-secondary', bg: '--a63-surface-page', min: AA_TEXT },
15
15
  { fg: '--a63-text-primary', bg: '--a63-surface-panel', min: AA_TEXT },
16
+ { fg: '--a63-text-accent', bg: '--a63-surface-page', min: AA_TEXT },
17
+ { fg: '--a63-text-accent', bg: '--a63-surface-panel', min: AA_TEXT },
16
18
  ] as const
17
19
 
18
20
  const actionPairs = [
19
- { fg: '--a63-action-primary-foreground', bg: '--a63-action-primary', min: AA_UI },
21
+ // Button labels are normal-size text, so the primary pair meets AA text, not 3:1.
22
+ { fg: '--a63-action-primary-foreground', bg: '--a63-action-primary', min: AA_TEXT },
20
23
  { fg: '--a63-action-neutral-foreground', bg: '--a63-action-neutral', min: AA_UI },
21
24
  { fg: '--a63-action-danger-foreground', bg: '--a63-action-danger', min: AA_UI },
22
25
  ] as const
23
26
 
24
- const pairs = [...textPairs, ...actionPairs] as const
27
+ // Status accents paint icons and borders (alerts, copy check, load more), so
28
+ // they meet WCAG's 3:1 for graphics against the page.
29
+ const statusPairs = [
30
+ { fg: '--a63-status-info', bg: '--a63-surface-page', min: AA_UI },
31
+ { fg: '--a63-status-success', bg: '--a63-surface-page', min: AA_UI },
32
+ { fg: '--a63-status-warning', bg: '--a63-surface-page', min: AA_UI },
33
+ ] as const
34
+
35
+ const pairs = [...textPairs, ...actionPairs, ...statusPairs] as const
25
36
 
26
37
  afterEach(() => {
27
38
  document.documentElement.removeAttribute('data-a63-theme')
@@ -105,7 +116,7 @@ function applyThemeMode(theme: (typeof themes)[number], mode: (typeof modes)[num
105
116
  }
106
117
 
107
118
  describe('core semantic contrast (WCAG AA)', () => {
108
- it('meets AA text 4.5:1 on surfaces and UI 3:1 on action fills', () => {
119
+ it('meets AA text 4.5:1 on surfaces and the primary fill, and 3:1 on other action fills', () => {
109
120
  const failures: string[] = []
110
121
 
111
122
  for (const theme of themes) {
@@ -138,3 +149,36 @@ describe('core semantic contrast (WCAG AA)', () => {
138
149
  expect(failures, failures.join('\n')).toEqual([])
139
150
  })
140
151
  })
152
+
153
+ const brands = ['b1', 'b2', 'b3', 'b4', 'b5', 'b6'] as const
154
+ const brandPairs = [
155
+ { fg: '--a63-action-primary-foreground', bg: '--a63-action-primary', min: AA_TEXT },
156
+ { fg: '--a63-text-accent', bg: '--a63-surface-page', min: AA_TEXT },
157
+ ] as const
158
+
159
+ describe('brand contrast (WCAG AA)', () => {
160
+ afterEach(() => root().removeAttribute('data-a63-brand'))
161
+
162
+ it('keeps the primary action and brand text readable on every brand ramp', () => {
163
+ const failures: string[] = []
164
+ for (const brand of brands) {
165
+ root().setAttribute('data-a63-brand', brand)
166
+ for (const theme of themes) {
167
+ for (const mode of modes) {
168
+ applyThemeMode(theme, mode)
169
+ for (const { fg, bg, min } of brandPairs) {
170
+ const fgCss = resolvePaintedColor(fg, 'color')
171
+ const bgCss = resolvePaintedColor(bg, 'background')
172
+ const ratio = contrastRatio(parseCssColor(fgCss), parseCssColor(bgCss))
173
+ if (ratio < min) {
174
+ failures.push(
175
+ `${brand} ${theme}/${mode} ${fg} on ${bg}: ${ratio.toFixed(2)}:1 < ${min}:1 (fg=${fgCss}, bg=${bgCss})`
176
+ )
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ expect(failures, failures.join('\n')).toEqual([])
183
+ })
184
+ })
@@ -0,0 +1,257 @@
1
+ import { afterEach, beforeAll, describe, expect, it } from 'vitest'
2
+ import { page } from 'vitest/browser'
3
+ import model from '../../generated/atom63.figma-sync.json'
4
+ import { resetRoot, root } from '../test/apply-styles'
5
+
6
+ /*
7
+ * Figma/web parity across every axis. Each Figma variable is resolved through
8
+ * the sync model the way Figma resolves it (follow aliases; a collection takes
9
+ * its mode from the active context) and compared with what the browser computes
10
+ * for the token under the same data-a63-* attributes. The Swift parity test
11
+ * checks the default context only; this one checks every mode of every axis,
12
+ * and every theme × brand × surface × mode combination for colors, because
13
+ * those four interact.
14
+ *
15
+ * Variables the model lists as `computed` vary on more axes than one Figma
16
+ * collection can hold; Figma shows their default and renderers evaluate their
17
+ * expression, so they are left out here, and so is any variable whose alias
18
+ * chain reaches one of them in the context being checked. The viewport matches the generator's
19
+ * page (1280 × 720), because viewport units and media queries resolve against it.
20
+ */
21
+
22
+ type Rgba = { r: number; g: number; b: number; a: number }
23
+ type Value = { alias?: string; value?: Rgba | number | string }
24
+ interface Variable {
25
+ name: string
26
+ token: string
27
+ type: 'COLOR' | 'FLOAT' | 'STRING'
28
+ values: Record<string, Value>
29
+ }
30
+ interface Collection {
31
+ name: string
32
+ modes: string[]
33
+ variables: Variable[]
34
+ }
35
+
36
+ const { collections, computed } = model as {
37
+ collections: Collection[]
38
+ computed: { token: string }[]
39
+ }
40
+ const computedTokens = new Set(computed.map(entry => entry.token))
41
+ const byToken = new Map<string, { collection: Collection; variable: Variable }>()
42
+ for (const collection of collections)
43
+ for (const variable of collection.variables) byToken.set(variable.token, { collection, variable })
44
+
45
+ // Context keys and the attribute each one sets on the root.
46
+ const attributes = {
47
+ theme: 'data-a63-theme',
48
+ mode: 'data-a63-mode',
49
+ brand: 'data-a63-brand',
50
+ surface: 'data-a63-surface',
51
+ designLanguage: 'data-a63-design-language',
52
+ input: 'data-a63-input',
53
+ density: 'data-a63-density',
54
+ radius: 'data-a63-radius',
55
+ typeScale: 'data-a63-type-scale',
56
+ font: 'data-a63-font',
57
+ windowSize: 'data-window-size',
58
+ } as const
59
+ type Context = Record<keyof typeof attributes, string>
60
+
61
+ const defaults: Context = {
62
+ theme: 'modern',
63
+ mode: 'light',
64
+ brand: 'b1',
65
+ surface: 'n1',
66
+ designLanguage: 'web',
67
+ input: 'pointer',
68
+ density: 'comfortable',
69
+ radius: 'default',
70
+ typeScale: 'normal',
71
+ font: 'sans',
72
+ windowSize: 'md',
73
+ }
74
+
75
+ // Which context key picks the mode of each axis collection.
76
+ const collectionAxis: Record<string, keyof Context> = {
77
+ 'Atom63 Mode': 'mode',
78
+ 'Atom63 Brand': 'brand',
79
+ 'Atom63 Surface': 'surface',
80
+ 'Atom63 Design Language': 'designLanguage',
81
+ 'Atom63 Input': 'input',
82
+ 'Atom63 Density': 'density',
83
+ 'Atom63 Radius': 'radius',
84
+ 'Atom63 Type Scale': 'typeScale',
85
+ 'Atom63 Font': 'font',
86
+ 'Atom63 Window Size': 'windowSize',
87
+ }
88
+
89
+ function modeOf(collection: Collection, context: Context): string {
90
+ if (collection.name === 'Atom63 Theme') return `${context.theme}-${context.mode}`
91
+ const axis = collectionAxis[collection.name]
92
+ return axis ? context[axis] : collection.modes[0]
93
+ }
94
+
95
+ /**
96
+ * The value Figma shows for a token in a context, following aliases, and
97
+ * whether the chain passed through a `computed` variable.
98
+ */
99
+ function resolveInModel(
100
+ token: string,
101
+ context: Context,
102
+ seen: string[] = []
103
+ ): { value: Value['value']; approximate: boolean } {
104
+ const found = byToken.get(token)
105
+ if (!found) throw new Error(`${token} is not in the Figma sync model`)
106
+ if (seen.includes(token)) throw new Error(`alias cycle: ${[...seen, token].join(' -> ')}`)
107
+ const entry = found.variable.values[modeOf(found.collection, context)]
108
+ if (entry?.alias) {
109
+ const target = resolveInModel(entry.alias, context, [...seen, token])
110
+ return { ...target, approximate: target.approximate || computedTokens.has(token) }
111
+ }
112
+ return { value: entry?.value, approximate: computedTokens.has(token) }
113
+ }
114
+
115
+ function applyContext(context: Context) {
116
+ const element = root()
117
+ for (const [key, attribute] of Object.entries(attributes))
118
+ element.setAttribute(attribute, context[key as keyof Context])
119
+ element.classList.remove('light', 'dark')
120
+ element.classList.add(context.mode)
121
+ }
122
+
123
+ const probe = document.createElement('div')
124
+ document.body.append(probe)
125
+
126
+ /** Float sRGB, like the generator reads it: no 8-bit rounding. */
127
+ function browserColor(value: string): Rgba | null {
128
+ probe.style.color = ''
129
+ probe.style.color = `color(from ${value} srgb r g b / alpha)`
130
+ if (!probe.style.color) return null
131
+ const match = /^color\(srgb ([-\d.e]+) ([-\d.e]+) ([-\d.e]+)(?: \/ ([-\d.e]+))?\)$/.exec(
132
+ getComputedStyle(probe).color
133
+ )
134
+ if (!match) return null
135
+ const channel = (text: string) => Math.min(1, Math.max(0, Number(text)))
136
+ return {
137
+ r: channel(match[1]),
138
+ g: channel(match[2]),
139
+ b: channel(match[3]),
140
+ a: channel(match[4] ?? '1'),
141
+ }
142
+ }
143
+
144
+ function browserNumber(value: string): number | null {
145
+ const trimmed = value.trim()
146
+ const percent = /^(-?[\d.]+)%$/.exec(trimmed)
147
+ if (percent) return Number(percent[1])
148
+ if (/^-?[\d.]+$/.test(trimmed)) return Number(trimmed)
149
+ const time = /^(-?[\d.]+)(ms|s)$/.exec(trimmed)
150
+ if (time) return Number(time[1]) * (time[2] === 's' ? 1000 : 1)
151
+ probe.style.width = ''
152
+ probe.style.width = trimmed
153
+ if (probe.style.width) return Number.parseFloat(getComputedStyle(probe).width)
154
+ return null
155
+ }
156
+
157
+ const normalize = (text: string) => text.replace(/\s+/g, ' ').trim()
158
+
159
+ /** Differences between the model and the browser for these tokens in one context. */
160
+ function compare(context: Context, variables: Variable[]): string[] {
161
+ applyContext(context)
162
+ const styles = getComputedStyle(root())
163
+ const label = `${context.theme}-${context.mode} ${Object.entries(context)
164
+ .filter(
165
+ ([key, value]) =>
166
+ key !== 'theme' && key !== 'mode' && value !== defaults[key as keyof Context]
167
+ )
168
+ .map(([key, value]) => `${key}=${value}`)
169
+ .join(' ')}`.trim()
170
+ const differences: string[] = []
171
+ for (const variable of variables) {
172
+ const raw = styles.getPropertyValue(variable.token)
173
+ const { value: expected, approximate } = resolveInModel(variable.token, context)
174
+ if (approximate) continue
175
+ if (variable.type === 'COLOR') {
176
+ const web = browserColor(raw)
177
+ const figma = expected as Rgba
178
+ if (!web) continue
179
+ const drift = Math.max(
180
+ Math.abs(web.r - figma.r),
181
+ Math.abs(web.g - figma.g),
182
+ Math.abs(web.b - figma.b),
183
+ Math.abs(web.a - figma.a)
184
+ )
185
+ if (drift > 1.5 / 255) differences.push(`${variable.token} @ ${label}`)
186
+ } else if (variable.type === 'FLOAT') {
187
+ const web = browserNumber(raw)
188
+ if (web === null) continue
189
+ if (Math.abs(web - (expected as number)) > 0.01)
190
+ differences.push(`${variable.token} @ ${label}`)
191
+ } else if (normalize(raw) !== normalize(String(expected))) {
192
+ differences.push(`${variable.token} @ ${label}`)
193
+ }
194
+ }
195
+ return differences
196
+ }
197
+
198
+ const allVariables = collections
199
+ .flatMap(collection => collection.variables)
200
+ .filter(variable => !computedTokens.has(variable.token))
201
+ const colorVariables = allVariables.filter(variable => variable.type === 'COLOR')
202
+
203
+ // Every mode of every axis on its own, and every theme × mode.
204
+ const axisContexts: Context[] = [defaults]
205
+ for (const collection of collections) {
206
+ const axis = collectionAxis[collection.name]
207
+ if (!axis) continue
208
+ for (const mode of collection.modes)
209
+ if (mode !== defaults[axis]) axisContexts.push({ ...defaults, [axis]: mode })
210
+ }
211
+ for (const theme of ['modern', 'aqua', 'retro', 'terminal'])
212
+ for (const mode of ['light', 'dark']) axisContexts.push({ ...defaults, theme, mode })
213
+
214
+ // Colors: every theme × brand × surface × mode.
215
+ const colorContexts: Context[] = []
216
+ for (const theme of ['modern', 'aqua', 'retro', 'terminal'])
217
+ for (const brand of ['b1', 'b2', 'b3', 'b4', 'b5', 'b6'])
218
+ for (const surface of ['n1', 'n2', 'n3', 'n4', 'n5', 'n6'])
219
+ for (const mode of ['light', 'dark'])
220
+ colorContexts.push({ ...defaults, theme, brand, surface, mode })
221
+
222
+ beforeAll(async () => {
223
+ await page.viewport(1280, 720)
224
+ })
225
+
226
+ afterEach(() => {
227
+ resetRoot()
228
+ for (const attribute of Object.values(attributes)) root().removeAttribute(attribute)
229
+ root().classList.remove('light', 'dark')
230
+ })
231
+
232
+ /** Groups differences by token, listing the contexts where each one differs. */
233
+ function summarize(differences: string[]) {
234
+ const byTokenName = new Map<string, string[]>()
235
+ for (const difference of differences) {
236
+ const [token, context] = difference.split(' @ ')
237
+ byTokenName.set(token, [...(byTokenName.get(token) ?? []), context])
238
+ }
239
+ return Object.fromEntries(
240
+ [...byTokenName].map(([token, contexts]) => [
241
+ token,
242
+ `${contexts.length}: ${contexts.slice(0, 3).join(' | ')}`,
243
+ ])
244
+ )
245
+ }
246
+
247
+ describe('Figma/web parity', () => {
248
+ it('matches every variable on every axis', () => {
249
+ const differences = axisContexts.flatMap(context => compare(context, allVariables))
250
+ expect(summarize(differences)).toEqual({})
251
+ })
252
+
253
+ it('matches every color across theme × brand × surface × mode', () => {
254
+ const differences = colorContexts.flatMap(context => compare(context, colorVariables))
255
+ expect(summarize(differences)).toEqual({})
256
+ })
257
+ })
@@ -1,4 +1,7 @@
1
1
  /*
2
+ * Generated from src/tokens/font.resolver.json by scripts/build-css-from-dtcg.mjs. Do not edit;
3
+ * change the DTCG source and run `pnpm --filter @atom63/styles generate:tokens`.
4
+ *
2
5
  * Font personalization axis.
3
6
  *
4
7
  * --a63-font-app is the active application font stack; a consumer applies it on
@@ -14,12 +17,15 @@
14
17
  [data-a63-font='sans'] {
15
18
  --a63-font-app: var(--font-family-sans);
16
19
  }
20
+
17
21
  [data-a63-font='serif'] {
18
22
  --a63-font-app: var(--font-family-serif);
19
23
  }
24
+
20
25
  [data-a63-font='mono'] {
21
26
  --a63-font-app: var(--font-family-mono);
22
27
  }
28
+
23
29
  [data-a63-font='pixel'] {
24
30
  --a63-font-app: var(--font-family-pixel);
25
31
  }
@@ -0,0 +1,107 @@
1
+ {
2
+ "version": "2025.10",
3
+ "description": "Font personalization axis.\n\n--a63-font-app is the active application font stack; a consumer applies it on\nthe app root (e.g. `font-family: var(--a63-font-app)` on body). [data-a63-font]\nremaps it to one of the four foundation family stacks (foundation/fonts.css).\nDefaults to the sans stack.",
4
+ "sets": {
5
+ "base": {
6
+ "sources": [
7
+ {
8
+ "a63": {
9
+ "font": {
10
+ "app": {
11
+ "$type": "fontFamily",
12
+ "$value": "{font.family.sans}"
13
+ }
14
+ }
15
+ },
16
+ "font": {
17
+ "weight": {
18
+ "medium": {
19
+ "$type": "fontWeight",
20
+ "$value": 500
21
+ }
22
+ }
23
+ }
24
+ }
25
+ ],
26
+ "$extensions": {
27
+ "io.atom63.css": {
28
+ "selector": ":root"
29
+ }
30
+ }
31
+ }
32
+ },
33
+ "modifiers": {
34
+ "font": {
35
+ "default": "sans",
36
+ "contexts": {
37
+ "sans": [
38
+ {
39
+ "a63": {
40
+ "font": {
41
+ "app": {
42
+ "$type": "fontFamily",
43
+ "$value": "{font.family.sans}"
44
+ }
45
+ }
46
+ }
47
+ }
48
+ ],
49
+ "serif": [
50
+ {
51
+ "a63": {
52
+ "font": {
53
+ "app": {
54
+ "$type": "fontFamily",
55
+ "$value": "{font.family.serif}"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ],
61
+ "mono": [
62
+ {
63
+ "a63": {
64
+ "font": {
65
+ "app": {
66
+ "$type": "fontFamily",
67
+ "$value": "{font.family.mono}"
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ],
73
+ "pixel": [
74
+ {
75
+ "a63": {
76
+ "font": {
77
+ "app": {
78
+ "$type": "fontFamily",
79
+ "$value": "{font.family.pixel}"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ ]
85
+ }
86
+ }
87
+ },
88
+ "resolutionOrder": [
89
+ {
90
+ "$ref": "#/sets/base"
91
+ },
92
+ {
93
+ "$ref": "#/modifiers/font"
94
+ }
95
+ ],
96
+ "$extensions": {
97
+ "io.atom63.css": {
98
+ "attribute": "data-a63-font",
99
+ "selectors": {
100
+ "sans": "[data-a63-font='sans']",
101
+ "serif": "[data-a63-font='serif']",
102
+ "mono": "[data-a63-font='mono']",
103
+ "pixel": "[data-a63-font='pixel']"
104
+ }
105
+ }
106
+ }
107
+ }
@@ -1,9 +1,16 @@
1
- /* Effects — shared shadow + blur scales */
2
- /* Shadows override Tailwind's defaults so values match Figma tokens */
3
- /* Usage: shadow-md → var(--shadow-md) → var(--effect-shadow-md) */
4
-
5
- /* Shadow utilities read effect aliases at runtime so generated themes can swap
6
- visual depth without rebuilding Tailwind classes. */
1
+ /*
2
+ * Generated from src/tokens/foundation/effects.resolver.json by scripts/build-css-from-dtcg.mjs. Do not edit;
3
+ * change the DTCG source and run `pnpm --filter @atom63/styles generate:tokens`.
4
+ *
5
+ * Effects — shared shadow + blur scales
6
+ *
7
+ * Shadows override Tailwind's defaults so values match Figma tokens
8
+ *
9
+ * Usage: shadow-md → var(--shadow-md) → var(--effect-shadow-md)
10
+ *
11
+ * Shadow utilities read effect aliases at runtime so generated themes can swap
12
+ * visual depth without rebuilding Tailwind classes.
13
+ */
7
14
  :root,
8
15
  .light {
9
16
  --effect-shadow-2xs: 0px 1px 1px 0px rgb(0 0 0 / 0.04);
@@ -13,7 +20,6 @@
13
20
  --effect-shadow-lg: 0px 8px 14px -4px rgb(0 0 0 / 0.07), 0px 18px 32px -12px rgb(0 0 0 / 0.1);
14
21
  --effect-shadow-xl: 0px 14px 22px -6px rgb(0 0 0 / 0.08), 0px 34px 64px -16px rgb(0 0 0 / 0.13);
15
22
  --effect-shadow-2xl: 0px 20px 32px -8px rgb(0 0 0 / 0.1), 0px 52px 96px -18px rgb(0 0 0 / 0.14);
16
-
17
23
  /* Blur scale — canonical shared steps; Tailwind adapter re-references. */
18
24
  --blur-xs: 4px;
19
25
  --blur-sm: 8px;
@@ -23,9 +29,3 @@
23
29
  --blur-2xl: 40px;
24
30
  --blur-3xl: 64px;
25
31
  }
26
-
27
- /*
28
- * Theme-private material (gel stacks, bevels, CRT glows, skin-only blur stops)
29
- * lives under `[data-a63-theme]` in themes/*.css — not here. Promote into this
30
- * file only when a second theme or an adapter needs the same stop.
31
- */