basalt-ui 0.4.2 → 1.0.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.
- package/AGENTS.md +70 -0
- package/CHANGELOG.md +199 -41
- package/LICENSE +201 -0
- package/README.md +434 -160
- package/agent/rules/basalt-agent.md +395 -0
- package/agent/rules/basalt-charts.md +170 -0
- package/agent/rules/basalt-commands.md +320 -0
- package/agent/rules/basalt-content.md +390 -0
- package/agent/rules/basalt-data.md +237 -0
- package/agent/rules/basalt-forms.md +186 -0
- package/agent/rules/basalt-mantine.md +327 -0
- package/agent/rules/basalt-notifications.md +264 -0
- package/agent/rules/basalt-query.md +130 -0
- package/agent/rules/basalt-router.md +173 -0
- package/agent/rules/basalt-state.md +99 -0
- package/agent/rules/basalt-tokens.md +148 -0
- package/agent/templates/CLAUDE-block.md.tpl +35 -0
- package/agent/templates/DESIGN.md.tpl +71 -0
- package/agent/templates/__root.tpl +31 -0
- package/agent/templates/query-client.ts.tpl +12 -0
- package/bin/basalt.mjs +14 -0
- package/configs/check.yml +29 -0
- package/configs/lefthook.yml +21 -0
- package/configs/oxfmt.json +8 -0
- package/configs/oxlint-plugin.js +269 -0
- package/configs/oxlint-plugin.test.ts +107 -0
- package/configs/oxlint.json +116 -0
- package/configs/tsconfig.base.json +20 -0
- package/configs/tsconfig.node.json +8 -0
- package/configs/tsconfig.react-app.json +8 -0
- package/dist/agent/ai-sdk-transport.d.ts +85 -0
- package/dist/agent/ai-sdk-transport.d.ts.map +1 -0
- package/dist/agent/ai-sdk-transport.js +109 -0
- package/dist/agent/history.d.ts +55 -0
- package/dist/agent/history.d.ts.map +1 -0
- package/dist/agent/history.js +32 -0
- package/dist/agent/index.d.ts +53 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +23 -0
- package/dist/agent/outcome.d.ts +71 -0
- package/dist/agent/outcome.d.ts.map +1 -0
- package/dist/agent/outcome.js +30 -0
- package/dist/agent/part-list.d.ts +75 -0
- package/dist/agent/part-list.d.ts.map +1 -0
- package/dist/agent/part-list.js +127 -0
- package/dist/agent/parts.d.ts +91 -0
- package/dist/agent/parts.d.ts.map +1 -0
- package/dist/agent/parts.js +49 -0
- package/dist/agent/stick-to-bottom.d.ts +23 -0
- package/dist/agent/stick-to-bottom.d.ts.map +1 -0
- package/dist/agent/stick-to-bottom.js +73 -0
- package/dist/agent/thread.d.ts +124 -0
- package/dist/agent/thread.d.ts.map +1 -0
- package/dist/agent/thread.js +131 -0
- package/dist/agent/transport.d.ts +87 -0
- package/dist/agent/transport.d.ts.map +1 -0
- package/dist/agent/transport.js +21 -0
- package/dist/agent/use-agent-stream.d.ts +34 -0
- package/dist/agent/use-agent-stream.d.ts.map +1 -0
- package/dist/agent/use-agent-stream.js +56 -0
- package/dist/agent/use-agent-thread-runs.d.ts +72 -0
- package/dist/agent/use-agent-thread-runs.d.ts.map +1 -0
- package/dist/agent/use-agent-thread-runs.js +217 -0
- package/dist/agent-chat/composer.d.ts +18 -0
- package/dist/agent-chat/composer.d.ts.map +1 -0
- package/dist/agent-chat/composer.js +86 -0
- package/dist/agent-chat/index.d.ts +24 -0
- package/dist/agent-chat/index.d.ts.map +1 -0
- package/dist/agent-chat/index.js +15 -0
- package/dist/agent-chat/thread-detail-panel.d.ts +27 -0
- package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -0
- package/dist/agent-chat/thread-detail-panel.js +108 -0
- package/dist/agent-chat/thread-feed.d.ts +18 -0
- package/dist/agent-chat/thread-feed.d.ts.map +1 -0
- package/dist/agent-chat/thread-feed.js +42 -0
- package/dist/agent-chat/thread-message.d.ts +31 -0
- package/dist/agent-chat/thread-message.d.ts.map +1 -0
- package/dist/agent-chat/thread-message.js +128 -0
- package/dist/agent-chat/thread-outcome-card.d.ts +19 -0
- package/dist/agent-chat/thread-outcome-card.d.ts.map +1 -0
- package/dist/agent-chat/thread-outcome-card.js +120 -0
- package/dist/agent-chat/thread-workspace.d.ts +27 -0
- package/dist/agent-chat/thread-workspace.d.ts.map +1 -0
- package/dist/agent-chat/thread-workspace.js +95 -0
- package/dist/charts/hooks/useChartSize.d.ts +25 -0
- package/dist/charts/hooks/useChartSize.d.ts.map +1 -0
- package/dist/charts/hooks/useChartSize.js +8 -0
- package/dist/charts/hooks/useChartTooltip.d.ts +13 -0
- package/dist/charts/hooks/useChartTooltip.d.ts.map +1 -0
- package/dist/charts/hooks/useChartTooltip.js +26 -0
- package/dist/charts/hooks/useHoverSync.d.ts +30 -0
- package/dist/charts/hooks/useHoverSync.d.ts.map +1 -0
- package/dist/charts/hooks/useHoverSync.js +70 -0
- package/dist/charts/hover-context.d.ts +21 -0
- package/dist/charts/hover-context.d.ts.map +1 -0
- package/dist/charts/hover-context.js +12 -0
- package/dist/charts/hover-sync.d.ts +14 -0
- package/dist/charts/hover-sync.d.ts.map +1 -0
- package/dist/charts/hover-sync.js +17 -0
- package/dist/charts/index.d.ts +47 -0
- package/dist/charts/index.d.ts.map +1 -0
- package/dist/charts/index.js +129 -0
- package/dist/charts/kinds/Bars.d.ts +129 -0
- package/dist/charts/kinds/Bars.d.ts.map +1 -0
- package/dist/charts/kinds/Bars.js +467 -0
- package/dist/charts/kinds/Donut.d.ts +65 -0
- package/dist/charts/kinds/Donut.d.ts.map +1 -0
- package/dist/charts/kinds/Donut.js +158 -0
- package/dist/charts/kinds/DualPanel.d.ts +67 -0
- package/dist/charts/kinds/DualPanel.d.ts.map +1 -0
- package/dist/charts/kinds/DualPanel.js +326 -0
- package/dist/charts/kinds/Heatmap.d.ts +59 -0
- package/dist/charts/kinds/Heatmap.d.ts.map +1 -0
- package/dist/charts/kinds/Heatmap.js +175 -0
- package/dist/charts/kinds/MultiLine.d.ts +73 -0
- package/dist/charts/kinds/MultiLine.d.ts.map +1 -0
- package/dist/charts/kinds/MultiLine.js +275 -0
- package/dist/charts/kinds/StackedArea.d.ts +35 -0
- package/dist/charts/kinds/StackedArea.d.ts.map +1 -0
- package/dist/charts/kinds/StackedArea.js +151 -0
- package/dist/charts/kinds/ZonedLine.d.ts +94 -0
- package/dist/charts/kinds/ZonedLine.d.ts.map +1 -0
- package/dist/charts/kinds/ZonedLine.js +218 -0
- package/dist/charts/primitives/AreaGradient.d.ts +18 -0
- package/dist/charts/primitives/AreaGradient.d.ts.map +1 -0
- package/dist/charts/primitives/AreaGradient.js +13 -0
- package/dist/charts/primitives/Axes.d.ts +22 -0
- package/dist/charts/primitives/Axes.d.ts.map +1 -0
- package/dist/charts/primitives/Axes.js +79 -0
- package/dist/charts/primitives/ChartCard.d.ts +14 -0
- package/dist/charts/primitives/ChartCard.d.ts.map +1 -0
- package/dist/charts/primitives/ChartCard.js +144 -0
- package/dist/charts/primitives/ChartFrame.d.ts +70 -0
- package/dist/charts/primitives/ChartFrame.d.ts.map +1 -0
- package/dist/charts/primitives/ChartFrame.js +77 -0
- package/dist/charts/primitives/ChartLegend.d.ts +36 -0
- package/dist/charts/primitives/ChartLegend.d.ts.map +1 -0
- package/dist/charts/primitives/ChartLegend.js +234 -0
- package/dist/charts/primitives/ChartTooltip.d.ts +34 -0
- package/dist/charts/primitives/ChartTooltip.d.ts.map +1 -0
- package/dist/charts/primitives/ChartTooltip.js +134 -0
- package/dist/charts/primitives/Crosshair.d.ts +23 -0
- package/dist/charts/primitives/Crosshair.d.ts.map +1 -0
- package/dist/charts/primitives/Crosshair.js +21 -0
- package/dist/charts/primitives/HoverOverlay.d.ts +9 -0
- package/dist/charts/primitives/HoverOverlay.d.ts.map +1 -0
- package/dist/charts/primitives/HoverOverlay.js +21 -0
- package/dist/charts/primitives/ResponsiveChart.d.ts +45 -0
- package/dist/charts/primitives/ResponsiveChart.d.ts.map +1 -0
- package/dist/charts/primitives/ResponsiveChart.js +24 -0
- package/dist/charts/primitives/ZoneRects.d.ts +38 -0
- package/dist/charts/primitives/ZoneRects.d.ts.map +1 -0
- package/dist/charts/primitives/ZoneRects.js +30 -0
- package/dist/charts/series.d.ts +99 -0
- package/dist/charts/series.d.ts.map +1 -0
- package/dist/charts/series.js +55 -0
- package/dist/charts/sparklines/BarSparkline.d.ts +13 -0
- package/dist/charts/sparklines/BarSparkline.d.ts.map +1 -0
- package/dist/charts/sparklines/BarSparkline.js +33 -0
- package/dist/charts/sparklines/LineSparkline.d.ts +15 -0
- package/dist/charts/sparklines/LineSparkline.d.ts.map +1 -0
- package/dist/charts/sparklines/LineSparkline.js +39 -0
- package/dist/charts/sparklines/index.d.ts +3 -0
- package/dist/charts/sparklines/index.d.ts.map +1 -0
- package/dist/charts/sparklines/index.js +6 -0
- package/dist/charts/theme.d.ts +21 -0
- package/dist/charts/theme.d.ts.map +1 -0
- package/dist/charts/theme.js +30 -0
- package/dist/charts/utils/domain.d.ts +20 -0
- package/dist/charts/utils/domain.d.ts.map +1 -0
- package/dist/charts/utils/domain.js +7 -0
- package/dist/charts/utils/format.d.ts +5 -0
- package/dist/charts/utils/format.d.ts.map +1 -0
- package/dist/charts/utils/format.js +27 -0
- package/dist/charts/utils/ticks.d.ts +5 -0
- package/dist/charts/utils/ticks.d.ts.map +1 -0
- package/dist/charts/utils/ticks.js +18 -0
- package/dist/cli/index.d.ts +273 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +907 -0
- package/dist/commands/ShortcutsHelp.d.ts +17 -0
- package/dist/commands/ShortcutsHelp.d.ts.map +1 -0
- package/dist/commands/ShortcutsHelp.js +64 -0
- package/dist/commands/define-commands.d.ts +140 -0
- package/dist/commands/define-commands.d.ts.map +1 -0
- package/dist/commands/define-commands.js +26 -0
- package/dist/commands/define-overlays.d.ts +134 -0
- package/dist/commands/define-overlays.d.ts.map +1 -0
- package/dist/commands/define-overlays.js +53 -0
- package/dist/commands/index.d.ts +42 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +46 -0
- package/dist/commands/overlays-mount.d.ts +117 -0
- package/dist/commands/overlays-mount.d.ts.map +1 -0
- package/dist/commands/overlays-mount.js +116 -0
- package/dist/commands/projectors.d.ts +152 -0
- package/dist/commands/projectors.d.ts.map +1 -0
- package/dist/commands/projectors.js +87 -0
- package/dist/commands/shortcut-format.d.ts +48 -0
- package/dist/commands/shortcut-format.d.ts.map +1 -0
- package/dist/commands/shortcut-format.js +33 -0
- package/dist/commands/useCommandHotkeys.d.ts +14 -0
- package/dist/commands/useCommandHotkeys.d.ts.map +1 -0
- package/dist/commands/useCommandHotkeys.js +45 -0
- package/dist/connectivity/connectivity-indicator.d.ts +8 -0
- package/dist/connectivity/connectivity-indicator.d.ts.map +1 -0
- package/dist/connectivity/connectivity-indicator.js +203 -0
- package/dist/connectivity/connectivity-provider.d.ts +7 -0
- package/dist/connectivity/connectivity-provider.d.ts.map +1 -0
- package/dist/connectivity/connectivity-provider.js +125 -0
- package/dist/connectivity/index.d.ts +13 -0
- package/dist/connectivity/index.d.ts.map +1 -0
- package/dist/connectivity/index.js +8 -0
- package/dist/connectivity/types.d.ts +36 -0
- package/dist/connectivity/types.d.ts.map +1 -0
- package/dist/connectivity/types.js +0 -0
- package/dist/connectivity/use-connectivity.d.ts +3 -0
- package/dist/connectivity/use-connectivity.d.ts.map +1 -0
- package/dist/connectivity/use-connectivity.js +14 -0
- package/dist/content/article-actions.d.ts +39 -0
- package/dist/content/article-actions.d.ts.map +1 -0
- package/dist/content/article-actions.js +28 -0
- package/dist/content/article-card.d.ts +58 -0
- package/dist/content/article-card.d.ts.map +1 -0
- package/dist/content/article-card.js +76 -0
- package/dist/content/article-card.module.css +109 -0
- package/dist/content/article-card.module.css.d.ts +16 -0
- package/dist/content/article-filter-bar.d.ts +40 -0
- package/dist/content/article-filter-bar.d.ts.map +1 -0
- package/dist/content/article-filter-bar.js +56 -0
- package/dist/content/article-layout.d.ts +61 -0
- package/dist/content/article-layout.d.ts.map +1 -0
- package/dist/content/article-layout.js +71 -0
- package/dist/content/article-layout.module.css +131 -0
- package/dist/content/article-layout.module.css.d.ts +20 -0
- package/dist/content/article-model.d.ts +62 -0
- package/dist/content/article-model.d.ts.map +1 -0
- package/dist/content/article-model.js +41 -0
- package/dist/content/block-split.d.ts +24 -0
- package/dist/content/block-split.d.ts.map +1 -0
- package/dist/content/block-split.js +63 -0
- package/dist/content/callout-alert.d.ts +27 -0
- package/dist/content/callout-alert.d.ts.map +1 -0
- package/dist/content/callout-alert.js +59 -0
- package/dist/content/callout.d.ts +24 -0
- package/dist/content/callout.d.ts.map +1 -0
- package/dist/content/callout.js +59 -0
- package/dist/content/callout.module.css +77 -0
- package/dist/content/callout.module.css.d.ts +16 -0
- package/dist/content/code-block.d.ts +26 -0
- package/dist/content/code-block.d.ts.map +1 -0
- package/dist/content/code-block.js +41 -0
- package/dist/content/code-block.module.css +86 -0
- package/dist/content/code-block.module.css.d.ts +14 -0
- package/dist/content/copy-action.d.ts +29 -0
- package/dist/content/copy-action.d.ts.map +1 -0
- package/dist/content/copy-action.js +46 -0
- package/dist/content/fence-block.d.ts +19 -0
- package/dist/content/fence-block.d.ts.map +1 -0
- package/dist/content/fence-block.js +23 -0
- package/dist/content/glyphs.d.ts +18 -0
- package/dist/content/glyphs.d.ts.map +1 -0
- package/dist/content/glyphs.js +43 -0
- package/dist/content/guide.d.ts +47 -0
- package/dist/content/guide.d.ts.map +1 -0
- package/dist/content/guide.js +110 -0
- package/dist/content/guide.module.css +62 -0
- package/dist/content/guide.module.css.d.ts +13 -0
- package/dist/content/heading-anchor.d.ts +8 -0
- package/dist/content/heading-anchor.d.ts.map +1 -0
- package/dist/content/heading-anchor.js +23 -0
- package/dist/content/heading-components.d.ts +5 -0
- package/dist/content/heading-components.d.ts.map +1 -0
- package/dist/content/heading-components.js +41 -0
- package/dist/content/highlighter.d.ts +8 -0
- package/dist/content/highlighter.d.ts.map +1 -0
- package/dist/content/highlighter.js +85 -0
- package/dist/content/index.d.ts +45 -0
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +43 -0
- package/dist/content/markdown-hast.d.ts +23 -0
- package/dist/content/markdown-hast.d.ts.map +1 -0
- package/dist/content/markdown-hast.js +48 -0
- package/dist/content/markdown.d.ts +68 -0
- package/dist/content/markdown.d.ts.map +1 -0
- package/dist/content/markdown.js +180 -0
- package/dist/content/mdx.d.ts +20 -0
- package/dist/content/mdx.d.ts.map +1 -0
- package/dist/content/mdx.js +64 -0
- package/dist/content/mermaid.d.ts +32 -0
- package/dist/content/mermaid.d.ts.map +1 -0
- package/dist/content/mermaid.js +70 -0
- package/dist/content/mermaid.module.css +20 -0
- package/dist/content/mermaid.module.css.d.ts +8 -0
- package/dist/content/prose.d.ts +29 -0
- package/dist/content/prose.d.ts.map +1 -0
- package/dist/content/prose.js +24 -0
- package/dist/content/prose.module.css +330 -0
- package/dist/content/prose.module.css.d.ts +12 -0
- package/dist/content/reading-progress.d.ts +20 -0
- package/dist/content/reading-progress.d.ts.map +1 -0
- package/dist/content/reading-progress.js +38 -0
- package/dist/content/reading-progress.module.css +22 -0
- package/dist/content/reading-progress.module.css.d.ts +9 -0
- package/dist/content/slug.d.ts +28 -0
- package/dist/content/slug.d.ts.map +1 -0
- package/dist/content/slug.js +28 -0
- package/dist/content/toc.d.ts +37 -0
- package/dist/content/toc.d.ts.map +1 -0
- package/dist/content/toc.js +134 -0
- package/dist/content/toc.module.css +51 -0
- package/dist/content/toc.module.css.d.ts +13 -0
- package/dist/content/url-hardening.d.ts +23 -0
- package/dist/content/url-hardening.d.ts.map +1 -0
- package/dist/content/url-hardening.js +23 -0
- package/dist/dashboard/delta-badge.d.ts +13 -0
- package/dist/dashboard/delta-badge.d.ts.map +1 -0
- package/dist/dashboard/delta-badge.js +45 -0
- package/dist/dashboard/empty-state.d.ts +15 -0
- package/dist/dashboard/empty-state.d.ts.map +1 -0
- package/dist/dashboard/empty-state.js +56 -0
- package/dist/dashboard/index.d.ts +5 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +16 -0
- package/dist/dashboard/settings-section.d.ts +24 -0
- package/dist/dashboard/settings-section.d.ts.map +1 -0
- package/dist/dashboard/settings-section.js +61 -0
- package/dist/dashboard/settings-section.module.css +23 -0
- package/dist/dashboard/settings-section.module.css.d.ts +10 -0
- package/dist/dashboard/stat-card.d.ts +18 -0
- package/dist/dashboard/stat-card.d.ts.map +1 -0
- package/dist/dashboard/stat-card.js +74 -0
- package/dist/data/data-table.d.ts +198 -0
- package/dist/data/data-table.d.ts.map +1 -0
- package/dist/data/data-table.js +342 -0
- package/dist/data/index.d.ts +34 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +2 -0
- package/dist/data/table.d.ts +24 -0
- package/dist/data/table.d.ts.map +1 -0
- package/dist/data/table.js +20 -0
- package/dist/data/virtual-list.d.ts +74 -0
- package/dist/data/virtual-list.d.ts.map +1 -0
- package/dist/data/virtual-list.js +86 -0
- package/dist/data/virtual.d.ts +20 -0
- package/dist/data/virtual.d.ts.map +1 -0
- package/dist/data/virtual.js +4 -0
- package/dist/forms/FormErrorSummary.d.ts +29 -0
- package/dist/forms/FormErrorSummary.d.ts.map +1 -0
- package/dist/forms/FormErrorSummary.js +28 -0
- package/dist/forms/create-form.d.ts +31 -0
- package/dist/forms/create-form.d.ts.map +1 -0
- package/dist/forms/create-form.js +18 -0
- package/dist/forms/field.d.ts +22 -0
- package/dist/forms/field.d.ts.map +1 -0
- package/dist/forms/field.js +9 -0
- package/dist/forms/index.d.ts +17 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +13 -0
- package/dist/forms/use-form-draft.d.ts +61 -0
- package/dist/forms/use-form-draft.d.ts.map +1 -0
- package/dist/forms/use-form-draft.js +55 -0
- package/dist/guard/guard-hook.d.ts +40 -0
- package/dist/guard/guard-hook.d.ts.map +1 -0
- package/dist/guard/guard-hook.js +55 -0
- package/dist/guard/index.d.ts +144 -0
- package/dist/guard/index.d.ts.map +1 -0
- package/dist/guard/index.js +315 -0
- package/dist/guard/types.d.ts +97 -0
- package/dist/guard/types.d.ts.map +1 -0
- package/dist/guard/types.js +0 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/motion/index.d.ts +29 -0
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion/index.js +12 -0
- package/dist/notifications/bell.d.ts +12 -0
- package/dist/notifications/bell.d.ts.map +1 -0
- package/dist/notifications/bell.js +84 -0
- package/dist/notifications/center.d.ts +20 -0
- package/dist/notifications/center.d.ts.map +1 -0
- package/dist/notifications/center.js +144 -0
- package/dist/notifications/define-notifications.d.ts +97 -0
- package/dist/notifications/define-notifications.d.ts.map +1 -0
- package/dist/notifications/define-notifications.js +27 -0
- package/dist/notifications/index.d.ts +36 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +52 -0
- package/dist/notifications/notify.d.ts +92 -0
- package/dist/notifications/notify.d.ts.map +1 -0
- package/dist/notifications/notify.js +127 -0
- package/dist/notifications/overlay.d.ts +20 -0
- package/dist/notifications/overlay.d.ts.map +1 -0
- package/dist/notifications/overlay.js +12 -0
- package/dist/notifications/store.d.ts +120 -0
- package/dist/notifications/store.d.ts.map +1 -0
- package/dist/notifications/store.js +113 -0
- package/dist/provider/index.d.ts +93 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +106 -0
- package/dist/query/devtools.d.ts +21 -0
- package/dist/query/devtools.d.ts.map +1 -0
- package/dist/query/devtools.js +12 -0
- package/dist/query/index.d.ts +65 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +68 -0
- package/dist/register.d.ts +139 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +6 -0
- package/dist/router-tanstack/index.d.ts +74 -0
- package/dist/router-tanstack/index.d.ts.map +1 -0
- package/dist/router-tanstack/index.js +29 -0
- package/dist/router-tanstack/multi-search-param-store.d.ts +78 -0
- package/dist/router-tanstack/multi-search-param-store.d.ts.map +1 -0
- package/dist/router-tanstack/multi-search-param-store.js +35 -0
- package/dist/router-tanstack/search-param-store.d.ts +92 -0
- package/dist/router-tanstack/search-param-store.d.ts.map +1 -0
- package/dist/router-tanstack/search-param-store.js +26 -0
- package/dist/shell/account-types.d.ts +118 -0
- package/dist/shell/account-types.d.ts.map +1 -0
- package/dist/shell/account-types.js +0 -0
- package/dist/shell/app-breadcrumbs.d.ts +17 -0
- package/dist/shell/app-breadcrumbs.d.ts.map +1 -0
- package/dist/shell/app-breadcrumbs.js +39 -0
- package/dist/shell/app-header.module.css +73 -0
- package/dist/shell/app-header.module.css.d.ts +11 -0
- package/dist/shell/app-mobile-nav.d.ts +26 -0
- package/dist/shell/app-mobile-nav.d.ts.map +1 -0
- package/dist/shell/app-mobile-nav.js +106 -0
- package/dist/shell/app-mobile-nav.module.css +100 -0
- package/dist/shell/app-mobile-nav.module.css.d.ts +14 -0
- package/dist/shell/app-sidebar-account.d.ts +3 -0
- package/dist/shell/app-sidebar-account.d.ts.map +1 -0
- package/dist/shell/app-sidebar-account.js +84 -0
- package/dist/shell/app-sidebar.d.ts +56 -0
- package/dist/shell/app-sidebar.d.ts.map +1 -0
- package/dist/shell/app-sidebar.js +455 -0
- package/dist/shell/app-sidebar.module.css +414 -0
- package/dist/shell/app-sidebar.module.css.d.ts +34 -0
- package/dist/shell/index.d.ts +123 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.js +179 -0
- package/dist/shell/page-header.d.ts +13 -0
- package/dist/shell/page-header.d.ts.map +1 -0
- package/dist/shell/page-header.js +23 -0
- package/dist/shell/sidebar-search.d.ts +12 -0
- package/dist/shell/sidebar-search.d.ts.map +1 -0
- package/dist/shell/sidebar-search.js +62 -0
- package/dist/shell/sidebar-search.module.css +62 -0
- package/dist/shell/sidebar-search.module.css.d.ts +11 -0
- package/dist/state.d.ts +62 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +124 -0
- package/dist/styles.css +166 -0
- package/dist/surfaces.d.ts +376 -0
- package/dist/surfaces.d.ts.map +1 -0
- package/dist/surfaces.js +306 -0
- package/dist/theme/controls.module.css +143 -0
- package/dist/theme/controls.module.css.d.ts +17 -0
- package/dist/theme/floating.module.css +35 -0
- package/dist/theme/floating.module.css.d.ts +9 -0
- package/dist/theme/index.d.ts +22 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +733 -0
- package/dist/theme/nav-link.module.css +67 -0
- package/dist/theme/nav-link.module.css.d.ts +8 -0
- package/dist/theme/segmented-control.module.css +14 -0
- package/dist/theme/segmented-control.module.css.d.ts +8 -0
- package/dist/theme/timeline.module.css +29 -0
- package/dist/theme/timeline.module.css.d.ts +9 -0
- package/dist/theme-lab/index.d.ts +59 -0
- package/dist/theme-lab/index.d.ts.map +1 -0
- package/dist/theme-lab/index.js +263 -0
- package/dist/theme-toggle/index.d.ts +8 -0
- package/dist/theme-toggle/index.d.ts.map +1 -0
- package/dist/theme-toggle/index.js +155 -0
- package/dist/tokens/index.d.ts +151 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +246 -0
- package/dist/tokens/palette.d.ts +304 -0
- package/dist/tokens/palette.d.ts.map +1 -0
- package/dist/tokens/palette.js +186 -0
- package/dist/vite.d.ts +30 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +68 -0
- package/llms.txt +149 -0
- package/package.json +243 -46
- package/src/agent/ai-sdk-transport.ts +280 -0
- package/src/agent/history.ts +128 -0
- package/src/agent/index.ts +92 -0
- package/src/agent/outcome.ts +120 -0
- package/src/agent/part-list.tsx +292 -0
- package/src/agent/parts.ts +136 -0
- package/src/agent/stick-to-bottom.tsx +154 -0
- package/src/agent/thread.ts +312 -0
- package/src/agent/transport.ts +114 -0
- package/src/agent/use-agent-stream.ts +141 -0
- package/src/agent/use-agent-thread-runs.ts +440 -0
- package/src/agent-chat/composer.tsx +131 -0
- package/src/agent-chat/index.ts +35 -0
- package/src/agent-chat/thread-detail-panel.tsx +192 -0
- package/src/agent-chat/thread-feed.tsx +81 -0
- package/src/agent-chat/thread-message.tsx +251 -0
- package/src/agent-chat/thread-outcome-card.tsx +196 -0
- package/src/agent-chat/thread-workspace.tsx +179 -0
- package/src/charts/hooks/useChartSize.ts +31 -0
- package/src/charts/hooks/useChartTooltip.ts +31 -0
- package/src/charts/hooks/useHoverSync.ts +116 -0
- package/src/charts/hover-context.ts +28 -0
- package/src/charts/hover-sync.tsx +37 -0
- package/src/charts/index.ts +118 -0
- package/src/charts/kinds/Bars.tsx +634 -0
- package/src/charts/kinds/Donut.tsx +233 -0
- package/src/charts/kinds/DualPanel.tsx +432 -0
- package/src/charts/kinds/Heatmap.tsx +255 -0
- package/src/charts/kinds/MultiLine.tsx +376 -0
- package/src/charts/kinds/StackedArea.tsx +218 -0
- package/src/charts/kinds/ZonedLine.tsx +346 -0
- package/src/charts/primitives/AreaGradient.tsx +26 -0
- package/src/charts/primitives/Axes.tsx +97 -0
- package/src/charts/primitives/ChartCard.tsx +180 -0
- package/src/charts/primitives/ChartFrame.tsx +157 -0
- package/src/charts/primitives/ChartLegend.tsx +302 -0
- package/src/charts/primitives/ChartTooltip.tsx +158 -0
- package/src/charts/primitives/Crosshair.tsx +40 -0
- package/src/charts/primitives/HoverOverlay.tsx +24 -0
- package/src/charts/primitives/ResponsiveChart.tsx +64 -0
- package/src/charts/primitives/ZoneRects.tsx +67 -0
- package/src/charts/series.ts +163 -0
- package/src/charts/sparklines/BarSparkline.tsx +48 -0
- package/src/charts/sparklines/LineSparkline.tsx +57 -0
- package/src/charts/sparklines/index.ts +2 -0
- package/src/charts/theme.tsx +53 -0
- package/src/charts/utils/domain.test.ts +24 -0
- package/src/charts/utils/domain.ts +22 -0
- package/src/charts/utils/format.ts +27 -0
- package/src/charts/utils/ticks.ts +18 -0
- package/src/cli/check-theme.test.ts +658 -0
- package/src/cli/index.ts +1497 -0
- package/src/cli/init-sync.test.ts +160 -0
- package/src/commands/ShortcutsHelp.tsx +129 -0
- package/src/commands/define-commands.ts +184 -0
- package/src/commands/define-overlays.ts +197 -0
- package/src/commands/index.ts +86 -0
- package/src/commands/overlays-mount.tsx +301 -0
- package/src/commands/projectors.ts +267 -0
- package/src/commands/shortcut-format.ts +83 -0
- package/src/commands/useCommandHotkeys.ts +114 -0
- package/src/connectivity/connectivity-indicator.tsx +249 -0
- package/src/connectivity/connectivity-provider.tsx +186 -0
- package/src/connectivity/index.ts +18 -0
- package/src/connectivity/types.ts +39 -0
- package/src/connectivity/use-connectivity.ts +25 -0
- package/src/content/article-actions.test.ts +78 -0
- package/src/content/article-actions.ts +72 -0
- package/src/content/article-card.module.css +109 -0
- package/src/content/article-card.module.css.d.ts +16 -0
- package/src/content/article-card.tsx +173 -0
- package/src/content/article-filter-bar.tsx +88 -0
- package/src/content/article-layout.module.css +131 -0
- package/src/content/article-layout.module.css.d.ts +20 -0
- package/src/content/article-layout.tsx +167 -0
- package/src/content/article-model.test.ts +119 -0
- package/src/content/article-model.ts +110 -0
- package/src/content/block-split.test.ts +75 -0
- package/src/content/block-split.ts +102 -0
- package/src/content/callout-alert.ts +88 -0
- package/src/content/callout.module.css +77 -0
- package/src/content/callout.module.css.d.ts +16 -0
- package/src/content/callout.tsx +96 -0
- package/src/content/code-block.module.css +86 -0
- package/src/content/code-block.module.css.d.ts +14 -0
- package/src/content/code-block.tsx +82 -0
- package/src/content/copy-action.tsx +79 -0
- package/src/content/fence-block.tsx +39 -0
- package/src/content/glyphs.tsx +53 -0
- package/src/content/guide.module.css +62 -0
- package/src/content/guide.module.css.d.ts +13 -0
- package/src/content/guide.tsx +174 -0
- package/src/content/heading-anchor.tsx +54 -0
- package/src/content/heading-components.tsx +62 -0
- package/src/content/highlighter.ts +123 -0
- package/src/content/index.ts +60 -0
- package/src/content/markdown-hast.ts +80 -0
- package/src/content/markdown.tsx +346 -0
- package/src/content/mdx.tsx +127 -0
- package/src/content/mermaid.module.css +20 -0
- package/src/content/mermaid.module.css.d.ts +8 -0
- package/src/content/mermaid.tsx +124 -0
- package/src/content/prose.module.css +330 -0
- package/src/content/prose.module.css.d.ts +12 -0
- package/src/content/prose.tsx +53 -0
- package/src/content/reading-progress.module.css +22 -0
- package/src/content/reading-progress.module.css.d.ts +9 -0
- package/src/content/reading-progress.tsx +67 -0
- package/src/content/slug.test.ts +62 -0
- package/src/content/slug.ts +57 -0
- package/src/content/toc.module.css +51 -0
- package/src/content/toc.module.css.d.ts +13 -0
- package/src/content/toc.tsx +226 -0
- package/src/content/url-hardening.ts +46 -0
- package/src/dashboard/delta-badge.tsx +70 -0
- package/src/dashboard/empty-state.tsx +80 -0
- package/src/dashboard/index.ts +11 -0
- package/src/dashboard/settings-section.module.css +23 -0
- package/src/dashboard/settings-section.module.css.d.ts +10 -0
- package/src/dashboard/settings-section.tsx +118 -0
- package/src/dashboard/stat-card.tsx +105 -0
- package/src/data/data-table.tsx +695 -0
- package/src/data/index.ts +37 -0
- package/src/data/table.ts +46 -0
- package/src/data/virtual-list.tsx +180 -0
- package/src/data/virtual.ts +21 -0
- package/src/forms/FormErrorSummary.tsx +64 -0
- package/src/forms/create-form.ts +57 -0
- package/src/forms/field.ts +30 -0
- package/src/forms/index.ts +26 -0
- package/src/forms/use-form-draft.ts +170 -0
- package/src/guard/check-source.test.ts +834 -0
- package/src/guard/guard-hook.test.ts +173 -0
- package/src/guard/guard-hook.ts +122 -0
- package/src/guard/index.ts +510 -0
- package/src/guard/types.ts +117 -0
- package/src/index.ts +139 -0
- package/src/motion/index.ts +26 -0
- package/src/notifications/bell.tsx +108 -0
- package/src/notifications/center.tsx +245 -0
- package/src/notifications/define-notifications.ts +162 -0
- package/src/notifications/index.ts +79 -0
- package/src/notifications/notify.tsx +260 -0
- package/src/notifications/overlay.tsx +64 -0
- package/src/notifications/store.ts +287 -0
- package/src/provider/index.tsx +234 -0
- package/src/query/devtools.tsx +38 -0
- package/src/query/index.ts +129 -0
- package/src/register.ts +158 -0
- package/src/router-tanstack/index.ts +111 -0
- package/src/router-tanstack/multi-search-param-store.test.ts +56 -0
- package/src/router-tanstack/multi-search-param-store.ts +122 -0
- package/src/router-tanstack/search-param-store.ts +125 -0
- package/src/shell/account-types.ts +119 -0
- package/src/shell/app-breadcrumbs.tsx +90 -0
- package/src/shell/app-header.module.css +73 -0
- package/src/shell/app-header.module.css.d.ts +11 -0
- package/src/shell/app-mobile-nav.module.css +100 -0
- package/src/shell/app-mobile-nav.module.css.d.ts +14 -0
- package/src/shell/app-mobile-nav.tsx +146 -0
- package/src/shell/app-sidebar-account.tsx +142 -0
- package/src/shell/app-sidebar.module.css +414 -0
- package/src/shell/app-sidebar.module.css.d.ts +34 -0
- package/src/shell/app-sidebar.tsx +632 -0
- package/src/shell/index.tsx +343 -0
- package/src/shell/page-header.tsx +35 -0
- package/src/shell/sidebar-search.module.css +62 -0
- package/src/shell/sidebar-search.module.css.d.ts +11 -0
- package/src/shell/sidebar-search.tsx +80 -0
- package/src/state.ts +246 -0
- package/src/styles.css +166 -0
- package/src/styles.floor.test.ts +36 -0
- package/src/surfaces.ts +489 -0
- package/src/theme/border-coverage.test.ts +272 -0
- package/src/theme/contrast.test.ts +306 -0
- package/src/theme/controls.module.css +143 -0
- package/src/theme/controls.module.css.d.ts +17 -0
- package/src/theme/floating.module.css +35 -0
- package/src/theme/floating.module.css.d.ts +9 -0
- package/src/theme/index.ts +933 -0
- package/src/theme/nav-link.module.css +67 -0
- package/src/theme/nav-link.module.css.d.ts +8 -0
- package/src/theme/segmented-control.module.css +14 -0
- package/src/theme/segmented-control.module.css.d.ts +8 -0
- package/src/theme/shadow-surfaces.test.ts +421 -0
- package/src/theme/timeline.module.css +29 -0
- package/src/theme/timeline.module.css.d.ts +9 -0
- package/src/theme-lab/index.tsx +359 -0
- package/src/theme-lab/theme-lab.test.ts +60 -0
- package/src/theme-toggle/index.tsx +180 -0
- package/src/tokens/index.ts +363 -0
- package/src/tokens/palette.ts +288 -0
- package/src/vite.ts +122 -0
- package/src/index.css +0 -877
- package/src/starlight.css +0 -308
- package/tailwind.config.js +0 -78
package/src/state.ts
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createPersistedState — Mantine-free, React-only localStorage primitive.
|
|
3
|
+
*
|
|
4
|
+
* Versioned, Standard-Schema-validated state via useSyncExternalStore. SSR-safe.
|
|
5
|
+
* Cross-tab via the 'storage' event. Keys are namespaced 'basalt:*' so they never
|
|
6
|
+
* collide with the localstorage-theme guard pattern.
|
|
7
|
+
*/
|
|
8
|
+
import { useSyncExternalStore } from 'react'
|
|
9
|
+
import type { StandardSchemaV1 } from './register'
|
|
10
|
+
|
|
11
|
+
// Shared noop subscribe — passed to useSyncExternalStore on the server so no window access occurs.
|
|
12
|
+
const noopSubscribe =
|
|
13
|
+
(_cb: () => void): (() => void) =>
|
|
14
|
+
() => {}
|
|
15
|
+
|
|
16
|
+
// ── useOnlineStatus ────────────────────────────────────────────────────────────────────────────────
|
|
17
|
+
|
|
18
|
+
function subscribeOnline(cb: () => void): () => void {
|
|
19
|
+
window.addEventListener('online', cb)
|
|
20
|
+
window.addEventListener('offline', cb)
|
|
21
|
+
return () => {
|
|
22
|
+
window.removeEventListener('online', cb)
|
|
23
|
+
window.removeEventListener('offline', cb)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const getOnlineSnapshot = (): boolean => navigator.onLine
|
|
28
|
+
const getOnlineServerSnapshot = (): boolean => true
|
|
29
|
+
|
|
30
|
+
// Detect SSR once at module load — mirrors createPersistedState's isServer pattern.
|
|
31
|
+
const isOnlineServer = typeof window === 'undefined'
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Returns `true` when the browser reports an active network connection, `false` otherwise.
|
|
35
|
+
* Backed by `useSyncExternalStore`: subscribes to window `online`/`offline` events.
|
|
36
|
+
* SSR-safe — `getServerSnapshot` returns `true` (optimistic: assume online on the server).
|
|
37
|
+
*
|
|
38
|
+
* @deprecated Use `useConnectivity()` from `basalt-ui` instead — it aggregates browser,
|
|
39
|
+
* React Query, SSE, and health-ping signals into a richer `{ status, details }` object.
|
|
40
|
+
* `useOnlineStatus` remains for simple boolean needs without a provider dependency.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const isOnline = useOnlineStatus()
|
|
44
|
+
* if (!isOnline) return <OfflineBanner />
|
|
45
|
+
*/
|
|
46
|
+
export function useOnlineStatus(): boolean {
|
|
47
|
+
return useSyncExternalStore(
|
|
48
|
+
isOnlineServer ? noopSubscribe : subscribeOnline,
|
|
49
|
+
isOnlineServer ? getOnlineServerSnapshot : getOnlineSnapshot,
|
|
50
|
+
getOnlineServerSnapshot,
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type PersistedStateOptions<T> = {
|
|
55
|
+
/** localStorage key (will be namespaced as `basalt:<key>`). */
|
|
56
|
+
readonly key: string
|
|
57
|
+
/** Envelope version — increment when the shape changes. */
|
|
58
|
+
readonly version: number
|
|
59
|
+
/** Value to use when nothing is persisted, after migration fails, or on SSR. */
|
|
60
|
+
readonly initial: T
|
|
61
|
+
/** Migrate a previous-version persisted value forward to the current shape. */
|
|
62
|
+
readonly migrate?: (persisted: unknown, fromVersion: number) => T
|
|
63
|
+
/**
|
|
64
|
+
* Standard-Schema validate the (post-migrate) value. Invalid result OR a Promise (async schema)
|
|
65
|
+
* falls back to `initial` — sync storage can't await, so async validators are treated as invalid.
|
|
66
|
+
*/
|
|
67
|
+
readonly schema?: StandardSchemaV1<unknown, T>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The envelope stored in localStorage: `{ v: number, value: unknown }`. */
|
|
71
|
+
type Envelope = { v: number; value: unknown }
|
|
72
|
+
|
|
73
|
+
function isEnvelope(raw: unknown): raw is Envelope {
|
|
74
|
+
return (
|
|
75
|
+
typeof raw === 'object' &&
|
|
76
|
+
raw !== null &&
|
|
77
|
+
'v' in raw &&
|
|
78
|
+
typeof (raw as Record<string, unknown>)['v'] === 'number' &&
|
|
79
|
+
'value' in raw
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Parse a raw localStorage string (or null) into a value, falling back to `initial` on any miss. */
|
|
84
|
+
function parseStorage<T>(raw: string | null, opts: PersistedStateOptions<T>): T {
|
|
85
|
+
if (raw === null) return opts.initial
|
|
86
|
+
try {
|
|
87
|
+
const parsed: unknown = JSON.parse(raw)
|
|
88
|
+
if (!isEnvelope(parsed)) return opts.initial
|
|
89
|
+
|
|
90
|
+
let value: unknown = parsed.value
|
|
91
|
+
|
|
92
|
+
if (parsed.v !== opts.version) {
|
|
93
|
+
value = opts.migrate ? opts.migrate(parsed.value, parsed.v) : opts.initial
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (opts.schema) {
|
|
97
|
+
const result = opts.schema['~standard'].validate(value)
|
|
98
|
+
// Async schema — can't await in sync storage path; fall back to initial
|
|
99
|
+
if (result instanceof Promise) return opts.initial
|
|
100
|
+
if (result.issues !== undefined) return opts.initial
|
|
101
|
+
// Narrowed to SuccessResult<T> — value is T
|
|
102
|
+
return result.value
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return value as T
|
|
106
|
+
} catch {
|
|
107
|
+
return opts.initial
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function writeStorage<T>(opts: PersistedStateOptions<T>, next: T): void {
|
|
112
|
+
const storageKey = `basalt:${opts.key}`
|
|
113
|
+
try {
|
|
114
|
+
const envelope: Envelope = { v: opts.version, value: next }
|
|
115
|
+
window.localStorage.setItem(storageKey, JSON.stringify(envelope))
|
|
116
|
+
} catch {
|
|
117
|
+
// Silently fail (storage full, private browsing, etc.)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Versioned, Standard-Schema-validated localStorage state via useSyncExternalStore (no zustand).
|
|
123
|
+
* SSR-safe (getServerSnapshot returns `initial`). Cross-tab via the storage event.
|
|
124
|
+
*
|
|
125
|
+
* Returns a factory hook — call it once per module, then use the returned hook in components.
|
|
126
|
+
* Common case is 3 lines.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* export const useFilterDraft = createPersistedState({ key: 'filters', version: 1, initial: DEFAULT, schema: FilterSchema })
|
|
130
|
+
* // in a component:
|
|
131
|
+
* const [draft, setDraft] = useFilterDraft()
|
|
132
|
+
*/
|
|
133
|
+
export function createPersistedState<T>(
|
|
134
|
+
opts: PersistedStateOptions<T>,
|
|
135
|
+
): () => readonly [T, (next: T) => void] {
|
|
136
|
+
const storageKey = `basalt:${opts.key}`
|
|
137
|
+
|
|
138
|
+
// One Set of subscriber callbacks — mirrors notifications/store.ts single-listener-to-Set pattern.
|
|
139
|
+
const listeners = new Set<() => void>()
|
|
140
|
+
|
|
141
|
+
// ONE module-scoped 'storage' event listener per key, registered lazily on first subscriber.
|
|
142
|
+
// Removed when the last subscriber unsubscribes (cleanup semantics preserved).
|
|
143
|
+
let storageHandler: ((e: StorageEvent) => void) | null = null
|
|
144
|
+
|
|
145
|
+
const subscribe = (cb: () => void): (() => void) => {
|
|
146
|
+
listeners.add(cb)
|
|
147
|
+
|
|
148
|
+
// Attach the shared window listener on the first subscriber.
|
|
149
|
+
if (storageHandler === null) {
|
|
150
|
+
storageHandler = (e: StorageEvent): void => {
|
|
151
|
+
if (e.key === storageKey) {
|
|
152
|
+
for (const listener of listeners) listener()
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
window.addEventListener('storage', storageHandler)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return () => {
|
|
159
|
+
listeners.delete(cb)
|
|
160
|
+
// Detach the shared window listener when the last subscriber unsubscribes.
|
|
161
|
+
if (listeners.size === 0 && storageHandler !== null) {
|
|
162
|
+
window.removeEventListener('storage', storageHandler)
|
|
163
|
+
storageHandler = null
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Snapshot cache — useSyncExternalStore requires getSnapshot to return a referentially STABLE
|
|
169
|
+
// value while the store is unchanged. parseStorage() allocates a fresh object/array on every
|
|
170
|
+
// call, so returning it raw makes React see an ever-changing snapshot for object/array state
|
|
171
|
+
// and loop until "Maximum update depth exceeded". We cache the parsed value keyed on the raw
|
|
172
|
+
// localStorage string: same string → same reference; a write (this tab or another) changes the
|
|
173
|
+
// string, so the next read re-parses exactly once. Primitive state was unaffected — this fixes
|
|
174
|
+
// the object/array case (chat history, form drafts).
|
|
175
|
+
let cachedRaw: string | null = null
|
|
176
|
+
let cachedValue: T = opts.initial
|
|
177
|
+
let primed = false
|
|
178
|
+
|
|
179
|
+
const getSnapshot = (): T => {
|
|
180
|
+
let raw: string | null
|
|
181
|
+
try {
|
|
182
|
+
raw = window.localStorage.getItem(storageKey)
|
|
183
|
+
} catch {
|
|
184
|
+
raw = null
|
|
185
|
+
}
|
|
186
|
+
if (primed && raw === cachedRaw) return cachedValue
|
|
187
|
+
cachedRaw = raw
|
|
188
|
+
cachedValue = parseStorage(raw, opts)
|
|
189
|
+
primed = true
|
|
190
|
+
return cachedValue
|
|
191
|
+
}
|
|
192
|
+
const getServerSnapshot = (): T => opts.initial
|
|
193
|
+
|
|
194
|
+
const setState = (next: T): void => {
|
|
195
|
+
writeStorage(opts, next)
|
|
196
|
+
// Notify in-tab listeners (the 'storage' event only fires in OTHER tabs)
|
|
197
|
+
for (const cb of listeners) cb()
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Detect SSR once at creation time — the environment doesn't change between renders.
|
|
201
|
+
const isServer = typeof window === 'undefined'
|
|
202
|
+
|
|
203
|
+
return function usePersistedState(): readonly [T, (next: T) => void] {
|
|
204
|
+
const value = useSyncExternalStore<T>(
|
|
205
|
+
// SSR guard — subscribe must not reference `window` on the server.
|
|
206
|
+
isServer ? noopSubscribe : subscribe,
|
|
207
|
+
isServer ? getServerSnapshot : getSnapshot,
|
|
208
|
+
getServerSnapshot,
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
return [value, setState] as const
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ── readPersistedValue — plain function, no React required ─────────────────────────────────
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Read a value previously written by `createPersistedState` under the namespaced key
|
|
219
|
+
* `basalt:<key>`. Parses the versioned envelope shape `{ v, value }`. Returns `null` on
|
|
220
|
+
* miss, corruption, version mismatch, or SSR — no fallback is applied (call sites supply
|
|
221
|
+
* their own default).
|
|
222
|
+
*
|
|
223
|
+
* Primary use: `validateSearch` in TanStack Router (which runs outside React, so it can't
|
|
224
|
+
* call `usePersistedState`). Combine with a URL-param check to create a search-param store
|
|
225
|
+
* backed by localStorage.
|
|
226
|
+
*
|
|
227
|
+
* @param key — un-namespaced key (the same one passed to `createPersistedState`)
|
|
228
|
+
* @param version — if provided, the envelope version must match; stale envelopes return `null`
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* const stored = readPersistedValue('dashboard-range', 1)
|
|
232
|
+
* // stored is '1d' | '7d' | '30d' | null
|
|
233
|
+
*/
|
|
234
|
+
export function readPersistedValue(key: string, version?: number): unknown | null {
|
|
235
|
+
const storageKey = `basalt:${key}`
|
|
236
|
+
try {
|
|
237
|
+
const raw = localStorage.getItem(storageKey)
|
|
238
|
+
if (raw === null) return null
|
|
239
|
+
const envelope: unknown = JSON.parse(raw)
|
|
240
|
+
if (!isEnvelope(envelope)) return null
|
|
241
|
+
if (version !== undefined && envelope.v !== version) return null
|
|
242
|
+
return envelope.value
|
|
243
|
+
} catch {
|
|
244
|
+
return null
|
|
245
|
+
}
|
|
246
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* basalt-ui global styles — plain global CSS (NOT a CSS module).
|
|
3
|
+
*
|
|
4
|
+
* Kept in a dedicated `@layer basalt` so consumer styles and Mantine's own layers can win or lose
|
|
5
|
+
* deterministically by import order. Carries cross-app safety nets that have no app coupling.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Layer order — LOW to HIGH priority. Declared up front (a `@layer` statement is allowed before
|
|
9
|
+
* `@import`) so it holds no matter which order the consumer's bundler emits the stylesheets in.
|
|
10
|
+
*
|
|
11
|
+
* This is load-bearing, not decorative: the consumer MUST import `@mantine/core/styles.layer.css`,
|
|
12
|
+
* never the plain `@mantine/core/styles.css`. Mantine's default bundle is entirely UNLAYERED, and
|
|
13
|
+
* unlayered author styles outrank EVERY layered rule regardless of specificity — so with the plain
|
|
14
|
+
* bundle this whole `@layer basalt` block silently loses to Mantine, including the iOS input floor
|
|
15
|
+
* below. `basalt doctor` flags the wrong import. */
|
|
16
|
+
@layer mantine, basalt;
|
|
17
|
+
|
|
18
|
+
/* The three-font system (docs/DESIGN-SPEC.md §3) — exact-pinned @fontsource-variable deps. Bare
|
|
19
|
+
* specifiers so consumer bundlers resolve them. */
|
|
20
|
+
@import '@fontsource-variable/nunito-sans';
|
|
21
|
+
@import '@fontsource-variable/hubot-sans';
|
|
22
|
+
@import '@fontsource-variable/jetbrains-mono';
|
|
23
|
+
|
|
24
|
+
/* Font stack — overridable via the --basalt-font-* custom properties. */
|
|
25
|
+
@layer base {
|
|
26
|
+
:root {
|
|
27
|
+
--basalt-font-sans:
|
|
28
|
+
'Nunito Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
|
|
29
|
+
Helvetica, Arial, sans-serif;
|
|
30
|
+
--basalt-font-head:
|
|
31
|
+
'Hubot Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica,
|
|
32
|
+
Arial, sans-serif;
|
|
33
|
+
--basalt-font-mono: 'JetBrains Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@layer basalt {
|
|
38
|
+
/* iOS input-zoom FLOOR. Safari zooms the viewport whenever a focused input computes below 16px,
|
|
39
|
+
and never zooms back out on blur — the single worst mobile-form defect. 16px is the only clean
|
|
40
|
+
fix: `maximum-scale=1` / `user-scalable=no` block pinch-zoom on Android (WCAG 1.4.4),
|
|
41
|
+
`text-size-adjust` governs text inflation rather than focus-zoom, and Safari doesn't support
|
|
42
|
+
`interactive-widget` at all.
|
|
43
|
+
|
|
44
|
+
`max()` makes this a FLOOR, not a pin: a deliberately larger input keeps its own size, and the
|
|
45
|
+
scale can grow without this rule fighting it. Being a CSS rule on the ELEMENT (rather than
|
|
46
|
+
per-component `defaultProps`) it reaches every input Mantine ships — Autocomplete, MultiSelect,
|
|
47
|
+
TagsInput, PinInput, NativeSelect, … — plus any consumer that passes an explicit `size="xs"`.
|
|
48
|
+
Enumerating components could never cover that; the previous attempt missed seven of them.
|
|
49
|
+
|
|
50
|
+
Deliberate side effect: it also overrides Mantine's `[data-monospace]` −2px shrink, which would
|
|
51
|
+
otherwise drop a mono input back under the threshold.
|
|
52
|
+
|
|
53
|
+
`!important` is deliberate and singular — the one legitimate use of it in this framework. An
|
|
54
|
+
inline `style` attribute outranks EVERY stylesheet rule regardless of layer or specificity, so
|
|
55
|
+
without `!important` a consumer's `style={{ fontSize: 13 }}` on a raw `<input>` silently wins
|
|
56
|
+
and re-opens the zoom bug — a floor a `style` prop can override is not a floor, it's a
|
|
57
|
+
suggestion. `check-theme`'s `raw-form-control` + `sub-16-input-font` guard kinds catch the
|
|
58
|
+
authoring mistake at build time; this `!important` is the runtime backstop that makes it
|
|
59
|
+
un-defeatable even when a violation slips through. */
|
|
60
|
+
input,
|
|
61
|
+
select,
|
|
62
|
+
textarea {
|
|
63
|
+
font-size: max(16px, var(--input-fz, 1rem)) !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Focus ring = the accent as INK, not as a fill. Mantine hardcodes the ring to
|
|
67
|
+
`var(--mantine-primary-color-filled)` — the SURFACE token, which is deliberately deep in both
|
|
68
|
+
schemes so a white label sits on it (see ACCENT in tokens/palette.ts). A ring is read against
|
|
69
|
+
the PAGE, though, so on dark it must be the light ink accent (8.64:1) rather than the deep fill
|
|
70
|
+
(3.26:1 — legal under WCAG 1.4.11, but a barely-there ring). Same specificity as Mantine's own
|
|
71
|
+
rule, but `@layer basalt` outranks `@layer mantine`, so this wins. */
|
|
72
|
+
.mantine-focus-auto:focus-visible,
|
|
73
|
+
.mantine-focus-always:focus {
|
|
74
|
+
outline-color: var(--vx-accent);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Hubot Sans is a condensed display face — the spec pins it at 88% font-stretch everywhere it
|
|
78
|
+
lands (headings + the Mantine Title component). */
|
|
79
|
+
h1,
|
|
80
|
+
h2,
|
|
81
|
+
h3,
|
|
82
|
+
h4,
|
|
83
|
+
h5,
|
|
84
|
+
h6,
|
|
85
|
+
.mantine-Title-root {
|
|
86
|
+
font-stretch: 88%;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Scrollbars (docs/DESIGN-SPEC.md §5): 9px, ink-mix thumb (stronger on hover), radius 6,
|
|
90
|
+
transparent track.
|
|
91
|
+
|
|
92
|
+
ONE thumb treatment drives BOTH bars — the native page bar below and Mantine's ScrollArea
|
|
93
|
+
overlay bar further down — so a page and a sidebar never read as two different scrollbar
|
|
94
|
+
languages. Defined as ink %-mixes (the same idiom as the ink-6% hover tints) rather than a
|
|
95
|
+
surface token: ink inverts across schemes, so one expression stays visible on both pages.
|
|
96
|
+
`--vx-surface-hairline` is NOT usable here — it's the card-ring token (`#e5e5e5` on light),
|
|
97
|
+
which all but vanishes against the light page. */
|
|
98
|
+
:root {
|
|
99
|
+
--basalt-scrollbar-thumb: color-mix(in srgb, var(--vx-ink) 25%, transparent);
|
|
100
|
+
--basalt-scrollbar-thumb-hover: color-mix(in srgb, var(--vx-ink) 40%, transparent);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
* {
|
|
104
|
+
scrollbar-width: thin;
|
|
105
|
+
scrollbar-color: var(--basalt-scrollbar-thumb) transparent;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
*::-webkit-scrollbar {
|
|
109
|
+
width: 9px;
|
|
110
|
+
height: 9px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
*::-webkit-scrollbar-track {
|
|
114
|
+
background: transparent;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
*::-webkit-scrollbar-thumb {
|
|
118
|
+
background-color: var(--basalt-scrollbar-thumb);
|
|
119
|
+
border-radius: 6px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
123
|
+
background-color: var(--basalt-scrollbar-thumb-hover);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Mantine ScrollArea draws its OWN overlay scrollbars and hides the native one on its viewport
|
|
127
|
+
(which is `overflow: scroll`). The `*` rules above re-expose that native bar, so a ScrollArea
|
|
128
|
+
shows TWO bars — plus an always-on native gutter on both axes even when nothing overflows (the
|
|
129
|
+
white bars seen inside Spotlight). Re-hide the native bar on ScrollArea viewports so only
|
|
130
|
+
Mantine's styled overlay bar remains. */
|
|
131
|
+
.mantine-ScrollArea-viewport {
|
|
132
|
+
scrollbar-width: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.mantine-ScrollArea-viewport::-webkit-scrollbar {
|
|
136
|
+
display: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Re-point Mantine's overlay bar at the same treatment. Its own thumb is a hardcoded
|
|
140
|
+
rgba(0,0,0,0.4) / rgba(255,255,255,0.4) and its track picks up a gray-0/dark-8 fill on hover —
|
|
141
|
+
both off-palette, and visibly heavier than the native bar they sit beside. No `!important`:
|
|
142
|
+
Mantine ships layered CSS (`@mantine/core/styles.layer.css`) and `@layer basalt` is declared
|
|
143
|
+
after `@layer mantine`, so this layer wins on order regardless of specificity. */
|
|
144
|
+
.mantine-ScrollArea-scrollbar {
|
|
145
|
+
background-color: transparent;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.mantine-ScrollArea-thumb {
|
|
149
|
+
background-color: var(--basalt-scrollbar-thumb);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.mantine-ScrollArea-scrollbar:hover .mantine-ScrollArea-thumb,
|
|
153
|
+
.mantine-ScrollArea-scrollbar:active .mantine-ScrollArea-thumb {
|
|
154
|
+
background-color: var(--basalt-scrollbar-thumb-hover);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Print: hide the BasaltShell chrome so only page content prints.
|
|
159
|
+
* AppShell.Navbar → <nav>, AppShell.Header → <header>, AppShell.Footer → <footer>. */
|
|
160
|
+
@media print {
|
|
161
|
+
nav,
|
|
162
|
+
header,
|
|
163
|
+
footer {
|
|
164
|
+
display: none !important;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test for the iOS input-zoom FLOOR itself (styles.css).
|
|
3
|
+
*
|
|
4
|
+
* This rule is load-bearing for accessibility (Safari zooms the viewport on focus below 16px and
|
|
5
|
+
* never zooms back out) — it must never be silently softened (dropping `!important`, so an inline
|
|
6
|
+
* `style` attribute defeats it again) or dropped (losing `max()`, turning the floor into a pin that
|
|
7
|
+
* fights a deliberately larger input). Both properties are asserted directly against the shipped
|
|
8
|
+
* CSS text, independent of the `check-theme` guard (which scans CONSUMER source, not this file).
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync } from 'node:fs'
|
|
11
|
+
import { dirname, resolve } from 'node:path'
|
|
12
|
+
import { fileURLToPath } from 'node:url'
|
|
13
|
+
import { describe, expect, it } from 'bun:test'
|
|
14
|
+
|
|
15
|
+
const STYLES_CSS_PATH = resolve(dirname(fileURLToPath(import.meta.url)), 'styles.css')
|
|
16
|
+
|
|
17
|
+
describe('styles.css — iOS input floor', () => {
|
|
18
|
+
const css = readFileSync(STYLES_CSS_PATH, 'utf8')
|
|
19
|
+
|
|
20
|
+
it('declares the floor rule on input, select, textarea', () => {
|
|
21
|
+
expect(css).toMatch(/input\s*,\s*\n?\s*select\s*,\s*\n?\s*textarea\s*\{/)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('keeps max(16px, …) — a FLOOR, not a pin', () => {
|
|
25
|
+
expect(css).toContain('max(16px')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('is !important — un-defeatable by an inline style attribute', () => {
|
|
29
|
+
const ruleMatch = css.match(
|
|
30
|
+
/input\s*,\s*\n?\s*select\s*,\s*\n?\s*textarea\s*\{\s*\n?\s*font-size:\s*([^;]+);/,
|
|
31
|
+
)
|
|
32
|
+
expect(ruleMatch).not.toBeNull()
|
|
33
|
+
expect(ruleMatch?.[1]).toContain('max(16px')
|
|
34
|
+
expect(ruleMatch?.[1]).toContain('!important')
|
|
35
|
+
})
|
|
36
|
+
})
|