cursedbelt 5.40.0 → 5.45.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/dist/react/Toast.d.ts +12 -2
- package/dist/react/Toast.d.ts.map +1 -1
- package/dist/react/Toast.js +32 -3
- package/dist/react/Toast.js.map +1 -1
- package/dist/react/analytics/MetricDrilldown.js +1 -1
- package/dist/react/canvas-hud/CanvasMinimap.d.ts +32 -0
- package/dist/react/canvas-hud/CanvasMinimap.d.ts.map +1 -0
- package/dist/react/canvas-hud/CanvasMinimap.js +32 -0
- package/dist/react/canvas-hud/CanvasMinimap.js.map +1 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.d.ts +34 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.d.ts.map +1 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.js +21 -0
- package/dist/react/canvas-hud/CanvasNodeMenu.js.map +1 -0
- package/dist/react/canvas-hud/CanvasSearchField.d.ts +27 -0
- package/dist/react/canvas-hud/CanvasSearchField.d.ts.map +1 -0
- package/dist/react/canvas-hud/CanvasSearchField.js +35 -0
- package/dist/react/canvas-hud/CanvasSearchField.js.map +1 -0
- package/dist/react/canvas-hud/HudControls.d.ts +43 -0
- package/dist/react/canvas-hud/HudControls.d.ts.map +1 -0
- package/dist/react/canvas-hud/HudControls.js +22 -0
- package/dist/react/canvas-hud/HudControls.js.map +1 -0
- package/dist/react/canvas-hud/index.d.ts +13 -0
- package/dist/react/canvas-hud/index.d.ts.map +1 -0
- package/dist/react/canvas-hud/index.js +7 -0
- package/dist/react/canvas-hud/index.js.map +1 -0
- package/dist/react/canvas-hud/useCanvasWheel.d.ts +41 -0
- package/dist/react/canvas-hud/useCanvasWheel.d.ts.map +1 -0
- package/dist/react/canvas-hud/useCanvasWheel.js +65 -0
- package/dist/react/canvas-hud/useCanvasWheel.js.map +1 -0
- package/dist/react/canvas-hud/viewport.d.ts +68 -0
- package/dist/react/canvas-hud/viewport.d.ts.map +1 -0
- package/dist/react/canvas-hud/viewport.js +77 -0
- package/dist/react/canvas-hud/viewport.js.map +1 -0
- package/dist/react/charts/AreaChart.d.ts.map +1 -1
- package/dist/react/charts/AreaChart.js +5 -5
- package/dist/react/charts/AreaChart.js.map +1 -1
- package/dist/react/charts/BarChart.d.ts.map +1 -1
- package/dist/react/charts/BarChart.js +3 -3
- package/dist/react/charts/BarChart.js.map +1 -1
- package/dist/react/charts/ChartCard.d.ts +53 -0
- package/dist/react/charts/ChartCard.d.ts.map +1 -0
- package/dist/react/charts/ChartCard.js +46 -0
- package/dist/react/charts/ChartCard.js.map +1 -0
- package/dist/react/charts/ChartFrame.d.ts +12 -5
- package/dist/react/charts/ChartFrame.d.ts.map +1 -1
- package/dist/react/charts/ChartFrame.js +12 -5
- package/dist/react/charts/ChartFrame.js.map +1 -1
- package/dist/react/charts/ChartLegend.js +1 -1
- package/dist/react/charts/ChartLegend.js.map +1 -1
- package/dist/react/charts/HeatmapChart.js +3 -3
- package/dist/react/charts/HeatmapChart.js.map +1 -1
- package/dist/react/charts/IntervalTimeline.js +1 -1
- package/dist/react/charts/IntervalTimeline.js.map +1 -1
- package/dist/react/charts/LineChart.d.ts.map +1 -1
- package/dist/react/charts/LineChart.js +3 -3
- package/dist/react/charts/LineChart.js.map +1 -1
- package/dist/react/charts/TimeSeriesChart.d.ts.map +1 -1
- package/dist/react/charts/TimeSeriesChart.js +6 -6
- package/dist/react/charts/TimeSeriesChart.js.map +1 -1
- package/dist/react/charts/chartBox.d.ts +46 -0
- package/dist/react/charts/chartBox.d.ts.map +1 -0
- package/dist/react/charts/chartBox.js +45 -0
- package/dist/react/charts/chartBox.js.map +1 -0
- package/dist/react/charts/index.d.ts +2 -0
- package/dist/react/charts/index.d.ts.map +1 -1
- package/dist/react/charts/index.js +2 -0
- package/dist/react/charts/index.js.map +1 -1
- package/dist/react/charts/shared.d.ts +13 -2
- package/dist/react/charts/shared.d.ts.map +1 -1
- package/dist/react/charts/shared.js +14 -3
- package/dist/react/charts/shared.js.map +1 -1
- package/dist/react/chat/Bubble.js +4 -4
- package/dist/react/chat/Bubble.js.map +1 -1
- package/dist/react/chat/MessageScroller.js +1 -1
- package/dist/react/chat/MessageScroller.js.map +1 -1
- package/dist/react/components/ActionBar.d.ts.map +1 -1
- package/dist/react/components/ActionBar.js +63 -1
- package/dist/react/components/ActionBar.js.map +1 -1
- package/dist/react/components/AddItemsMenu.js +1 -1
- package/dist/react/components/AddItemsMenu.js.map +1 -1
- package/dist/react/components/Alert.d.ts +16 -2
- package/dist/react/components/Alert.d.ts.map +1 -1
- package/dist/react/components/Alert.js +35 -2
- package/dist/react/components/Alert.js.map +1 -1
- package/dist/react/components/AppShell.d.ts +55 -33
- package/dist/react/components/AppShell.d.ts.map +1 -1
- package/dist/react/components/AppShell.js +141 -31
- package/dist/react/components/AppShell.js.map +1 -1
- package/dist/react/components/AsyncPanel.d.ts +21 -3
- package/dist/react/components/AsyncPanel.d.ts.map +1 -1
- package/dist/react/components/AsyncPanel.js +50 -6
- package/dist/react/components/AsyncPanel.js.map +1 -1
- package/dist/react/components/BannerLane.d.ts +32 -0
- package/dist/react/components/BannerLane.d.ts.map +1 -0
- package/dist/react/components/BannerLane.js +41 -0
- package/dist/react/components/BannerLane.js.map +1 -0
- package/dist/react/components/Button.d.ts.map +1 -1
- package/dist/react/components/Button.js +2 -1
- package/dist/react/components/Button.js.map +1 -1
- package/dist/react/components/Checkbox.d.ts.map +1 -1
- package/dist/react/components/Checkbox.js +7 -2
- package/dist/react/components/Checkbox.js.map +1 -1
- package/dist/react/components/ChipFilterStrip.js +1 -1
- package/dist/react/components/ChipFilterStrip.js.map +1 -1
- package/dist/react/components/ComboboxField.d.ts.map +1 -1
- package/dist/react/components/ComboboxField.js +14 -4
- package/dist/react/components/ComboboxField.js.map +1 -1
- package/dist/react/components/CommentThread.js +2 -2
- package/dist/react/components/CommentThread.js.map +1 -1
- package/dist/react/components/ConfirmDialog.js +1 -1
- package/dist/react/components/ConfirmDialog.js.map +1 -1
- package/dist/react/components/DataTable/DataTable.d.ts +18 -2
- package/dist/react/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/react/components/DataTable/DataTable.js +51 -12
- package/dist/react/components/DataTable/DataTable.js.map +1 -1
- package/dist/react/components/DataTable/Pagination.js +1 -1
- package/dist/react/components/DataTable/Pagination.js.map +1 -1
- package/dist/react/components/DataTable/RowActions.d.ts +7 -1
- package/dist/react/components/DataTable/RowActions.d.ts.map +1 -1
- package/dist/react/components/DataTable/RowActions.js +10 -3
- package/dist/react/components/DataTable/RowActions.js.map +1 -1
- package/dist/react/components/DataTable/TableFilterBuilder.js +1 -1
- package/dist/react/components/DataTable/TableFilterBuilder.js.map +1 -1
- package/dist/react/components/DataTable/cells/CodeCell.js +1 -1
- package/dist/react/components/DataTable/cells/CodeCell.js.map +1 -1
- package/dist/react/components/DataTable/cells/LinkCell.js +1 -1
- package/dist/react/components/DataTable/cells/LinkCell.js.map +1 -1
- package/dist/react/components/DataTable/index.d.ts +1 -1
- package/dist/react/components/DataTable/index.d.ts.map +1 -1
- package/dist/react/components/DataTable/index.js.map +1 -1
- package/dist/react/components/DataTable/types.d.ts +20 -0
- package/dist/react/components/DataTable/types.d.ts.map +1 -1
- package/dist/react/components/DataTable/types.js +22 -0
- package/dist/react/components/DataTable/types.js.map +1 -1
- package/dist/react/components/DateTimeField.d.ts.map +1 -1
- package/dist/react/components/DateTimeField.js +4 -1
- package/dist/react/components/DateTimeField.js.map +1 -1
- package/dist/react/components/DeleteButton.js +2 -0
- package/dist/react/components/DeleteButton.js.map +1 -1
- package/dist/react/components/Drawer.js +3 -3
- package/dist/react/components/Drawer.js.map +1 -1
- package/dist/react/components/DropdownMenu.d.ts +16 -0
- package/dist/react/components/DropdownMenu.d.ts.map +1 -1
- package/dist/react/components/DropdownMenu.js +22 -6
- package/dist/react/components/DropdownMenu.js.map +1 -1
- package/dist/react/components/EmptyState.d.ts +10 -2
- package/dist/react/components/EmptyState.d.ts.map +1 -1
- package/dist/react/components/EmptyState.js +10 -5
- package/dist/react/components/EmptyState.js.map +1 -1
- package/dist/react/components/EventTimeline.js +1 -1
- package/dist/react/components/EventTimeline.js.map +1 -1
- package/dist/react/components/Field.d.ts.map +1 -1
- package/dist/react/components/Field.js +4 -1
- package/dist/react/components/Field.js.map +1 -1
- package/dist/react/components/FileDropZone.js +1 -1
- package/dist/react/components/FileDropZone.js.map +1 -1
- package/dist/react/components/Grid.d.ts +9 -1
- package/dist/react/components/Grid.d.ts.map +1 -1
- package/dist/react/components/Grid.js +20 -2
- package/dist/react/components/Grid.js.map +1 -1
- package/dist/react/components/Guide.d.ts +31 -0
- package/dist/react/components/Guide.d.ts.map +1 -0
- package/dist/react/components/Guide.js +18 -0
- package/dist/react/components/Guide.js.map +1 -0
- package/dist/react/components/InfoHintImpl.d.ts +0 -13
- package/dist/react/components/InfoHintImpl.d.ts.map +1 -1
- package/dist/react/components/InfoHintImpl.js +17 -1
- package/dist/react/components/InfoHintImpl.js.map +1 -1
- package/dist/react/components/InlineEditableText.js +1 -1
- package/dist/react/components/InlineEditableText.js.map +1 -1
- package/dist/react/components/IsolatedFrame.js +1 -1
- package/dist/react/components/IsolatedFrame.js.map +1 -1
- package/dist/react/components/ListToolbar.d.ts.map +1 -1
- package/dist/react/components/ListToolbar.js +2 -2
- package/dist/react/components/ListToolbar.js.map +1 -1
- package/dist/react/components/LogViewer.d.ts +26 -2
- package/dist/react/components/LogViewer.d.ts.map +1 -1
- package/dist/react/components/LogViewer.js +41 -26
- package/dist/react/components/LogViewer.js.map +1 -1
- package/dist/react/components/Modal.d.ts +5 -1
- package/dist/react/components/Modal.d.ts.map +1 -1
- package/dist/react/components/Modal.js +18 -8
- package/dist/react/components/Modal.js.map +1 -1
- package/dist/react/components/Page.d.ts +51 -7
- package/dist/react/components/Page.d.ts.map +1 -1
- package/dist/react/components/Page.js +53 -8
- package/dist/react/components/Page.js.map +1 -1
- package/dist/react/components/PageGuideButton.d.ts +11 -0
- package/dist/react/components/PageGuideButton.d.ts.map +1 -0
- package/dist/react/components/PageGuideButton.js +52 -0
- package/dist/react/components/PageGuideButton.js.map +1 -0
- package/dist/react/components/PageGuidePopover.d.ts +14 -0
- package/dist/react/components/PageGuidePopover.d.ts.map +1 -0
- package/dist/react/components/PageGuidePopover.js +25 -0
- package/dist/react/components/PageGuidePopover.js.map +1 -0
- package/dist/react/components/PanelSeparator.js +1 -1
- package/dist/react/components/PanelSeparator.js.map +1 -1
- package/dist/react/components/Popover.d.ts.map +1 -1
- package/dist/react/components/Popover.js +2 -1
- package/dist/react/components/Popover.js.map +1 -1
- package/dist/react/components/PromptDialog.js +1 -1
- package/dist/react/components/PromptDialog.js.map +1 -1
- package/dist/react/components/ScrollArea.d.ts +9 -1
- package/dist/react/components/ScrollArea.d.ts.map +1 -1
- package/dist/react/components/ScrollArea.js +9 -3
- package/dist/react/components/ScrollArea.js.map +1 -1
- package/dist/react/components/Section.d.ts +5 -2
- package/dist/react/components/Section.d.ts.map +1 -1
- package/dist/react/components/Section.js +5 -2
- package/dist/react/components/Section.js.map +1 -1
- package/dist/react/components/Skeleton.d.ts +19 -1
- package/dist/react/components/Skeleton.d.ts.map +1 -1
- package/dist/react/components/Skeleton.js +24 -2
- package/dist/react/components/Skeleton.js.map +1 -1
- package/dist/react/components/StatStrip.js +1 -1
- package/dist/react/components/StatStrip.js.map +1 -1
- package/dist/react/components/StatTile.d.ts +30 -3
- package/dist/react/components/StatTile.d.ts.map +1 -1
- package/dist/react/components/StatTile.js +35 -9
- package/dist/react/components/StatTile.js.map +1 -1
- package/dist/react/components/StatTileGrid.d.ts +10 -1
- package/dist/react/components/StatTileGrid.d.ts.map +1 -1
- package/dist/react/components/StatTileGrid.js +50 -33
- package/dist/react/components/StatTileGrid.js.map +1 -1
- package/dist/react/components/StatusPill.d.ts.map +1 -1
- package/dist/react/components/StatusPill.js +26 -1
- package/dist/react/components/StatusPill.js.map +1 -1
- package/dist/react/components/Surface.d.ts +1 -1
- package/dist/react/components/Surface.d.ts.map +1 -1
- package/dist/react/components/Surface.js +20 -11
- package/dist/react/components/Surface.js.map +1 -1
- package/dist/react/components/SwatchPicker.d.ts.map +1 -1
- package/dist/react/components/SwatchPicker.js +5 -1
- package/dist/react/components/SwatchPicker.js.map +1 -1
- package/dist/react/components/Switch.js +1 -1
- package/dist/react/components/Switch.js.map +1 -1
- package/dist/react/components/TagsInput.d.ts.map +1 -1
- package/dist/react/components/TagsInput.js +3 -1
- package/dist/react/components/TagsInput.js.map +1 -1
- package/dist/react/components/WidgetHeader.js +1 -1
- package/dist/react/components/WidgetHeader.js.map +1 -1
- package/dist/react/components/calendar/CalendarLegend.js +1 -1
- package/dist/react/components/calendar/CalendarLegend.js.map +1 -1
- package/dist/react/components/calendar/DayAgenda.js +1 -1
- package/dist/react/components/calendar/DayAgenda.js.map +1 -1
- package/dist/react/components/calendar/EventChip.js +1 -1
- package/dist/react/components/calendar/EventChip.js.map +1 -1
- package/dist/react/components/calendar/MonthGrid.js +1 -1
- package/dist/react/components/calendar/MonthGrid.js.map +1 -1
- package/dist/react/components/calendar/WeekView.js +2 -2
- package/dist/react/components/calendar/WeekView.js.map +1 -1
- package/dist/react/components/cardFrame.d.ts +16 -0
- package/dist/react/components/cardFrame.d.ts.map +1 -0
- package/dist/react/components/cardFrame.js +24 -0
- package/dist/react/components/cardFrame.js.map +1 -0
- package/dist/react/components/dialog.d.ts.map +1 -1
- package/dist/react/components/dialog.js +2 -1
- package/dist/react/components/dialog.js.map +1 -1
- package/dist/react/dashboard-grid/WidgetFrame.js +2 -2
- package/dist/react/dashboard-grid/WidgetFrame.js.map +1 -1
- package/dist/react/emoji/EmojiPicker.js +1 -1
- package/dist/react/emoji/EmojiPicker.js.map +1 -1
- package/dist/react/file-tree/FileTree.d.ts +8 -1
- package/dist/react/file-tree/FileTree.d.ts.map +1 -1
- package/dist/react/file-tree/FileTree.js +29 -4
- package/dist/react/file-tree/FileTree.js.map +1 -1
- package/dist/react/filter-rail/FilterRail.js +1 -1
- package/dist/react/filter-rail/FilterRail.js.map +1 -1
- package/dist/react/folder-tree/FolderPicker.d.ts.map +1 -1
- package/dist/react/folder-tree/FolderPicker.js +5 -1
- package/dist/react/folder-tree/FolderPicker.js.map +1 -1
- package/dist/react/icons.d.ts +28 -0
- package/dist/react/icons.d.ts.map +1 -1
- package/dist/react/icons.js +29 -1
- package/dist/react/icons.js.map +1 -1
- package/dist/react/index.d.ts +9 -6
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +6 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/lib/menuSections.d.ts +8 -0
- package/dist/react/lib/menuSections.d.ts.map +1 -0
- package/dist/react/lib/menuSections.js +37 -0
- package/dist/react/lib/menuSections.js.map +1 -0
- package/dist/react/lib/whenIdle.d.ts +7 -0
- package/dist/react/lib/whenIdle.d.ts.map +1 -0
- package/dist/react/lib/whenIdle.js +14 -0
- package/dist/react/lib/whenIdle.js.map +1 -0
- package/dist/react/markdown/Markdown.js +2 -2
- package/dist/react/markdown/Markdown.js.map +1 -1
- package/dist/react/media/DenseGalleryShell.d.ts +7 -1
- package/dist/react/media/DenseGalleryShell.d.ts.map +1 -1
- package/dist/react/media/DenseGalleryShell.js +3 -3
- package/dist/react/media/DenseGalleryShell.js.map +1 -1
- package/dist/react/media/HoverScrubVideoThumb.js +1 -1
- package/dist/react/media/HoverScrubVideoThumb.js.map +1 -1
- package/dist/react/media/MaskPainter.js +1 -1
- package/dist/react/media/MediaUploadControl.js +1 -1
- package/dist/react/media/MediaUploadControl.js.map +1 -1
- package/dist/react/media/VideoTrimmer.js +1 -1
- package/dist/react/media/VideoTrimmer.js.map +1 -1
- package/dist/react/media/denseGallery.css +96 -1
- package/dist/react/media-gallery/MediaGallery.d.ts +5 -2
- package/dist/react/media-gallery/MediaGallery.d.ts.map +1 -1
- package/dist/react/media-gallery/MediaGallery.js +1 -1
- package/dist/react/media-gallery/MediaGallery.js.map +1 -1
- package/dist/react/namespace/NamespaceTargetCapsule.js +1 -1
- package/dist/react/namespace/NamespaceTargetCapsule.js.map +1 -1
- package/dist/react/nav/BreadcrumbTrail.js +1 -1
- package/dist/react/nav/BreadcrumbTrail.js.map +1 -1
- package/dist/react/nav/CommandBar.d.ts +7 -1
- package/dist/react/nav/CommandBar.d.ts.map +1 -1
- package/dist/react/nav/CommandBar.js +5 -3
- package/dist/react/nav/CommandBar.js.map +1 -1
- package/dist/react/nav/PlaceBar.d.ts.map +1 -1
- package/dist/react/nav/PlaceBar.js +7 -9
- package/dist/react/nav/PlaceBar.js.map +1 -1
- package/dist/react/nav/SideNav.d.ts +12 -2
- package/dist/react/nav/SideNav.d.ts.map +1 -1
- package/dist/react/nav/SideNav.js +42 -22
- package/dist/react/nav/SideNav.js.map +1 -1
- package/dist/react/nav/TopBar.d.ts +65 -31
- package/dist/react/nav/TopBar.d.ts.map +1 -1
- package/dist/react/nav/TopBar.js +59 -24
- package/dist/react/nav/TopBar.js.map +1 -1
- package/dist/react/nav/index.d.ts +1 -1
- package/dist/react/nav/index.d.ts.map +1 -1
- package/dist/react/nav/index.js +1 -1
- package/dist/react/nav/index.js.map +1 -1
- package/dist/react/nav/navShared.d.ts +10 -1
- package/dist/react/nav/navShared.d.ts.map +1 -1
- package/dist/react/nav/navShared.js +23 -0
- package/dist/react/nav/navShared.js.map +1 -1
- package/dist/react/notifications/NotificationFeed.js +2 -2
- package/dist/react/notifications/NotificationFeed.js.map +1 -1
- package/dist/react/palette/Command.d.ts.map +1 -1
- package/dist/react/palette/Command.js +1 -1
- package/dist/react/palette/Command.js.map +1 -1
- package/dist/react/palette/CommandPalette.d.ts +13 -1
- package/dist/react/palette/CommandPalette.d.ts.map +1 -1
- package/dist/react/palette/CommandPalette.js +44 -8
- package/dist/react/palette/CommandPalette.js.map +1 -1
- package/dist/react/palette/commandSources.d.ts +57 -0
- package/dist/react/palette/commandSources.d.ts.map +1 -0
- package/dist/react/palette/commandSources.js +129 -0
- package/dist/react/palette/commandSources.js.map +1 -0
- package/dist/react/palette/index.d.ts +1 -0
- package/dist/react/palette/index.d.ts.map +1 -1
- package/dist/react/palette/index.js +1 -0
- package/dist/react/palette/index.js.map +1 -1
- package/dist/react/rich-text/RichTextEditor.js +1 -1
- package/dist/react/rich-text/RichTextEditor.js.map +1 -1
- package/dist/react/rich-text/RichTextToolbar.js +1 -1
- package/dist/react/rich-text/RichTextToolbar.js.map +1 -1
- package/dist/scripts/guardrailsEnforce.d.ts.map +1 -1
- package/dist/styles-areas/analytics.css +16 -16
- package/dist/styles-areas/auth.css +2 -2
- package/dist/styles-areas/calendar.css +5 -6
- package/dist/styles-areas/canvas-hud.css +30 -0
- package/dist/styles-areas/chart-table.css +1 -1
- package/dist/styles-areas/charts.css +3 -3
- package/dist/styles-areas/chat.css +7 -6
- package/dist/styles-areas/companion-link.css +2 -2
- package/dist/styles-areas/core.css +99 -90
- package/dist/styles-areas/dashboard-grid.css +4 -4
- package/dist/styles-areas/data-table.css +16 -16
- package/dist/styles-areas/disk-usage.css +5 -5
- package/dist/styles-areas/emoji.css +2 -2
- package/dist/styles-areas/fields.css +13 -14
- package/dist/styles-areas/filter-rail.css +4 -4
- package/dist/styles-areas/folder-tree.css +6 -6
- package/dist/styles-areas/layout-engine.css +4 -4
- package/dist/styles-areas/markdown.css +2 -1
- package/dist/styles-areas/master-detail.css +3 -3
- package/dist/styles-areas/media-gallery.css +7 -6
- package/dist/styles-areas/media.css +12 -13
- package/dist/styles-areas/nav.css +28 -14
- package/dist/styles-areas/notifications.css +4 -4
- package/dist/styles-areas/overlays.css +4 -4
- package/dist/styles-areas/palette.css +5 -4
- package/dist/styles-areas/rich-text.css +3 -3
- package/dist/styles-areas/sharing.css +4 -3
- package/dist/styles-areas/stats.css +9 -8
- package/dist/styles-areas/test-report.css +4 -4
- package/dist/styles-areas/wizard.css +6 -5
- package/dist/styles-areas/workbench.css +10 -9
- package/dist/styles-areas/workbook-viewer.css +2 -2
- package/dist/styles-utilities.css +296 -190
- package/dist/testing/designAudit.d.ts.map +1 -1
- package/dist/testing/designAudit.js +4 -0
- package/dist/testing/designAudit.js.map +1 -1
- package/dist/testing/designBaseline.d.ts.map +1 -1
- package/dist/testing/designBaseline.js +4 -0
- package/dist/testing/designBaseline.js.map +1 -1
- package/dist/theme.css +103 -2
- package/package.json +10 -2
- package/scripts/generateAreaStyles.ts +3 -1
- package/scripts/guardrails-baseline.json +2 -1
- package/scripts/guardrailsEnforce.spec.ts +64 -0
- package/scripts/guardrailsEnforce.ts +65 -8
- package/scripts/styleAreas.ts +89 -6
- package/src/bundlerOnlyEntries.spec.ts +25 -8
- package/src/nodeTypesDeclared.spec.ts +47 -0
- package/src/react/Toast.spec.tsx +43 -0
- package/src/react/Toast.tsx +45 -2
- package/src/react/analytics/MetricDrilldown.tsx +1 -1
- package/src/react/canvas-hud/CanvasMinimap.tsx +88 -0
- package/src/react/canvas-hud/CanvasNodeMenu.tsx +91 -0
- package/src/react/canvas-hud/CanvasSearchField.tsx +91 -0
- package/src/react/canvas-hud/HudControls.spec.tsx +160 -0
- package/src/react/canvas-hud/HudControls.tsx +128 -0
- package/src/react/canvas-hud/index.ts +33 -0
- package/src/react/canvas-hud/useCanvasWheel.ts +99 -0
- package/src/react/canvas-hud/viewport.spec.ts +105 -0
- package/src/react/canvas-hud/viewport.ts +124 -0
- package/src/react/charts/AreaChart.tsx +9 -8
- package/src/react/charts/BarChart.tsx +11 -10
- package/src/react/charts/ChartCard.tsx +146 -0
- package/src/react/charts/ChartFrame.tsx +28 -10
- package/src/react/charts/ChartLegend.tsx +1 -1
- package/src/react/charts/HeatmapChart.tsx +5 -5
- package/src/react/charts/IntervalTimeline.tsx +2 -2
- package/src/react/charts/LineChart.tsx +9 -8
- package/src/react/charts/TimeSeriesChart.tsx +11 -10
- package/src/react/charts/chartBox.spec.ts +40 -0
- package/src/react/charts/chartBox.ts +75 -0
- package/src/react/charts/index.ts +2 -0
- package/src/react/charts/shared.ts +16 -3
- package/src/react/chat/Bubble.tsx +5 -5
- package/src/react/chat/MessageScroller.tsx +1 -1
- package/src/react/components/ActionBar.spec.tsx +90 -0
- package/src/react/components/ActionBar.tsx +82 -2
- package/src/react/components/AddItemsMenu.tsx +1 -1
- package/src/react/components/Alert.spec.tsx +32 -2
- package/src/react/components/Alert.tsx +47 -3
- package/src/react/components/AppShell.spec.tsx +199 -13
- package/src/react/components/AppShell.tsx +254 -92
- package/src/react/components/AsyncPanel.spec.tsx +17 -1
- package/src/react/components/AsyncPanel.tsx +88 -6
- package/src/react/components/BannerLane.tsx +128 -0
- package/src/react/components/Button.tsx +2 -0
- package/src/react/components/Checkbox.spec.tsx +18 -0
- package/src/react/components/Checkbox.tsx +8 -5
- package/src/react/components/ChipFilterStrip.tsx +1 -1
- package/src/react/components/ComboboxField.tsx +20 -3
- package/src/react/components/CommentThread.tsx +2 -2
- package/src/react/components/ConfirmDialog.tsx +1 -1
- package/src/react/components/DataTable/DataTable.tsx +80 -8
- package/src/react/components/DataTable/Pagination.tsx +1 -1
- package/src/react/components/DataTable/RowActions.tsx +55 -2
- package/src/react/components/DataTable/TableFilterBuilder.tsx +1 -1
- package/src/react/components/DataTable/cells/CodeCell.tsx +1 -1
- package/src/react/components/DataTable/cells/LinkCell.tsx +1 -1
- package/src/react/components/DataTable/index.ts +1 -0
- package/src/react/components/DataTable/numericColumn.spec.ts +19 -0
- package/src/react/components/DataTable/types.ts +36 -0
- package/src/react/components/DateTimeField.tsx +3 -1
- package/src/react/components/DeleteButton.tsx +3 -0
- package/src/react/components/Drawer.tsx +3 -3
- package/src/react/components/DropdownMenu.spec.tsx +55 -0
- package/src/react/components/DropdownMenu.tsx +73 -20
- package/src/react/components/EmptyState.tsx +26 -7
- package/src/react/components/EventTimeline.tsx +1 -1
- package/src/react/components/Field.spec.tsx +3 -2
- package/src/react/components/Field.tsx +7 -4
- package/src/react/components/Field.width.spec.tsx +14 -3
- package/src/react/components/FileDropZone.tsx +1 -1
- package/src/react/components/Grid.spec.tsx +44 -0
- package/src/react/components/Grid.tsx +41 -11
- package/src/react/components/Guide.tsx +77 -0
- package/src/react/components/InfoHint.spec.tsx +21 -0
- package/src/react/components/InfoHintImpl.tsx +22 -1
- package/src/react/components/InlineEditableText.tsx +1 -1
- package/src/react/components/IsolatedFrame.tsx +1 -1
- package/src/react/components/ListToolbar.spec.tsx +12 -0
- package/src/react/components/ListToolbar.tsx +8 -5
- package/src/react/components/LogViewer.tsx +118 -18
- package/src/react/components/Modal.spec.tsx +17 -2
- package/src/react/components/Modal.tsx +25 -10
- package/src/react/components/MultiSelectField.spec.tsx +6 -0
- package/src/react/components/Page.spec.tsx +89 -5
- package/src/react/components/Page.tsx +100 -16
- package/src/react/components/PageGuideButton.spec.tsx +39 -0
- package/src/react/components/PageGuideButton.tsx +110 -0
- package/src/react/components/PageGuidePopover.tsx +52 -0
- package/src/react/components/PanelSeparator.tsx +1 -1
- package/src/react/components/Popover.tsx +3 -1
- package/src/react/components/PromptDialog.tsx +1 -1
- package/src/react/components/ScrollArea.spec.tsx +20 -0
- package/src/react/components/ScrollArea.tsx +19 -0
- package/src/react/components/Section.spec.tsx +82 -1
- package/src/react/components/Section.tsx +10 -4
- package/src/react/components/Skeleton.tsx +50 -2
- package/src/react/components/StatStrip.tsx +1 -1
- package/src/react/components/StatTile.tsx +84 -11
- package/src/react/components/StatTileGrid.spec.tsx +6 -1
- package/src/react/components/StatTileGrid.tsx +25 -0
- package/src/react/components/StatusPill.tsx +26 -1
- package/src/react/components/Surface.tsx +22 -14
- package/src/react/components/SwatchPicker.tsx +4 -0
- package/src/react/components/Switch.tsx +1 -1
- package/src/react/components/TagsInput.spec.tsx +8 -0
- package/src/react/components/TagsInput.tsx +3 -1
- package/src/react/components/WidgetHeader.tsx +1 -1
- package/src/react/components/calendar/CalendarLegend.tsx +1 -1
- package/src/react/components/calendar/DayAgenda.tsx +1 -1
- package/src/react/components/calendar/EventChip.tsx +1 -1
- package/src/react/components/calendar/MonthGrid.tsx +1 -1
- package/src/react/components/calendar/WeekView.tsx +2 -2
- package/src/react/components/cardFrame.ts +28 -0
- package/src/react/components/dataDisplay.spec.tsx +176 -0
- package/src/react/components/dialog.tsx +4 -1
- package/src/react/components/entryChunks.graph.spec.ts +89 -0
- package/src/react/dashboard-grid/WidgetFrame.tsx +2 -2
- package/src/react/emoji/EmojiPicker.tsx +1 -1
- package/src/react/file-tree/FileTree.spec.tsx +49 -0
- package/src/react/file-tree/FileTree.tsx +37 -4
- package/src/react/filter-rail/FilterRail.tsx +1 -1
- package/src/react/folder-tree/FolderPicker.spec.tsx +8 -0
- package/src/react/folder-tree/FolderPicker.tsx +4 -1
- package/src/react/icons.spec.ts +21 -1
- package/src/react/icons.tsx +136 -2
- package/src/react/index.ts +38 -3
- package/src/react/lib/menuSections.ts +33 -0
- package/src/react/lib/whenIdle.ts +13 -0
- package/src/react/markdown/Markdown.tsx +2 -2
- package/src/react/media/DenseGalleryShell.tsx +20 -4
- package/src/react/media/HoverScrubVideoThumb.tsx +2 -2
- package/src/react/media/MaskPainter.tsx +1 -1
- package/src/react/media/MediaUploadControl.tsx +1 -1
- package/src/react/media/VideoTrimmer.tsx +1 -1
- package/src/react/media/denseGallery.css +96 -1
- package/src/react/media-gallery/MediaGallery.spec.tsx +26 -0
- package/src/react/media-gallery/MediaGallery.tsx +10 -3
- package/src/react/namespace/NamespaceTargetCapsule.tsx +1 -1
- package/src/react/nav/BreadcrumbTrail.tsx +2 -2
- package/src/react/nav/CommandBar.tsx +14 -3
- package/src/react/nav/PlaceBar.tsx +18 -8
- package/src/react/nav/SideNav.tsx +99 -17
- package/src/react/nav/TopBar.spec.tsx +78 -21
- package/src/react/nav/TopBar.tsx +270 -98
- package/src/react/nav/index.ts +8 -1
- package/src/react/nav/nav.spec.tsx +46 -2
- package/src/react/nav/navShared.tsx +23 -2
- package/src/react/notifications/NotificationFeed.tsx +2 -2
- package/src/react/palette/Command.tsx +1 -1
- package/src/react/palette/CommandPalette.spec.tsx +31 -0
- package/src/react/palette/CommandPalette.tsx +108 -11
- package/src/react/palette/commandSources.tsx +186 -0
- package/src/react/palette/index.ts +7 -0
- package/src/react/rich-text/RichTextEditor.tsx +1 -1
- package/src/react/rich-text/RichTextToolbar.tsx +1 -1
- package/src/styles-areas/analytics.css +16 -16
- package/src/styles-areas/auth.css +2 -2
- package/src/styles-areas/calendar.css +5 -6
- package/src/styles-areas/canvas-hud.css +30 -0
- package/src/styles-areas/chart-table.css +1 -1
- package/src/styles-areas/charts.css +3 -3
- package/src/styles-areas/chat.css +7 -6
- package/src/styles-areas/companion-link.css +2 -2
- package/src/styles-areas/core.css +99 -90
- package/src/styles-areas/dashboard-grid.css +4 -4
- package/src/styles-areas/data-table.css +16 -16
- package/src/styles-areas/disk-usage.css +5 -5
- package/src/styles-areas/emoji.css +2 -2
- package/src/styles-areas/fields.css +13 -14
- package/src/styles-areas/filter-rail.css +4 -4
- package/src/styles-areas/folder-tree.css +6 -6
- package/src/styles-areas/layout-engine.css +4 -4
- package/src/styles-areas/markdown.css +2 -1
- package/src/styles-areas/master-detail.css +3 -3
- package/src/styles-areas/media-gallery.css +7 -6
- package/src/styles-areas/media.css +12 -13
- package/src/styles-areas/nav.css +28 -14
- package/src/styles-areas/notifications.css +4 -4
- package/src/styles-areas/overlays.css +4 -4
- package/src/styles-areas/palette.css +5 -4
- package/src/styles-areas/rich-text.css +3 -3
- package/src/styles-areas/sharing.css +4 -3
- package/src/styles-areas/stats.css +9 -8
- package/src/styles-areas/test-report.css +4 -4
- package/src/styles-areas/wizard.css +6 -5
- package/src/styles-areas/workbench.css +10 -9
- package/src/styles-areas/workbook-viewer.css +2 -2
- package/src/styles-utilities.css +296 -190
- package/src/stylesAreas.spec.ts +17 -0
- package/src/testing/designAudit.ts +3 -0
- package/src/testing/designBaseline.ts +4 -0
- package/src/theme.css +103 -2
- package/src/themeDarkScopeAliases.spec.ts +65 -0
package/scripts/styleAreas.ts
CHANGED
|
@@ -169,6 +169,7 @@ export const AREAS: readonly Area[] = [
|
|
|
169
169
|
'components/Field.tsx',
|
|
170
170
|
'components/FieldLabel.tsx',
|
|
171
171
|
'components/Grid.tsx',
|
|
172
|
+
'components/Guide.tsx',
|
|
172
173
|
'components/HoverCard.tsx',
|
|
173
174
|
'components/IconButton.tsx',
|
|
174
175
|
'components/InfoHint.tsx',
|
|
@@ -178,6 +179,7 @@ export const AREAS: readonly Area[] = [
|
|
|
178
179
|
'components/Modal.tsx',
|
|
179
180
|
'components/OnlineDot.tsx',
|
|
180
181
|
'components/Page.tsx',
|
|
182
|
+
'components/PageGuidePopover.tsx',
|
|
181
183
|
'components/PanelSeparator.tsx',
|
|
182
184
|
'components/PathText.tsx',
|
|
183
185
|
'components/Popover.tsx',
|
|
@@ -219,6 +221,7 @@ export const AREAS: readonly Area[] = [
|
|
|
219
221
|
roots: ['components/auth', 'AuthGate.tsx'],
|
|
220
222
|
},
|
|
221
223
|
{ name: 'calendar', why: 'the date-picker family: a calendar grid is a whole layout nothing else shares', roots: ['components/calendar'] },
|
|
224
|
+
{ name: 'canvas-hud', why: 'the pan-and-zoom canvas HUD — zoom keys, minimap, find pill, node menu', roots: ['canvas-hud'] },
|
|
222
225
|
{ name: 'charts', why: 'the recharts wrappers — an app with no dashboard renders none of them', roots: ['charts'] },
|
|
223
226
|
{
|
|
224
227
|
name: 'chart-table',
|
|
@@ -273,7 +276,12 @@ export const AREAS: readonly Area[] = [
|
|
|
273
276
|
},
|
|
274
277
|
{ name: 'file-tree', why: 'the flat (non-nested) file list and its row chrome', roots: ['file-tree'] },
|
|
275
278
|
{ name: 'filter-rail', why: 'the faceted filter rail', roots: ['filter-rail'] },
|
|
276
|
-
{
|
|
279
|
+
{
|
|
280
|
+
name: 'folder-tree',
|
|
281
|
+
why: 'the nested folder tree',
|
|
282
|
+
// The breadcrumb's menus and pivot are `import()`ed by `nav/BreadcrumbTrail.tsx` (lazyImportFault).
|
|
283
|
+
roots: ['folder-tree', 'nav/BreadcrumbMenus.tsx', 'nav/BreadcrumbPivot.tsx'],
|
|
284
|
+
},
|
|
277
285
|
{ name: 'keep-awake', why: 'the keep-awake toggle and its badge', roots: ['keep-awake'] },
|
|
278
286
|
{ name: 'layout-engine', why: 'the persisted pane/grid layout engine — apps with a fixed layout render none of it', roots: ['layoutEngine'] },
|
|
279
287
|
{ name: 'markdown', why: 'the rendered-markdown document', roots: ['markdown', 'markdown/MarkdownDoc.tsx'] },
|
|
@@ -291,12 +299,33 @@ export const AREAS: readonly Area[] = [
|
|
|
291
299
|
// two entries up: the gallery reaches it through `lazyWithReload(() => import(…))`, and the
|
|
292
300
|
// closure walk reads static specifiers only — so a lazily-imported dialog is an orphan
|
|
293
301
|
// unless it is its own root. The coverage gate is what says so, by name, at build time.
|
|
294
|
-
|
|
302
|
+
// The viewers it opens are `import()`ed too, so they are named (lazyImportFault): a gallery
|
|
303
|
+
// app that does not import `media`, `pdf-viewer` or `workbook-viewer` still opens them styled.
|
|
304
|
+
roots: [
|
|
305
|
+
'media-gallery',
|
|
306
|
+
'media-gallery/MediaMetaEditor.tsx',
|
|
307
|
+
'components/Lightbox.tsx',
|
|
308
|
+
'markdown/MarkdownDoc.tsx',
|
|
309
|
+
'media/FrameGrabber.tsx',
|
|
310
|
+
'media/VideoChapterEditor.tsx',
|
|
311
|
+
'media/VideoCutEditor.tsx',
|
|
312
|
+
'media/VideoPlayer.tsx',
|
|
313
|
+
'pdf-viewer/PdfViewer.tsx',
|
|
314
|
+
'workbook-viewer/WorkbookViewer.tsx',
|
|
315
|
+
],
|
|
295
316
|
},
|
|
296
317
|
{
|
|
297
318
|
name: 'nav',
|
|
298
319
|
why: 'the AppShell chrome — the command palette, the nav rail, the place bar and the app menus',
|
|
299
|
-
|
|
320
|
+
// `palette/CommandPalette.tsx` is named for media-gallery's reason above: AppShell reaches its
|
|
321
|
+
// ⌘K palette through `import()` since forge task 2533, and the walk follows static imports only.
|
|
322
|
+
roots: [
|
|
323
|
+
'nav',
|
|
324
|
+
'nav/BreadcrumbMenus.tsx',
|
|
325
|
+
'nav/SideNavCustomize.tsx',
|
|
326
|
+
'components/AppShell.tsx',
|
|
327
|
+
'palette/CommandPalette.tsx',
|
|
328
|
+
],
|
|
300
329
|
},
|
|
301
330
|
{ name: 'notifications', why: 'the notification centre and its feed', roots: ['notifications'] },
|
|
302
331
|
{
|
|
@@ -311,7 +340,7 @@ export const AREAS: readonly Area[] = [
|
|
|
311
340
|
'components/AddItemsMenu.tsx',
|
|
312
341
|
],
|
|
313
342
|
},
|
|
314
|
-
{ name: 'palette', why: 'the
|
|
343
|
+
{ name: 'palette', why: 'the ⌘K command palette and its hotkey/source hooks', roots: ['palette'] },
|
|
315
344
|
{ name: 'pdf-viewer', why: 'the lazy PDF viewer (an optional peer already)', roots: ['pdf-viewer'] },
|
|
316
345
|
{ name: 'problem-detail', why: 'the RFC-7807 problem renderer', roots: ['problem-detail'] },
|
|
317
346
|
{ name: 'rich-text', why: 'the TipTap editor and its toolbar', roots: ['rich-text'] },
|
|
@@ -411,8 +440,8 @@ export const nonModuleFiles = (): string[] => {
|
|
|
411
440
|
};
|
|
412
441
|
|
|
413
442
|
/**
|
|
414
|
-
* Relative import specifiers in a module — `from '…'
|
|
415
|
-
* `
|
|
443
|
+
* Relative import specifiers in a module — `from '…'` and bare `import '…'`. NOT `import('…')`:
|
|
444
|
+
* a lazily-imported module is an orphan unless an area names it as a root (see `media-gallery`).
|
|
416
445
|
*
|
|
417
446
|
* A regex and not the TypeScript AST on purpose: this runs over 700 modules on
|
|
418
447
|
* every build, the only thing it has to understand is a string literal after a
|
|
@@ -536,6 +565,60 @@ export const coverageFault = (closures: Map<string, Set<string>>, areas: readonl
|
|
|
536
565
|
);
|
|
537
566
|
};
|
|
538
567
|
|
|
568
|
+
/** `import('./x')` specifiers — the edges the static walk above deliberately does not follow. */
|
|
569
|
+
const DYNAMIC_SPECIFIER = /\bimport\s*\(\s*['"](\.[^'"]*)['"]/g;
|
|
570
|
+
|
|
571
|
+
/** Module → the modules it `import()`s lazily, inside `src/react`. */
|
|
572
|
+
export const buildLazyGraph = async (): Promise<Map<string, string[]>> => {
|
|
573
|
+
const graph = new Map<string, string[]>();
|
|
574
|
+
await Promise.all(
|
|
575
|
+
allModules().map(async (file) => {
|
|
576
|
+
const out = new Set<string>();
|
|
577
|
+
for (const match of (await Bun.file(file).text()).matchAll(DYNAMIC_SPECIFIER)) {
|
|
578
|
+
const target = resolveRelative(file, match[1] as string);
|
|
579
|
+
if (target?.startsWith(`${REACT_DIR}/`) && !SPEC.test(target)) out.add(target);
|
|
580
|
+
}
|
|
581
|
+
if (out.size > 0) graph.set(file, [...out]);
|
|
582
|
+
}),
|
|
583
|
+
);
|
|
584
|
+
return graph;
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* 🔴 A module an area reaches LAZILY is styled by that area too (forge task 2533).
|
|
589
|
+
*
|
|
590
|
+
* The walk follows static imports only, so when a component moves a body behind `import()` —
|
|
591
|
+
* AppShell's ⌘K palette, to take it off every app's entry chunk — that body leaves the area's
|
|
592
|
+
* closure. `coverageFault` stays quiet as long as SOME area still reaches it, and the area that
|
|
593
|
+
* renders it regenerates without its utilities: an app that imports `nav` but not `palette`
|
|
594
|
+
* would open an unstyled palette. Every lazy target must be in the importing area's own closure,
|
|
595
|
+
* in `core`, or in an area it `needs` — usually by naming it as a root, as `media-gallery` does.
|
|
596
|
+
*/
|
|
597
|
+
export const lazyImportFault = (
|
|
598
|
+
closures: Map<string, Set<string>>,
|
|
599
|
+
lazyGraph: Map<string, string[]>,
|
|
600
|
+
areas: readonly Area[] = AREAS,
|
|
601
|
+
): string | null => {
|
|
602
|
+
const faults: string[] = [];
|
|
603
|
+
const rel = (f: string) => f.replace(`${REACT_DIR}/`, '');
|
|
604
|
+
for (const area of areas) {
|
|
605
|
+
const own = closures.get(area.name) ?? new Set<string>();
|
|
606
|
+
const styled = new Set(own);
|
|
607
|
+
for (const name of [CORE, ...transitiveNeeds(area.name, areas)]) for (const f of closures.get(name) ?? []) styled.add(f);
|
|
608
|
+
for (const file of own) {
|
|
609
|
+
for (const target of lazyGraph.get(file) ?? []) {
|
|
610
|
+
if (!styled.has(target)) faults.push(`${area.name}: ${rel(file)} → import('${rel(target)}')`);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (faults.length === 0) return null;
|
|
615
|
+
return (
|
|
616
|
+
`${faults.length} lazy import(s) leave their area, so the module they load is unstyled in an app that\n` +
|
|
617
|
+
"imports that area alone. Name each target in the area's `roots` in scripts/styleAreas.ts:\n " +
|
|
618
|
+
faults.sort().join('\n ')
|
|
619
|
+
);
|
|
620
|
+
};
|
|
621
|
+
|
|
539
622
|
/**
|
|
540
623
|
* 🔴 `needs` names areas that exist, never itself, and never a cycle.
|
|
541
624
|
*
|
|
@@ -38,12 +38,9 @@ const isDirectoryImport = (specifier: string): boolean => {
|
|
|
38
38
|
|
|
39
39
|
const SPECIFIER = /\bfrom\s*["']([^"'\n]+)["']|^\s*import\s*["']([^"'\n]+)["'];?\s*$/gm;
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return source && /\.tsx?$/.test(source) ? [[subpath, source.replace(/^\.\//, '')] as const] : [];
|
|
45
|
-
});
|
|
46
|
-
const outdir = `${process.env.TMPDIR ?? '/tmp'}/cursedbelt-bundler-only-${process.pid}`;
|
|
41
|
+
/** One `Bun.build` over `entries`: which of them import a stylesheet, and which reach a directory import. */
|
|
42
|
+
async function bundle(entries: readonly (readonly [string, string])[], pass: number): Promise<Record<Reason, string[]>> {
|
|
43
|
+
const outdir = `${process.env.TMPDIR ?? '/tmp'}/cursedbelt-bundler-only-${process.pid}-${pass}`;
|
|
47
44
|
try {
|
|
48
45
|
const result = await Bun.build({
|
|
49
46
|
entrypoints: entries.map(([, source]) => `${REPO}${source}`),
|
|
@@ -62,14 +59,34 @@ async function measure(): Promise<Record<Reason, string[]>> {
|
|
|
62
59
|
if (emitted.has(js.replace(/\.js$/, '.css')) || specifiers.some((s) => s.endsWith('.css'))) out.css.push(subpath);
|
|
63
60
|
if (specifiers.some((s) => !s.startsWith('.') && isDirectoryImport(s))) out.directoryImport.push(subpath);
|
|
64
61
|
}
|
|
65
|
-
out.css.sort();
|
|
66
|
-
out.directoryImport.sort();
|
|
67
62
|
return out;
|
|
68
63
|
} finally {
|
|
69
64
|
rmSync(outdir, { recursive: true, force: true });
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
|
|
68
|
+
async function measure(): Promise<Record<Reason, string[]>> {
|
|
69
|
+
const entries = Object.entries(pkg.exports as Record<string, unknown>).flatMap(([subpath, target]) => {
|
|
70
|
+
const source = (target as { source?: string }).source;
|
|
71
|
+
return source && /\.tsx?$/.test(source) ? [[subpath, source.replace(/^\.\//, '')] as const] : [];
|
|
72
|
+
});
|
|
73
|
+
const first = await bundle(entries, 0);
|
|
74
|
+
const css = new Set(first.css);
|
|
75
|
+
/*
|
|
76
|
+
* 🔴 One build emits a stylesheet that several entries import ONCE, beside the first of them
|
|
77
|
+
* (`canvas-hud` and `search-input` both import `searchInput.css`; only one got the sibling, so
|
|
78
|
+
* `search-input` read as stale — task 2401). So build again without the entries already
|
|
79
|
+
* counted, until a pass finds no new one: each pass hands a shared sheet to the next importer.
|
|
80
|
+
*/
|
|
81
|
+
for (let pass = 1; ; pass++) {
|
|
82
|
+
const rest = entries.filter(([subpath]) => !css.has(subpath));
|
|
83
|
+
const found = (await bundle(rest, pass)).css;
|
|
84
|
+
if (found.length === 0) break;
|
|
85
|
+
for (const subpath of found) css.add(subpath);
|
|
86
|
+
}
|
|
87
|
+
return { css: [...css].sort(), directoryImport: [...first.directoryImport].sort() };
|
|
88
|
+
}
|
|
89
|
+
|
|
73
90
|
describe('bundlerOnly', () => {
|
|
74
91
|
it('declares exactly the subpaths that import a stylesheet, and exactly those that reach a directory import', async () => {
|
|
75
92
|
const measured = await measure();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔴 A shipped source that imports `node:` declares its own Node types.
|
|
3
|
+
*
|
|
4
|
+
* `tsconfig.json` says `"types": []`, so the dist build (`tsconfig.build.json`) sees Node's
|
|
5
|
+
* types only through something that references them. On 2026-10-01 the one such file,
|
|
6
|
+
* `src/testing/designBaseline.ts`, was getting them from a STRAY `@types/papaparse` in the main
|
|
7
|
+
* checkout's `node_modules` — in no lockfile — so `bun run build` passed there and failed on a
|
|
8
|
+
* clean `bun install --frozen-lockfile` (a fresh worktree), which is where a publish should be
|
|
9
|
+
* able to run from. A string this can read in a millisecond, rather than a clean install.
|
|
10
|
+
*/
|
|
11
|
+
import { describe, expect, test } from 'bun:test'
|
|
12
|
+
import { readdirSync, readFileSync } from 'node:fs'
|
|
13
|
+
import { join } from 'node:path'
|
|
14
|
+
|
|
15
|
+
const SRC = import.meta.dir
|
|
16
|
+
const NODE_IMPORT = /\bfrom\s+['"]node:|\bimport\(\s*['"]node:/
|
|
17
|
+
const DECLARES = /^\/\/\/\s*<reference\s+types="(node|bun)"\s*\/>/m
|
|
18
|
+
|
|
19
|
+
/** The files `tsconfig.build.json` compiles: `src`, minus specs and the demo. */
|
|
20
|
+
export function builtSources(dir: string = SRC): string[] {
|
|
21
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
22
|
+
const path = join(dir, entry.name)
|
|
23
|
+
if (entry.isDirectory()) return entry.name === 'demo' ? [] : builtSources(path)
|
|
24
|
+
return /\.tsx?$/.test(entry.name) && !/\.spec\.tsx?$/.test(entry.name) ? [path] : []
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The built sources that import `node:` without saying where its types come from. */
|
|
29
|
+
export function undeclaredNodeImports(files: readonly { path: string; text: string }[]): string[] {
|
|
30
|
+
return files.filter(({ text }) => NODE_IMPORT.test(text) && !DECLARES.test(text)).map(({ path }) => path)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('a built source that imports node: names its types', () => {
|
|
34
|
+
test('every one in src does', () => {
|
|
35
|
+
const files = builtSources().map((path) => ({ path, text: readFileSync(path, 'utf8') }))
|
|
36
|
+
expect(undeclaredNodeImports(files)).toEqual([])
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('the check fails a file that relies on a transitive reference', () => {
|
|
40
|
+
expect(
|
|
41
|
+
undeclaredNodeImports([
|
|
42
|
+
{ path: 'bare.ts', text: "import { readFileSync } from 'node:fs'\n" },
|
|
43
|
+
{ path: 'named.ts', text: '/// <reference types="node" />\nimport { join } from "node:path"\n' },
|
|
44
|
+
]),
|
|
45
|
+
).toEqual(['bare.ts'])
|
|
46
|
+
})
|
|
47
|
+
})
|
package/src/react/Toast.spec.tsx
CHANGED
|
@@ -31,4 +31,47 @@ describe('Toast', () => {
|
|
|
31
31
|
expect(toaster.style.getPropertyValue('--normal-border')).toBe('var(--border)');
|
|
32
32
|
expect(toaster.style.getPropertyValue('--normal-text')).toBe('var(--popover-foreground)');
|
|
33
33
|
});
|
|
34
|
+
|
|
35
|
+
test('toast.error with no action warns (OVL-9); with a Retry it does not', () => {
|
|
36
|
+
const realWarn = console.warn;
|
|
37
|
+
const warnings: string[] = [];
|
|
38
|
+
console.warn = (message: string) => warnings.push(message);
|
|
39
|
+
try {
|
|
40
|
+
toast.error('Upload failed', { action: { label: 'Retry', onClick: () => {} } });
|
|
41
|
+
expect(warnings).toEqual([]);
|
|
42
|
+
toast.error('Upload failed');
|
|
43
|
+
expect(warnings).toHaveLength(1);
|
|
44
|
+
expect(warnings[0]).toContain('inline <Alert');
|
|
45
|
+
} finally {
|
|
46
|
+
console.warn = realWarn;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('toast.undo offers an Undo that runs the callback', async () => {
|
|
51
|
+
render(<Toaster />);
|
|
52
|
+
let undone = 0;
|
|
53
|
+
act(() => {
|
|
54
|
+
toast.undo('Moved to trash', () => undone++);
|
|
55
|
+
});
|
|
56
|
+
const undo = await waitFor(() => {
|
|
57
|
+
const button = Array.from(document.querySelectorAll('button')).find((b) => b.textContent === 'Undo');
|
|
58
|
+
if (!button) throw new Error('no Undo yet');
|
|
59
|
+
return button;
|
|
60
|
+
});
|
|
61
|
+
act(() => undo.click());
|
|
62
|
+
expect(undone).toBe(1);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('the stack rises above the shell\'s bottom chrome on a phone (OVL-9)', async () => {
|
|
66
|
+
render(<Toaster />);
|
|
67
|
+
act(() => {
|
|
68
|
+
toast('Saved');
|
|
69
|
+
});
|
|
70
|
+
const toaster = await waitFor(() => {
|
|
71
|
+
const found = document.querySelector<HTMLElement>('[data-sonner-toaster]');
|
|
72
|
+
if (!found) throw new Error('no toaster yet');
|
|
73
|
+
return found;
|
|
74
|
+
});
|
|
75
|
+
expect(toaster.getAttribute('style')).toContain('--cb-bottom-chrome-h');
|
|
76
|
+
});
|
|
34
77
|
});
|
package/src/react/Toast.tsx
CHANGED
|
@@ -11,9 +11,42 @@
|
|
|
11
11
|
* light/dark exactly like every other primitive (no sonner `richColors` — that
|
|
12
12
|
* would inject sonner's own hardcoded palette instead of our tokens).
|
|
13
13
|
*/
|
|
14
|
-
import { Toaster as SonnerToaster, toast } from 'sonner';
|
|
14
|
+
import { type ExternalToast, Toaster as SonnerToaster, toast as sonnerToast } from 'sonner';
|
|
15
|
+
import { devWarnOnce } from './lib/devWarn.js';
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
type ToastMessage = Parameters<typeof sonnerToast.error>[0];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* OVL-9: a toast confirms what happened ("Moved to trash") and offers Undo; it never carries an
|
|
21
|
+
* error the reader must act on — that is an inline `Alert` where the problem is, because a toast
|
|
22
|
+
* leaves in four seconds and takes the problem with it. An error toast is allowed only with an
|
|
23
|
+
* `action` (Retry, Undo), so the error is something the toast itself lets you resolve.
|
|
24
|
+
*/
|
|
25
|
+
function errorToast(message: ToastMessage, data?: ExternalToast) {
|
|
26
|
+
if (!data?.action) {
|
|
27
|
+
devWarnOnce(
|
|
28
|
+
'toast:error-without-action',
|
|
29
|
+
'cursedbelt: toast.error() with no `action` — an error the reader must act on belongs in an inline <Alert tone="error"> ' +
|
|
30
|
+
"where the problem is (OVL-9). Give the toast an action (Retry) if it can resolve it itself.",
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return sonnerToast.error(message, data);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* "Moved 3 files to trash" with an Undo — the shape OVL-9 asks every reversible action to take.
|
|
38
|
+
* `onUndo` runs when Undo is pressed; the toast stays for 6s, long enough to reach the button.
|
|
39
|
+
*/
|
|
40
|
+
function undoToast(message: ToastMessage, onUndo: () => void, data?: ExternalToast) {
|
|
41
|
+
return sonnerToast(message, { duration: 6000, ...data, action: { label: 'Undo', onClick: onUndo } });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** sonner's `toast`, with OVL-9's rules on `error` and an `undo` helper. */
|
|
45
|
+
export const toast: typeof sonnerToast & { undo: typeof undoToast } = Object.assign(
|
|
46
|
+
(...args: Parameters<typeof sonnerToast>) => sonnerToast(...args),
|
|
47
|
+
sonnerToast,
|
|
48
|
+
{ error: errorToast, undo: undoToast },
|
|
49
|
+
);
|
|
17
50
|
|
|
18
51
|
export type ToasterProps = React.ComponentProps<typeof SonnerToaster>;
|
|
19
52
|
|
|
@@ -31,11 +64,21 @@ const TOKEN_VARS = {
|
|
|
31
64
|
'--normal-text': 'var(--popover-foreground)',
|
|
32
65
|
} as React.CSSProperties;
|
|
33
66
|
|
|
67
|
+
/**
|
|
68
|
+
* OVL-9: on a phone the stack sits ABOVE the `PlaceBar` (and any bottom dock), not on top of
|
|
69
|
+
* the navigation. `AppShell` publishes its bottom chrome's height as `--cb-bottom-chrome-h`;
|
|
70
|
+
* outside a shell it is 0 and this is sonner's own gap.
|
|
71
|
+
*/
|
|
72
|
+
const BOTTOM_OFFSET = { bottom: 'calc(var(--cb-bottom-chrome-h, 0px) + 16px)', right: '16px' };
|
|
73
|
+
const DESKTOP_OFFSET = { bottom: 'calc(var(--cb-bottom-chrome-h, 0px) + 24px)', right: '24px' };
|
|
74
|
+
|
|
34
75
|
export function Toaster({ style, ...props }: ToasterProps) {
|
|
35
76
|
return (
|
|
36
77
|
<SonnerToaster
|
|
37
78
|
style={{ ...TOKEN_VARS, ...style }}
|
|
38
79
|
position='bottom-right'
|
|
80
|
+
offset={DESKTOP_OFFSET}
|
|
81
|
+
mobileOffset={BOTTOM_OFFSET}
|
|
39
82
|
closeButton
|
|
40
83
|
toastOptions={{
|
|
41
84
|
classNames: {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { cn } from '../lib/cn.js';
|
|
3
|
+
import { type CanvasBounds, type CanvasSize, type CanvasView, visibleBounds } from './viewport.js';
|
|
4
|
+
|
|
5
|
+
export interface CanvasMinimapProps {
|
|
6
|
+
/** The content's extent in WORLD units — what the thumbnail shows. */
|
|
7
|
+
bounds: CanvasBounds;
|
|
8
|
+
view: CanvasView;
|
|
9
|
+
/** The canvas viewport in screen pixels, for the visible window. */
|
|
10
|
+
viewport: CanvasSize;
|
|
11
|
+
/** A click on the thumbnail, in WORLD units — the canvas centres there. */
|
|
12
|
+
onJump?: (point: { x: number; y: number }) => void;
|
|
13
|
+
/** The thumbnail's longest side in pixels. Default 168. */
|
|
14
|
+
size?: number;
|
|
15
|
+
/** Drawn inside the SVG in WORLD units, under the window: dots, zones, edges. */
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
/** A one-line caption under the map. Default "Tap to jump" when `onJump` is set. */
|
|
18
|
+
hint?: ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* CNV-3's minimap — the whole content as a low-opacity thumbnail with the visible window drawn
|
|
24
|
+
* on it. What a canvas draws on it (a dot per node, a heat zone per cluster) is `children` in its
|
|
25
|
+
* own world coordinates; the frame, the scaling and the window are this component's.
|
|
26
|
+
*
|
|
27
|
+
* The SVG is `aria-hidden`: the jump is a pointer shortcut over content that is already
|
|
28
|
+
* reachable by keyboard on the canvas itself, and a parallel interface over unlabeled dots would
|
|
29
|
+
* be a second, worse way to do what Tab already does (family's reasoning, kept).
|
|
30
|
+
*/
|
|
31
|
+
export function CanvasMinimap({
|
|
32
|
+
bounds,
|
|
33
|
+
view,
|
|
34
|
+
viewport,
|
|
35
|
+
onJump,
|
|
36
|
+
size = 168,
|
|
37
|
+
children,
|
|
38
|
+
hint,
|
|
39
|
+
className,
|
|
40
|
+
}: CanvasMinimapProps) {
|
|
41
|
+
if (bounds.width <= 0 || bounds.height <= 0 || viewport.width <= 0 || view.scale <= 0) return null;
|
|
42
|
+
const ratio = Math.min(size / bounds.width, (size * 0.62) / bounds.height);
|
|
43
|
+
const width = Math.max(1, bounds.width * ratio);
|
|
44
|
+
const height = Math.max(1, bounds.height * ratio);
|
|
45
|
+
const seen = visibleBounds(view, viewport);
|
|
46
|
+
const jump = (event: MouseEvent<SVGSVGElement>) => {
|
|
47
|
+
if (!onJump) return;
|
|
48
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
49
|
+
onJump({
|
|
50
|
+
x: bounds.x + (event.clientX - rect.left) / ratio,
|
|
51
|
+
y: bounds.y + (event.clientY - rect.top) / ratio,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const caption = hint === undefined ? (onJump ? 'Tap to jump' : null) : hint;
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
data-testid='canvas-minimap'
|
|
58
|
+
className={cn(
|
|
59
|
+
'pointer-events-auto flex flex-col items-center gap-1 rounded-lg border border-border/60 bg-background/70 p-2 shadow-raised backdrop-blur-md',
|
|
60
|
+
className,
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
<svg
|
|
64
|
+
width={width}
|
|
65
|
+
height={height}
|
|
66
|
+
viewBox={`${bounds.x} ${bounds.y} ${bounds.width} ${bounds.height}`}
|
|
67
|
+
onClick={jump}
|
|
68
|
+
aria-hidden='true'
|
|
69
|
+
className={cn('overflow-hidden', onJump && 'cursor-pointer')}
|
|
70
|
+
>
|
|
71
|
+
{children}
|
|
72
|
+
<rect
|
|
73
|
+
data-testid='canvas-minimap-window'
|
|
74
|
+
x={seen.x}
|
|
75
|
+
y={seen.y}
|
|
76
|
+
width={seen.width}
|
|
77
|
+
height={seen.height}
|
|
78
|
+
fill='var(--accent)'
|
|
79
|
+
fillOpacity={0.12}
|
|
80
|
+
stroke='var(--accent)'
|
|
81
|
+
strokeWidth={1.5 / ratio}
|
|
82
|
+
rx={3 / ratio}
|
|
83
|
+
/>
|
|
84
|
+
</svg>
|
|
85
|
+
{caption ? <span className='text-caption text-muted-foreground'>{caption}</span> : null}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { PointerEvent, ReactNode } from 'react';
|
|
2
|
+
import { Button } from '../components/Button.js';
|
|
3
|
+
import { Popover } from '../components/Popover.js';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
|
|
6
|
+
export interface CanvasNodeMenuItem {
|
|
7
|
+
label: string;
|
|
8
|
+
onSelect: () => void;
|
|
9
|
+
/** Drawn disabled. The section's `note` is where the reason goes. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
destructive?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface CanvasNodeMenuSection {
|
|
15
|
+
heading?: string;
|
|
16
|
+
items: CanvasNodeMenuItem[];
|
|
17
|
+
/** One quiet line under the rows: what they change, or why they cannot. */
|
|
18
|
+
note?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CanvasNodeMenuProps {
|
|
22
|
+
trigger: ReactNode;
|
|
23
|
+
open: boolean;
|
|
24
|
+
onOpenChange: (open: boolean) => void;
|
|
25
|
+
sections: CanvasNodeMenuSection[];
|
|
26
|
+
align?: 'start' | 'center' | 'end';
|
|
27
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A node's menu on a canvas — a `Popover`, deliberately not a `DropdownMenu`.
|
|
33
|
+
*
|
|
34
|
+
* A menu takes the arrow keys for its own rows; on a canvas they belong to the CANVAS, which
|
|
35
|
+
* moves its cursor to the next node and closes this (family's branch menu, the owner's ask of
|
|
36
|
+
* 2026-09-24: *"I want it to disappear if I click off of it or use arrows to move to another
|
|
37
|
+
* person"*). So the rows are Tab-reachable buttons, the keys bubble, and an outside press or
|
|
38
|
+
* Escape closes it. Pointer-downs stop here so pressing a row never starts a pan.
|
|
39
|
+
*/
|
|
40
|
+
export function CanvasNodeMenu({
|
|
41
|
+
trigger,
|
|
42
|
+
open,
|
|
43
|
+
onOpenChange,
|
|
44
|
+
sections,
|
|
45
|
+
align = 'start',
|
|
46
|
+
side = 'bottom',
|
|
47
|
+
className,
|
|
48
|
+
}: CanvasNodeMenuProps) {
|
|
49
|
+
const stop = (event: PointerEvent) => event.stopPropagation();
|
|
50
|
+
return (
|
|
51
|
+
<Popover
|
|
52
|
+
open={open}
|
|
53
|
+
onOpenChange={onOpenChange}
|
|
54
|
+
align={align}
|
|
55
|
+
side={side}
|
|
56
|
+
className={cn('w-64 p-1', className)}
|
|
57
|
+
trigger={trigger}
|
|
58
|
+
>
|
|
59
|
+
<div role='menu' onPointerDown={stop} className='flex flex-col'>
|
|
60
|
+
{sections.map((section, sectionIndex) => (
|
|
61
|
+
<div
|
|
62
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: sections are a static list in the caller's order
|
|
63
|
+
key={sectionIndex}
|
|
64
|
+
className={cn('flex flex-col py-1', sectionIndex > 0 && 'border-t border-border')}
|
|
65
|
+
>
|
|
66
|
+
{section.heading ? <p className='cb-meta-label px-2 pt-1 pb-1.5'>{section.heading}</p> : null}
|
|
67
|
+
{section.items.map((item) => (
|
|
68
|
+
<Button
|
|
69
|
+
key={item.label}
|
|
70
|
+
role='menuitem'
|
|
71
|
+
variant={item.destructive ? 'destructive' : 'ghost'}
|
|
72
|
+
size='sm'
|
|
73
|
+
tooltip={item.label}
|
|
74
|
+
tooltipMobile='off'
|
|
75
|
+
disabled={item.disabled}
|
|
76
|
+
className='w-full justify-start'
|
|
77
|
+
onClick={(event) => {
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
item.onSelect();
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{item.label}
|
|
83
|
+
</Button>
|
|
84
|
+
))}
|
|
85
|
+
{section.note ? <p className='px-2 pt-1 text-caption text-muted-foreground'>{section.note}</p> : null}
|
|
86
|
+
</div>
|
|
87
|
+
))}
|
|
88
|
+
</div>
|
|
89
|
+
</Popover>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { KeyboardEvent } from 'react';
|
|
2
|
+
import { HudPill } from '../components/HudPill.js';
|
|
3
|
+
import { Input } from '../components/Input.js';
|
|
4
|
+
import { IconSearch } from '../icons.js';
|
|
5
|
+
import { cn } from '../lib/cn.js';
|
|
6
|
+
import { HudButton } from './HudControls.js';
|
|
7
|
+
|
|
8
|
+
export interface CanvasSearchFieldProps {
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
/** Step to the next (1) or previous (-1) match — Enter and Shift+Enter, and the ‹ › keys. */
|
|
12
|
+
onStep?: (delta: 1 | -1) => void;
|
|
13
|
+
/** How many matches the query has, and which one is current (0-based). */
|
|
14
|
+
matches?: number;
|
|
15
|
+
index?: number;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The find box that floats over a canvas, and the one that does not steal the canvas's keys.
|
|
23
|
+
*
|
|
24
|
+
* 🔴 A canvas binds the arrow keys on an ancestor of this field. Without stopping them here,
|
|
25
|
+
* typing a name and pressing ← to fix a typo walked the reader to a cousin instead of moving
|
|
26
|
+
* the caret (family, 2026-09). Every key stops at the field; Enter and Shift+Enter step through
|
|
27
|
+
* the matches, the convention of every find-in-page; Escape empties the box rather than blurring.
|
|
28
|
+
*
|
|
29
|
+
* It is the belt's `Input` drawn borderless, so the pill around it is the field — and NOT
|
|
30
|
+
* `SearchInput`: a find box over a canvas matches names, never wildcards or regexes, and the
|
|
31
|
+
* syntax parser and its badge were 5.6 kB gzip on family's first paint for nothing (task 2401).
|
|
32
|
+
* A ✕ empties it too, because a phone has no Escape key.
|
|
33
|
+
*/
|
|
34
|
+
export function CanvasSearchField({
|
|
35
|
+
value,
|
|
36
|
+
onChange,
|
|
37
|
+
onStep,
|
|
38
|
+
matches = 0,
|
|
39
|
+
index = 0,
|
|
40
|
+
placeholder = 'Find…',
|
|
41
|
+
'aria-label': ariaLabel,
|
|
42
|
+
className,
|
|
43
|
+
}: CanvasSearchFieldProps) {
|
|
44
|
+
const searching = value.trim().length > 0;
|
|
45
|
+
const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
|
|
46
|
+
if (event.key === 'Enter' && onStep) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
onStep(event.shiftKey ? -1 : 1);
|
|
49
|
+
}
|
|
50
|
+
if (event.key === 'Escape' && value !== '') {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
onChange('');
|
|
53
|
+
}
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
};
|
|
56
|
+
return (
|
|
57
|
+
<HudPill className={cn('gap-0.5 rounded-lg py-0.5 pr-1 pl-0', className)}>
|
|
58
|
+
<IconSearch size={16} className='ml-2 shrink-0 text-muted-foreground' />
|
|
59
|
+
<Input
|
|
60
|
+
type='search'
|
|
61
|
+
size='sm'
|
|
62
|
+
value={value}
|
|
63
|
+
onChange={(event) => onChange(event.target.value)}
|
|
64
|
+
placeholder={placeholder}
|
|
65
|
+
aria-label={ariaLabel ?? placeholder}
|
|
66
|
+
onKeyDown={onKeyDown}
|
|
67
|
+
className='w-40 border-transparent bg-transparent pl-1 shadow-none focus-visible:border-transparent focus-visible:ring-0 [&::-webkit-search-cancel-button]:hidden'
|
|
68
|
+
/>
|
|
69
|
+
{searching ? (
|
|
70
|
+
<span className='min-w-10 text-center text-xs text-muted-foreground tabular-nums' aria-live='polite'>
|
|
71
|
+
{matches === 0 ? 'none' : `${index + 1}/${matches}`}
|
|
72
|
+
</span>
|
|
73
|
+
) : null}
|
|
74
|
+
{onStep && matches > 1 ? (
|
|
75
|
+
<>
|
|
76
|
+
<HudButton label='Previous match — Shift+Enter' onClick={() => onStep(-1)}>
|
|
77
|
+
<span aria-hidden>‹</span>
|
|
78
|
+
</HudButton>
|
|
79
|
+
<HudButton label='Next match — Enter' onClick={() => onStep(1)}>
|
|
80
|
+
<span aria-hidden>›</span>
|
|
81
|
+
</HudButton>
|
|
82
|
+
</>
|
|
83
|
+
) : null}
|
|
84
|
+
{searching ? (
|
|
85
|
+
<HudButton label='Clear the search — Escape' onClick={() => onChange('')}>
|
|
86
|
+
<span aria-hidden>×</span>
|
|
87
|
+
</HudButton>
|
|
88
|
+
) : null}
|
|
89
|
+
</HudPill>
|
|
90
|
+
);
|
|
91
|
+
}
|