basalt-ui 1.28.0 → 1.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +12 -19
- package/CHANGELOG.md +23 -0
- package/MIGRATING.md +171 -7
- package/README.md +66 -105
- package/agent/rules/basalt-batteries.md +60 -183
- package/agent/rules/basalt-charts.md +56 -75
- package/agent/rules/basalt-controls.md +38 -69
- package/agent/rules/basalt-mantine.md +58 -103
- package/agent/rules/basalt-state.md +42 -60
- package/agent/rules/basalt-tokens.md +46 -67
- package/agent/skills/basalt-app/SKILL.md +2 -0
- package/agent/templates/CLAUDE-block.md.tpl +14 -14
- package/agent/templates/query-client.ts.tpl +1 -1
- package/configs/oxlint-plugin.js +84 -254
- package/configs/oxlint-plugin.test.ts +23 -266
- package/configs/oxlint.json +0 -2
- package/dist/agent/ai-sdk-transport.d.ts.map +1 -1
- package/dist/agent/ai-sdk-transport.js +7 -4
- package/dist/agent/coalesce.js +1 -1
- package/dist/agent/merge.js +1 -1
- package/dist/agent/transport.d.ts +13 -2
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/use-agent-thread-runs.d.ts +12 -1
- package/dist/agent/use-agent-thread-runs.d.ts.map +1 -1
- package/dist/agent/use-agent-thread-runs.js +20 -6
- package/dist/agent-chat/index.d.ts +1 -1
- package/dist/agent-chat/index.d.ts.map +1 -1
- package/dist/agent-chat/relative-time.js +1 -1
- package/dist/agent-chat/thread-detail-panel.js +1 -1
- package/dist/agent-chat/thread-feed-row.d.ts +32 -7
- package/dist/agent-chat/thread-feed-row.d.ts.map +1 -1
- package/dist/agent-chat/thread-feed-row.js +121 -86
- package/dist/agent-chat/thread-feed.d.ts +11 -1
- package/dist/agent-chat/thread-feed.d.ts.map +1 -1
- package/dist/agent-chat/thread-feed.js +10 -6
- package/dist/agent-chat/thread-message.js +1 -1
- package/dist/agent-chat/virtualize.d.ts +39 -0
- package/dist/agent-chat/virtualize.d.ts.map +1 -1
- package/dist/agent-chat/virtualize.js +15 -0
- package/dist/charts/index.d.ts +3 -3
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/index.js +8 -4
- package/dist/charts/kinds/BandStrip.js +1 -1
- package/dist/charts/kinds/Bars.d.ts +1 -3
- package/dist/charts/kinds/Bars.d.ts.map +1 -1
- package/dist/charts/kinds/Bars.js +1 -1
- package/dist/charts/kinds/DualPanel.d.ts +3 -1
- package/dist/charts/kinds/DualPanel.d.ts.map +1 -1
- package/dist/charts/kinds/DualPanel.js +1 -1
- package/dist/charts/kinds/StackedArea.js +1 -1
- package/dist/charts/kinds/ZonedLine.d.ts +1 -3
- package/dist/charts/kinds/ZonedLine.d.ts.map +1 -1
- package/dist/charts/primitives/Axes.d.ts +21 -2
- package/dist/charts/primitives/Axes.d.ts.map +1 -1
- package/dist/charts/primitives/Axes.js +34 -2
- package/dist/charts/primitives/ChartCard.d.ts +20 -4
- package/dist/charts/primitives/ChartCard.d.ts.map +1 -1
- package/dist/charts/primitives/ChartCard.js +62 -33
- package/dist/charts/primitives/ChartFrame.d.ts.map +1 -1
- package/dist/charts/primitives/ChartFrame.js +8 -1
- package/dist/charts/primitives/ChartPending.d.ts +12 -6
- package/dist/charts/primitives/ChartPending.d.ts.map +1 -1
- package/dist/charts/primitives/ChartPending.js +1 -1
- package/dist/charts/utils/format.d.ts +5 -92
- package/dist/charts/utils/format.d.ts.map +1 -1
- package/dist/charts/utils/format.js +10 -80
- package/dist/cli/audit-allows.d.ts +24 -0
- package/dist/cli/audit-allows.d.ts.map +1 -0
- package/dist/cli/audit-allows.js +240 -0
- package/dist/cli/check-theme.d.ts +10 -0
- package/dist/cli/check-theme.d.ts.map +1 -0
- package/dist/cli/check-theme.js +139 -0
- package/dist/cli/doctor.d.ts +47 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +197 -0
- package/dist/cli/guard-hook.d.ts +9 -0
- package/dist/cli/guard-hook.d.ts.map +1 -0
- package/dist/cli/guard-hook.js +93 -0
- package/dist/cli/help.d.ts +9 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +53 -0
- package/dist/cli/index.d.ts +360 -270
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +85 -1901
- package/dist/cli/init.d.ts +4 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +165 -0
- package/dist/cli/sync.d.ts +43 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +206 -0
- package/dist/cli/tokens-css.d.ts +51 -0
- package/dist/cli/tokens-css.d.ts.map +1 -0
- package/dist/cli/tokens-css.js +165 -0
- package/dist/commands/define-commands.js +1 -1
- package/dist/commands/define-overlays.js +1 -1
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +6 -0
- package/dist/commands/overlays-mount.d.ts +7 -9
- package/dist/commands/overlays-mount.d.ts.map +1 -1
- package/dist/commands/shell-bridge.d.ts +57 -0
- package/dist/commands/shell-bridge.d.ts.map +1 -0
- package/dist/commands/shell-bridge.js +32 -0
- package/dist/common/errors.d.ts +35 -0
- package/dist/common/errors.d.ts.map +1 -1
- package/dist/common/errors.js +29 -1
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +6 -0
- package/dist/common/is-dev.d.ts.map +1 -0
- package/dist/{motion/index.d.ts → common/motion.d.ts} +1 -1
- package/dist/common/motion.d.ts.map +1 -0
- package/dist/common/props.d.ts +1 -1
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/validate.js +1 -1
- package/dist/content/markdown.d.ts +3 -4
- package/dist/content/markdown.d.ts.map +1 -1
- package/dist/content/markdown.js +1 -4
- package/dist/controls/actions.d.ts +1 -1
- package/dist/controls/actions.d.ts.map +1 -1
- package/dist/controls/panel-row.js +1 -1
- package/dist/controls/range-filter.js +1 -1
- package/dist/dashboard/delta-badge.d.ts +18 -10
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +33 -1
- package/dist/dashboard/empty-state.d.ts +1 -4
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +1 -2
- package/dist/dashboard/index.d.ts +4 -2
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +7 -1
- package/dist/dashboard/query-state.d.ts +4 -13
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +4 -7
- package/dist/{section → dashboard}/section.d.ts +2 -2
- package/dist/{section → dashboard}/section.d.ts.map +1 -1
- package/dist/{section → dashboard}/section.js +2 -2
- package/dist/dashboard/settings-section.d.ts +1 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +1 -1
- package/dist/dashboard/stat-card.d.ts +1 -1
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +1 -1
- package/dist/dashboard/widget-header.d.ts.map +1 -0
- package/dist/data/data-table.js +2 -2
- package/dist/data/table.d.ts +1 -1
- package/dist/data/table.d.ts.map +1 -1
- package/dist/data/table.js +2 -16
- package/dist/data/virtual.d.ts +3 -3
- package/dist/dev-dock.d.ts +26 -0
- package/dist/dev-dock.d.ts.map +1 -0
- package/dist/dev-dock.js +85 -0
- package/dist/format/date.d.ts +62 -0
- package/dist/format/date.d.ts.map +1 -0
- package/dist/format/date.js +106 -0
- package/dist/format/index.d.ts +39 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +54 -0
- package/dist/format/measure.d.ts +15 -0
- package/dist/format/measure.d.ts.map +1 -0
- package/dist/format/measure.js +16 -0
- package/dist/format/number.d.ts +69 -0
- package/dist/format/number.d.ts.map +1 -0
- package/dist/format/number.js +62 -0
- package/dist/format/shared.d.ts +27 -0
- package/dist/format/shared.d.ts.map +1 -0
- package/dist/format/shared.js +29 -0
- package/dist/forms/field.d.ts +4 -20
- package/dist/forms/field.d.ts.map +1 -1
- package/dist/forms/field.js +0 -4
- package/dist/forms/form-layout.d.ts +1 -1
- package/dist/forms/form-layout.d.ts.map +1 -1
- package/dist/forms/form-layout.js +1 -1
- package/dist/forms/index.d.ts +1 -1
- package/dist/forms/index.d.ts.map +1 -1
- package/dist/forms/index.js +1 -2
- package/dist/forms/use-form-submit.d.ts +1 -1
- package/dist/forms/use-form-submit.js +1 -1
- package/dist/guard/index.d.ts +2 -9
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +53 -32
- package/dist/guard/types.d.ts +8 -10
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/index.d.ts +16 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -29
- package/dist/notifications/index.d.ts +5 -5
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +0 -2
- package/dist/notifications/mount-guard.d.ts.map +1 -1
- package/dist/notifications/mount-guard.js +2 -2
- package/dist/provider/connectivity-indicator.d.ts.map +1 -0
- package/dist/{connectivity → provider}/connectivity-provider.d.ts +1 -1
- package/dist/provider/connectivity-provider.d.ts.map +1 -0
- package/dist/{connectivity/types.d.ts → provider/connectivity-types.d.ts} +1 -1
- package/dist/provider/connectivity-types.d.ts.map +1 -0
- package/dist/provider/error-fallback.module.css +21 -0
- package/dist/provider/error-fallback.module.css.d.ts +9 -0
- package/dist/provider/index.d.ts +20 -36
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +42 -32
- package/dist/provider/lab-theme.js +1 -1
- package/dist/provider/use-connectivity.d.ts +3 -0
- package/dist/provider/use-connectivity.d.ts.map +1 -0
- package/dist/query-client.d.ts +67 -0
- package/dist/query-client.d.ts.map +1 -0
- package/dist/query-client.js +35 -0
- package/dist/{query/devtools.d.ts → query-devtools.d.ts} +2 -2
- package/dist/query-devtools.d.ts.map +1 -0
- package/dist/register.d.ts +17 -3
- package/dist/register.d.ts.map +1 -1
- package/dist/router-tanstack/index.d.ts +4 -7
- package/dist/router-tanstack/index.d.ts.map +1 -1
- package/dist/router-tanstack/index.js +1 -9
- package/dist/router-tanstack/nav.d.ts +1 -1
- package/dist/router-tanstack/nav.d.ts.map +1 -1
- package/dist/router-tanstack/search-store.d.ts +3 -6
- package/dist/router-tanstack/search-store.d.ts.map +1 -1
- package/dist/router-tanstack/use-nav.d.ts +1 -1
- package/dist/router-tanstack/use-nav.d.ts.map +1 -1
- package/dist/shell/app-breadcrumbs.d.ts +1 -1
- package/dist/shell/app-breadcrumbs.d.ts.map +1 -1
- package/dist/shell/app-main.module.css +11 -0
- package/dist/shell/app-mobile-nav.d.ts +1 -1
- package/dist/shell/app-mobile-nav.d.ts.map +1 -1
- package/dist/shell/app-mobile-nav.js +24 -2
- package/dist/shell/app-sidebar.d.ts +1 -1
- package/dist/shell/app-sidebar.d.ts.map +1 -1
- package/dist/shell/app-sidebar.js +31 -2
- package/dist/shell/app-sidebar.module.css +10 -0
- package/dist/shell/index.d.ts +10 -4
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +13 -17
- package/dist/shell/mobile-nav-model.d.ts +1 -1
- package/dist/shell/mobile-nav-model.d.ts.map +1 -1
- package/dist/{nav/types.d.ts → shell/nav-types.d.ts} +1 -1
- package/dist/shell/nav-types.d.ts.map +1 -0
- package/dist/shell/page-aside.d.ts.map +1 -1
- package/dist/shell/page-aside.js +2 -29
- package/dist/shell/page-title.d.ts +14 -0
- package/dist/shell/page-title.d.ts.map +1 -0
- package/dist/shell/page-title.js +25 -0
- package/dist/shell/page-title.module.css +33 -0
- package/dist/shell/page-title.module.css.d.ts +11 -0
- package/dist/shell/sidebar-block-model.d.ts +1 -1
- package/dist/shell/sidebar-block-model.d.ts.map +1 -1
- package/dist/shell/sidebar-blocks.d.ts +1 -1
- package/dist/shell/sidebar-blocks.d.ts.map +1 -1
- package/dist/shell/use-breakpoint.d.ts +11 -0
- package/dist/shell/use-breakpoint.d.ts.map +1 -0
- package/dist/shell/use-breakpoint.js +33 -0
- package/dist/state/fields.d.ts +3 -19
- package/dist/state/fields.d.ts.map +1 -1
- package/dist/state/fields.js +6 -16
- package/dist/styles.css +36 -0
- package/dist/surfaces.d.ts +18 -41
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +48 -60
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/{theme-toggle/index.d.ts → theme/theme-toggle.d.ts} +1 -1
- package/dist/theme/theme-toggle.d.ts.map +1 -0
- package/dist/{theme-toggle/index.js → theme/theme-toggle.js} +1 -1
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +10 -0
- package/dist/tokens/palette.d.ts +12 -0
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +13 -1
- package/dist/tokens.css +1 -0
- package/llms.txt +9 -24
- package/package.json +12 -16
- package/src/agent/ai-sdk-transport.ts +11 -4
- package/src/agent/coalesce.ts +1 -1
- package/src/agent/merge.ts +1 -1
- package/src/agent/transport.ts +15 -2
- package/src/agent/use-agent-thread-runs.ts +65 -15
- package/src/agent-chat/index.ts +6 -4
- package/src/agent-chat/relative-time.ts +1 -1
- package/src/agent-chat/thread-detail-panel.tsx +1 -1
- package/src/agent-chat/thread-feed-row.tsx +105 -30
- package/src/agent-chat/thread-feed.tsx +51 -25
- package/src/agent-chat/thread-message.tsx +1 -1
- package/src/agent-chat/virtualize.ts +48 -0
- package/src/charts/index.ts +7 -10
- package/src/charts/kinds/BandStrip.tsx +1 -1
- package/src/charts/kinds/Bars.tsx +2 -5
- package/src/charts/kinds/DualPanel.tsx +4 -3
- package/src/charts/kinds/StackedArea.tsx +1 -1
- package/src/charts/kinds/ZonedLine.tsx +1 -4
- package/src/charts/primitives/Axes.tsx +49 -0
- package/src/charts/primitives/ChartCard.tsx +49 -6
- package/src/charts/primitives/ChartFrame.tsx +5 -1
- package/src/charts/primitives/ChartPending.tsx +14 -8
- package/src/charts/utils/format.ts +17 -186
- package/src/cli/audit-allows.ts +371 -0
- package/src/cli/check-theme.ts +197 -0
- package/src/cli/doctor.ts +331 -0
- package/src/cli/guard-hook.ts +115 -0
- package/src/cli/help.ts +101 -0
- package/src/cli/index.ts +269 -3439
- package/src/cli/init.ts +247 -0
- package/src/cli/sync.ts +324 -0
- package/src/cli/tokens-css.ts +252 -0
- package/src/commands/define-commands.ts +1 -1
- package/src/commands/define-overlays.ts +1 -1
- package/src/commands/index.ts +10 -1
- package/src/commands/overlays-mount.tsx +8 -10
- package/src/commands/shell-bridge.ts +86 -0
- package/src/common/errors.ts +70 -0
- package/src/common/index.ts +2 -0
- package/src/common/props.ts +1 -1
- package/src/common/validate.ts +1 -1
- package/src/content/markdown.tsx +4 -8
- package/src/controls/actions.tsx +1 -1
- package/src/controls/panel-row.tsx +1 -1
- package/src/controls/range-filter.tsx +1 -1
- package/src/dashboard/delta-badge.tsx +74 -7
- package/src/dashboard/empty-state.tsx +2 -6
- package/src/dashboard/index.ts +11 -2
- package/src/dashboard/query-state.tsx +5 -18
- package/src/{section → dashboard}/section.tsx +4 -4
- package/src/dashboard/settings-section.tsx +2 -2
- package/src/dashboard/stat-card.tsx +2 -2
- package/src/data/data-table.tsx +3 -3
- package/src/data/table.ts +6 -25
- package/src/data/virtual-list.tsx +1 -1
- package/src/data/virtual.ts +3 -3
- package/src/dev-dock.tsx +162 -0
- package/src/format/date.ts +184 -0
- package/src/format/index.ts +69 -0
- package/src/format/measure.ts +31 -0
- package/src/format/number.ts +129 -0
- package/src/format/shared.ts +63 -0
- package/src/forms/field.ts +4 -24
- package/src/forms/form-layout.tsx +2 -2
- package/src/forms/index.ts +1 -2
- package/src/forms/use-form-submit.ts +2 -2
- package/src/guard/index.ts +80 -69
- package/src/guard/types.ts +7 -10
- package/src/index.ts +38 -29
- package/src/notifications/index.ts +5 -7
- package/src/notifications/mount-guard.ts +7 -9
- package/src/{connectivity → provider}/connectivity-indicator.tsx +1 -1
- package/src/{connectivity → provider}/connectivity-provider.tsx +1 -1
- package/src/provider/error-fallback.module.css +21 -0
- package/src/provider/error-fallback.module.css.d.ts +9 -0
- package/src/provider/index.tsx +71 -71
- package/src/provider/lab-theme.ts +1 -1
- package/src/{connectivity → provider}/use-connectivity.ts +3 -3
- package/src/query-client.ts +105 -0
- package/src/{query/devtools.tsx → query-devtools.tsx} +5 -4
- package/src/register.ts +20 -4
- package/src/router-tanstack/index.ts +4 -15
- package/src/router-tanstack/nav.ts +1 -1
- package/src/router-tanstack/search-store.ts +3 -4
- package/src/router-tanstack/use-nav.ts +1 -1
- package/src/shell/app-breadcrumbs.tsx +1 -1
- package/src/shell/app-main.module.css +11 -0
- package/src/shell/app-mobile-nav.tsx +28 -1
- package/src/shell/app-sidebar.module.css +10 -0
- package/src/shell/app-sidebar.tsx +31 -2
- package/src/shell/index.tsx +23 -28
- package/src/shell/mobile-nav-model.ts +1 -1
- package/src/shell/page-aside.tsx +2 -52
- package/src/shell/page-title.module.css +33 -0
- package/src/shell/page-title.module.css.d.ts +11 -0
- package/src/shell/page-title.tsx +57 -0
- package/src/shell/sidebar-block-model.ts +1 -1
- package/src/shell/sidebar-blocks.tsx +1 -1
- package/src/shell/use-breakpoint.ts +73 -0
- package/src/state/fields.ts +7 -43
- package/src/styles.css +36 -0
- package/src/surfaces.ts +47 -61
- package/src/theme/index.ts +7 -0
- package/src/{theme-toggle/index.tsx → theme/theme-toggle.tsx} +1 -1
- package/src/tokens/index.ts +10 -0
- package/src/tokens/palette.ts +12 -0
- package/dist/connectivity/connectivity-indicator.d.ts.map +0 -1
- package/dist/connectivity/connectivity-provider.d.ts.map +0 -1
- package/dist/connectivity/index.d.ts +0 -14
- package/dist/connectivity/index.d.ts.map +0 -1
- package/dist/connectivity/index.js +0 -8
- package/dist/connectivity/types.d.ts.map +0 -1
- package/dist/connectivity/use-connectivity.d.ts +0 -3
- package/dist/connectivity/use-connectivity.d.ts.map +0 -1
- package/dist/data/index.d.ts +0 -38
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/index.js +0 -24
- package/dist/motion/index.d.ts.map +0 -1
- package/dist/nav/types.d.ts.map +0 -1
- package/dist/notifications/overlay.d.ts +0 -20
- package/dist/notifications/overlay.d.ts.map +0 -1
- package/dist/notifications/overlay.js +0 -14
- package/dist/query/devtools.d.ts.map +0 -1
- package/dist/query/error-message.d.ts +0 -41
- package/dist/query/error-message.d.ts.map +0 -1
- package/dist/query/error-message.js +0 -30
- package/dist/query/index.d.ts +0 -47
- package/dist/query/index.d.ts.map +0 -1
- package/dist/query/index.js +0 -56
- package/dist/router-tanstack/field.d.ts +0 -14
- package/dist/router-tanstack/field.d.ts.map +0 -1
- package/dist/router-tanstack/field.js +0 -4
- package/dist/router-tanstack/multi-search-param-store.d.ts +0 -43
- package/dist/router-tanstack/multi-search-param-store.d.ts.map +0 -1
- package/dist/router-tanstack/multi-search-param-store.js +0 -30
- package/dist/router-tanstack/search-param-store.d.ts +0 -42
- package/dist/router-tanstack/search-param-store.d.ts.map +0 -1
- package/dist/router-tanstack/search-param-store.js +0 -25
- package/dist/section/index.d.ts +0 -2
- package/dist/section/index.d.ts.map +0 -1
- package/dist/section/index.js +0 -4
- package/dist/theme-toggle/index.d.ts.map +0 -1
- package/dist/utils/is-dev.d.ts.map +0 -1
- package/dist/widget-header/delta-badge.d.ts +0 -19
- package/dist/widget-header/delta-badge.d.ts.map +0 -1
- package/dist/widget-header/delta-badge.js +0 -36
- package/dist/widget-header/index.d.ts +0 -3
- package/dist/widget-header/index.d.ts.map +0 -1
- package/dist/widget-header/index.js +0 -8
- package/dist/widget-header/widget-header.d.ts.map +0 -1
- package/src/connectivity/index.ts +0 -19
- package/src/data/index.ts +0 -69
- package/src/notifications/overlay.tsx +0 -66
- package/src/query/error-message.ts +0 -70
- package/src/query/index.ts +0 -97
- package/src/router-tanstack/field.ts +0 -36
- package/src/router-tanstack/multi-search-param-store.ts +0 -106
- package/src/router-tanstack/search-param-store.ts +0 -100
- package/src/section/index.ts +0 -1
- package/src/widget-header/delta-badge.tsx +0 -77
- package/src/widget-header/index.ts +0 -10
- /package/dist/{utils → common}/is-dev.d.ts +0 -0
- /package/dist/{utils → common}/is-dev.js +0 -0
- /package/dist/{motion/index.js → common/motion.js} +0 -0
- /package/dist/{section → dashboard}/section.module.css +0 -0
- /package/dist/{section → dashboard}/section.module.css.d.ts +0 -0
- /package/dist/{widget-header → dashboard}/widget-header.d.ts +0 -0
- /package/dist/{widget-header → dashboard}/widget-header.js +0 -0
- /package/dist/{widget-header → dashboard}/widget-header.module.css +0 -0
- /package/dist/{widget-header → dashboard}/widget-header.module.css.d.ts +0 -0
- /package/dist/{connectivity → provider}/connectivity-indicator.d.ts +0 -0
- /package/dist/{connectivity → provider}/connectivity-indicator.js +0 -0
- /package/dist/{connectivity → provider}/connectivity-provider.js +0 -0
- /package/dist/{connectivity/types.js → provider/connectivity-types.js} +0 -0
- /package/dist/{connectivity → provider}/use-connectivity.js +0 -0
- /package/dist/{query/devtools.js → query-devtools.js} +0 -0
- /package/dist/{nav/types.js → shell/nav-types.js} +0 -0
- /package/src/{utils → common}/is-dev.ts +0 -0
- /package/src/{motion/index.ts → common/motion.ts} +0 -0
- /package/src/{section → dashboard}/section.module.css +0 -0
- /package/src/{section → dashboard}/section.module.css.d.ts +0 -0
- /package/src/{widget-header → dashboard}/widget-header.module.css +0 -0
- /package/src/{widget-header → dashboard}/widget-header.module.css.d.ts +0 -0
- /package/src/{widget-header → dashboard}/widget-header.tsx +0 -0
- /package/src/{connectivity/types.ts → provider/connectivity-types.ts} +0 -0
- /package/src/{nav/types.ts → shell/nav-types.ts} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compact,
|
|
3
|
+
deltaPct,
|
|
4
|
+
fmtCompact,
|
|
5
|
+
fmtCurrency,
|
|
6
|
+
fmtInt,
|
|
7
|
+
fmtPercent,
|
|
8
|
+
integer,
|
|
9
|
+
money,
|
|
10
|
+
NON_FINITE,
|
|
11
|
+
percent
|
|
12
|
+
} from "./number.js";
|
|
13
|
+
import {
|
|
14
|
+
clock,
|
|
15
|
+
duration,
|
|
16
|
+
durationClock,
|
|
17
|
+
fmtAxisDate,
|
|
18
|
+
fmtTooltipDate,
|
|
19
|
+
relativeTime,
|
|
20
|
+
weekday
|
|
21
|
+
} from "./date.js";
|
|
22
|
+
import { kcal, km } from "./measure.js";
|
|
23
|
+
import { fmtCompact as fmtCompact2, fmtCurrency as fmtCurrency2, fmtInt as fmtInt2, fmtPercent as fmtPercent2 } from "./number.js";
|
|
24
|
+
import { fmtAxisDate as fmtAxisDate2, fmtTooltipDate as fmtTooltipDate2 } from "./date.js";
|
|
25
|
+
const formatters = {
|
|
26
|
+
compact: fmtCompact2,
|
|
27
|
+
percent: fmtPercent2,
|
|
28
|
+
currency: fmtCurrency2,
|
|
29
|
+
int: fmtInt2,
|
|
30
|
+
axisDate: fmtAxisDate2,
|
|
31
|
+
tooltipDate: fmtTooltipDate2
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
NON_FINITE,
|
|
35
|
+
clock,
|
|
36
|
+
compact,
|
|
37
|
+
deltaPct,
|
|
38
|
+
duration,
|
|
39
|
+
durationClock,
|
|
40
|
+
fmtAxisDate,
|
|
41
|
+
fmtCompact,
|
|
42
|
+
fmtCurrency,
|
|
43
|
+
fmtInt,
|
|
44
|
+
fmtPercent,
|
|
45
|
+
fmtTooltipDate,
|
|
46
|
+
formatters,
|
|
47
|
+
integer,
|
|
48
|
+
kcal,
|
|
49
|
+
km,
|
|
50
|
+
money,
|
|
51
|
+
percent,
|
|
52
|
+
relativeTime,
|
|
53
|
+
weekday
|
|
54
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type KmOptions = {
|
|
2
|
+
/** Fraction digits. Default 2 (`"5.30 km"`). */
|
|
3
|
+
digits?: number;
|
|
4
|
+
};
|
|
5
|
+
/** Meters as kilometers — `"5.30 km"`. A non-finite value prints {@link NON_FINITE}. */
|
|
6
|
+
export declare function km(meters: number, options?: KmOptions): string;
|
|
7
|
+
export type KcalOptions = {
|
|
8
|
+
/** Fraction digits once compacted to `k cal`. Default 2. Below 1000 kcal always rounds to a
|
|
9
|
+
* whole number, matching the seed (`formatKcal`). */
|
|
10
|
+
digits?: number;
|
|
11
|
+
};
|
|
12
|
+
/** Kilocalories, compacting to `"k cal"` above 1000 — `"842 kcal"`, `"1.24 k cal"`. A non-finite
|
|
13
|
+
* value prints {@link NON_FINITE}. */
|
|
14
|
+
export declare function kcal(value: number, options?: KcalOptions): string;
|
|
15
|
+
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../src/format/measure.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,SAAS,GAAG;IACtB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,SAAc,GAAG,MAAM,CAIlE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB;yDACqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;sCACsC;AACtC,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAKrE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NON_FINITE } from "./shared.js";
|
|
2
|
+
function km(meters, options = {}) {
|
|
3
|
+
if (!Number.isFinite(meters)) return NON_FINITE;
|
|
4
|
+
const { digits = 2 } = options;
|
|
5
|
+
return `${(meters / 1e3).toFixed(digits)} km`;
|
|
6
|
+
}
|
|
7
|
+
function kcal(value, options = {}) {
|
|
8
|
+
if (!Number.isFinite(value)) return NON_FINITE;
|
|
9
|
+
const { digits = 2 } = options;
|
|
10
|
+
if (value >= 1e3) return `${(value / 1e3).toFixed(digits)} k cal`;
|
|
11
|
+
return `${Math.round(value)} kcal`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
kcal,
|
|
15
|
+
km
|
|
16
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Number formatting — `Intl.NumberFormat` with the arguments already decided, so a caller states
|
|
3
|
+
* WHAT a number is rather than how to punctuate it. Moved here from `src/charts/utils/format.ts`
|
|
4
|
+
* (C5 consolidation) — that file now re-exports from this module so charts keep working through
|
|
5
|
+
* one implementation.
|
|
6
|
+
*
|
|
7
|
+
* `money`/`percent`/`integer`/`compact`/`deltaPct` are the argo-facing names (seeded from
|
|
8
|
+
* `features/*\/{formatters,formulas}.ts`); `fmtCurrency`/`fmtPercent`/`fmtInt`/`fmtCompact` are the
|
|
9
|
+
* original chart-formatter names, kept for source compatibility and delegated to by the new names.
|
|
10
|
+
*/
|
|
11
|
+
import { NON_FINITE } from './shared.js';
|
|
12
|
+
import type { LocaleOption } from './shared.js';
|
|
13
|
+
export type { LocaleOption };
|
|
14
|
+
export { NON_FINITE };
|
|
15
|
+
export type FmtCompactOptions = LocaleOption & {
|
|
16
|
+
/** Significant-ish fraction digits on the compacted number. Default 1 (`1.2k`, `3.4M`). */
|
|
17
|
+
digits?: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Compact notation: `1.2k`, `3.4M`, `-820`. The axis formatter for any count whose range spans
|
|
21
|
+
* more than three digits. A non-finite value prints {@link NON_FINITE}.
|
|
22
|
+
*
|
|
23
|
+
* Note `Intl`'s compact notation is LOCALE text, not a suffix table: `en` gives `1.2K`, and this
|
|
24
|
+
* lowercases the `K` to match the package's own numeral style while leaving every other locale's
|
|
25
|
+
* word (`1,2 Mio.`) untouched.
|
|
26
|
+
*/
|
|
27
|
+
export declare function fmtCompact(value: number, options?: FmtCompactOptions): string;
|
|
28
|
+
/** `compact` — the `basalt-ui/format` name for {@link fmtCompact}. */
|
|
29
|
+
export declare const compact: typeof fmtCompact;
|
|
30
|
+
export type FmtPercentOptions = LocaleOption & {
|
|
31
|
+
/** Fraction digits. Default 0 (`42%`). */
|
|
32
|
+
digits?: number;
|
|
33
|
+
/**
|
|
34
|
+
* What the incoming number MEANS. `'ratio'` (default) is `0.42 → 42%`; `'percent'` is
|
|
35
|
+
* `42 → 42%`. Required as an explicit option rather than guessed from magnitude.
|
|
36
|
+
*/
|
|
37
|
+
input?: 'ratio' | 'percent';
|
|
38
|
+
};
|
|
39
|
+
/** Percentages, from either a ratio or an already-scaled percentage. A non-finite value prints
|
|
40
|
+
* {@link NON_FINITE}. */
|
|
41
|
+
export declare function fmtPercent(value: number, options?: FmtPercentOptions): string;
|
|
42
|
+
/** `percent` — the `basalt-ui/format` name for {@link fmtPercent}. */
|
|
43
|
+
export declare const percent: typeof fmtPercent;
|
|
44
|
+
export type DeltaPctOptions = FmtPercentOptions;
|
|
45
|
+
/**
|
|
46
|
+
* A signed percentage delta: `+4%`, `-12%`, `0%` — argo's `walking-pad/formatters.ts#formatPct`
|
|
47
|
+
* (a `+`-prefixed ratio) generalized onto `Intl`'s own `signDisplay: 'exceptZero'`, which adds the
|
|
48
|
+
* `+`/`-` sign the same way `Intl`'s own minus sign already does, and adds nothing for zero. A
|
|
49
|
+
* non-finite value prints {@link NON_FINITE}.
|
|
50
|
+
*/
|
|
51
|
+
export declare function deltaPct(value: number, options?: DeltaPctOptions): string;
|
|
52
|
+
export type FmtCurrencyOptions = LocaleOption & {
|
|
53
|
+
/** ISO 4217 code — required. There is no default currency. */
|
|
54
|
+
currency: string;
|
|
55
|
+
/** Compact notation for the amount (`$1.2k`). Default false. */
|
|
56
|
+
compact?: boolean;
|
|
57
|
+
/** Fraction digits. Default 0 compacted, else the currency's own default (`undefined`). */
|
|
58
|
+
digits?: number;
|
|
59
|
+
};
|
|
60
|
+
/** Money. `fmtCurrency(1234, { currency: 'USD' })` → `$1,234`. A non-finite amount prints
|
|
61
|
+
* {@link NON_FINITE}. */
|
|
62
|
+
export declare function fmtCurrency(value: number, options: FmtCurrencyOptions): string;
|
|
63
|
+
/** `money` — the `basalt-ui/format` name for {@link fmtCurrency}. */
|
|
64
|
+
export declare const money: typeof fmtCurrency;
|
|
65
|
+
/** Grouped integer: `12,480`. Rounds. A non-finite value prints {@link NON_FINITE}. */
|
|
66
|
+
export declare function fmtInt(value: number, options?: LocaleOption): string;
|
|
67
|
+
/** `integer` — the `basalt-ui/format` name for {@link fmtInt}. */
|
|
68
|
+
export declare const integer: typeof fmtInt;
|
|
69
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/format/number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAgB,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,YAAY,EAAE,YAAY,EAAE,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,CAAA;AAMrB,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAUjF;AAED,sEAAsE;AACtE,eAAO,MAAM,OAAO,mBAAa,CAAA;AAEjC,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC5B,CAAA;AAED;yBACyB;AACzB,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAQjF;AAED,sEAAsE;AACtE,eAAO,MAAM,OAAO,mBAAa,CAAA;AAEjC,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAE/C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,MAAM,CAS7E;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAA;IAChB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;yBACyB;AACzB,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAa9E;AAED,qEAAqE;AACrE,eAAO,MAAM,KAAK,oBAAc,CAAA;AAEhC,uFAAuF;AACvF,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAGxE;AAED,kEAAkE;AAClE,eAAO,MAAM,OAAO,eAAS,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { NON_FINITE, numberFormat } from "./shared.js";
|
|
2
|
+
const COMPACT_K = /(\d\s?)K/;
|
|
3
|
+
function fmtCompact(value, options = {}) {
|
|
4
|
+
if (!Number.isFinite(value)) return NON_FINITE;
|
|
5
|
+
const { digits = 1, locale } = options;
|
|
6
|
+
return numberFormat(locale, {
|
|
7
|
+
notation: "compact",
|
|
8
|
+
compactDisplay: "short",
|
|
9
|
+
maximumFractionDigits: digits
|
|
10
|
+
}).format(value).replace(COMPACT_K, "$1k");
|
|
11
|
+
}
|
|
12
|
+
const compact = fmtCompact;
|
|
13
|
+
function fmtPercent(value, options = {}) {
|
|
14
|
+
if (!Number.isFinite(value)) return NON_FINITE;
|
|
15
|
+
const { digits = 0, input = "ratio", locale } = options;
|
|
16
|
+
return numberFormat(locale, {
|
|
17
|
+
style: "percent",
|
|
18
|
+
minimumFractionDigits: digits,
|
|
19
|
+
maximumFractionDigits: digits
|
|
20
|
+
}).format(input === "percent" ? value / 100 : value);
|
|
21
|
+
}
|
|
22
|
+
const percent = fmtPercent;
|
|
23
|
+
function deltaPct(value, options = {}) {
|
|
24
|
+
if (!Number.isFinite(value)) return NON_FINITE;
|
|
25
|
+
const { digits = 0, input = "ratio", locale } = options;
|
|
26
|
+
return numberFormat(locale, {
|
|
27
|
+
style: "percent",
|
|
28
|
+
signDisplay: "exceptZero",
|
|
29
|
+
minimumFractionDigits: digits,
|
|
30
|
+
maximumFractionDigits: digits
|
|
31
|
+
}).format(input === "percent" ? value / 100 : value);
|
|
32
|
+
}
|
|
33
|
+
function fmtCurrency(value, options) {
|
|
34
|
+
if (!Number.isFinite(value)) return NON_FINITE;
|
|
35
|
+
const { currency, compact: isCompact = false, digits, locale } = options;
|
|
36
|
+
const fractionDigits = digits ?? (isCompact ? 1 : 0);
|
|
37
|
+
return numberFormat(locale, {
|
|
38
|
+
style: "currency",
|
|
39
|
+
currency,
|
|
40
|
+
...isCompact && { notation: "compact", compactDisplay: "short" },
|
|
41
|
+
minimumFractionDigits: isCompact ? 0 : fractionDigits,
|
|
42
|
+
maximumFractionDigits: fractionDigits
|
|
43
|
+
}).format(value).replace(COMPACT_K, "$1k");
|
|
44
|
+
}
|
|
45
|
+
const money = fmtCurrency;
|
|
46
|
+
function fmtInt(value, options = {}) {
|
|
47
|
+
if (!Number.isFinite(value)) return NON_FINITE;
|
|
48
|
+
return numberFormat(options.locale, { maximumFractionDigits: 0 }).format(value);
|
|
49
|
+
}
|
|
50
|
+
const integer = fmtInt;
|
|
51
|
+
export {
|
|
52
|
+
NON_FINITE,
|
|
53
|
+
compact,
|
|
54
|
+
deltaPct,
|
|
55
|
+
fmtCompact,
|
|
56
|
+
fmtCurrency,
|
|
57
|
+
fmtInt,
|
|
58
|
+
fmtPercent,
|
|
59
|
+
integer,
|
|
60
|
+
money,
|
|
61
|
+
percent
|
|
62
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared low-level pieces of `basalt-ui/format` — the em-dash sentinel and the memoized
|
|
3
|
+
* `Intl.NumberFormat` cache every number formatter in this module reuses. Moved here (out of
|
|
4
|
+
* `src/charts/utils/format.ts`, C5 consolidation) so the subpath is the single implementation and
|
|
5
|
+
* `charts/utils/format.ts` becomes a thin re-export (`docs/CHARTS-SPEC.md` still calls it home for
|
|
6
|
+
* chart callers, but the code lives here now).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* What EVERY formatter in this module prints for input it cannot represent — `NaN`, `±Infinity`,
|
|
10
|
+
* an `Invalid Date`. An em dash (U+2014). A formatter may say it does not know; it may not print a
|
|
11
|
+
* number that is not one.
|
|
12
|
+
*/
|
|
13
|
+
export declare const NON_FINITE = "\u2014";
|
|
14
|
+
/** Options every number formatter here accepts. */
|
|
15
|
+
export type LocaleOption = {
|
|
16
|
+
/** BCP-47 tag. Default `undefined` — the runtime's own locale. */
|
|
17
|
+
locale?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function numberFormat(locale: string | undefined, options: Intl.NumberFormatOptions): Intl.NumberFormat;
|
|
20
|
+
export declare function dateFormat(locale: string | undefined, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
|
|
21
|
+
/** Coerces the flexible `Date | number | string` inputs this module's date formatters accept into
|
|
22
|
+
* a `Date`. A `number` is treated as epoch milliseconds (matching `Date`'s own constructor and
|
|
23
|
+
* `agent-chat/relative-time.ts`'s prior contract) — a caller with epoch seconds multiplies by
|
|
24
|
+
* 1000 first. Returns `null` for a non-finite/unparseable input so every caller can share one
|
|
25
|
+
* {@link NON_FINITE} guard instead of re-deriving one. */
|
|
26
|
+
export declare function toDate(value: Date | number | string): Date | null;
|
|
27
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/format/shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU,WAAM,CAAA;AAE7B,mDAAmD;AACnD,MAAM,MAAM,YAAY,GAAG;IACzB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AASD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,IAAI,CAAC,mBAAmB,GAChC,IAAI,CAAC,YAAY,CAOnB;AAID,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,IAAI,CAAC,qBAAqB,GAClC,IAAI,CAAC,cAAc,CAOrB;AAED;;;;0DAI0D;AAC1D,wBAAgB,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAGjE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const NON_FINITE = "\u2014";
|
|
2
|
+
const formatterCache = /* @__PURE__ */ new Map();
|
|
3
|
+
function numberFormat(locale, options) {
|
|
4
|
+
const key = `${locale ?? ""}|${JSON.stringify(options)}`;
|
|
5
|
+
const cached = formatterCache.get(key);
|
|
6
|
+
if (cached !== void 0) return cached;
|
|
7
|
+
const created = new Intl.NumberFormat(locale, options);
|
|
8
|
+
formatterCache.set(key, created);
|
|
9
|
+
return created;
|
|
10
|
+
}
|
|
11
|
+
const dateFormatterCache = /* @__PURE__ */ new Map();
|
|
12
|
+
function dateFormat(locale, options) {
|
|
13
|
+
const key = `${locale ?? ""}|${JSON.stringify(options)}`;
|
|
14
|
+
const cached = dateFormatterCache.get(key);
|
|
15
|
+
if (cached !== void 0) return cached;
|
|
16
|
+
const created = new Intl.DateTimeFormat(locale, options);
|
|
17
|
+
dateFormatterCache.set(key, created);
|
|
18
|
+
return created;
|
|
19
|
+
}
|
|
20
|
+
function toDate(value) {
|
|
21
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
22
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
NON_FINITE,
|
|
26
|
+
dateFormat,
|
|
27
|
+
numberFormat,
|
|
28
|
+
toDate
|
|
29
|
+
};
|
package/dist/forms/field.d.ts
CHANGED
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
* three warnings per page. The bundle was basalt's own invention; Mantine's documented idiom is
|
|
11
11
|
* `key={form.key(path)} {...form.getInputProps(path)}`, and this is that idiom with basalt's names.
|
|
12
12
|
*
|
|
13
|
-
* The `@deprecated` `field` alias
|
|
14
|
-
*
|
|
13
|
+
* The `@deprecated` `field` alias that used to live here is removed (1.29.0, C1 consolidation) —
|
|
14
|
+
* `basalt-ui/forms`' `field` collided in name with the `field` store builder on `basalt-ui/state`,
|
|
15
|
+
* which was the whole reason for the rename in the first place. Write
|
|
16
|
+
* `key={fieldKey(form, path)} {...inputProps(form, path)}`.
|
|
15
17
|
*/
|
|
16
18
|
import type { LooseKeys, UseFormReturnType } from '@mantine/form';
|
|
17
19
|
/**
|
|
@@ -41,22 +43,4 @@ export declare function inputProps<Values extends Record<string, unknown>, Path
|
|
|
41
43
|
* <TextInput key={fieldKey(form, 'email')} {...inputProps(form, 'email')} />
|
|
42
44
|
*/
|
|
43
45
|
export declare function fieldKey<Values extends Record<string, unknown>, Path extends LooseKeys<Values>>(form: UseFormReturnType<Values>, path: Path): string;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated Renamed to `inputProps` in 1.x — collides with the `field` store builder in
|
|
46
|
-
* `basalt-ui/state`. Kept until the forms surface next changes; removal ships as a plain `feat:`,
|
|
47
|
-
* never a major. Write `key={fieldKey(form, path)} {...inputProps(form, path)}` instead.
|
|
48
|
-
*
|
|
49
|
-
* **It is NOT `export const field = inputProps` any more, and the difference is the whole point.**
|
|
50
|
-
* It returns the 1.27 shape — `getInputProps(path)` PLUS `key` — because an alias of the new
|
|
51
|
-
* `inputProps` would have changed what every existing `<TextInput {...field(form, 'x')} />` does
|
|
52
|
-
* without changing whether it compiles: the element loses its reconciler key, keeps its old text
|
|
53
|
-
* through `form.reset()`, and nothing anywhere says so. A deprecated export is a SCHEDULE, not a
|
|
54
|
-
* behaviour change (`../../CLAUDE.md`, "Deprecation lifecycle"), so this one keeps its behaviour
|
|
55
|
-
* byte for byte — including the React 19 `A props object containing a "key" prop is being spread
|
|
56
|
-
* into JSX` warning it has always produced. That warning is the migration signal; `1.29.0` removing
|
|
57
|
-
* the export is the deadline. `basalt/forms-field-key` reports every remaining call site.
|
|
58
|
-
*/
|
|
59
|
-
export declare function field<Values extends Record<string, unknown>, Path extends LooseKeys<Values>>(form: UseFormReturnType<Values>, path: Path): ReturnType<UseFormReturnType<Values>['getInputProps']> & {
|
|
60
|
-
key: string;
|
|
61
|
-
};
|
|
62
46
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/forms/field.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/forms/field.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,SAAS,SAAS,CAAC,MAAM,CAAC,EAC/F,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,IAAI,GACT,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,SAAS,SAAS,CAAC,MAAM,CAAC,EAC7F,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,IAAI,GACT,MAAM,CAER"}
|
package/dist/forms/field.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { BasaltProps, SlotStylesProps } from '../common/props.js';
|
|
3
3
|
import type { SlotActions } from '../controls/actions.js';
|
|
4
|
-
import type { WidgetHeaderTitleProps } from '../
|
|
4
|
+
import type { WidgetHeaderTitleProps } from '../dashboard/index.js';
|
|
5
5
|
/** The three boxes `FormSection` paints (`common/props.ts`). */
|
|
6
6
|
export type FormSectionSlot = 'root' | 'header' | 'body';
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-layout.d.ts","sourceRoot":"","sources":["../../src/forms/form-layout.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"form-layout.d.ts","sourceRoot":"","sources":["../../src/forms/form-layout.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAyC1D,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAExD;;;;;GAKG;AACH,MAAM,MAA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AM,gBAAgB,GAAG,WAAW,GAAG;IAC3C;;;;;;;;OAQG;IACH,OAAO,EAAE,WAAW,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAgBlD"}
|
|
@@ -3,7 +3,7 @@ import { VisuallyHidden } from "@mantine/core";
|
|
|
3
3
|
import { cx } from "../common/props.js";
|
|
4
4
|
import { assertRequiredProps } from "../common/validate.js";
|
|
5
5
|
import { BarActionSlot } from "../controls/actions.js";
|
|
6
|
-
import { WidgetHeader } from "../
|
|
6
|
+
import { WidgetHeader } from "../dashboard/index.js";
|
|
7
7
|
import { useFormState } from "./form-state.js";
|
|
8
8
|
import classes from "./form-layout.module.css";
|
|
9
9
|
function RequiredMark({ required }) {
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export { useBasaltForm } from './create-form.js';
|
|
17
17
|
export type { UseBasaltFormOptions } from './create-form.js';
|
|
18
|
-
export { inputProps, fieldKey
|
|
18
|
+
export { inputProps, fieldKey } from './field.js';
|
|
19
19
|
export { FormSection, FormRow, FormGroup, FormActions } from './form-layout.js';
|
|
20
20
|
export type { FormSectionProps, FormSectionSlot, FormRowProps, FormRowSlot, FormGroupProps, FormActionsProps, } from './form-layout.js';
|
|
21
21
|
export { useFormSubmit, isFieldErrorEnvelope } from './use-form-submit.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,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Key } from "./field.js";
|
|
3
3
|
import { FormSection, FormRow, FormGroup, FormActions } from "./form-layout.js";
|
|
4
4
|
import { useFormSubmit, isFieldErrorEnvelope } from "./use-form-submit.js";
|
|
5
5
|
import { FormStateProvider, useFormState } from "./form-state.js";
|
|
@@ -15,7 +15,6 @@ export {
|
|
|
15
15
|
FormRow,
|
|
16
16
|
FormSection,
|
|
17
17
|
FormStateProvider,
|
|
18
|
-
field,
|
|
19
18
|
fieldKey,
|
|
20
19
|
inputProps,
|
|
21
20
|
isFieldErrorEnvelope,
|
|
@@ -28,7 +28,7 @@ export type UseFormSubmitOptions<Values extends Record<string, unknown>> = {
|
|
|
28
28
|
onError?: (err: unknown) => void;
|
|
29
29
|
/**
|
|
30
30
|
* Turns a thrown value into the message `submitError` carries. Defaults to `toErrorMessage`
|
|
31
|
-
* (
|
|
31
|
+
* (root barrel), which already unwraps `Error`, `{ message }` and Eden's `{ status, value }`.
|
|
32
32
|
* Override it to brand the copy or to branch on `errorStatus(err)`.
|
|
33
33
|
*/
|
|
34
34
|
mapError?: (err: unknown) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useRef, useState } from "react";
|
|
2
|
-
import { toErrorMessage } from "../
|
|
2
|
+
import { toErrorMessage } from "../common/errors.js";
|
|
3
3
|
function isFieldErrorEnvelope(err) {
|
|
4
4
|
if (err === null || typeof err !== "object") return false;
|
|
5
5
|
const fieldErrors = err.fieldErrors;
|
package/dist/guard/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ./guard — headless policy core. Mantine-free, dependency-free.
|
|
3
3
|
*
|
|
4
|
-
* GUARD_RULES: the closed registry of all
|
|
4
|
+
* GUARD_RULES: the closed registry of all 26 violation kinds.
|
|
5
5
|
* checkSource: pure (text, relPath, cfg) → Finding[]. No FS, no walk, no console.
|
|
6
6
|
*/
|
|
7
7
|
import type { Finding, GuardConfig, GuardKind, GuardSeverity } from './types.js';
|
|
@@ -115,7 +115,7 @@ export declare const GENERATED_HEADER_LINE = "/* @generated basalt-ui \u2014 do
|
|
|
115
115
|
*/
|
|
116
116
|
export declare const TOKENS_ONLY_DISABLED_KINDS: ReadonlySet<GuardKind>;
|
|
117
117
|
/**
|
|
118
|
-
* The closed registry of all
|
|
118
|
+
* The closed registry of all 26 guard kinds. The triad test asserts
|
|
119
119
|
* `surface.guardKinds ⊆ keyof GUARD_RULES` at runtime.
|
|
120
120
|
*
|
|
121
121
|
* raw-surface, raw-html-layout, and sub-16-input-font are handled inline in checkSource
|
|
@@ -229,13 +229,6 @@ export declare const GUARD_RULES: {
|
|
|
229
229
|
readonly appliesTo: (relPath: string) => boolean;
|
|
230
230
|
readonly message: "Route animation timing through MOTION_DURATION / MOTION_SPRING / MOTION_EASE_STANDARD (basalt-ui motion tokens) instead of a hardcoded duration/spring/ease.";
|
|
231
231
|
};
|
|
232
|
-
readonly 'unframed-chart': {
|
|
233
|
-
readonly kind: "unframed-chart";
|
|
234
|
-
readonly pattern: RegExp;
|
|
235
|
-
readonly enabled: (cfg: GuardConfig) => boolean;
|
|
236
|
-
readonly appliesTo: (relPath: string) => boolean;
|
|
237
|
-
readonly message: "Hand-rolled ChartLegend built from an inline array literal — pass a derived legend (deriveLegend(series)), or compose ChartFrame, which derives it for you.";
|
|
238
|
-
};
|
|
239
232
|
readonly 'chart-missing-aria-label': {
|
|
240
233
|
readonly kind: "chart-missing-aria-label";
|
|
241
234
|
readonly pattern: RegExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7E,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.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IAC3B,qGAAqG;IACrG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,WAAW,GACf,mBAAmB,EAAE,CAuBvB;AAED,kGAAkG;AAClG,eAAO,MAAM,uBAAuB,6BAA6B,CAAA;AAEjE;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,MAAM,CAM9F"}
|
package/dist/guard/index.js
CHANGED
|
@@ -107,9 +107,33 @@ const AXIS_WRAPPER_FILE = /(?:^|\/)Axes\.tsx$/;
|
|
|
107
107
|
const RADIUS_PROP_RE = /\bradius=(?:\{[0-9]+\}|"[0-9]+")/g;
|
|
108
108
|
const MOTION_TRANSITION_NUMERIC = /\btransition\s*=\s*\{\{[^}]*\b(?:duration|stiffness|damping|mass)\s*:\s*-?\d/g;
|
|
109
109
|
const MOTION_TRANSITION_EASE_ARRAY = /\btransition\s*=\s*\{\{[^}]*\bease\s*:\s*\[/g;
|
|
110
|
-
const
|
|
111
|
-
const CHART_ENTRY_POINT_TAG = /<(MultiLine|Bars|BandStrip|Donut|DualPanel|Heatmap|MirroredBars|ZonedLine|StackedArea|LineSparkline|BarSparkline)\b(?:<[^<>]*>)?(?:=>|[^>])*?>/g;
|
|
110
|
+
const CHART_ENTRY_POINT_TAG_START = /<(MultiLine|Bars|BandStrip|Donut|DualPanel|Heatmap|MirroredBars|ZonedLine|StackedArea|LineSparkline|BarSparkline)\b(?:<[^<>]*>)?/g;
|
|
112
111
|
const HAS_ARIA_LABEL_PROP = /\bariaLabel\s*=/;
|
|
112
|
+
function scanChartTagClose(codeText, start) {
|
|
113
|
+
let depth = 0;
|
|
114
|
+
let i = start;
|
|
115
|
+
while (i < codeText.length) {
|
|
116
|
+
const ch = codeText[i];
|
|
117
|
+
if (ch === '"' || ch === "'" || ch === "`") {
|
|
118
|
+
const quote = ch;
|
|
119
|
+
i++;
|
|
120
|
+
while (i < codeText.length && codeText[i] !== quote) {
|
|
121
|
+
i += codeText[i] === "\\" ? 2 : 1;
|
|
122
|
+
}
|
|
123
|
+
i++;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (ch === "{") {
|
|
127
|
+
depth++;
|
|
128
|
+
} else if (ch === "}") {
|
|
129
|
+
depth = Math.max(0, depth - 1);
|
|
130
|
+
} else if (ch === ">" && depth === 0) {
|
|
131
|
+
return i;
|
|
132
|
+
}
|
|
133
|
+
i++;
|
|
134
|
+
}
|
|
135
|
+
return -1;
|
|
136
|
+
}
|
|
113
137
|
const LOCAL_COMPONENT_DEF = /(?:^|[\n;}])\s*(?:export\s+)?(?:default\s+)?(?:async\s+)?(?:function|class|const|let|var)\s+([A-Z]\w*)/g;
|
|
114
138
|
const BASALT_NAMED_IMPORT = /import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"]basalt-ui(?:\/[^'"]*)?['"]/g;
|
|
115
139
|
function localComponentNames(codeText) {
|
|
@@ -164,7 +188,6 @@ const DEFAULT_GUARD_CONFIG = {
|
|
|
164
188
|
inlineDisplay: true,
|
|
165
189
|
rawVisxAxis: true,
|
|
166
190
|
rawMotionValue: true,
|
|
167
|
-
unframedChart: true,
|
|
168
191
|
chartMissingAriaLabel: true,
|
|
169
192
|
rawFormControl: true,
|
|
170
193
|
sub16InputFont: true,
|
|
@@ -263,12 +286,10 @@ const PLUGIN_RULE_IDS = /* @__PURE__ */ new Set([
|
|
|
263
286
|
"responsive-twin",
|
|
264
287
|
"search-literal-link",
|
|
265
288
|
"use-search-from-literal",
|
|
266
|
-
// The
|
|
267
|
-
// reach: provenance here is an import graph and a JSX ancestry, neither of which
|
|
268
|
-
// regex window has. Same reason `bound-control-outside-home` has no text-lane twin.
|
|
289
|
+
// The three remaining F5 rules and the B4 deprecation rule — all AST-only, all outside
|
|
290
|
+
// `checkSource`'s reach: provenance here is an import graph and a JSX ancestry, neither of which
|
|
291
|
+
// a 12-line regex window has. Same reason `bound-control-outside-home` has no text-lane twin.
|
|
269
292
|
"provider-above-router",
|
|
270
|
-
"duplicate-notifications-mount",
|
|
271
|
-
"query-dual-import",
|
|
272
293
|
"query-fn-unwrap",
|
|
273
294
|
"deprecated-export",
|
|
274
295
|
// Same lane: `{...inputProps(…)}` without a sibling `key` is a JSX-ancestry claim (does this
|
|
@@ -280,11 +301,25 @@ const PLUGIN_RULE_IDS = /* @__PURE__ */ new Set([
|
|
|
280
301
|
"visx-boundary",
|
|
281
302
|
"visx-tooltip",
|
|
282
303
|
"token-layer-boundary",
|
|
304
|
+
"no-import-meta-env",
|
|
283
305
|
// These three honour `basalt-agent-allow`, never `theme-allow` — but they are still REAL ids, so
|
|
284
306
|
// a `theme-allow ai-sdk-major` must parse as a (useless) scoped annotation rather than as prose.
|
|
285
307
|
"agent-resume-guard",
|
|
286
308
|
"agent-no-raw-usechat",
|
|
287
|
-
"ai-sdk-major"
|
|
309
|
+
"ai-sdk-major",
|
|
310
|
+
// Retired guard kinds — `unframed-chart`'s only case (`<ChartLegend items={[...]}>`) is fully
|
|
311
|
+
// subsumed by `basalt/chart-legend-literal`. Kept here (mirrored by the plugin's own
|
|
312
|
+
// `RETIRED_RULE_IDS`) so an existing `theme-allow unframed-chart` reads as a dead waiver via
|
|
313
|
+
// `--audit-allows`, never as an unknown-id typo.
|
|
314
|
+
"unframed-chart",
|
|
315
|
+
// Retired plugin rule — `<BasaltNotifications />` mounted beside `<BasaltOverlays
|
|
316
|
+
// notifications>` is unreachable now that `BasaltNotifications` no longer exists as a
|
|
317
|
+
// standalone export. Mirrored by the plugin's own `RETIRED_RULE_IDS`.
|
|
318
|
+
"duplicate-notifications-mount",
|
|
319
|
+
// Retired plugin rule — its whole premise (a raw `@tanstack/react-query` import beside
|
|
320
|
+
// `basalt-ui/query`) is unreachable now that C1 (1.29.0) dropped the `./query` subpath.
|
|
321
|
+
// Mirrored by the plugin's own `RETIRED_RULE_IDS`.
|
|
322
|
+
"query-dual-import"
|
|
288
323
|
]);
|
|
289
324
|
const MIN_ALLOW_REASON_LENGTH = 4;
|
|
290
325
|
function parseAllowAnnotation(rest, scope) {
|
|
@@ -479,7 +514,6 @@ const TOKENS_ONLY_DISABLED_KINDS = /* @__PURE__ */ new Set([
|
|
|
479
514
|
"inline-display",
|
|
480
515
|
"raw-visx-axis",
|
|
481
516
|
"raw-motion-value",
|
|
482
|
-
"unframed-chart",
|
|
483
517
|
"chart-missing-aria-label",
|
|
484
518
|
"raw-form-control",
|
|
485
519
|
"sub-16-input-font",
|
|
@@ -770,18 +804,9 @@ const GUARD_RULES = {
|
|
|
770
804
|
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
771
805
|
message: "Route animation timing through MOTION_DURATION / MOTION_SPRING / MOTION_EASE_STANDARD (basalt-ui motion tokens) instead of a hardcoded duration/spring/ease."
|
|
772
806
|
},
|
|
773
|
-
"unframed-chart": {
|
|
774
|
-
kind: "unframed-chart",
|
|
775
|
-
pattern: RAW_CHART_LEGEND_ARRAY,
|
|
776
|
-
// handled inline (full-text tag-scoped scan); entry keeps registry complete
|
|
777
|
-
enabled: (cfg) => cfg.unframedChart,
|
|
778
|
-
// JSX-tag-shaped (`<ChartLegend items={[…]}>`) — never appears in CSS text.
|
|
779
|
-
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
780
|
-
message: "Hand-rolled ChartLegend built from an inline array literal \u2014 pass a derived legend (deriveLegend(series)), or compose ChartFrame, which derives it for you."
|
|
781
|
-
},
|
|
782
807
|
"chart-missing-aria-label": {
|
|
783
808
|
kind: "chart-missing-aria-label",
|
|
784
|
-
pattern:
|
|
809
|
+
pattern: CHART_ENTRY_POINT_TAG_START,
|
|
785
810
|
// handled inline (full-text tag-scoped scan); entry keeps registry complete
|
|
786
811
|
enabled: (cfg) => cfg.chartMissingAriaLabel,
|
|
787
812
|
// JSX-tag-shaped (`<MultiLine …>`) — never appears in CSS text.
|
|
@@ -1059,23 +1084,19 @@ function checkSource(text, relPath, cfg) {
|
|
|
1059
1084
|
});
|
|
1060
1085
|
}
|
|
1061
1086
|
}
|
|
1062
|
-
const unframedChartRuns = GUARD_RULES["unframed-chart"].enabled(cfg) && ruleApplies("unframed-chart", relPath);
|
|
1063
1087
|
const ariaLabelRuns = GUARD_RULES["chart-missing-aria-label"].enabled(cfg) && ruleApplies("chart-missing-aria-label", relPath);
|
|
1064
|
-
const localNames =
|
|
1065
|
-
const basaltNames =
|
|
1088
|
+
const localNames = ariaLabelRuns ? localComponentNames(codeText) : /* @__PURE__ */ new Set();
|
|
1089
|
+
const basaltNames = ariaLabelRuns ? basaltImportedNames(codeText) : /* @__PURE__ */ new Set();
|
|
1066
1090
|
const isShippedTag = (tag) => basaltNames.has(tag) || !localNames.has(tag);
|
|
1067
|
-
if (unframedChartRuns && isShippedTag("ChartLegend")) {
|
|
1068
|
-
for (const m of codeText.matchAll(RAW_CHART_LEGEND_ARRAY)) {
|
|
1069
|
-
const lineNo = codeText.slice(0, (m.index ?? 0) + m[0].length).split("\n").length;
|
|
1070
|
-
push("unframed-chart", lineNo, "items={[");
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
1091
|
if (ariaLabelRuns) {
|
|
1074
|
-
for (const m of codeText.matchAll(
|
|
1075
|
-
const
|
|
1092
|
+
for (const m of codeText.matchAll(CHART_ENTRY_POINT_TAG_START)) {
|
|
1093
|
+
const matchStart = m.index ?? 0;
|
|
1076
1094
|
if (!isShippedTag(m[1])) continue;
|
|
1095
|
+
const closeIdx = scanChartTagClose(codeText, matchStart + m[0].length);
|
|
1096
|
+
if (closeIdx === -1) continue;
|
|
1097
|
+
const tagText = codeText.slice(matchStart, closeIdx + 1);
|
|
1077
1098
|
if (HAS_ARIA_LABEL_PROP.test(tagText)) continue;
|
|
1078
|
-
const startLine = codeText.slice(0,
|
|
1099
|
+
const startLine = codeText.slice(0, matchStart).split("\n").length;
|
|
1079
1100
|
const endLine = startLine + (tagText.split("\n").length - 1);
|
|
1080
1101
|
if (isAllowedInRange(startLine, endLine, "chart-missing-aria-label")) continue;
|
|
1081
1102
|
findings.push({
|