@atom63/styles 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +233 -0
  2. package/generated/atom63.figma-tokens.json +21650 -0
  3. package/generated/atom63.tokens.json +21909 -0
  4. package/package.json +116 -0
  5. package/src/animations/animations.css +55 -0
  6. package/src/animations/index.css +1 -0
  7. package/src/compat/a63-from-shadcn.css +141 -0
  8. package/src/compat/index.css +2 -0
  9. package/src/compat/mdx.css +13 -0
  10. package/src/compat/shadcn.css +52 -0
  11. package/src/contracts/action.css +31 -0
  12. package/src/contracts/badge.css +68 -0
  13. package/src/contracts/choice.css +32 -0
  14. package/src/contracts/control.css +102 -0
  15. package/src/contracts/environment.css +158 -0
  16. package/src/contracts/field.css +26 -0
  17. package/src/contracts/index.css +26 -0
  18. package/src/contracts/marker.css +23 -0
  19. package/src/contracts/menu.css +100 -0
  20. package/src/contracts/overlay.css +44 -0
  21. package/src/contracts/segment.css +100 -0
  22. package/src/contracts/selection.css +21 -0
  23. package/src/contracts/skeleton.css +14 -0
  24. package/src/contracts/surface.css +56 -0
  25. package/src/contracts/toggle.css +26 -0
  26. package/src/contracts/track.css +26 -0
  27. package/src/contracts/trigger.css +28 -0
  28. package/src/contracts/widget.css +196 -0
  29. package/src/index.css +17 -0
  30. package/src/manifest/types.ts +61 -0
  31. package/src/os/index.css +2 -0
  32. package/src/os/macos.css +54 -0
  33. package/src/os/windows.css +299 -0
  34. package/src/tailwind/animations.css +8 -0
  35. package/src/tailwind/index.css +4 -0
  36. package/src/tailwind/theme.css +516 -0
  37. package/src/tailwind/utilities.css +41 -0
  38. package/src/tailwind/variants.css +64 -0
  39. package/src/test/apply-styles.ts +30 -0
  40. package/src/themes/aqua.css +240 -0
  41. package/src/themes/index.css +4 -0
  42. package/src/themes/modern.css +55 -0
  43. package/src/themes/retro.css +112 -0
  44. package/src/themes/terminal.css +179 -0
  45. package/src/tokens/brand.css +148 -0
  46. package/src/tokens/contrast.browser.test.ts +140 -0
  47. package/src/tokens/font.css +24 -0
  48. package/src/tokens/foundation/aliases.css +28 -0
  49. package/src/tokens/foundation/effects.css +31 -0
  50. package/src/tokens/foundation/fonts.css +11 -0
  51. package/src/tokens/foundation/motion.css +19 -0
  52. package/src/tokens/foundation/palette.css +255 -0
  53. package/src/tokens/foundation/primitives.css +420 -0
  54. package/src/tokens/foundation/radius.css +36 -0
  55. package/src/tokens/foundation/typography.css +191 -0
  56. package/src/tokens/foundation.css +15 -0
  57. package/src/tokens/index.css +9 -0
  58. package/src/tokens/motion.css +27 -0
  59. package/src/tokens/personalization-axes.browser.test.ts +240 -0
  60. package/src/tokens/radius.css +35 -0
  61. package/src/tokens/semantics.css +157 -0
  62. package/src/tokens/space.css +21 -0
  63. package/src/tokens/surface.css +184 -0
  64. package/src/tokens/theme-overrides.browser.test.ts +140 -0
  65. package/src/tokens/type-scale.css +20 -0
  66. package/src/tokens/widget-chrome-signature.browser.test.ts +225 -0
  67. package/src/tokens/widget-paint.browser.test.ts +98 -0
  68. package/src/utils/code-highlighting.css +35 -0
  69. package/src/utils/debug.css +453 -0
  70. package/src/utils/index.css +9 -0
  71. package/src/utils/scroll-bar.css +78 -0
  72. package/src/utils/scroll-mask.css +119 -0
  73. package/src/utils/view-transition.css +16 -0
  74. package/src/z-layers.ts +40 -0
