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,158 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode, RefObject } from 'react'
|
|
2
|
+
import { VX } from '../../tokens'
|
|
3
|
+
import { fmtTooltipDate } from '../utils/format'
|
|
4
|
+
|
|
5
|
+
// Panel bg + shadow-card, radius 8 (docs/DESIGN-SPEC.md §5's "Tooltip/popover/menu" idiom) — the
|
|
6
|
+
// same depth-via-shadow treatment as ChartCard, never a `border` property. Surfaces resolve per
|
|
7
|
+
// theme via CSS vars, so this is a static object (no useMemo/hook needed).
|
|
8
|
+
const TOOLTIP_STYLES: CSSProperties = {
|
|
9
|
+
position: 'fixed',
|
|
10
|
+
pointerEvents: 'none',
|
|
11
|
+
zIndex: 9999,
|
|
12
|
+
backgroundColor: VX.surface.panel,
|
|
13
|
+
borderRadius: 8,
|
|
14
|
+
padding: '0',
|
|
15
|
+
fontSize: VX.text.xs,
|
|
16
|
+
lineHeight: '18px',
|
|
17
|
+
color: VX.ink,
|
|
18
|
+
boxShadow: VX.shadowCard,
|
|
19
|
+
minWidth: 140,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Theme-aware tooltip container styles — use with useChartTooltip(). */
|
|
23
|
+
export function useTooltipStyles(): CSSProperties {
|
|
24
|
+
return TOOLTIP_STYLES
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Outer tooltip shell. Renders nothing when tip is null. */
|
|
28
|
+
export function ChartTooltip({
|
|
29
|
+
tip,
|
|
30
|
+
tooltipRef,
|
|
31
|
+
styles,
|
|
32
|
+
children,
|
|
33
|
+
}: {
|
|
34
|
+
tip: { x: number; y: number } | null
|
|
35
|
+
tooltipRef?: RefObject<HTMLDivElement | null>
|
|
36
|
+
styles: CSSProperties
|
|
37
|
+
children: ReactNode
|
|
38
|
+
}) {
|
|
39
|
+
if (!tip) return null
|
|
40
|
+
return (
|
|
41
|
+
<div ref={tooltipRef} style={{ ...styles, left: tip.x, top: tip.y }}>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Tooltip header — shows formatted date + optional right-aligned label with color. */
|
|
48
|
+
export function TooltipHeader({
|
|
49
|
+
date,
|
|
50
|
+
label,
|
|
51
|
+
labelColor,
|
|
52
|
+
}: {
|
|
53
|
+
date: string
|
|
54
|
+
label?: string
|
|
55
|
+
labelColor?: string
|
|
56
|
+
}) {
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
style={{
|
|
60
|
+
display: 'flex',
|
|
61
|
+
justifyContent: 'space-between',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
gap: 16,
|
|
64
|
+
padding: '6px 10px',
|
|
65
|
+
borderBottom: `1px solid ${VX.divider}`,
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<span
|
|
69
|
+
style={{
|
|
70
|
+
fontSize: VX.text.micro,
|
|
71
|
+
fontWeight: 600,
|
|
72
|
+
fontFamily: 'var(--basalt-font-mono)',
|
|
73
|
+
color: VX.ink,
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{fmtTooltipDate(date)}
|
|
77
|
+
</span>
|
|
78
|
+
{label !== undefined && (
|
|
79
|
+
<span
|
|
80
|
+
style={{
|
|
81
|
+
fontSize: VX.text.micro,
|
|
82
|
+
fontWeight: 500,
|
|
83
|
+
fontFamily: 'var(--basalt-font-mono)',
|
|
84
|
+
color: labelColor,
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
{label}
|
|
88
|
+
</span>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Tooltip row — swatch + label + value. */
|
|
95
|
+
export function TooltipRow({
|
|
96
|
+
color,
|
|
97
|
+
label,
|
|
98
|
+
value,
|
|
99
|
+
valueColor,
|
|
100
|
+
shape,
|
|
101
|
+
strokeWidth,
|
|
102
|
+
dashed,
|
|
103
|
+
}: {
|
|
104
|
+
color: string
|
|
105
|
+
label: string
|
|
106
|
+
value: string
|
|
107
|
+
valueColor?: string
|
|
108
|
+
shape?: 'dot' | 'line' | 'bar'
|
|
109
|
+
strokeWidth?: number
|
|
110
|
+
/** Render the line swatch as dashed (only applies to shape='line'). */
|
|
111
|
+
dashed?: boolean
|
|
112
|
+
}) {
|
|
113
|
+
return (
|
|
114
|
+
<div
|
|
115
|
+
style={{
|
|
116
|
+
display: 'flex',
|
|
117
|
+
justifyContent: 'space-between',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
gap: 16,
|
|
120
|
+
padding: '0 10px',
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<span style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
|
124
|
+
{shape === 'line' ? (
|
|
125
|
+
<svg width={12} height={10} style={{ flexShrink: 0 }}>
|
|
126
|
+
<line
|
|
127
|
+
x1={0}
|
|
128
|
+
y1={5}
|
|
129
|
+
x2={12}
|
|
130
|
+
y2={5}
|
|
131
|
+
stroke={color}
|
|
132
|
+
strokeWidth={strokeWidth ?? VX.lineWidth}
|
|
133
|
+
strokeDasharray={dashed ? VX.dashArray : undefined}
|
|
134
|
+
/>
|
|
135
|
+
</svg>
|
|
136
|
+
) : (
|
|
137
|
+
<span
|
|
138
|
+
style={{
|
|
139
|
+
width: 8,
|
|
140
|
+
height: 8,
|
|
141
|
+
borderRadius: 2,
|
|
142
|
+
backgroundColor: color,
|
|
143
|
+
flexShrink: 0,
|
|
144
|
+
}}
|
|
145
|
+
/>
|
|
146
|
+
)}
|
|
147
|
+
{label}
|
|
148
|
+
</span>
|
|
149
|
+
<span style={{ fontWeight: 400, fontFamily: 'var(--basalt-font-mono)', color: valueColor }}>
|
|
150
|
+
{value}
|
|
151
|
+
</span>
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function TooltipBody({ children }: { children: ReactNode }) {
|
|
157
|
+
return <div style={{ padding: '5px 0' }}>{children}</div>
|
|
158
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { VX } from '../../tokens'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The shared vertical hover crosshair — one implementation for what used to be five hand-rolled
|
|
6
|
+
* call sites (`MultiLine`, `ZonedLine`, `StackedArea`, `Bars`, `DualPanel`). `top`/`bottom` are the
|
|
7
|
+
* plot-local y extent the line spans (usually `0` and the plot's `yMax`); `DualPanel` passes the
|
|
8
|
+
* extent spanning both panes for its cross-pane crosshair.
|
|
9
|
+
*/
|
|
10
|
+
export function Crosshair({
|
|
11
|
+
x,
|
|
12
|
+
top,
|
|
13
|
+
bottom,
|
|
14
|
+
}: {
|
|
15
|
+
x: number
|
|
16
|
+
top: number
|
|
17
|
+
bottom: number
|
|
18
|
+
}): ReactNode {
|
|
19
|
+
return <line x1={x} x2={x} y1={top} y2={bottom} stroke={VX.crosshair} strokeWidth={1} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The punched-out hover marker: a filled circle whose stroke is the chart background color, so it
|
|
24
|
+
* reads as a "hole" cut into the line on both themes. Centralizes the `dotStroke = chart-bg` trick.
|
|
25
|
+
*/
|
|
26
|
+
export function SeriesDot({
|
|
27
|
+
cx,
|
|
28
|
+
cy,
|
|
29
|
+
color,
|
|
30
|
+
r,
|
|
31
|
+
}: {
|
|
32
|
+
cx: number
|
|
33
|
+
cy: number
|
|
34
|
+
color: string
|
|
35
|
+
r?: number
|
|
36
|
+
}): ReactNode {
|
|
37
|
+
return (
|
|
38
|
+
<circle cx={cx} cy={cy} r={r ?? VX.dotR} fill={color} stroke={VX.dotStroke} strokeWidth={2} />
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { MouseEventHandler } from 'react'
|
|
2
|
+
|
|
3
|
+
/** Transparent <rect> that captures mouse events for tooltip + crosshair sync. */
|
|
4
|
+
export function HoverOverlay({
|
|
5
|
+
width,
|
|
6
|
+
height,
|
|
7
|
+
onMove,
|
|
8
|
+
onLeave,
|
|
9
|
+
}: {
|
|
10
|
+
width: number
|
|
11
|
+
height: number
|
|
12
|
+
onMove: MouseEventHandler<SVGRectElement>
|
|
13
|
+
onLeave: MouseEventHandler<SVGRectElement>
|
|
14
|
+
}) {
|
|
15
|
+
return (
|
|
16
|
+
<rect
|
|
17
|
+
width={width}
|
|
18
|
+
height={height}
|
|
19
|
+
fill="transparent"
|
|
20
|
+
onMouseMove={onMove}
|
|
21
|
+
onMouseLeave={onLeave}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { useChartSize } from '../hooks/useChartSize'
|
|
3
|
+
|
|
4
|
+
export type ResponsiveChartProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Fixed height in pixels. Used when `aspectRatio` is not set. Default 240.
|
|
7
|
+
* Ignored when `aspectRatio` is set — height is derived from measured width.
|
|
8
|
+
*/
|
|
9
|
+
height?: number
|
|
10
|
+
/**
|
|
11
|
+
* When set, height = Math.round(width / aspectRatio) and `height` prop is ignored.
|
|
12
|
+
* E.g. `aspectRatio={16 / 9}` produces a 16:9 panel.
|
|
13
|
+
*/
|
|
14
|
+
aspectRatio?: number
|
|
15
|
+
/** ResizeObserver debounce in milliseconds. Default 0 (immediate). */
|
|
16
|
+
debounceMs?: number
|
|
17
|
+
/**
|
|
18
|
+
* Accessible text alternative for the chart, applied as `aria-label` (+ `role="img"`) on the
|
|
19
|
+
* outer measuring container — e.g. when wrapping `Heatmap`, which measures via this primitive
|
|
20
|
+
* rather than `ChartFrame`.
|
|
21
|
+
*/
|
|
22
|
+
ariaLabel?: string
|
|
23
|
+
/** Render prop — called with the measured `{ width, height }`. */
|
|
24
|
+
children: (size: { width: number; height: number }) => ReactNode
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Render-prop container that measures its own width and derives a final height
|
|
29
|
+
* from `height` (default 240) or `aspectRatio`. Renders nothing until the first
|
|
30
|
+
* measurement arrives (`width > 0`). Backed by `@visx/responsive`'s `useParentSize`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <ResponsiveChart height={320}>
|
|
34
|
+
* {({ width, height }) => (
|
|
35
|
+
* <Bars width={width} height={height} data={data} ... />
|
|
36
|
+
* )}
|
|
37
|
+
* </ResponsiveChart>
|
|
38
|
+
*
|
|
39
|
+
* @example aspectRatio
|
|
40
|
+
* <ResponsiveChart aspectRatio={16 / 9}>
|
|
41
|
+
* {({ width, height }) => <MyChart width={width} height={height} />}
|
|
42
|
+
* </ResponsiveChart>
|
|
43
|
+
*/
|
|
44
|
+
export function ResponsiveChart({
|
|
45
|
+
height = 240,
|
|
46
|
+
aspectRatio,
|
|
47
|
+
debounceMs = 0,
|
|
48
|
+
ariaLabel,
|
|
49
|
+
children,
|
|
50
|
+
}: ResponsiveChartProps): ReactNode {
|
|
51
|
+
const { ref, width } = useChartSize(debounceMs)
|
|
52
|
+
|
|
53
|
+
const resolvedHeight = aspectRatio !== undefined ? Math.round(width / aspectRatio) : height
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
ref={ref}
|
|
58
|
+
style={{ width: '100%' }}
|
|
59
|
+
{...(ariaLabel !== undefined && { role: 'img', 'aria-label': ariaLabel })}
|
|
60
|
+
>
|
|
61
|
+
{width > 0 ? children({ width, height: resolvedHeight }) : null}
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { scaleLinear } from '@visx/scale'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The linear-scale instance type, derived from `@visx/scale`'s own `scaleLinear` return type.
|
|
5
|
+
* Equivalent to d3's `ScaleLinear<number, number>` but resolved through `@visx/scale` (an
|
|
6
|
+
* installed dep) so it needs no `@types/d3-scale` and stays inside the visx-only-in-charts boundary.
|
|
7
|
+
*/
|
|
8
|
+
type LinearScale = ReturnType<typeof scaleLinear<number>>
|
|
9
|
+
|
|
10
|
+
export type ZoneSpec = {
|
|
11
|
+
/** Lower bound on the anchored axis. Use -Infinity for "bottom of axis". */
|
|
12
|
+
from: number
|
|
13
|
+
/** Upper bound. Use Infinity for "top of axis". */
|
|
14
|
+
to: number
|
|
15
|
+
fill: string
|
|
16
|
+
axisSide?: 'left' | 'right'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Full-width horizontal zone backgrounds — one <rect> per zone, spanning
|
|
21
|
+
* x=[0, width] and y=[scale(to), scale(from)]. Shared by every kind that
|
|
22
|
+
* renders target-zone / threshold-zone bands.
|
|
23
|
+
*
|
|
24
|
+
* `Infinity` / `-Infinity` bounds clamp to the resolved domain of the
|
|
25
|
+
* scale so "from: -Infinity" reads as "the bottom of this axis" regardless
|
|
26
|
+
* of whether the domain is fixed or auto-computed.
|
|
27
|
+
*
|
|
28
|
+
* The wrapper picks left vs right scale per zone via `axisSide`; callers
|
|
29
|
+
* on single-axis kinds just pass the same scale twice (or leave `rightScale`
|
|
30
|
+
* undefined).
|
|
31
|
+
*/
|
|
32
|
+
export function ZoneRects({
|
|
33
|
+
zones,
|
|
34
|
+
width,
|
|
35
|
+
leftScale,
|
|
36
|
+
rightScale,
|
|
37
|
+
}: {
|
|
38
|
+
zones: ZoneSpec[]
|
|
39
|
+
/** Plot-area width (xMax); rects span from 0 to this. */
|
|
40
|
+
width: number
|
|
41
|
+
leftScale: LinearScale
|
|
42
|
+
/** Required only when any zone has axisSide='right'. */
|
|
43
|
+
rightScale?: LinearScale | null
|
|
44
|
+
}) {
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{zones.map((z, i) => {
|
|
48
|
+
const scale = z.axisSide === 'right' && rightScale ? rightScale : leftScale
|
|
49
|
+
const [domainMin, domainMax] = scale.domain() as [number, number]
|
|
50
|
+
const zTo = z.to === Infinity ? domainMax : z.to
|
|
51
|
+
const zFrom = z.from === -Infinity ? domainMin : z.from
|
|
52
|
+
const yTop = scale(zTo)
|
|
53
|
+
const yBottom = scale(zFrom)
|
|
54
|
+
return (
|
|
55
|
+
<rect
|
|
56
|
+
key={`zone-${i}`}
|
|
57
|
+
x={0}
|
|
58
|
+
y={yTop}
|
|
59
|
+
width={width}
|
|
60
|
+
height={yBottom - yTop}
|
|
61
|
+
fill={z.fill}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
})}
|
|
65
|
+
</>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The series descriptor — single source of truth for color + line-style + label + accessor.
|
|
3
|
+
* Legend + tooltip rows are *derived* from it, never hand-authored in parallel. Mantine-free.
|
|
4
|
+
*
|
|
5
|
+
* Generalizes `MultiLineSeries<T>` (`kinds/MultiLine.tsx`) into the shared spine consumed by
|
|
6
|
+
* every kind. `LegendPlacement` also lives here so `ChartLegend` and the future `ChartFrame`
|
|
7
|
+
* share one definition.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { LegendEntry } from './primitives/ChartLegend'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Default stroke width for plotted line overlays in `DualPanel` / `MultiLine` / `ZonedLine` —
|
|
14
|
+
* thinner than the generic `VX.lineWidth` per the 2026-07 modern-zinc redesign
|
|
15
|
+
* (`docs/DESIGN-SPEC.md` §5, "tertiary/line overlay ... at 1.9px stroke"). `VX.lineWidth` itself
|
|
16
|
+
* stays the "one width everywhere" default for `Bars`' line overlays, legend line swatches, and
|
|
17
|
+
* `TooltipRow`'s generic fallback — this constant only overrides the three kinds it's imported by.
|
|
18
|
+
*/
|
|
19
|
+
export const LINE_OVERLAY_STROKE_WIDTH = 1.9
|
|
20
|
+
|
|
21
|
+
/** Governs BOTH the plotted mark and the legend swatch shape. */
|
|
22
|
+
export type SeriesMark = 'line' | 'bar' | 'area'
|
|
23
|
+
|
|
24
|
+
/** Only meaningful for `mark: 'line'`. */
|
|
25
|
+
export type SeriesDash = 'solid' | 'dashed'
|
|
26
|
+
|
|
27
|
+
/** Drives legend grouping/dividers. */
|
|
28
|
+
export type SeriesRole = 'series' | 'overlay' | 'reference'
|
|
29
|
+
|
|
30
|
+
/** Where the derived legend renders relative to the plot. */
|
|
31
|
+
export type LegendPlacement = 'top' | 'bottom' | 'left' | 'right'
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Consumer-facing legend config exposed by every kind's `legend` prop — the subset of
|
|
35
|
+
* `ChartFrame`'s legend object a consumer may set directly. Deliberately excludes
|
|
36
|
+
* `highlighted`/`onHighlight`, which the kind injects itself (its own hover-dim state).
|
|
37
|
+
* `legend={false}` on a kind disables the legend entirely (the sparkline escape).
|
|
38
|
+
*/
|
|
39
|
+
export type ChartLegendConfig = {
|
|
40
|
+
/** Default 'bottom'. */
|
|
41
|
+
placement?: LegendPlacement
|
|
42
|
+
/** Visually separate role: series | overlay | reference. */
|
|
43
|
+
groups?: boolean
|
|
44
|
+
/** Wrap cap → "+N more" rollup at high cardinality. */
|
|
45
|
+
maxRows?: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Visual identity of a series — everything the legend + tooltip swatch need. No accessors, no `T`. */
|
|
49
|
+
export type SeriesStyle = {
|
|
50
|
+
key: string
|
|
51
|
+
label: string
|
|
52
|
+
/** A --vx-* ref (VX.series.*), never a raw hex. */
|
|
53
|
+
color: string
|
|
54
|
+
mark: SeriesMark
|
|
55
|
+
/** Default 'solid'. */
|
|
56
|
+
dash?: SeriesDash
|
|
57
|
+
/** Default VX.lineWidth (one width, everywhere). */
|
|
58
|
+
strokeWidth?: number
|
|
59
|
+
/** bar/area: the swatch honors this so it cannot lie. */
|
|
60
|
+
fillOpacity?: number
|
|
61
|
+
/** Default 'series'. */
|
|
62
|
+
role?: SeriesRole
|
|
63
|
+
/** Default true; false = companion folded under `parent`. */
|
|
64
|
+
legend?: boolean
|
|
65
|
+
/** e.g. an MA line names its parent so hover-dimming keeps the pair. */
|
|
66
|
+
parent?: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Full descriptor = visual identity + data accessors. Generic over the point type. */
|
|
70
|
+
export type ChartSeries<T> = SeriesStyle & {
|
|
71
|
+
/** null = line gap + skipped tooltip row. */
|
|
72
|
+
getValue: (d: T) => number | null
|
|
73
|
+
/** Per-series override of the shared tooltip/value formatter. */
|
|
74
|
+
formatValue?: (v: number) => string
|
|
75
|
+
/** PR star / status dot. Return null for no marker at that point. */
|
|
76
|
+
getMarker?: (d: T) => { color?: string; r?: number } | null
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** A single derived tooltip row, ready for `TooltipRow`. */
|
|
80
|
+
export type TooltipRowData = {
|
|
81
|
+
key: string
|
|
82
|
+
label: string
|
|
83
|
+
color: string
|
|
84
|
+
value: string
|
|
85
|
+
shape: 'line' | 'bar'
|
|
86
|
+
dashed: boolean
|
|
87
|
+
strokeWidth?: number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const shapeFor = (mark: SeriesMark): 'line' | 'bar' => (mark === 'line' ? 'line' : 'bar')
|
|
91
|
+
|
|
92
|
+
function legendEntryFor(s: SeriesStyle): LegendEntry {
|
|
93
|
+
return {
|
|
94
|
+
key: s.key,
|
|
95
|
+
label: s.label,
|
|
96
|
+
color: s.color,
|
|
97
|
+
shape: shapeFor(s.mark),
|
|
98
|
+
dashed: s.dash === 'dashed',
|
|
99
|
+
...(s.strokeWidth !== undefined && { strokeWidth: s.strokeWidth }),
|
|
100
|
+
...(s.fillOpacity !== undefined && { fillOpacity: s.fillOpacity }),
|
|
101
|
+
...(s.role !== undefined && { role: s.role }),
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Derive the legend from a series-style array — the enforcement that the legend can never drift
|
|
107
|
+
* from what's plotted. Groups by `role` (series → overlay → reference) via `ChartLegend`'s own
|
|
108
|
+
* `groups` rendering.
|
|
109
|
+
*
|
|
110
|
+
* `legend === false`: dropped entirely, UNLESS `parent` names another series in the array — then
|
|
111
|
+
* it is folded into that parent's `LegendEntry.children` as a subordinate dashed sub-entry (e.g.
|
|
112
|
+
* an MA companion), rather than vanishing. A series with `legend !== false` always renders as a
|
|
113
|
+
* normal top-level entry.
|
|
114
|
+
*/
|
|
115
|
+
export function deriveLegend(series: readonly SeriesStyle[]): LegendEntry[] {
|
|
116
|
+
const entries: LegendEntry[] = []
|
|
117
|
+
const byKey = new Map<string, LegendEntry>()
|
|
118
|
+
|
|
119
|
+
for (const s of series) {
|
|
120
|
+
if (s.legend === false) continue
|
|
121
|
+
const entry = legendEntryFor(s)
|
|
122
|
+
entries.push(entry)
|
|
123
|
+
byKey.set(s.key, entry)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
for (const s of series) {
|
|
127
|
+
if (s.legend !== false || s.parent === undefined) continue
|
|
128
|
+
const parent = byKey.get(s.parent)
|
|
129
|
+
if (parent === undefined) continue
|
|
130
|
+
parent.children ??= []
|
|
131
|
+
parent.children.push(legendEntryFor(s))
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return entries
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Derive tooltip rows from a series descriptor array + the hovered datum. Skips rows where
|
|
139
|
+
* `getValue(datum) === null`; honors per-series `formatValue` over the shared `fallbackFormat`.
|
|
140
|
+
* Kinds pass `series.toReversed()` for stacked charts so the tooltip stack matches the visual stack.
|
|
141
|
+
*/
|
|
142
|
+
export function deriveTooltipRows<T>(
|
|
143
|
+
series: readonly ChartSeries<T>[],
|
|
144
|
+
datum: T,
|
|
145
|
+
fallbackFormat: (v: number) => string,
|
|
146
|
+
): TooltipRowData[] {
|
|
147
|
+
const rows: TooltipRowData[] = []
|
|
148
|
+
for (const s of series) {
|
|
149
|
+
const value = s.getValue(datum)
|
|
150
|
+
if (value === null) continue
|
|
151
|
+
const format = s.formatValue ?? fallbackFormat
|
|
152
|
+
rows.push({
|
|
153
|
+
key: s.key,
|
|
154
|
+
label: s.label,
|
|
155
|
+
color: s.color,
|
|
156
|
+
value: format(value),
|
|
157
|
+
shape: shapeFor(s.mark),
|
|
158
|
+
dashed: s.dash === 'dashed',
|
|
159
|
+
...(s.strokeWidth !== undefined && { strokeWidth: s.strokeWidth }),
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
return rows
|
|
163
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { scaleLinear } from '@visx/scale'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
import { VX } from '../../tokens'
|
|
4
|
+
|
|
5
|
+
type BarSparklineProps = {
|
|
6
|
+
data: number[]
|
|
7
|
+
width: number
|
|
8
|
+
height: number
|
|
9
|
+
color?: string
|
|
10
|
+
/** Accessible text alternative, applied as `aria-label` (+ `role="img"`) on the `<svg>`. */
|
|
11
|
+
ariaLabel?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Quiet inline bar trend — defaults to `VX.faint`, matching the sparkline family's restrained
|
|
15
|
+
* identity (docs/DESIGN-SPEC.md §5). */
|
|
16
|
+
export function BarSparkline({ data, width, height, color, ariaLabel }: BarSparklineProps) {
|
|
17
|
+
const fillColor = color ?? VX.faint
|
|
18
|
+
const a11yProps = ariaLabel !== undefined ? { role: 'img' as const, 'aria-label': ariaLabel } : {}
|
|
19
|
+
|
|
20
|
+
const yScale = useMemo(() => {
|
|
21
|
+
const max = Math.max(...data.filter((v) => isFinite(v)), 1)
|
|
22
|
+
return scaleLinear<number>({ domain: [0, max], range: [0, height] })
|
|
23
|
+
}, [data, height])
|
|
24
|
+
|
|
25
|
+
if (!data.length) return <svg width={width} height={height} {...a11yProps} />
|
|
26
|
+
|
|
27
|
+
const step = width / data.length
|
|
28
|
+
const barWidth = Math.max(step - 1, 1)
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<svg width={width} height={height} {...a11yProps}>
|
|
32
|
+
{data.map((v, i) => {
|
|
33
|
+
const bh = Math.max(yScale(Math.max(v, 0)), 0)
|
|
34
|
+
return (
|
|
35
|
+
<rect
|
|
36
|
+
key={i}
|
|
37
|
+
x={i * step}
|
|
38
|
+
y={height - bh}
|
|
39
|
+
width={barWidth}
|
|
40
|
+
height={bh}
|
|
41
|
+
fill={fillColor}
|
|
42
|
+
fillOpacity={0.75}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
})}
|
|
46
|
+
</svg>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { curveMonotoneX } from '@visx/curve'
|
|
2
|
+
import { Group } from '@visx/group'
|
|
3
|
+
import { scaleLinear } from '@visx/scale'
|
|
4
|
+
import { LinePath } from '@visx/shape'
|
|
5
|
+
import { useMemo } from 'react'
|
|
6
|
+
import { VX } from '../../tokens'
|
|
7
|
+
|
|
8
|
+
type LineSparklineProps = {
|
|
9
|
+
data: number[]
|
|
10
|
+
width: number
|
|
11
|
+
height: number
|
|
12
|
+
color?: string
|
|
13
|
+
/** Accessible text alternative, applied as `aria-label` (+ `role="img"`) on the `<svg>`. */
|
|
14
|
+
ariaLabel?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Quiet single-hue trend line (docs/DESIGN-SPEC.md §5: "single 1.6px faint line, no fill, no
|
|
19
|
+
* axes, no dots"). Sparklines default to `VX.faint`, not the bolder `VX.line` used by full charts.
|
|
20
|
+
*/
|
|
21
|
+
export function LineSparkline({ data, width, height, color, ariaLabel }: LineSparklineProps) {
|
|
22
|
+
const strokeColor = color ?? VX.faint
|
|
23
|
+
const a11yProps = ariaLabel !== undefined ? { role: 'img' as const, 'aria-label': ariaLabel } : {}
|
|
24
|
+
|
|
25
|
+
const xScale = useMemo(
|
|
26
|
+
() => scaleLinear<number>({ domain: [0, Math.max(data.length - 1, 1)], range: [0, width] }),
|
|
27
|
+
[data.length, width],
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const yScale = useMemo(() => {
|
|
31
|
+
const vals = data.filter((v) => isFinite(v))
|
|
32
|
+
if (!vals.length) return scaleLinear<number>({ domain: [0, 1], range: [height, 0] })
|
|
33
|
+
const min = Math.min(...vals)
|
|
34
|
+
const max = Math.max(...vals)
|
|
35
|
+
const pad = (max - min) * 0.1 || 1
|
|
36
|
+
return scaleLinear<number>({ domain: [min - pad, max + pad], range: [height, 0] })
|
|
37
|
+
}, [data, height])
|
|
38
|
+
|
|
39
|
+
if (data.length < 2) return <svg width={width} height={height} {...a11yProps} />
|
|
40
|
+
|
|
41
|
+
const indexed = data.map((v, i) => ({ v, i }))
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<svg width={width} height={height} {...a11yProps}>
|
|
45
|
+
<Group>
|
|
46
|
+
<LinePath<{ v: number; i: number }>
|
|
47
|
+
data={indexed}
|
|
48
|
+
x={(d) => xScale(d.i)}
|
|
49
|
+
y={(d) => yScale(d.v)}
|
|
50
|
+
stroke={strokeColor}
|
|
51
|
+
strokeWidth={1.6}
|
|
52
|
+
curve={curveMonotoneX}
|
|
53
|
+
/>
|
|
54
|
+
</Group>
|
|
55
|
+
</svg>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
type ColorScheme = 'light' | 'dark'
|
|
5
|
+
|
|
6
|
+
export type VxTheme = {
|
|
7
|
+
colorScheme: ColorScheme
|
|
8
|
+
line: string
|
|
9
|
+
line2: string
|
|
10
|
+
axis: string
|
|
11
|
+
axisStroke: string
|
|
12
|
+
tooltipBg: string
|
|
13
|
+
tooltipText: string
|
|
14
|
+
tooltipMuted: string
|
|
15
|
+
tooltipBorder: string
|
|
16
|
+
tooltipShadow: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Theme-resolved neutrals are now CSS custom properties (see the token layer). They resolve per
|
|
21
|
+
* Mantine color scheme in CSS, so these are static var refs — the provider keeps `colorScheme`
|
|
22
|
+
* only for any non-color branching a chart may need.
|
|
23
|
+
*/
|
|
24
|
+
const REFS = {
|
|
25
|
+
line: 'var(--vx-line)',
|
|
26
|
+
line2: 'var(--vx-line2)',
|
|
27
|
+
axis: 'var(--vx-axis)',
|
|
28
|
+
axisStroke: 'var(--vx-axisStroke)',
|
|
29
|
+
tooltipBg: 'var(--vx-tooltipBg)',
|
|
30
|
+
tooltipText: 'var(--vx-tooltipText)',
|
|
31
|
+
tooltipMuted: 'var(--vx-tooltipMuted)',
|
|
32
|
+
tooltipBorder: 'var(--vx-tooltipBorder)',
|
|
33
|
+
tooltipShadow: 'var(--vx-tooltipShadow)',
|
|
34
|
+
} as const
|
|
35
|
+
|
|
36
|
+
const VxThemeContext = createContext<VxTheme | null>(null)
|
|
37
|
+
|
|
38
|
+
export function VxThemeProvider({
|
|
39
|
+
colorScheme,
|
|
40
|
+
children,
|
|
41
|
+
}: {
|
|
42
|
+
colorScheme: ColorScheme
|
|
43
|
+
children: ReactNode
|
|
44
|
+
}) {
|
|
45
|
+
const value = useMemo<VxTheme>(() => ({ colorScheme, ...REFS }), [colorScheme])
|
|
46
|
+
return <VxThemeContext.Provider value={value}>{children}</VxThemeContext.Provider>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function useVxTheme(): VxTheme {
|
|
50
|
+
const ctx = useContext(VxThemeContext)
|
|
51
|
+
if (!ctx) throw new Error('useVxTheme must be used inside <VxThemeProvider>')
|
|
52
|
+
return ctx
|
|
53
|
+
}
|