basalt-ui 1.1.0 → 1.2.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 (191) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +37 -0
  3. package/README.md +47 -5
  4. package/agent/rules/basalt-app.md +126 -0
  5. package/agent/rules/basalt-content.md +3 -1
  6. package/agent/skills/basalt-app/SKILL.md +32 -10
  7. package/configs/check.yml +3 -1
  8. package/configs/oxlint.json +1 -1
  9. package/dist/agent/part-list.d.ts.map +1 -1
  10. package/dist/agent/part-list.js +17 -7
  11. package/dist/agent/stick-to-bottom.js +2 -2
  12. package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -1
  13. package/dist/agent-chat/thread-detail-panel.js +37 -33
  14. package/dist/agent-chat/thread-message.d.ts.map +1 -1
  15. package/dist/agent-chat/thread-message.js +8 -5
  16. package/dist/agent-chat/thread-outcome-card.js +3 -3
  17. package/dist/agent-chat/thread-workspace.js +1 -1
  18. package/dist/charts/primitives/ChartLegend.js +2 -0
  19. package/dist/charts/primitives/ChartTooltip.js +2 -1
  20. package/dist/cli/index.d.ts +21 -1
  21. package/dist/cli/index.d.ts.map +1 -1
  22. package/dist/cli/index.js +50 -12
  23. package/dist/connectivity/connectivity-indicator.d.ts.map +1 -1
  24. package/dist/connectivity/connectivity-indicator.js +3 -3
  25. package/dist/content/article-card.module.css +7 -5
  26. package/dist/content/article-layout.module.css +16 -12
  27. package/dist/content/callout.module.css +4 -4
  28. package/dist/content/code-block.module.css +8 -7
  29. package/dist/content/guide.module.css +3 -3
  30. package/dist/content/mermaid.module.css +2 -2
  31. package/dist/content/prose.module.css +59 -29
  32. package/dist/content/reading-progress.module.css +2 -0
  33. package/dist/content/toc.module.css +6 -3
  34. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  35. package/dist/dashboard/delta-badge.js +10 -2
  36. package/dist/dashboard/empty-state.d.ts.map +1 -1
  37. package/dist/dashboard/empty-state.js +3 -16
  38. package/dist/dashboard/settings-section.js +2 -2
  39. package/dist/dashboard/settings-section.module.css +2 -2
  40. package/dist/dashboard/stat-card.js +2 -1
  41. package/dist/data/virtual-list.d.ts.map +1 -1
  42. package/dist/data/virtual-list.js +12 -2
  43. package/dist/forms/FormErrorSummary.js +2 -2
  44. package/dist/guard/index.d.ts +20 -4
  45. package/dist/guard/index.d.ts.map +1 -1
  46. package/dist/guard/index.js +250 -37
  47. package/dist/guard/types.d.ts +24 -3
  48. package/dist/guard/types.d.ts.map +1 -1
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/provider/index.d.ts +30 -1
  52. package/dist/provider/index.d.ts.map +1 -1
  53. package/dist/provider/index.js +32 -7
  54. package/dist/provider/lab-theme.d.ts +39 -0
  55. package/dist/provider/lab-theme.d.ts.map +1 -0
  56. package/dist/provider/lab-theme.js +52 -0
  57. package/dist/shell/app-header.module.css +2 -2
  58. package/dist/shell/app-mobile-nav.module.css +1 -1
  59. package/dist/shell/app-sidebar-account.d.ts.map +1 -1
  60. package/dist/shell/app-sidebar-account.js +4 -2
  61. package/dist/shell/app-sidebar.d.ts.map +1 -1
  62. package/dist/shell/app-sidebar.js +4 -2
  63. package/dist/shell/app-sidebar.module.css +36 -26
  64. package/dist/shell/index.d.ts.map +1 -1
  65. package/dist/shell/index.js +11 -4
  66. package/dist/shell/sidebar-search.module.css +16 -4
  67. package/dist/styles.css +1 -1
  68. package/dist/surfaces.d.ts +16 -12
  69. package/dist/surfaces.d.ts.map +1 -1
  70. package/dist/surfaces.js +12 -4
  71. package/dist/theme/controls.module.css +1 -1
  72. package/dist/theme/floating.module.css +1 -1
  73. package/dist/theme/index.d.ts +116 -11
  74. package/dist/theme/index.d.ts.map +1 -1
  75. package/dist/theme/index.js +703 -566
  76. package/dist/theme/nav-link.module.css +1 -1
  77. package/dist/theme/use-basalt-spacing.d.ts +3 -0
  78. package/dist/theme/use-basalt-spacing.d.ts.map +1 -0
  79. package/dist/theme/use-basalt-spacing.js +8 -0
  80. package/dist/theme-lab/derive-controls.d.ts +13 -0
  81. package/dist/theme-lab/derive-controls.d.ts.map +1 -0
  82. package/dist/theme-lab/derive-controls.js +137 -0
  83. package/dist/theme-lab/derive-state.d.ts +55 -0
  84. package/dist/theme-lab/derive-state.d.ts.map +1 -0
  85. package/dist/theme-lab/derive-state.js +81 -0
  86. package/dist/theme-lab/index.d.ts +12 -2
  87. package/dist/theme-lab/index.d.ts.map +1 -1
  88. package/dist/theme-lab/index.js +13 -62
  89. package/dist/theme-toggle/index.d.ts.map +1 -1
  90. package/dist/theme-toggle/index.js +3 -2
  91. package/dist/tokens/derive.d.ts +89 -0
  92. package/dist/tokens/derive.d.ts.map +1 -0
  93. package/dist/tokens/derive.js +250 -0
  94. package/dist/tokens/hct.d.ts +34 -0
  95. package/dist/tokens/hct.d.ts.map +1 -0
  96. package/dist/tokens/hct.js +159 -0
  97. package/dist/tokens/index.d.ts +71 -7
  98. package/dist/tokens/index.d.ts.map +1 -1
  99. package/dist/tokens/index.js +284 -46
  100. package/dist/tokens/palette.d.ts +984 -167
  101. package/dist/tokens/palette.d.ts.map +1 -1
  102. package/dist/tokens/palette.js +617 -119
  103. package/dist/vite-color-mix.d.ts +30 -0
  104. package/dist/vite-color-mix.d.ts.map +1 -0
  105. package/dist/vite-color-mix.js +80 -0
  106. package/dist/vite.d.ts +82 -1
  107. package/dist/vite.d.ts.map +1 -1
  108. package/dist/vite.js +312 -0
  109. package/llms.txt +5 -4
  110. package/package.json +24 -9
  111. package/src/agent/part-list.tsx +13 -7
  112. package/src/agent/stick-to-bottom.tsx +2 -2
  113. package/src/agent-chat/thread-detail-panel.tsx +13 -10
  114. package/src/agent-chat/thread-message.tsx +8 -5
  115. package/src/agent-chat/thread-outcome-card.tsx +2 -2
  116. package/src/agent-chat/thread-workspace.tsx +2 -2
  117. package/src/charts/primitives/ChartLegend.tsx +2 -2
  118. package/src/charts/primitives/ChartTooltip.tsx +2 -2
  119. package/src/cli/check-theme.test.ts +18 -0
  120. package/src/cli/index.ts +112 -20
  121. package/src/cli/init-sync.test.ts +68 -0
  122. package/src/connectivity/connectivity-indicator.tsx +8 -2
  123. package/src/content/article-card.module.css +7 -5
  124. package/src/content/article-layout.module.css +16 -12
  125. package/src/content/callout.module.css +4 -4
  126. package/src/content/code-block.module.css +8 -7
  127. package/src/content/guide.module.css +3 -3
  128. package/src/content/mermaid.module.css +2 -2
  129. package/src/content/prose.module.css +59 -29
  130. package/src/content/prose.module.css.test.ts +55 -0
  131. package/src/content/reading-progress.module.css +2 -0
  132. package/src/content/toc.module.css +6 -3
  133. package/src/dashboard/delta-badge.tsx +10 -4
  134. package/src/dashboard/empty-state.tsx +3 -16
  135. package/src/dashboard/settings-section.module.css +2 -2
  136. package/src/dashboard/settings-section.tsx +2 -2
  137. package/src/dashboard/stat-card.tsx +2 -2
  138. package/src/data/virtual-list.tsx +12 -2
  139. package/src/forms/FormErrorSummary.tsx +1 -1
  140. package/src/guard/check-source.test.ts +416 -5
  141. package/src/guard/index.ts +367 -45
  142. package/src/guard/types.ts +24 -2
  143. package/src/index.ts +1 -0
  144. package/src/provider/index.test.tsx +100 -0
  145. package/src/provider/index.tsx +79 -7
  146. package/src/provider/lab-theme.test.ts +147 -0
  147. package/src/provider/lab-theme.ts +166 -0
  148. package/src/shell/app-header.module.css +2 -2
  149. package/src/shell/app-mobile-nav.module.css +1 -1
  150. package/src/shell/app-sidebar-account.tsx +9 -2
  151. package/src/shell/app-sidebar.module.css +36 -26
  152. package/src/shell/app-sidebar.tsx +12 -2
  153. package/src/shell/index.tsx +14 -3
  154. package/src/shell/sidebar-search.module.css +16 -4
  155. package/src/styles.css +1 -1
  156. package/src/surfaces.ts +25 -11
  157. package/src/theme/contrast.test.ts +19 -3
  158. package/src/theme/controls.module.css +1 -1
  159. package/src/theme/density-option.test.ts +96 -0
  160. package/src/theme/density-relations.test.ts +428 -0
  161. package/src/theme/derive-theme.test.ts +101 -0
  162. package/src/theme/floating.module.css +1 -1
  163. package/src/theme/fonts-option.test.ts +69 -0
  164. package/src/theme/index.ts +930 -563
  165. package/src/theme/nav-link.module.css +1 -1
  166. package/src/theme/radius-option.test.ts +86 -0
  167. package/src/theme/radius.test.ts +132 -0
  168. package/src/theme/spacing.test.ts +432 -0
  169. package/src/theme/use-basalt-spacing.test.tsx +51 -0
  170. package/src/theme/use-basalt-spacing.ts +38 -0
  171. package/src/theme-lab/derive-controls.test.ts +94 -0
  172. package/src/theme-lab/derive-controls.tsx +227 -0
  173. package/src/theme-lab/derive-state.test.ts +71 -0
  174. package/src/theme-lab/derive-state.ts +163 -0
  175. package/src/theme-lab/index.tsx +29 -68
  176. package/src/theme-lab/theme-lab.test.ts +4 -18
  177. package/src/theme-toggle/index.tsx +9 -4
  178. package/src/tokens/build-fonts-css.test.ts +51 -0
  179. package/src/tokens/build-radius-css.test.ts +25 -0
  180. package/src/tokens/density.test.ts +274 -0
  181. package/src/tokens/derive-radius.test.ts +62 -0
  182. package/src/tokens/derive.test.ts +30 -0
  183. package/src/tokens/derive.ts +481 -0
  184. package/src/tokens/hct.ts +231 -0
  185. package/src/tokens/index.ts +395 -45
  186. package/src/tokens/palette.test.ts +114 -0
  187. package/src/tokens/palette.ts +1118 -180
  188. package/src/vite-color-mix.test.ts +46 -0
  189. package/src/vite-color-mix.ts +137 -0
  190. package/src/vite.test.ts +192 -0
  191. package/src/vite.ts +502 -1
