basalt-ui 2.7.3 → 2.8.1

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 (70) hide show
  1. package/CHANGELOG.md +194 -172
  2. package/MIGRATING.md +137 -16
  3. package/agent/rules/basalt-batteries.md +1 -1
  4. package/agent/rules/basalt-controls.md +1 -1
  5. package/agent/rules/basalt-mantine.md +1 -1
  6. package/agent/skills/basalt-app/SKILL.md +7 -7
  7. package/agent/templates/AGENTS-block.md.tpl +1 -1
  8. package/dist/charts/BandStrip.d.ts +13 -0
  9. package/dist/charts/BandStrip.d.ts.map +1 -1
  10. package/dist/charts/BandStrip.js +142 -44
  11. package/dist/cli/doctor-upgrade.d.ts +16 -4
  12. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  13. package/dist/cli/doctor-upgrade.js +132 -96
  14. package/dist/cli/doctor.d.ts +2 -1
  15. package/dist/cli/doctor.d.ts.map +1 -1
  16. package/dist/cli/doctor.js +21 -13
  17. package/dist/cli/help.js +1 -1
  18. package/dist/cli/index.d.ts +18 -4
  19. package/dist/cli/index.d.ts.map +1 -1
  20. package/dist/cli/index.js +25 -24
  21. package/dist/cli/init.d.ts.map +1 -1
  22. package/dist/cli/init.js +10 -4
  23. package/dist/cli/router-wiring.d.ts +37 -0
  24. package/dist/cli/router-wiring.d.ts.map +1 -0
  25. package/dist/cli/router-wiring.js +116 -0
  26. package/dist/cli/source-text.d.ts +12 -0
  27. package/dist/cli/source-text.d.ts.map +1 -0
  28. package/dist/cli/source-text.js +46 -0
  29. package/dist/cli/sync.d.ts.map +1 -1
  30. package/dist/cli/sync.js +32 -2
  31. package/dist/content/code-block.d.ts.map +1 -1
  32. package/dist/content/code-block.js +36 -27
  33. package/dist/content/code-block.module.css +19 -1
  34. package/dist/content/mermaid-sanitize.d.ts +15 -0
  35. package/dist/content/mermaid-sanitize.d.ts.map +1 -0
  36. package/dist/content/mermaid-sanitize.js +28 -0
  37. package/dist/content/mermaid.d.ts +6 -0
  38. package/dist/content/mermaid.d.ts.map +1 -1
  39. package/dist/content/mermaid.js +3 -1
  40. package/dist/provider/index.d.ts +22 -4
  41. package/dist/provider/index.d.ts.map +1 -1
  42. package/dist/provider/index.js +24 -8
  43. package/dist/provider/test-router.d.ts +2 -1
  44. package/dist/provider/test-router.d.ts.map +1 -1
  45. package/dist/provider/test-router.js +6 -7
  46. package/dist/vite-boot.d.ts +25 -0
  47. package/dist/vite-boot.d.ts.map +1 -0
  48. package/dist/vite-boot.js +36 -0
  49. package/dist/vite.d.ts +24 -3
  50. package/dist/vite.d.ts.map +1 -1
  51. package/dist/vite.js +7 -16
  52. package/llms.txt +37 -4
  53. package/package.json +1 -1
  54. package/src/charts/BandStrip.tsx +223 -48
  55. package/src/cli/doctor-upgrade.ts +181 -141
  56. package/src/cli/doctor.ts +23 -14
  57. package/src/cli/help.ts +1 -1
  58. package/src/cli/index.ts +37 -36
  59. package/src/cli/init.ts +10 -6
  60. package/src/cli/router-wiring.ts +185 -0
  61. package/src/cli/source-text.ts +62 -0
  62. package/src/cli/sync.ts +36 -2
  63. package/src/content/code-block.module.css +19 -1
  64. package/src/content/code-block.tsx +7 -2
  65. package/src/content/mermaid-sanitize.ts +49 -0
  66. package/src/content/mermaid.tsx +3 -2
  67. package/src/provider/index.tsx +71 -18
  68. package/src/provider/test-router.tsx +9 -9
  69. package/src/vite-boot.ts +109 -0
  70. package/src/vite.ts +32 -61
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useState } from "react";
3
3
  import { CodeBlock } from "./code-block.js";
4
4
  import classes from "./mermaid.module.css";
