basalt-ui 1.1.1 → 1.3.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 +46 -0
  3. package/README.md +64 -8
  4. package/agent/rules/basalt-app.md +126 -0
  5. package/agent/rules/basalt-content.md +3 -1
  6. package/agent/rules/basalt-tokens.md +14 -5
  7. package/agent/skills/basalt-app/SKILL.md +28 -7
  8. package/dist/agent/part-list.d.ts.map +1 -1
  9. package/dist/agent/part-list.js +17 -7
  10. package/dist/agent/stick-to-bottom.js +2 -2
  11. package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -1
  12. package/dist/agent-chat/thread-detail-panel.js +37 -33
  13. package/dist/agent-chat/thread-message.d.ts.map +1 -1
  14. package/dist/agent-chat/thread-message.js +8 -5
  15. package/dist/agent-chat/thread-outcome-card.js +3 -3
  16. package/dist/agent-chat/thread-workspace.js +1 -1
  17. package/dist/charts/primitives/ChartLegend.js +2 -0
  18. package/dist/charts/primitives/ChartTooltip.js +2 -1
  19. package/dist/cli/index.d.ts +29 -0
  20. package/dist/cli/index.d.ts.map +1 -1
  21. package/dist/cli/index.js +80 -9
  22. package/dist/connectivity/connectivity-indicator.d.ts.map +1 -1
  23. package/dist/connectivity/connectivity-indicator.js +3 -3
  24. package/dist/content/article-card.module.css +7 -5
  25. package/dist/content/article-layout.module.css +16 -12
  26. package/dist/content/callout.module.css +4 -4
  27. package/dist/content/code-block.module.css +8 -7
  28. package/dist/content/guide.module.css +3 -3
  29. package/dist/content/mermaid.module.css +2 -2
  30. package/dist/content/prose.module.css +59 -29
  31. package/dist/content/reading-progress.module.css +2 -0
  32. package/dist/content/toc.module.css +6 -3
  33. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  34. package/dist/dashboard/delta-badge.js +10 -2
  35. package/dist/dashboard/empty-state.d.ts.map +1 -1
  36. package/dist/dashboard/empty-state.js +3 -16
  37. package/dist/dashboard/settings-section.js +2 -2
  38. package/dist/dashboard/settings-section.module.css +2 -2
  39. package/dist/dashboard/stat-card.js +2 -1
  40. package/dist/data/virtual-list.d.ts.map +1 -1
  41. package/dist/data/virtual-list.js +12 -2
  42. package/dist/forms/FormErrorSummary.js +2 -2
  43. package/dist/guard/index.d.ts +20 -4
  44. package/dist/guard/index.d.ts.map +1 -1
  45. package/dist/guard/index.js +266 -38
  46. package/dist/guard/types.d.ts +24 -3
  47. package/dist/guard/types.d.ts.map +1 -1
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/provider/index.d.ts +30 -1
  51. package/dist/provider/index.d.ts.map +1 -1
  52. package/dist/provider/index.js +32 -7
  53. package/dist/provider/lab-theme.d.ts +39 -0
  54. package/dist/provider/lab-theme.d.ts.map +1 -0
  55. package/dist/provider/lab-theme.js +52 -0
  56. package/dist/shell/app-header.module.css +2 -2
  57. package/dist/shell/app-mobile-nav.module.css +1 -1
  58. package/dist/shell/app-sidebar-account.d.ts.map +1 -1
  59. package/dist/shell/app-sidebar-account.js +4 -2
  60. package/dist/shell/app-sidebar.d.ts.map +1 -1
  61. package/dist/shell/app-sidebar.js +4 -2
  62. package/dist/shell/app-sidebar.module.css +36 -26
  63. package/dist/shell/index.d.ts.map +1 -1
  64. package/dist/shell/index.js +11 -4
  65. package/dist/shell/sidebar-search.module.css +16 -4
  66. package/dist/styles.css +22 -11
  67. package/dist/surfaces.d.ts +21 -11
  68. package/dist/surfaces.d.ts.map +1 -1
  69. package/dist/surfaces.js +10 -3
  70. package/dist/theme/controls.module.css +1 -1
  71. package/dist/theme/floating.module.css +1 -1
  72. package/dist/theme/index.d.ts +116 -11
  73. package/dist/theme/index.d.ts.map +1 -1
  74. package/dist/theme/index.js +703 -566
  75. package/dist/theme/nav-link.module.css +1 -1
  76. package/dist/theme/use-basalt-spacing.d.ts +3 -0
  77. package/dist/theme/use-basalt-spacing.d.ts.map +1 -0
  78. package/dist/theme/use-basalt-spacing.js +8 -0
  79. package/dist/theme-lab/derive-controls.d.ts +13 -0
  80. package/dist/theme-lab/derive-controls.d.ts.map +1 -0
  81. package/dist/theme-lab/derive-controls.js +137 -0
  82. package/dist/theme-lab/derive-state.d.ts +55 -0
  83. package/dist/theme-lab/derive-state.d.ts.map +1 -0
  84. package/dist/theme-lab/derive-state.js +81 -0
  85. package/dist/theme-lab/index.d.ts +12 -2
  86. package/dist/theme-lab/index.d.ts.map +1 -1
  87. package/dist/theme-lab/index.js +13 -62
  88. package/dist/theme-toggle/index.d.ts.map +1 -1
  89. package/dist/theme-toggle/index.js +3 -2
  90. package/dist/tokens/derive.d.ts +89 -0
  91. package/dist/tokens/derive.d.ts.map +1 -0
  92. package/dist/tokens/derive.js +250 -0
  93. package/dist/tokens/hct.d.ts +34 -0
  94. package/dist/tokens/hct.d.ts.map +1 -0
  95. package/dist/tokens/hct.js +159 -0
  96. package/dist/tokens/index.d.ts +143 -7
  97. package/dist/tokens/index.d.ts.map +1 -1
  98. package/dist/tokens/index.js +322 -48
  99. package/dist/tokens/palette.d.ts +984 -167
  100. package/dist/tokens/palette.d.ts.map +1 -1
  101. package/dist/tokens/palette.js +617 -119
  102. package/dist/tokens.css +248 -0
  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 +14 -4
  110. package/package.json +41 -10
  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 +129 -6
  121. package/src/cli/tokens-css.test.ts +90 -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 +483 -15
  141. package/src/guard/index.ts +426 -47
  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 +22 -11
  156. package/src/surfaces.ts +24 -10
  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 +534 -48
  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