@@ -0,0 +1,140 @@
1
+ import { afterEach, describe, expect, it } from 'vitest'
2
+ import { cssVar, root } from '../test/apply-styles'
3
+
4
+ afterEach(() => {
5
+ document.documentElement.removeAttribute('data-a63-theme')
6
+ document.documentElement.removeAttribute('data-a63-mode')
7
+ document.documentElement.removeAttribute('data-a63-brand')
8
+ document.documentElement.classList.remove('dark', 'light')
9
+ })
10
+
11
+ describe('weather widget contract', () => {
12
+ it('defaults to the live semantic condition material', () => {
13
+ const probe = document.createElement('div')
14
+ probe.dataset.widgetKind = 'weather'
15
+ probe.dataset.weatherTone = 'clear-night'
16
+ document.body.appendChild(probe)
17
+
18
+ expect(getComputedStyle(probe).getPropertyValue('--a63-widget-background-image')).toContain(
19
+ 'linear-gradient'
20
+ )
21
+ probe.remove()
22
+ })
23
+
24
+ it('adjusts the same live condition for light and dark modes', () => {
25
+ const shell = document.createElement('div')
26
+ const probe = document.createElement('div')
27
+ probe.dataset.widgetKind = 'weather'
28
+ probe.dataset.weatherTone = 'clear-night'
29
+ shell.appendChild(probe)
30
+ document.body.appendChild(shell)
31
+
32
+ shell.className = 'light'
33
+ const light = getComputedStyle(probe).getPropertyValue(
34
+ '--a63-weather-condition-background-image'
35
+ )
36
+ shell.className = 'dark'
37
+ const dark = getComputedStyle(probe).getPropertyValue(
38
+ '--a63-weather-condition-background-image'
39
+ )
40
+
41
+ expect(light).not.toBe(dark)
42
+ shell.remove()
43
+ })
44
+
45
+ it('gives each expressive theme an authored weather material', () => {
46
+ const values = new Set<string>()
47
+
48
+ for (const theme of ['aqua', 'retro', 'terminal']) {
49
+ root().setAttribute('data-a63-theme', theme)
50
+ root().setAttribute('data-a63-mode', 'dark')
51
+ root().classList.add('dark')
52
+ values.add(cssVar('--a63-weather-background-image'))
53
+ }
54
+
55
+ expect(values.size).toBe(3)
56
+ expect(values).not.toContain('')
57
+ })
58
+ })
59
+
60
+ describe('theme archetype overrides win over the base contract', () => {
61
+ it('a theme sets --a63-control-shadow (not clobbered to none by contracts)', () => {
62
+ root().setAttribute('data-a63-theme', 'aqua')
63
+ const shadow = cssVar('--a63-control-shadow')
64
+ expect(shadow).not.toBe('none')
65
+ expect(shadow).not.toBe('')
66
+ })
67
+
68
+ it('terminal overrides --a63-control-shadow distinctly from aqua', () => {
69
+ root().setAttribute('data-a63-theme', 'aqua')
70
+ const aqua = cssVar('--a63-control-shadow')
71
+ root().setAttribute('data-a63-theme', 'terminal')
72
+ const terminal = cssVar('--a63-control-shadow')
73
+ expect(terminal).not.toBe(aqua)
74
+ })
75
+ })
76
+
77
+ describe('theme-private material under data-a63-theme', () => {
78
+ it('exposes the shared blur ladder on the foundation path', () => {
79
+ expect(cssVar('--blur-lg')).toBe('16px')
80
+ expect(cssVar('--blur-xl')).toBe('24px')
81
+ })
82
+
83
+ it('aqua backdrops use shared frost blur and skin-only gel blur', () => {
84
+ root().setAttribute('data-a63-theme', 'aqua')
85
+ expect(cssVar('--a63-surface-backdrop')).toContain('16px')
86
+ expect(cssVar('--a63-overlay-backdrop')).toContain('20px')
87
+ expect(cssVar('--a63-widget-rim-backdrop')).toContain('20px')
88
+ expect(cssVar('--a63-surface-backdrop')).toContain('saturate(1.4)')
89
+ expect(cssVar('--a63-overlay-backdrop')).toContain('saturate(1.6)')
90
+ })
91
+
92
+ it('modern sets tactile inset control/field shadows', () => {
93
+ root().setAttribute('data-a63-theme', 'modern')
94
+ expect(cssVar('--a63-control-shadow')).toContain('inset')
95
+ expect(cssVar('--a63-control-shadow-active')).toContain('inset')
96
+ expect(cssVar('--a63-field-shadow')).toContain('inset')
97
+ expect(cssVar('--a63-segment-selected-shadow')).toContain('inset')
98
+ })
99
+
100
+ it('aqua sets gel control shadows and a wide focus ring', () => {
101
+ root().setAttribute('data-a63-theme', 'aqua')
102
+ expect(cssVar('--a63-control-focus-ring-width')).toBe('4px')
103
+ expect(cssVar('--a63-control-shadow')).toContain('inset')
104
+ expect(cssVar('--a63-field-shadow')).toContain('inset')
105
+ expect(cssVar('--a63-overlay-shadow')).toContain('12px')
106
+ expect(cssVar('--a63-segment-selected-shadow')).toContain('inset')
107
+ })
108
+
109
+ it('aqua dark mode uses a quieter segment press stack', () => {
110
+ root().setAttribute('data-a63-theme', 'aqua')
111
+ const lightSelected = cssVar('--a63-segment-selected-shadow')
112
+ root().setAttribute('data-a63-mode', 'dark')
113
+ root().classList.add('dark')
114
+ const darkSelected = cssVar('--a63-segment-selected-shadow')
115
+ expect(darkSelected).not.toBe(lightSelected)
116
+ expect(darkSelected).toContain('inset')
117
+ })
118
+
119
+ it('retro sets chunky bevel chrome', () => {
120
+ root().setAttribute('data-a63-theme', 'retro')
121
+ expect(cssVar('--a63-control-border-width')).toBe('2px')
122
+ expect(cssVar('--a63-control-focus-ring-width')).toBe('2px')
123
+ expect(cssVar('--a63-control-shadow')).toContain('inset')
124
+ expect(cssVar('--a63-widget-shadow')).toContain('3px')
125
+ expect(cssVar('--a63-surface-border-style')).toBe('outset')
126
+ })
127
+
128
+ it('terminal CRT glows track brand on the theme scope', () => {
129
+ root().setAttribute('data-a63-theme', 'terminal')
130
+ root().setAttribute('data-a63-brand', 'b1')
131
+ const b1Control = cssVar('--a63-control-shadow')
132
+ expect(b1Control).toContain('inset')
133
+ expect(cssVar('--a63-field-shadow')).toContain('inset')
134
+ expect(cssVar('--a63-widget-shadow')).toContain('20px')
135
+
136
+ root().setAttribute('data-a63-brand', 'b3')
137
+ const b3Control = cssVar('--a63-control-shadow')
138
+ expect(b3Control).not.toBe(b1Control)
139
+ })
140
+ })
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Typography personalization axis.
3
+ *
4
+ * [data-a63-type-scale] sets the multiplier the responsive type scale
5
+ * (foundation/typography.css) already multiplies every size + line-height by.
6
+ * `normal` = 1 restates the foundation default (--typography-scale defaults to 1
7
+ * via its calc fallback) so a subtree can reset it.
8
+ */
9
+ [data-a63-type-scale='compact'] {
10
+ --typography-scale: 0.9;
11
+ }
12
+ [data-a63-type-scale='normal'] {
13
+ --typography-scale: 1;
14
+ }
15
+ [data-a63-type-scale='comfortable'] {
16
+ --typography-scale: 1.1;
17
+ }
18
+ [data-a63-type-scale='large'] {
19
+ --typography-scale: 1.2;
20
+ }
@@ -0,0 +1,225 @@
1
+ import { afterEach, describe, expect, it } from 'vitest'
2
+ import { root } from '../test/apply-styles'
3
+
4
+ /**
5
+ * Chrome-signature guards for the widget surface.
6
+ *
7
+ * Every regression these cover shipped green through unit tests, typecheck,
8
+ * lint and build, and was caught only by eye or by measuring a live browser:
9
+ *
10
+ * 1. `--a63-widget-shadow` composed `var(--a63-overlay-inner-shadow), …`, which
11
+ * resolves to `box-shadow: none, <shadow>` — invalid CSS, dropped whole. No
12
+ * theme's widget edge rendered at all.
13
+ * 2. The Storybook audit stamped the theme on a NESTED cell, so every theme
14
+ * inherited the frozen `:root` string and rendered identically.
15
+ * 3. The rim shipped alongside the face's border, producing two concentric
16
+ * rings on every tile.
17
+ *
18
+ * The theme goes on `documentElement` — which IS `:root` — so contract
19
+ * declarations re-resolve per theme with no re-emission needed.
20
+ */
21
+
22
+ const THEMES = ['modern', 'aqua', 'retro', 'terminal'] as const
23
+
24
+ /** Mirrors the shell/face split in WIDGET_RIM_SHELL_CLASS + WIDGET_CARD_SURFACE_CLASS. */
25
+ function renderSurface(kind?: 'weather') {
26
+ const shell = document.createElement('div')
27
+ shell.style.borderRadius = 'var(--a63-widget-radius)'
28
+ // The rim is a BORDER, not padding — only a border follows border-radius, so a
29
+ // per-side bevel mitres around the corner arc at any radius scale.
30
+ shell.style.borderStyle = 'solid'
31
+ shell.style.borderWidth = 'var(--a63-widget-rim-width)'
32
+ shell.style.borderColor = 'var(--a63-widget-rim-border-color)'
33
+ shell.style.backgroundColor = 'var(--a63-widget-rim-color)'
34
+ shell.style.backgroundImage = 'var(--a63-widget-rim-image)'
35
+ shell.style.backgroundOrigin = 'border-box'
36
+ shell.style.boxShadow = 'var(--a63-widget-shadow)'
37
+
38
+ const face = document.createElement('div')
39
+ face.style.borderRadius =
40
+ 'calc(var(--a63-widget-radius, var(--radius-xl)) - var(--a63-widget-rim-width))'
41
+ face.style.borderStyle = 'var(--a63-widget-border-style)'
42
+ face.style.borderWidth = 'var(--a63-widget-border-width)'
43
+ face.style.borderColor = 'var(--a63-widget-border-color)'
44
+
45
+ if (kind) shell.setAttribute('data-widget-kind', kind)
46
+ shell.appendChild(face)
47
+ document.body.appendChild(shell)
48
+ return { face, shell }
49
+ }
50
+
51
+ function signature(kind?: 'weather') {
52
+ const { face, shell } = renderSurface(kind)
53
+ const s = getComputedStyle(shell)
54
+ const f = getComputedStyle(face)
55
+ const sig = {
56
+ boxShadow: s.boxShadow,
57
+ faceBorderWidth: f.borderWidth,
58
+ rimColor: s.borderColor,
59
+ rimImage: s.backgroundImage,
60
+ // The rim is a border, so its width lives here — NOT in padding.
61
+ rimWidth: s.borderTopWidth,
62
+ }
63
+ shell.remove()
64
+ return sig
65
+ }
66
+
67
+ function px(value: string): number {
68
+ return Number.parseFloat(value) || 0
69
+ }
70
+
71
+ const RADIUS_SCALES = ['none', 'subtle', 'default', 'round'] as const
72
+
73
+ afterEach(() => {
74
+ root().removeAttribute('data-a63-radius')
75
+ root().removeAttribute('data-a63-theme')
76
+ root().removeAttribute('data-a63-mode')
77
+ root().classList.remove('dark', 'light')
78
+ document.body.replaceChildren()
79
+ })
80
+
81
+ function useTheme(theme: string) {
82
+ root().setAttribute('data-a63-theme', theme)
83
+ root().setAttribute('data-a63-mode', 'dark')
84
+ root().classList.add('dark')
85
+ }
86
+
87
+ describe('widget chrome signature', () => {
88
+ it('renders a real box-shadow whenever the widget token defines one', () => {
89
+ // Guards regression 1: `box-shadow: none, <shadow>` is invalid and drops the
90
+ // whole declaration, so a themed edge silently disappears.
91
+ //
92
+ // Read --a63-widget-shadow, NOT --a63-overlay-shadow. The widget default is
93
+ // deliberately flat (the rim is the tile's edge), so an overlay shadow does
94
+ // not imply a widget shadow. What must never happen is the token carrying a
95
+ // real value that computes to `none` — that is the composition bug.
96
+ for (const theme of THEMES) {
97
+ useTheme(theme)
98
+ const token = getComputedStyle(root()).getPropertyValue('--a63-widget-shadow').trim()
99
+ if (!token || token === 'none') continue
100
+ expect(
101
+ signature().boxShadow,
102
+ `${theme}: --a63-widget-shadow is set but the widget resolved no shadow — check for a \`none\` composed into the list`
103
+ ).not.toBe('none')
104
+ }
105
+ })
106
+
107
+ it('gives each theme a distinct chrome signature', () => {
108
+ // Guards regression 2: a frozen token makes every theme render identically.
109
+ const seen = new Map<string, string>()
110
+ for (const theme of THEMES) {
111
+ useTheme(theme)
112
+ const key = JSON.stringify(signature())
113
+ const clash = seen.get(key)
114
+ expect(clash, `${theme} and ${clash} resolve identical chrome — a token is frozen`).toBe(
115
+ undefined
116
+ )
117
+ seen.set(key, theme)
118
+ }
119
+ expect(seen.size).toBe(THEMES.length)
120
+ })
121
+
122
+ it('draws exactly one edge — a rim or a border, never both', () => {
123
+ // Guards regression 3: rim + face border read as two concentric rings.
124
+ for (const theme of THEMES) {
125
+ useTheme(theme)
126
+ const { faceBorderWidth, rimWidth } = signature()
127
+ expect(
128
+ px(rimWidth) > 0 && px(faceBorderWidth) > 0,
129
+ `${theme}: rim ${rimWidth} AND border ${faceBorderWidth} both paint — that is a double ring`
130
+ ).toBe(false)
131
+ expect(
132
+ px(rimWidth) > 0 || px(faceBorderWidth) > 0,
133
+ `${theme}: neither a rim nor a border — the tile has no edge`
134
+ ).toBe(true)
135
+ }
136
+ })
137
+
138
+ it('keeps the standard rim and shared shadow for weather', () => {
139
+ // Weather specializes the FACE (condition artwork + foreground) but outer
140
+ // chrome stays on the shared system — same rim and drop shadow as every
141
+ // other tile.
142
+ for (const theme of THEMES) {
143
+ useTheme(theme)
144
+ const standard = signature()
145
+ const weather = signature('weather')
146
+ expect(px(weather.rimWidth), `${theme}: weather must keep the shared rim`).toBe(
147
+ px(standard.rimWidth)
148
+ )
149
+ expect(px(weather.rimWidth), `${theme}: weather rim must be present`).toBeGreaterThan(0)
150
+ expect(
151
+ px(weather.faceBorderWidth),
152
+ `${theme}: weather with a rim must not also paint a face border`
153
+ ).toBe(0)
154
+ expect(weather.boxShadow, `${theme}: weather must keep the shared drop shadow`).toBe(
155
+ standard.boxShadow
156
+ )
157
+ }
158
+ })
159
+
160
+ it('keeps the standard rim for location even when a weather tone is set', () => {
161
+ // Location reuses weather FACE material via data-weather-tone; outer chrome
162
+ // stays on the shared system for both Location and Weather.
163
+ for (const theme of THEMES) {
164
+ useTheme(theme)
165
+ const { face, shell } = renderSurface()
166
+ shell.setAttribute('data-widget-kind', 'location')
167
+ shell.setAttribute('data-weather-tone', 'clear-day')
168
+ const rimWidth = getComputedStyle(shell).borderTopWidth
169
+ const faceBorderWidth = getComputedStyle(face).borderWidth
170
+ shell.remove()
171
+
172
+ expect(px(rimWidth), `${theme}: location must keep the shared rim`).toBeGreaterThan(0)
173
+ expect(
174
+ px(faceBorderWidth),
175
+ `${theme}: location with a rim must not also paint a face border`
176
+ ).toBe(0)
177
+ }
178
+ })
179
+
180
+ it('keeps the rim concentric across the whole radius axis', () => {
181
+ // Radius is a personalization control, so chrome must CONSUME the radius
182
+ // tokens rather than assume each theme's default. Retro previously used
183
+ // rectangular edge strips, which a rounded corner exposed as a broken frame —
184
+ // and previewing retro only at its square default hid that.
185
+ for (const theme of THEMES) {
186
+ for (const scale of RADIUS_SCALES) {
187
+ useTheme(theme)
188
+ root().setAttribute('data-a63-radius', scale)
189
+
190
+ const { face, shell } = renderSurface()
191
+ const outer = px(getComputedStyle(shell).borderTopLeftRadius)
192
+ const inner = px(getComputedStyle(face).borderTopLeftRadius)
193
+ const rim = px(getComputedStyle(shell).borderTopWidth)
194
+ const pad = px(getComputedStyle(shell).paddingTop)
195
+ shell.remove()
196
+
197
+ expect(
198
+ rim,
199
+ `${theme}/${scale}: the rim must be a border — only a border follows border-radius`
200
+ ).toBeGreaterThan(0)
201
+ expect(pad, `${theme}/${scale}: the rim must not be padding`).toBe(0)
202
+ expect(
203
+ inner,
204
+ `${theme}/${scale}: face radius ${inner} should be outer ${outer} less the ${rim} rim`
205
+ ).toBeCloseTo(Math.max(0, outer - rim), 1)
206
+ }
207
+ }
208
+ })
209
+
210
+ it("mitres retro's bevel per side so it survives a rounded corner", () => {
211
+ useTheme('retro')
212
+ root().setAttribute('data-a63-radius', 'round')
213
+ const { shell } = renderSurface()
214
+ const cs = getComputedStyle(shell)
215
+ const top = cs.borderTopColor
216
+ const bottom = cs.borderBottomColor
217
+ shell.remove()
218
+
219
+ expect(top, 'retro: the bevel needs a lit top edge').not.toBe('rgba(0, 0, 0, 0)')
220
+ expect(
221
+ top,
222
+ 'retro: top and bottom must differ — that difference IS the bevel, and as a border it mitres around the arc'
223
+ ).not.toBe(bottom)
224
+ })
225
+ })
@@ -0,0 +1,98 @@
1
+ import { afterEach, describe, expect, it } from 'vitest'
2
+ import { cssVar, root } from '../test/apply-styles'
3
+
4
+ afterEach(() => {
5
+ document.documentElement.removeAttribute('data-a63-theme')
6
+ document.documentElement.removeAttribute('data-a63-mode')
7
+ document.documentElement.classList.remove('dark', 'light')
8
+ document.body.replaceChildren()
9
+ })
10
+
11
+ function parseCssAlpha(color: string): number | null {
12
+ const trimmed = color.trim()
13
+ if (!trimmed || trimmed === 'transparent') return 0
14
+ if (trimmed.startsWith('#')) {
15
+ if (trimmed.length === 9) return Number.parseInt(trimmed.slice(7, 9), 16) / 255
16
+ return 1
17
+ }
18
+ const match = trimmed.match(/^(?:rgba?|hsla?|color)\((?:[^)]*?[,\s/]+)([\d.]+%?)\s*\)$/i)
19
+ if (!match) {
20
+ // rgb() without alpha, named colors, etc.
21
+ if (/^rgb\(/i.test(trimmed) || /^hsl\(/i.test(trimmed)) return 1
22
+ return null
23
+ }
24
+ const raw = match[1]
25
+ return raw.endsWith('%') ? Number.parseFloat(raw) / 100 : Number.parseFloat(raw)
26
+ }
27
+
28
+ function hasPaint(backgroundColor: string, backgroundImage: string): boolean {
29
+ const image = backgroundImage.trim()
30
+ if (image && image !== 'none') return true
31
+ const alpha = parseCssAlpha(backgroundColor)
32
+ return alpha !== null && alpha > 0.02
33
+ }
34
+
35
+ describe('widget surface paint contract', () => {
36
+ it('resolves a visible ::before material via widget background tokens', () => {
37
+ const themes = ['modern', 'aqua', 'retro', 'terminal'] as const
38
+
39
+ for (const theme of themes) {
40
+ root().setAttribute('data-a63-theme', theme)
41
+ root().setAttribute('data-a63-mode', 'dark')
42
+ root().classList.add('dark')
43
+
44
+ const colorToken = cssVar('--a63-widget-background-color')
45
+ const imageToken = cssVar('--a63-widget-background-image')
46
+ expect(colorToken, `${theme} widget background color`).not.toBe('')
47
+
48
+ // Mirror WIDGET_CARD_SURFACE_CLASS ::before paint without Tailwind in this package.
49
+ const before = document.createElement('div')
50
+ before.style.backgroundColor = 'var(--a63-widget-background-color)'
51
+ before.style.backgroundImage = 'var(--a63-widget-background-image)'
52
+ document.body.appendChild(before)
53
+
54
+ const style = getComputedStyle(before)
55
+ expect(
56
+ hasPaint(style.backgroundColor, style.backgroundImage),
57
+ `${theme}: widget ::before material must not be fully transparent (got color=${style.backgroundColor}, image=${style.backgroundImage}, tokens color=${colorToken}, image=${imageToken})`
58
+ ).toBe(true)
59
+
60
+ before.remove()
61
+ }
62
+ })
63
+
64
+ it('keeps widget foreground and border tokens authored', () => {
65
+ root().setAttribute('data-a63-theme', 'modern')
66
+ root().setAttribute('data-a63-mode', 'dark')
67
+ root().classList.add('dark')
68
+
69
+ expect(cssVar('--a63-widget-foreground')).not.toBe('')
70
+ expect(cssVar('--a63-widget-border-color')).not.toBe('')
71
+ expect(cssVar('--a63-widget-shadow')).not.toBe('')
72
+ })
73
+
74
+ it('splits the raised media shadow by mode', () => {
75
+ root().setAttribute('data-a63-theme', 'modern')
76
+
77
+ root().setAttribute('data-a63-mode', 'light')
78
+ root().classList.add('light')
79
+ const lightResting = cssVar('--a63-widget-media-shadow')
80
+ const lightRaised = cssVar('--a63-widget-media-shadow-raised')
81
+
82
+ root().classList.remove('light')
83
+ root().setAttribute('data-a63-mode', 'dark')
84
+ root().classList.add('dark')
85
+ const darkResting = cssVar('--a63-widget-media-shadow')
86
+ const darkRaised = cssVar('--a63-widget-media-shadow-raised')
87
+
88
+ for (const value of [lightResting, lightRaised, darkResting, darkRaised]) {
89
+ expect(value).not.toBe('')
90
+ }
91
+
92
+ // A dark face needs a heavier throw, so the two modes must not collapse.
93
+ expect(darkResting).not.toBe(lightResting)
94
+ expect(darkRaised).not.toBe(lightRaised)
95
+ // The centered print sits above its neighbours in both modes.
96
+ expect(darkRaised).not.toBe(darkResting)
97
+ })
98
+ })
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Syntax highlighting for rehype-pretty-code / Shiki (MDX docs, prose).
3
+ */
4
+
5
+ /* Shiki dual-theme token colors */
6
+ pre[data-theme*=' '] span,
7
+ pre[data-theme*=' '] code span {
8
+ color: var(--shiki-light);
9
+ }
10
+
11
+ :is(.dark, [data-a63-mode='dark']) pre[data-theme*=' '] span,
12
+ :is(.dark, [data-a63-mode='dark']) pre[data-theme*=' '] code span {
13
+ color: var(--shiki-dark);
14
+ }
15
+
16
+ pre > code {
17
+ display: block;
18
+ }
19
+
20
+ /* Line highlighting */
21
+ [data-highlighted-line] {
22
+ background-color: color-mix(in srgb, var(--a63-text-primary) 5%, transparent);
23
+ border-left: 2px solid var(--a63-action-primary);
24
+ padding-left: calc(1rem - 2px);
25
+ margin-left: -1rem;
26
+ margin-right: -1rem;
27
+ padding-right: 1rem;
28
+ }
29
+
30
+ /* Inline highlighted words */
31
+ [data-highlighted-chars] {
32
+ background-color: color-mix(in srgb, var(--a63-action-primary) 15%, transparent);
33
+ border-radius: 0.25rem;
34
+ padding: 0.1em 0.2em;
35
+ }