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
package/dist/vite.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { resolve } from "node:path";
2
2
  import { searchForWorkspaceRoot } from "vite";
3
+ import { SURFACE } from "./tokens/palette.js";
4
+ import { resolveColorMix } from "./vite-color-mix.js";
3
5
  function basaltViteConfig(opts) {
4
6
  const { port, host, allowedHosts, apiTarget, version = "0.0.0" } = opts;
5
7
  const basaltSrc = opts.basaltSrc ?? process.env["BASALT_LOCAL"];
@@ -63,6 +65,316 @@ function basaltViteConfig(opts) {
63
65
  }
64
66
  return config;
65
67
  }
68
+ const ICON_FILES = {
69
+ favicon: "favicon.ico",
70
+ svg: "favicon.svg",
71
+ png96: "favicon-96x96.png",
72
+ appleTouch: "apple-touch-icon.png",
73
+ manifest192: "web-app-manifest-192x192.png",
74
+ manifest512: "web-app-manifest-512x512.png"
75
+ };
76
+ const DEFAULT_SERVICE_WORKER_OPTIONS = {
77
+ registerType: "autoUpdate",
78
+ injectRegister: "auto",
79
+ // We emit our own manifest (theme-color-resolved, site.webmanifest) — never let VitePWA emit one.
80
+ manifest: false,
81
+ workbox: {
82
+ globPatterns: ["**/*.{js,css,html,svg,png,ico,woff2}"],
83
+ navigateFallback: "/index.html",
84
+ navigateFallbackDenylist: [/^\/api/],
85
+ cleanupOutdatedCaches: true,
86
+ clientsClaim: true,
87
+ maximumFileSizeToCacheInBytes: 3 * 1024 * 1024
88
+ },
89
+ devOptions: { enabled: false }
90
+ };
91
+ function isPlainObject(value) {
92
+ return typeof value === "object" && value !== null && !Array.isArray(value);
93
+ }
94
+ function deepMerge(base, overrides) {
95
+ const result = { ...base };
96
+ for (const [key, value] of Object.entries(overrides)) {
97
+ const baseValue = result[key];
98
+ result[key] = isPlainObject(baseValue) && isPlainObject(value) ? deepMerge(baseValue, value) : value;
99
+ }
100
+ return result;
101
+ }
102
+ function resolveThemeColors(themeColor) {
103
+ if (themeColor === void 0 || themeColor === "auto") {
104
+ return { light: resolveColorMix(SURFACE.bg.light), dark: resolveColorMix(SURFACE.bg.dark) };
105
+ }
106
+ return themeColor;
107
+ }
108
+ function withIconPath(dir, file) {
109
+ if (!dir) return `/${file}`;
110
+ const trimmed = dir.replace(/^\/+|\/+$/g, "");
111
+ return trimmed ? `/${trimmed}/${file}` : `/${file}`;
112
+ }
113
+ function withBase(base, path) {
114
+ return base + path.slice(1);
115
+ }
116
+ function hasViewportMeta(html) {
117
+ return /<meta\s+[^>]*name=["']viewport["']/i.test(html);
118
+ }
119
+ const VIEWPORT_TAG = {
120
+ tag: "meta",
121
+ attrs: { name: "viewport", content: "width=device-width, initial-scale=1.0, viewport-fit=cover" }
122
+ };
123
+ function buildSeoTags(input) {
124
+ const { name, description, seo } = input;
125
+ const tags = [];
126
+ if (description) {
127
+ tags.push({ tag: "meta", attrs: { name: "description", content: description } });
128
+ }
129
+ if (description || seo?.url || seo?.image) {
130
+ if (seo?.url) {
131
+ tags.push(
132
+ { tag: "link", attrs: { rel: "canonical", href: seo.url } },
133
+ { tag: "meta", attrs: { property: "og:url", content: seo.url } }
134
+ );
135
+ }
136
+ tags.push(
137
+ { tag: "meta", attrs: { property: "og:type", content: "website" } },
138
+ { tag: "meta", attrs: { property: "og:title", content: name } }
139
+ );
140
+ if (description) {
141
+ tags.push({ tag: "meta", attrs: { property: "og:description", content: description } });
142
+ }
143
+ if (seo?.image) {
144
+ tags.push({ tag: "meta", attrs: { property: "og:image", content: seo.image } });
145
+ }
146
+ }
147
+ if (seo?.twitterCard) {
148
+ tags.push(
149
+ { tag: "meta", attrs: { name: "twitter:card", content: seo.twitterCard } },
150
+ { tag: "meta", attrs: { name: "twitter:title", content: name } }
151
+ );
152
+ if (description) {
153
+ tags.push({ tag: "meta", attrs: { name: "twitter:description", content: description } });
154
+ }
155
+ if (seo?.image) {
156
+ tags.push({ tag: "meta", attrs: { name: "twitter:image", content: seo.image } });
157
+ }
158
+ }
159
+ return tags;
160
+ }
161
+ function buildStaticTags(input) {
162
+ const {
163
+ options,
164
+ shortName,
165
+ themeColor,
166
+ backgroundColor,
167
+ iconsEnabled,
168
+ iconsDir,
169
+ darkreader,
170
+ manifestEnabled,
171
+ base,
172
+ manifestHref
173
+ } = input;
174
+ const tags = [];
175
+ tags.push(
176
+ {
177
+ tag: "meta",
178
+ attrs: {
179
+ name: "theme-color",
180
+ media: "(prefers-color-scheme: light)",
181
+ content: themeColor.light
182
+ }
183
+ },
184
+ {
185
+ tag: "meta",
186
+ attrs: {
187
+ name: "theme-color",
188
+ media: "(prefers-color-scheme: dark)",
189
+ content: themeColor.dark
190
+ }
191
+ }
192
+ );
193
+ tags.push({
194
+ tag: "style",
195
+ children: `html{background-color:${backgroundColor};color-scheme:dark}`
196
+ });
197
+ if (iconsEnabled) {
198
+ tags.push(
199
+ {
200
+ tag: "link",
201
+ attrs: {
202
+ rel: "shortcut icon",
203
+ href: withBase(base, withIconPath(iconsDir, ICON_FILES.favicon))
204
+ }
205
+ },
206
+ {
207
+ tag: "link",
208
+ attrs: {
209
+ rel: "icon",
210
+ type: "image/svg+xml",
211
+ href: withBase(base, withIconPath(iconsDir, ICON_FILES.svg))
212
+ }
213
+ },
214
+ {
215
+ tag: "link",
216
+ attrs: {
217
+ rel: "icon",
218
+ sizes: "96x96",
219
+ href: withBase(base, withIconPath(iconsDir, ICON_FILES.png96))
220
+ }
221
+ },
222
+ {
223
+ tag: "link",
224
+ attrs: {
225
+ rel: "apple-touch-icon",
226
+ sizes: "180x180",
227
+ href: withBase(base, withIconPath(iconsDir, ICON_FILES.appleTouch))
228
+ }
229
+ }
230
+ );
231
+ }
232
+ tags.push(
233
+ { tag: "meta", attrs: { name: "apple-mobile-web-app-title", content: shortName } },
234
+ { tag: "meta", attrs: { name: "apple-mobile-web-app-capable", content: "yes" } },
235
+ { tag: "meta", attrs: { name: "mobile-web-app-capable", content: "yes" } },
236
+ { tag: "meta", attrs: { name: "apple-mobile-web-app-status-bar-style", content: "default" } }
237
+ );
238
+ if (darkreader === "lock") {
239
+ tags.push({ tag: "meta", attrs: { name: "darkreader-lock" } });
240
+ }
241
+ if (manifestEnabled) {
242
+ tags.push({ tag: "link", attrs: { rel: "manifest", href: manifestHref } });
243
+ }
244
+ tags.push(
245
+ ...buildSeoTags({ name: options.name, description: options.description, seo: options.seo })
246
+ );
247
+ return tags;
248
+ }
249
+ function buildManifestJson(input) {
250
+ const {
251
+ options,
252
+ shortName,
253
+ startUrl,
254
+ scope,
255
+ id,
256
+ display,
257
+ themeColor,
258
+ backgroundColor,
259
+ iconsDir,
260
+ base
261
+ } = input;
262
+ const manifest = {
263
+ id,
264
+ name: options.name,
265
+ short_name: shortName,
266
+ ...options.description ? { description: options.description } : {},
267
+ start_url: startUrl,
268
+ scope,
269
+ display,
270
+ theme_color: themeColor.dark,
271
+ background_color: backgroundColor,
272
+ icons: [
273
+ {
274
+ src: withBase(base, withIconPath(iconsDir, ICON_FILES.manifest192)),
275
+ sizes: "192x192",
276
+ type: "image/png"
277
+ },
278
+ {
279
+ src: withBase(base, withIconPath(iconsDir, ICON_FILES.manifest512)),
280
+ sizes: "512x512",
281
+ type: "image/png",
282
+ purpose: "any maskable"
283
+ }
284
+ ]
285
+ };
286
+ return JSON.stringify(manifest, null, 2);
287
+ }
288
+ function createMainPlugin(options) {
289
+ const shortName = options.shortName ?? options.name;
290
+ const display = options.display ?? "standalone";
291
+ const darkreader = options.darkreader ?? "lock";
292
+ const iconsEnabled = options.icons !== false;
293
+ const iconsDir = options.icons === false ? void 0 : options.icons?.dir;
294
+ const manifestEnabled = options.manifest !== false;
295
+ const themeColor = resolveThemeColors(options.themeColor);
296
+ const backgroundColor = options.backgroundColor ?? themeColor.dark;
297
+ let manifestJson = "";
298
+ let manifestHref = "/site.webmanifest";
299
+ let staticTags = [];
300
+ return {
301
+ name: "basalt:app",
302
+ configResolved(config) {
303
+ const base = config.base;
304
+ const startUrl = options.startUrl ?? base;
305
+ const scope = options.scope ?? base;
306
+ const id = options.id ?? startUrl;
307
+ manifestHref = withBase(base, "/site.webmanifest");
308
+ manifestJson = buildManifestJson({
309
+ options,
310
+ shortName,
311
+ startUrl,
312
+ scope,
313
+ id,
314
+ display,
315
+ themeColor,
316
+ backgroundColor,
317
+ iconsDir,
318
+ base
319
+ });
320
+ staticTags = buildStaticTags({
321
+ options,
322
+ shortName,
323
+ themeColor,
324
+ backgroundColor,
325
+ iconsEnabled,
326
+ iconsDir,
327
+ darkreader,
328
+ manifestEnabled,
329
+ base,
330
+ manifestHref
331
+ });
332
+ },
333
+ transformIndexHtml(html) {
334
+ const tags = hasViewportMeta(html) ? staticTags : [VIEWPORT_TAG, ...staticTags];
335
+ return { html, tags };
336
+ },
337
+ generateBundle() {
338
+ if (!manifestEnabled) return;
339
+ this.emitFile({ type: "asset", fileName: "site.webmanifest", source: manifestJson });
340
+ },
341
+ configureServer(server) {
342
+ if (!manifestEnabled) return;
343
+ server.middlewares.use((req, res, next) => {
344
+ if (req.url === manifestHref || req.url === "/site.webmanifest") {
345
+ res.setHeader("Content-Type", "application/manifest+json");
346
+ res.end(manifestJson);
347
+ return;
348
+ }
349
+ next();
350
+ });
351
+ }
352
+ };
353
+ }
354
+ function createServiceWorkerPlugin(serviceWorker) {
355
+ return (async () => {
356
+ let mod;
357
+ try {
358
+ mod = await import("vite-plugin-pwa");
359
+ } catch {
360
+ console.warn(
361
+ '[basalt-ui] serviceWorker was requested but the optional peer "vite-plugin-pwa" (plus its own peers workbox-build, workbox-window) is not installed \u2014 skipping the service worker. Install with: bun add -D vite-plugin-pwa workbox-build workbox-window'
362
+ );
363
+ return false;
364
+ }
365
+ const overrides = typeof serviceWorker === "object" ? serviceWorker : {};
366
+ const pwaOptions = deepMerge(DEFAULT_SERVICE_WORKER_OPTIONS, overrides);
367
+ return mod.VitePWA(pwaOptions);
368
+ })();
369
+ }
370
+ function basaltAppPlugin(options) {
371
+ const plugins = [createMainPlugin(options)];
372
+ if (options.serviceWorker) {
373
+ plugins.push(createServiceWorkerPlugin(options.serviceWorker));
374
+ }
375
+ return plugins;
376
+ }
66
377
  export {
378
+ basaltAppPlugin,
67
379
  basaltViteConfig
68
380
  };
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # basalt-ui v1.1.1
1
+ # basalt-ui v1.3.0
2
2
  # Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets
3
3
  #
4
4
  # basalt-ui is an opinionated framework for Mantine-based React apps.
@@ -13,9 +13,13 @@
13
13
  # Subpaths: use the exact import specifier below — do not guess.
14
14
  # Charts and tokens are Mantine-free; the root (.) is Mantine-coupled.
15
15
  # Optional peers are listed per subpath; install only what you use.
16
+ # Every peer is optional: ./tokens, ./charts, ./state and ./guard resolve with
17
+ # no React and no Mantine installed. A consumer with no React at all can take the
18
+ # token system alone — `bunx basalt-ui tokens:css --out tokens.css`, or the prebuilt
19
+ # ./tokens.css subpath. Guide: docs/FRAMEWORK-FREE.md in the repo.
16
20
 
17
21
  Package: basalt-ui
18
- Version: 1.1.1
22
+ Version: 1.3.0
19
23
 
20
24
  ## basalt-ui
21
25
  Import: import { ... } from 'basalt-ui'
@@ -38,13 +42,14 @@ Rule: basalt-tokens
38
42
 
39
43
  ## basalt-ui/theme-lab
40
44
  Import: import { ... } from 'basalt-ui/theme-lab'
41
- Description: ThemeLabControls, applyOverrides, COLOR_GROUPS for live theme inspection
45
+ Description: ThemeLabControls, applyOverrides, COLOR_GROUPS — a low-level inspector for the non-derived structural tokens; identity/color tuning lives in DeriveControls
42
46
  Layer: mantine-coupled
43
47
 
44
48
  ## basalt-ui/vite
45
49
  Import: import { ... } from 'basalt-ui/vite'
46
- Description: basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps
50
+ Description: basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps; basaltAppPlugin(opts) — PWA head, manifest, and icon metadata derived from the token palette
47
51
  Layer: mantine-coupled
52
+ OptionalPeers: vite-plugin-pwa@^1.3.0
48
53
 
49
54
  ## basalt-ui/guard
50
55
  Import: import { ... } from 'basalt-ui/guard'
@@ -138,6 +143,11 @@ Asset: basalt-ui/styles.css
138
143
  Description: Mandatory CSS import (after the Mantine styles.layer.css bundles) — @layer basalt base styles, iOS input safety net, font stack
139
144
  Layer: non-js-asset
140
145
 
146
+ ## basalt-ui/tokens.css
147
+ Asset: basalt-ui/tokens.css
148
+ 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`
149
+ Layer: non-js-asset
150
+
141
151
  ## basalt-ui/configs/*
142
152
  Asset: basalt-ui/configs/*
143
153
  Description: Raw toolchain presets for consumer extends: oxlint.json, oxfmt.json, tsconfig.*.json, lefthook.yml, check.yml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basalt-ui",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "description": "Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets",
5
5
  "keywords": [
6
6
  "charts",
@@ -117,6 +117,7 @@
117
117
  "import": "./dist/connectivity/index.js"
118
118
  },
119
119
  "./styles.css": "./dist/styles.css",
120
+ "./tokens.css": "./dist/tokens.css",
120
121
  "./configs/*": "./configs/*",
121
122
  "./llms.txt": "./llms.txt"
122
123
  },
@@ -125,7 +126,7 @@
125
126
  "provenance": true
126
127
  },
127
128
  "scripts": {
128
- "build": "tsup && tsc --emitDeclarationOnly --declarationMap && bun scripts/copy-assets.mjs && bun scripts/fix-esm-extensions.mjs",
129
+ "build": "tsup && tsc --emitDeclarationOnly --declarationMap && bun scripts/copy-assets.mjs && bun scripts/gen-tokens-css.mjs && bun scripts/fix-esm-extensions.mjs",
129
130
  "typecheck": "tsc --noEmit",
130
131
  "pack-test": "bash scripts/pack-test.sh",
131
132
  "prepack": "bun run build",
@@ -165,7 +166,8 @@
165
166
  "tsup": "^8.5.1",
166
167
  "typescript": "^6.0.3",
167
168
  "use-stick-to-bottom": "^1.1.6",
168
- "vite": "^8.0.16"
169
+ "vite": "^8.0.16",
170
+ "vite-plugin-pwa": "^1.3.0"
169
171
  },
170
172
  "peerDependencies": {
171
173
  "@mantine/core": "^9.3.0",
@@ -190,12 +192,19 @@
190
192
  "remark-gfm": "^4.0.1",
191
193
  "shiki": "^4.3.0",
192
194
  "use-stick-to-bottom": "^1.1.6",
193
- "vite": "^7 || ^8"
195
+ "vite": "^7 || ^8",
196
+ "vite-plugin-pwa": "^1.3.0"
194
197
  },
195
198
  "peerDependenciesMeta": {
199
+ "@mantine/core": {
200
+ "optional": true
201
+ },
196
202
  "@mantine/form": {
197
203
  "optional": true
198
204
  },
205
+ "@mantine/hooks": {
206
+ "optional": true
207
+ },
199
208
  "@shikijs/langs": {
200
209
  "optional": true
201
210
  },
@@ -214,6 +223,9 @@
214
223
  "@mantine/spotlight": {
215
224
  "optional": true
216
225
  },
226
+ "@tanstack/react-query": {
227
+ "optional": true
228
+ },
217
229
  "@tanstack/react-query-devtools": {
218
230
  "optional": true
219
231
  },
@@ -232,6 +244,12 @@
232
244
  "beautiful-mermaid": {
233
245
  "optional": true
234
246
  },
247
+ "react": {
248
+ "optional": true
249
+ },
250
+ "react-dom": {
251
+ "optional": true
252
+ },
235
253
  "react-markdown": {
236
254
  "optional": true
237
255
  },
@@ -246,6 +264,9 @@
246
264
  },
247
265
  "vite": {
248
266
  "optional": true
267
+ },
268
+ "vite-plugin-pwa": {
269
+ "optional": true
249
270
  }
250
271
  },
251
272
  "basalt": {
@@ -255,15 +276,25 @@
255
276
  "exempt": [
256
277
  "src/tokens/palette.ts",
257
278
  "src/tokens/index.ts",
279
+ "src/tokens/derive.ts",
280
+ "src/tokens/hct.ts",
258
281
  "src/theme/index.ts",
259
282
  "src/guard/index.ts",
260
283
  "src/cli/index.ts"
261
284
  ],
262
- "rawSurface": false,
263
- "rawHtmlLayout": false,
264
- "inlineSpacing": false,
265
- "inlineDisplay": false,
266
- "rawRadius": false,
267
- "spacingSteps": []
285
+ "rawRadius": true,
286
+ "exemptRules": {
287
+ "inline-spacing": [
288
+ "charts"
289
+ ],
290
+ "inline-display": [
291
+ "agent",
292
+ "charts"
293
+ ],
294
+ "raw-html-layout": [
295
+ "agent",
296
+ "charts"
297
+ ]
298
+ }
268
299
  }
269
300
  }
@@ -98,14 +98,17 @@ const MICRO_LABEL_STYLE = {
98
98
 
99
99
  /** Faint left divider rail (docs/DESIGN-SPEC.md §5) — reasoning/tool-call parts read as transcript
100
100
  * asides, not surfaces. */
101
- const RAIL_STYLE = { borderLeft: `2px solid ${VX.divider}`, paddingLeft: 10 } as const
101
+ const RAIL_STYLE = {
102
+ borderLeft: `2px solid ${VX.divider}`,
103
+ paddingLeft: 'var(--vx-space-agent-rail-inset-x)',
104
+ } as const
102
105
 
103
106
  const CODE_BLOCK_STYLE = {
104
- marginTop: 6,
107
+ marginTop: 'var(--vx-space-agent-part-gap-top)',
105
108
  fontFamily: 'var(--basalt-font-mono)',
106
109
  backgroundColor: alpha(VX.ink, 0.06),
107
- borderRadius: 8,
108
- padding: 8,
110
+ borderRadius: 'var(--vx-radius-card)',
111
+ padding: 'var(--vx-space-agent-code-inset)',
109
112
  overflowX: 'auto',
110
113
  } as const
111
114
 
@@ -129,7 +132,10 @@ function DefaultReasoning({ part }: { part: ReasoningPart; index: number }): JSX
129
132
  >
130
133
  Reasoning
131
134
  </summary>
132
- <div className="basalt-agent-reasoning-body" style={{ color: VX.muted, marginTop: 6 }}>
135
+ <div
136
+ className="basalt-agent-reasoning-body"
137
+ style={{ color: VX.muted, marginTop: 'var(--vx-space-agent-part-gap-top)' }}
138
+ >
133
139
  {part.text}
134
140
  </div>
135
141
  </details>
@@ -176,8 +182,8 @@ function DefaultError({ part }: { part: ErrorPart; index: number }): JSX.Element
176
182
  style={{
177
183
  backgroundColor: alpha(VX.status.bad, 0.13),
178
184
  color: VX.status.bad,
179
- borderRadius: 8,
180
- padding: '8px 10px',
185
+ borderRadius: 'var(--vx-radius-card)',
186
+ padding: 'var(--vx-space-agent-error-inset-y) var(--vx-space-agent-error-inset-x)',
181
187
  }}
182
188
  >
183
189
  {part.message}
@@ -76,8 +76,8 @@ const LazyStickToBottom = lazy(() =>
76
76
  justifyContent: 'center',
77
77
  width: 30,
78
78
  height: 30,
79
- margin: '8px auto 0',
80
- borderRadius: 999,
79
+ margin: 'var(--vx-space-agent-scroll-button-gap-top) auto 0',
80
+ borderRadius: 'var(--vx-radius-pill)',
81
81
  border: 'none',
82
82
  cursor: 'pointer',
83
83
  backgroundColor: 'var(--vx-surface-panel)',
@@ -20,7 +20,7 @@
20
20
  * onClose={() => select(null)}
21
21
  * />
22
22
  */
23
- import { ActionIcon, Alert, Box, Button, Divider, Stack, Text } from '@mantine/core'
23
+ import { ActionIcon, Alert, Box, Button, Divider, Flex, Stack, Text } from '@mantine/core'
24
24
  import { useReducedMotion } from '@mantine/hooks'
25
25
  import { motion } from 'motion/react'
26
26
  import type { JSX } from 'react'
@@ -113,11 +113,8 @@ export function ThreadDetailPanel({
113
113
  const streaming = runStatus === 'streaming'
114
114
 
115
115
  const panel = (
116
- <Box style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
117
- <Box
118
- p="sm"
119
- style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
120
- >
116
+ <Flex direction="column" h="100%">
117
+ <Flex p="sm" align="center" justify="space-between">
121
118
  <Text
122
119
  fw={550}
123
120
  lineClamp={1}
@@ -132,11 +129,17 @@ export function ThreadDetailPanel({
132
129
  <ActionIcon variant="subtle" color="gray" onClick={onClose} aria-label="Close thread">
133
130
  <CloseGlyph />
134
131
  </ActionIcon>
135
- </Box>
132
+ </Flex>
136
133
  <Divider color="var(--vx-divider)" />
137
134
  <Box style={{ flex: 1, minHeight: 0 }}>
138
- {/* theme-allow — BasaltStickToBottom owns this scroll node (see stick-to-bottom.tsx). */}
139
- <BasaltStickToBottom style={{ height: '100%', overflowY: 'auto', padding: 16 }}>
135
+ <BasaltStickToBottom
136
+ style={{
137
+ height: '100%',
138
+ // theme-allow — BasaltStickToBottom owns this scroll node (see stick-to-bottom.tsx).
139
+ overflowY: 'auto',
140
+ padding: 'var(--vx-space-agent-transcript-inset)',
141
+ }}
142
+ >
140
143
  <ThreadTranscript
141
144
  messages={thread.messages}
142
145
  {...(liveParts !== undefined ? { liveParts } : {})}
@@ -172,7 +175,7 @@ export function ThreadDetailPanel({
172
175
  )}
173
176
  </Stack>
174
177
  </Box>
175
- </Box>
178
+ </Flex>
176
179
  )
177
180
 
178
181
  if (reduceMotion) return panel
@@ -72,14 +72,17 @@ function TextRenderer({ part }: { part: TextPart; index: number }): JSX.Element
72
72
 
73
73
  // Tool-call/reasoning parts (docs/DESIGN-SPEC.md §5): a mono micro-label header with a faint left
74
74
  // divider rail — quieter than the card idiom, since these are transcript asides, not surfaces.
75
- const RAIL_STYLE = { borderLeft: `2px solid ${VX.divider}`, paddingLeft: 10 } as const
75
+ const RAIL_STYLE = {
76
+ borderLeft: `2px solid ${VX.divider}`,
77
+ paddingLeft: 'var(--vx-space-agent-rail-inset-x)',
78
+ } as const
76
79
  const CODE_BLOCK_STYLE = {
77
80
  margin: 0,
78
- marginTop: 6,
81
+ marginTop: 'var(--vx-space-agent-part-gap-top)',
79
82
  fontFamily: 'var(--basalt-font-mono)',
80
83
  backgroundColor: alpha(VX.ink, 0.06),
81
- borderRadius: 8,
82
- padding: 8,
84
+ borderRadius: 'var(--vx-radius-card)',
85
+ padding: 'var(--vx-space-agent-code-inset)',
83
86
  whiteSpace: 'pre-wrap',
84
87
  overflowWrap: 'anywhere',
85
88
  } as const
@@ -192,7 +195,7 @@ function MessageBlock({
192
195
  return (
193
196
  <Box
194
197
  style={{
195
- padding: '10px 12px',
198
+ padding: 'var(--vx-space-agent-message-inset-y) var(--vx-space-agent-message-inset-x)',
196
199
  backgroundColor: author === 'user' ? VX.surface.subtle : VX.surface.panel,
197
200
  borderRadius: VX.radiusCard,
198
201
  boxShadow: VX.shadowCard,
@@ -107,12 +107,12 @@ function OutcomeBody({ thread }: { thread: AgentThread }): JSX.Element {
107
107
  {badge !== undefined && (
108
108
  <Badge
109
109
  size="xs"
110
- radius={6}
111
110
  styles={{
112
111
  root: {
113
112
  backgroundColor: alpha(badge.statusToken, 0.13),
114
- padding: '2px 7px',
113
+ padding: 'var(--vx-space-badge-inset-y) var(--vx-space-badge-inset-x)',
115
114
  height: 'auto',
115
+ borderRadius: 'var(--vx-radius-ctrl)',
116
116
  },
117
117
  label: {
118
118
  fontFamily: 'var(--basalt-font-mono)',
@@ -128,7 +128,7 @@ export function ThreadWorkspace({
128
128
  // A plain pane, NOT a card — the feed's own rows carry the card idiom (docs/DESIGN-SPEC.md §5),
129
129
  // so this pane stays flush with the page and the feed/detail split reads via the divider token.
130
130
  const feed = (
131
- <Box style={{ display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }}>
131
+ <Flex direction="column" h="100%" style={{ overflow: 'hidden' }}>
132
132
  <Box style={{ flex: 1, minHeight: 0 }}>
133
133
  {store.threads.length === 0 ? (
134
134
  (emptyState ?? <FeedEmptyState />)
@@ -143,7 +143,7 @@ export function ThreadWorkspace({
143
143
  {...(newThreadPlaceholder !== undefined ? { placeholder: newThreadPlaceholder } : {})}
144
144
  />
145
145
  </Box>
146
- </Box>
146
+ </Flex>
147
147
  )
148
148
 
149
149
  const detail = (
@@ -147,7 +147,7 @@ function LegendSwatch({ item, idPrefix }: { item: LegendEntry; idPrefix: string
147
147
  style={{
148
148
  width: 11,
149
149
  height: 11,
150
- borderRadius: 3,
150
+ borderRadius: 3, // theme-allow: sub-scale legend-swatch corner, below the 4px radius floor
151
151
  backgroundColor: item.color,
152
152
  opacity: item.fillOpacity ?? 0.7,
153
153
  flexShrink: 0,
@@ -192,7 +192,7 @@ function LegendChildSwatch({ item }: { item: LegendEntry }) {
192
192
  style={{
193
193
  width: 10,
194
194
  height: 10,
195
- borderRadius: 2,
195
+ borderRadius: 2, // theme-allow: sub-scale legend-swatch corner, below the 4px radius floor
196
196
  backgroundColor: item.color,
197
197
  opacity: item.fillOpacity ?? 0.7,
198
198
  flexShrink: 0,