@@ -6,13 +6,13 @@
6
6
  * RULE_NAMES: derived projection — the deduped set of doctrine rule names (PROJECTION 1).
7
7
  */
8
8
  import type { GuardKind } from './guard/types.js';
9
- /** The 12 on-disk rule names (agent/rules/basalt-{name}.md — the set-equality target).
9
+ /** The 13 on-disk rule names (agent/rules/basalt-{name}.md — the set-equality target).
10
10
  *
11
11
  * @example
12
12
  * const r: RuleName = 'tokens' // ok
13
13
  * // const bad: RuleName = 'overlays' // tsc error — not in the union
14
14
  */
15
- export type RuleName = 'tokens' | 'charts' | 'mantine' | 'router' | 'query' | 'state' | 'forms' | 'notifications' | 'commands' | 'data' | 'agent' | 'content';
15
+ export type RuleName = 'tokens' | 'charts' | 'mantine' | 'router' | 'query' | 'state' | 'forms' | 'notifications' | 'commands' | 'data' | 'agent' | 'content' | 'app';
16
16
  /** The 3 shipped skill names (agent/skills/basalt-{name}/SKILL.md, placed into a consumer's
17
17
  * .claude/skills/ by `basalt-ui init`/`sync` — the same managed path the rules take).
18
18
  *
@@ -73,6 +73,14 @@ type BaseSurface = {
73
73
  readonly shipped: readonly string[];
74
74
  readonly repo: readonly string[];
75
75
  };
76
+ /**
77
+ * Optional peer package names this surface depends on (e.g. '@tanstack/react-query').
78
+ * Single source of truth — read by gen-llms.ts and cli/index.ts; versions resolved from package.json.
79
+ *
80
+ * Lives on the base, not the doctrine triad: an optional peer is a PACKAGING fact, so a tooling
81
+ * surface can carry one too (`./vite` → `vite-plugin-pwa`).
82
+ */
83
+ readonly optionalPeers?: readonly string[];
76
84
  };
