basalt-ui 0.4.2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +70 -0
- package/CHANGELOG.md +210 -40
- package/LICENSE +201 -0
- package/README.md +421 -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/skills/basalt-app/SKILL.md +137 -0
- package/agent/skills/basalt-charts/SKILL.md +179 -0
- package/agent/skills/basalt-design/SKILL.md +249 -0
- package/agent/templates/CLAUDE-block.md.tpl +38 -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-ui.mjs +14 -0
- package/configs/check.yml +29 -0
- package/configs/lefthook.yml +25 -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 +292 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +889 -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 +386 -0
- package/dist/surfaces.d.ts.map +1 -0
- package/dist/surfaces.js +312 -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 +152 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +249 -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 +668 -0
- package/src/cli/help.test.ts +93 -0
- package/src/cli/index.ts +1535 -0
- package/src/cli/init-sync.test.ts +160 -0
- package/src/cli/placement-engine.test.ts +194 -0
- package/src/cli/tarball-parity.test.ts +44 -0
- package/src/cli/template-format.test.ts +64 -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 +508 -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 +369 -0
- package/src/tokens/palette.ts +288 -0
- package/src/vite.ts +122 -0
- package/src/index.css +0 -877
- package/src/starlight.css +0 -308
- package/tailwind.config.js +0 -78
package/dist/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BasaltProvider,
|
|
3
|
+
BasaltErrorBoundary
|
|
4
|
+
} from "./provider/index.js";
|
|
5
|
+
import { createBasaltTheme, baseTheme, cssVariablesResolver } from "./theme/index.js";
|
|
6
|
+
import { ThemeToggle } from "./theme-toggle/index.js";
|
|
7
|
+
import { MOTION_DURATION, MOTION_SPRING, MOTION_EASE_STANDARD } from "./motion/index.js";
|
|
8
|
+
import {
|
|
9
|
+
BasaltShell,
|
|
10
|
+
NavCountBadge,
|
|
11
|
+
AppSidebar,
|
|
12
|
+
SidebarSearch,
|
|
13
|
+
SidebarAccount,
|
|
14
|
+
MobileNav,
|
|
15
|
+
AppBreadcrumbs,
|
|
16
|
+
PageHeaderProvider,
|
|
17
|
+
PageActions,
|
|
18
|
+
PageActionsOutlet
|
|
19
|
+
} from "./shell/index.js";
|
|
20
|
+
import {
|
|
21
|
+
assertNever
|
|
22
|
+
} from "./register.js";
|
|
23
|
+
import {
|
|
24
|
+
createPersistedState,
|
|
25
|
+
useOnlineStatus,
|
|
26
|
+
readPersistedValue
|
|
27
|
+
} from "./state.js";
|
|
28
|
+
import {
|
|
29
|
+
DeltaBadge,
|
|
30
|
+
StatCard,
|
|
31
|
+
EmptyState,
|
|
32
|
+
SettingsSection,
|
|
33
|
+
SettingsRow,
|
|
34
|
+
DangerZone
|
|
35
|
+
} from "./dashboard/index.js";
|
|
36
|
+
import { ConnectivityProvider, ConnectivityIndicator, useConnectivity } from "./connectivity/index.js";
|
|
37
|
+
import {
|
|
38
|
+
ThreadWorkspace,
|
|
39
|
+
ThreadFeed,
|
|
40
|
+
ThreadOutcomeCard,
|
|
41
|
+
ThreadDetailPanel,
|
|
42
|
+
Composer,
|
|
43
|
+
threadPartRenderers,
|
|
44
|
+
ThreadTranscript
|
|
45
|
+
} from "./agent-chat/index.js";
|
|
46
|
+
import { createThreadsStore, heuristicOutcome, useAgentThreadRuns } from "./agent/index.js";
|
|
47
|
+
export {
|
|
48
|
+
AppBreadcrumbs,
|
|
49
|
+
AppSidebar,
|
|
50
|
+
BasaltErrorBoundary,
|
|
51
|
+
BasaltProvider,
|
|
52
|
+
BasaltShell,
|
|
53
|
+
Composer,
|
|
54
|
+
ConnectivityIndicator,
|
|
55
|
+
ConnectivityProvider,
|
|
56
|
+
DangerZone,
|
|
57
|
+
DeltaBadge,
|
|
58
|
+
EmptyState,
|
|
59
|
+
MOTION_DURATION,
|
|
60
|
+
MOTION_EASE_STANDARD,
|
|
61
|
+
MOTION_SPRING,
|
|
62
|
+
MobileNav,
|
|
63
|
+
NavCountBadge,
|
|
64
|
+
PageActions,
|
|
65
|
+
PageActionsOutlet,
|
|
66
|
+
PageHeaderProvider,
|
|
67
|
+
SettingsRow,
|
|
68
|
+
SettingsSection,
|
|
69
|
+
SidebarAccount,
|
|
70
|
+
SidebarSearch,
|
|
71
|
+
StatCard,
|
|
72
|
+
ThemeToggle,
|
|
73
|
+
ThreadDetailPanel,
|
|
74
|
+
ThreadFeed,
|
|
75
|
+
ThreadOutcomeCard,
|
|
76
|
+
ThreadTranscript,
|
|
77
|
+
ThreadWorkspace,
|
|
78
|
+
assertNever,
|
|
79
|
+
baseTheme,
|
|
80
|
+
createBasaltTheme,
|
|
81
|
+
createPersistedState,
|
|
82
|
+
createThreadsStore,
|
|
83
|
+
cssVariablesResolver,
|
|
84
|
+
heuristicOutcome,
|
|
85
|
+
readPersistedValue,
|
|
86
|
+
threadPartRenderers,
|
|
87
|
+
useAgentThreadRuns,
|
|
88
|
+
useConnectivity,
|
|
89
|
+
useOnlineStatus
|
|
90
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared motion constants — the animation analog of the `--vx-*` token system. A component reaches
|
|
3
|
+
* for these instead of inventing its own duration/easing/spring values, so animated chrome across
|
|
4
|
+
* the framework feels like one identity. Pairs with `motion` (`motion/react`), the framework's one
|
|
5
|
+
* animation dependency (bundled implementation detail, same precedent as `@visx/*`).
|
|
6
|
+
*
|
|
7
|
+
* Reduced-motion is read via `@mantine/hooks`' `useReducedMotion` (already a peer dep) at the call
|
|
8
|
+
* site — this module stays framework-agnostic (no React) so it can be imported anywhere.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Seconds, for tween-based transitions. Capped at 0.3 (300ms) — basalt-mantine.md's interaction
|
|
12
|
+
* doctrine holds "never above 300ms (feels laggy)" for Mantine's own `Transition`, and the same
|
|
13
|
+
* ceiling applies here so the two animation mechanisms agree on pacing.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MOTION_DURATION: {
|
|
16
|
+
readonly fast: 0.15;
|
|
17
|
+
readonly base: 0.25;
|
|
18
|
+
readonly slow: 0.3;
|
|
19
|
+
};
|
|
20
|
+
/** Standard ease curve for tween transitions (Material "standard" curve). */
|
|
21
|
+
export declare const MOTION_EASE_STANDARD: readonly [0.4, 0, 0.2, 1];
|
|
22
|
+
/** Standard spring for interactive, physical-feeling transitions (icon morphs, reveals). */
|
|
23
|
+
export declare const MOTION_SPRING: {
|
|
24
|
+
readonly type: "spring";
|
|
25
|
+
readonly stiffness: 400;
|
|
26
|
+
readonly damping: 32;
|
|
27
|
+
readonly mass: 0.9;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/motion/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;CAIlB,CAAA;AAEV,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,2BAA4B,CAAA;AAE7D,4FAA4F;AAC5F,eAAO,MAAM,aAAa;;;;;CAAsE,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const MOTION_DURATION = {
|
|
2
|
+
fast: 0.15,
|
|
3
|
+
base: 0.25,
|
|
4
|
+
slow: 0.3
|
|
5
|
+
};
|
|
6
|
+
const MOTION_EASE_STANDARD = [0.4, 0, 0.2, 1];
|
|
7
|
+
const MOTION_SPRING = { type: "spring", stiffness: 400, damping: 32, mass: 0.9 };
|
|
8
|
+
export {
|
|
9
|
+
MOTION_DURATION,
|
|
10
|
+
MOTION_EASE_STANDARD,
|
|
11
|
+
MOTION_SPRING
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type NotificationBellProps = {
|
|
2
|
+
/** Tooltip label. Default: 'Notifications'. */
|
|
3
|
+
label?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Bell icon button with an unread-Inbox indicator. Opens a NotificationCenter popover.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <BasaltShell globalActions={<NotificationBell />} {...rest} />
|
|
10
|
+
*/
|
|
11
|
+
export declare function NotificationBell({ label }: NotificationBellProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=bell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bell.d.ts","sourceRoot":"","sources":["../../src/notifications/bell.tsx"],"names":[],"mappings":"AA0BA,MAAM,MAAM,qBAAqB,GAAG;IAClC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAuB,EAAE,EAAE,qBAAqB,+BAsElF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon, Indicator, Popover } from "@mantine/core";
|
|
3
|
+
import { useDisclosure } from "@mantine/hooks";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
import { useNotificationHistory } from "./store.js";
|
|
6
|
+
import { NotificationCenter } from "./center.js";
|
|
7
|
+
const HOVER_OPEN_DELAY = 150;
|
|
8
|
+
const HOVER_CLOSE_DELAY = 200;
|
|
9
|
+
function NotificationBell({ label = "Notifications" }) {
|
|
10
|
+
const [opened, { open, toggle, close }] = useDisclosure(false);
|
|
11
|
+
const { unreadCount } = useNotificationHistory();
|
|
12
|
+
const timer = useRef(void 0);
|
|
13
|
+
const scheduleOpen = () => {
|
|
14
|
+
clearTimeout(timer.current);
|
|
15
|
+
timer.current = setTimeout(() => open(), HOVER_OPEN_DELAY);
|
|
16
|
+
};
|
|
17
|
+
const scheduleClose = () => {
|
|
18
|
+
clearTimeout(timer.current);
|
|
19
|
+
timer.current = setTimeout(() => close(), HOVER_CLOSE_DELAY);
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsxs(Popover, { opened, onClose: close, position: "bottom-end", withArrow: true, withinPortal: true, children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsx(
|
|
23
|
+
Indicator,
|
|
24
|
+
{
|
|
25
|
+
color: "color-mix(in srgb, var(--vx-ink) 8%, transparent)",
|
|
26
|
+
size: 16,
|
|
27
|
+
label: unreadCount > 9 ? "9+" : String(unreadCount),
|
|
28
|
+
disabled: unreadCount === 0,
|
|
29
|
+
processing: false,
|
|
30
|
+
styles: {
|
|
31
|
+
indicator: {
|
|
32
|
+
color: "var(--vx-ink)",
|
|
33
|
+
fontFamily: "var(--basalt-font-mono)",
|
|
34
|
+
fontWeight: 500
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
children: /* @__PURE__ */ jsx(
|
|
38
|
+
ActionIcon,
|
|
39
|
+
{
|
|
40
|
+
variant: "transparent",
|
|
41
|
+
color: "gray",
|
|
42
|
+
onClick: toggle,
|
|
43
|
+
onMouseEnter: scheduleOpen,
|
|
44
|
+
onMouseLeave: scheduleClose,
|
|
45
|
+
"aria-label": label,
|
|
46
|
+
"aria-expanded": opened,
|
|
47
|
+
"aria-haspopup": "dialog",
|
|
48
|
+
children: /* @__PURE__ */ jsxs(
|
|
49
|
+
"svg",
|
|
50
|
+
{
|
|
51
|
+
width: 18,
|
|
52
|
+
height: 18,
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
fill: "none",
|
|
55
|
+
stroke: "var(--mantine-color-dimmed)",
|
|
56
|
+
strokeWidth: 2,
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round",
|
|
59
|
+
"aria-hidden": true,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx("path", { d: "M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9" }),
|
|
62
|
+
/* @__PURE__ */ jsx("path", { d: "M13.73 21a2 2 0 0 1-3.46 0" })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
) }),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
Popover.Dropdown,
|
|
72
|
+
{
|
|
73
|
+
p: "md",
|
|
74
|
+
"aria-label": "Notification center",
|
|
75
|
+
onMouseEnter: scheduleOpen,
|
|
76
|
+
onMouseLeave: scheduleClose,
|
|
77
|
+
children: /* @__PURE__ */ jsx(NotificationCenter, {})
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
NotificationBell
|
|
84
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type NotificationCenterProps = {
|
|
2
|
+
/** Maximum height of the scrollable list. Default: 320px. */
|
|
3
|
+
maxHeight?: number | string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Two-view notification center (Inbox / All) with per-item read, dismiss, and remove, plus
|
|
7
|
+
* registry-resolved action buttons. Designed to be mounted inside a Popover or Drawer (e.g.
|
|
8
|
+
* NotificationBell).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { NotificationCenter } from 'basalt-ui/notifications'
|
|
12
|
+
*
|
|
13
|
+
* <Popover>
|
|
14
|
+
* <Popover.Dropdown>
|
|
15
|
+
* <NotificationCenter />
|
|
16
|
+
* </Popover.Dropdown>
|
|
17
|
+
* </Popover>
|
|
18
|
+
*/
|
|
19
|
+
export declare function NotificationCenter({ maxHeight }: NotificationCenterProps): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=center.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"center.d.ts","sourceRoot":"","sources":["../../src/notifications/center.tsx"],"names":[],"mappings":"AAwJA,MAAM,MAAM,uBAAuB,GAAG;IACpC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,SAAe,EAAE,EAAE,uBAAuB,+BAyE9E"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Button,
|
|
6
|
+
CloseButton,
|
|
7
|
+
Group,
|
|
8
|
+
ScrollArea,
|
|
9
|
+
SegmentedControl,
|
|
10
|
+
Stack,
|
|
11
|
+
Text
|
|
12
|
+
} from "@mantine/core";
|
|
13
|
+
import { VX } from "../tokens/index.js";
|
|
14
|
+
import { resolveAction } from "./define-notifications.js";
|
|
15
|
+
import { useNotificationHistory } from "./store.js";
|
|
16
|
+
function relativeTime(createdAt) {
|
|
17
|
+
const seconds = Math.floor((Date.now() - createdAt) / 1e3);
|
|
18
|
+
if (seconds < 60) return "just now";
|
|
19
|
+
const minutes = Math.floor(seconds / 60);
|
|
20
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
21
|
+
const hours = Math.floor(minutes / 60);
|
|
22
|
+
if (hours < 24) return `${hours}h ago`;
|
|
23
|
+
const days = Math.floor(hours / 24);
|
|
24
|
+
return `${days}d ago`;
|
|
25
|
+
}
|
|
26
|
+
const INTENT_COLOR = {
|
|
27
|
+
success: "green",
|
|
28
|
+
error: "red",
|
|
29
|
+
warning: "yellow",
|
|
30
|
+
info: "blue"
|
|
31
|
+
};
|
|
32
|
+
const INTENT_STATUS = {
|
|
33
|
+
success: VX.status.good,
|
|
34
|
+
error: VX.status.bad,
|
|
35
|
+
warning: VX.status.warn,
|
|
36
|
+
info: VX.accent
|
|
37
|
+
};
|
|
38
|
+
function NotificationItem({
|
|
39
|
+
item,
|
|
40
|
+
view,
|
|
41
|
+
onMarkRead,
|
|
42
|
+
onDismiss,
|
|
43
|
+
onRemove
|
|
44
|
+
}) {
|
|
45
|
+
const isUnread = item.readAt === void 0;
|
|
46
|
+
const isDismissed = item.dismissedAt !== void 0;
|
|
47
|
+
const color = INTENT_COLOR[item.intent];
|
|
48
|
+
const statusAccent = INTENT_STATUS[item.intent];
|
|
49
|
+
const resolved = item.action !== void 0 ? resolveAction(item.action) : void 0;
|
|
50
|
+
function handleAction(e) {
|
|
51
|
+
e.stopPropagation();
|
|
52
|
+
onMarkRead(item.id);
|
|
53
|
+
resolved?.run();
|
|
54
|
+
}
|
|
55
|
+
function handleClose() {
|
|
56
|
+
if (view === "inbox") onDismiss(item.id);
|
|
57
|
+
else onRemove(item.id);
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
Box,
|
|
61
|
+
{
|
|
62
|
+
px: "xs",
|
|
63
|
+
py: 6,
|
|
64
|
+
onClick: isUnread ? () => onMarkRead(item.id) : void 0,
|
|
65
|
+
style: {
|
|
66
|
+
cursor: isUnread ? "pointer" : "default",
|
|
67
|
+
borderInlineStart: `3px solid ${statusAccent}`,
|
|
68
|
+
borderRadius: "var(--mantine-radius-sm)",
|
|
69
|
+
background: isUnread ? "var(--mantine-color-default-hover)" : "transparent",
|
|
70
|
+
opacity: isDismissed ? 0.55 : 1
|
|
71
|
+
},
|
|
72
|
+
children: /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "flex-start", wrap: "nowrap", children: [
|
|
73
|
+
/* @__PURE__ */ jsxs(Stack, { gap: 2, style: { minWidth: 0, flex: 1 }, children: [
|
|
74
|
+
item.title !== void 0 && /* @__PURE__ */ jsx(Text, { size: "sm", fw: isUnread ? 600 : 500, lh: 1.2, truncate: "end", children: item.title }),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
Text,
|
|
77
|
+
{
|
|
78
|
+
size: "sm",
|
|
79
|
+
lh: 1.3,
|
|
80
|
+
...item.title !== void 0 && { c: "dimmed" },
|
|
81
|
+
style: { wordBreak: "break-word" },
|
|
82
|
+
children: item.message
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", mt: 2, wrap: "nowrap", children: [
|
|
86
|
+
/* @__PURE__ */ jsx(Text, { ff: "monospace", c: "var(--vx-faint)", style: { fontSize: VX.text.micro }, children: relativeTime(item.createdAt) }),
|
|
87
|
+
resolved !== void 0 && /* @__PURE__ */ jsx(Button, { variant: "light", color, size: "compact-xs", onClick: handleAction, children: resolved.label })
|
|
88
|
+
] })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
CloseButton,
|
|
92
|
+
{
|
|
93
|
+
size: "sm",
|
|
94
|
+
onClick: handleClose,
|
|
95
|
+
"aria-label": view === "inbox" ? "Dismiss notification" : "Delete notification",
|
|
96
|
+
title: view === "inbox" ? "Dismiss" : "Delete",
|
|
97
|
+
style: { flexShrink: 0 }
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] })
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function NotificationCenter({ maxHeight = 320 }) {
|
|
105
|
+
const { items, inbox, unreadCount, markRead, markAllRead, dismiss, dismissAll, remove, clear } = useNotificationHistory();
|
|
106
|
+
const [view, setView] = useState("inbox");
|
|
107
|
+
const list = view === "inbox" ? inbox : items;
|
|
108
|
+
const emptyLabel = view === "inbox" ? "You're all caught up" : "No notifications yet";
|
|
109
|
+
return /* @__PURE__ */ jsxs(Stack, { gap: "xs", style: { width: 320 }, children: [
|
|
110
|
+
/* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", wrap: "nowrap", children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, children: "Notifications" }),
|
|
112
|
+
unreadCount > 0 && /* @__PURE__ */ jsx(Button, { variant: "subtle", size: "compact-xs", onClick: markAllRead, children: "Mark all read" })
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
SegmentedControl,
|
|
116
|
+
{
|
|
117
|
+
fullWidth: true,
|
|
118
|
+
size: "xs",
|
|
119
|
+
value: view,
|
|
120
|
+
onChange: (value) => setView(value),
|
|
121
|
+
data: [
|
|
122
|
+
{ value: "inbox", label: inbox.length > 0 ? `Inbox (${inbox.length})` : "Inbox" },
|
|
123
|
+
{ value: "all", label: "All" }
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
list.length === 0 ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", py: "lg", children: emptyLabel }) : /* @__PURE__ */ jsx(ScrollArea.Autosize, { mah: maxHeight, type: "hover", children: /* @__PURE__ */ jsx(Stack, { gap: 4, pr: "xs", children: list.map((item) => /* @__PURE__ */ jsx(
|
|
128
|
+
NotificationItem,
|
|
129
|
+
{
|
|
130
|
+
item,
|
|
131
|
+
view,
|
|
132
|
+
onMarkRead: markRead,
|
|
133
|
+
onDismiss: dismiss,
|
|
134
|
+
onRemove: remove
|
|
135
|
+
},
|
|
136
|
+
item.id
|
|
137
|
+
)) }) }),
|
|
138
|
+
view === "inbox" && inbox.length > 0 && /* @__PURE__ */ jsx(Group, { justify: "flex-end", children: /* @__PURE__ */ jsx(Button, { variant: "subtle", size: "compact-xs", color: "gray", onClick: dismissAll, children: "Dismiss all" }) }),
|
|
139
|
+
view === "all" && items.length > 0 && /* @__PURE__ */ jsx(Group, { justify: "flex-end", children: /* @__PURE__ */ jsx(Button, { variant: "subtle", size: "compact-xs", color: "gray", onClick: clear, children: "Clear all" }) })
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
NotificationCenter
|
|
144
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineNotifications — const-generic factory for typed notification kind registries.
|
|
3
|
+
* Mirrors the defineSeries pattern from ./tokens (const-generic, identity passthrough).
|
|
4
|
+
*
|
|
5
|
+
* Consumer augments BasaltRegister.notifications with the spec map type, then uses the typed
|
|
6
|
+
* `emit` helper which resolves the registered kind at compile-time. An unknown kind is a tsc error.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // notifications.ts (app-side)
|
|
10
|
+
* import { defineNotifications } from 'basalt-ui/notifications'
|
|
11
|
+
* export const NOTIFICATIONS = defineNotifications({
|
|
12
|
+
* 'upload:success': { intent: 'success', toMessage: (p: { name: string }) => `Uploaded ${p.name}` },
|
|
13
|
+
* 'upload:error': { intent: 'error', toMessage: (_: unknown) => 'Upload failed' },
|
|
14
|
+
* })
|
|
15
|
+
* declare module 'basalt-ui' {
|
|
16
|
+
* interface BasaltRegister { notifications: typeof NOTIFICATIONS }
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* // usage.ts
|
|
20
|
+
* import { emit } from 'basalt-ui/notifications'
|
|
21
|
+
* emit('upload:success', { name: 'photo.jpg' }) // ✓ typed
|
|
22
|
+
* emit('nonexistent', {}) // ✗ tsc error
|
|
23
|
+
*/
|
|
24
|
+
import type { ReactNode } from 'react';
|
|
25
|
+
import type { Slot } from '../register.js';
|
|
26
|
+
import type { NotifyOptions, NotificationIntent } from './notify.js';
|
|
27
|
+
import type { NotificationActionRef } from './store.js';
|
|
28
|
+
export type { NotificationIntent };
|
|
29
|
+
/**
|
|
30
|
+
* The action a notification kind carries: a button label + a handler. The handler lives in the
|
|
31
|
+
* registry (code, app-scoped) — only a serializable `{ kind, payload }` ref is persisted — so an
|
|
32
|
+
* actionable notification keeps working after a reload. The handler can do anything (navigate, open
|
|
33
|
+
* a modal, retry a request); it receives the same payload that was passed to `emit`.
|
|
34
|
+
*/
|
|
35
|
+
export type NotificationAction = {
|
|
36
|
+
label: string;
|
|
37
|
+
run: (payload: unknown) => void;
|
|
38
|
+
};
|
|
39
|
+
/** A single notification kind spec — intent + optional payload→message renderer + optional action. */
|
|
40
|
+
export type NotificationSpec = {
|
|
41
|
+
intent?: NotificationIntent;
|
|
42
|
+
toMessage?: (payload: unknown) => ReactNode;
|
|
43
|
+
action?: NotificationAction;
|
|
44
|
+
};
|
|
45
|
+
/** The map of kind → spec that a consumer registers. */
|
|
46
|
+
export type NotificationSpecMap = Record<string, NotificationSpec>;
|
|
47
|
+
/** The consumer's registered notification spec map, or `{}` when un-augmented. */
|
|
48
|
+
type Notifications = Slot<'notifications', NotificationSpecMap>;
|
|
49
|
+
/**
|
|
50
|
+
* The legal notification kind keys.
|
|
51
|
+
* Extract<…, string> drops symbol/number members that `keyof` always includes.
|
|
52
|
+
* Un-augmented: `never`. Augmented: the exact string literal union.
|
|
53
|
+
*/
|
|
54
|
+
export type NotificationKind = Extract<keyof Notifications, string>;
|
|
55
|
+
/**
|
|
56
|
+
* Type a single notification spec without registering it.
|
|
57
|
+
* Identity passthrough — preserves the exact literal shape for local type-checking.
|
|
58
|
+
*
|
|
59
|
+
* **WARNING:** this does NOT register the spec in the runtime registry and does NOT
|
|
60
|
+
* augment BasaltRegister. Use `defineNotifications` (plural) to register a full spec
|
|
61
|
+
* map and enable `emit()`. Use this only when you need to type an isolated spec constant
|
|
62
|
+
* before merging it into a larger map.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* const uploadSuccess = defineNotification({
|
|
66
|
+
* intent: 'success',
|
|
67
|
+
* toMessage: (p: { name: string }) => `Uploaded ${p.name}`,
|
|
68
|
+
* })
|
|
69
|
+
* // Merge into the full registry before passing to defineNotifications:
|
|
70
|
+
* const NOTIFICATIONS = defineNotifications({ 'upload:success': uploadSuccess })
|
|
71
|
+
*/
|
|
72
|
+
export declare function defineNotification<const T extends NotificationSpec>(spec: T): T;
|
|
73
|
+
export declare function defineNotifications<const T extends NotificationSpecMap>(spec: T): T;
|
|
74
|
+
/**
|
|
75
|
+
* Emit a registered notification kind. The kind must be a key of the consumer's registered
|
|
76
|
+
* `BasaltRegister.notifications` map — any other string is a tsc error.
|
|
77
|
+
*
|
|
78
|
+
* Resolves the spec's intent + toMessage, then calls notify(). Extra opts override spec defaults.
|
|
79
|
+
*
|
|
80
|
+
* Un-augmented (Notifications = {}): NotificationKind = never → `emit` is effectively uncallable.
|
|
81
|
+
* Augmented: only the registered keys are accepted.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* emit('upload:success', { name: 'photo.jpg' })
|
|
85
|
+
* emit('upload:error', null, { title: 'Storage full' })
|
|
86
|
+
*/
|
|
87
|
+
export declare function emit(kind: NotificationKind, payload?: unknown, opts?: Omit<NotifyOptions, 'intent' | 'message'>): string;
|
|
88
|
+
/**
|
|
89
|
+
* Resolve a persisted action ref against the active registry — returns the button label and a
|
|
90
|
+
* bound handler, or undefined if the kind is unregistered (e.g. the registry changed since the
|
|
91
|
+
* item was stored). Used by the notification center to render an item's action.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveAction(ref: NotificationActionRef): {
|
|
94
|
+
label: string;
|
|
95
|
+
run: () => void;
|
|
96
|
+
} | undefined;
|
|
97
|
+
//# sourceMappingURL=define-notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-notifications.d.ts","sourceRoot":"","sources":["../../src/notifications/define-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,YAAY,EAAE,kBAAkB,EAAE,CAAA;AAIlC;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAChC,CAAA;AAID,sGAAsG;AACtG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAA;IAC3B,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAA;IAC3C,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAED,wDAAwD;AACxD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;AAIlE,kFAAkF;AAClF,KAAK,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAA;AAE/D;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,aAAa,EAAE,MAAM,CAAC,CAAA;AAInE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,CAAC,SAAS,gBAAgB,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAE/E;AAsBD,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAGnF;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,OAAO,EACjB,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,SAAS,CAAC,GAC/C,MAAM,CAWR;AAID;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,qBAAqB,GACzB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,SAAS,CAIhD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { notify } from "./notify.js";
|
|
2
|
+
function defineNotification(spec) {
|
|
3
|
+
return spec;
|
|
4
|
+
}
|
|
5
|
+
let activeRegistry = {};
|
|
6
|
+
function defineNotifications(spec) {
|
|
7
|
+
activeRegistry = spec;
|
|
8
|
+
return spec;
|
|
9
|
+
}
|
|
10
|
+
function emit(kind, payload, opts) {
|
|
11
|
+
const spec = activeRegistry[kind];
|
|
12
|
+
const intent = spec?.intent ?? "info";
|
|
13
|
+
const message = spec?.toMessage !== void 0 ? spec.toMessage(payload) : kind;
|
|
14
|
+
const action = spec?.action !== void 0 ? { kind, payload } : void 0;
|
|
15
|
+
return notify({ ...opts, intent, message, ...action !== void 0 && { action } });
|
|
16
|
+
}
|
|
17
|
+
function resolveAction(ref) {
|
|
18
|
+
const action = activeRegistry[ref.kind]?.action;
|
|
19
|
+
if (action === void 0) return void 0;
|
|
20
|
+
return { label: action.label, run: () => action.run(ref.payload) };
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
defineNotification,
|
|
24
|
+
defineNotifications,
|
|
25
|
+
emit,
|
|
26
|
+
resolveAction
|
|
27
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ./notifications — Mantine notification adapter battery.
|
|
3
|
+
*
|
|
4
|
+
* Provides notify helpers, a typed registry, a persisted history store, and a bell/center
|
|
5
|
+
* overlay component on top of @mantine/notifications.
|
|
6
|
+
*
|
|
7
|
+
* Optional peer: @mantine/notifications ^9.3.0.
|
|
8
|
+
*
|
|
9
|
+
* Install with: bun add @mantine/notifications
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // main.tsx — mount the overlay:
|
|
13
|
+
* import { BasaltNotifications } from 'basalt-ui/notifications'
|
|
14
|
+
* <BasaltProvider><BasaltNotifications /><App /></BasaltProvider>
|
|
15
|
+
*
|
|
16
|
+
* // Usage:
|
|
17
|
+
* import { notifySuccess, notifyError, notifyPromise, NotificationBell } from 'basalt-ui/notifications'
|
|
18
|
+
* notifySuccess('Saved')
|
|
19
|
+
* notifyError('Failed', { title: 'Upload error' })
|
|
20
|
+
* notifyPromise(save(), { loading: 'Saving…', success: 'Saved', error: 'Failed' })
|
|
21
|
+
*
|
|
22
|
+
* // Shell bell (globalActions slot):
|
|
23
|
+
* <BasaltShell globalActions={<NotificationBell />} ... />
|
|
24
|
+
*/
|
|
25
|
+
export { notify, notifySuccess, notifyError, notifyWarning, notifyInfo, notifyPromise, } from './notify.js';
|
|
26
|
+
export type { NotifyOptions, NotifyPromiseMessages } from './notify.js';
|
|
27
|
+
export { defineNotification, defineNotifications, emit, resolveAction, type NotificationAction, type NotificationKind, type NotificationSpec, type NotificationSpecMap, type NotificationIntent, } from './define-notifications.js';
|
|
28
|
+
export { add, markRead, markAllRead, dismiss, dismissAll, remove, clear, needsAttention, useNotificationHistory, } from './store.js';
|
|
29
|
+
export type { NotificationActionRef, NotificationHistoryItem, NotificationHistoryState, UseNotificationHistoryReturn, } from './store.js';
|
|
30
|
+
export { NotificationBell } from './bell.js';
|
|
31
|
+
export type { NotificationBellProps } from './bell.js';
|
|
32
|
+
export { NotificationCenter } from './center.js';
|
|
33
|
+
export type { NotificationCenterProps } from './center.js';
|
|
34
|
+
export { BasaltNotifications } from './overlay.js';
|
|
35
|
+
export type { BasaltNotificationsProps } from './overlay.js';
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,EACX,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAGpE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,IAAI,EACJ,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAA;AAG/B,OAAO,EACL,GAAG,EACH,QAAQ,EACR,WAAW,EACX,OAAO,EACP,UAAU,EACV,MAAM,EACN,KAAK,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,SAAS,CAAA;AAChB,YAAY,EACV,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AACzC,YAAY,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAGnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAGvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC/C,YAAY,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
notify,
|
|
3
|
+
notifySuccess,
|
|
4
|
+
notifyError,
|
|
5
|
+
notifyWarning,
|
|
6
|
+
notifyInfo,
|
|
7
|
+
notifyPromise
|
|
8
|
+
} from "./notify.js";
|
|
9
|
+
import {
|
|
10
|
+
defineNotification,
|
|
11
|
+
defineNotifications,
|
|
12
|
+
emit,
|
|
13
|
+
resolveAction
|
|
14
|
+
} from "./define-notifications.js";
|
|
15
|
+
import {
|
|
16
|
+
add,
|
|
17
|
+
markRead,
|
|
18
|
+
markAllRead,
|
|
19
|
+
dismiss,
|
|
20
|
+
dismissAll,
|
|
21
|
+
remove,
|
|
22
|
+
clear,
|
|
23
|
+
needsAttention,
|
|
24
|
+
useNotificationHistory
|
|
25
|
+
} from "./store.js";
|
|
26
|
+
import { NotificationBell } from "./bell.js";
|
|
27
|
+
import { NotificationCenter } from "./center.js";
|
|
28
|
+
import { BasaltNotifications } from "./overlay.js";
|
|
29
|
+
export {
|
|
30
|
+
BasaltNotifications,
|
|
31
|
+
NotificationBell,
|
|
32
|
+
NotificationCenter,
|
|
33
|
+
add,
|
|
34
|
+
clear,
|
|
35
|
+
defineNotification,
|
|
36
|
+
defineNotifications,
|
|
37
|
+
dismiss,
|
|
38
|
+
dismissAll,
|
|
39
|
+
emit,
|
|
40
|
+
markAllRead,
|
|
41
|
+
markRead,
|
|
42
|
+
needsAttention,
|
|
43
|
+
notify,
|
|
44
|
+
notifyError,
|
|
45
|
+
notifyInfo,
|
|
46
|
+
notifyPromise,
|
|
47
|
+
notifySuccess,
|
|
48
|
+
notifyWarning,
|
|
49
|
+
remove,
|
|
50
|
+
resolveAction,
|
|
51
|
+
useNotificationHistory
|
|
52
|
+
};
|