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,834 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for checkSource — the pure (text, relPath, cfg) → Finding[] core.
|
|
3
|
+
*
|
|
4
|
+
* Covers all 18 guard kinds. Co-located with the guard, excluded from tsc
|
|
5
|
+
* (tsconfig exclude: src/**\/*.test.ts), run via `bun test`.
|
|
6
|
+
*
|
|
7
|
+
* The walker/reporter half is covered by the integration test in
|
|
8
|
+
* src/cli/check-theme.test.ts (temp-dir + exit-code contract).
|
|
9
|
+
*/
|
|
10
|
+
import { describe, expect, it } from 'bun:test'
|
|
11
|
+
import { checkSource, DEFAULT_GUARD_CONFIG } from './index'
|
|
12
|
+
import type { Finding, GuardKind } from './types'
|
|
13
|
+
|
|
14
|
+
const PATH = 'src/Dashboard.tsx'
|
|
15
|
+
const CHART_PATH = 'src/charts/kinds/Foo.tsx'
|
|
16
|
+
|
|
17
|
+
function kinds(findings: Finding[]): GuardKind[] {
|
|
18
|
+
return findings.map((f) => f.kind)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function find(text: string, relPath = PATH) {
|
|
22
|
+
return checkSource(text, relPath, DEFAULT_GUARD_CONFIG)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ── 1. raw-hex ────────────────────────────────────────────────────────────────
|
|
26
|
+
|
|
27
|
+
describe('raw-hex', () => {
|
|
28
|
+
it('flags a 6-digit hex literal', () => {
|
|
29
|
+
const f = find(`const c = '#a3b4c5'`)
|
|
30
|
+
expect(kinds(f)).toContain('raw-hex')
|
|
31
|
+
expect(f.find((x) => x.kind === 'raw-hex')?.token).toBe('#a3b4c5')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('flags a 3-digit hex literal', () => {
|
|
35
|
+
const f = find(`const c = '#abc'`)
|
|
36
|
+
expect(kinds(f)).toContain('raw-hex')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('reports correct line number', () => {
|
|
40
|
+
const f = find(`line one\nconst c = '#ff0000'\nline three`)
|
|
41
|
+
const hit = f.find((x) => x.kind === 'raw-hex')
|
|
42
|
+
expect(hit?.line).toBe(2)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('does NOT flag a line with a theme-allow comment', () => {
|
|
46
|
+
const f = find(`const c = '#ff0000' // theme-allow: legacy`)
|
|
47
|
+
expect(kinds(f)).not.toContain('raw-hex')
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('does NOT flag a pure line comment mentioning a hex', () => {
|
|
51
|
+
const f = find(`// use #ff0000 from the palette`)
|
|
52
|
+
expect(kinds(f)).not.toContain('raw-hex')
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// ── 2. raw-color-fn ──────────────────────────────────────────────────────────
|
|
57
|
+
|
|
58
|
+
describe('raw-color-fn', () => {
|
|
59
|
+
it('flags rgba()', () => {
|
|
60
|
+
const f = find(`const c = rgba(255, 0, 0, 0.5)`)
|
|
61
|
+
expect(kinds(f)).toContain('raw-color-fn')
|
|
62
|
+
expect(f.find((x) => x.kind === 'raw-color-fn')?.token).toBe('rgba(')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('flags rgb()', () => {
|
|
66
|
+
const f = find(`const c = rgb(10, 20, 30)`)
|
|
67
|
+
expect(kinds(f)).toContain('raw-color-fn')
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('flags hsl()', () => {
|
|
71
|
+
const f = find(`fill: hsl(200, 50%, 50%)`)
|
|
72
|
+
expect(kinds(f)).toContain('raw-color-fn')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('flags hsla()', () => {
|
|
76
|
+
const f = find(`fill: hsla(200, 50%, 50%, 0.5)`)
|
|
77
|
+
expect(kinds(f)).toContain('raw-color-fn')
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('does NOT flag a theme-allow line', () => {
|
|
81
|
+
const f = find(`const c = rgba(0,0,0,0.5) // theme-allow`)
|
|
82
|
+
expect(kinds(f)).not.toContain('raw-color-fn')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('does NOT flag a pure block comment line', () => {
|
|
86
|
+
const f = find(`* use rgba() for opacity`)
|
|
87
|
+
expect(kinds(f)).not.toContain('raw-color-fn')
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
// ── 3. localstorage-theme ────────────────────────────────────────────────────
|
|
92
|
+
|
|
93
|
+
describe('localstorage-theme', () => {
|
|
94
|
+
it('flags localStorage.getItem("theme")', () => {
|
|
95
|
+
const f = find(`const t = localStorage.getItem('theme')`)
|
|
96
|
+
expect(kinds(f)).toContain('localstorage-theme')
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('flags with double quotes', () => {
|
|
100
|
+
const f = find(`const t = localStorage.getItem("theme")`)
|
|
101
|
+
expect(kinds(f)).toContain('localstorage-theme')
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it('flags with whitespace around getItem call', () => {
|
|
105
|
+
const f = find(`localStorage . getItem ( 'theme' )`)
|
|
106
|
+
expect(kinds(f)).toContain('localstorage-theme')
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('does NOT flag localStorage.getItem("other-key")', () => {
|
|
110
|
+
const f = find(`localStorage.getItem('colorMode')`)
|
|
111
|
+
expect(kinds(f)).not.toContain('localstorage-theme')
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('does NOT flag a theme-allow line', () => {
|
|
115
|
+
const f = find(`localStorage.getItem('theme') // theme-allow: legacy`)
|
|
116
|
+
expect(kinds(f)).not.toContain('localstorage-theme')
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// ── 4. off-identity-accent ───────────────────────────────────────────────────
|
|
121
|
+
|
|
122
|
+
describe('off-identity-accent', () => {
|
|
123
|
+
it('flags a forbidden color prop (teal)', () => {
|
|
124
|
+
const f = find(`<Badge color="teal" />`)
|
|
125
|
+
expect(kinds(f)).toContain('off-identity-accent')
|
|
126
|
+
expect(f.find((x) => x.kind === 'off-identity-accent')?.token).toBe('teal')
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it('flags c="violet"', () => {
|
|
130
|
+
const f = find(`<Button c="violet" />`)
|
|
131
|
+
expect(kinds(f)).toContain('off-identity-accent')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it('flags bg="grape"', () => {
|
|
135
|
+
const f = find(`<Box bg="grape" />`)
|
|
136
|
+
expect(kinds(f)).toContain('off-identity-accent')
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('flags backgroundColor="indigo"', () => {
|
|
140
|
+
const f = find(`<Box backgroundColor="indigo" />`)
|
|
141
|
+
expect(kinds(f)).toContain('off-identity-accent')
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
it('does NOT flag color="blue" (allowed)', () => {
|
|
145
|
+
const f = find(`<Badge color="blue" />`)
|
|
146
|
+
expect(kinds(f)).not.toContain('off-identity-accent')
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('does NOT flag a theme-allow line', () => {
|
|
150
|
+
const f = find(`<Badge color="teal" /> // theme-allow: design exception`)
|
|
151
|
+
expect(kinds(f)).not.toContain('off-identity-accent')
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
// ── 5. raw-spacing ───────────────────────────────────────────────────────────
|
|
156
|
+
|
|
157
|
+
describe('raw-spacing', () => {
|
|
158
|
+
it('flags p={16} (default spacing step)', () => {
|
|
159
|
+
const f = find(`<Box p={16} />`)
|
|
160
|
+
expect(kinds(f)).toContain('raw-spacing')
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
it('flags gap={12}', () => {
|
|
164
|
+
const f = find(`<Stack gap={12} />`)
|
|
165
|
+
expect(kinds(f)).toContain('raw-spacing')
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
it('does NOT flag p={8} (not a default step)', () => {
|
|
169
|
+
const f = find(`<Box p={8} />`)
|
|
170
|
+
expect(kinds(f)).not.toContain('raw-spacing')
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
it('does NOT flag p="md" (string token)', () => {
|
|
174
|
+
const f = find(`<Box p="md" />`)
|
|
175
|
+
expect(kinds(f)).not.toContain('raw-spacing')
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
it('does NOT flag a theme-allow line', () => {
|
|
179
|
+
const f = find(`<Box p={16} /> // theme-allow`)
|
|
180
|
+
expect(kinds(f)).not.toContain('raw-spacing')
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
// ── 6. raw-radius ────────────────────────────────────────────────────────────
|
|
185
|
+
|
|
186
|
+
describe('raw-radius', () => {
|
|
187
|
+
it('flags radius={8}', () => {
|
|
188
|
+
const f = find(`<Card radius={8} />`)
|
|
189
|
+
expect(kinds(f)).toContain('raw-radius')
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
it('flags radius="4"', () => {
|
|
193
|
+
const f = find(`<Card radius="4" />`)
|
|
194
|
+
expect(kinds(f)).toContain('raw-radius')
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
it('does NOT flag radius="md"', () => {
|
|
198
|
+
const f = find(`<Card radius="md" />`)
|
|
199
|
+
expect(kinds(f)).not.toContain('raw-radius')
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
it('does NOT flag a theme-allow line', () => {
|
|
203
|
+
const f = find(`<Card radius={8} /> // theme-allow`)
|
|
204
|
+
expect(kinds(f)).not.toContain('raw-radius')
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
// ── 7. raw-surface ───────────────────────────────────────────────────────────
|
|
209
|
+
|
|
210
|
+
describe('raw-surface', () => {
|
|
211
|
+
it('flags an inline border literal', () => {
|
|
212
|
+
const f = find(`<div style={{ border: '1px solid #ccc' }} />`)
|
|
213
|
+
expect(kinds(f)).toContain('raw-surface')
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
it('flags a numeric borderRadius', () => {
|
|
217
|
+
const f = find(`<div style={{ borderRadius: 8 }} />`)
|
|
218
|
+
expect(kinds(f)).toContain('raw-surface')
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
it('flags a boxShadow literal', () => {
|
|
222
|
+
const f = find(`<div style={{ boxShadow: '0 1px 3px black' }} />`)
|
|
223
|
+
expect(kinds(f)).toContain('raw-surface')
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
it('does NOT flag a var(--…) border token', () => {
|
|
227
|
+
const f = find(`<Box style={{ border: '1px solid var(--vx-surface-border)' }} />`)
|
|
228
|
+
expect(kinds(f)).not.toContain('raw-surface')
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
it('does NOT flag a var(--…) boxShadow token', () => {
|
|
232
|
+
const f = find(`<div style={{ boxShadow: 'var(--mantine-shadow-sm)' }} />`)
|
|
233
|
+
expect(kinds(f)).not.toContain('raw-surface')
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it('does NOT flag when rawSurface is false', () => {
|
|
237
|
+
const f = checkSource(`<div style={{ borderRadius: 8 }} />`, PATH, {
|
|
238
|
+
...DEFAULT_GUARD_CONFIG,
|
|
239
|
+
rawSurface: false,
|
|
240
|
+
})
|
|
241
|
+
expect(kinds(f)).not.toContain('raw-surface')
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
it('does NOT flag a theme-allow line', () => {
|
|
245
|
+
const f = find(`<div style={{ borderRadius: 8 }} /> // theme-allow`)
|
|
246
|
+
expect(kinds(f)).not.toContain('raw-surface')
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
// ── 8. off-system-surface-var ─────────────────────────────────────────────────
|
|
251
|
+
|
|
252
|
+
describe('off-system-surface-var', () => {
|
|
253
|
+
it('flags a raw Mantine gray ramp step', () => {
|
|
254
|
+
const f = find(`<Box style={{ color: 'var(--mantine-color-gray-3)' }} />`)
|
|
255
|
+
expect(kinds(f)).toContain('off-system-surface-var')
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
it('flags a raw Mantine dark ramp step', () => {
|
|
259
|
+
const f = find(`<Box bg="var(--mantine-color-dark-6)" />`)
|
|
260
|
+
expect(kinds(f)).toContain('off-system-surface-var')
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
it('does NOT flag a --vx-surface-* token', () => {
|
|
264
|
+
const f = find(`<Box bg="var(--vx-surface-panel)" />`)
|
|
265
|
+
expect(kinds(f)).not.toContain('off-system-surface-var')
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
it('does NOT flag a named Mantine var (not a ramp step)', () => {
|
|
269
|
+
const f = find(`<Box bg="var(--mantine-color-default-border)" />`)
|
|
270
|
+
expect(kinds(f)).not.toContain('off-system-surface-var')
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
it('does NOT flag when offSystemSurfaceVar is false', () => {
|
|
274
|
+
const f = checkSource(`<Box bg="var(--mantine-color-gray-3)" />`, PATH, {
|
|
275
|
+
...DEFAULT_GUARD_CONFIG,
|
|
276
|
+
offSystemSurfaceVar: false,
|
|
277
|
+
})
|
|
278
|
+
expect(kinds(f)).not.toContain('off-system-surface-var')
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
it('does NOT flag a theme-allow line', () => {
|
|
282
|
+
const f = find(`<Box bg="var(--mantine-color-gray-3)" /> // theme-allow`)
|
|
283
|
+
expect(kinds(f)).not.toContain('off-system-surface-var')
|
|
284
|
+
})
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
// ── 9. raw-html-layout ───────────────────────────────────────────────────────
|
|
288
|
+
|
|
289
|
+
describe('raw-html-layout', () => {
|
|
290
|
+
it('flags a raw <div> with inline display:flex', () => {
|
|
291
|
+
const f = find(`<div style={{ display: 'flex', gap: 8 }} />`)
|
|
292
|
+
expect(kinds(f)).toContain('raw-html-layout')
|
|
293
|
+
})
|
|
294
|
+
|
|
295
|
+
it('flags a raw <section> with inline padding', () => {
|
|
296
|
+
const f = find(`<section style={{ padding: 16 }}>x</section>`)
|
|
297
|
+
expect(kinds(f)).toContain('raw-html-layout')
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
it('does NOT flag a bare <div> without style', () => {
|
|
301
|
+
const f = find(`<div ref={r} className="x" />`)
|
|
302
|
+
expect(kinds(f)).not.toContain('raw-html-layout')
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
it('does NOT flag an <img> (not a layout element)', () => {
|
|
306
|
+
const f = find(`<img style={{ width: 40 }} src="a.png" />`)
|
|
307
|
+
expect(kinds(f)).not.toContain('raw-html-layout')
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
it('does NOT flag when rawHtmlLayout is false', () => {
|
|
311
|
+
const f = checkSource(`<div style={{ display: 'flex' }} />`, PATH, {
|
|
312
|
+
...DEFAULT_GUARD_CONFIG,
|
|
313
|
+
rawHtmlLayout: false,
|
|
314
|
+
inlineDisplay: false,
|
|
315
|
+
})
|
|
316
|
+
expect(kinds(f)).not.toContain('raw-html-layout')
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
it('does NOT flag a theme-allow line', () => {
|
|
320
|
+
const f = find(`<div style={{ display: 'flex' }} /> // theme-allow`)
|
|
321
|
+
expect(kinds(f)).not.toContain('raw-html-layout')
|
|
322
|
+
})
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
// ── 10. inline-spacing ───────────────────────────────────────────────────────
|
|
326
|
+
|
|
327
|
+
describe('inline-spacing', () => {
|
|
328
|
+
it('flags padding: 16', () => {
|
|
329
|
+
const f = find(`<Box style={{ padding: 16 }} />`)
|
|
330
|
+
expect(kinds(f)).toContain('inline-spacing')
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
it('flags marginTop: "12px"', () => {
|
|
334
|
+
const f = find(`<Box style={{ marginTop: '12px' }} />`)
|
|
335
|
+
expect(kinds(f)).toContain('inline-spacing')
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
it('does NOT flag padding: 0', () => {
|
|
339
|
+
const f = find(`<Box style={{ padding: 0 }} />`)
|
|
340
|
+
expect(kinds(f)).not.toContain('inline-spacing')
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
it('does NOT flag a var(--…) gap token', () => {
|
|
344
|
+
const f = find(`<Box style={{ gap: 'var(--mantine-spacing-md)' }} />`)
|
|
345
|
+
expect(kinds(f)).not.toContain('inline-spacing')
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
it('does NOT flag when inlineSpacing is false', () => {
|
|
349
|
+
const f = checkSource(`<Box style={{ padding: 16 }} />`, PATH, {
|
|
350
|
+
...DEFAULT_GUARD_CONFIG,
|
|
351
|
+
inlineSpacing: false,
|
|
352
|
+
})
|
|
353
|
+
expect(kinds(f)).not.toContain('inline-spacing')
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
it('does NOT flag a theme-allow line', () => {
|
|
357
|
+
const f = find(`<Box style={{ padding: 16 }} /> // theme-allow`)
|
|
358
|
+
expect(kinds(f)).not.toContain('inline-spacing')
|
|
359
|
+
})
|
|
360
|
+
})
|
|
361
|
+
|
|
362
|
+
// ── 11. inline-display ───────────────────────────────────────────────────────
|
|
363
|
+
|
|
364
|
+
describe('inline-display', () => {
|
|
365
|
+
it('flags display: "flex"', () => {
|
|
366
|
+
const f = find(`<Box style={{ display: 'flex' }} />`)
|
|
367
|
+
expect(kinds(f)).toContain('inline-display')
|
|
368
|
+
})
|
|
369
|
+
|
|
370
|
+
it('flags display: "grid"', () => {
|
|
371
|
+
const f = find(`<Box style={{ display: "grid" }} />`)
|
|
372
|
+
expect(kinds(f)).toContain('inline-display')
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
it('flags display: "inline-flex"', () => {
|
|
376
|
+
const f = find(`<Box style={{ display: 'inline-flex' }} />`)
|
|
377
|
+
expect(kinds(f)).toContain('inline-display')
|
|
378
|
+
})
|
|
379
|
+
|
|
380
|
+
it('does NOT flag display: "block"', () => {
|
|
381
|
+
const f = find(`<Box style={{ display: 'block' }} />`)
|
|
382
|
+
expect(kinds(f)).not.toContain('inline-display')
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
it('does NOT flag when inlineDisplay is false', () => {
|
|
386
|
+
const f = checkSource(`<Box style={{ display: 'flex' }} />`, PATH, {
|
|
387
|
+
...DEFAULT_GUARD_CONFIG,
|
|
388
|
+
inlineDisplay: false,
|
|
389
|
+
})
|
|
390
|
+
expect(kinds(f)).not.toContain('inline-display')
|
|
391
|
+
})
|
|
392
|
+
|
|
393
|
+
it('does NOT flag a theme-allow line', () => {
|
|
394
|
+
const f = find(`<Box style={{ display: 'flex' }} /> // theme-allow`)
|
|
395
|
+
expect(kinds(f)).not.toContain('inline-display')
|
|
396
|
+
})
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
// ── 12. raw-visx-axis ────────────────────────────────────────────────────────
|
|
400
|
+
|
|
401
|
+
describe('raw-visx-axis', () => {
|
|
402
|
+
it('flags <AxisLeft> in a chart file', () => {
|
|
403
|
+
const f = find(`<AxisLeft scale={s} numTicks={4} />`, CHART_PATH)
|
|
404
|
+
expect(kinds(f)).toContain('raw-visx-axis')
|
|
405
|
+
expect(f.find((x) => x.kind === 'raw-visx-axis')?.token).toBe('<AxisLeft')
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
it('flags <AxisBottom> in a chart file', () => {
|
|
409
|
+
const f = find(`<AxisBottom scale={x} />`, CHART_PATH)
|
|
410
|
+
expect(kinds(f)).toContain('raw-visx-axis')
|
|
411
|
+
})
|
|
412
|
+
|
|
413
|
+
it('flags <AxisRight> in a chart file', () => {
|
|
414
|
+
const f = find(`<AxisRight scale={y} />`, CHART_PATH)
|
|
415
|
+
expect(kinds(f)).toContain('raw-visx-axis')
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
it('does NOT flag <AxisLeft> in a NON-chart path', () => {
|
|
419
|
+
const f = find(`<AxisLeft scale={s} />`, PATH)
|
|
420
|
+
expect(kinds(f)).not.toContain('raw-visx-axis')
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
it('does NOT flag <AxisLeftNumeric> in a chart file (not a raw axis)', () => {
|
|
424
|
+
const f = find(`<AxisLeftNumeric scale={s} />`, CHART_PATH)
|
|
425
|
+
expect(kinds(f)).not.toContain('raw-visx-axis')
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
it('does NOT flag <AxisLeft> in Axes.tsx (the wrapper primitive)', () => {
|
|
429
|
+
const f = find(
|
|
430
|
+
`export const AxisLeftNumeric = (p) => <AxisLeft {...p} />`,
|
|
431
|
+
'src/charts/primitives/Axes.tsx',
|
|
432
|
+
)
|
|
433
|
+
expect(kinds(f)).not.toContain('raw-visx-axis')
|
|
434
|
+
})
|
|
435
|
+
|
|
436
|
+
it('does NOT flag when rawVisxAxis is false', () => {
|
|
437
|
+
const f = checkSource(`<AxisLeft scale={s} />`, CHART_PATH, {
|
|
438
|
+
...DEFAULT_GUARD_CONFIG,
|
|
439
|
+
rawVisxAxis: false,
|
|
440
|
+
})
|
|
441
|
+
expect(kinds(f)).not.toContain('raw-visx-axis')
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
it('does NOT flag a theme-allow line in a chart file', () => {
|
|
445
|
+
const f = find(`<AxisLeft scale={s} /> // theme-allow: bespoke`, CHART_PATH)
|
|
446
|
+
expect(kinds(f)).not.toContain('raw-visx-axis')
|
|
447
|
+
})
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
// ── 13. raw-motion-value ─────────────────────────────────────────────────────
|
|
451
|
+
|
|
452
|
+
describe('raw-motion-value', () => {
|
|
453
|
+
it('flags a hardcoded duration in transition={{}}', () => {
|
|
454
|
+
const f = find(`<motion.div transition={{ duration: 0.3 }} />`)
|
|
455
|
+
expect(kinds(f)).toContain('raw-motion-value')
|
|
456
|
+
})
|
|
457
|
+
|
|
458
|
+
it('flags a hardcoded spring stiffness in transition={{}}', () => {
|
|
459
|
+
const f = find(`<motion.div transition={{ type: 'spring', stiffness: 400 }} />`)
|
|
460
|
+
expect(kinds(f)).toContain('raw-motion-value')
|
|
461
|
+
})
|
|
462
|
+
|
|
463
|
+
it('flags a hardcoded ease bezier array in transition={{}}', () => {
|
|
464
|
+
const f = find(`<motion.div transition={{ ease: [0.4, 0, 0.2, 1] }} />`)
|
|
465
|
+
expect(kinds(f)).toContain('raw-motion-value')
|
|
466
|
+
})
|
|
467
|
+
|
|
468
|
+
it('does NOT flag a transition referencing the shared token', () => {
|
|
469
|
+
const f = find(`<motion.div transition={MOTION_SPRING} />`)
|
|
470
|
+
expect(kinds(f)).not.toContain('raw-motion-value')
|
|
471
|
+
})
|
|
472
|
+
|
|
473
|
+
it('does NOT flag a named easing string (not a magic number)', () => {
|
|
474
|
+
const f = find(`<motion.div transition={{ ease: 'easeInOut' }} />`)
|
|
475
|
+
expect(kinds(f)).not.toContain('raw-motion-value')
|
|
476
|
+
})
|
|
477
|
+
|
|
478
|
+
it('does NOT flag when rawMotionValue is false', () => {
|
|
479
|
+
const f = checkSource(`<motion.div transition={{ duration: 0.3 }} />`, PATH, {
|
|
480
|
+
...DEFAULT_GUARD_CONFIG,
|
|
481
|
+
rawMotionValue: false,
|
|
482
|
+
})
|
|
483
|
+
expect(kinds(f)).not.toContain('raw-motion-value')
|
|
484
|
+
})
|
|
485
|
+
|
|
486
|
+
it('does NOT flag a theme-allow line', () => {
|
|
487
|
+
const f = find(`<motion.div transition={{ duration: 0.3 }} /> // theme-allow: bespoke`)
|
|
488
|
+
expect(kinds(f)).not.toContain('raw-motion-value')
|
|
489
|
+
})
|
|
490
|
+
})
|
|
491
|
+
|
|
492
|
+
// ── 14. unframed-chart ───────────────────────────────────────────────────────
|
|
493
|
+
|
|
494
|
+
describe('unframed-chart', () => {
|
|
495
|
+
it('flags a hand-rolled <ChartLegend items={[...]}> on one line', () => {
|
|
496
|
+
const f = find(`<ChartLegend items={[{ key: 'a', label: 'A', color: '#fff' }]} />`)
|
|
497
|
+
expect(kinds(f)).toContain('unframed-chart')
|
|
498
|
+
})
|
|
499
|
+
|
|
500
|
+
it('flags a hand-rolled legend array literal formatted across multiple lines', () => {
|
|
501
|
+
const text = [
|
|
502
|
+
'<ChartLegend',
|
|
503
|
+
" items={[{ key: 'a', label: 'A', color: VX.line }]}",
|
|
504
|
+
' placement="bottom"',
|
|
505
|
+
'/>',
|
|
506
|
+
].join('\n')
|
|
507
|
+
const f = find(text)
|
|
508
|
+
expect(kinds(f)).toContain('unframed-chart')
|
|
509
|
+
})
|
|
510
|
+
|
|
511
|
+
it('reports the line carrying the items={[ token, not the tag-open line', () => {
|
|
512
|
+
const text = ['<ChartLegend', " items={[{ key: 'a', label: 'A' }]}", '/>'].join('\n')
|
|
513
|
+
const f = find(text)
|
|
514
|
+
const hit = f.find((x) => x.kind === 'unframed-chart')
|
|
515
|
+
expect(hit?.line).toBe(2)
|
|
516
|
+
})
|
|
517
|
+
|
|
518
|
+
it('does NOT flag ChartFrame composing its own derived legend (call expression)', () => {
|
|
519
|
+
const text = [
|
|
520
|
+
'<ChartLegend',
|
|
521
|
+
' items={deriveLegend(series)}',
|
|
522
|
+
' placement={placement}',
|
|
523
|
+
'/>',
|
|
524
|
+
].join('\n')
|
|
525
|
+
const f = find(text)
|
|
526
|
+
expect(kinds(f)).not.toContain('unframed-chart')
|
|
527
|
+
})
|
|
528
|
+
|
|
529
|
+
it('does NOT flag an unrelated items={[...]} prop on a different component', () => {
|
|
530
|
+
const f = find(`<Menu items={[{ label: 'a' }]} />`)
|
|
531
|
+
expect(kinds(f)).not.toContain('unframed-chart')
|
|
532
|
+
})
|
|
533
|
+
|
|
534
|
+
it('does NOT flag when unframedChart is false', () => {
|
|
535
|
+
const f = checkSource(`<ChartLegend items={[{ key: 'a', label: 'A' }]} />`, PATH, {
|
|
536
|
+
...DEFAULT_GUARD_CONFIG,
|
|
537
|
+
unframedChart: false,
|
|
538
|
+
})
|
|
539
|
+
expect(kinds(f)).not.toContain('unframed-chart')
|
|
540
|
+
})
|
|
541
|
+
|
|
542
|
+
it('does NOT flag a theme-allow line', () => {
|
|
543
|
+
const f = find(
|
|
544
|
+
`<ChartLegend items={[{ key: 'a', label: 'A' }]} /> // theme-allow: bespoke legend`,
|
|
545
|
+
)
|
|
546
|
+
expect(kinds(f)).not.toContain('unframed-chart')
|
|
547
|
+
})
|
|
548
|
+
})
|
|
549
|
+
|
|
550
|
+
// ── 15. chart-missing-aria-label ─────────────────────────────────────────────
|
|
551
|
+
|
|
552
|
+
describe('chart-missing-aria-label', () => {
|
|
553
|
+
it('flags a chart kind tag without ariaLabel', () => {
|
|
554
|
+
const f = find(`<ZonedLine data={points} height={240} chartId="x" />`)
|
|
555
|
+
expect(kinds(f)).toContain('chart-missing-aria-label')
|
|
556
|
+
})
|
|
557
|
+
|
|
558
|
+
it('does NOT flag a tag carrying ariaLabel', () => {
|
|
559
|
+
const f = find(`<ZonedLine ariaLabel="HRV trend" data={points} height={240} />`)
|
|
560
|
+
expect(kinds(f)).not.toContain('chart-missing-aria-label')
|
|
561
|
+
})
|
|
562
|
+
|
|
563
|
+
it('sees ariaLabel PAST an arrow function in an earlier prop (=> must not end the tag)', () => {
|
|
564
|
+
const f = find(`<ZonedLine data={points} getX={(d) => d.date} ariaLabel="HRV trend" />`)
|
|
565
|
+
expect(kinds(f)).not.toContain('chart-missing-aria-label')
|
|
566
|
+
})
|
|
567
|
+
|
|
568
|
+
it('sees ariaLabel past an explicit JSX generic argument', () => {
|
|
569
|
+
const text = [
|
|
570
|
+
'<MultiLine<ChartPoint>',
|
|
571
|
+
' data={points}',
|
|
572
|
+
' getX={(d) => d.date}',
|
|
573
|
+
' ariaLabel="Body weight trend"',
|
|
574
|
+
'/>',
|
|
575
|
+
].join('\n')
|
|
576
|
+
const f = find(text)
|
|
577
|
+
expect(kinds(f)).not.toContain('chart-missing-aria-label')
|
|
578
|
+
})
|
|
579
|
+
|
|
580
|
+
it('still flags a generic + arrow-function tag genuinely missing ariaLabel', () => {
|
|
581
|
+
const f = find(`<MultiLine<ChartPoint> data={points} getX={(d) => d.date} />`)
|
|
582
|
+
expect(kinds(f)).toContain('chart-missing-aria-label')
|
|
583
|
+
})
|
|
584
|
+
|
|
585
|
+
it('does NOT flag raw-radius when rawRadius is false (framework-internal repos)', () => {
|
|
586
|
+
const f = checkSource(`<Paper radius={6} />`, PATH, {
|
|
587
|
+
...DEFAULT_GUARD_CONFIG,
|
|
588
|
+
rawRadius: false,
|
|
589
|
+
})
|
|
590
|
+
expect(kinds(f)).not.toContain('raw-radius')
|
|
591
|
+
})
|
|
592
|
+
|
|
593
|
+
it('does NOT flag when chartMissingAriaLabel is false', () => {
|
|
594
|
+
const f = checkSource(`<ZonedLine data={points} />`, PATH, {
|
|
595
|
+
...DEFAULT_GUARD_CONFIG,
|
|
596
|
+
chartMissingAriaLabel: false,
|
|
597
|
+
})
|
|
598
|
+
expect(kinds(f)).not.toContain('chart-missing-aria-label')
|
|
599
|
+
})
|
|
600
|
+
})
|
|
601
|
+
|
|
602
|
+
// ── 16. card-with-border ─────────────────────────────────────────────────────
|
|
603
|
+
|
|
604
|
+
describe('card-with-border', () => {
|
|
605
|
+
it('flags withBorder on a Card', () => {
|
|
606
|
+
const f = find(`<Card padding="md" withBorder h="100%">{children}</Card>`)
|
|
607
|
+
expect(kinds(f)).toContain('card-with-border')
|
|
608
|
+
})
|
|
609
|
+
|
|
610
|
+
it('flags withBorder on a Paper', () => {
|
|
611
|
+
const f = find(`<Paper withBorder p="sm" />`)
|
|
612
|
+
expect(kinds(f)).toContain('card-with-border')
|
|
613
|
+
})
|
|
614
|
+
|
|
615
|
+
it('flags withBorder in a multi-line-formatted tag, reporting the prop line', () => {
|
|
616
|
+
const f = find(`<Card\n padding="md"\n withBorder\n h="100%"\n>`)
|
|
617
|
+
const finding = f.find((v) => v.kind === 'card-with-border')
|
|
618
|
+
expect(finding?.line).toBe(3)
|
|
619
|
+
})
|
|
620
|
+
|
|
621
|
+
it('does NOT flag a Card with no withBorder', () => {
|
|
622
|
+
const f = find(`<Card padding="md" h="100%">{children}</Card>`)
|
|
623
|
+
expect(kinds(f)).not.toContain('card-with-border')
|
|
624
|
+
})
|
|
625
|
+
|
|
626
|
+
it('does NOT flag an explicit withBorder={false} opt-out', () => {
|
|
627
|
+
const f = find(`<Paper withBorder={false} p="sm" />`)
|
|
628
|
+
expect(kinds(f)).not.toContain('card-with-border')
|
|
629
|
+
})
|
|
630
|
+
|
|
631
|
+
it('does NOT flag Card.Section withBorder (a section divider, not card depth)', () => {
|
|
632
|
+
const f = find(`<Card.Section withBorder inheritPadding py="xs">{header}</Card.Section>`)
|
|
633
|
+
expect(kinds(f)).not.toContain('card-with-border')
|
|
634
|
+
})
|
|
635
|
+
|
|
636
|
+
it('does NOT flag withBorder on a non-card surface (Table keeps its own borders)', () => {
|
|
637
|
+
const f = find(`<Table withBorder striped />`)
|
|
638
|
+
expect(kinds(f)).not.toContain('card-with-border')
|
|
639
|
+
})
|
|
640
|
+
|
|
641
|
+
it('does NOT flag a component whose name merely starts with Card', () => {
|
|
642
|
+
const f = find(`<CardHeader withBorder />`)
|
|
643
|
+
expect(kinds(f)).not.toContain('card-with-border')
|
|
644
|
+
})
|
|
645
|
+
|
|
646
|
+
it('does NOT flag when cardWithBorder is false', () => {
|
|
647
|
+
const f = checkSource(`<Card withBorder />`, PATH, {
|
|
648
|
+
...DEFAULT_GUARD_CONFIG,
|
|
649
|
+
cardWithBorder: false,
|
|
650
|
+
})
|
|
651
|
+
expect(kinds(f)).not.toContain('card-with-border')
|
|
652
|
+
})
|
|
653
|
+
})
|
|
654
|
+
|
|
655
|
+
// ── 17. raw-form-control ─────────────────────────────────────────────────────
|
|
656
|
+
|
|
657
|
+
describe('raw-form-control', () => {
|
|
658
|
+
it('flags a raw <input>', () => {
|
|
659
|
+
const f = find(`<input type="text" value={v} onChange={onChange} />`)
|
|
660
|
+
expect(kinds(f)).toContain('raw-form-control')
|
|
661
|
+
})
|
|
662
|
+
|
|
663
|
+
it('flags a raw <select>', () => {
|
|
664
|
+
const f = find(`<select value={v}><option value="a">A</option></select>`)
|
|
665
|
+
expect(kinds(f)).toContain('raw-form-control')
|
|
666
|
+
})
|
|
667
|
+
|
|
668
|
+
it('flags a raw <textarea>', () => {
|
|
669
|
+
const f = find(`<textarea value={v} onChange={onChange} />`)
|
|
670
|
+
expect(kinds(f)).toContain('raw-form-control')
|
|
671
|
+
})
|
|
672
|
+
|
|
673
|
+
it('does NOT flag a Mantine <TextInput>', () => {
|
|
674
|
+
const f = find(`<TextInput label="Name" value={v} onChange={onChange} />`)
|
|
675
|
+
expect(kinds(f)).not.toContain('raw-form-control')
|
|
676
|
+
})
|
|
677
|
+
|
|
678
|
+
it('does NOT flag a Mantine <Select>', () => {
|
|
679
|
+
const f = find(`<Select data={options} value={v} />`)
|
|
680
|
+
expect(kinds(f)).not.toContain('raw-form-control')
|
|
681
|
+
})
|
|
682
|
+
|
|
683
|
+
it('does NOT flag a component whose name merely starts with the tag name (inputRef)', () => {
|
|
684
|
+
const f = find(`<inputRef.current.focus() />`)
|
|
685
|
+
expect(kinds(f)).not.toContain('raw-form-control')
|
|
686
|
+
})
|
|
687
|
+
|
|
688
|
+
it('does NOT flag a theme-allow line', () => {
|
|
689
|
+
const f = find(`<input type="text" /> // theme-allow: legacy widget`)
|
|
690
|
+
expect(kinds(f)).not.toContain('raw-form-control')
|
|
691
|
+
})
|
|
692
|
+
|
|
693
|
+
it('does NOT flag when rawFormControl is false', () => {
|
|
694
|
+
const f = checkSource(`<input type="text" />`, PATH, {
|
|
695
|
+
...DEFAULT_GUARD_CONFIG,
|
|
696
|
+
rawFormControl: false,
|
|
697
|
+
})
|
|
698
|
+
expect(kinds(f)).not.toContain('raw-form-control')
|
|
699
|
+
})
|
|
700
|
+
})
|
|
701
|
+
|
|
702
|
+
// ── 18. sub-16-input-font ────────────────────────────────────────────────────
|
|
703
|
+
|
|
704
|
+
describe('sub-16-input-font', () => {
|
|
705
|
+
it('flags a sub-16 fontSize inline style on a raw <input>', () => {
|
|
706
|
+
const f = find(`<input style={{ fontSize: 13, border: 'none' }} />`)
|
|
707
|
+
expect(kinds(f)).toContain('sub-16-input-font')
|
|
708
|
+
})
|
|
709
|
+
|
|
710
|
+
it('flags a sub-16 fontSize inline style on a raw <textarea>', () => {
|
|
711
|
+
const f = find(`<textarea style={{ fontSize: 12 }} />`)
|
|
712
|
+
expect(kinds(f)).toContain('sub-16-input-font')
|
|
713
|
+
})
|
|
714
|
+
|
|
715
|
+
it('flags a quoted "12px" fontSize value', () => {
|
|
716
|
+
const f = find(`<input style={{ fontSize: '12px' }} />`)
|
|
717
|
+
expect(kinds(f)).toContain('sub-16-input-font')
|
|
718
|
+
})
|
|
719
|
+
|
|
720
|
+
it('flags a Mantine styles={{ input: { fontSize } }} per-part override', () => {
|
|
721
|
+
const f = find(`<TextInput styles={{ input: { fontSize: 12 } }} />`)
|
|
722
|
+
expect(kinds(f)).toContain('sub-16-input-font')
|
|
723
|
+
})
|
|
724
|
+
|
|
725
|
+
it('does NOT flag a fontSize of 16 or above on a raw input (already at/above the floor)', () => {
|
|
726
|
+
const f = find(`<input style={{ fontSize: 16 }} />`)
|
|
727
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
728
|
+
})
|
|
729
|
+
|
|
730
|
+
it('does NOT flag a fontSize below 16 on a <Text> (not a form control)', () => {
|
|
731
|
+
const f = find(`<Text style={{ fontSize: 12 }}>caption</Text>`)
|
|
732
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
733
|
+
})
|
|
734
|
+
|
|
735
|
+
it('does NOT flag a fontSize below 16 on a <span> (not a form control)', () => {
|
|
736
|
+
const f = find(`<span style={{ fontSize: 11 }}>micro-label</span>`)
|
|
737
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
738
|
+
})
|
|
739
|
+
|
|
740
|
+
it('does NOT flag a fontSize below 16 on a <Code> chart label (not a form control)', () => {
|
|
741
|
+
const f = find(`<Code style={{ fontSize: 10 }}>{value}</Code>`)
|
|
742
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
743
|
+
})
|
|
744
|
+
|
|
745
|
+
it('does NOT flag a rem-unit fontSize (ambiguous relative to a px floor, deliberately not matched)', () => {
|
|
746
|
+
const f = find(`<input style={{ fontSize: '0.8rem' }} />`)
|
|
747
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
748
|
+
})
|
|
749
|
+
|
|
750
|
+
it('does NOT flag a raw <input> with no style at all', () => {
|
|
751
|
+
const f = find(`<input type="text" value={v} />`)
|
|
752
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
753
|
+
})
|
|
754
|
+
|
|
755
|
+
it('does NOT flag a Mantine styles={{ root: {...} }} override (targets the wrapper, not the input)', () => {
|
|
756
|
+
const f = find(`<TextInput styles={{ root: { fontSize: 12 } }} />`)
|
|
757
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
758
|
+
})
|
|
759
|
+
|
|
760
|
+
it('does NOT flag a theme-allow line', () => {
|
|
761
|
+
const f = find(`<input style={{ fontSize: 12 }} /> // theme-allow: legacy widget`)
|
|
762
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
763
|
+
})
|
|
764
|
+
|
|
765
|
+
it('does NOT flag when sub16InputFont is false', () => {
|
|
766
|
+
const f = checkSource(`<input style={{ fontSize: 12 }} />`, PATH, {
|
|
767
|
+
...DEFAULT_GUARD_CONFIG,
|
|
768
|
+
sub16InputFont: false,
|
|
769
|
+
})
|
|
770
|
+
expect(kinds(f)).not.toContain('sub-16-input-font')
|
|
771
|
+
})
|
|
772
|
+
})
|
|
773
|
+
|
|
774
|
+
// ── theme-allow skip ─────────────────────────────────────────────────────────
|
|
775
|
+
|
|
776
|
+
describe('theme-allow skip', () => {
|
|
777
|
+
it('skips the entire line when it contains the allow comment', () => {
|
|
778
|
+
const text = `
|
|
779
|
+
const a = '#ff0000' // theme-allow
|
|
780
|
+
const b = '#00ff00'
|
|
781
|
+
`.trim()
|
|
782
|
+
const f = find(text)
|
|
783
|
+
// only the second line should fire
|
|
784
|
+
expect(f.filter((x) => x.kind === 'raw-hex')).toHaveLength(1)
|
|
785
|
+
expect(f.find((x) => x.kind === 'raw-hex')?.line).toBe(2)
|
|
786
|
+
})
|
|
787
|
+
|
|
788
|
+
it('supports a custom allowComment value', () => {
|
|
789
|
+
const f = checkSource(`const c = '#ff0000' // ok-to-use-raw`, PATH, {
|
|
790
|
+
...DEFAULT_GUARD_CONFIG,
|
|
791
|
+
allowComment: 'ok-to-use-raw',
|
|
792
|
+
})
|
|
793
|
+
expect(kinds(f)).not.toContain('raw-hex')
|
|
794
|
+
})
|
|
795
|
+
})
|
|
796
|
+
|
|
797
|
+
// ── pure-comment skip ─────────────────────────────────────────────────────────
|
|
798
|
+
|
|
799
|
+
describe('pure-comment skip', () => {
|
|
800
|
+
it('skips a // line comment', () => {
|
|
801
|
+
const f = find(`// const c = '#ff0000'`)
|
|
802
|
+
expect(kinds(f)).not.toContain('raw-hex')
|
|
803
|
+
})
|
|
804
|
+
|
|
805
|
+
it('skips a * JSDoc body line', () => {
|
|
806
|
+
const f = find(` * Use rgba() for opacity, not raw hex`)
|
|
807
|
+
expect(kinds(f)).not.toContain('raw-color-fn')
|
|
808
|
+
})
|
|
809
|
+
|
|
810
|
+
it('skips a /* start-of-block line', () => {
|
|
811
|
+
const f = find(`/* const c = '#aabbcc' */`)
|
|
812
|
+
expect(kinds(f)).not.toContain('raw-hex')
|
|
813
|
+
})
|
|
814
|
+
|
|
815
|
+
it('still flags a code line that follows a comment', () => {
|
|
816
|
+
const text = `// this is a comment\nconst c = '#ff0000'`
|
|
817
|
+
const f = find(text)
|
|
818
|
+
expect(kinds(f)).toContain('raw-hex')
|
|
819
|
+
})
|
|
820
|
+
})
|
|
821
|
+
|
|
822
|
+
// ── isChartFile gates raw-visx-axis ──────────────────────────────────────────
|
|
823
|
+
|
|
824
|
+
describe('isChartFile path gate', () => {
|
|
825
|
+
it('fires raw-visx-axis in src/charts/kinds/k.tsx', () => {
|
|
826
|
+
const f = checkSource(`<AxisLeft scale={s} />`, 'src/charts/kinds/k.tsx', DEFAULT_GUARD_CONFIG)
|
|
827
|
+
expect(kinds(f)).toContain('raw-visx-axis')
|
|
828
|
+
})
|
|
829
|
+
|
|
830
|
+
it('does NOT fire raw-visx-axis in src/page.tsx', () => {
|
|
831
|
+
const f = checkSource(`<AxisLeft scale={s} />`, 'src/page.tsx', DEFAULT_GUARD_CONFIG)
|
|
832
|
+
expect(kinds(f)).not.toContain('raw-visx-axis')
|
|
833
|
+
})
|
|
834
|
+
})
|