77
85
  /**
78
86
  * A doctrine surface owes the full triad (rule + skill[] + guardKinds[]).
@@ -89,11 +97,6 @@ export type DoctrineSpec = BaseSurface & {
89
97
  readonly skill: readonly SkillName[];
90
98
  /** Required, but [] is legal for advisory surfaces (router/query: rule only, no guard). */
91
99
  readonly guardKinds: readonly GuardKind[];
92
- /**
93
- * Optional peer package names this surface depends on (e.g. '@tanstack/react-query').
94
- * Single source of truth — read by gen-llms.ts and cli/index.ts; versions resolved from package.json.
95
- */
96
- readonly optionalPeers?: readonly string[];
97
100
  };
98
101
  /**
99
102
  * A tooling surface owes NO triad — these fields are statically ABSENT (cannot be set).
@@ -166,13 +169,14 @@ export declare const SURFACES: {
166
169
  readonly './theme-lab': {
167
170
  readonly kind: "tooling";
168
171
  readonly layer: "mantine-coupled";
169
- readonly description: "ThemeLabControls, applyOverrides, COLOR_GROUPS for live theme inspection";
172
+ readonly description: "ThemeLabControls, applyOverrides, COLOR_GROUPS — a low-level inspector for the non-derived structural tokens; identity/color tuning lives in DeriveControls";
170
173
  readonly forbiddenImports: readonly [];
171
174
  };
172
175
  readonly './vite': {
173
176
  readonly kind: "tooling";
174
177
  readonly layer: "mantine-coupled";
175
- readonly description: "basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps";
178
+ readonly description: "basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps; basaltAppPlugin(opts) — PWA head, manifest, and icon metadata derived from the token palette";
179
+ readonly optionalPeers: readonly ["vite-plugin-pwa"];
176
180
  readonly forbiddenImports: readonly [];
177
181
  };
178
182
  readonly './guard': {
@@ -327,6 +331,12 @@ export declare const SURFACES: {
327
331
  readonly description: "Mandatory CSS import (after the Mantine styles.layer.css bundles) — @layer basalt base styles, iOS input safety net, font stack";
328
332
  readonly forbiddenImports: readonly [];
329
333
  };
334
+ readonly './tokens.css': {
335
+ readonly kind: "tooling";
336
+ readonly layer: "non-js-asset";
337
+ readonly description: "Prebuilt --vx-* token stylesheet — the default buildPaletteCss() output as a plain file, for a consumer with no bundler, no React and no Mantine; retune the selector or trim the spacing set with `basalt-ui tokens:css`";
338
+ readonly forbiddenImports: readonly [];
339
+ };
330
340
  readonly './configs/*': {
331
341
  readonly kind: "tooling";
332
342
  readonly layer: "non-js-asset";
@@ -342,7 +352,7 @@ export declare const SURFACES: {
342
352
  readonly '#app': {
343
353
  readonly kind: "doctrine";
344
354
  readonly layer: "app-global";
345
- readonly rule: "mantine";
355
+ readonly rule: "app";
346
356
  readonly skill: readonly ["basalt-app"];
347
357
  readonly guardKinds: readonly [];
348
358
  readonly globs: {
@@ -359,7 +369,7 @@ export declare const SURFACES: {
359
369
  };
360
370
  /**
361
371
  * Derived, deduped set of doctrine rule names. Projection 1 of SURFACES.
362
- * → ['mantine', 'charts', 'tokens', 'query', 'router', 'forms', 'notifications', 'commands', 'data', 'agent', 'content', 'state'] (order is insertion order of Set)
372
+ * → ['mantine', 'charts', 'tokens', 'query', 'router', 'forms', 'notifications', 'commands', 'data', 'agent', 'content', 'state', 'app'] (order is insertion order of Set)
363
373
  *
364
374
  * @example
365
375
  * RULE_NAMES.includes('tokens') // true
@@ -1 +1 @@
1
- {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../src/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,eAAe,GACf,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,CAAA;AAEb;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,eAAe,GAAG,eAAe,CAAA;AAExE;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,iBAAiB,GAAG,UAAU,GAAG,YAAY,GAAG,cAAc,CAAA;AAElF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,wFAAwF;IACxF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;IAChC,oFAAoF;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAA;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAA;CACzB,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;CACrC,CAAA;AAID,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,KAAK,EAA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AA;CAC1C,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAC5B,CAAA;AAED,kEAAkE;AAClE,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,WAAW,CAAA;AA8BpD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2S2B,CAAA;AAIhD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,qBAMiB,CAAA;AAIxC;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,sBAMiB,CAAA;AAIzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,6BAA6B,EAAE,WAAW,CAAC,MAAM,CAAqC,CAAA;AAEnG;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACzC,OAAO,CAET"}
package/dist/surfaces.js CHANGED
@@ -64,13 +64,14 @@ const SURFACES = {
64
64
  "./theme-lab": {
65
65
  kind: "tooling",
66
66
  layer: "mantine-coupled",
67
- description: "ThemeLabControls, applyOverrides, COLOR_GROUPS for live theme inspection",
67
+ description: "ThemeLabControls, applyOverrides, COLOR_GROUPS \u2014 a low-level inspector for the non-derived structural tokens; identity/color tuning lives in DeriveControls",
68
68
  forbiddenImports: []
69
69
  },
70
70
  "./vite": {
71
71
  kind: "tooling",
72
72
  layer: "mantine-coupled",
73
- description: "basaltViteConfig(opts) \u2014 Vite preset for basalt-ui consumer apps",
73
+ description: "basaltViteConfig(opts) \u2014 Vite preset for basalt-ui consumer apps; basaltAppPlugin(opts) \u2014 PWA head, manifest, and icon metadata derived from the token palette",
74
+ optionalPeers: ["vite-plugin-pwa"],
74
75
  forbiddenImports: []
75
76
  },
76
77
  "./guard": {
@@ -243,6 +244,12 @@ const SURFACES = {
243
244
  description: "Mandatory CSS import (after the Mantine styles.layer.css bundles) \u2014 @layer basalt base styles, iOS input safety net, font stack",
244
245
  forbiddenImports: []
245
246
  },
247
+ "./tokens.css": {
248
+ kind: "tooling",
249
+ layer: "non-js-asset",
250
+ description: "Prebuilt --vx-* token stylesheet \u2014 the default buildPaletteCss() output as a plain file, for a consumer with no bundler, no React and no Mantine; retune the selector or trim the spacing set with `basalt-ui tokens:css`",
251
+ forbiddenImports: []
252
+ },
246
253
  "./configs/*": {
247
254
  kind: "tooling",
248
255
  layer: "non-js-asset",
@@ -260,7 +267,7 @@ const SURFACES = {
260
267
  // synthetic global app-wide ban layer — the src/**+app/** glob
261
268
  kind: "doctrine",
262
269
  layer: "app-global",
263
- rule: "mantine",
270
+ rule: "app",
264
271
  skill: ["basalt-app"],
265
272
  guardKinds: [],
266
273
  globs: {
@@ -45,7 +45,7 @@ html[data-mantine-color-scheme] .inputWrapper[data-variant='default']:not([data-
45
45
  * which keep their Mantine semantics and take the focus ring alone.
46
46
  */