@@ -63,5 +63,5 @@
63
63
  * every render path.
64
64
  */
65
65
  .root [data-position='left'] {
66
- margin-inline-end: 10px;
66
+ margin-inline-end: var(--vx-space-nav-icon-gap);
67
67
  }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * `createBasaltTheme`'s `{ radius }` option — the graduation of `deriveRadius` into a first-class
3
+ * consumer API. Mirrors `derive-theme.test.ts`'s two invariants:
4
+ *
5
+ * 1. The DEFAULT path (no `options`, or `radius: 0`) stays byte-identical to the pre-baked static
6
+ * `baseTheme` — `theme.other.basaltRadius` stays unset, and `radius.test.ts` (untouched) stays
7
+ * green.
8
+ * 2. A NON-default level rebuilds every radius-anchored `defaultProps`/`styles` number AND the
9
+ * `radius` size-scale from `deriveRadius(level)`'s output, and lands it on
10
+ * `theme.other.basaltRadius`.
11
+ */
12
+ import { describe, expect, test } from 'bun:test'
13
+ import { deriveRadius } from '../tokens/palette'
14
+ import { createBasaltTheme } from './index'
15
+
16
+ describe('the default level stays on the static path', () => {
17
+ test('createBasaltTheme() carries no theme.other.basaltRadius', () => {
18
+ expect(createBasaltTheme().other?.['basaltRadius']).toBeUndefined()
19
+ })
20
+
21
+ test('createBasaltTheme(undefined, {}) resolves to the same default', () => {
22
+ expect(createBasaltTheme(undefined, {}).other?.['basaltRadius']).toBeUndefined()
23
+ })
24
+
25
+ test('an explicit radius: 0 also carries no basaltRadius', () => {
26
+ expect(createBasaltTheme(undefined, { radius: 0 }).other?.['basaltRadius']).toBeUndefined()
27
+ })
28
+ })
29
+
30
+ describe('a non-default radius level graduates onto the theme', () => {
31
+ const theme = createBasaltTheme(undefined, { radius: 2 })
32
+ const expected = deriveRadius(2)
33
+
34
+ test('the resolved values land on theme.other.basaltRadius', () => {
35
+ expect(theme.other?.['basaltRadius']).toEqual(expected)
36
+ })
37
+
38
+ test('Tooltip/Modal defaultProps radius follows floating (card + 1 = 10)', () => {
39
+ expect(theme.components?.['Tooltip']?.defaultProps?.['radius']).toBe(10)
40
+ expect(theme.components?.['Modal']?.defaultProps?.['radius']).toBe(10)
41
+ })
42
+
43
+ test('the radius size-scale md step reflects ctrl (8)', () => {
44
+ expect(theme.radius?.md).toBe(`${8 / 16}rem`)
45
+ })
46
+
47
+ test('the independent scale steps (xs/lg/xl) stay fixed', () => {
48
+ expect(theme.radius?.xs).toBe(`${2 / 16}rem`)
49
+ expect(theme.radius?.lg).toBe(`${16 / 16}rem`)
50
+ expect(theme.radius?.xl).toBe(`${32 / 16}rem`)
51
+ })
52
+ })
53
+
54
+ describe('the default theme is unchanged by the radius option existing', () => {
55
+ test('createBasaltTheme() still matches the shipped level-0 numbers', () => {
56
+ const theme = createBasaltTheme()
57
+ expect(theme.components?.['Tooltip']?.defaultProps?.['radius']).toBe(8)
58
+ expect(theme.components?.['Badge']?.defaultProps?.['radius']).toBe(6)
59
+ })
60
+ })
61
+
62
+ describe('a malformed radius level throws through createBasaltTheme', () => {
63
+ test('rejects a non-integer', () => {
64
+ expect(() => createBasaltTheme(undefined, { radius: 1.5 })).toThrow()
65
+ })
66
+
67
+ test('rejects an out-of-range level', () => {
68
+ expect(() => createBasaltTheme(undefined, { radius: 10 })).toThrow()
69
+ })
70
+ })
71
+
72
+ describe('consumer overrides still win on top of a radius option', () => {
73
+ test('an explicit override merges onto the radius-rebuilt theme', () => {
74
+ const theme = createBasaltTheme({ primaryColor: 'green' }, { radius: 2 })
75
+ expect(theme.primaryColor).toBe('green')
76
+ expect(theme.other?.['basaltRadius']).toEqual(deriveRadius(2))
77
+ })
78
+ })
79
+
80
+ describe('radius and derive combine without dropping either', () => {
81
+ test('both land on theme.other', () => {
82
+ const theme = createBasaltTheme(undefined, { derive: { accent: '#16a34a' }, radius: 2 })
83
+ expect(theme.other?.['basaltDerive']).toBeDefined()
84
+ expect(theme.other?.['basaltRadius']).toEqual(deriveRadius(2))
85
+ })
86
+ })
@@ -0,0 +1,132 @@
1
+ /**
2
+ * The radius gate — this is a TOKENIZATION-only refactor (`RADIUS`/`RADIUS_STEP` in
3
+ * `tokens/palette.ts` replace ~10 components' hardcoded `defaultProps`/`styles` radius literals,
4
+ * the Mantine `radius` size-scale, and the `--vx-radius-card`/`--vx-radius-ctrl` CSS vars), so the
5
+ * rendered output must stay byte-identical to the numbers shipped before it. This locks today's
6
+ * exact values as the acceptance baseline — a future change to `RADIUS.card`/`RADIUS.ctrl` (or any
7
+ * `RADIUS_STEP` offset) that moves one of these numbers is a deliberate visual change, not a
8
+ * silent regression, and must update this file in the same commit.
9
+ */
10
+ import { describe, expect, test } from 'bun:test'
11
+ import { buildPaletteCss } from '../tokens'
12
+ import { RADIUS, RADIUS_STEP } from '../tokens/palette'
13
+ import { baseTheme } from './index'
14
+
15
+ describe('the two anchors match the shipped identity', () => {
16
+ test('RADIUS.card is 7', () => {
17
+ expect(RADIUS.card).toBe(7)
18
+ })
19
+
20
+ test('RADIUS.ctrl is 6', () => {
21
+ expect(RADIUS.ctrl).toBe(6)
22
+ })
23
+ })
24
+
25
+ describe('every derived/independent step reproduces its exact shipped number', () => {
26
+ test('floating (Tooltip/Popover/Modal/Notification) = card + 1 = 8', () => {
27
+ expect(RADIUS_STEP.floating).toBe(8)
28
+ })
29
+
30
+ test('tight (SegmentedControl indicator, Kbd, Code) = ctrl - 1 = 5', () => {
31
+ expect(RADIUS_STEP.tight).toBe(5)
32
+ })
33
+
34
+ test('fine (Progress, Mantine scale sm) = ctrl - 2 = 4', () => {
35
+ expect(RADIUS_STEP.fine).toBe(4)
36
+ })
37
+
38
+ test('the independent Mantine-scale steps are unchanged', () => {
39
+ expect(RADIUS_STEP.scaleXs).toBe(2)
40
+ expect(RADIUS_STEP.scaleLg).toBe(16)
41
+ expect(RADIUS_STEP.scaleXl).toBe(32)
42
+ })
43
+
44
+ test('the pill affordance is fixed at 9999, independent of the radius knob', () => {
45
+ expect(RADIUS_STEP.pill).toBe(9999)
46
+ })
47
+ })
48
+
49
+ describe('the Mantine radius size-scale is byte-identical to the pre-tokenization literals', () => {
50
+ test('xs/sm/md/lg/xl resolve to the exact prior rem strings', () => {
51
+ expect(baseTheme.radius).toEqual({
52
+ xs: '0.125rem',
53
+ sm: '0.25rem',
54
+ md: '0.375rem',
55
+ lg: '1rem',
56
+ xl: '2rem',
57
+ })
58
+ })
59
+
60
+ test('defaultRadius stays "md" (= RADIUS.ctrl)', () => {
61
+ expect(baseTheme.defaultRadius).toBe('md')
62
+ })
63
+ })
64
+
65
+ describe('every re-pointed component defaultProps/styles radius matches its shipped number', () => {
66
+ test('Badge = 6', () => {
67
+ expect(baseTheme.components?.['Badge']?.defaultProps?.['radius']).toBe(6)
68
+ })
69
+
70
+ test('SegmentedControl root = 7, indicator = 5', () => {
71
+ const sc = baseTheme.components?.['SegmentedControl']
72
+ expect(sc?.defaultProps?.['radius']).toBe(7)
73
+ expect(sc?.styles?.['indicator']?.['borderRadius']).toBe('var(--vx-radius-tight)')
74
+ })
75
+
76
+ test('Progress = 4', () => {
77
+ expect(baseTheme.components?.['Progress']?.defaultProps?.['radius']).toBe(4)
78
+ })
79
+
80
+ test('Tooltip = 8', () => {
81
+ expect(baseTheme.components?.['Tooltip']?.defaultProps?.['radius']).toBe(8)
82
+ })
83
+
84
+ test('Popover = 8', () => {
85
+ expect(baseTheme.components?.['Popover']?.defaultProps?.['radius']).toBe(8)
86
+ })
87
+
88
+ test('Modal = 8', () => {
89
+ expect(baseTheme.components?.['Modal']?.defaultProps?.['radius']).toBe(8)
90
+ })
91
+
92
+ test('Notification = 8', () => {
93
+ expect(baseTheme.components?.['Notification']?.defaultProps?.['radius']).toBe(8)
94
+ })
95
+
96
+ test('NavLink root = 6', () => {
97
+ expect(baseTheme.components?.['NavLink']?.styles?.['root']?.['borderRadius']).toBe(
98
+ 'var(--vx-radius-ctrl)',
99
+ )
100
+ })
101
+
102
+ test('Menu item = 6', () => {
103
+ expect(baseTheme.components?.['Menu']?.styles?.['item']?.['borderRadius']).toBe(
104
+ 'var(--vx-radius-ctrl)',
105
+ )
106
+ })
107
+
108
+ test('Kbd = 5', () => {
109
+ expect(baseTheme.components?.['Kbd']?.styles?.['root']?.['borderRadius']).toBe(
110
+ 'var(--vx-radius-tight)',
111
+ )
112
+ })
113
+
114
+ test('Code = 5', () => {
115
+ expect(baseTheme.components?.['Code']?.styles?.['root']?.['borderRadius']).toBe(
116
+ 'var(--vx-radius-tight)',
117
+ )
118
+ })
119
+ })
120
+
121
+ describe('--vx-radius-card / --vx-radius-ctrl are emitted from the SAME constants', () => {
122
+ const css = buildPaletteCss()
123
+
124
+ test('emits 7px / 6px, unchanged', () => {
125
+ expect(css).toContain('--vx-radius-card: 7px;')
126
+ expect(css).toContain('--vx-radius-ctrl: 6px;')
127
+ })
128
+
129
+ test('emits the fixed pill radius', () => {
130
+ expect(css).toContain('--vx-radius-pill: 9999px;')
131
+ })
132
+ })
@@ -0,0 +1,432 @@
1
+ /**
2
+ * The spacing gate — the level-0 acceptance baseline for `SPACE`/`SPACE_SCALE`/`SPACE_STEP`/
3
+ * `SPACE_FIXED` (`tokens/palette.ts`).
4
+ *
5
+ * READ THIS BEFORE UPDATING A NUMBER HERE. This file locks the CURRENT shipped identity, not the
6
+ * pre-tokenization one. It was born as the byte-identity gate for a tokenization-only refactor (the
7
+ * token tables replacing the Mantine `spacing` size-scale, ~4 components' hardcoded
8
+ * `styles`/`defaultProps` literals, and the `--vx-space-*` CSS vars), and it is still the ONLY thing
9
+ * standing between a base-table typo and a silent app-wide layout shift. What it can NOT do is tell
10
+ * you whether a diff to it was intended — updating this file is exactly how a deliberate retune
11
+ * lands, and also exactly how a regression would hide. So: a change here must be a visual decision
12
+ * taken on purpose, in the same commit as the base-table edit, with the reason in the commit body.
13
+ * Never "fix the test" to make a red suite green.
14
+ *
15
+ * Deliberate departures from the original pre-tokenization numbers so far:
16
+ *
17
+ * - `SPACE_SCALE` (the app-wide Mantine `xs`..`xl` rhythm) went 10/12/16/18/24 → 11/13/18/20/26, and
18
+ * 13 `sidebar*` gap/inset one-offs tightened ~15% — the component-roominess retune. The two moves
19
+ * are deliberately opposite: roomier cards and generic layout, a tighter sidebar. `SPACE.rowInsetX`/
20
+ * `rowInsetY`, the 4px stack rhythm, and the sidebar SIZES (`sidebarAvatarSize`,
21
+ * `sidebarSearchTriggerHeight`, the two Menu widths) were held back on purpose — see that commit.
22
+ * - `SPACE_STEP.stickyHeaderClearance` moved from 84 (the original literal) through an
23
+ * intermediate single derived value of 108, to its FINAL shape — a responsive PAIR (Decision 3):
24
+ * `stickyHeaderClearance` (desktop, `>= sm`) now 60, plus a new `stickyHeaderClearanceMobile`
25
+ * (mobile, `< sm`) at 108. Both are DERIVED from their own AppShell header (`appShellHeaderHeight`/
26
+ * `appShellHeaderMobileHeight`) instead of one independent literal, which fixed two bugs at once:
27
+ * the original 84 under-cleared the mobile header (96px at the time, 97 since the retune above) at
28
+ * level 0 (before density entered the
29
+ * picture at all), and a single derived value tuned against the mobile header over-cleared the 48px
30
+ * desktop header by 60px on the common (desktop) path. See `deriveSpacing`'s doc in
31
+ * `tokens/palette.ts` for the full rationale. Every value NOT named above is still byte-identical to
32
+ * the pre-tokenization number it replaced.
33
+ */
34
+ import { DEFAULT_THEME, mergeMantineTheme } from '@mantine/core'
35
+ import type { MantineTheme } from '@mantine/core'
36
+ import { describe, expect, test } from 'bun:test'
37
+ import { buildPaletteCss } from '../tokens'
38
+ import { SPACE, SPACE_FIXED, SPACE_SCALE, SPACE_STEP } from '../tokens/palette'
39
+ import { baseTheme } from './index'
40
+
41
+ const theme: MantineTheme = mergeMantineTheme(DEFAULT_THEME, baseTheme)
42
+
43
+ describe('SPACE anchors match the shipped identity', () => {
44
+ test('rowInsetX is 10, rowInsetY is 6', () => {
45
+ expect(SPACE.rowInsetX).toBe(10)
46
+ expect(SPACE.rowInsetY).toBe(6)
47
+ })
48
+
49
+ test('the 4px vertical rhythm is unchanged', () => {
50
+ expect(SPACE.stackXs).toBe(4)
51
+ expect(SPACE.stackSm).toBe(8)
52
+ expect(SPACE.stackMd).toBe(12)
53
+ expect(SPACE.stackLg).toBe(16)
54
+ expect(SPACE.stackXl).toBe(24)
55
+ })
56
+
57
+ test('inputHeight and controlHeight are both 42 (the shared control-height anchor)', () => {
58
+ expect(SPACE.inputHeight).toBe(42)
59
+ expect(SPACE.controlHeight).toBe(42)
60
+ })
61
+ })
62
+
63
+ describe('SPACE_SCALE matches the shipped identity — independent of SPACE even where it coincides', () => {
64
+ test('xs/sm/md/lg/xl are 11/13/18/20/26', () => {
65
+ expect(SPACE_SCALE.xs).toBe(11)
66
+ expect(SPACE_SCALE.sm).toBe(13)
67
+ expect(SPACE_SCALE.md).toBe(18)
68
+ expect(SPACE_SCALE.lg).toBe(20)
69
+ expect(SPACE_SCALE.xl).toBe(26)
70
+ })
71
+ })
72
+
73
+ describe('SPACE_STEP one-offs match the shipped identity', () => {
74
+ test('timelineBullet is 22', () => {
75
+ expect(SPACE_STEP.timelineBullet).toBe(22)
76
+ })
77
+ })
78
+
79
+ describe('SPACE_FIXED structurals match the shipped identity', () => {
80
+ test('hairline is 1', () => {
81
+ expect(SPACE_FIXED.hairline).toBe(1)
82
+ })
83
+
84
+ test('readingProgressHeight is 2 (not emitted as a var — see the assertion below)', () => {
85
+ expect(SPACE_FIXED.readingProgressHeight).toBe(2)
86
+ })
87
+
88
+ test('segmentedTrackInset is 2 (not emitted as a var — see the assertion below)', () => {
89
+ expect(SPACE_FIXED.segmentedTrackInset).toBe(2)
90
+ })
91
+ })
92
+
93
+ describe('the Mantine spacing size-scale reaches theme.spacing as the expected rem strings', () => {
94
+ // The px->rem conversion and the retuned bases, end to end (`pxRem`'s 16px root: 11px = 0.6875rem).
95
+ // These WERE the pre-tokenization literals until the component-roominess retune — see the file doc.
96
+ test('xs/sm/md/lg/xl resolve to the exact expected rem strings', () => {
97
+ expect(baseTheme.spacing).toEqual({
98
+ xs: '0.6875rem',
99
+ sm: '0.8125rem',
100
+ md: '1.125rem',
101
+ lg: '1.25rem',
102
+ xl: '1.625rem',
103
+ })
104
+ })
105
+ })
106
+
107
+ describe('every re-pointed component styles/defaultProps spacing value matches its shipped number', () => {
108
+ test('NavLink root padding = 6px 10px', () => {
109
+ expect(baseTheme.components?.['NavLink']?.styles?.['root']?.['padding']).toBe(
110
+ 'var(--vx-space-row-inset-y) var(--vx-space-row-inset-x)',
111
+ )
112
+ })
113
+
114
+ test('Menu item padding = 6px 10px', () => {
115
+ expect(baseTheme.components?.['Menu']?.styles?.['item']?.['padding']).toBe(
116
+ 'var(--vx-space-row-inset-y) var(--vx-space-row-inset-x)',
117
+ )
118
+ })
119
+
120
+ test('SegmentedControl root padding = 2 (a density-exempt SPACE_FIXED literal, not a var)', () => {
121
+ expect(baseTheme.components?.['SegmentedControl']?.styles?.['root']?.['padding']).toBe('2px')
122
+ })
123
+
124
+ test('Timeline defaultProps stays bulletSize: 22, lineWidth: 1', () => {
125
+ const tl = baseTheme.components?.['Timeline']
126
+ expect(tl?.defaultProps?.['bulletSize']).toBe(22)
127
+ expect(tl?.defaultProps?.['lineWidth']).toBe(1)
128
+ })
129
+
130
+ test('Progress defaultProps stays size: 6', () => {
131
+ expect(baseTheme.components?.['Progress']?.defaultProps?.['size']).toBe(6)
132
+ })
133
+
134
+ test('NavLink root/label lineHeight reads the density-tracking var', () => {
135
+ const nl = baseTheme.components?.['NavLink']
136
+ expect(nl?.styles?.['root']?.['lineHeight']).toBe('var(--vx-space-row-line-height)')
137
+ expect(nl?.styles?.['label']?.['lineHeight']).toBe('var(--vx-space-row-line-height)')
138
+ })
139
+
140
+ test('Input --input-height reconstructs BOTH the rem half and the --mantine-scale half', () => {
141
+ // Mantine's own `--input-height-md` is `calc(2.625rem * var(--mantine-scale))` — rem-relative
142
+ // to the root font size AND scale-aware. The override must reconstruct both, not flatten either
143
+ // into a bare px value (see the `Input.extend` `vars` doc comment for why).
144
+ const vars = baseTheme.components?.['Input']?.vars
145
+ // Test-only stub props/ctx — the callback only reads `size`.
146
+ const mdResult = vars?.(theme, { size: 'md' } as never, {} as never)
147
+ expect(mdResult?.wrapper?.['--input-height']).toBe(
148
+ 'calc(var(--vx-space-input-height) * var(--mantine-scale))',
149
+ )
150
+ })
151
+
152
+ test('Input --input-height leaves a non-md size on Mantine own static height', () => {
153
+ const vars = baseTheme.components?.['Input']?.vars
154
+ const xsResult = vars?.(theme, { size: 'xs' } as never, {} as never)
155
+ expect(xsResult?.wrapper?.['--input-height']).toBeUndefined()
156
+ })
157
+
158
+ test('Button --button-height reconstructs BOTH the rem half and the --mantine-scale half', () => {
159
+ // Same reconstruction as Input above — Mantine's own `--button-height-md` is also
160
+ // `calc(2.625rem * var(--mantine-scale))`. Single-sourced from the SAME `controlHeight` anchor
161
+ // `--vx-space-input-height` reads (see `Button.extend`'s doc comment).
162
+ const vars = baseTheme.components?.['Button']?.vars
163
+ const mdResult = vars?.(theme, { size: 'md' } as never, {} as never)
164
+ expect(mdResult?.root?.['--button-height']).toBe(
165
+ 'calc(var(--vx-space-control-height) * var(--mantine-scale))',
166
+ )
167
+ })
168
+
169
+ test('Button --button-height leaves a non-md size on Mantine own static height', () => {
170
+ const vars = baseTheme.components?.['Button']?.vars
171
+ const smResult = vars?.(theme, { size: 'sm' } as never, {} as never)
172
+ expect(smResult?.root?.['--button-height']).toBeUndefined()
173
+ })
174
+
175
+ test('ActionIcon --ai-size reconstructs BOTH the rem half and the --mantine-scale half', () => {
176
+ const vars = baseTheme.components?.['ActionIcon']?.vars
177
+ const mdResult = vars?.(theme, { size: 'md' } as never, {} as never)
178
+ expect(mdResult?.root?.['--ai-size']).toBe(
179
+ 'calc(var(--vx-space-control-height) * var(--mantine-scale))',
180
+ )
181
+ })
182
+
183
+ test('ActionIcon --ai-size leaves a non-md size on Mantine own static height', () => {
184
+ const vars = baseTheme.components?.['ActionIcon']?.vars
185
+ const smResult = vars?.(theme, { size: 'sm' } as never, {} as never)
186
+ expect(smResult?.root?.['--ai-size']).toBeUndefined()
187
+ })
188
+ })
189
+
190
+ describe('--vx-space-* is emitted from the SAME constants', () => {
191
+ const css = buildPaletteCss()
192
+
193
+ test('emits every SPACE anchor, unchanged', () => {
194
+ expect(css).toContain('--vx-space-row-inset-x: 10px;')
195
+ expect(css).toContain('--vx-space-row-inset-y: 6px;')
196
+ expect(css).toContain('--vx-space-stack-xs: 4px;')
197
+ expect(css).toContain('--vx-space-stack-sm: 8px;')
198
+ expect(css).toContain('--vx-space-stack-md: 12px;')
199
+ expect(css).toContain('--vx-space-stack-lg: 16px;')
200
+ expect(css).toContain('--vx-space-stack-xl: 24px;')
201
+ })
202
+
203
+ test('does NOT emit SPACE_FIXED as a var', () => {
204
+ expect(css).not.toContain('--vx-space-hairline')
205
+ expect(css).not.toContain('--vx-space-reading-progress-height')
206
+ expect(css).not.toContain('--vx-space-segmented-track-inset')
207
+ })
208
+
209
+ test('does NOT emit the dead numbers-only vars (JS-consumed, zero var() reads)', () => {
210
+ // `SPACE_SCALE` (the generic Mantine spacing scale) already reaches production through
211
+ // `theme.spacing` -> `--mantine-spacing-*`, not a `--vx-space-scale-*` var nobody read — and
212
+ // `timelineBullet`/`chart*`/`progressBarSize` are JS-number-only (`Timeline`'s
213
+ // `defaultProps.bulletSize`, `VX.legendGap`/`VX.margin`/`VX.dotR`, `Progress`'s
214
+ // `defaultProps.size`). See `spaceDecls`'s doc in `tokens/index.ts`.
215
+ expect(css).not.toContain('--vx-space-scale-xs')
216
+ expect(css).not.toContain('--vx-space-scale-sm')
217
+ expect(css).not.toContain('--vx-space-scale-md')
218
+ expect(css).not.toContain('--vx-space-scale-lg')
219
+ expect(css).not.toContain('--vx-space-scale-xl')
220
+ expect(css).not.toContain('--vx-space-timeline-bullet')
221
+ expect(css).not.toContain('--vx-space-chart-legend-gap')
222
+ expect(css).not.toContain('--vx-space-chart-margin-top')
223
+ expect(css).not.toContain('--vx-space-chart-margin-right')
224
+ expect(css).not.toContain('--vx-space-chart-margin-bottom')
225
+ expect(css).not.toContain('--vx-space-chart-margin-left')
226
+ expect(css).not.toContain('--vx-space-chart-dot-r')
227
+ expect(css).not.toContain('--vx-space-progress-bar-size')
228
+ })
229
+
230
+ test('emits the density pass additions: row line-height, input height, control height', () => {
231
+ expect(css).toContain('--vx-space-row-line-height: 1.35;')
232
+ // REM, not px — Mantine's own `--input-height-md`/`--button-height-md` are both
233
+ // `calc(2.625rem * var(--mantine-scale))` (identical in `styles.css` and the `styles.layer.css`
234
+ // variant consumers load), so flattening this into a flat px value would desync those heights
235
+ // from the root font size AND `--mantine-scale`. See `tokens/index.ts`'s `spaceDecls` and
236
+ // `theme/index.ts`'s `Input.extend`/`Button.extend`/`ActionIcon.extend` `vars` for the halves
237
+ // of the fix.
238
+ expect(css).toContain('--vx-space-input-height: 2.625rem;')
239
+ expect(css).not.toContain('--vx-space-input-height: 42px;')
240
+ expect(css).toContain('--vx-space-control-height: 2.625rem;')
241
+ expect(css).not.toContain('--vx-space-control-height: 42px;')
242
+ })
243
+ })
244
+
245
+ /**
246
+ * The CSS-module spacing sweep (`docs/STATUS.md`) — every new `SPACE_STEP` one-off it introduced,
247
+ * locked to its shipped literal AND, for the ones with a real `var()` consumer, to the exact
248
+ * `--vx-space-*` declaration `buildPaletteCss()` emits for it. Table-driven (one row per constant)
249
+ * instead of one `test()` per constant — this table is the single place a future retune of one of
250
+ * these has to touch. `cssVar: null` marks a JS-number-only constant (no `var()` consumer anywhere —
251
+ * `Timeline`'s `defaultProps.bulletSize`, `VX.legendGap`/`VX.margin`/`VX.dotR`, `Progress`'s
252
+ * `defaultProps.size`) that deliberately has NO `--vx-space-*` declaration (see `spaceDecls`'s doc
253
+ * in `tokens/index.ts`).
254
+ */
255
+ const SPACE_STEP_SWEEP: ReadonlyArray<
256
+ readonly [key: keyof typeof SPACE_STEP, value: number, cssVar: string | null]
257
+ > = [
258
+ // DERIVED, not an independent literal — see `deriveSpacing`'s doc (`tokens/palette.ts`, third
259
+ // bullet, Decision 3) for why 60/108 (not 84) are the level-0 values: the ONE responsive PAIR
260
+ // deliberately exempt from the "every SPACE_STEP number is locked at level 0" invariant
261
+ // this file otherwise enforces (locked here, not skipped, precisely so a future regression back to
262
+ // 84, or back to a single shared value, shows up as a failing assertion rather than a silent
263
+ // revert).
264
+ ['stickyHeaderClearance', 60, 'space-sticky-header-clearance'],
265
+ ['stickyHeaderClearanceMobile', 109, 'space-sticky-header-clearance-mobile'],
266
+ ['navIconGap', 10, 'space-nav-icon-gap'],
267
+ ['sidebarRegionGap', 10, 'space-sidebar-region-gap'],
268
+ ['proseQuoteInsetY', 2, 'space-prose-quote-inset-y'],
269
+ ['proseQuoteIndent', 12, 'space-prose-quote-indent'],
270
+ ['proseInlineCodeInsetY', 1.5, 'space-prose-inline-code-inset-y'],
271
+ ['proseInlineCodeInsetX', 5, 'space-prose-inline-code-inset-x'],
272
+ ['proseCodeBlockInsetY', 10, 'space-prose-code-block-inset-y'],
273
+ ['proseCodeBlockInsetX', 12, 'space-prose-code-block-inset-x'],
274
+ ['proseHeadingAnchorGap', 6, 'space-prose-heading-anchor-gap'],
275
+ ['proseTableCellInsetY', 5, 'space-prose-table-cell-inset-y'],
276
+ ['proseTableCellInsetX', 8, 'space-prose-table-cell-inset-x'],
277
+ ['proseChatListGapBottom', 10, 'space-prose-chat-list-gap-bottom'],
278
+ ['proseChatListIndent', 20, 'space-prose-chat-list-indent'],
279
+ ['proseChatListItemGap', 3, 'space-prose-chat-list-item-gap'],
280
+ ['proseChatNestedListGap', 2, 'space-prose-chat-nested-list-gap'],
281
+ ['proseChatHeadingGapTop', 14, 'space-prose-chat-heading-gap-top'],
282
+ ['proseChatHeadingGapBottom', 6, 'space-prose-chat-heading-gap-bottom'],
283
+ ['proseArticleParagraphGap', 14, 'space-prose-article-paragraph-gap'],
284
+ ['proseArticleListGapTop', 6, 'space-prose-article-list-gap-top'],
285
+ ['proseArticleListGapBottom', 14, 'space-prose-article-list-gap-bottom'],
286
+ ['proseArticleListIndent', 22, 'space-prose-article-list-indent'],
287
+ ['proseArticleH1GapTop', 6, 'space-prose-article-h1-gap-top'],
288
+ ['proseArticleH1GapBottom', 14, 'space-prose-article-h1-gap-bottom'],
289
+ ['proseArticleHeadingGapTop', 30, 'space-prose-article-heading-gap-top'],
290
+ ['proseArticleHeadingGapBottom', 10, 'space-prose-article-heading-gap-bottom'],
291
+ ['proseArticleH2RuleGap', 6, 'space-prose-article-h2-rule-gap'],
292
+ ['proseArticleBlockGap', 18, 'space-prose-article-block-gap'],
293
+ ['articleColumnGap', 56, 'space-article-column-gap'],
294
+ ['articleTocRailWidth', 220, 'space-article-toc-rail-width'],
295
+ ['articleHeaderGap', 10, 'space-article-header-gap'],
296
+ ['articleHeaderPaddingBottom', 20, 'space-article-header-padding-bottom'],
297
+ ['articleHeaderMarginBottom', 28, 'space-article-header-margin-bottom'],
298
+ ['articleMetaRowGap', 6, 'space-article-meta-row-gap'],
299
+ ['articleFooterGap', 12, 'space-article-footer-gap'],
300
+ ['articleFooterMarginTop', 40, 'space-article-footer-margin-top'],
301
+ ['articleFooterPaddingTop', 20, 'space-article-footer-padding-top'],
302
+ ['articleNavTargetGap', 6, 'space-article-nav-target-gap'],
303
+ ['codeBlockHeaderGap', 8, 'space-code-block-header-gap'],
304
+ ['codeBlockHeaderInsetY', 6, 'space-code-block-header-inset-y'],
305
+ ['codeBlockHeaderInsetRight', 10, 'space-code-block-header-inset-right'],
306
+ ['codeBlockContentInsetX', 14, 'space-code-block-content-inset-x'],
307
+ ['codeBlockHeaderRightGap', 6, 'space-code-block-header-right-gap'],
308
+ ['codeBlockBodyInsetY', 10, 'space-code-block-body-inset-y'],
309
+ ['codeBlockFloatingCopyOffset', 6, 'space-code-block-floating-copy-offset'],
310
+ ['calloutInsetY', 10, 'space-callout-inset-y'],
311
+ ['calloutInsetX', 14, 'space-callout-inset-x'],
312
+ ['calloutTitleRowGap', 8, 'space-callout-title-row-gap'],
313
+ ['tocRootGap', 6, 'space-toc-root-gap'],
314
+ ['tocLinkInsetY', 4, 'space-toc-link-inset-y'],
315
+ ['tocLinkIndent', 12, 'space-toc-link-indent'],
316
+ ['tocSubIndent', 24, 'space-toc-sub-indent'],
317
+ ['articleCardTagsGap', 4, 'space-article-card-tags-gap'],
318
+ ['articleCardTagInsetY', 1, 'space-article-card-tag-inset-y'],
319
+ ['articleCardTagInsetX', 6, 'space-article-card-tag-inset-x'],
320
+ ['articleCardMetaGapTop', 2, 'space-article-card-meta-gap-top'],
321
+ ['guideBodyGapBottom', 8, 'space-guide-body-gap-bottom'],
322
+ ['guideFooterGapTop', 20, 'space-guide-footer-gap-top'],
323
+ ['guideFooterInsetTop', 16, 'space-guide-footer-inset-top'],
324
+ ['sidebarSearchGap', 7, 'space-sidebar-search-gap'],
325
+ ['sidebarSearchTriggerHeight', 32, 'space-sidebar-search-trigger-height'],
326
+ ['settingsRowInsetY', 10, 'space-settings-row-inset-y'],
327
+ ['settingsRowGap', 16, 'space-settings-row-gap'],
328
+ ['mermaidContainerInset', 16, 'space-mermaid-container-inset'],
329
+ ['sidebarBrandInsetTop', 2, 'space-sidebar-brand-inset-top'],
330
+ ['sidebarBrandInsetX', 7, 'space-sidebar-brand-inset-x'],
331
+ ['sidebarSectionGap', 12, 'space-sidebar-section-gap'],
332
+ ['sidebarAccountInsetTop', 9, 'space-sidebar-account-inset-top'],
333
+ ['sidebarAccountInsetX', 7, 'space-sidebar-account-inset-x'],
334
+ ['sidebarAccountInsetBottom', 2, 'space-sidebar-account-inset-bottom'],
335
+ ['sidebarAvatarSize', 28, 'space-sidebar-avatar-size'],
336
+ ['sidebarSectionLabelGap', 2, 'space-sidebar-section-label-gap'],
337
+ ['sidebarChildListGapTop', 2, 'space-sidebar-child-list-gap-top'],
338
+ ['sidebarChildListGapBottom', 3, 'space-sidebar-child-list-gap-bottom'],
339
+ ['sidebarChildListIndent', 15, 'space-sidebar-child-list-indent'],
340
+ ['sidebarChildRowInsetY', 4, 'space-sidebar-child-row-inset-y'],
341
+ ['sidebarChildRowIndent', 12, 'space-sidebar-child-row-indent'],
342
+ // JS-number-only (`app-sidebar-account.tsx`/`app-sidebar.tsx` read both via `useBasaltSpacing()` —
343
+ // Mantine's `<Menu width={…}>` also takes a number, not a `var()` string).
344
+ ['sidebarAccountMenuWidth', 220, null],
345
+ ['sidebarSettingsMenuWidth', 200, null],
346
+ ['appHeaderMobileActionsHeight', 52, 'space-app-header-mobile-actions-height'],
347
+ // JS-number-only (`shell/index.tsx` reads all four via `useBasaltSpacing()` — Mantine's AppShell
348
+ // `header`/`navbar` props take numbers, not `var()` strings) — see `spaceDecls`'s doc in
349
+ // `tokens/index.ts` for why a `--vx-space-app-shell-*` declaration would have zero consumers.
350
+ ['appShellHeaderHeight', 48, null],
351
+ ['appShellHeaderMobileHeight', 97, null],
352
+ ['appShellNavbarWidth', 216, null],
353
+ ['appShellNavbarRailWidth', 48, null],
354
+ ['mobileNavTabGap', 3, 'space-mobile-nav-tab-gap'],
355
+ ['agentRailInsetX', 10, 'space-agent-rail-inset-x'],
356
+ ['agentPartGapTop', 6, 'space-agent-part-gap-top'],
357
+ ['agentCodeInset', 8, 'space-agent-code-inset'],
358
+ ['agentErrorInsetY', 8, 'space-agent-error-inset-y'],
359
+ ['agentErrorInsetX', 10, 'space-agent-error-inset-x'],
360
+ ['agentScrollButtonGapTop', 8, 'space-agent-scroll-button-gap-top'],
361
+ ['agentMessageInsetY', 10, 'space-agent-message-inset-y'],
362
+ ['agentMessageInsetX', 12, 'space-agent-message-inset-x'],
363
+ ['agentTranscriptInset', 16, 'space-agent-transcript-inset'],
364
+ ['badgeInsetY', 2, 'space-badge-inset-y'],
365
+ ['badgeInsetX', 7, 'space-badge-inset-x'],
366
+ ['statCardGap', 8, 'space-stat-card-gap'],
367
+ ['virtualRowInsetY', 8, 'space-virtual-row-inset-y'],
368
+ ['virtualRowInsetX', 12, 'space-virtual-row-inset-x'],
369
+ ['chartLegendGap', 22, null],
370
+ ['chartMarginTop', 12, null],
371
+ ['chartMarginRight', 16, null],
372
+ ['chartMarginBottom', 30, null],
373
+ ['chartMarginLeft', 44, null],
374
+ ['chartDotR', 5, null],
375
+ ['progressBarSize', 6, null],
376
+ ['timelineBullet', 22, null],
377
+ ]
378
+
379
+ describe('SPACE_STEP CSS-module spacing-sweep one-offs match the shipped identity', () => {
380
+ test('every constant matches its shipped literal', () => {
381
+ for (const [key, value] of SPACE_STEP_SWEEP) {
382
+ expect(SPACE_STEP[key]).toBe(value)
383
+ }
384
+ })
385
+
386
+ test('every constant with a cssVar is emitted as its own --vx-space-* declaration, unchanged', () => {
387
+ const css = buildPaletteCss()
388
+ for (const [, value, cssVar] of SPACE_STEP_SWEEP) {
389
+ if (cssVar === null) continue
390
+ expect(css).toContain(`--vx-${cssVar}: ${value}px;`)
391
+ }
392
+ })
393
+
394
+ test('every cssVar: null constant is NOT emitted as a --vx-space-* declaration', () => {
395
+ const css = buildPaletteCss()
396
+ const jsOnlyKeys = SPACE_STEP_SWEEP.filter(([, , cssVar]) => cssVar === null).map(
397
+ ([key]) => key,
398
+ )
399
+ expect(jsOnlyKeys).toEqual([
400
+ 'sidebarAccountMenuWidth',
401
+ 'sidebarSettingsMenuWidth',
402
+ 'appShellHeaderHeight',
403
+ 'appShellHeaderMobileHeight',
404
+ 'appShellNavbarWidth',
405
+ 'appShellNavbarRailWidth',
406
+ 'chartLegendGap',
407
+ 'chartMarginTop',
408
+ 'chartMarginRight',
409
+ 'chartMarginBottom',
410
+ 'chartMarginLeft',
411
+ 'chartDotR',
412
+ 'progressBarSize',
413
+ 'timelineBullet',
414
+ ])
415
+ expect(css).not.toContain('--vx-space-sidebar-account-menu-width')
416
+ expect(css).not.toContain('--vx-space-sidebar-settings-menu-width')
417
+ expect(css).not.toContain('--vx-space-app-shell-header-height')
418
+ expect(css).not.toContain('--vx-space-app-shell-header-mobile-height')
419
+ expect(css).not.toContain('--vx-space-app-shell-navbar-width')
420
+ expect(css).not.toContain('--vx-space-app-shell-navbar-rail-width')
421
+ expect(css).not.toContain('--vx-space-chart-legend-gap')
422
+ expect(css).not.toContain('--vx-space-progress-bar-size')
423
+ expect(css).not.toContain('--vx-space-timeline-bullet')
424
+ })
425
+
426
+ test('the sweep table covers every SPACE_STEP key', () => {
427
+ const tableKeys = new Set(SPACE_STEP_SWEEP.map(([key]) => key))
428
+ for (const key of Object.keys(SPACE_STEP)) {
429
+ expect(tableKeys.has(key as keyof typeof SPACE_STEP)).toBe(true)
430
+ }
431
+ })
432
+ })