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
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: basalt-ui
|
|
3
|
+
description: Content/prose surface from basalt-ui/content — Prose, CodeBlock, Callout, TableOfContents, ReadingProgress, Markdown (streaming-aware), MermaidDiagram, MDX component map, ArticleLayout, ArticleCard/Grid, GuideLink/GuideDrawer, and the content-collections + TanStack Start recipe. Mantine-coupled (docs/CONTENT-SPEC.md in the basalt-ui repo).
|
|
4
|
+
paths:
|
|
5
|
+
- 'src/content/**'
|
|
6
|
+
- 'apps/**/src/**/*content*'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Basalt Content — Prose, Markdown, Mermaid, MDX, Docs Framing
|
|
10
|
+
|
|
11
|
+
basalt-ui ships `./content` — a Mantine-coupled surface for long-form reading (docs, guides,
|
|
12
|
+
hand-authored articles, AI-streamed prose) plus the docs-framing chrome around it: a page layout,
|
|
13
|
+
overview cards, and a contextual-help drawer.
|
|
14
|
+
|
|
15
|
+
## Prose vs Markdown vs MDX
|
|
16
|
+
|
|
17
|
+
| Entry | Input | Use case |
|
|
18
|
+
| ----------------------------------------- | ------------------ | ---------------------------------------------------------------------- |
|
|
19
|
+
| `<Prose>` | React children | hand-authored JSX articles |
|
|
20
|
+
| `<Markdown>` | a markdown string | CMS content, files, **AI-streamed output** (`streaming` prop) |
|
|
21
|
+
| `mdxComponents` / `createMdxComponents()` | MDX runtime output | `content-collections`/any MDX pipeline's `MDXContent components={...}` |
|
|
22
|
+
|
|
23
|
+
All three route through the SAME typography CSS (`Prose`), the same `CodeBlock`/`MermaidDiagram`
|
|
24
|
+
fenced-code rendering, and the same GFM-alert-aware `Callout` blockquote mapping — a hand-authored
|
|
25
|
+
article, a rendered markdown file, and an MDX guide are visually indistinguishable. `Markdown`
|
|
26
|
+
wraps its own `<Prose>` internally; `mdxComponents` does NOT — wrap MDX output in `<Prose>`
|
|
27
|
+
yourself, or reach for `ArticleLayout` (below), which wraps it for you.
|
|
28
|
+
|
|
29
|
+
## Density
|
|
30
|
+
|
|
31
|
+
`density='article'` (default) — 16px body, 1.7 leading, a 72ch measure (`VX.text.h1`/`h2` + the
|
|
32
|
+
`--vx-prose-measure` token), generous block spacing. `density='chat'` — the compact chat typography
|
|
33
|
+
(15px/1.55). Use `chat` density for agent/chat text, e.g. `<Markdown streaming density="chat">`.
|
|
34
|
+
|
|
35
|
+
**The type-ladder rule applies here too**: never a literal font-size in JSX or a bespoke CSS value
|
|
36
|
+
— every size in `Prose`/`CodeBlock`/`Callout`/`ArticleLayout`/`ArticleCard`/`GuideDrawer` resolves
|
|
37
|
+
to a `VX.text.*` / `--vx-text-*` step. `h1` (26px) and `h2` (21px) are the two ladder steps this
|
|
38
|
+
surface added.
|
|
39
|
+
|
|
40
|
+
## CodeBlock — optional-peer behavior
|
|
41
|
+
|
|
42
|
+
`shiki` is an OPTIONAL peer, lazy-loaded via a module-level singleton (`createHighlighterCore`,
|
|
43
|
+
dual `github-light`/`github-dark` themes, `defaultColor: false` — a Mantine scheme flip is then
|
|
44
|
+
pure CSS, zero re-highlighting). Without `shiki` installed, or for an unrecognized `language`,
|
|
45
|
+
`CodeBlock` degrades to a plain mono `<pre>` — never a crash, never an unhandled rejection.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bun add shiki
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { CodeBlock } from 'basalt-ui/content'
|
|
53
|
+
|
|
54
|
+
<CodeBlock title="vite.config.ts" language="ts" code={source} />
|
|
55
|
+
<CodeBlock language="bash" code="bun add basalt-ui" />
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## TableOfContents / ReadingProgress
|
|
59
|
+
|
|
60
|
+
`TableOfContents` auto-collects `h2`/`h3` ids from a `containerRef` (IntersectionObserver
|
|
61
|
+
scroll-spy) or takes an explicit `items` list — pair it with `headingSlug`/`SlugTracker` when
|
|
62
|
+
authoring heading ids by hand. `ReadingProgress` is an opt-in scroll-driven top bar, `target`
|
|
63
|
+
defaults to the whole document. Both are headless-styled but Mantine-coupled; `ArticleLayout`
|
|
64
|
+
already wires both for you (below) — reach for them directly only when composing a custom page
|
|
65
|
+
shell.
|
|
66
|
+
|
|
67
|
+
## Markdown — streaming contract
|
|
68
|
+
|
|
69
|
+
`<Markdown streaming>` is the flagship AI-stream path: pass the accumulating string on every
|
|
70
|
+
token, no debouncing needed.
|
|
71
|
+
|
|
72
|
+
- **`blockSplit`** (own fence-aware, blank-line lexer — no dep) splits `children` into top-level
|
|
73
|
+
blocks. Every block except the last renders through a `React.memo`'d renderer — referentially
|
|
74
|
+
stable `components`/`urlTransform` (built once per `Markdown` render via `useMemo`) is what makes
|
|
75
|
+
the memo actually skip re-rendering an unchanged settled block.
|
|
76
|
+
- The LAST (in-flight) block is repaired via `remend` before rendering — unclosed `**`/`` ` ``/
|
|
77
|
+
`~~`/`$$`, an incomplete `[text](url` link (remend rewrites it to
|
|
78
|
+
`streamdown:incomplete-link` — any `streamdown:` href is dropped by the link hardening below).
|
|
79
|
+
- **Hardening is ALWAYS ON**, streaming or not: `allowedLinkPrefixes` (default `['https://',
|
|
80
|
+
'mailto:', '#', '/']`) / `allowedImagePrefixes` (default `['https://', '/']`) / `defaultOrigin`
|
|
81
|
+
(resolves a relative URL before the allowlist check's result is used). A disallowed `href`/`src`
|
|
82
|
+
renders as an unlinked `<span>` / a dropped image — never a raw unsafe URL.
|
|
83
|
+
- Fenced code highlights/upgrades per BLOCK on settle, not per token — the in-flight fence renders
|
|
84
|
+
plain mono (`CodeBlock showCopy={false}`) until its block settles.
|
|
85
|
+
- Heading ids: a document-wide `SlugTracker` in non-streaming mode gives correct cross-heading
|
|
86
|
+
dedup (`overview`, `overview-1`, …). In `streaming` mode each block gets its OWN tracker instead
|
|
87
|
+
(a shared tracker would have to live across memoized blocks that never re-render) — a heading
|
|
88
|
+
text repeated across two DIFFERENT blocks will NOT get a deduped suffix. Streamed chat content
|
|
89
|
+
doesn't drive a `TableOfContents`, so this is an accepted tradeoff, not a bug.
|
|
90
|
+
- `StreamingMarkdown` is DELETED — `Markdown` is the package's only markdown renderer. Render
|
|
91
|
+
agent/chat text via `<Markdown streaming density="chat">`. `agent/** -> content` is lint-blocked
|
|
92
|
+
by design, so `./agent` deliberately ships NO renderer — `PartList` takes a consumer-supplied
|
|
93
|
+
`components.text` instead.
|
|
94
|
+
|
|
95
|
+
## MermaidDiagram — support matrix
|
|
96
|
+
|
|
97
|
+
`beautiful-mermaid` (optional peer, lazy dynamic import, module-level singleton) covers exactly
|
|
98
|
+
six diagram types: **flowchart, state, sequence, class, ER, XY chart**. Anything else (full
|
|
99
|
+
mermaid grammar — gantt, git graphs, mindmaps, …) is a consumer escape hatch: install the full
|
|
100
|
+
`mermaid` package yourself and render it outside `Markdown`/`MermaidDiagram`; this module does not
|
|
101
|
+
attempt to cover it.
|
|
102
|
+
|
|
103
|
+
Theming passes `var(--vx-*)` strings straight through as `bg`/`fg`/`line`/`accent`/`muted`/
|
|
104
|
+
`surface`/`border` — the emitted SVG references those custom properties directly, so a Mantine
|
|
105
|
+
scheme flip never re-renders the diagram. A ` ```mermaid ` fence inside `Markdown`'s `streaming`
|
|
106
|
+
mode renders as plain `CodeBlock` while it's the in-flight block and upgrades to `MermaidDiagram`
|
|
107
|
+
once the block settles (parse errors keep the last successfully-rendered SVG rather than blanking
|
|
108
|
+
a working diagram).
|
|
109
|
+
|
|
110
|
+
## ArticleLayout — the docs-page frame
|
|
111
|
+
|
|
112
|
+
The page shell around a `Prose`/`Markdown`/`MDXContent` body: a centered content column, a sticky
|
|
113
|
+
scroll-spy TOC rail (`toc`, default `true`, auto-hides below 1200px), an opt-in reading-progress
|
|
114
|
+
bar (`readingProgress`, default `false`), a title/description/date/reading-time meta header
|
|
115
|
+
(`meta`), and a prev/next pagination footer (`prev`/`next`). The header/content/footer share ONE
|
|
116
|
+
grid column, so the article body reads as a single consistent width whether or not the TOC rail is
|
|
117
|
+
visible.
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { ArticleLayout } from 'basalt-ui/content'
|
|
121
|
+
import { Link } from '@tanstack/react-router'
|
|
122
|
+
;<ArticleLayout
|
|
123
|
+
meta={{
|
|
124
|
+
title: 'Reading dashboards',
|
|
125
|
+
description: 'Why most internal dashboards fail the five-second glance test.',
|
|
126
|
+
date: 'Jul 16, 2026',
|
|
127
|
+
readingTime: 6,
|
|
128
|
+
}}
|
|
129
|
+
readingProgress
|
|
130
|
+
next={{ label: 'Chart guide', href: '/guides/charts' }}
|
|
131
|
+
renderLink={(target, node) => <Link to={target.href}>{node}</Link>}
|
|
132
|
+
>
|
|
133
|
+
<h2 id="setup">Setup</h2>
|
|
134
|
+
<p>…</p>
|
|
135
|
+
</ArticleLayout>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**The `renderLink` router-bridge convention** — every content component that links (`ArticleLayout`
|
|
139
|
+
prev/next, `ArticleCard`, `GuideDrawer`'s "open full page" link) takes an optional `renderLink:
|
|
140
|
+
(target, node) => ReactNode` prop. It defaults to a plain `<a href={target.href}>{node}</a>`; pass
|
|
141
|
+
a router bridge to get client-side navigation:
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
// TanStack Router
|
|
145
|
+
renderLink={(target, node) => <Link to={target.href}>{node}</Link>}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## ArticleCard / ArticleGrid — overview pages
|
|
149
|
+
|
|
150
|
+
The docs-landing card grid (StatCard-family aesthetics: panel bg, shadow-card, card radius, no
|
|
151
|
+
explicit `p`/`radius` on the underlying `Card` — the shared inset idiom). `ArticleCard` is
|
|
152
|
+
clickable three ways: `href` alone renders the card itself as an anchor; `href` + `renderLink`
|
|
153
|
+
hands it to a router bridge; `onClick` alone renders a keyboard-operable button-role card. Omit all
|
|
154
|
+
three for a static card.
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { ArticleCard, ArticleGrid } from 'basalt-ui/content'
|
|
158
|
+
import { Link } from '@tanstack/react-router'
|
|
159
|
+
;<ArticleGrid>
|
|
160
|
+
<ArticleCard
|
|
161
|
+
title="Reading dashboards"
|
|
162
|
+
description="Why most internal dashboards fail the five-second glance test."
|
|
163
|
+
meta="6 min read · guide"
|
|
164
|
+
href="/content"
|
|
165
|
+
renderLink={(target, node) => <Link to={target.href}>{node}</Link>}
|
|
166
|
+
/>
|
|
167
|
+
</ArticleGrid>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Article model — classification, sorting, filtering, search
|
|
171
|
+
|
|
172
|
+
`Article<C, T>` (`basalt-ui/content`) is the structured data model behind `ArticleCard`/
|
|
173
|
+
`ArticleLayout`: pure data + pure operators (`sortArticles`, `filterArticles`,
|
|
174
|
+
`formatArticleDate`), no React, no `@mantine/*`. It is GENERIC over the taxonomy — the framework
|
|
175
|
+
ships the shape and the operators; _which_ categories/tags exist is domain data the consumer
|
|
176
|
+
declares. This is the `VX.series` doctrine (see `packages/basalt-ui/CLAUDE.md` "Consumer-series
|
|
177
|
+
extensibility") applied to content instead of chart series. Reference implementation:
|
|
178
|
+
`apps/playground/src/demo/articles.ts` (`ARTICLE_CATEGORIES`, `ARTICLE_TAGS`, `ARTICLES satisfies
|
|
179
|
+
readonly Article<ArticleCategory, ArticleTag>[]`).
|
|
180
|
+
|
|
181
|
+
There is deliberately NO `defineArticles` factory. `satisfies readonly Article<Cat, Tag>[]` gives
|
|
182
|
+
identical inference with no import — contrast `defineSeries`, which earns its place because
|
|
183
|
+
`buildPaletteCss`/`seriesTokens` actually consume the map it returns; a plain article list has no
|
|
184
|
+
such consumer, so a factory would be a config bag with no payoff.
|
|
185
|
+
|
|
186
|
+
`date` is ISO 8601 (`'2026-07-16'`). Rendering always goes through `formatArticleDate`, which pins
|
|
187
|
+
BOTH `locale` (`'en-US'`) and `timeZone` (`'UTC'`) — both load-bearing against SSR/client hydration
|
|
188
|
+
mismatch: an unpinned zone shifts a date-only ISO string by a day depending on the runtime's UTC
|
|
189
|
+
offset, the same failure mode an unpinned locale causes on the string shape. "No date library"
|
|
190
|
+
still holds — `Intl` is a native API.
|
|
191
|
+
|
|
192
|
+
**Filter semantics** (`filterArticles`): `category` is exact-match; `tags` is ANY-OF (OR); the two
|
|
193
|
+
axes AND together — matching the existing multi-facet `filterFn` semantics in
|
|
194
|
+
`data/data-table.tsx`. An empty query returns the list unchanged.
|
|
195
|
+
|
|
196
|
+
**Filter state is URL state.** Single-select axes (category) use `createSearchParamStore`;
|
|
197
|
+
multi-select axes (tags) use `createMultiSearchParamStore` — both from `basalt-ui/router-tanstack`.
|
|
198
|
+
Two stores compose on one route by spreading both `validateSearch` results:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
// apps/playground/src/demo/article-filter-stores.ts (reference implementation in the basalt-ui repo)
|
|
202
|
+
export const articleCategory = createSearchParamStore({
|
|
203
|
+
key: 'article-category',
|
|
204
|
+
param: 'category',
|
|
205
|
+
values: ['all', ...ARTICLE_CATEGORIES] as const,
|
|
206
|
+
fallback: 'all',
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
export const articleTags = createMultiSearchParamStore({
|
|
210
|
+
key: 'article-tags',
|
|
211
|
+
param: 'tags',
|
|
212
|
+
values: ARTICLE_TAGS,
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
// routes/content-overview.tsx
|
|
216
|
+
export const Route = createFileRoute('/content-overview')({
|
|
217
|
+
validateSearch: (search) => ({
|
|
218
|
+
...articleCategory.validateSearch(search),
|
|
219
|
+
...articleTags.validateSearch(search),
|
|
220
|
+
}),
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The `'all'` sentinel is a UI concern added by the consumer, NOT an `Article`/`filterArticles`
|
|
225
|
+
concept — `filterArticles` treats `undefined`/`''` as "no constraint" and deliberately does NOT
|
|
226
|
+
special-case the string `'all'` (a consumer could legitimately have a category literally named
|
|
227
|
+
`'all'`), so the page maps `category === 'all' ? undefined : category` before calling it.
|
|
228
|
+
|
|
229
|
+
**The store/UI split is a LAYER boundary, not a style choice.** `basalt-ui/router-tanstack` is
|
|
230
|
+
headless (`@mantine/*` banned by the Mantine-free boundary), so the store itself cannot render.
|
|
231
|
+
`ArticleFilterBar` (`basalt-ui/content`) is the Mantine half: a fully controlled component wired to
|
|
232
|
+
the store pair per `createSearchParamStore`'s 5-step JSDoc recipe (the filter bar is that recipe's
|
|
233
|
+
step 3).
|
|
234
|
+
|
|
235
|
+
**`toArticleActions`** is a pure in-memory PROJECTOR into the already-shipped Spotlight command
|
|
236
|
+
surface (`basalt-ui/commands`) — the same tier as `toRouteActions`. It joins title, description,
|
|
237
|
+
category, tags, and slug into a `keywords` string for substring search; it does not tokenize, rank,
|
|
238
|
+
index, or persist. An app that outgrows substring matching over a client-side array brings its own
|
|
239
|
+
search index — see docs/CONTENT-SPEC.md §9 (Non-goals) in the basalt-ui repo.
|
|
240
|
+
|
|
241
|
+
`ArticleGrid` stays a dumb layout wrapper — deliberate, so callers keep composition (sorting,
|
|
242
|
+
filtering, and pagination all happen above it, not inside it).
|
|
243
|
+
|
|
244
|
+
**Mobile.** `ArticleFilterBar`'s category control renders a `SegmentedControl` above the `sm`
|
|
245
|
+
breakpoint and a `Select` below it, switched via Mantine's CSS-based `visibleFrom`/`hiddenFrom`
|
|
246
|
+
props — NOT `useMediaQuery`. A JS media-query hook renders differently on the server than on the
|
|
247
|
+
first client paint (the server has no viewport to query), which trips a React hydration mismatch;
|
|
248
|
+
the CSS-based switch has no such server/client branch.
|
|
249
|
+
|
|
250
|
+
## GuideLink / GuideDrawer — contextual help
|
|
251
|
+
|
|
252
|
+
The "this chart has a guide" pattern (GitLab Pajamas / Stripe-dashboard style): `GuideDrawer` is a
|
|
253
|
+
controlled right-side `Drawer` rendering an article at article density (`markdown` string via
|
|
254
|
+
`Markdown`, or `children` via `Prose`) with an optional "open full page" footer link; `GuideLink`
|
|
255
|
+
is the uncontrolled quiet trigger + drawer pair — mount it next to whatever it explains. The
|
|
256
|
+
trigger MUST read as quiet (faint ink, accent on hover) — it is never a loud primary button.
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { GuideLink } from 'basalt-ui/content'
|
|
260
|
+
|
|
261
|
+
<GuideLink
|
|
262
|
+
title="How p95 latency is measured"
|
|
263
|
+
markdown={p95GuideMarkdown}
|
|
264
|
+
fullPageHref="/guides/p95-latency"
|
|
265
|
+
/>
|
|
266
|
+
|
|
267
|
+
// Icon-only variant, for a tight chart-card header
|
|
268
|
+
<GuideLink title="How this metric works" markdown={guideMarkdown} iconOnly />
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## content-collections + TanStack Start recipe
|
|
272
|
+
|
|
273
|
+
Build-time content tooling is a **recipe, not a dependency** — `@content-collections/*` are
|
|
274
|
+
consumer devDeps, never a `basalt-ui` dependency. Resolved versions: `@content-collections/core`
|
|
275
|
+
`0.15`, `@content-collections/vite` `0.3`, `@content-collections/mdx` `0.2`. Wire the MDX runtime
|
|
276
|
+
part (`@content-collections/mdx/react`) as a regular dependency instead of a devDep if the consumer
|
|
277
|
+
does strict prod-only installs — it's imported at runtime, not just build time.
|
|
278
|
+
|
|
279
|
+
**Install:**
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
bun add -D @content-collections/core @content-collections/vite @content-collections/mdx
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**`vite.config.ts`** — the content-collections vite plugin MUST precede every other plugin (it
|
|
286
|
+
generates the virtual `content-collections` module other plugins/transforms may depend on).
|
|
287
|
+
TanStack Start (`>= 1.121`) wires it the same way:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
import { defineConfig } from 'vite'
|
|
291
|
+
import viteReact from '@vitejs/plugin-react'
|
|
292
|
+
import { contentCollections } from '@content-collections/vite'
|
|
293
|
+
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
|
|
294
|
+
|
|
295
|
+
export default defineConfig({
|
|
296
|
+
resolve: { tsconfigPaths: true }, // makes the `content-collections` tsconfig alias resolve
|
|
297
|
+
plugins: [
|
|
298
|
+
contentCollections(), // FIRST — before tanstackStart()/react()
|
|
299
|
+
tanstackStart(),
|
|
300
|
+
viteReact(), // react's vite plugin must come AFTER start's
|
|
301
|
+
],
|
|
302
|
+
})
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**`tsconfig.json`** — path alias so `import { allDocs } from 'content-collections'` resolves to the
|
|
306
|
+
generated output (picked up by `resolve.tsconfigPaths` above):
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"compilerOptions": {
|
|
311
|
+
"paths": {
|
|
312
|
+
"content-collections": ["./.content-collections/generated"]
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**`.gitignore`** — the generated output is build tooling, not source:
|
|
319
|
+
|
|
320
|
+
```
|
|
321
|
+
.content-collections
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**`content-collections.ts`** — a Standard Schema definition (a plain zod object works directly;
|
|
325
|
+
`content: z.string()` is required by the frontmatter parser) plus an MDX `transform` that compiles
|
|
326
|
+
the body once at build time:
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
import { defineCollection, defineConfig } from '@content-collections/core'
|
|
330
|
+
import { compileMDX } from '@content-collections/mdx'
|
|
331
|
+
import { z } from 'zod'
|
|
332
|
+
|
|
333
|
+
const docs = defineCollection({
|
|
334
|
+
name: 'docs',
|
|
335
|
+
directory: 'content/docs',
|
|
336
|
+
include: '**/*.mdx',
|
|
337
|
+
schema: (z) => ({
|
|
338
|
+
title: z.string(),
|
|
339
|
+
description: z.string().optional(),
|
|
340
|
+
date: z.string().optional(),
|
|
341
|
+
content: z.string(),
|
|
342
|
+
}),
|
|
343
|
+
transform: async (doc, ctx) => ({
|
|
344
|
+
...doc,
|
|
345
|
+
mdx: await compileMDX(ctx, doc),
|
|
346
|
+
}),
|
|
347
|
+
})
|
|
348
|
+
|
|
349
|
+
export default defineConfig({ collections: [docs] })
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**The page/route** — `MDXContent` from `@content-collections/mdx/react` renders the compiled body
|
|
353
|
+
onto `mdxComponents`, wrapped in `ArticleLayout` for the full docs-page frame:
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
import { allDocs } from 'content-collections'
|
|
357
|
+
import { MDXContent } from '@content-collections/mdx/react'
|
|
358
|
+
import { ArticleLayout } from 'basalt-ui/content'
|
|
359
|
+
import { mdxComponents } from 'basalt-ui/content'
|
|
360
|
+
import { Link } from '@tanstack/react-router'
|
|
361
|
+
|
|
362
|
+
const doc = allDocs.find((d) => d.slug === slug)
|
|
363
|
+
|
|
364
|
+
<ArticleLayout
|
|
365
|
+
meta={{ title: doc.title, description: doc.description, date: doc.date }}
|
|
366
|
+
renderLink={(target, node) => <Link to={target.href}>{node}</Link>}
|
|
367
|
+
>
|
|
368
|
+
<MDXContent code={doc.mdx} components={mdxComponents} />
|
|
369
|
+
</ArticleLayout>
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**Wiring articles into Spotlight** — `allDocs` is a typed article list; map it into page actions the
|
|
373
|
+
same way the shell's own nav model does, via `toRouteActions` (`basalt-ui/commands`) so every
|
|
374
|
+
article is instantly searchable without a separate search index:
|
|
375
|
+
|
|
376
|
+
```ts
|
|
377
|
+
import { allDocs } from 'content-collections'
|
|
378
|
+
import { toRouteActions } from 'basalt-ui/commands'
|
|
379
|
+
|
|
380
|
+
const articleActions = toRouteActions(
|
|
381
|
+
allDocs.map((doc) => ({ key: doc.slug, label: doc.title, href: `/docs/${doc.slug}` })),
|
|
382
|
+
{ navigate },
|
|
383
|
+
)
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Escape hatches / non-goals
|
|
387
|
+
|
|
388
|
+
KaTeX/math, full mermaid grammar bundling (d2, pintora), Vega-Lite streamed specs, versioned docs/
|
|
389
|
+
i18n routing, and a `create-basalt-docs` scaffold are all out of scope for 1.0 — see
|
|
390
|
+
`docs/CONTENT-SPEC.md` §9 in the basalt-ui repo for the full non-goals list and rationale.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: basalt-ui
|
|
3
|
+
description: Data table and virtual list adapter battery from basalt-ui/data — BasaltDataTable (sortable TanStack Table + Mantine Table) and BasaltVirtualList (TanStack Virtual + Mantine Box). Both packages are optional peers.
|
|
4
|
+
paths:
|
|
5
|
+
- 'src/**'
|
|
6
|
+
- 'apps/**/src/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Basalt Data
|
|
10
|
+
|
|
11
|
+
basalt-ui ships `./data` — a Mantine-coupled data adapter battery providing `BasaltDataTable` and
|
|
12
|
+
`BasaltVirtualList` backed by headless TanStack Table and TanStack Virtual respectively. Both
|
|
13
|
+
optional peers must be installed before use:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add @tanstack/react-table @tanstack/react-virtual
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## BasaltDataTable
|
|
20
|
+
|
|
21
|
+
A generic sortable data table over `@tanstack/react-table`, rendered with Mantine `Table`
|
|
22
|
+
primitives (`Table.Thead/Tbody/Tr/Th/Td`). Client-side sorting is built in via `useState`; no
|
|
23
|
+
server-side wiring required.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { BasaltDataTable, createColumnHelper } from 'basalt-ui/data'
|
|
27
|
+
|
|
28
|
+
type User = { name: string; email: string; age: number }
|
|
29
|
+
|
|
30
|
+
const col = createColumnHelper<User>()
|
|
31
|
+
const columns = [
|
|
32
|
+
col.accessor('name', { header: 'Name' }),
|
|
33
|
+
col.accessor('email', { header: 'Email' }),
|
|
34
|
+
col.accessor('age', { header: 'Age' }),
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
<BasaltDataTable
|
|
38
|
+
data={users}
|
|
39
|
+
columns={columns}
|
|
40
|
+
enableSorting // default true — clickable sort headers with ↑/↓ indicators
|
|
41
|
+
striped
|
|
42
|
+
highlightOnHover
|
|
43
|
+
emptyState={<Text c="dimmed">No users found.</Text>}
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Props
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Notes |
|
|
50
|
+
| ------------------ | --------------------------- | -------- | ------------------------------------------------------ |
|
|
51
|
+
| `data` | `T[]` | required | Row data array |
|
|
52
|
+
| `columns` | `ColumnDef<T>[]` | required | TanStack column definitions |
|
|
53
|
+
| `enableSorting` | `boolean` | `true` | Clickable headers, asc/desc toggle |
|
|
54
|
+
| `striped` | `boolean` | — | Forwarded to Mantine `Table` |
|
|
55
|
+
| `highlightOnHover` | `boolean` | — | Forwarded to Mantine `Table` |
|
|
56
|
+
| `emptyState` | `ReactNode` | — | Shown when `data` is empty and not loading |
|
|
57
|
+
| `isLoading` | `boolean` | `false` | Shows skeleton rows instead of empty-state/data |
|
|
58
|
+
| `skeletonRows` | `number` | `5` | Number of skeleton rows when `isLoading` is true |
|
|
59
|
+
| `initialSorting` | `SortingState` | `[]` | Initial sort state; drives `useState` initializer |
|
|
60
|
+
| `onSortingChange` | `(s: SortingState) => void` | — | Called whenever sorting changes; omit for uncontrolled |
|
|
61
|
+
|
|
62
|
+
### Controlled sorting and URL sync
|
|
63
|
+
|
|
64
|
+
`initialSorting` seeds the internal `useState` and `onSortingChange` is called on every sort
|
|
65
|
+
change — the table stays internally managed (uncontrolled) when `onSortingChange` is omitted.
|
|
66
|
+
|
|
67
|
+
To sync sort state with TanStack Router search params:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { type SortingState } from 'basalt-ui/data'
|
|
71
|
+
|
|
72
|
+
// In the route definition (validated search params):
|
|
73
|
+
// sortBy: z.string().optional(), sortDir: z.enum(['asc','desc']).optional()
|
|
74
|
+
|
|
75
|
+
function UsersTable() {
|
|
76
|
+
const { sortBy, sortDir } = Route.useSearch()
|
|
77
|
+
const navigate = Route.useNavigate()
|
|
78
|
+
|
|
79
|
+
const initialSorting: SortingState = sortBy ? [{ id: sortBy, desc: sortDir === 'desc' }] : []
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<BasaltDataTable
|
|
83
|
+
data={users}
|
|
84
|
+
columns={columns}
|
|
85
|
+
initialSorting={initialSorting}
|
|
86
|
+
onSortingChange={(s) => {
|
|
87
|
+
const col = s[0]
|
|
88
|
+
navigate({
|
|
89
|
+
search: (prev) => ({
|
|
90
|
+
...prev,
|
|
91
|
+
sortBy: col?.id,
|
|
92
|
+
sortDir: col?.desc ? 'desc' : 'asc',
|
|
93
|
+
}),
|
|
94
|
+
})
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Column definitions
|
|
102
|
+
|
|
103
|
+
Use `createColumnHelper<T>()` (re-exported from `basalt-ui/data`) for a typed accessor builder.
|
|
104
|
+
`ColumnDef<T>` is generic over the row type only — `TValue` defaults to `unknown`, so no `any`
|
|
105
|
+
is needed.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { createColumnHelper, type ColumnDef } from 'basalt-ui/data'
|
|
109
|
+
|
|
110
|
+
type Row = { id: number; label: string }
|
|
111
|
+
const col = createColumnHelper<Row>()
|
|
112
|
+
|
|
113
|
+
// Accessor column — infers the value type from the key
|
|
114
|
+
col.accessor('label', { header: 'Label' })
|
|
115
|
+
|
|
116
|
+
// Display column — custom renderer, no accessor
|
|
117
|
+
col.display({ id: 'actions', header: 'Actions', cell: (ctx) => <Button>Delete {ctx.row.original.id}</Button> })
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### No `any`
|
|
121
|
+
|
|
122
|
+
`ColumnDef<T>` defaults `TValue` to `unknown`, not `any`. Never cast column defs to `any` — use
|
|
123
|
+
the correct `ColumnDef<T>` type or `ColumnDef<T, unknown>`.
|
|
124
|
+
|
|
125
|
+
### Deferred for later versions
|
|
126
|
+
|
|
127
|
+
The 1.0 table ships sorting only. Natural extensions are **not** in scope yet:
|
|
128
|
+
|
|
129
|
+
- Filtering (column or global search)
|
|
130
|
+
- Pagination (client-side or server-side)
|
|
131
|
+
- Row selection (checkboxes)
|
|
132
|
+
- Row expansion / sub-rows
|
|
133
|
+
|
|
134
|
+
Add them when a concrete consumer need arises; keep the API additive. Controlled (fully external)
|
|
135
|
+
sorting for `BasaltDataTable` itself is likewise deferred — `onSortingChange` above is the current
|
|
136
|
+
sync seam.
|
|
137
|
+
|
|
138
|
+
### The blessed lane vs the raw escape hatch
|
|
139
|
+
|
|
140
|
+
`BasaltDataTable` (from `basalt-ui/data/table`) is the **blessed, opinionated grid** — batteries
|
|
141
|
+
included (sorting, loading skeletons, empty state, Mantine `Table` chrome) and the default choice
|
|
142
|
+
for a data grid in a basalt-ui app.
|
|
143
|
+
|
|
144
|
+
For a bespoke table shape `BasaltDataTable` doesn't cover, `basalt-ui/data/table` also re-exports
|
|
145
|
+
the raw TanStack Table primitives as the documented **escape hatch**: `useReactTable`, `flexRender`,
|
|
146
|
+
`getCoreRowModel`, `getSortedRowModel`, `createColumnHelper`, and the `ColumnDef` type — the full
|
|
147
|
+
surface for constructing and rendering a fully custom table, with no direct `@tanstack/react-table`
|
|
148
|
+
import in consumer code:
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import {
|
|
152
|
+
createColumnHelper,
|
|
153
|
+
flexRender,
|
|
154
|
+
getCoreRowModel,
|
|
155
|
+
useReactTable,
|
|
156
|
+
} from 'basalt-ui/data/table'
|
|
157
|
+
|
|
158
|
+
type Row = { name: string; score: number }
|
|
159
|
+
const col = createColumnHelper<Row>()
|
|
160
|
+
const columns = [
|
|
161
|
+
col.accessor('name', { header: 'Name' }),
|
|
162
|
+
col.accessor('score', { header: 'Score' }),
|
|
163
|
+
]
|
|
164
|
+
|
|
165
|
+
const table = useReactTable({ data: rows, columns, getCoreRowModel: getCoreRowModel() })
|
|
166
|
+
// table.getHeaderGroups() / table.getRowModel().rows, rendered with flexRender(...) and your own markup
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Reach for the escape hatch only when `BasaltDataTable`'s props genuinely can't express the shape —
|
|
170
|
+
grid feature growth (pagination, server-side data, column visibility, filtering) is consumer-pulled
|
|
171
|
+
future work, not a reason to bypass the blessed lane by default.
|
|
172
|
+
|
|
173
|
+
## BasaltVirtualList
|
|
174
|
+
|
|
175
|
+
A windowed virtual list backed by TanStack Virtual, rendered inside a Mantine `Box` scroll
|
|
176
|
+
container. Only the visible rows plus `overscan` are in the DOM at any time — suitable for lists
|
|
177
|
+
of 1 000+ items.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { Box } from '@mantine/core'
|
|
181
|
+
import { VX } from 'basalt-ui/tokens'
|
|
182
|
+
import { BasaltVirtualList } from 'basalt-ui/data'
|
|
183
|
+
|
|
184
|
+
const items = Array.from({ length: 10_000 }, (_, i) => ({ id: i, name: `Row ${i}` }))
|
|
185
|
+
|
|
186
|
+
<BasaltVirtualList
|
|
187
|
+
items={items}
|
|
188
|
+
height={400}
|
|
189
|
+
estimateSize={40}
|
|
190
|
+
overscan={5}
|
|
191
|
+
renderItem={(item, index) => (
|
|
192
|
+
<Box px="sm" py={8} style={{ borderBottom: `1px solid ${VX.divider}` }}>
|
|
193
|
+
{index + 1}. {item.name}
|
|
194
|
+
</Box>
|
|
195
|
+
)}
|
|
196
|
+
getItemKey={(item) => item.id}
|
|
197
|
+
/>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Props
|
|
201
|
+
|
|
202
|
+
| Prop | Type | Default | Notes |
|
|
203
|
+
| -------------- | ---------------------------------------------- | -------- | ------------------------------------------------- |
|
|
204
|
+
| `items` | `T[]` | required | Full unsliced item list |
|
|
205
|
+
| `height` | `number \| string` | required | Scroll container height (px number or CSS string) |
|
|
206
|
+
| `estimateSize` | `number` | `40` | Estimated row height for layout (px) |
|
|
207
|
+
| `overscan` | `number` | `5` | Extra rows rendered beyond visible viewport |
|
|
208
|
+
| `renderItem` | `(item: T, index: number) => ReactNode` | required | Row render function |
|
|
209
|
+
| `getItemKey` | `(item: T, index: number) => string \| number` | — | Stable key (defaults to index) |
|
|
210
|
+
| `isLoading` | `boolean` | `false` | Shows skeleton rows at `estimateSize` height |
|
|
211
|
+
| `skeletonRows` | `number` | `5` | Number of skeleton rows when `isLoading` is true |
|
|
212
|
+
|
|
213
|
+
### useFlushSync: false (React 19)
|
|
214
|
+
|
|
215
|
+
Always pass `useFlushSync: false` to `useVirtualizer`. TanStack Virtual internally calls the
|
|
216
|
+
deprecated `flushSync` on scroll events; this opt-out disables that path and is required for React
|
|
217
|
+
19+ apps (silences a runtime warning). `BasaltVirtualList` sets this automatically — do not
|
|
218
|
+
override it.
|
|
219
|
+
|
|
220
|
+
### Absolute-position transform pattern
|
|
221
|
+
|
|
222
|
+
The virtual list uses the canonical TanStack Virtual render pattern:
|
|
223
|
+
|
|
224
|
+
1. **Scroll container** — fixed height, `overflow: auto`, holds a `ref` passed to `getScrollElement`.
|
|
225
|
+
2. **Inner sizer div** — height equals `getTotalSize()`, position `relative` — defines the total
|
|
226
|
+
scrollable area without rendering all rows.
|
|
227
|
+
3. **Virtual rows** — absolutely positioned (`position: absolute`, `top: 0`, `left: 0`) with
|
|
228
|
+
`transform: translateY(vi.start)` — each row "jumps" to its virtual position without relayout.
|
|
229
|
+
|
|
230
|
+
Never use `margin-top` or `top: vi.start` for positioning — the `transform` approach avoids
|
|
231
|
+
layout reflow and is the canonical pattern for TanStack Virtual.
|
|
232
|
+
|
|
233
|
+
### When to virtualize
|
|
234
|
+
|
|
235
|
+
Use `BasaltVirtualList` when the list exceeds ~200 rows. Below that, a plain Mantine `Stack` or
|
|
236
|
+
`Table` is cheaper (no virtualizer overhead, simpler DOM, easier accessibility). Above ~1 000
|
|
237
|
+
rows, virtualization is essential for scroll performance.
|