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,658 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the `basalt check-theme` guard — specifically the `raw-surface` check that flags
|
|
3
|
+
* ad-hoc inline surface styling (border / borderRadius / boxShadow) in consumer code.
|
|
4
|
+
*
|
|
5
|
+
* `checkTheme(cwd)` scans the configured `roots` (from the consumer package.json `"basalt"` key)
|
|
6
|
+
* and returns 0 (clean) / 1 (violations), printing findings to stderr. Each case writes a tiny
|
|
7
|
+
* fixture repo into a temp dir, runs the guard against it, and asserts on the exit code plus the
|
|
8
|
+
* captured `raw-surface` lines.
|
|
9
|
+
*/
|
|
10
|
+
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
11
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
12
|
+
import { tmpdir } from 'node:os'
|
|
13
|
+
import { resolve } from 'node:path'
|
|
14
|
+
|
|
15
|
+
import { checkTheme } from './index.ts'
|
|
16
|
+
|
|
17
|
+
let dir: string
|
|
18
|
+
|
|
19
|
+
/** Write a consumer fixture: a package.json pointing `roots` at `src`, plus one component file. */
|
|
20
|
+
function fixture(source: string, basalt: Record<string, unknown> = { roots: ['src'] }): void {
|
|
21
|
+
writeFileSync(resolve(dir, 'package.json'), JSON.stringify({ name: 'fixture', basalt }))
|
|
22
|
+
mkdirSync(resolve(dir, 'src'), { recursive: true })
|
|
23
|
+
writeFileSync(resolve(dir, 'src', 'Card.tsx'), source)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Write a consumer fixture at an arbitrary path under the scanned root (e.g. a `charts/` subdir),
|
|
28
|
+
* so the path-gated `raw-visx-axis` guard can be exercised. `relPath` is relative to `src`.
|
|
29
|
+
*/
|
|
30
|
+
function fixtureAt(
|
|
31
|
+
relPath: string,
|
|
32
|
+
source: string,
|
|
33
|
+
basalt: Record<string, unknown> = { roots: ['src'] },
|
|
34
|
+
): void {
|
|
35
|
+
writeFileSync(resolve(dir, 'package.json'), JSON.stringify({ name: 'fixture', basalt }))
|
|
36
|
+
const abs = resolve(dir, 'src', relPath)
|
|
37
|
+
mkdirSync(resolve(abs, '..'), { recursive: true })
|
|
38
|
+
writeFileSync(abs, source)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Run the guard against the fixture, capturing stderr so we can assert on the emitted kinds. */
|
|
42
|
+
function run(): { code: number; err: string } {
|
|
43
|
+
const original = console.error
|
|
44
|
+
let err = ''
|
|
45
|
+
console.error = (...args: unknown[]) => {
|
|
46
|
+
err += `${args.join(' ')}\n`
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
return { code: checkTheme(dir), err }
|
|
50
|
+
} finally {
|
|
51
|
+
console.error = original
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
beforeEach(() => {
|
|
56
|
+
dir = mkdtempSync(resolve(tmpdir(), 'basalt-check-theme-'))
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
afterEach(() => {
|
|
60
|
+
rmSync(dir, { recursive: true, force: true })
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
describe('check-theme raw-surface', () => {
|
|
64
|
+
it('flags a raw inline border literal', () => {
|
|
65
|
+
fixture(`export const C = () => <div style={{ border: '1px solid #ccc' }} />\n`)
|
|
66
|
+
const { code, err } = run()
|
|
67
|
+
expect(code).toBe(1)
|
|
68
|
+
expect(err).toContain('raw-surface')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('flags a numeric borderRadius literal', () => {
|
|
72
|
+
fixture(`export const C = () => <div style={{ borderRadius: 8 }} />\n`)
|
|
73
|
+
const { code, err } = run()
|
|
74
|
+
expect(code).toBe(1)
|
|
75
|
+
expect(err).toContain('raw-surface')
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('flags a boxShadow literal', () => {
|
|
79
|
+
fixture(`export const C = () => <div style={{ boxShadow: '0 1px 3px rgba(0,0,0,.2)' }} />\n`)
|
|
80
|
+
const { code, err } = run()
|
|
81
|
+
expect(code).toBe(1)
|
|
82
|
+
expect(err).toContain('raw-surface')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
86
|
+
fixture(
|
|
87
|
+
`export const C = () => <div style={{ borderRadius: 8 }} /> // theme-allow: legacy widget\n`,
|
|
88
|
+
)
|
|
89
|
+
const { code, err } = run()
|
|
90
|
+
expect(code).toBe(0)
|
|
91
|
+
expect(err).not.toContain('raw-surface')
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('does NOT flag a var(--…) radius token', () => {
|
|
95
|
+
fixture(`export const C = () => <div style={{ borderRadius: 'var(--vx-radius-card)' }} />\n`)
|
|
96
|
+
const { code, err } = run()
|
|
97
|
+
expect(code).toBe(0)
|
|
98
|
+
expect(err).not.toContain('raw-surface')
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it('does NOT flag a var(--…) border token (regression: var() not adjacent to the quote)', () => {
|
|
102
|
+
// Use a Mantine component (not a raw <div>) so this isolates raw-surface's var() lookahead
|
|
103
|
+
// without also tripping the raw-html-layout guard (border is a layout/surface prop).
|
|
104
|
+
fixture(
|
|
105
|
+
`export const C = () => <Box style={{ border: '1px solid var(--vx-surface-border)' }} />\n`,
|
|
106
|
+
)
|
|
107
|
+
const { code, err } = run()
|
|
108
|
+
expect(code).toBe(0)
|
|
109
|
+
expect(err).not.toContain('raw-surface')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('does NOT flag a var(--…) boxShadow token (regression)', () => {
|
|
113
|
+
fixture(`export const C = () => <div style={{ boxShadow: 'var(--mantine-shadow-sm)' }} />\n`)
|
|
114
|
+
const { code, err } = run()
|
|
115
|
+
expect(code).toBe(0)
|
|
116
|
+
expect(err).not.toContain('raw-surface')
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it('does NOT flag a Mantine radius="md" prop (not inline surface styling)', () => {
|
|
120
|
+
fixture(`export const C = () => <Card radius="md" />\n`)
|
|
121
|
+
const { code, err } = run()
|
|
122
|
+
expect(code).toBe(0)
|
|
123
|
+
expect(err).not.toContain('raw-surface')
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it('does NOT flag an unrelated inline style (display: flex)', () => {
|
|
127
|
+
// A Mantine component with an inline flex/padding is not raw-surface. (display/spacing on a raw
|
|
128
|
+
// <div> is covered by the dedicated inline-display / raw-html-layout / inline-spacing checks.)
|
|
129
|
+
fixture(`export const C = () => <Box style={{ display: 'flex', padding: 8 }} />\n`, {
|
|
130
|
+
roots: ['src'],
|
|
131
|
+
inlineDisplay: false,
|
|
132
|
+
inlineSpacing: false,
|
|
133
|
+
})
|
|
134
|
+
const { code, err } = run()
|
|
135
|
+
expect(code).toBe(0)
|
|
136
|
+
expect(err).not.toContain('raw-surface')
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('respects the rawSurface:false config knob', () => {
|
|
140
|
+
fixture(`export const C = () => <div style={{ borderRadius: 8 }} />\n`, {
|
|
141
|
+
roots: ['src'],
|
|
142
|
+
rawSurface: false,
|
|
143
|
+
})
|
|
144
|
+
const { code, err } = run()
|
|
145
|
+
expect(code).toBe(0)
|
|
146
|
+
expect(err).not.toContain('raw-surface')
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
describe('check-theme card-with-border', () => {
|
|
151
|
+
it('fails the build on withBorder on a Card', () => {
|
|
152
|
+
fixture(`export const C = () => <Card padding="md" withBorder />\n`)
|
|
153
|
+
const { code, err } = run()
|
|
154
|
+
expect(code).toBe(1)
|
|
155
|
+
expect(err).toContain('card-with-border')
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
it('does NOT flag a Card that takes its depth from the theme', () => {
|
|
159
|
+
fixture(`export const C = () => <Card padding="md" />\n`)
|
|
160
|
+
const { code, err } = run()
|
|
161
|
+
expect(code).toBe(0)
|
|
162
|
+
expect(err).not.toContain('card-with-border')
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
it('respects the cardWithBorder:false config knob', () => {
|
|
166
|
+
fixture(`export const C = () => <Card withBorder />\n`, {
|
|
167
|
+
roots: ['src'],
|
|
168
|
+
cardWithBorder: false,
|
|
169
|
+
})
|
|
170
|
+
const { code, err } = run()
|
|
171
|
+
expect(code).toBe(0)
|
|
172
|
+
expect(err).not.toContain('card-with-border')
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
describe('check-theme off-system-surface-var', () => {
|
|
177
|
+
it('flags a raw Mantine gray ramp step used for surface color', () => {
|
|
178
|
+
fixture(
|
|
179
|
+
`export const C = () => <Box style={{ borderColor: 'var(--mantine-color-gray-3)' }} />\n`,
|
|
180
|
+
)
|
|
181
|
+
const { code, err } = run()
|
|
182
|
+
expect(code).toBe(1)
|
|
183
|
+
expect(err).toContain('off-system-surface-var')
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
it('flags a raw Mantine dark ramp step', () => {
|
|
187
|
+
fixture(`export const C = () => <Box bg="var(--mantine-color-dark-6)" />\n`)
|
|
188
|
+
const { code, err } = run()
|
|
189
|
+
expect(code).toBe(1)
|
|
190
|
+
expect(err).toContain('off-system-surface-var')
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
it('does NOT flag a --vx-surface-* token', () => {
|
|
194
|
+
fixture(`export const C = () => <Box bg="var(--vx-surface-panel)" />\n`)
|
|
195
|
+
const { code, err } = run()
|
|
196
|
+
expect(code).toBe(0)
|
|
197
|
+
expect(err).not.toContain('off-system-surface-var')
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
it('does NOT flag a named Mantine surface var (default-border)', () => {
|
|
201
|
+
fixture(`export const C = () => <Box bg="var(--mantine-color-default-border)" />\n`)
|
|
202
|
+
const { code, err } = run()
|
|
203
|
+
expect(code).toBe(0)
|
|
204
|
+
expect(err).not.toContain('off-system-surface-var')
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
it('respects the offSystemSurfaceVar:false config knob', () => {
|
|
208
|
+
fixture(`export const C = () => <Box bg="var(--mantine-color-gray-3)" />\n`, {
|
|
209
|
+
roots: ['src'],
|
|
210
|
+
offSystemSurfaceVar: false,
|
|
211
|
+
})
|
|
212
|
+
const { code, err } = run()
|
|
213
|
+
expect(code).toBe(0)
|
|
214
|
+
expect(err).not.toContain('off-system-surface-var')
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
218
|
+
fixture(
|
|
219
|
+
`export const C = () => <Box bg="var(--mantine-color-gray-3)" /> // theme-allow: legacy\n`,
|
|
220
|
+
)
|
|
221
|
+
const { code, err } = run()
|
|
222
|
+
expect(code).toBe(0)
|
|
223
|
+
expect(err).not.toContain('off-system-surface-var')
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
describe('check-theme raw-html-layout', () => {
|
|
228
|
+
it('flags a raw <div> with inline layout styling', () => {
|
|
229
|
+
fixture(`export const C = () => <div style={{ display: 'flex', gap: 8 }} />\n`)
|
|
230
|
+
const { code, err } = run()
|
|
231
|
+
expect(code).toBe(1)
|
|
232
|
+
expect(err).toContain('raw-html-layout')
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
it('flags a raw <section> with inline padding', () => {
|
|
236
|
+
fixture(`export const C = () => <section style={{ padding: 16 }}>x</section>\n`)
|
|
237
|
+
const { code, err } = run()
|
|
238
|
+
expect(code).toBe(1)
|
|
239
|
+
expect(err).toContain('raw-html-layout')
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('does NOT flag a bare <div ref={...}> with no style', () => {
|
|
243
|
+
fixture(`export const C = (r) => <div ref={r} className="x" />\n`)
|
|
244
|
+
const { code, err } = run()
|
|
245
|
+
expect(code).toBe(0)
|
|
246
|
+
expect(err).not.toContain('raw-html-layout')
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
it('does NOT flag an <img> (not a layout element)', () => {
|
|
250
|
+
fixture(`export const C = () => <img style={{ width: 40, height: 40 }} src="a.png" />\n`)
|
|
251
|
+
const { code, err } = run()
|
|
252
|
+
expect(code).toBe(0)
|
|
253
|
+
expect(err).not.toContain('raw-html-layout')
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
it('respects the rawHtmlLayout:false config knob', () => {
|
|
257
|
+
fixture(`export const C = () => <div style={{ display: 'flex' }} />\n`, {
|
|
258
|
+
roots: ['src'],
|
|
259
|
+
rawHtmlLayout: false,
|
|
260
|
+
// disable the overlapping checks so we isolate raw-html-layout
|
|
261
|
+
inlineDisplay: false,
|
|
262
|
+
})
|
|
263
|
+
const { code, err } = run()
|
|
264
|
+
expect(code).toBe(0)
|
|
265
|
+
expect(err).not.toContain('raw-html-layout')
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
269
|
+
fixture(`export const C = () => <div style={{ display: 'flex' }} /> // theme-allow\n`)
|
|
270
|
+
const { code, err } = run()
|
|
271
|
+
expect(code).toBe(0)
|
|
272
|
+
expect(err).not.toContain('raw-html-layout')
|
|
273
|
+
})
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
describe('check-theme inline-spacing', () => {
|
|
277
|
+
it('flags an inline padding literal', () => {
|
|
278
|
+
fixture(`export const C = () => <Box style={{ padding: 16 }} />\n`)
|
|
279
|
+
const { code, err } = run()
|
|
280
|
+
expect(code).toBe(1)
|
|
281
|
+
expect(err).toContain('inline-spacing')
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
it('flags an inline marginTop string literal', () => {
|
|
285
|
+
fixture(`export const C = () => <Box style={{ marginTop: '12px' }} />\n`)
|
|
286
|
+
const { code, err } = run()
|
|
287
|
+
expect(code).toBe(1)
|
|
288
|
+
expect(err).toContain('inline-spacing')
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
it('does NOT flag a zero value', () => {
|
|
292
|
+
fixture(`export const C = () => <Box style={{ padding: 0, color: 'red' }} />\n`)
|
|
293
|
+
const { err } = run()
|
|
294
|
+
expect(err).not.toContain('inline-spacing')
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
it('does NOT flag a var(--…) gap token', () => {
|
|
298
|
+
fixture(`export const C = () => <Box style={{ gap: 'var(--mantine-spacing-md)' }} />\n`)
|
|
299
|
+
const { err } = run()
|
|
300
|
+
expect(err).not.toContain('inline-spacing')
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
it('respects the inlineSpacing:false config knob', () => {
|
|
304
|
+
fixture(`export const C = () => <Box style={{ padding: 16 }} />\n`, {
|
|
305
|
+
roots: ['src'],
|
|
306
|
+
inlineSpacing: false,
|
|
307
|
+
})
|
|
308
|
+
const { err } = run()
|
|
309
|
+
expect(err).not.toContain('inline-spacing')
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
313
|
+
fixture(`export const C = () => <Box style={{ padding: 16 }} /> // theme-allow\n`)
|
|
314
|
+
const { err } = run()
|
|
315
|
+
expect(err).not.toContain('inline-spacing')
|
|
316
|
+
})
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
describe('check-theme inline-display', () => {
|
|
320
|
+
it('flags an inline display:flex', () => {
|
|
321
|
+
fixture(`export const C = () => <Box style={{ display: 'flex' }} />\n`)
|
|
322
|
+
const { code, err } = run()
|
|
323
|
+
expect(code).toBe(1)
|
|
324
|
+
expect(err).toContain('inline-display')
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
it('flags an inline display:grid', () => {
|
|
328
|
+
fixture(`export const C = () => <Box style={{ display: "grid" }} />\n`)
|
|
329
|
+
const { code, err } = run()
|
|
330
|
+
expect(code).toBe(1)
|
|
331
|
+
expect(err).toContain('inline-display')
|
|
332
|
+
})
|
|
333
|
+
|
|
334
|
+
it('does NOT flag display:block', () => {
|
|
335
|
+
fixture(`export const C = () => <Box style={{ display: 'block' }} />\n`)
|
|
336
|
+
const { err } = run()
|
|
337
|
+
expect(err).not.toContain('inline-display')
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
it('respects the inlineDisplay:false config knob', () => {
|
|
341
|
+
fixture(`export const C = () => <Box style={{ display: 'flex' }} />\n`, {
|
|
342
|
+
roots: ['src'],
|
|
343
|
+
inlineDisplay: false,
|
|
344
|
+
})
|
|
345
|
+
const { err } = run()
|
|
346
|
+
expect(err).not.toContain('inline-display')
|
|
347
|
+
})
|
|
348
|
+
|
|
349
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
350
|
+
fixture(`export const C = () => <Box style={{ display: 'flex' }} /> // theme-allow\n`)
|
|
351
|
+
const { err } = run()
|
|
352
|
+
expect(err).not.toContain('inline-display')
|
|
353
|
+
})
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
describe('check-theme raw-visx-axis', () => {
|
|
357
|
+
it('flags a raw <AxisLeft> in a chart file', () => {
|
|
358
|
+
fixtureAt(
|
|
359
|
+
'charts/kinds/Foo.tsx',
|
|
360
|
+
`export const Foo = () => <AxisLeft scale={s} numTicks={4} />\n`,
|
|
361
|
+
)
|
|
362
|
+
const { code, err } = run()
|
|
363
|
+
expect(code).toBe(1)
|
|
364
|
+
expect(err).toContain('raw-visx-axis')
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
it('flags a raw <AxisBottom> and <AxisRight> in a chart file', () => {
|
|
368
|
+
fixtureAt(
|
|
369
|
+
'charts/kinds/Foo.tsx',
|
|
370
|
+
`export const Foo = () => (\n <>\n <AxisBottom scale={x} />\n <AxisRight scale={y} />\n </>\n)\n`,
|
|
371
|
+
)
|
|
372
|
+
const { code, err } = run()
|
|
373
|
+
expect(code).toBe(1)
|
|
374
|
+
expect(err).toContain('raw-visx-axis')
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
it('does NOT flag a chart-path <AxisLeft> carrying a theme-allow comment', () => {
|
|
378
|
+
fixtureAt(
|
|
379
|
+
'charts/kinds/Foo.tsx',
|
|
380
|
+
`export const Foo = () => <AxisLeft scale={s} /> // theme-allow: bespoke dual-panel\n`,
|
|
381
|
+
)
|
|
382
|
+
const { code, err } = run()
|
|
383
|
+
expect(code).toBe(0)
|
|
384
|
+
expect(err).not.toContain('raw-visx-axis')
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
it('does NOT flag a raw <AxisLeft> in a NON-chart path', () => {
|
|
388
|
+
fixtureAt('widgets/Foo.tsx', `export const Foo = () => <AxisLeft scale={s} />\n`)
|
|
389
|
+
const { code, err } = run()
|
|
390
|
+
expect(code).toBe(0)
|
|
391
|
+
expect(err).not.toContain('raw-visx-axis')
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
it('does NOT flag AxisLeftNumeric usage in a chart file', () => {
|
|
395
|
+
fixtureAt(
|
|
396
|
+
'charts/kinds/Foo.tsx',
|
|
397
|
+
`export const Foo = () => <AxisLeftNumeric scale={s} numTicks={4} />\n`,
|
|
398
|
+
)
|
|
399
|
+
const { code, err } = run()
|
|
400
|
+
expect(code).toBe(0)
|
|
401
|
+
expect(err).not.toContain('raw-visx-axis')
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
it('does NOT flag raw <AxisLeft> in the Axes.tsx wrapper primitive', () => {
|
|
405
|
+
fixtureAt(
|
|
406
|
+
'charts/primitives/Axes.tsx',
|
|
407
|
+
`export const AxisLeftNumeric = (p) => <AxisLeft {...p} />\n`,
|
|
408
|
+
)
|
|
409
|
+
const { code, err } = run()
|
|
410
|
+
expect(code).toBe(0)
|
|
411
|
+
expect(err).not.toContain('raw-visx-axis')
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
it('respects the rawVisxAxis:false config knob', () => {
|
|
415
|
+
fixtureAt('charts/kinds/Foo.tsx', `export const Foo = () => <AxisLeft scale={s} />\n`, {
|
|
416
|
+
roots: ['src'],
|
|
417
|
+
rawVisxAxis: false,
|
|
418
|
+
})
|
|
419
|
+
const { code, err } = run()
|
|
420
|
+
expect(code).toBe(0)
|
|
421
|
+
expect(err).not.toContain('raw-visx-axis')
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
describe('check-theme unframed-chart', () => {
|
|
426
|
+
it('flags a hand-rolled <ChartLegend items={[...]}> array literal', () => {
|
|
427
|
+
fixtureAt(
|
|
428
|
+
'charts/kinds/Foo.tsx',
|
|
429
|
+
`export const Foo = () => <ChartLegend items={[{ key: 'a', label: 'A', color: '#fff' }]} />\n`,
|
|
430
|
+
)
|
|
431
|
+
const { code, err } = run()
|
|
432
|
+
expect(code).toBe(1)
|
|
433
|
+
expect(err).toContain('unframed-chart')
|
|
434
|
+
})
|
|
435
|
+
|
|
436
|
+
it('flags a hand-rolled legend array literal formatted across multiple lines', () => {
|
|
437
|
+
fixtureAt(
|
|
438
|
+
'charts/kinds/Foo.tsx',
|
|
439
|
+
[
|
|
440
|
+
'export const Foo = () => (',
|
|
441
|
+
' <ChartLegend',
|
|
442
|
+
" items={[{ key: 'a', label: 'A', color: VX.line }]}",
|
|
443
|
+
' placement="bottom"',
|
|
444
|
+
' />',
|
|
445
|
+
')',
|
|
446
|
+
'',
|
|
447
|
+
].join('\n'),
|
|
448
|
+
)
|
|
449
|
+
const { code, err } = run()
|
|
450
|
+
expect(code).toBe(1)
|
|
451
|
+
expect(err).toContain('unframed-chart')
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
it('does NOT flag a derived legend (items={deriveLegend(series)})', () => {
|
|
455
|
+
fixtureAt(
|
|
456
|
+
'charts/primitives/ChartFrame.tsx',
|
|
457
|
+
[
|
|
458
|
+
'export const Foo = () => (',
|
|
459
|
+
' <ChartLegend',
|
|
460
|
+
' items={deriveLegend(series)}',
|
|
461
|
+
' placement={placement}',
|
|
462
|
+
' />',
|
|
463
|
+
')',
|
|
464
|
+
'',
|
|
465
|
+
].join('\n'),
|
|
466
|
+
)
|
|
467
|
+
const { code, err } = run()
|
|
468
|
+
expect(code).toBe(0)
|
|
469
|
+
expect(err).not.toContain('unframed-chart')
|
|
470
|
+
})
|
|
471
|
+
|
|
472
|
+
it('does NOT flag an unrelated items={[...]} prop on a non-ChartLegend component', () => {
|
|
473
|
+
fixtureAt('widgets/Menu.tsx', `export const Foo = () => <Menu items={[{ label: 'a' }]} />\n`)
|
|
474
|
+
const { code, err } = run()
|
|
475
|
+
expect(code).toBe(0)
|
|
476
|
+
expect(err).not.toContain('unframed-chart')
|
|
477
|
+
})
|
|
478
|
+
|
|
479
|
+
it('respects the unframedChart:false config knob', () => {
|
|
480
|
+
fixtureAt(
|
|
481
|
+
'charts/kinds/Foo.tsx',
|
|
482
|
+
`export const Foo = () => <ChartLegend items={[{ key: 'a', label: 'A' }]} />\n`,
|
|
483
|
+
{ roots: ['src'], unframedChart: false },
|
|
484
|
+
)
|
|
485
|
+
const { code, err } = run()
|
|
486
|
+
expect(code).toBe(0)
|
|
487
|
+
expect(err).not.toContain('unframed-chart')
|
|
488
|
+
})
|
|
489
|
+
|
|
490
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
491
|
+
fixtureAt(
|
|
492
|
+
'charts/kinds/Foo.tsx',
|
|
493
|
+
`export const Foo = () => <ChartLegend items={[{ key: 'a', label: 'A' }]} /> // theme-allow: bespoke legend\n`,
|
|
494
|
+
)
|
|
495
|
+
const { code, err } = run()
|
|
496
|
+
expect(code).toBe(0)
|
|
497
|
+
expect(err).not.toContain('unframed-chart')
|
|
498
|
+
})
|
|
499
|
+
})
|
|
500
|
+
|
|
501
|
+
describe('check-theme raw-form-control', () => {
|
|
502
|
+
it('fails the build on a raw <input>', () => {
|
|
503
|
+
fixture(`export const C = () => <input type="text" value={v} />\n`)
|
|
504
|
+
const { code, err } = run()
|
|
505
|
+
expect(code).toBe(1)
|
|
506
|
+
expect(err).toContain('raw-form-control')
|
|
507
|
+
})
|
|
508
|
+
|
|
509
|
+
it('fails the build on a raw <select>', () => {
|
|
510
|
+
fixture(`export const C = () => <select value={v}><option>A</option></select>\n`)
|
|
511
|
+
const { code, err } = run()
|
|
512
|
+
expect(code).toBe(1)
|
|
513
|
+
expect(err).toContain('raw-form-control')
|
|
514
|
+
})
|
|
515
|
+
|
|
516
|
+
it('fails the build on a raw <textarea>', () => {
|
|
517
|
+
fixture(`export const C = () => <textarea value={v} />\n`)
|
|
518
|
+
const { code, err } = run()
|
|
519
|
+
expect(code).toBe(1)
|
|
520
|
+
expect(err).toContain('raw-form-control')
|
|
521
|
+
})
|
|
522
|
+
|
|
523
|
+
it('does NOT flag a Mantine TextInput', () => {
|
|
524
|
+
fixture(`export const C = () => <TextInput value={v} onChange={onChange} />\n`)
|
|
525
|
+
const { code, err } = run()
|
|
526
|
+
expect(code).toBe(0)
|
|
527
|
+
expect(err).not.toContain('raw-form-control')
|
|
528
|
+
})
|
|
529
|
+
|
|
530
|
+
it('respects the rawFormControl:false config knob', () => {
|
|
531
|
+
fixture(`export const C = () => <input type="text" />\n`, {
|
|
532
|
+
roots: ['src'],
|
|
533
|
+
rawFormControl: false,
|
|
534
|
+
})
|
|
535
|
+
const { code, err } = run()
|
|
536
|
+
expect(code).toBe(0)
|
|
537
|
+
expect(err).not.toContain('raw-form-control')
|
|
538
|
+
})
|
|
539
|
+
|
|
540
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
541
|
+
fixture(`export const C = () => <input type="text" /> // theme-allow: legacy widget\n`)
|
|
542
|
+
const { code, err } = run()
|
|
543
|
+
expect(code).toBe(0)
|
|
544
|
+
expect(err).not.toContain('raw-form-control')
|
|
545
|
+
})
|
|
546
|
+
})
|
|
547
|
+
|
|
548
|
+
describe('check-theme sub-16-input-font', () => {
|
|
549
|
+
it('fails the build on a sub-16 inline fontSize on a raw <input>', () => {
|
|
550
|
+
fixture(`export const C = () => <input style={{ fontSize: 13, border: 'none' }} />\n`, {
|
|
551
|
+
roots: ['src'],
|
|
552
|
+
rawFormControl: false,
|
|
553
|
+
})
|
|
554
|
+
const { code, err } = run()
|
|
555
|
+
expect(code).toBe(1)
|
|
556
|
+
expect(err).toContain('sub-16-input-font')
|
|
557
|
+
})
|
|
558
|
+
|
|
559
|
+
it('fails the build on a Mantine styles={{ input: { fontSize } }} override', () => {
|
|
560
|
+
fixture(`export const C = () => <TextInput styles={{ input: { fontSize: 12 } }} />\n`)
|
|
561
|
+
const { code, err } = run()
|
|
562
|
+
expect(code).toBe(1)
|
|
563
|
+
expect(err).toContain('sub-16-input-font')
|
|
564
|
+
})
|
|
565
|
+
|
|
566
|
+
it('does NOT flag a fontSize below 16 on a <Text> (not a form control)', () => {
|
|
567
|
+
fixture(`export const C = () => <Text style={{ fontSize: 12 }}>caption</Text>\n`)
|
|
568
|
+
const { code, err } = run()
|
|
569
|
+
expect(code).toBe(0)
|
|
570
|
+
expect(err).not.toContain('sub-16-input-font')
|
|
571
|
+
})
|
|
572
|
+
|
|
573
|
+
it('does NOT flag a fontSize below 16 on a <span> (not a form control)', () => {
|
|
574
|
+
fixture(`export const C = () => <span style={{ fontSize: 11 }}>micro</span>\n`)
|
|
575
|
+
const { code, err } = run()
|
|
576
|
+
expect(code).toBe(0)
|
|
577
|
+
expect(err).not.toContain('sub-16-input-font')
|
|
578
|
+
})
|
|
579
|
+
|
|
580
|
+
it('respects the sub16InputFont:false config knob', () => {
|
|
581
|
+
fixture(`export const C = () => <input style={{ fontSize: 12 }} />\n`, {
|
|
582
|
+
roots: ['src'],
|
|
583
|
+
rawFormControl: false,
|
|
584
|
+
sub16InputFont: false,
|
|
585
|
+
})
|
|
586
|
+
const { code, err } = run()
|
|
587
|
+
expect(code).toBe(0)
|
|
588
|
+
expect(err).not.toContain('sub-16-input-font')
|
|
589
|
+
})
|
|
590
|
+
|
|
591
|
+
it('does NOT flag a line carrying a theme-allow comment', () => {
|
|
592
|
+
fixture(
|
|
593
|
+
`export const C = () => <input style={{ fontSize: 12 }} /> // theme-allow: legacy widget\n`,
|
|
594
|
+
{ roots: ['src'], rawFormControl: false },
|
|
595
|
+
)
|
|
596
|
+
const { code, err } = run()
|
|
597
|
+
expect(code).toBe(0)
|
|
598
|
+
expect(err).not.toContain('sub-16-input-font')
|
|
599
|
+
})
|
|
600
|
+
})
|
|
601
|
+
|
|
602
|
+
describe('check-theme roots fail-loud', () => {
|
|
603
|
+
it('exits non-zero when the built-in default roots match zero files', () => {
|
|
604
|
+
// No "basalt.roots" in package.json — falls back to the built-in defaults
|
|
605
|
+
// (apps/dashboard/src, packages/charts/src), which don't exist under this fixture at all.
|
|
606
|
+
writeFileSync(resolve(dir, 'package.json'), JSON.stringify({ name: 'fixture' }))
|
|
607
|
+
const { code, err } = run()
|
|
608
|
+
expect(code).toBe(1)
|
|
609
|
+
expect(err).toContain('basalt.roots')
|
|
610
|
+
})
|
|
611
|
+
|
|
612
|
+
it('exits non-zero when explicitly configured roots match zero files', () => {
|
|
613
|
+
writeFileSync(
|
|
614
|
+
resolve(dir, 'package.json'),
|
|
615
|
+
JSON.stringify({ name: 'fixture', basalt: { roots: ['nonexistent-dir'] } }),
|
|
616
|
+
)
|
|
617
|
+
const { code, err } = run()
|
|
618
|
+
expect(code).toBe(1)
|
|
619
|
+
expect(err).toContain('nonexistent-dir')
|
|
620
|
+
})
|
|
621
|
+
|
|
622
|
+
it('stays green when the configured roots match at least one file', () => {
|
|
623
|
+
fixture(`export const C = () => <Box p="md" />\n`)
|
|
624
|
+
const { code } = run()
|
|
625
|
+
expect(code).toBe(0)
|
|
626
|
+
})
|
|
627
|
+
})
|
|
628
|
+
|
|
629
|
+
describe('check-theme comment skipping', () => {
|
|
630
|
+
it('does NOT flag a banned element mentioned in a pure line comment', () => {
|
|
631
|
+
fixtureAt(
|
|
632
|
+
'charts/kinds/Foo.tsx',
|
|
633
|
+
`// never render a raw <AxisLeft> — use AxisLeftNumeric\nexport const Foo = () => <AxisLeftNumeric scale={s} />\n`,
|
|
634
|
+
)
|
|
635
|
+
const { code, err } = run()
|
|
636
|
+
expect(code).toBe(0)
|
|
637
|
+
expect(err).not.toContain('raw-visx-axis')
|
|
638
|
+
})
|
|
639
|
+
|
|
640
|
+
it('does NOT flag a banned token mentioned in a JSDoc body line', () => {
|
|
641
|
+
fixture(
|
|
642
|
+
`/**\n * Avoid var(--mantine-color-gray-3); use the surface token.\n */\nexport const C = 1\n`,
|
|
643
|
+
)
|
|
644
|
+
const { code, err } = run()
|
|
645
|
+
expect(code).toBe(0)
|
|
646
|
+
expect(err).not.toContain('off-system-surface-var')
|
|
647
|
+
})
|
|
648
|
+
|
|
649
|
+
it('still flags the real violation on a code line even when a comment mentions it too', () => {
|
|
650
|
+
fixtureAt(
|
|
651
|
+
'charts/kinds/Foo.tsx',
|
|
652
|
+
`// raw <AxisLeft> is banned\nexport const Foo = () => <AxisLeft scale={s} />\n`,
|
|
653
|
+
)
|
|
654
|
+
const { code, err } = run()
|
|
655
|
+
expect(code).toBe(1)
|
|
656
|
+
expect(err).toContain('raw-visx-axis')
|
|
657
|
+
})
|
|
658
|
+
})
|