5
+ import { sanitizeMermaidFonts } from "./mermaid-sanitize.js";
5
6
  const MERMAID_THEME_OPTIONS = {
6
7
  bg: "var(--vx-surface-panel)",
7
8
  fg: "var(--vx-ink)",
@@ -34,7 +35,7 @@ function MermaidDiagram({ code, className, style, fallback }) {
34
35
  const rendered = useMemo(() => {
35
36
  if (!mod) return null;
36
37
  try {
37
- return mod.renderMermaidSVG(code, MERMAID_THEME_OPTIONS);
38
+ return sanitizeMermaidFonts(mod.renderMermaidSVG(code, MERMAID_THEME_OPTIONS));
38
39
  } catch {
39
40
  return void 0;
40
41
  }
@@ -66,5 +67,6 @@ function MermaidDiagram({ code, className, style, fallback }) {
66
67
  );
67
68
  }
68
69
  export {
70
+ MERMAID_THEME_OPTIONS,
69
71
  MermaidDiagram
70
72
  };
@@ -6,9 +6,7 @@ import type { SizeClass } from '../shell/use-size-class.js';
6
6
  import type { Telemetry } from '../telemetry.js';
7
7
  import type { BasaltRouter } from './create-router.js';
8
8
  import type { FlatNavItem } from '../router-tanstack/nav.js';
9
- export type BasaltProviderProps = {
10
- /** From `createBasaltRouter`; the provider mounts it and reads its `queryClient`. */
11
- router: BasaltRouter;
9
+ type BasaltProviderCommonProps = {
12
10
  /** Theme override merged onto the Basalt base. Defaults to `createBasaltTheme()`. */
13
11
  theme?: MantineProviderProps['theme'];
14
12
  /**
@@ -48,7 +46,27 @@ export type BasaltProviderProps = {
48
46
  * entry with id `nav.<id>` replaces the generated one outright.
49
47
  */
50
48
  navCommandLabel?: (item: FlatNavItem) => string;
49
+ /**
50
+ * Mount Basalt's `<Spotlight>` (Cmd+K) with the generated nav + command actions. Default `true`.
51
+ * Set `false` when the app owns its own palette: neither the component nor its action wiring mounts.
52
+ */
53
+ spotlight?: boolean;
51
54
  } & Omit<MantineProviderProps, 'children' | 'theme' | 'defaultColorScheme' | 'cssVariablesResolver'>;
55
+ /**
56
+ * Two modes, never both: pass a `createBasaltRouter` `router` and the provider mounts it, or pass
57
+ * `children` and render the provider INSIDE a router the app does not own (around the `<Outlet />`
58
+ * of TanStack Start's root route component) — the router then comes from `useRouter()` and must carry
59
+ * `context.queryClient` (its `getRouter()` builds the same context `createBasaltRouter` does).
60
+ */
61
+ export type BasaltProviderProps = BasaltProviderCommonProps & ({
62
+ /** From `createBasaltRouter`; the provider mounts it and reads its `queryClient`. */
63
+ router: BasaltRouter;
64
+ children?: never;
65
+ } | {
66
+ router?: never;
67
+ /** The subtree inside the app's own router; rendered where `<RouterProvider>` would be. */
68
+ children: ReactNode;
69
+ });
52
70
  type RootBoundaryProps = {
53
71
  children: ReactNode;
54
72
  emit: Telemetry;
@@ -83,6 +101,6 @@ export declare function composeInjectedCss(base: string, fontsCss: string, radiu
83
101
  * closes the gap between hydration and the next client paint.
84
102
  */
85
103
  export declare function useHostAttribute(): void;
86
- export declare function BasaltProvider({ router, theme, telemetry, fallback, injectPalette, paletteOptions, defaultColorScheme, nonce, sizeClassHint, navCommandLabel, ...rest }: BasaltProviderProps): import("react").JSX.Element;
104
+ export declare function BasaltProvider({ theme, telemetry, fallback, injectPalette, paletteOptions, defaultColorScheme, nonce, sizeClassHint, navCommandLabel, spotlight, router: mountedRouter, children, ...rest }: BasaltProviderProps): import("react").JSX.Element;
87
105
  export {};
88
106
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AASzD,OAAO,EAAE,SAAS,EAAqE,MAAM,OAAO,CAAA;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAStD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAQxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,iBAAiB,CAAA;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGzD,MAAM,MAAM,mBAAmB,GAAG;IAChC,qFAAqF;IACrF,MAAM,EAAE,YAAY,CAAA;IACpB,qFAAqF;IACrF,KAAK,C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;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAYD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAmBvC;AAwND,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,SAAS,EACT,QAAQ,EACR,aAAoB,EACpB,cAAc,EACd,kBAA2B,EAC3B,KAAK,EACL,aAAyB,EACzB,eAAe,EACf,SAAgB,EAChB,MAAM,EAAE,aAAa,EACrB,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,mBAAmB,+BAsFrB"}
@@ -4,7 +4,7 @@ import { ModalsProvider } from "@mantine/modals";
4
4
  import { Notifications } from "@mantine/notifications";
5
5
  import { Spotlight } from "@mantine/spotlight";
6
6
  import { QueryClientProvider } from "@tanstack/react-query";
7
- import { RouterProvider } from "@tanstack/react-router";
7
+ import { RouterProvider, useRouter } from "@tanstack/react-router";
8
8
  import { Component, Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
9
9
  import fallbackClasses from "./error-fallback.module.css";
10
10
  import { cssVariablesResolver } from "../theme/index.js";
@@ -228,18 +228,28 @@ function useDataTelemetry(router, client, emit) {
228
228
  };
229
229
  }, [router, client, emit]);
230
230
  }
231
- const LazyDevDock = lazy(() => import("../dev-dock.js").then((m) => ({ default: m.BasaltDevDock })));
231
+ const loadDevDock = () => import("../dev-dock.js").then((m) => ({ default: m.BasaltDevDock }));
232
+ const LazyDevDock = process.env.NODE_ENV === "production" ? null : lazy(loadDevDock);
232
233
  function readQueryClient(router) {
233
234
  const client = router.options.context?.queryClient;
234
235
  if (client === void 0) {
235
236
  throw new Error(
236
- "[basalt] BasaltProvider: the router has no context.queryClient \u2014 create it with createBasaltRouter({ routeTree })."
237
+ "[basalt] BasaltProvider: no context.queryClient \u2014 pass `router` from createBasaltRouter, or with `children` put a QueryClient in the router context."
237
238
  );
238
239
  }
239
240
  return client;
240
241
  }
242
+ function useEffectiveRouter(mounted) {
243
+ const ambient = useRouter({ warn: false });
244
+ const router = mounted ?? ambient;
245
+ if (!router) {
246
+ throw new Error(
247
+ "[basalt] BasaltProvider: no router \u2014 pass `router` to mount one, or `children` inside one."
248
+ );
249
+ }
250
+ return router;
251
+ }
241
252
  function BasaltProvider({
242
- router,
243
253
  theme,
244
254
  telemetry,
245
255
  fallback,
@@ -249,6 +259,9 @@ function BasaltProvider({
249
259
  nonce,
250
260
  sizeClassHint = "compact",
251
261
  navCommandLabel,
262
+ spotlight = true,
263
+ router: mountedRouter,
264
+ children,
252
265
  ...rest
253
266
  }) {
254
267
  useDuplicateProviderGuard();
@@ -261,6 +274,7 @@ function BasaltProvider({
261
274
  useWindowErrors(emit);
262
275
  useRegistryHotkeys();
263
276
  useEffect(() => registerModalsProvider(), []);
277
+ const router = useEffectiveRouter(mountedRouter);
264
278
  const client = readQueryClient(router);
265
279
  useDataTelemetry(router, client, emit);
266
280
  const [devTool, setDevTool] = useState(null);
@@ -269,7 +283,9 @@ function BasaltProvider({
269
283
  () => setActions(buildSpotlightActions(router, setDevTool, navCommandLabel)),
270
284
  [router, navCommandLabel]
271
285
  );
272
- useEffect(refreshActions, [refreshActions]);
286
+ useEffect(() => {
287
+ if (spotlight) refreshActions();
288
+ }, [spotlight, refreshActions]);
273
289
  const resolvedTheme = useLabTheme(theme);
274
290
  return (
275
291
  // `...rest` spreads FIRST so a consumer's `MantineProviderProps` can never shadow the three
@@ -284,8 +300,8 @@ function BasaltProvider({
284
300
  defaultColorScheme,
285
301
  children: /* @__PURE__ */ jsx(RootBoundary, { emit, fallback, children: /* @__PURE__ */ jsx(BasaltBridge, { injectPalette, paletteOptions, nonce, children: /* @__PURE__ */ jsx(TelemetryContext.Provider, { value: emit, children: /* @__PURE__ */ jsxs(SizeClassHintContext.Provider, { value: sizeClassHint, children: [
286
302
  /* @__PURE__ */ jsx(QueryClientProvider, { client, children: /* @__PURE__ */ jsxs(ModalsProvider, { children: [
287
- /* @__PURE__ */ jsx(RouterProvider, { router }),
288
- process.env.NODE_ENV !== "production" && /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
303
+ mountedRouter === void 0 ? children : /* @__PURE__ */ jsx(RouterProvider, { router: mountedRouter }),
304
+ LazyDevDock !== null && /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
289
305
  LazyDevDock,
290
306
  {
291
307
  tool: devTool,
@@ -295,7 +311,7 @@ function BasaltProvider({
295
311
  ) })
296
312
  ] }) }),
297
313
  /* @__PURE__ */ jsx(Notifications, { position: "bottom-right", autoClose: 4e3, limit: 5 }),
298
- /* @__PURE__ */ jsx(
314
+ spotlight && /* @__PURE__ */ jsx(
299
315
  Spotlight,
300
316
  {
301
317
  actions,
@@ -1,6 +1,7 @@
1
1
  import type { AnyRouter } from '@tanstack/react-router';
2
+ import type { ReactNode } from 'react';
2
3
  import type { BasaltRouterContext } from './create-router.js';
3
4
  /** The router's QueryClient — a plain root route declares no context type, so read it untyped. */
4
5
  export declare const queryClientOf: (router: AnyRouter) => BasaltRouterContext["queryClient"];
5
- export declare function testRouter(text?: string): import("./create-router.js").BasaltRouter<import("@tanstack/router-core").Route<import("@tanstack/router-core").Register, any, "/", "/", string, "__root__", undefined, {}, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, readonly [import("@tanstack/react-router").Route<unknown, import("@tanstack/react-router").RootRoute<import("@tanstack/router-core").Register, undefined, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/other", "/other", string, "/other", undefined, import("@tanstack/router-core").ResolveParams<"/other">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>], unknown, unknown, unknown, undefined>>;
6
+ export declare function testRouter(text?: string, wrap?: (children: ReactNode) => ReactNode): import("./create-router.js").BasaltRouter<import("@tanstack/router-core").Route<import("@tanstack/router-core").Register, any, "/", "/", string, "__root__", undefined, {}, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, readonly [import("@tanstack/react-router").Route<unknown, import("@tanstack/react-router").RootRoute<import("@tanstack/router-core").Register, undefined, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/other", "/other", string, "/other", undefined, import("@tanstack/router-core").ResolveParams<"/other">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>], unknown, unknown, unknown, undefined>>;
6
7
  //# sourceMappingURL=test-router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-router.d.ts","sourceRoot":"","sources":["../../src/provider/test-router.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,kGAAkG;AAClG,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,KAAG,mBAAmB,CAAC,aAAa,CACtB,CAAA;AAE7D,wBAAgB,UAAU,CAAC,IAAI,SAAY,i6BAW1C"}
1
+ {"version":3,"file":"test-router.d.ts","sourceRoot":"","sources":["../../src/provider/test-router.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,kGAAkG;AAClG,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,KAAG,mBAAmB,CAAC,aAAa,CACtB,CAAA;AAE7D,wBAAgB,UAAU,CAAC,IAAI,SAAY,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,SAAS,i6BAUrF"}
@@ -2,13 +2,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Outlet, createRootRoute, createRoute } from "@tanstack/react-router";
3
3
  import { createBasaltRouter } from "./create-router.js";
4
4
  const queryClientOf = (router) => router.options.context.queryClient;
5
- function testRouter(text = "content") {
6
- const root = createRootRoute({
7
- component: () => /* @__PURE__ */ jsxs(Fragment, { children: [
8
- /* @__PURE__ */ jsx("div", { children: text }),
9
- /* @__PURE__ */ jsx(Outlet, {})
10
- ] })
11
- });
5
+ function testRouter(text = "content", wrap) {
6
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
7
+ /* @__PURE__ */ jsx("div", { children: text }),
8
+ /* @__PURE__ */ jsx(Outlet, {})
9
+ ] });
10
+ const root = createRootRoute({ component: () => wrap ? wrap(body) : body });
12
11
  const other = createRoute({ getParentRoute: () => root, path: "/other", component: () => null });
13
12
  return createBasaltRouter({ routeTree: root.addChildren([other]) });
14
13
  }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * vite-boot.ts — the anti-FOUC boot subsystem of `basaltAppPlugin`: the unlayered `<style>` that
3
+ * paints the page before any stylesheet lands, and the tiny inline script that makes that paint
4
+ * follow the scheme the user last stored.
5
+ *
6
+ * Internal to the `./vite` subpath only — deliberately NOT re-exported from `vite.ts`.
7
+ */
8
+ import type { HtmlTagDescriptor } from 'vite';
9
+ /** The `colorScheme` option: which scheme the boot paint assumes; `false` declares no `color-scheme`. */
10
+ export type BootColorScheme = 'dark' | 'light' | 'auto' | false;
11
+ type BootInput = {
12
+ colorScheme: BootColorScheme;
13
+ themeColor: {
14
+ light: string;
15
+ dark: string;
16
+ };
17
+ backgroundColor: string;
18
+ explicitBackground: boolean;
19
+ /** Inject the stored-scheme script and the variant rules it drives. */
20
+ bootScript: boolean;
21
+ };
22
+ /** The boot `<style>`, then (unless `bootScript: false`) the script — adjacent, head-prepend. */
23
+ export declare function buildBootTags(input: BootInput): HtmlTagDescriptor[];
24
+ export {};
25
+ //# sourceMappingURL=vite-boot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-boot.d.ts","sourceRoot":"","sources":["../src/vite-boot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AA0C7C,yGAAyG;AACzG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;AAE/D,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,eAAe,CAAA;IAC5B,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3C,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,uEAAuE;IACvE,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AA4CD,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,EAAE,CAInE"}
@@ -0,0 +1,36 @@
1
+ const BOOT_SCOPE = "html:not([data-mantine-color-scheme])";
2
+ const BOOT_ATTRIBUTE = "data-basalt-boot";
3
+ const BOOT_STORAGE_KEY = "mantine-color-scheme-value";
4
+ const BOOT_SCRIPT = `(function(){try{let v=localStorage.getItem('${BOOT_STORAGE_KEY}');if(v==='auto')v=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';if(v==='light'||v==='dark')document.documentElement.setAttribute('${BOOT_ATTRIBUTE}',v)}catch(e){}})()`;
5
+ const BOOT_COLOR_SCHEME = { dark: "dark", light: "light", auto: "light dark" };
6
+ function buildBaseBootStyle(input) {
7
+ const { colorScheme, themeColor, backgroundColor, explicitBackground } = input;
8
+ if (colorScheme === false) return `${BOOT_SCOPE}{background-color:${backgroundColor}}`;
9
+ const scheme = BOOT_COLOR_SCHEME[colorScheme];
10
+ if (colorScheme !== "auto" || explicitBackground) {
11
+ return `${BOOT_SCOPE}{background-color:${backgroundColor};color-scheme:${scheme}}`;
12
+ }
13
+ return `${BOOT_SCOPE}{background-color:${themeColor.light};color-scheme:${scheme}}@media(prefers-color-scheme:dark){${BOOT_SCOPE}{background-color:${themeColor.dark}}}`;
14
+ }
15
+ function buildBootStyle(input) {
16
+ const { colorScheme, themeColor, explicitBackground, bootScript } = input;
17
+ const base = buildBaseBootStyle(input);
18
+ if (!bootScript) return base;
19
+ const variants = ["light", "dark"].map((scheme) => {
20
+ const declarations = [
21
+ ...explicitBackground ? [] : [`background-color:${themeColor[scheme]}`],
22
+ ...colorScheme === false ? [] : [`color-scheme:${scheme}`]
23
+ ];
24
+ if (declarations.length === 0) return "";
25
+ return `${BOOT_SCOPE}[${BOOT_ATTRIBUTE}=${scheme}]{${declarations.join(";")}}`;
26
+ });
27
+ return base + variants.join("");
28
+ }
29
+ function buildBootTags(input) {
30
+ const tags = [{ tag: "style", children: buildBootStyle(input) }];
31
+ if (input.bootScript) tags.push({ tag: "script", children: BOOT_SCRIPT });
32
+ return tags;
33
+ }
34
+ export {
35
+ buildBootTags
36
+ };
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { PluginOption, UserConfig } from 'vite';
2
+ import type { BootColorScheme } from './vite-boot.js';
2
3
  type BasaltViteOptions = {
3
4
  /** Dev server port. Passed with `strictPort: true` so the app fails fast on a busy port. */
4
5
  port: number;
@@ -80,9 +81,29 @@ type BasaltAppOptions = {
80
81
  *
81
82
  * Set this to whatever the app passes as `defaultColorScheme` — a mismatch is a visible flash of
82
83
  * the wrong surface, not a correctness bug: the boot rule stops applying the moment Mantine
83
- * writes `data-mantine-color-scheme` on `<html>` (see `BOOT_SCOPE`).
84
+ * writes `data-mantine-color-scheme` on `<html>` (see `./vite-boot.ts`).
84
85
  */
85
- colorScheme?: 'dark' | 'light' | 'auto' | false;
86
+ colorScheme?: BootColorScheme;
87
+ /**
88
+ * Default `true`. Injects a ~300-byte inline `<script>` that reads the scheme the user last chose
89
+ * (Mantine's default `mantine-color-scheme-value` localStorage key — `light`, `dark` or `auto`,
90
+ * `auto` resolved through `prefers-color-scheme`) and sets a boot-only `data-basalt-boot`
91
+ * attribute on `<html>`, so the pre-boot paint matches the stored scheme instead of the build-time
92
+ * `colorScheme`. Storage unavailable or unset → the `colorScheme` paint stands. The script never
93
+ * writes `data-mantine-color-scheme`, so the boot rule still expires when Mantine mounts.
94
+ *
95
+ * `colorScheme: false` still gets the stored-scheme background paint; only `color-scheme` is
96
+ * suppressed. A stored value wins over the build-time `colorScheme`: an app that removes its scheme toggle
97
+ * should clear the stored key or set `bootScript: false`.
98
+ *
99
+ * CSP: Vite stamps `html.cspNonce` onto every `<script>`/`<style>` in the transformed HTML,
100
+ * plugin-injected ones included, so one nonce covers both boot tags. Without a nonce, a CSP that
101
+ * forbids inline scripts needs `bootScript: false`.
102
+ *
103
+ * Also set `false` when `BasaltProvider` gets a custom `colorSchemeManager` with another key
104
+ * (e.g. `localStorageColorSchemeManager({ key })`) — the script reads only the default key.
105
+ */
106
+ bootScript?: boolean;
86
107
  /**
87
108
  * Manifest `background_color` + anti-FOUC paint color. Default: the theme color matching
88
109
  * `colorScheme` (the dark one for `'dark'` / `'auto'` / `false`, the light one for `'light'`).
@@ -165,7 +186,7 @@ type BasaltAppOptions = {
165
186
  * • It HOISTS the shell's `<meta charset>` ahead of everything it injects, so the encoding
166
187
  * declaration stays inside the spec's first 1024 bytes (see `hoistCharset`).
167
188
  * • The anti-FOUC `<style>` expires the moment Mantine resolves the real scheme, and `colorScheme`
168
- * selects which surface it paints until then (see `BOOT_SCOPE` / `buildBootStyle`).
189
+ * selects which surface it paints until then (see `./vite-boot.ts`).
169
190
  *
170
191
  * @example
171
192
  * // vite.config.ts
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../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G;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,wDAAwD;IACxD,OAAO,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAA;IAChE;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mGAAmG;IACnG,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,aAAa,EAAE,CAAA;IAC3D,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IAC3B,oFAAoF;IACpF,GAAG,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,SAAS,GAAG,qBAAqB,CAAA;KAAE,CAAA;IACvF,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClD,CAAA;AAuhBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAMzE"}
package/dist/vite.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import { searchForWorkspaceRoot } from "vite";
4
4
  import { SURFACE } from "./tokens/palette.js";
5
+ import { buildBootTags } from "./vite-boot.js";
5
6
  import { resolveColorMix } from "./vite-color-mix.js";
6
7
  const UNENFORCED_SEARCH_DEPTH = 3;
7
8
  let unenforcedNoticePrinted = false;
@@ -152,17 +153,6 @@ const VIEWPORT_TAG = {
152
153
  tag: "meta",
153
154
  attrs: { name: "viewport", content: "width=device-width, initial-scale=1.0, viewport-fit=cover" }
154
155
  };
155
- const BOOT_SCOPE = "html:not([data-mantine-color-scheme])";
156
- const BOOT_COLOR_SCHEME = { dark: "dark", light: "light", auto: "light dark" };
157
- function buildBootStyle(input) {
158
- const { colorScheme, themeColor, backgroundColor, explicitBackground } = input;
159
- if (colorScheme === false) return `${BOOT_SCOPE}{background-color:${backgroundColor}}`;
160
- const scheme = BOOT_COLOR_SCHEME[colorScheme];
161
- if (colorScheme !== "auto" || explicitBackground) {
162
- return `${BOOT_SCOPE}{background-color:${backgroundColor};color-scheme:${scheme}}`;
163
- }
164
- return `${BOOT_SCOPE}{background-color:${themeColor.light};color-scheme:${scheme}}@media(prefers-color-scheme:dark){${BOOT_SCOPE}{background-color:${themeColor.dark}}}`;
165
- }
166
156
  const CHARSET_META_RE = /[ \t]*<meta\s+charset\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>=]+))\s*\/?>[ \t]*\r?\n?/i;
167
157
  const HTTP_EQUIV_CHARSET_RE = /<meta\s[^>]*http-equiv\s*=\s*["']?content-type["']?[^>]*>/i;
168
158
  const DEFAULT_CHARSET = "UTF-8";
@@ -218,7 +208,7 @@ function buildStaticTags(input) {
218
208
  options,
219
209
  shortName,
220
210
  themeColor,
221
- bootStyle,
211
+ bootTags,
222
212
  icons,
223
213
  darkreader,
224
214
  manifestEnabled,
@@ -244,7 +234,7 @@ function buildStaticTags(input) {
244
234
  }
245
235
  }
246
236
  );
247
- tags.push({ tag: "style", children: bootStyle });
237
+ tags.push(...bootTags);
248
238
  if (icons.mode === "default") {
249
239
  tags.push(
250
240
  {
@@ -384,11 +374,12 @@ function createMainPlugin(options) {
384
374
  const colorScheme = options.colorScheme ?? "dark";
385
375
  const schemeColor = colorScheme === "light" ? themeColor.light : themeColor.dark;
386
376
  const backgroundColor = options.backgroundColor ?? schemeColor;
387
- const bootStyle = buildBootStyle({
377
+ const bootTags = buildBootTags({
388
378
  colorScheme,
389
379
  themeColor,
390
380
  backgroundColor,
391
- explicitBackground: options.backgroundColor !== void 0
381
+ explicitBackground: options.backgroundColor !== void 0,
382
+ bootScript: options.bootScript !== false
392
383
  });
393
384
  let manifestJson = "";
394
385
  let manifestHref = "/site.webmanifest";
@@ -417,7 +408,7 @@ function createMainPlugin(options) {
417
408
  options,
418
409
  shortName,
419
410
  themeColor,
420
- bootStyle,
411
+ bootTags,
421
412
  icons,
422
413
  darkreader,
423
414
  manifestEnabled,
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # basalt-ui v2.7.3
1
+ # basalt-ui v2.8.1
2
2
  # Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets
3
3
  #
4
4
  # Entry points: use the exact import specifier below; do not guess.
@@ -13,7 +13,7 @@
13
13
  # A subpath's `Install:` line is its required peers; `OptionalPeers:` are import()-only, install on use.
14
14
 
15
15
  Package: basalt-ui
16
- Version: 2.7.3
16
+ Version: 2.8.1
17
17
 
18
18
  ## basalt-ui
19
19
  Import: import { ... } from 'basalt-ui'
@@ -21,7 +21,7 @@ Description: Wiring (`BasaltProvider`, `createBasaltTheme`, `createBasaltRouter`
21
21
  Layer: mantine-coupled
22
22
  Rule: basalt-mantine
23
23
  Signature: BasaltProvider(props: BasaltProviderProps): JSX.Element
24
- router: BasaltRouter
24
+ one of: router | children
25
25
  theme?: PartialObjectDeep<MantineTheme, { recurseIntoArrays: false;…
26
26
  telemetry?: Telemetry
27
27
  fallback?: ReactNode | ((error: unknown) => ReactNode)
@@ -31,6 +31,9 @@ Signature: BasaltProvider(props: BasaltProviderProps): JSX.Element
31
31
  nonce?: string
32
32
  sizeClassHint?: "compact" | "medium" | "expanded"
33
33
  navCommandLabel?: (item: FlatNavItem) => string
34
+ spotlight?: boolean
35
+ router: BasaltRouter
36
+ children: ReactNode
34
37
  Signature: BasaltShell(props: BasaltShellProps<G, T>): JSX.Element
35
38
  className?: string
36
39
  style?: CSSProperties
@@ -243,6 +246,7 @@ Signature: BandStrip(props: BandStripProps<T, X>): ReactElement<unknown, string
243
246
  states: readonly BandStripSeries<T>[]
244
247
  getBand: (d: T) => BandSpan
245
248
  fold?: BandFold<T>
249
+ absentState?: string
246
250
  Signature: Bars(props: BarsProps<T, X>): ReactElement<unknown, string | JSXElementConstructor<any>>
247
251
  className?: string
248
252
  style?: CSSProperties
@@ -464,7 +468,8 @@ Signature: basaltAppPlugin(options: BasaltAppOptions): PluginOption[]
464
468
  shortName?: string
465
469
  description?: string
466
470
  themeColor?: "auto" | { light: string; dark: string; }
467
- colorScheme?: false | "light" | "dark" | "auto"
471
+ colorScheme?: BootColorScheme
472
+ bootScript?: boolean
468
473
  backgroundColor?: string
469
474
  display?: "standalone" | "minimal-ui" | "fullscreen" | "browser"
470
475
  startUrl?: string
@@ -620,6 +625,28 @@ Signature: ThreadFeed(props: ThreadFeedProps): JSX.Element
620
625
  renderRow?: ((thread: AgentThread) => ReactNode)
621
626
  anchor?: "start" | "end"
622
627
  Signature: ThreadFeedRow(props: ThreadFeedRowProps): JSX.Element
628
+ thread: AgentThread<TranscriptPart>
629
+ expanded: boolean
630
+ onToggle: (id: string) => void
631
+ title?: string
632
+ summary?: string
633
+ headerLeft?: ReactNode
634
+ headerRight?: ReactNode
635
+ messages?: readonly ChatMessage<TranscriptPart>[]
636
+ liveParts?: readonly TranscriptPart[]
637
+ liveStatus?: StreamStatus
638
+ renderers?: Readonly<Record<string, PartRenderer<ForeignPart>>>
639
+ fallbackRenderer?: PartRenderer<ForeignPart>
640
+ affordances?: MessageAffordances
641
+ groupConsecutive?: boolean
642
+ onSend: (payload: ComposerSubmit) => void
643
+ onStop?: (() => void)
644
+ composerProps?: Omit<ComposerProps, "streaming" | "onSubmit" | "onStop">
645
+ virtualize?: false | true | VirtualizeOptions
646
+ height?: string | number
647
+ classNames?: Partial<Record<"root" | "header" | "body", string>>
648
+ className?: string
649
+ style?: CSSProperties
623
650
  Signature: ToolChip(props: ToolChipProps): JSX.Element
624
651
  className?: string
625
652
  style?: CSSProperties
@@ -628,6 +655,12 @@ Signature: ToolChip(props: ToolChipProps): JSX.Element
628
655
  onApprove?: ((approvalId: string) => void)
629
656
  onDeny?: ((approvalId: string, reason?: string) => void)
630
657
  Signature: aiSdkTransport(options: AiSdkTransportOptions): AiSdkTransport<TPart>
658
+ one of: api | transport
659
+ api: string
660
+ transport: ChatTransport<UIMessage<unknown, UIDataTypes, UITools>>
661
+ headers?: Record<string, string> | Headers [with api]
662
+ credentials?: RequestCredentials [with api]
663
+ fetch?: typeof fetch [with api]
631
664
  Signature: parseAgentPart(raw: unknown): AgentPart | null
632
665
  Signature: toAgentError(error: unknown): AgentError
633
666
  Signature: useAgentThreadRuns(props: UseAgentThreadRunsArgs<TPart>): UseAgentThreadRunsReturn<TPart>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basalt-ui",
3
- "version": "2.7.3",
3
+ "version": "2.8.1",
4
4
  "description": "Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets",
5
5
  "keywords": [
6
6
  "charts",