basalt-ui 0.3.0 → 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 +216 -26
- 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 +246 -37
- 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 -986
- package/src/starlight.css +0 -308
- package/tailwind.config.js +0 -78
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PartList — exhaustively renders a list of AgentPart values using an overridable renderer map.
|
|
3
|
+
*
|
|
4
|
+
* The exhaustive switch with a `default: assertNever(part)` case guarantees that adding a new
|
|
5
|
+
* AgentPart variant without updating this file (or the consumer's override map) is a tsc error.
|
|
6
|
+
*
|
|
7
|
+
* All default renderers are headless — plain HTML elements with className hooks, zero Mantine.
|
|
8
|
+
* Consumers can override any or all renderers via the `components` prop. `PartList` itself stays
|
|
9
|
+
* headless — the markdown renderer is the consumer's choice; basalt's own is `basalt-ui/content`'s
|
|
10
|
+
* `Markdown`.
|
|
11
|
+
*
|
|
12
|
+
* The text renderer defaults to plain text (className="basalt-agent-text"). To render rich
|
|
13
|
+
* markdown, pass a custom text renderer:
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { PartList } from 'basalt-ui/agent'
|
|
17
|
+
* import { Markdown } from 'basalt-ui/content'
|
|
18
|
+
*
|
|
19
|
+
* <PartList
|
|
20
|
+
* parts={parts}
|
|
21
|
+
* components={{
|
|
22
|
+
* text: ({ part }) => <Markdown streaming density="chat">{part.text}</Markdown>,
|
|
23
|
+
* }}
|
|
24
|
+
* />
|
|
25
|
+
*/
|
|
26
|
+
import { Fragment, useMemo } from 'react'
|
|
27
|
+
import type { JSX } from 'react'
|
|
28
|
+
import { assertNever } from '../register'
|
|
29
|
+
import { alpha, VX } from '../tokens'
|
|
30
|
+
import type {
|
|
31
|
+
AgentPart,
|
|
32
|
+
ErrorPart,
|
|
33
|
+
ReasoningPart,
|
|
34
|
+
SourcePart,
|
|
35
|
+
TextPart,
|
|
36
|
+
ToolCallPart,
|
|
37
|
+
} from './parts'
|
|
38
|
+
|
|
39
|
+
// ── Per-type renderer signatures ──────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
export type TextPartRenderer<TPart extends AgentPart = AgentPart> = (props: {
|
|
42
|
+
part: Extract<TPart, { type: 'text' }>
|
|
43
|
+
index: number
|
|
44
|
+
}) => JSX.Element | null
|
|
45
|
+
|
|
46
|
+
export type ReasoningPartRenderer<TPart extends AgentPart = AgentPart> = (props: {
|
|
47
|
+
part: Extract<TPart, { type: 'reasoning' }>
|
|
48
|
+
index: number
|
|
49
|
+
}) => JSX.Element | null
|
|
50
|
+
|
|
51
|
+
export type ToolCallPartRenderer<TPart extends AgentPart = AgentPart> = (props: {
|
|
52
|
+
part: Extract<TPart, { type: 'tool' }>
|
|
53
|
+
index: number
|
|
54
|
+
}) => JSX.Element | null
|
|
55
|
+
|
|
56
|
+
export type SourcePartRenderer<TPart extends AgentPart = AgentPart> = (props: {
|
|
57
|
+
part: Extract<TPart, { type: 'source' }>
|
|
58
|
+
index: number
|
|
59
|
+
}) => JSX.Element | null
|
|
60
|
+
|
|
61
|
+
export type ErrorPartRenderer<TPart extends AgentPart = AgentPart> = (props: {
|
|
62
|
+
part: Extract<TPart, { type: 'error' }>
|
|
63
|
+
index: number
|
|
64
|
+
}) => JSX.Element | null
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Partial map of per-type renderers. Any omitted key falls back to the headless default.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* const renderers: Partial<AgentPartRenderers> = {
|
|
71
|
+
* text: ({ part }) => <Markdown streaming density="chat">{part.text}</Markdown>,
|
|
72
|
+
* }
|
|
73
|
+
*/
|
|
74
|
+
export type AgentPartRenderers<TPart extends AgentPart = AgentPart> = {
|
|
75
|
+
readonly text: TextPartRenderer<TPart>
|
|
76
|
+
readonly reasoning: ReasoningPartRenderer<TPart>
|
|
77
|
+
readonly tool: ToolCallPartRenderer<TPart>
|
|
78
|
+
readonly source: SourcePartRenderer<TPart>
|
|
79
|
+
readonly error: ErrorPartRenderer<TPart>
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ── Default headless renderers ────────────────────────────────────────────────
|
|
83
|
+
//
|
|
84
|
+
// Styled inline with `VX.*` / `alpha()` (never raw hex) so a bare consumer — one that renders
|
|
85
|
+
// `PartList` with no `components` override — still gets the on-brand look, not unstyled HTML.
|
|
86
|
+
// className hooks are kept alongside so a consumer's own CSS can still target/override each part.
|
|
87
|
+
|
|
88
|
+
/** Mono, uppercase, letter-spaced micro-label idiom (docs/DESIGN-SPEC.md §3) — reasoning/tool
|
|
89
|
+
* headers below. */
|
|
90
|
+
const MICRO_LABEL_STYLE = {
|
|
91
|
+
fontFamily: 'var(--basalt-font-mono)',
|
|
92
|
+
fontSize: VX.text.micro,
|
|
93
|
+
fontWeight: 500,
|
|
94
|
+
letterSpacing: '0.06em',
|
|
95
|
+
textTransform: 'uppercase',
|
|
96
|
+
color: VX.faint,
|
|
97
|
+
} as const
|
|
98
|
+
|
|
99
|
+
/** Faint left divider rail (docs/DESIGN-SPEC.md §5) — reasoning/tool-call parts read as transcript
|
|
100
|
+
* asides, not surfaces. */
|
|
101
|
+
const RAIL_STYLE = { borderLeft: `2px solid ${VX.divider}`, paddingLeft: 10 } as const
|
|
102
|
+
|
|
103
|
+
const CODE_BLOCK_STYLE = {
|
|
104
|
+
marginTop: 6,
|
|
105
|
+
fontFamily: 'var(--basalt-font-mono)',
|
|
106
|
+
backgroundColor: alpha(VX.ink, 0.06),
|
|
107
|
+
borderRadius: 8,
|
|
108
|
+
padding: 8,
|
|
109
|
+
overflowX: 'auto',
|
|
110
|
+
} as const
|
|
111
|
+
|
|
112
|
+
function DefaultText({ part }: { part: TextPart; index: number }): JSX.Element {
|
|
113
|
+
return (
|
|
114
|
+
<div
|
|
115
|
+
className="basalt-agent-text"
|
|
116
|
+
style={{ color: VX.ink, fontFamily: 'var(--basalt-font-sans)' }}
|
|
117
|
+
>
|
|
118
|
+
{part.text}
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function DefaultReasoning({ part }: { part: ReasoningPart; index: number }): JSX.Element {
|
|
124
|
+
return (
|
|
125
|
+
<details className="basalt-agent-reasoning" style={RAIL_STYLE}>
|
|
126
|
+
<summary
|
|
127
|
+
className="basalt-agent-reasoning-summary"
|
|
128
|
+
style={{ ...MICRO_LABEL_STYLE, cursor: 'pointer' }}
|
|
129
|
+
>
|
|
130
|
+
Reasoning
|
|
131
|
+
</summary>
|
|
132
|
+
<div className="basalt-agent-reasoning-body" style={{ color: VX.muted, marginTop: 6 }}>
|
|
133
|
+
{part.text}
|
|
134
|
+
</div>
|
|
135
|
+
</details>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function DefaultToolCall({ part }: { part: ToolCallPart; index: number }): JSX.Element {
|
|
140
|
+
return (
|
|
141
|
+
<div className="basalt-agent-tool" style={RAIL_STYLE}>
|
|
142
|
+
<span className="basalt-agent-tool-name" style={MICRO_LABEL_STYLE}>
|
|
143
|
+
{part.toolName}
|
|
144
|
+
</span>
|
|
145
|
+
<pre className="basalt-agent-tool-input" style={CODE_BLOCK_STYLE}>
|
|
146
|
+
{JSON.stringify(part.input, null, 2)}
|
|
147
|
+
</pre>
|
|
148
|
+
{part.output !== undefined && (
|
|
149
|
+
<pre className="basalt-agent-tool-output" style={CODE_BLOCK_STYLE}>
|
|
150
|
+
{JSON.stringify(part.output, null, 2)}
|
|
151
|
+
</pre>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function DefaultSource({ part }: { part: SourcePart; index: number }): JSX.Element {
|
|
158
|
+
return (
|
|
159
|
+
<a
|
|
160
|
+
className="basalt-agent-source"
|
|
161
|
+
href={part.url}
|
|
162
|
+
target="_blank"
|
|
163
|
+
rel="noopener noreferrer"
|
|
164
|
+
style={{ color: VX.accent }}
|
|
165
|
+
>
|
|
166
|
+
{part.title ?? part.url}
|
|
167
|
+
</a>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function DefaultError({ part }: { part: ErrorPart; index: number }): JSX.Element {
|
|
172
|
+
return (
|
|
173
|
+
<div
|
|
174
|
+
className="basalt-agent-error"
|
|
175
|
+
role="alert"
|
|
176
|
+
style={{
|
|
177
|
+
backgroundColor: alpha(VX.status.bad, 0.13),
|
|
178
|
+
color: VX.status.bad,
|
|
179
|
+
borderRadius: 8,
|
|
180
|
+
padding: '8px 10px',
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
{part.message}
|
|
184
|
+
</div>
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const DEFAULT_RENDERERS: AgentPartRenderers = {
|
|
189
|
+
text: DefaultText,
|
|
190
|
+
reasoning: DefaultReasoning,
|
|
191
|
+
tool: DefaultToolCall,
|
|
192
|
+
source: DefaultSource,
|
|
193
|
+
error: DefaultError,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ── PartList ──────────────────────────────────────────────────────────────────
|
|
197
|
+
|
|
198
|
+
export type PartListProps<TPart extends AgentPart = AgentPart> = {
|
|
199
|
+
/** The parts accumulator from useAgentStream. */
|
|
200
|
+
readonly parts: TPart[]
|
|
201
|
+
/**
|
|
202
|
+
* Override individual part renderers. Omitted keys fall back to the headless defaults.
|
|
203
|
+
* Pass `{ text: ({ part }) => <Markdown streaming density="chat">{part.text}</Markdown> }` to
|
|
204
|
+
* enable rich markdown rendering.
|
|
205
|
+
*/
|
|
206
|
+
readonly components?: Partial<AgentPartRenderers<TPart>>
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Renders a list of AgentPart values via an exhaustive switch over part.type.
|
|
211
|
+
*
|
|
212
|
+
* The `default: assertNever(part)` branch ensures that adding a new AgentPart variant is a tsc
|
|
213
|
+
* error unless every switch consuming AgentPart is updated. Headless — zero Mantine imports.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* import { PartList } from 'basalt-ui/agent'
|
|
217
|
+
* <PartList parts={parts} />
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* // With basalt's own Markdown for the text renderer:
|
|
221
|
+
* import { PartList } from 'basalt-ui/agent'
|
|
222
|
+
* import { Markdown } from 'basalt-ui/content'
|
|
223
|
+
* <PartList parts={parts} components={{ text: ({ part }) => <Markdown streaming density="chat">{part.text}</Markdown> }} />
|
|
224
|
+
*/
|
|
225
|
+
export function PartList<TPart extends AgentPart = AgentPart>({
|
|
226
|
+
parts,
|
|
227
|
+
components,
|
|
228
|
+
}: PartListProps<TPart>): JSX.Element {
|
|
229
|
+
// Memoised to avoid rebuilding the renderer map on every streaming re-render (hot path).
|
|
230
|
+
// Cast required because DEFAULT_RENDERERS is typed for the base AgentPart, not the generic TPart.
|
|
231
|
+
const renderers = useMemo(
|
|
232
|
+
() => ({ ...DEFAULT_RENDERERS, ...components }) as AgentPartRenderers<TPart>,
|
|
233
|
+
[components],
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<Fragment>
|
|
238
|
+
{parts.map((part, index) => {
|
|
239
|
+
// The exhaustive switch: `default: assertNever(part)` is the tsc gate.
|
|
240
|
+
// If a new AgentPart variant is added without a case here, tsc errors.
|
|
241
|
+
switch (part.type) {
|
|
242
|
+
case 'start':
|
|
243
|
+
// Not renderable content — a no-op signal (run id + resume token).
|
|
244
|
+
return null
|
|
245
|
+
case 'text': {
|
|
246
|
+
const Render = renderers.text
|
|
247
|
+
return (
|
|
248
|
+
<Fragment key={index}>
|
|
249
|
+
<Render part={part as Extract<TPart, { type: 'text' }>} index={index} />
|
|
250
|
+
</Fragment>
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
case 'reasoning': {
|
|
254
|
+
const Render = renderers.reasoning
|
|
255
|
+
return (
|
|
256
|
+
<Fragment key={index}>
|
|
257
|
+
<Render part={part as Extract<TPart, { type: 'reasoning' }>} index={index} />
|
|
258
|
+
</Fragment>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
case 'tool': {
|
|
262
|
+
const Render = renderers.tool
|
|
263
|
+
return (
|
|
264
|
+
<Fragment key={index}>
|
|
265
|
+
<Render part={part as Extract<TPart, { type: 'tool' }>} index={index} />
|
|
266
|
+
</Fragment>
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
case 'source': {
|
|
270
|
+
const Render = renderers.source
|
|
271
|
+
return (
|
|
272
|
+
<Fragment key={index}>
|
|
273
|
+
<Render part={part as Extract<TPart, { type: 'source' }>} index={index} />
|
|
274
|
+
</Fragment>
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
case 'error': {
|
|
278
|
+
const Render = renderers.error
|
|
279
|
+
return (
|
|
280
|
+
<Fragment key={index}>
|
|
281
|
+
<Render part={part as Extract<TPart, { type: 'error' }>} index={index} />
|
|
282
|
+
</Fragment>
|
|
283
|
+
)
|
|
284
|
+
}
|
|
285
|
+
default:
|
|
286
|
+
// This line is a tsc error if any AgentPart variant is unhandled above.
|
|
287
|
+
return assertNever(part)
|
|
288
|
+
}
|
|
289
|
+
})}
|
|
290
|
+
</Fragment>
|
|
291
|
+
)
|
|
292
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentPart — the discriminated union describing all structured parts emitted by an agent stream.
|
|
3
|
+
*
|
|
4
|
+
* Exhaustiveness is enforced at every switch via assertNever (imported from '../register').
|
|
5
|
+
* Adding a new variant without a matching case is a tsc error — see the fixture in
|
|
6
|
+
* apps/playground/src/demo/agent-part.type-guard.ts.
|
|
7
|
+
*
|
|
8
|
+
* Eden #231 doctrine: the server-side Elysia route MUST declare `: AsyncGenerator<AgentPart>`
|
|
9
|
+
* explicitly and carry NO t.Object/t.Union response schema. Validate at yield-time. See
|
|
10
|
+
* agent/rules/basalt-agent.md for the full doctrine.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import type { AgentPart } from 'basalt-ui/agent'
|
|
14
|
+
* function describe(p: AgentPart): string {
|
|
15
|
+
* switch (p.type) {
|
|
16
|
+
* case 'start': return `[start] ${p.runId}`
|
|
17
|
+
* case 'text': return p.text
|
|
18
|
+
* case 'reasoning': return `[think] ${p.text}`
|
|
19
|
+
* case 'tool': return `[tool] ${p.toolName}`
|
|
20
|
+
* case 'source': return p.url
|
|
21
|
+
* case 'error': return `[err] ${p.message}`
|
|
22
|
+
* default: return assertNever(p)
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
// ── AgentPart discriminated union ────────────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Emitted once at stream start, carrying the run id and an opaque token a transport can use to
|
|
31
|
+
* resume this run after a disconnect. Not renderable content — UI code should treat it as a
|
|
32
|
+
* no-op signal, not conversation content.
|
|
33
|
+
*/
|
|
34
|
+
export type StartPart = {
|
|
35
|
+
readonly type: 'start'
|
|
36
|
+
readonly runId: string
|
|
37
|
+
readonly resumeToken?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A streamed text fragment from the assistant. */
|
|
41
|
+
export type TextPart = { readonly type: 'text'; readonly text: string }
|
|
42
|
+
|
|
43
|
+
/** An internal reasoning/thinking fragment (may be hidden in the UI). */
|
|
44
|
+
export type ReasoningPart = { readonly type: 'reasoning'; readonly text: string }
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A tool invocation — input is the parameters sent, output (optional) is the result once
|
|
48
|
+
* the tool has completed. Streams arrive with output undefined; it may be appended later.
|
|
49
|
+
*
|
|
50
|
+
* `toolCallId` (optional) identifies the specific invocation when a transport's wire format
|
|
51
|
+
* carries one (e.g. AI SDK's `ToolUIPart`) — useful for consumer-side coalescing of a tool call's
|
|
52
|
+
* input/output pair by id rather than by array position.
|
|
53
|
+
*/
|
|
54
|
+
export type ToolCallPart = {
|
|
55
|
+
readonly type: 'tool'
|
|
56
|
+
readonly toolName: string
|
|
57
|
+
readonly input: unknown
|
|
58
|
+
readonly output?: unknown
|
|
59
|
+
readonly toolCallId?: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A cited source URL referenced by the assistant. */
|
|
63
|
+
export type SourcePart = { readonly type: 'source'; readonly url: string; readonly title?: string }
|
|
64
|
+
|
|
65
|
+
/** A fatal or recoverable error emitted in-stream by the agent. */
|
|
66
|
+
export type ErrorPart = { readonly type: 'error'; readonly message: string }
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The complete discriminated union of all structured agent stream parts.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* const part: AgentPart = { type: 'text', text: 'Hello' }
|
|
73
|
+
*/
|
|
74
|
+
export type AgentPart = StartPart | TextPart | ReasoningPart | ToolCallPart | SourcePart | ErrorPart
|
|
75
|
+
|
|
76
|
+
// ── parseAgentPart ───────────────────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Runtime type-narrowing guard: validates an unknown value against the AgentPart discriminated
|
|
80
|
+
* union and returns the narrowed type or null when validation fails.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const raw = JSON.parse(line)
|
|
84
|
+
* const part = parseAgentPart(raw)
|
|
85
|
+
* if (part !== null) handlePart(part)
|
|
86
|
+
*/
|
|
87
|
+
export function parseAgentPart(raw: unknown): AgentPart | null {
|
|
88
|
+
if (raw === null || typeof raw !== 'object') return null
|
|
89
|
+
const obj = raw as Record<string, unknown>
|
|
90
|
+
if (typeof obj['type'] !== 'string') return null
|
|
91
|
+
|
|
92
|
+
switch (obj['type']) {
|
|
93
|
+
case 'start':
|
|
94
|
+
if (typeof obj['runId'] !== 'string') return null
|
|
95
|
+
return {
|
|
96
|
+
type: 'start',
|
|
97
|
+
runId: obj['runId'],
|
|
98
|
+
...(typeof obj['resumeToken'] === 'string' ? { resumeToken: obj['resumeToken'] } : {}),
|
|
99
|
+
}
|
|
100
|
+
case 'text':
|
|
101
|
+
if (typeof obj['text'] !== 'string') return null
|
|
102
|
+
return { type: 'text', text: obj['text'] }
|
|
103
|
+
case 'reasoning':
|
|
104
|
+
if (typeof obj['text'] !== 'string') return null
|
|
105
|
+
return { type: 'reasoning', text: obj['text'] }
|
|
106
|
+
case 'tool':
|
|
107
|
+
if (typeof obj['toolName'] !== 'string') return null
|
|
108
|
+
if (!('input' in obj)) return null
|
|
109
|
+
return {
|
|
110
|
+
type: 'tool',
|
|
111
|
+
toolName: obj['toolName'],
|
|
112
|
+
input: obj['input'],
|
|
113
|
+
...(obj['output'] !== undefined ? { output: obj['output'] } : {}),
|
|
114
|
+
...(typeof obj['toolCallId'] === 'string' ? { toolCallId: obj['toolCallId'] } : {}),
|
|
115
|
+
}
|
|
116
|
+
case 'source':
|
|
117
|
+
if (typeof obj['url'] !== 'string') return null
|
|
118
|
+
return {
|
|
119
|
+
type: 'source',
|
|
120
|
+
url: obj['url'],
|
|
121
|
+
...(typeof obj['title'] === 'string' ? { title: obj['title'] } : {}),
|
|
122
|
+
}
|
|
123
|
+
case 'error':
|
|
124
|
+
if (typeof obj['message'] !== 'string') return null
|
|
125
|
+
return { type: 'error', message: obj['message'] }
|
|
126
|
+
default:
|
|
127
|
+
return null
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ── isStartPart ──────────────────────────────────────────────────────────────
|
|
132
|
+
|
|
133
|
+
/** Type guard: narrows an unknown value to StartPart. */
|
|
134
|
+
export function isStartPart(part: unknown): part is StartPart {
|
|
135
|
+
return typeof part === 'object' && part !== null && (part as { type?: unknown }).type === 'start'
|
|
136
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BasaltStickToBottom — thin lazy wrapper over use-stick-to-bottom providing chat auto-scroll.
|
|
3
|
+
*
|
|
4
|
+
* LAZY-LOADED: use-stick-to-bottom is an OPTIONAL peer. This module uses React.lazy + dynamic
|
|
5
|
+
* import() so importing 'basalt-ui/agent' does NOT eagerly resolve use-stick-to-bottom. The
|
|
6
|
+
* package is loaded only when BasaltStickToBottom is first rendered.
|
|
7
|
+
*
|
|
8
|
+
* If use-stick-to-bottom is not installed, BasaltStickToBottom renders a plain scrollable <div>
|
|
9
|
+
* (graceful degradation) — no unhandled rejection, no crash.
|
|
10
|
+
*
|
|
11
|
+
* Renders (when peer is present):
|
|
12
|
+
* <StickToBottom>
|
|
13
|
+
* <StickToBottom.Content>{children}</StickToBottom.Content>
|
|
14
|
+
* [scroll-to-bottom button when not at bottom]
|
|
15
|
+
* </StickToBottom>
|
|
16
|
+
*
|
|
17
|
+
* Install optional peer:
|
|
18
|
+
* bun add use-stick-to-bottom
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* import { BasaltStickToBottom } from 'basalt-ui/agent'
|
|
22
|
+
*
|
|
23
|
+
* <BasaltStickToBottom className="chat-messages">
|
|
24
|
+
* <PartList parts={parts} />
|
|
25
|
+
* </BasaltStickToBottom>
|
|
26
|
+
*/
|
|
27
|
+
import { lazy, Suspense } from 'react'
|
|
28
|
+
import type { CSSProperties, JSX, ReactNode } from 'react'
|
|
29
|
+
import { VX } from '../tokens'
|
|
30
|
+
|
|
31
|
+
// ── Lazy-loaded StickToBottom ─────────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
type WrapperProps = {
|
|
34
|
+
children: ReactNode
|
|
35
|
+
className?: string
|
|
36
|
+
style?: CSSProperties
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Plain scrollable container rendered when use-stick-to-bottom peer is absent. */
|
|
40
|
+
function PlainContainerFallback({ children, className, style }: WrapperProps): JSX.Element {
|
|
41
|
+
const props: { className?: string; style?: CSSProperties } = {
|
|
42
|
+
// theme-allow — scroll anchoring needs a real scrollable node it owns, not a ScrollArea.
|
|
43
|
+
style: { overflowY: 'auto', ...style },
|
|
44
|
+
}
|
|
45
|
+
if (className !== undefined) props.className = className
|
|
46
|
+
return <div {...props}>{children}</div>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// The lazy wrapper resolves use-stick-to-bottom only when rendered.
|
|
50
|
+
// If the peer is absent the import fails — .catch resolves to PlainContainerFallback so
|
|
51
|
+
// the optional-peer contract is honoured: no unhandled rejection, no crash.
|
|
52
|
+
const LazyStickToBottom = lazy(() =>
|
|
53
|
+
import('use-stick-to-bottom')
|
|
54
|
+
.then(({ StickToBottom, useStickToBottomContext }) => {
|
|
55
|
+
function StickToBottomInner({
|
|
56
|
+
children,
|
|
57
|
+
className,
|
|
58
|
+
}: {
|
|
59
|
+
children: ReactNode
|
|
60
|
+
className?: string
|
|
61
|
+
}): JSX.Element {
|
|
62
|
+
const { isAtBottom, scrollToBottom } = useStickToBottomContext()
|
|
63
|
+
const contentProps = className !== undefined ? { className } : {}
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<StickToBottom.Content {...contentProps}>{children}</StickToBottom.Content>
|
|
67
|
+
{!isAtBottom && (
|
|
68
|
+
<button
|
|
69
|
+
type="button"
|
|
70
|
+
className="basalt-agent-scroll-to-bottom"
|
|
71
|
+
onClick={() => scrollToBottom()}
|
|
72
|
+
aria-label="Scroll to bottom"
|
|
73
|
+
style={{
|
|
74
|
+
display: 'flex',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
width: 30,
|
|
78
|
+
height: 30,
|
|
79
|
+
margin: '8px auto 0',
|
|
80
|
+
borderRadius: 999,
|
|
81
|
+
border: 'none',
|
|
82
|
+
cursor: 'pointer',
|
|
83
|
+
backgroundColor: 'var(--vx-surface-panel)',
|
|
84
|
+
boxShadow: 'var(--vx-shadow-card)',
|
|
85
|
+
color: 'var(--vx-faint)',
|
|
86
|
+
fontFamily: 'var(--basalt-font-mono)',
|
|
87
|
+
fontSize: VX.text.md,
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
↓
|
|
91
|
+
</button>
|
|
92
|
+
)}
|
|
93
|
+
</>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// oxlint-disable-next-line unicorn/consistent-function-scoping
|
|
98
|
+
function StickToBottomWrapper({ children, className, style }: WrapperProps): JSX.Element {
|
|
99
|
+
const outerProps = style !== undefined ? { style } : {}
|
|
100
|
+
const innerProps = className !== undefined ? { className } : {}
|
|
101
|
+
return (
|
|
102
|
+
<StickToBottom {...outerProps}>
|
|
103
|
+
<StickToBottomInner {...innerProps}>{children}</StickToBottomInner>
|
|
104
|
+
</StickToBottom>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return { default: StickToBottomWrapper }
|
|
109
|
+
})
|
|
110
|
+
.catch(() => ({ default: PlainContainerFallback })),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
// ── BasaltStickToBottom ───────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
export type BasaltStickToBottomProps = {
|
|
116
|
+
readonly children: ReactNode
|
|
117
|
+
/** Applied to the scroll content container. */
|
|
118
|
+
readonly className?: string
|
|
119
|
+
/** Applied to the outer StickToBottom element. */
|
|
120
|
+
readonly style?: CSSProperties
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Auto-scrolling chat container — sticks to the bottom as content grows, surfaces a
|
|
125
|
+
* scroll-to-bottom affordance when the user scrolls up. Lazy-loaded over use-stick-to-bottom.
|
|
126
|
+
*
|
|
127
|
+
* Falls back to a plain scrollable div while the package loads (first render only).
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* import { BasaltStickToBottom, PartList } from 'basalt-ui/agent'
|
|
131
|
+
*
|
|
132
|
+
* <BasaltStickToBottom style={{ height: '400px', overflow: 'auto' }}>
|
|
133
|
+
* <PartList parts={parts} />
|
|
134
|
+
* </BasaltStickToBottom>
|
|
135
|
+
*/
|
|
136
|
+
export function BasaltStickToBottom({
|
|
137
|
+
children,
|
|
138
|
+
className,
|
|
139
|
+
style,
|
|
140
|
+
}: BasaltStickToBottomProps): JSX.Element {
|
|
141
|
+
const fallbackProps: { className?: string; style?: CSSProperties } = {}
|
|
142
|
+
if (className !== undefined) fallbackProps.className = className
|
|
143
|
+
if (style !== undefined) fallbackProps.style = style
|
|
144
|
+
|
|
145
|
+
const lazyProps: WrapperProps = { children }
|
|
146
|
+
if (className !== undefined) lazyProps.className = className
|
|
147
|
+
if (style !== undefined) lazyProps.style = style
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Suspense fallback={<div {...fallbackProps}>{children}</div>}>
|
|
151
|
+
<LazyStickToBottom {...lazyProps} />
|
|
152
|
+
</Suspense>
|
|
153
|
+
)
|
|
154
|
+
}
|