47
47
  .input {
48
- --field-depth: 0 0 #0000;
48
+ --field-depth: 0 0 transparent;
49
49
 
50
50
  box-shadow: var(--field-depth);
51
51
  }
@@ -14,7 +14,7 @@
14
14
  */
15
15
  .closeButton {
16
16
  color: var(--vx-faint) !important;
17
- border-radius: 6px !important;
17
+ border-radius: var(--vx-radius-ctrl) !important;
18
18
  }
19
19
 
20
20
  .closeButton:hover {
@@ -1,22 +1,127 @@
1
1
  import type { CSSVariablesResolver, MantineThemeOverride } from '@mantine/core';
2
+ import type { RadiusValues, SpaceValues } from '../tokens/palette.js';
3
+ import type { DeriveConfig } from '../tokens/derive.js';
4
+ import type { BasaltFontsConfig } from '../tokens/index.js';
2
5
  /**
3
- * Basalt base theme — Mantine `createTheme` bound to the Basalt zinc palette.
4
- *
5
- * Inputs keep `size: 'md'` for GEOMETRY (42px height, padding), while their FONT-SIZE is floored
6
- * at 16px by the `styles.css` rule — Safari zooms the viewport when a focused input computes below
7
- * 16px. Splitting the two is deliberate: pinning `size: 'lg'` to reach a 16px font would drag a
8
- * 50px input height along with it. The floor is `max(16px, …)`, so it never clamps a deliberately
9
- * LARGER input down, and — being a CSS floor on the element rather than a per-component
10
- * `defaultProps` — it covers every input Mantine ships (Autocomplete, MultiSelect, TagsInput,
11
- * PinInput, …) plus any consumer that passes an explicit `size="xs"`. Enumerating components in
12
- * `defaultProps` could never do that; the previous attempt missed seven of them.
6
+ * The `fonts` option's resolved shape — defined in `basalt-ui/tokens` (`BasaltFontsConfig`,
7
+ * paired with its pure builder `buildFontsCss` there); re-exported here since
8
+ * `CreateBasaltThemeOptions.fonts` below is its primary production entry point. See
9
+ * {@link CreateBasaltThemeOptions.fonts}.
13
10
  */
11
+ export type { BasaltFontsConfig } from '../tokens/index.js';
12
+ export { useBasaltSpacing } from './use-basalt-spacing.js';
13
+ declare module '@mantine/core' {
14
+ interface MantineThemeOther {
15
+ basaltDerive?: DeriveConfig;
16
+ basaltFonts?: BasaltFontsConfig;
17
+ basaltRadius?: RadiusValues;
18
+ basaltDensity?: SpaceValues;
19
+ }
20
+ }
21
+ /** The static, shipped-identity theme — `buildTheme` evaluated once at
22
+ * `DEFAULT_DERIVE_CONFIG` (memoized by `buildPaletteData`), not per import. */
14
23
  export declare const baseTheme: MantineThemeOverride;
24
+ /** The static, shipped-identity resolver — `buildCssVariablesResolver` evaluated once at
25
+ * `DEFAULT_DERIVE_CONFIG`. Unchanged call signature (`cssVariablesResolver(theme)`), so it drops
26
+ * straight into `<MantineProvider cssVariablesResolver={cssVariablesResolver}>` as before. */
15
27
  export declare const cssVariablesResolver: CSSVariablesResolver;
28
+ /** Options for {@link createBasaltTheme}'s derive-config path. */
29
+ export type CreateBasaltThemeOptions = {
30
+ /**
31
+ * Retune the shipped palette identity from the six-knob derive engine (`basalt-ui/tokens`'s
32
+ * `DeriveConfig`) instead of the shipped `#0077bd` zinc default. Omitted knobs fall back to
33
+ * {@link DEFAULT_DERIVE_CONFIG}'s value for that knob (`resolveDeriveConfig`).
34
+ *
35
+ * This is the ONE place a consumer sets the palette identity — everything else follows: the
36
+ * Mantine color ramps, the on-color contrast measurements, and the CSS-variables resolver
37
+ * fallbacks are all rebuilt from the SAME resolved config, and the config itself is stashed on
38
+ * `theme.other.basaltDerive` so `BasaltProvider` can inject the matching `--vx-*` stylesheet
39
+ * automatically. For live DEV-time tuning instead of a fixed production identity, see
40
+ * `DeriveControls` (`basalt-ui/theme-lab`).
41
+ */
42
+ derive?: Partial<DeriveConfig>;
43
+ /**
44
+ * Retune the three-font system (`docs/DESIGN-SPEC.md` §3: Nunito Sans body / Hubot Sans
45
+ * condensed headings / JetBrains Mono numerals + micro-labels) instead of the shipped stacks.
46
+ * THIS is the font entry point — a consumer must not set `fontFamily` literals in component code
47
+ * (enforced by the `raw-font-family` guard kind, `./guard`); overriding Mantine's `fontFamily` via
48
+ * `overrides` is unnecessary because the theme already reads `--basalt-font-sans/head/mono`.
49
+ *
50
+ * Each value is a FULL CSS font-family stack string (bring your own fallback chain) —
51
+ * an omitted key keeps the shipped `styles.css` fallback untouched. The resolved value is
52
+ * stashed on `theme.other.basaltFonts` so `BasaltProvider` can inject the matching
53
+ * `--basalt-font-*` declarations — it rides the SAME `<style>` injection as the palette CSS, so
54
+ * `injectPalette={false}` (SSR/head injection) also opts fonts out; a consumer taking over
55
+ * injection must then emit those declarations itself.
56
+ *
57
+ * @example
58
+ * createBasaltTheme(undefined, { fonts: { sans: 'Inter, sans-serif' } })
59
+ */
60
+ fonts?: BasaltFontsConfig;
61
+ /**
62
+ * Retune the two radius anchors (`card`/`ctrl`, `docs/DESIGN-SPEC.md` §4) and their dependent
63
+ * offsets from a single integer level in `[-5, 5]` (default `0` = the shipped identity: card 7,
64
+ * ctrl 6) — see `deriveRadius` (`basalt-ui/tokens`) for the exact law. Rebuilds every
65
+ * radius-anchored `defaultProps`/`styles` number in the Mantine theme AND the `radius` size-scale
66
+ * from the level's values. The resolved {@link RadiusValues} is stashed on
67
+ * `theme.other.basaltRadius` (only when non-default) so `BasaltProvider` can emit the matching
68
+ * `--vx-radius-*` override declarations — it rides the SAME `<style>` injection as the palette
69
+ * CSS, so `injectPalette={false}` also opts the radius override out.
70
+ *
71
+ * For live DEV-time tuning instead of a fixed production identity, see the "Radius" slider on
72
+ * `DeriveControls` (`basalt-ui/theme-lab`) — that dev-tool path can only move the CSS vars, not
73
+ * the defaultProps numbers baked into the theme object; this option covers both.
74
+ *
75
+ * @example
76
+ * createBasaltTheme(undefined, { radius: 2 })
77
+ */
78
+ radius?: number;
79
+ /**
80
+ * Retune spacing DENSITY from a single integer level in `[-3, 3]` (default `0` = the shipped
81
+ * identity) — narrower than `radius`'s `[-5, 5]` on purpose (see `deriveSpacing`'s JSDoc,
82
+ * `basalt-ui/tokens`, for why: the same `0.7..1.30` multiplier envelope at fewer, more meaningful
83
+ * notches). The law: a multiplier, `1 + 0.1 * level`, applied to every density-tracking anchor/
84
+ * scale-stop/one-off (rounded, floored at 1), plus an independent additive law for the NavLink row
85
+ * line-height. Rebuilds every
86
+ * density-anchored `defaultProps`/`styles` number in the Mantine theme (Timeline's `bulletSize`,
87
+ * Progress's `size`) AND the `spacing` size-scale from the level's values. The resolved
88
+ * {@link SpaceValues} is stashed on `theme.other.basaltDensity` (only when non-default) so
89
+ * `BasaltProvider` can emit the matching `--vx-space-*` override declarations — it rides the SAME
90
+ * `<style>` injection as the palette CSS, so `injectPalette={false}` also opts the density
91
+ * override out.
92
+ *
93
+ * For live DEV-time tuning instead of a fixed production identity, see the "Density" slider on
94
+ * `DeriveControls` (`basalt-ui/theme-lab`) — that dev-tool path can only move the CSS vars, not
95
+ * the defaultProps numbers baked into the theme object; this option covers both.
96
+ *
97
+ * @example
98
+ * createBasaltTheme(undefined, { density: -2 })
99
+ */
100
+ density?: number;
101
+ };
16
102
  /**
17
103
  * Build the Basalt theme, optionally merged with consumer overrides. Overrides win on conflict
18
104
  * (Mantine `mergeThemeOverrides` is last-wins), so a consumer can retune any field without
19
105
  * forking the base.
106
+ *
107
+ * Pass `{ derive }` to retune the palette identity instead of the shipped default, `{ fonts }` to
108
+ * retune the three-font system, `{ radius }` to retune the two radius anchors, and/or `{ density }`
109
+ * to retune spacing density (see {@link CreateBasaltThemeOptions}); the default (no `options`, or
110
+ * `derive`/`radius`/`density` that resolve back to nothing non-default and a `fonts` that sets no
111
+ * slot — an omitted, empty, or all-`undefined`-keys object) stays on the pre-baked static
112
+ * `baseTheme` — zero extra derivation work, byte-identical to the shipped identity.
113
+ *
114
+ * Call this at MODULE scope, not inline in a component's render — the non-default `{ derive }` /
115
+ * `{ fonts }` / `{ radius }` / `{ density }` paths build a fresh `MantineThemeOverride` object on
116
+ * every call (`mergeThemeOverrides(...)`), so calling it per-render would hand `MantineProvider` a
117
+ * new `theme` reference every render and churn Mantine's theme context (and every consumer
118
+ * subscribed to it) for no reason.
119
+ *
120
+ * `overrides.other` deep-merges onto the derive-produced `other` (Mantine's `mergeThemeOverrides` /
121
+ * `deepMerge` recurse into plain-object values rather than replacing them wholesale), so passing
122
+ * `{ other: { myFlag: true } }` alongside a non-default `derive`/`fonts`/`radius`/`density` still
123
+ * leaves `other.basaltDerive`/`other.basaltFonts`/`other.basaltRadius`/`other.basaltDensity` intact
124
+ * — it is only lost if a consumer's own `overrides.other` explicitly sets that same key.
20
125
  */
21
- export declare function createBasaltTheme(overrides?: MantineThemeOverride): MantineThemeOverride;
126
+ export declare function createBasaltTheme(overrides?: MantineThemeOverride, options?: CreateBasaltThemeOptions): MantineThemeOverride;
22
127
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EACV,oBAAoB,EAGpB,oBAAoB,EAErB,MAAM,eAAe,CAAA;AA0NtB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,EAAE,oBAsftB,CAAA;AAsEF,eAAO,MAAM,oBAAoB,EAAE,oBAoDjC,CAAA;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,CAExF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EACV,oBAAoB,EAGpB,oBAAoB,EAErB,MAAM,eAAe,CAAA;AAStB,OAAO,KAAK,EAAe,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAOlD;;;;;GAKG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAIlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AASvD,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,iBAAiB;QACzB,YAAY,CAAC,EAAE,YAAY,CAAA;QAC3B,WAAW,CAAC,EAAE,iBAAiB,CAAA;QAC/B,YAAY,CAAC,EAAE,YAAY,CAAA;QAC3B,aAAa,CAAC,EAAE,WAAW,CAAA;KAC5B;CACF;AAm3BD;+EAC+E;AAC/E,eAAO,MAAM,SAAS,EAAE,oBAAuD,CAAA;AAmJ/E;;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