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
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_DERIVE_CONFIG, deriveTokens, isDefaultDeriveConfig } from "./derive.js";
1
2
  const BP = {
2
3
  black: "#18181b",
3
4
  white: "#ffffff",
@@ -34,78 +35,6 @@ const p = (fam, light = 2, dark = 3) => ({
34
35
  light: fam[light],
35
36
  dark: fam[dark]
36
37
  });
37
- const SUCCESS = { light: "#2f7a4f", dark: "#56c07a" };
38
- const WARNING = { light: "#b5750f", dark: "#e0a83a" };
39
- const DANGER = { light: "#b53f3f", dark: "#e0685f" };
40
- const SEMANTIC = {
41
- good: SUCCESS,
42
- bad: DANGER,
43
- warn: WARNING
44
- };
45
- const STATUS = {
46
- excellent: p(BP.forest),
47
- good: SUCCESS,
48
- warn: WARNING,
49
- bad: DANGER,
50
- neutral: p(BP.gray, 1, 2)
51
- };
52
- const NEUTRAL = {
53
- line: { light: BP.gray[0], dark: BP.gray[4] },
54
- // primary line
55
- line2: { light: BP.gray[1], dark: BP.gray[2] },
56
- // secondary line
57
- axis: { light: "rgba(38,38,38,0.6)", dark: "rgba(255,255,255,0.6)" },
58
- axisStroke: { light: "rgba(38,38,38,0.12)", dark: "rgba(255,255,255,0.12)" },
59
- grid: { light: "rgba(38,38,38,0.07)", dark: "rgba(255,255,255,0.06)" },
60
- crosshair: { light: "rgba(38,38,38,0.32)", dark: "rgba(255,255,255,0.42)" },
61
- dotStroke: { light: BP.white, dark: BP.darkGray[1] },
62
- // matches chart-area bg
63
- tooltipBg: { light: BP.white, dark: "rgba(39,39,42,0.96)" },
64
- tooltipText: { light: "rgba(38,38,38,0.88)", dark: "rgba(255,255,255,0.88)" },
65
- tooltipMuted: { light: "rgba(38,38,38,0.5)", dark: "rgba(255,255,255,0.5)" },
66
- tooltipBorder: { light: `1px solid ${BP.lightGray[1]}`, dark: "none" },
67
- tooltipShadow: { light: "0 2px 8px rgba(38,38,38,0.1)", dark: "0 2px 8px rgba(0,0,0,0.35)" },
68
- // Base neutral for hairlines / muted / DIMMED text / overlays — apply opacity via alpha().
69
- // Binds to --mantine-color-dimmed, so it is THE dimmed-text lever. Equal to `INK.muted` (the
70
- // spec's "muted (secondary text)" row) — kept as its own pair for the pre-existing `--vx-neutral`
71
- // name (never renamed), while `INK.muted` below is the new explicit spec-named token.
72
- neutral: { light: "#525252", dark: "#d4d4d4" }
73
- };
74
- const INK = {
75
- ink: { light: "#262626", dark: "#e5e5e5" },
76
- // primary text
77
- ink2: { light: "#404040", dark: "#dddddd" },
78
- // emphasis body
79
- muted: { light: "#525252", dark: "#d4d4d4" },
80
- // secondary text (= NEUTRAL.neutral)
81
- faint: { light: "#737373", dark: "#a1a1a1" }
82
- // tertiary text / micro-labels
83
- };
84
- const ACCENT = {
85
- accent: { light: "#0077bd", dark: "#8ec5ff" },
86
- // accent as INK — inverts across schemes
87
- accentHover: { light: "#0069a8", dark: "#51a2ff" },
88
- accentFill: { light: "#0077bd", dark: "#0077bd" },
89
- // accent as SURFACE — same hex in both schemes
90
- accentFillHover: { light: "#0069a8", dark: "#0069a8" },
91
- // deeper on hover (white text 5.86:1)
92
- onAccent: { light: "#ffffff", dark: "#ffffff" }
93
- // text on an accent fill — white in BOTH
94
- };
95
- const FILL = {
96
- gray: "#707078",
97
- red: "#cc3c41",
98
- pink: "#d22b6a",
99
- grape: "#ad47ad",
100
- violet: "#ad47ad",
101
- indigo: "#745cda",
102
- cyan: "#1378aa",
103
- teal: "#007f75",
104
- green: "#1f8228",
105
- lime: "#617a1a",
106
- yellow: "#936a05",
107
- orange: "#a56113"
108
- };
109
38
  const SHADOW = {
110
39
  card: {
111
40
  light: "0 1px 2px rgba(28,25,23,0.05), 0 0 0 1px var(--vx-surface-hairline)",
@@ -124,63 +53,632 @@ const SHADOW = {
124
53
  dark: "0 8px 24px rgba(0,0,0,0.5)"
125
54
  }
126
55
  };
127
- const DARK_PAGE = "color-mix(in srgb, #27272a 70%, #18181b)";
128
- const SURFACE = {
129
- bg: {
130
- light: "color-mix(in srgb, #f4f4f5 50%, #e4e4e7)",
131
- dark: DARK_PAGE
132
- },
133
- // page background
134
- panel: { light: "#f4f4f5", dark: "#27272a" },
135
- // cards, controls
136
- panelHover: {
137
- light: "#fafafa",
138
- dark: "color-mix(in srgb, #3f3f46 50%, #27272a)"
139
- },
140
- // Elevated surface (chart area, `--mantine-color-default-hover`) — same lift as panel-hover.
141
- elevated: {
142
- light: "#fafafa",
143
- dark: "color-mix(in srgb, #3f3f46 50%, #27272a)"
144
- },
145
- border: {
146
- light: "color-mix(in srgb, #e4e4e7 50%, #d4d4d8)",
147
- dark: "#3f3f46"
148
- },
149
- // "line" — strong border (layout/control chrome, NOT the card ring)
150
- hairline: {
151
- light: "#e5e5e5",
152
- dark: "color-mix(in srgb, #52525c 50%, #3f3f46)"
153
- },
154
- // card ring only — consumed by `SHADOW.card`
155
- // Hover/striped/track fallback surface — a faint step between `panel` and `border`. Used by
156
- // Table hover/striped, Code, SegmentedControl track fallback, Tabs/Accordion/Menu hover.
157
- subtle: { light: "#eeeef0", dark: "#2d2d33" },
158
- // Floating-layer surface (menus, popovers, tooltips, modals, drawers). On light it reads pure
159
- // white — a clean lift above the zinc-100 panel; on dark it reuses the `panelHover` elevated step
160
- // (≈ #333338) so detached surfaces sit a shade above the panel. Paired with `SHADOW.overlay` +
161
- // a real `border` so Mantine's arrow renders a proper edge (`docs/DESIGN-SPEC.md` §5).
162
- overlay: {
163
- light: "#ffffff",
164
- dark: "color-mix(in srgb, #3f3f46 50%, #27272a)"
165
- },
166
- // Input field surface (docs/DESIGN-SPEC.md §5 field idiom) — reads slightly inset ON a panel.
167
- // Light: pure white on the zinc-100 panel; dark: the page-bg step (one darker than panel).
168
- field: { light: "#ffffff", dark: DARK_PAGE },
169
- divider: {
170
- light: "color-mix(in srgb, #e5e5e5 65%, transparent)",
171
- dark: "color-mix(in srgb, #ffffff 6%, transparent)"
56
+ function clampRadius(n) {
57
+ return Math.max(0, n);
58
+ }
59
+ const RADIUS_LEVEL_RANGE = { min: -5, max: 5 };
60
+ function deriveRadius(level) {
61
+ if (!Number.isInteger(level) || level < RADIUS_LEVEL_RANGE.min || level > RADIUS_LEVEL_RANGE.max) {
62
+ throw new Error(
63
+ `deriveRadius: level must be an integer in [${RADIUS_LEVEL_RANGE.min}, ${RADIUS_LEVEL_RANGE.max}], got ${level}`
64
+ );
172
65
  }
173
- // layout separators (header bottom rule, sidebar child indent)
66
+ const card = clampRadius(7 + level);
67
+ const ctrl = clampRadius(6 + level);
68
+ return {
69
+ card,
70
+ ctrl,
71
+ floating: card + 1,
72
+ tight: clampRadius(ctrl - 1),
73
+ fine: clampRadius(ctrl - 2)
74
+ };
75
+ }
76
+ const DEFAULT_RADIUS_VALUES = deriveRadius(0);
77
+ const RADIUS = {
78
+ /** Card / Paper / `ChartCard` (Mantine-free chart chrome shares this token too). */
79
+ card: DEFAULT_RADIUS_VALUES.card,
80
+ /** Inputs, buttons, segmented-control track — also `defaultRadius: 'md'` in the Mantine `radius`
81
+ * size-scale below. */
82
+ ctrl: DEFAULT_RADIUS_VALUES.ctrl
83
+ };
84
+ const RADIUS_STEP = {
85
+ /** Tooltip / Popover / Modal / Notification (`docs/DESIGN-SPEC.md` §5 floating tier) — one step
86
+ * above the card radius. */
87
+ floating: DEFAULT_RADIUS_VALUES.floating,
88
+ // 8
89
+ /** SegmentedControl's active indicator, Kbd, Code — one step below the control radius. */
90
+ tight: DEFAULT_RADIUS_VALUES.tight,
91
+ // 5
92
+ /** Progress bar, and the Mantine scale's `sm` step — two steps below the control radius. */
93
+ fine: DEFAULT_RADIUS_VALUES.fine,
94
+ // 4
95
+ /** The Mantine `radius` scale's `xs` step — independent of both anchors. */
96
+ scaleXs: 2,
97
+ /** The Mantine `radius` scale's `lg` step — independent of both anchors. */
98
+ scaleLg: 16,
99
+ /** The Mantine `radius` scale's `xl` step — independent of both anchors. */
100
+ scaleXl: 32,
101
+ /** Fully-rounded pill affordance (scroll-to-bottom button, chips). Fixed — a pill reads round at
102
+ * any radius level, so it does not track the knob (like the scale stops above). */
103
+ pill: 9999
104
+ };
105
+ const CONTROL_HEIGHT_BASE = 42;
106
+ const SPACE_ANCHORS_BASE = {
107
+ /** Horizontal inset of a nav/menu row (NavLink root, Menu item). */
108
+ rowInsetX: 10,
109
+ /** Vertical inset of a nav/menu row (NavLink root, Menu item). */
110
+ rowInsetY: 6,
111
+ /** The 4px vertical rhythm's tightest step. Rebuilt from a single scaled unit at non-zero levels
112
+ * (see {@link deriveSpacing}'s doc) — this literal is the level-0 reference only. */
113
+ stackXs: 4,
114
+ /** The 4px vertical rhythm, 2nd step — always `2 * stackXs` (see {@link deriveSpacing}'s doc). */
115
+ stackSm: 8,
116
+ /** The 4px vertical rhythm, 3rd step — always `3 * stackXs`. (It USED to coincide with
117
+ * `SPACE_SCALE.sm` at level 0; the component-roominess retune moved the scale off the rhythm, which
118
+ * is exactly the independence that constant's doc describes.) */
119
+ stackMd: 12,
120
+ /** The 4px vertical rhythm, 4th step — always `4 * stackXs`. */
121
+ stackLg: 16,
122
+ /** The 4px vertical rhythm's widest step — always `6 * stackXs`. */
123
+ stackXl: 24,
124
+ /** A `size: 'md'` Mantine Input's resolved height (see the group doc above). */
125
+ inputHeight: CONTROL_HEIGHT_BASE,
126
+ /** A `size: 'md'` Mantine Button's/ActionIcon's resolved height — the SAME number as `inputHeight`
127
+ * (both read {@link CONTROL_HEIGHT_BASE}), so a Button/ActionIcon placed beside a `size="md"`
128
+ * Input tracks it at every density level instead of only coinciding at level 0 (the defect this
129
+ * anchor fixes — Mantine's own `--button-height-md`/`--ai-size` are static, density-blind). */
130
+ controlHeight: CONTROL_HEIGHT_BASE
131
+ };
132
+ const SPACE_SCALE_BASE = {
133
+ xs: 11,
134
+ sm: 13,
135
+ md: 18,
136
+ lg: 20,
137
+ xl: 26
174
138
  };
139
+ const SPACE_STEP_BASE = {
140
+ /** Timeline `defaultProps.bulletSize`. */
141
+ timelineBullet: 22,
142
+ // ── Shared across ≥2 sites (structural — must render at the same value) ──────────────────────
143
+ // `stickyHeaderClearance`/`stickyHeaderClearanceMobile` USED to live here as ONE independent base
144
+ // literal (84) — they don't any more. Both are DERIVED, post-`step`, from their OWN AppShell
145
+ // header (`appShellHeaderHeight` / `appShellHeaderMobileHeight` below) instead (see
146
+ // {@link deriveSpacing}'s doc for why): an independent literal could drift from the header it's
147
+ // supposed to clear, which is exactly what happened (84 < 96, under-clearing the mobile header at
148
+ // every level before this fix) — and a SINGLE derived value still over-cleared the desktop header
149
+ // by 60px, since the desktop header is less than half the mobile one's height. `SpaceValues.step`
150
+ // still carries both keys — see that type's own doc — they're just not part of this BASE table.
151
+ /** NavLink leftSection icon-to-label gap — shared by `theme/nav-link.module.css` (every render
152
+ * path) and `shell/app-sidebar.module.css`'s own `.link` rule (belt-and-suspenders on the same
153
+ * DOM), and reused verbatim for `.footerBtn`/`.accountRow`'s icon gap (their own doc comments call
154
+ * out "IDENTICAL geometry to a nav row"). */
155
+ navIconGap: 10,
156
+ /** Sidebar region-to-region gap: `.brand`'s bottom padding and `.searchSlot`'s bottom padding (in
157
+ * both the expanded and collapsed rail variants) — the searchSlot comment explicitly says its gap
158
+ * opens the nav region "the same way the brand row's own bottom padding does". */
159
+ sidebarRegionGap: 10,
160
+ // ── content/prose.module.css ──────────────────────────────────────────────────────────────────
161
+ /** Blockquote rail's own vertical inset. */
162
+ proseQuoteInsetY: 2,
163
+ /** Blockquote text indent past the rail. */
164
+ proseQuoteIndent: 12,
165
+ /** Inline code chip vertical inset. */
166
+ proseInlineCodeInsetY: 1.5,
167
+ /** Inline code chip horizontal inset. */
168
+ proseInlineCodeInsetX: 5,
169
+ /** Raw `<pre>` fallback block vertical inset. */
170
+ proseCodeBlockInsetY: 10,
171
+ /** Raw `<pre>` fallback block horizontal inset. */
172
+ proseCodeBlockInsetX: 12,
173
+ /** Heading copy-link anchor's gap from the heading text. */
174
+ proseHeadingAnchorGap: 6,
175
+ /** Table cell vertical inset. */
176
+ proseTableCellInsetY: 5,
177
+ /** Table cell horizontal inset. */
178
+ proseTableCellInsetX: 8,
179
+ /** Chat-density list's bottom margin (top margin reuses `SPACE.stackXs`). */
180
+ proseChatListGapBottom: 10,
181
+ /** Chat-density list indent. */
182
+ proseChatListIndent: 20,
183
+ /** Chat-density list-item vertical margin. */
184
+ proseChatListItemGap: 3,
185
+ /** Chat-density nested-list vertical margin. */
186
+ proseChatNestedListGap: 2,
187
+ /** Chat-density heading top margin. */
188
+ proseChatHeadingGapTop: 14,
189
+ /** Chat-density heading bottom margin. */
190
+ proseChatHeadingGapBottom: 6,
191
+ /** Article-density paragraph bottom margin. */
192
+ proseArticleParagraphGap: 14,
193
+ /** Article-density list top margin. */
194
+ proseArticleListGapTop: 6,
195
+ /** Article-density list bottom margin. */
196
+ proseArticleListGapBottom: 14,
197
+ /** Article-density list indent. */
198
+ proseArticleListIndent: 22,
199
+ /** Article-density `h1` top margin. */
200
+ proseArticleH1GapTop: 6,
201
+ /** Article-density `h1` bottom margin. */
202
+ proseArticleH1GapBottom: 14,
203
+ /** Article-density `h2`/`h3`/`h4`-`h6` shared top margin — one heading-rhythm law repeated
204
+ * verbatim across all three selectors, not a coincidence. */
205
+ proseArticleHeadingGapTop: 30,
206
+ /** Article-density `h2`/`h3`/`h4`-`h6` shared bottom margin (see `proseArticleHeadingGapTop`). */
207
+ proseArticleHeadingGapBottom: 10,
208
+ /** Article-density `h2`'s bottom-rule padding. */
209
+ proseArticleH2RuleGap: 6,
210
+ /** Article-density block-object (blockquote/pre/table/embedded div) margin. */
211
+ proseArticleBlockGap: 18,
212
+ // ── content/article-layout.module.css ─────────────────────────────────────────────────────────
213
+ /** Content-column-to-TOC-rail column gap. The governing `@media (max-width: 1200px)` breakpoint
214
+ * (`article-layout.module.css`) is deliberately NOT density-coupled — it is a viewport-comfort
215
+ * threshold for showing the TOC rail at all, not a sum of the column tracks: the grid's first
216
+ * column is `minmax(0, var(--vx-prose-measure))`, a FLEXIBLE track that shrinks to fit rather
217
+ * than a fixed width the breakpoint would need to sum. A gap and a responsive breakpoint are
218
+ * different concepts — forcing them to move together would be the coincidence-not-law trap in
219
+ * reverse (see `articleTocRailWidth` below for the track this gap sits beside, which — unlike
220
+ * the breakpoint — IS a genuine density-tracking dimension). */
221
+ articleColumnGap: 56,
222
+ /** TOC rail's own grid-column track width (`.root`'s `grid-template-columns` second track). The
223
+ * rail's contents (`content/toc.module.css`'s link rows) already track density via
224
+ * `tocLinkInsetY`/`tocLinkIndent`/`tocSubIndent`, so a fixed-width raw literal here would squeeze
225
+ * those rows' available space as density rises instead of growing with them — the inverse of the
226
+ * AppShell navbar/rail-width tokenization, same rationale. */
227
+ articleTocRailWidth: 220,
228
+ /** Meta header's own vertical stack gap (title/description/metaRow). */
229
+ articleHeaderGap: 10,
230
+ /** Meta header's bottom padding (above its divider). */
231
+ articleHeaderPaddingBottom: 20,
232
+ /** Meta header's bottom margin (below its divider). */
233
+ articleHeaderMarginBottom: 28,
234
+ /** Meta-row icon-to-text gap. */
235
+ articleMetaRowGap: 6,
236
+ /** Prev/next footer's column gap. */
237
+ articleFooterGap: 12,
238
+ /** Prev/next footer's top margin (above its divider). */
239
+ articleFooterMarginTop: 40,
240
+ /** Prev/next footer's top padding (below its divider). */
241
+ articleFooterPaddingTop: 20,
242
+ /** Prev/next nav-target icon-to-text gap. */
243
+ articleNavTargetGap: 6,
244
+ // ── content/code-block.module.css ─────────────────────────────────────────────────────────────
245
+ /** Header's title-to-controls gap. */
246
+ codeBlockHeaderGap: 8,
247
+ /** Header's vertical inset. */
248
+ codeBlockHeaderInsetY: 6,
249
+ /** Header's right inset (before the header-right control cluster). */
250
+ codeBlockHeaderInsetRight: 10,
251
+ /** Content-column left edge — shared by the header's left inset and the body's horizontal inset,
252
+ * so the header title and the code text line up on the same left edge. */
253
+ codeBlockContentInsetX: 14,
254
+ /** Header-right control cluster's own gap. */
255
+ codeBlockHeaderRightGap: 6,
256
+ /** Body's vertical inset. */
257
+ codeBlockBodyInsetY: 10,
258
+ /** Floating copy button's corner offset — one value reused for both `top` and `right`. */
259
+ codeBlockFloatingCopyOffset: 6,
260
+ // ── content/callout.module.css ────────────────────────────────────────────────────────────────
261
+ /** Panel vertical inset. */
262
+ calloutInsetY: 10,
263
+ /** Panel horizontal inset. */
264
+ calloutInsetX: 14,
265
+ /** Title row's icon-to-text gap. */
266
+ calloutTitleRowGap: 8,
267
+ // ── content/toc.module.css ────────────────────────────────────────────────────────────────────
268
+ /** Rail's own vertical stack gap (header-to-list). */
269
+ tocRootGap: 6,
270
+ /** Link row's vertical inset. */
271
+ tocLinkInsetY: 4,
272
+ /** Link row's text indent past the rail guide. */
273
+ tocLinkIndent: 12,
274
+ /** Nested (sub-heading) link's extra indent. */
275
+ tocSubIndent: 24,
276
+ // ── content/article-card.module.css ───────────────────────────────────────────────────────────
277
+ /** Tag row's own gap. */
278
+ articleCardTagsGap: 4,
279
+ /** Tag chip's vertical inset. */
280
+ articleCardTagInsetY: 1,
281
+ /** Tag chip's horizontal inset. */
282
+ articleCardTagInsetX: 6,
283
+ /** Meta line's top gap. */
284
+ articleCardMetaGapTop: 2,
285
+ // ── content/guide.module.css ──────────────────────────────────────────────────────────────────
286
+ /** Drawer body's bottom gap (before the footer). */
287
+ guideBodyGapBottom: 8,
288
+ /** Footer's top margin (above its divider). */
289
+ guideFooterGapTop: 20,
290
+ /** Footer's top inset (below its divider). */
291
+ guideFooterInsetTop: 16,
292
+ // ── shell/sidebar-search.module.css ───────────────────────────────────────────────────────────
293
+ /** Trigger's icon-to-label gap. */
294
+ sidebarSearchGap: 7,
295
+ /** Trigger's height — floored at 24px in {@link deriveSpacing} (WCAG 2.5.8 minimum target size);
296
+ * the collapsed rail's `ActionIcon` variant reads the SAME resolved value (`shell/sidebar-
297
+ * search.module.css`'s `.railBtn`), so both states of the control stay consistent at every level. */
298
+ sidebarSearchTriggerHeight: 32,
299
+ // ── dashboard/settings-section.module.css ─────────────────────────────────────────────────────
300
+ /** Row's vertical inset. */
301
+ settingsRowInsetY: 10,
302
+ /** Row's own gap (label cluster to control). */
303
+ settingsRowGap: 16,
304
+ // ── content/mermaid.module.css ────────────────────────────────────────────────────────────────
305
+ /** Diagram container's inset (all sides). */
306
+ mermaidContainerInset: 16,
307
+ // ── shell/app-sidebar.module.css (beyond the shared/reused anchors above) ────────────────────
308
+ /** Brand row's top inset. */
309
+ sidebarBrandInsetTop: 2,
310
+ /** Brand row's horizontal inset. */
311
+ sidebarBrandInsetX: 7,
312
+ /** Gap between nav sections. */
313
+ sidebarSectionGap: 12,
314
+ /** Account row's top inset. */
315
+ sidebarAccountInsetTop: 9,
316
+ /** Account row's horizontal inset. */
317
+ sidebarAccountInsetX: 7,
318
+ /** Account row's bottom inset. */
319
+ sidebarAccountInsetBottom: 2,
320
+ /** Identity-initials avatar block's fixed size (width and height). */
321
+ sidebarAvatarSize: 28,
322
+ /** Section-label row's bottom gap (before the first nav row). */
323
+ sidebarSectionLabelGap: 2,
324
+ /** Collapsible child-list wrapper's top margin. */
325
+ sidebarChildListGapTop: 2,
326
+ /** Collapsible child-list wrapper's bottom margin. */
327
+ sidebarChildListGapBottom: 3,
328
+ /** Collapsible child-list wrapper's left indent. */
329
+ sidebarChildListIndent: 15,
330
+ /** Child NavLink row's vertical inset. */
331
+ sidebarChildRowInsetY: 4,
332
+ /** Child NavLink row's extra left indent (past the rail guide). */
333
+ sidebarChildRowIndent: 12,
334
+ // ── shell/app-sidebar.tsx & app-sidebar-account.tsx (Mantine `<Menu width={…}>` props) ────────
335
+ // Both are FIXED dropdown widths (a JSX number prop, not CSS — same "JS-consumed, no --vx-* var"
336
+ // shape as `appShellNavbarWidth` etc.) holding `Menu.Item` rows padded by `rowInsetX`/`rowInsetY`
337
+ // (`theme/index.ts`'s `Menu.extend`). Unlike `.subnavDropdown`'s `min-width: 180px`
338
+ // (`app-sidebar.module.css`, deliberately left a raw literal — a `min-width` only floors the box
339
+ // and it grows with content, so it can never squeeze), a `width` prop caps the dropdown exactly:
340
+ // as density rises the row's padding/line-height need more room than a frozen width can give,
341
+ // squeezing the label text — the same rationale `articleTocRailWidth` documents for its own
342
+ // fixed-width track.
343
+ /** Account-menu `<Menu width={…}>` (`app-sidebar-account.tsx`). */
344
+ sidebarAccountMenuWidth: 220,
345
+ /** Settings-menu `<Menu width={…}>` (`app-sidebar.tsx`). */
346
+ sidebarSettingsMenuWidth: 200,
347
+ // ── shell/app-header.module.css ───────────────────────────────────────────────────────────────
348
+ /** Mobile two-row header's page-actions row height. */
349
+ appHeaderMobileActionsHeight: 52,
350
+ // ── shell/index.tsx (AppShell dimensions) ──────────────────────────────────────────────
351
+ /** AppShell desktop header bar height — sized to hold one row of `size="md"` controls, so it
352
+ * tracks `controlHeight`. Its level-0 coincidence with `appShellNavbarRailWidth` below is a
353
+ * coincidence, not a law: this is a horizontal bar's HEIGHT (governed by control height), that
354
+ * is a vertical rail's WIDTH (governed by icon footprint). They stay separate entries. */
355
+ appShellHeaderHeight: 48,
356
+ /** AppShell mobile (two-row) header height. Not one concept but a sum: row 1 + `app-header.
357
+ * module.css`'s wrap row-gap (`--mantine-spacing-sm`) + `appHeaderMobileActionsHeight`. Two of
358
+ * those three addends already track density, so the container must too — held fixed, row 1's
359
+ * budget collapses 52px -> 12px across the level range.
360
+ *
361
+ * KEEP THIS EQUAL TO THE SUM. At level 0: 32 (row 1) + 13 (`SPACE_SCALE.sm`) + 52
362
+ * (`appHeaderMobileActionsHeight`) = 97. It was 96 while `SPACE_SCALE.sm` was 12; the
363
+ * component-roominess retune raised that addend, and leaving the total at 96 silently took the
364
+ * pixel out of row 1 instead — which is what ate the last of its WCAG 2.5.8 target-size margin at
365
+ * density -3 (`theme/density-relations.test.ts` measures row 1 as the REMAINDER of this sum, so
366
+ * the total is the only place the budget can come from). Raise this whenever `SPACE_SCALE.sm` or
367
+ * `appHeaderMobileActionsHeight` moves. Better still, make it unnecessary: computing this the way
368
+ * `stickyHeaderClearance*` already is — post-`step`, from its own addends rather than as an
369
+ * independent literal — would make the drift impossible instead of merely re-tuned. That is the
370
+ * same refactor, and the same reasoning, this PR applied to the clearances; it is worth doing to
371
+ * this one too, and it stays a follow-up only because it moves every non-zero level's value. */
372
+ appShellHeaderMobileHeight: 97,
373
+ /** AppShell navbar width, expanded — ONE entry for both the `base` (mobile drawer) and the
374
+ * expanded `sm` value: the same `.root` at full width, genuinely one concept. */
375
+ appShellNavbarWidth: 216,
376
+ /** AppShell navbar width, collapsed icon rail. Separate from `appShellHeaderHeight` above
377
+ * despite sharing 48 at level 0 (see that entry's note). */
378
+ appShellNavbarRailWidth: 48,
379
+ // ── shell/app-mobile-nav.module.css ───────────────────────────────────────────────────────────
380
+ /** Tab's icon-to-label gap. */
381
+ mobileNavTabGap: 3,
382
+ // ── charts (tokens/index.ts's `VX` object — structural, tracks density) ──────────────────────
383
+ // `VX.lineWidth`/`VX.line2Width` are DELIBERATELY absent here — they are stroke WEIGHTS (line
384
+ // thickness), not spacing/gaps/sizes, so they stay fixed regardless of density (see `VX` in
385
+ // `tokens/index.ts`). The six below are gaps/margins/a marker footprint — genuinely spacing.
386
+ /** `ChartLegend`'s column/row gap (`VX.legendGap`). */
387
+ chartLegendGap: 22,
388
+ /** Chart plot-area margin, top (`VX.margin.top`). */
389
+ chartMarginTop: 12,
390
+ /** Chart plot-area margin, right (`VX.margin.right`). */
391
+ chartMarginRight: 16,
392
+ /** Chart plot-area margin, bottom (`VX.margin.bottom`). */
393
+ chartMarginBottom: 30,
394
+ /** Chart plot-area margin, left (`VX.margin.left`). */
395
+ chartMarginLeft: 44,
396
+ /** Data-point marker radius (`VX.dotR`) — a discrete visual footprint, not a stroke weight, so
397
+ * (unlike `lineWidth`/`line2Width`) it tracks density: a judgment call, made this way because it
398
+ * reads as a "size" (closer to `sidebarAvatarSize` above) rather than a line thickness. */
399
+ chartDotR: 5,
400
+ // ── theme/index.ts's Progress `defaultProps.size` (previously an untokenized literal `6`) ──────
401
+ /** Progress bar thickness (`components.Progress.defaultProps.size`) — a numeric Mantine size prop,
402
+ * same "dev slider can't reach it, production `{ density }` rebuilds it" limitation as
403
+ * `timelineBullet` above (see `deriveSpacing`'s doc). */
404
+ progressBarSize: 6,
405
+ // ── Agent transcript / chat inline spacings — routed from the agent + agent-chat renderers and
406
+ // the dashboard/data inline styles that were raw px (the inline-spacing guard sweep) ───────────
407
+ /** `agent/part-list.tsx` + `agent-chat/thread-message.tsx` reasoning/tool-call rail's left inset. */
408
+ agentRailInsetX: 10,
409
+ /** `agent/part-list.tsx`'s `DefaultReasoning` body / both rail code blocks' top gap. */
410
+ agentPartGapTop: 6,
411
+ /** Both rail code blocks' own inset (all sides). */
412
+ agentCodeInset: 8,
413
+ /** `agent/part-list.tsx`'s `DefaultError` vertical inset. */
414
+ agentErrorInsetY: 8,
415
+ /** `agent/part-list.tsx`'s `DefaultError` horizontal inset. */
416
+ agentErrorInsetX: 10,
417
+ /** `agent/stick-to-bottom.tsx`'s scroll-to-bottom button top gap. */
418
+ agentScrollButtonGapTop: 8,
419
+ /** `agent-chat/thread-message.tsx`'s message bubble vertical inset. */
420
+ agentMessageInsetY: 10,
421
+ /** `agent-chat/thread-message.tsx`'s message bubble horizontal inset. */
422
+ agentMessageInsetX: 12,
423
+ /** `agent-chat/thread-detail-panel.tsx`'s transcript scroll container's own inset (all sides). */
424
+ agentTranscriptInset: 16,
425
+ /** `agent-chat/thread-outcome-card.tsx` + `dashboard/delta-badge.tsx`'s status badge vertical inset. */
426
+ badgeInsetY: 2,
427
+ /** `agent-chat/thread-outcome-card.tsx` + `dashboard/delta-badge.tsx`'s status badge horizontal inset. */
428
+ badgeInsetX: 7,
429
+ /** `dashboard/stat-card.tsx`'s header/value/sparkline stack gap. */
430
+ statCardGap: 8,
431
+ /** `data/virtual-list.tsx`'s skeleton row vertical inset. */
432
+ virtualRowInsetY: 8,
433
+ /** `data/virtual-list.tsx`'s skeleton row horizontal inset. */
434
+ virtualRowInsetX: 12
435
+ };
436
+ const SPACE_FIXED = {
437
+ /** Timeline `defaultProps.lineWidth`; also used for 1px borders. */
438
+ hairline: 1,
439
+ /** ReadingProgress's fixed top-bar height — a hairline-like indicator line (docs/CONTENT-SPEC.md
440
+ * §7), not a spacing gap that should thicken with density. Stays a literal at its one call site
441
+ * (`content/reading-progress.module.css`), same as `hairline`. */
442
+ readingProgressHeight: 2,
443
+ /** SegmentedControl track's optical inset (`styles.root` padding) — moved OUT of `SPACE_STEP` and
444
+ * exempted from the density knob because it is load-bearing for the nested-corner law
445
+ * (docs/DESIGN-SPEC.md §4): `RADIUS.card === RADIUS_STEP.tight + segmentedTrackInset` (`7 = 5 +
446
+ * 2`). `RADIUS.card`/`RADIUS_STEP.tight` both shift together under the RADIUS knob (`card = 7 +
447
+ * level`, `tight = ctrl - 1 = 5 + level`), so their difference is ALWAYS exactly 2 regardless of
448
+ * that knob — a density-tracking inset would break concentricity in both directions (verified: this
449
+ * inset's own value, HAD it stayed density-tracking, resolves via `scaleSpace(2, level, multiplier)`
450
+ * to 1 at density's floor level -3 and 3 at its ceiling level +3 — the widest swing `deriveSpacing`'s
451
+ * `[-3, 3]` range can produce) for no compensating benefit, since the two radii it sits between
452
+ * never move independently of each other. */
453
+ segmentedTrackInset: 2
454
+ };
455
+ function scaleSpace(value, level, multiplier) {
456
+ if (level === 0) return value;
457
+ const scaled = Math.round(value * multiplier);
458
+ return Math.max(1, scaled);
459
+ }
460
+ function mapSpaceGroup(base, level, multiplier) {
461
+ const out = {};
462
+ for (const key of Object.keys(base))
463
+ out[key] = scaleSpace(base[key], level, multiplier);
464
+ return out;
465
+ }
466
+ const ROW_LINE_HEIGHT_STEP = 1 / 30;
467
+ const DENSITY_LEVEL_RANGE = { min: -3, max: 3 };
468
+ function deriveSpacing(level) {
469
+ if (!Number.isInteger(level) || level < DENSITY_LEVEL_RANGE.min || level > DENSITY_LEVEL_RANGE.max) {
470
+ throw new Error(
471
+ `deriveSpacing: level must be an integer in [${DENSITY_LEVEL_RANGE.min}, ${DENSITY_LEVEL_RANGE.max}], got ${level}`
472
+ );
473
+ }
474
+ const multiplier = 1 + 0.1 * level;
475
+ const anchors = mapSpaceGroup(SPACE_ANCHORS_BASE, level, multiplier);
476
+ const stackUnit = scaleSpace(4, level, multiplier);
477
+ anchors.stackXs = stackUnit;
478
+ anchors.stackSm = stackUnit * 2;
479
+ anchors.stackMd = stackUnit * 3;
480
+ anchors.stackLg = stackUnit * 4;
481
+ anchors.stackXl = stackUnit * 6;
482
+ const mappedStep = mapSpaceGroup(SPACE_STEP_BASE, level, multiplier);
483
+ mappedStep.sidebarSearchTriggerHeight = Math.max(24, mappedStep.sidebarSearchTriggerHeight);
484
+ const step = {
485
+ ...mappedStep,
486
+ // RESPONSIVE, one per AppShell breakpoint — each DERIVED from its own header, plus
487
+ // density-tracking breathing room — see this function's doc (third bullet, Decision 3) for the
488
+ // full rationale, and `theme/spacing.test.ts` for why `stickyHeaderClearance` alone is exempt
489
+ // from the level-0 byte-identity gate.
490
+ stickyHeaderClearance: mappedStep.appShellHeaderHeight + anchors.stackMd,
491
+ stickyHeaderClearanceMobile: mappedStep.appShellHeaderMobileHeight + anchors.stackMd
492
+ };
493
+ return {
494
+ anchors,
495
+ scale: mapSpaceGroup(SPACE_SCALE_BASE, level, multiplier),
496
+ step,
497
+ // Additive, gentler, INDEPENDENT law than the multiplier — see `ROW_LINE_HEIGHT_STEP`'s own doc
498
+ // for why it must NOT be computed from `multiplier`.
499
+ rowLineHeight: Math.round((1.35 + ROW_LINE_HEIGHT_STEP * level) * 100) / 100
500
+ };
501
+ }
502
+ const DEFAULT_SPACE_VALUES = deriveSpacing(0);
503
+ const SPACE = DEFAULT_SPACE_VALUES.anchors;
504
+ const SPACE_SCALE = DEFAULT_SPACE_VALUES.scale;
505
+ const SPACE_STEP = DEFAULT_SPACE_VALUES.step;
506
+ const ROW_LINE_HEIGHT = DEFAULT_SPACE_VALUES.rowLineHeight;
507
+ function hexToRgbTriplet(hex) {
508
+ const n = Number.parseInt(hex.slice(1), 16);
509
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
510
+ }
511
+ function inkRgba(hex, alpha) {
512
+ const [r, g, b] = hexToRgbTriplet(hex);
513
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
514
+ }
515
+ function buildPaletteDataUncached(config) {
516
+ const DERIVED = deriveTokens(config);
517
+ const SUCCESS = DERIVED.status.good;
518
+ const WARNING = DERIVED.status.warn;
519
+ const DANGER = DERIVED.status.bad;
520
+ const SEMANTIC2 = {
521
+ good: SUCCESS,
522
+ bad: DANGER,
523
+ warn: WARNING
524
+ };
525
+ const STATUS2 = {
526
+ excellent: p(BP.forest),
527
+ good: SUCCESS,
528
+ warn: WARNING,
529
+ bad: DANGER,
530
+ neutral: p(BP.gray, 1, 2)
531
+ };
532
+ const inkLight = DERIVED.ink.ink.light;
533
+ const NEUTRAL2 = {
534
+ line: { light: BP.gray[0], dark: BP.gray[4] },
535
+ // primary line
536
+ line2: { light: BP.gray[1], dark: BP.gray[2] },
537
+ // secondary line
538
+ axis: { light: inkRgba(inkLight, 0.6), dark: "rgba(255,255,255,0.6)" },
539
+ axisStroke: { light: inkRgba(inkLight, 0.12), dark: "rgba(255,255,255,0.12)" },
540
+ grid: { light: inkRgba(inkLight, 0.07), dark: "rgba(255,255,255,0.06)" },
541
+ crosshair: { light: inkRgba(inkLight, 0.32), dark: "rgba(255,255,255,0.42)" },
542
+ dotStroke: { light: BP.white, dark: BP.darkGray[1] },
543
+ // matches chart-area bg
544
+ tooltipBg: { light: BP.white, dark: "rgba(39,39,42,0.96)" },
545
+ tooltipText: { light: inkRgba(inkLight, 0.88), dark: "rgba(255,255,255,0.88)" },
546
+ tooltipMuted: { light: inkRgba(inkLight, 0.5), dark: "rgba(255,255,255,0.5)" },
547
+ tooltipBorder: { light: `1px solid ${BP.lightGray[1]}`, dark: "none" },
548
+ tooltipShadow: {
549
+ light: `0 2px 8px ${inkRgba(inkLight, 0.1)}`,
550
+ dark: "0 2px 8px rgba(0,0,0,0.35)"
551
+ },
552
+ // Chart legend text — same DERIVED-ink treatment as axis/grid/tooltip* above (light keys off
553
+ // `inkLight`; dark stays flat white like every other neutral chart-chrome pair here).
554
+ legendText: { light: inkRgba(inkLight, 0.82), dark: "rgba(255,255,255,0.92)" },
555
+ // Base neutral for hairlines / muted / DIMMED text / overlays — apply opacity via alpha().
556
+ // Binds to --mantine-color-dimmed, so it is THE dimmed-text lever. Equal to `INK.muted` (the
557
+ // spec's "muted (secondary text)" row) — kept as its own pair for the pre-existing `--vx-neutral`
558
+ // name (never renamed), while `INK.muted` below is the new explicit spec-named token. Both read
559
+ // the SAME generated value (`DERIVED.ink.muted`) so a palette retune can't pull them apart.
560
+ neutral: DERIVED.ink.muted
561
+ };
562
+ const INK2 = {
563
+ ink: DERIVED.ink.ink,
564
+ // primary text
565
+ ink2: DERIVED.ink.ink2,
566
+ // emphasis body
567
+ muted: DERIVED.ink.muted,
568
+ // secondary text (= NEUTRAL.neutral)
569
+ faint: DERIVED.ink.faint
570
+ // tertiary text / micro-labels
571
+ };
572
+ const ACCENT2 = {
573
+ accent: DERIVED.accent,
574
+ // accent as INK — inverts across schemes
575
+ accentHover: DERIVED.accentHover,
576
+ accentFill: DERIVED.accentFill,
577
+ // accent as SURFACE — same hex in both schemes
578
+ accentFillHover: DERIVED.accentFillHover,
579
+ // deeper on hover
580
+ onAccent: DERIVED.onAccent
581
+ // text on an accent fill
582
+ };
583
+ const FILL2 = {
584
+ gray: DERIVED.fill.gray.light,
585
+ red: DERIVED.fill.red.light,
586
+ pink: DERIVED.fill.pink.light,
587
+ grape: DERIVED.fill.grape.light,
588
+ violet: DERIVED.fill.violet.light,
589
+ indigo: DERIVED.fill.indigo.light,
590
+ cyan: DERIVED.fill.cyan.light,
591
+ teal: DERIVED.fill.teal.light,
592
+ green: DERIVED.fill.green.light,
593
+ lime: DERIVED.fill.lime.light,
594
+ yellow: DERIVED.fill.yellow.light,
595
+ orange: DERIVED.fill.orange.light
596
+ };
597
+ const SURFACE2 = {
598
+ bg: DERIVED.surface.bg,
599
+ // page background
600
+ panel: DERIVED.surface.panel,
601
+ // cards, controls
602
+ panelHover: DERIVED.surface.panelHover,
603
+ // Elevated surface (chart area, `--mantine-color-default-hover`) — same lift as panel-hover.
604
+ elevated: DERIVED.surface.elevated,
605
+ border: DERIVED.surface.border,
606
+ // "line" — strong border (layout/control chrome, NOT the card ring)
607
+ hairline: DERIVED.surface.hairline,
608
+ // card ring only — consumed by `SHADOW.card`
609
+ // Hover/striped/track fallback surface — a faint step between `panel` and `border`. Used by
610
+ // Table hover/striped, Code, SegmentedControl track fallback, Tabs/Accordion/Menu hover.
611
+ subtle: DERIVED.surface.subtle,
612
+ // Floating-layer surface (menus, popovers, tooltips, modals, drawers). Hand-authored: the
613
+ // generator has no `overlay` stop. On light it reads pure white — a clean lift above the panel;
614
+ // on dark it reuses the `panelHover` elevated step so detached surfaces sit a shade above the
615
+ // panel. Paired with `SHADOW.overlay` + a real `border` so Mantine's arrow renders a proper edge
616
+ // (`docs/DESIGN-SPEC.md` §5).
617
+ overlay: {
618
+ light: "#ffffff",
619
+ dark: "color-mix(in srgb, #3f3f46 50%, #27272a)"
620
+ },
621
+ // Input field surface (docs/DESIGN-SPEC.md §5 field idiom) — reads slightly inset ON a panel.
622
+ field: DERIVED.surface.field,
623
+ // Hand-authored: the generator has no `divider` stop — layout separators (header bottom rule,
624
+ // sidebar child indent) stay a fixed-opacity color-mix, distinct from the card ring.
625
+ divider: {
626
+ light: "color-mix(in srgb, #e5e5e5 65%, transparent)",
627
+ dark: "color-mix(in srgb, #ffffff 6%, transparent)"
628
+ }
629
+ };
630
+ return { ACCENT: ACCENT2, FILL: FILL2, SURFACE: SURFACE2, INK: INK2, NEUTRAL: NEUTRAL2, SEMANTIC: SEMANTIC2, STATUS: STATUS2 };
631
+ }
632
+ const paletteDataCache = /* @__PURE__ */ new Map();
633
+ const PALETTE_DATA_CACHE_MAX = 32;
634
+ let defaultPaletteData;
635
+ function buildPaletteData(config = DEFAULT_DERIVE_CONFIG) {
636
+ if (isDefaultDeriveConfig(config)) {
637
+ defaultPaletteData ??= buildPaletteDataUncached(config);
638
+ return defaultPaletteData;
639
+ }
640
+ const key = JSON.stringify(config);
641
+ const cached = paletteDataCache.get(key);
642
+ if (cached) return cached;
643
+ const data = buildPaletteDataUncached(config);
644
+ paletteDataCache.set(key, data);
645
+ if (paletteDataCache.size > PALETTE_DATA_CACHE_MAX) {
646
+ const oldestKey = paletteDataCache.keys().next().value;
647
+ if (oldestKey !== void 0) paletteDataCache.delete(oldestKey);
648
+ }
649
+ return data;
650
+ }
651
+ const STATIC_PALETTE_DATA = buildPaletteData(DEFAULT_DERIVE_CONFIG);
652
+ const SEMANTIC = STATIC_PALETTE_DATA.SEMANTIC;
653
+ const STATUS = STATIC_PALETTE_DATA.STATUS;
654
+ const NEUTRAL = STATIC_PALETTE_DATA.NEUTRAL;
655
+ const INK = STATIC_PALETTE_DATA.INK;
656
+ const ACCENT = STATIC_PALETTE_DATA.ACCENT;
657
+ const FILL = STATIC_PALETTE_DATA.FILL;
658
+ const SURFACE = STATIC_PALETTE_DATA.SURFACE;
175
659
  export {
176
660
  ACCENT,
177
661
  BP,
662
+ DEFAULT_SPACE_VALUES,
663
+ DENSITY_LEVEL_RANGE,
178
664
  FILL,
179
665
  INK,
180
666
  NEUTRAL,
667
+ RADIUS,
668
+ RADIUS_LEVEL_RANGE,
669
+ RADIUS_STEP,
670
+ ROW_LINE_HEIGHT,
181
671
  SEMANTIC,
182
672
  SHADOW,
673
+ SPACE,
674
+ SPACE_FIXED,
675
+ SPACE_SCALE,
676
+ SPACE_STEP,
183
677
  STATUS,
184
678
  SURFACE,
185
- p
679
+ buildPaletteData,
680
+ deriveRadius,
681
+ deriveSpacing,
682
+ p,
683
+ scaleSpace
186
684
  };