@shavin/ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/LICENSE +21 -0
- package/README.md +81 -2
- package/components.json +15771 -0
- package/dist/authoring/types.js +0 -0
- package/dist/icons.d.ts +20 -0
- package/dist/icons.js +6 -0
- package/dist/index.d.ts +3325 -0
- package/dist/index.js +531 -0
- package/dist/inspector/FindingPopover.js +252 -0
- package/dist/inspector/Highlight.js +76 -0
- package/dist/inspector/Inspector.js +420 -0
- package/dist/inspector/InspectorRoot.js +75 -0
- package/dist/inspector/IssuesLayer.js +134 -0
- package/dist/inspector/IssuesList.js +174 -0
- package/dist/inspector/SettingsPanel.js +89 -0
- package/dist/inspector/ShavinMark.js +22 -0
- package/dist/inspector/Toolbar.js +202 -0
- package/dist/inspector/barPlacement.js +117 -0
- package/dist/inspector/env.js +59 -0
- package/dist/inspector/geometry.js +44 -0
- package/dist/inspector/ignored.js +52 -0
- package/dist/inspector/index.js +7 -0
- package/dist/inspector/journalClient.js +57 -0
- package/dist/inspector/journalState.js +36 -0
- package/dist/inspector/pin.js +43 -0
- package/dist/inspector/placement.js +96 -0
- package/dist/inspector/prompt.js +63 -0
- package/dist/inspector/scheme.js +56 -0
- package/dist/inspector/settings.js +54 -0
- package/dist/inspector/strings.js +67 -0
- package/dist/inspector/targets.js +31 -0
- package/dist/inspector/theme/ThemeControls.js +351 -0
- package/dist/inspector/theme/ThemePanel.js +32 -0
- package/dist/inspector/theme/useThemeController.js +560 -0
- package/dist/inspector/usePhone.js +32 -0
- package/dist/inspector/useSelectTool.js +82 -0
- package/dist/inspector/useTimeouts.js +22 -0
- package/dist/inspector/useTrackedRect.js +39 -0
- package/dist/lib/announce.js +47 -0
- package/dist/lib/bridge.js +43 -0
- package/dist/lib/buttonState.js +81 -0
- package/dist/lib/chart-kit.js +226 -0
- package/dist/lib/cn.js +8 -0
- package/dist/lib/color-space.js +315 -0
- package/dist/lib/concentric.js +85 -0
- package/dist/lib/hit-area.js +25 -0
- package/dist/lib/inspector/collect.js +299 -0
- package/dist/lib/inspector/color.js +58 -0
- package/dist/lib/inspector/console-capture.js +96 -0
- package/dist/lib/inspector/index.js +8 -0
- package/dist/lib/inspector/rules.js +232 -0
- package/dist/lib/inspector/run.js +35 -0
- package/dist/lib/inspector/schema.js +110 -0
- package/dist/lib/inspector/selector.js +103 -0
- package/dist/lib/inspector/tokens.js +34 -0
- package/dist/lib/media-overlay-presets.js +284 -0
- package/dist/lib/media-overlays.js +381 -0
- package/dist/lib/meta.js +70 -0
- package/dist/lib/motion-gsap.js +25 -0
- package/dist/lib/motion-runtime.js +283 -0
- package/dist/lib/neutral-tint.js +108 -0
- package/dist/lib/portal-container.js +12 -0
- package/dist/lib/scroll-edges.js +41 -0
- package/dist/lib/surface.js +6 -0
- package/dist/lib/syntax.js +115 -0
- package/dist/lib/theme-presets.d.ts +1 -0
- package/dist/lib/theme-presets.js +759 -0
- package/dist/lib/useClientLocale.js +11 -0
- package/dist/lib/useFieldErrorAnnouncement.js +15 -0
- package/dist/lib/useReducedMotion.js +17 -0
- package/dist/lib/useResizable.js +313 -0
- package/dist/lib/useReturnFocus.js +24 -0
- package/dist/lib/useSlidingIndicator.js +56 -0
- package/dist/panels.d.ts +37 -0
- package/dist/panels.js +19 -0
- package/dist/primitives/Accordion/Accordion.doc.js +37 -0
- package/dist/primitives/Accordion/Accordion.js +87 -0
- package/dist/primitives/Accordion/index.js +2 -0
- package/dist/primitives/ActionBar/ActionBar.doc.js +37 -0
- package/dist/primitives/ActionBar/ActionBar.js +126 -0
- package/dist/primitives/ActionBar/index.js +2 -0
- package/dist/primitives/AlertDialog/AlertDialog.doc.js +54 -0
- package/dist/primitives/AlertDialog/AlertDialog.js +113 -0
- package/dist/primitives/AlertDialog/index.js +2 -0
- package/dist/primitives/AppShell/AppShell.doc.js +81 -0
- package/dist/primitives/AppShell/AppShell.js +178 -0
- package/dist/primitives/AppShell/frame-context.js +10 -0
- package/dist/primitives/AppShell/index.js +2 -0
- package/dist/primitives/AspectRatio/AspectRatio.doc.js +34 -0
- package/dist/primitives/AspectRatio/AspectRatio.js +5 -0
- package/dist/primitives/AspectRatio/index.js +2 -0
- package/dist/primitives/Avatar/Avatar.doc.js +40 -0
- package/dist/primitives/Avatar/Avatar.js +62 -0
- package/dist/primitives/Avatar/index.js +2 -0
- package/dist/primitives/Backdrop/Backdrop.doc.js +24 -0
- package/dist/primitives/Backdrop/Backdrop.js +42 -0
- package/dist/primitives/Backdrop/index.js +2 -0
- package/dist/primitives/Badge/Badge.doc.js +35 -0
- package/dist/primitives/Badge/Badge.js +95 -0
- package/dist/primitives/Badge/index.js +2 -0
- package/dist/primitives/BarChart/BarChart.doc.js +59 -0
- package/dist/primitives/BarChart/BarChart.js +154 -0
- package/dist/primitives/BarChart/index.js +2 -0
- package/dist/primitives/BlockPreview/BlockPreview.doc.js +51 -0
- package/dist/primitives/BlockPreview/BlockPreview.js +485 -0
- package/dist/primitives/BlockPreview/index.js +8 -0
- package/dist/primitives/Blockquote/Blockquote.doc.js +25 -0
- package/dist/primitives/Blockquote/Blockquote.js +19 -0
- package/dist/primitives/Blockquote/index.js +2 -0
- package/dist/primitives/BottomNav/BottomNav.doc.js +37 -0
- package/dist/primitives/BottomNav/BottomNav.js +54 -0
- package/dist/primitives/BottomNav/index.js +2 -0
- package/dist/primitives/Box/Box.doc.js +45 -0
- package/dist/primitives/Box/Box.js +51 -0
- package/dist/primitives/Box/index.js +2 -0
- package/dist/primitives/Breadcrumbs/Breadcrumbs.doc.js +35 -0
- package/dist/primitives/Breadcrumbs/Breadcrumbs.js +40 -0
- package/dist/primitives/Breadcrumbs/index.js +2 -0
- package/dist/primitives/Button/Button.doc.js +80 -0
- package/dist/primitives/Button/Button.js +132 -0
- package/dist/primitives/Button/index.js +2 -0
- package/dist/primitives/Calendar/Calendar.doc.js +36 -0
- package/dist/primitives/Calendar/Calendar.js +502 -0
- package/dist/primitives/Calendar/index.js +2 -0
- package/dist/primitives/Callout/Callout.doc.js +34 -0
- package/dist/primitives/Callout/Callout.js +63 -0
- package/dist/primitives/Callout/index.js +2 -0
- package/dist/primitives/Card/Card.doc.js +46 -0
- package/dist/primitives/Card/Card.js +159 -0
- package/dist/primitives/Card/index.js +2 -0
- package/dist/primitives/Carousel/Carousel.doc.js +61 -0
- package/dist/primitives/Carousel/Carousel.js +369 -0
- package/dist/primitives/Carousel/index.js +1 -0
- package/dist/primitives/ChatBubble/ChatBubble.doc.js +37 -0
- package/dist/primitives/ChatBubble/ChatBubble.js +120 -0
- package/dist/primitives/ChatBubble/index.js +2 -0
- package/dist/primitives/Checkbox/Checkbox.doc.js +36 -0
- package/dist/primitives/Checkbox/Checkbox.js +57 -0
- package/dist/primitives/Checkbox/index.js +2 -0
- package/dist/primitives/CheckboxCards/CheckboxCards.doc.js +35 -0
- package/dist/primitives/CheckboxCards/CheckboxCards.js +47 -0
- package/dist/primitives/CheckboxCards/index.js +2 -0
- package/dist/primitives/CheckboxGroup/CheckboxGroup.doc.js +35 -0
- package/dist/primitives/CheckboxGroup/CheckboxGroup.js +40 -0
- package/dist/primitives/CheckboxGroup/index.js +2 -0
- package/dist/primitives/Code/Code.doc.js +22 -0
- package/dist/primitives/Code/Code.js +17 -0
- package/dist/primitives/Code/index.js +2 -0
- package/dist/primitives/CodeBlock/CodeBlock.doc.js +36 -0
- package/dist/primitives/CodeBlock/CodeBlock.js +205 -0
- package/dist/primitives/CodeBlock/index.js +2 -0
- package/dist/primitives/CodeEditor/CodeEditor.doc.js +53 -0
- package/dist/primitives/CodeEditor/CodeEditor.js +204 -0
- package/dist/primitives/CodeEditor/index.js +4 -0
- package/dist/primitives/ColorPicker/ColorPicker.doc.js +37 -0
- package/dist/primitives/ColorPicker/ColorPicker.js +776 -0
- package/dist/primitives/ColorPicker/index.js +2 -0
- package/dist/primitives/Combobox/Combobox.doc.js +36 -0
- package/dist/primitives/Combobox/Combobox.js +199 -0
- package/dist/primitives/Combobox/index.js +2 -0
- package/dist/primitives/Container/Container.doc.js +46 -0
- package/dist/primitives/Container/Container.js +54 -0
- package/dist/primitives/Container/index.js +2 -0
- package/dist/primitives/ContextMenu/ContextMenu.doc.js +36 -0
- package/dist/primitives/ContextMenu/ContextMenu.js +59 -0
- package/dist/primitives/ContextMenu/index.js +2 -0
- package/dist/primitives/DataList/DataList.doc.js +34 -0
- package/dist/primitives/DataList/DataList.js +35 -0
- package/dist/primitives/DataList/index.js +2 -0
- package/dist/primitives/DatePicker/DatePicker.doc.js +36 -0
- package/dist/primitives/DatePicker/DatePicker.js +398 -0
- package/dist/primitives/DatePicker/index.js +2 -0
- package/dist/primitives/Dialog/Dialog.doc.js +107 -0
- package/dist/primitives/Dialog/Dialog.js +143 -0
- package/dist/primitives/Dialog/index.js +2 -0
- package/dist/primitives/DonutChart/DonutChart.doc.js +26 -0
- package/dist/primitives/DonutChart/DonutChart.js +71 -0
- package/dist/primitives/DonutChart/index.js +2 -0
- package/dist/primitives/Drawer/Drawer.doc.js +44 -0
- package/dist/primitives/Drawer/Drawer.js +158 -0
- package/dist/primitives/Drawer/index.js +2 -0
- package/dist/primitives/Dropdown/Dropdown.doc.js +40 -0
- package/dist/primitives/Dropdown/Dropdown.js +146 -0
- package/dist/primitives/Dropdown/index.js +2 -0
- package/dist/primitives/Emphasis/Emphasis.doc.js +28 -0
- package/dist/primitives/Emphasis/Emphasis.js +25 -0
- package/dist/primitives/Emphasis/index.js +2 -0
- package/dist/primitives/EmptyState/EmptyState.doc.js +76 -0
- package/dist/primitives/EmptyState/EmptyState.js +118 -0
- package/dist/primitives/EmptyState/index.js +2 -0
- package/dist/primitives/FileOutput/FileOutput.doc.js +26 -0
- package/dist/primitives/FileOutput/FileOutput.js +55 -0
- package/dist/primitives/FileOutput/index.js +2 -0
- package/dist/primitives/Flex/Flex.doc.js +58 -0
- package/dist/primitives/Flex/Flex.js +98 -0
- package/dist/primitives/Flex/index.js +2 -0
- package/dist/primitives/FormErrorSummary/FormErrorSummary.doc.js +39 -0
- package/dist/primitives/FormErrorSummary/FormErrorSummary.js +61 -0
- package/dist/primitives/FormErrorSummary/index.js +2 -0
- package/dist/primitives/FormField/FormField.doc.js +68 -0
- package/dist/primitives/FormField/FormField.js +149 -0
- package/dist/primitives/FormField/index.js +2 -0
- package/dist/primitives/FunnelChart/FunnelChart.doc.js +45 -0
- package/dist/primitives/FunnelChart/FunnelChart.js +54 -0
- package/dist/primitives/FunnelChart/index.js +2 -0
- package/dist/primitives/Grid/Grid.doc.js +57 -0
- package/dist/primitives/Grid/Grid.js +122 -0
- package/dist/primitives/Grid/index.js +2 -0
- package/dist/primitives/Heading/Heading.doc.js +46 -0
- package/dist/primitives/Heading/Heading.js +80 -0
- package/dist/primitives/Heading/index.js +2 -0
- package/dist/primitives/Heatmap/Heatmap.doc.js +49 -0
- package/dist/primitives/Heatmap/Heatmap.js +42 -0
- package/dist/primitives/Heatmap/index.js +2 -0
- package/dist/primitives/HoverCard/HoverCard.doc.js +36 -0
- package/dist/primitives/HoverCard/HoverCard.js +39 -0
- package/dist/primitives/HoverCard/index.js +2 -0
- package/dist/primitives/Icon/Icon.doc.js +49 -0
- package/dist/primitives/Icon/Icon.js +214 -0
- package/dist/primitives/Icon/buckets/lucide-a.js +214 -0
- package/dist/primitives/Icon/buckets/lucide-b.js +298 -0
- package/dist/primitives/Icon/buckets/lucide-c.js +524 -0
- package/dist/primitives/Icon/buckets/lucide-d.js +110 -0
- package/dist/primitives/Icon/buckets/lucide-e.js +50 -0
- package/dist/primitives/Icon/buckets/lucide-f.js +264 -0
- package/dist/primitives/Icon/buckets/lucide-g.js +108 -0
- package/dist/primitives/Icon/buckets/lucide-h.js +112 -0
- package/dist/primitives/Icon/buckets/lucide-i.js +46 -0
- package/dist/primitives/Icon/buckets/lucide-j.js +6 -0
- package/dist/primitives/Icon/buckets/lucide-k.js +18 -0
- package/dist/primitives/Icon/buckets/lucide-l.js +162 -0
- package/dist/primitives/Icon/buckets/lucide-m.js +266 -0
- package/dist/primitives/Icon/buckets/lucide-n.js +34 -0
- package/dist/primitives/Icon/buckets/lucide-o.js +20 -0
- package/dist/primitives/Icon/buckets/lucide-p.js +216 -0
- package/dist/primitives/Icon/buckets/lucide-q.js +6 -0
- package/dist/primitives/Icon/buckets/lucide-r.js +140 -0
- package/dist/primitives/Icon/buckets/lucide-s.js +490 -0
- package/dist/primitives/Icon/buckets/lucide-t.js +204 -0
- package/dist/primitives/Icon/buckets/lucide-u.js +84 -0
- package/dist/primitives/Icon/buckets/lucide-v.js +46 -0
- package/dist/primitives/Icon/buckets/lucide-w.js +82 -0
- package/dist/primitives/Icon/buckets/lucide-x.js +6 -0
- package/dist/primitives/Icon/buckets/lucide-z.js +36 -0
- package/dist/primitives/Icon/buckets/phosphor-a.js +250 -0
- package/dist/primitives/Icon/buckets/phosphor-b.js +158 -0
- package/dist/primitives/Icon/buckets/phosphor-c.js +320 -0
- package/dist/primitives/Icon/buckets/phosphor-d.js +90 -0
- package/dist/primitives/Icon/buckets/phosphor-e.js +52 -0
- package/dist/primitives/Icon/buckets/phosphor-f.js +162 -0
- package/dist/primitives/Icon/buckets/phosphor-g.js +92 -0
- package/dist/primitives/Icon/buckets/phosphor-h.js +88 -0
- package/dist/primitives/Icon/buckets/phosphor-i.js +26 -0
- package/dist/primitives/Icon/buckets/phosphor-j.js +8 -0
- package/dist/primitives/Icon/buckets/phosphor-k.js +8 -0
- package/dist/primitives/Icon/buckets/phosphor-l.js +84 -0
- package/dist/primitives/Icon/buckets/phosphor-m.js +110 -0
- package/dist/primitives/Icon/buckets/phosphor-n.js +100 -0
- package/dist/primitives/Icon/buckets/phosphor-o.js +14 -0
- package/dist/primitives/Icon/buckets/phosphor-p.js +166 -0
- package/dist/primitives/Icon/buckets/phosphor-q.js +10 -0
- package/dist/primitives/Icon/buckets/phosphor-r.js +46 -0
- package/dist/primitives/Icon/buckets/phosphor-s.js +254 -0
- package/dist/primitives/Icon/buckets/phosphor-t.js +152 -0
- package/dist/primitives/Icon/buckets/phosphor-u.js +38 -0
- package/dist/primitives/Icon/buckets/phosphor-v.js +22 -0
- package/dist/primitives/Icon/buckets/phosphor-w.js +48 -0
- package/dist/primitives/Icon/buckets/phosphor-x.js +4 -0
- package/dist/primitives/Icon/buckets/phosphor-y.js +8 -0
- package/dist/primitives/Icon/icon-display-names.generated.js +4 -0
- package/dist/primitives/Icon/icon-loaders.generated.js +70 -0
- package/dist/primitives/Icon/icon-names-material.generated.js +4 -0
- package/dist/primitives/Icon/icon-names.js +11 -0
- package/dist/primitives/Icon/index.js +7 -0
- package/dist/primitives/IconButton/IconButton.doc.js +43 -0
- package/dist/primitives/IconButton/IconButton.js +98 -0
- package/dist/primitives/IconButton/index.js +2 -0
- package/dist/primitives/IconPicker/IconPicker.doc.js +52 -0
- package/dist/primitives/IconPicker/IconPicker.js +193 -0
- package/dist/primitives/IconPicker/index.js +2 -0
- package/dist/primitives/IconPicker/registry.js +98 -0
- package/dist/primitives/Image/Image.doc.js +40 -0
- package/dist/primitives/Image/Image.js +76 -0
- package/dist/primitives/Image/index.js +2 -0
- package/dist/primitives/Inset/Inset.doc.js +34 -0
- package/dist/primitives/Inset/Inset.js +51 -0
- package/dist/primitives/Inset/index.js +2 -0
- package/dist/primitives/Kbd/Kbd.doc.js +22 -0
- package/dist/primitives/Kbd/Kbd.js +17 -0
- package/dist/primitives/Kbd/index.js +2 -0
- package/dist/primitives/LineChart/LineChart.doc.js +61 -0
- package/dist/primitives/LineChart/LineChart.js +146 -0
- package/dist/primitives/LineChart/index.js +2 -0
- package/dist/primitives/Link/Link.doc.js +45 -0
- package/dist/primitives/Link/Link.js +37 -0
- package/dist/primitives/Link/index.js +2 -0
- package/dist/primitives/List/List.doc.js +35 -0
- package/dist/primitives/List/List.js +35 -0
- package/dist/primitives/List/index.js +2 -0
- package/dist/primitives/Menu/Menu.doc.js +37 -0
- package/dist/primitives/Menu/Menu.js +117 -0
- package/dist/primitives/Menu/index.js +2 -0
- package/dist/primitives/Murmur/Murmur.doc.js +32 -0
- package/dist/primitives/Murmur/Murmur.js +85 -0
- package/dist/primitives/Murmur/engine.js +163 -0
- package/dist/primitives/Murmur/index.js +12 -0
- package/dist/primitives/Pagination/Pagination.doc.js +37 -0
- package/dist/primitives/Pagination/Pagination.js +183 -0
- package/dist/primitives/Pagination/index.js +2 -0
- package/dist/primitives/PanelGroup/PanelGroup.doc.js +41 -0
- package/dist/primitives/PanelGroup/PanelGroup.js +142 -0
- package/dist/primitives/PanelGroup/index.js +2 -0
- package/dist/primitives/Popover/Popover.doc.js +36 -0
- package/dist/primitives/Popover/Popover.js +41 -0
- package/dist/primitives/Popover/index.js +2 -0
- package/dist/primitives/Progress/Progress.doc.js +35 -0
- package/dist/primitives/Progress/Progress.js +77 -0
- package/dist/primitives/Progress/index.js +2 -0
- package/dist/primitives/RadioGroup/RadioGroup.doc.js +36 -0
- package/dist/primitives/RadioGroup/RadioGroup.js +132 -0
- package/dist/primitives/RadioGroup/index.js +2 -0
- package/dist/primitives/Rating/NpsScale.js +102 -0
- package/dist/primitives/Rating/Rating.doc.js +35 -0
- package/dist/primitives/Rating/Rating.js +116 -0
- package/dist/primitives/Rating/RatingSummary.js +50 -0
- package/dist/primitives/Rating/SentimentRating.js +81 -0
- package/dist/primitives/Rating/index.js +5 -0
- package/dist/primitives/Reasoning/Reasoning.doc.js +28 -0
- package/dist/primitives/Reasoning/Reasoning.js +73 -0
- package/dist/primitives/Reasoning/index.js +2 -0
- package/dist/primitives/Resizable/Resizable.doc.js +50 -0
- package/dist/primitives/Resizable/ResizeHandle.js +185 -0
- package/dist/primitives/Resizable/index.js +2 -0
- package/dist/primitives/Row/Row.doc.js +36 -0
- package/dist/primitives/Row/Row.js +53 -0
- package/dist/primitives/Row/index.js +2 -0
- package/dist/primitives/ScrollArea/ScrollArea.doc.js +35 -0
- package/dist/primitives/ScrollArea/ScrollArea.js +50 -0
- package/dist/primitives/ScrollArea/index.js +2 -0
- package/dist/primitives/Section/Section.doc.js +64 -0
- package/dist/primitives/Section/Section.js +76 -0
- package/dist/primitives/Section/index.js +2 -0
- package/dist/primitives/SegmentedControl/SegmentedControl.doc.js +75 -0
- package/dist/primitives/SegmentedControl/SegmentedControl.js +160 -0
- package/dist/primitives/SegmentedControl/index.js +2 -0
- package/dist/primitives/Select/Select.doc.js +42 -0
- package/dist/primitives/Select/Select.js +180 -0
- package/dist/primitives/Select/index.js +2 -0
- package/dist/primitives/Separator/Separator.doc.js +34 -0
- package/dist/primitives/Separator/Separator.js +84 -0
- package/dist/primitives/Separator/index.js +2 -0
- package/dist/primitives/ShavinDevTools/DevToolsPanel.js +2050 -0
- package/dist/primitives/ShavinDevTools/ShavinDevTools.doc.js +44 -0
- package/dist/primitives/ShavinDevTools/ShavinDevTools.js +15 -0
- package/dist/primitives/ShavinDevTools/index.js +8 -0
- package/dist/primitives/ShavinDevTools/types.js +0 -0
- package/dist/primitives/Sidebar/Sidebar.doc.js +39 -0
- package/dist/primitives/Sidebar/Sidebar.js +295 -0
- package/dist/primitives/Sidebar/index.js +2 -0
- package/dist/primitives/Skeleton/Skeleton.doc.js +38 -0
- package/dist/primitives/Skeleton/Skeleton.js +36 -0
- package/dist/primitives/Skeleton/index.js +2 -0
- package/dist/primitives/Slider/Slider.doc.js +45 -0
- package/dist/primitives/Slider/Slider.js +406 -0
- package/dist/primitives/Slider/index.js +2 -0
- package/dist/primitives/Sortable/Sortable.doc.js +35 -0
- package/dist/primitives/Sortable/Sortable.js +179 -0
- package/dist/primitives/Sortable/index.js +2 -0
- package/dist/primitives/Sparkline/Sparkline.doc.js +25 -0
- package/dist/primitives/Sparkline/Sparkline.js +46 -0
- package/dist/primitives/Sparkline/index.js +2 -0
- package/dist/primitives/Spinner/Spinner.doc.js +35 -0
- package/dist/primitives/Spinner/Spinner.js +162 -0
- package/dist/primitives/Spinner/index.js +2 -0
- package/dist/primitives/Spotlight/Spotlight.doc.js +36 -0
- package/dist/primitives/Spotlight/Spotlight.js +139 -0
- package/dist/primitives/Spotlight/index.js +2 -0
- package/dist/primitives/Stepper/Stepper.doc.js +46 -0
- package/dist/primitives/Stepper/Stepper.js +235 -0
- package/dist/primitives/Stepper/index.js +2 -0
- package/dist/primitives/Switch/Switch.doc.js +36 -0
- package/dist/primitives/Switch/Switch.js +54 -0
- package/dist/primitives/Switch/index.js +2 -0
- package/dist/primitives/Table/Table.doc.js +47 -0
- package/dist/primitives/Table/Table.js +63 -0
- package/dist/primitives/Table/index.js +2 -0
- package/dist/primitives/Tabs/Tabs.doc.js +53 -0
- package/dist/primitives/Tabs/Tabs.js +275 -0
- package/dist/primitives/Tabs/index.js +2 -0
- package/dist/primitives/Text/Text.doc.js +35 -0
- package/dist/primitives/Text/Text.js +67 -0
- package/dist/primitives/Text/index.js +2 -0
- package/dist/primitives/TextArea/TextArea.doc.js +35 -0
- package/dist/primitives/TextArea/TextArea.js +45 -0
- package/dist/primitives/TextArea/index.js +2 -0
- package/dist/primitives/TextField/TextField.doc.js +41 -0
- package/dist/primitives/TextField/TextField.js +290 -0
- package/dist/primitives/TextField/index.js +2 -0
- package/dist/primitives/ThemeProvider/ScopedThemeProvider.js +71 -0
- package/dist/primitives/ThemeProvider/ThemeProvider.doc.js +61 -0
- package/dist/primitives/ThemeProvider/ThemeProvider.js +143 -0
- package/dist/primitives/ThemeProvider/clientTheme.js +47 -0
- package/dist/primitives/ThemeProvider/index.js +3 -0
- package/dist/primitives/ThemeProvider/themeContext.js +11 -0
- package/dist/primitives/ThemeSwitcher/ThemeSwitcher.doc.js +49 -0
- package/dist/primitives/ThemeSwitcher/ThemeSwitcher.js +323 -0
- package/dist/primitives/ThemeSwitcher/index.js +2 -0
- package/dist/primitives/TimePicker/TimePicker.doc.js +36 -0
- package/dist/primitives/TimePicker/TimePicker.js +368 -0
- package/dist/primitives/TimePicker/index.js +2 -0
- package/dist/primitives/Toast/Toast.doc.js +65 -0
- package/dist/primitives/Toast/Toast.js +304 -0
- package/dist/primitives/Toast/index.js +2 -0
- package/dist/primitives/ToolCall/ToolCall.doc.js +29 -0
- package/dist/primitives/ToolCall/ToolCall.js +75 -0
- package/dist/primitives/ToolCall/index.js +2 -0
- package/dist/primitives/Tooltip/Tooltip.doc.js +37 -0
- package/dist/primitives/Tooltip/Tooltip.js +55 -0
- package/dist/primitives/Tooltip/index.js +2 -0
- package/dist/primitives/TopBar/TopBar.doc.js +34 -0
- package/dist/primitives/TopBar/TopBar.js +8 -0
- package/dist/primitives/TopBar/index.js +2 -0
- package/dist/primitives/Video/PauseToggle.js +49 -0
- package/dist/primitives/Video/Video.doc.js +47 -0
- package/dist/primitives/Video/Video.js +104 -0
- package/dist/primitives/Video/index.js +1 -0
- package/dist/primitives/VoiceInput/VoiceInput.doc.js +38 -0
- package/dist/primitives/VoiceInput/VoiceInput.js +96 -0
- package/dist/primitives/VoiceInput/index.js +2 -0
- package/dist/primitives/WiseOwlLogo/WiseOwlLogo.doc.js +38 -0
- package/dist/primitives/WiseOwlLogo/WiseOwlLogo.js +82 -0
- package/dist/primitives/WiseOwlLogo/index.js +2 -0
- package/dist/primitives/WiseOwlLogo/paths.js +10 -0
- package/dist/server.d.ts +256 -0
- package/dist/server.js +22 -0
- package/dist/styles/base-oklch.css +124 -0
- package/dist/styles/base-oklch.d.ts +2 -0
- package/dist/styles/base.css +124 -0
- package/dist/styles/base.d.ts +2 -0
- package/dist/styles/brand-preset.d.ts +22 -0
- package/dist/styles/brand-preset.js +13 -0
- package/dist/styles/brand-theme-v4-oklch.css +2 -0
- package/dist/styles/brand-theme-v4-oklch.d.ts +2 -0
- package/dist/styles/brand-theme-v4.css +2 -0
- package/dist/styles/brand-theme-v4.d.ts +2 -0
- package/dist/styles/brand-tokens-oklch.css +6 -0
- package/dist/styles/brand-tokens-oklch.d.ts +2 -0
- package/dist/styles/brand-tokens.css +6 -0
- package/dist/styles/brand-tokens.d.ts +2 -0
- package/dist/styles/global-oklch.css +1329 -0
- package/dist/styles/global-oklch.d.ts +2 -0
- package/dist/styles/global.css +1329 -0
- package/dist/styles/global.d.ts +2 -0
- package/dist/styles/theme-v4-oklch.css +22 -0
- package/dist/styles/theme-v4-oklch.d.ts +2 -0
- package/dist/styles/theme-v4.css +22 -0
- package/dist/styles/theme-v4.d.ts +2 -0
- package/dist/styles/tokens-oklch.css +1204 -0
- package/dist/styles/tokens-oklch.d.ts +2 -0
- package/dist/styles/tokens.css +1204 -0
- package/dist/styles/tokens.d.ts +2 -0
- package/dist/tailwind-preset.cjs +155 -0
- package/dist/tailwind-preset.d.ts +112 -0
- package/dist/tailwind-preset.js +133 -0
- package/dist/theme-presets-BVWZ_TxX.d.ts +514 -0
- package/global-oklch.css +3 -0
- package/package.json +169 -4
- package/styles.css +3 -0
- package/tailwind-preset.ts +140 -0
- package/tokens.json +423 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { countFindings, makeFinding } from "../lib/inspector/schema.js";
|
|
5
|
+
import { contextLabel, describeElement, uniqueSelector } from "../lib/inspector/selector.js";
|
|
6
|
+
import { FindingPopover } from "./FindingPopover.js";
|
|
7
|
+
import { Highlight } from "./Highlight.js";
|
|
8
|
+
import { InspectorRoot } from "./InspectorRoot.js";
|
|
9
|
+
import { IssuesLayer } from "./IssuesLayer.js";
|
|
10
|
+
import { IssuesList } from "./IssuesList.js";
|
|
11
|
+
import { Toolbar } from "./Toolbar.js";
|
|
12
|
+
import { SettingsPanel } from "./SettingsPanel.js";
|
|
13
|
+
import { reserveSpace, useSettings } from "./settings.js";
|
|
14
|
+
import { ThemePanel } from "./theme/ThemePanel.js";
|
|
15
|
+
import { avoidAnchor, dockStyle, loadBarPrefs, panelInsets, saveBarPrefs } from "./barPlacement.js";
|
|
16
|
+
import { copyText, currentTabId, useNow } from "./env.js";
|
|
17
|
+
import { clearIgnored, emptyIgnored, ignore, loadIgnored, restore, saveIgnored, undo } from "./ignored.js";
|
|
18
|
+
import { readJournal, sendFindings, withdrawFinding } from "./journalClient.js";
|
|
19
|
+
import { useTimeouts } from "./useTimeouts.js";
|
|
20
|
+
import { RESCAN_WINDOW_MS, countsFor, rowState, stripSummary } from "./journalState.js";
|
|
21
|
+
import { controlsScheme, usePageScheme } from "./scheme.js";
|
|
22
|
+
import { STR } from "./strings.js";
|
|
23
|
+
import { buildPrompt, userFindingInput } from "./prompt.js";
|
|
24
|
+
import { isInspectorElement, useSelectTool, walk } from "./useSelectTool.js";
|
|
25
|
+
import { useTrackedRect } from "./useTrackedRect.js";
|
|
26
|
+
import { DOCK_H, SHEET_GAP, sheetStyle, usePhone } from "./usePhone.js";
|
|
27
|
+
import { resolveTarget } from "./targets.js";
|
|
28
|
+
const IGNORED_EVENT = "shavin-inspector-ignored";
|
|
29
|
+
const RESCAN_EVENT = "shavin-inspector-rescan";
|
|
30
|
+
const isTyping = (t) => {
|
|
31
|
+
const el = t;
|
|
32
|
+
return !!el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));
|
|
33
|
+
};
|
|
34
|
+
function useIgnored() {
|
|
35
|
+
const [state, setState] = React.useState(() => emptyIgnored(loadIgnored()));
|
|
36
|
+
const commit = React.useCallback((next) => {
|
|
37
|
+
setState(next);
|
|
38
|
+
saveIgnored(next.ids);
|
|
39
|
+
window.dispatchEvent(new Event(IGNORED_EVENT));
|
|
40
|
+
}, []);
|
|
41
|
+
return {
|
|
42
|
+
state,
|
|
43
|
+
ignore: (id) => commit(ignore(state, id)),
|
|
44
|
+
restore: (id) => commit(restore(state, id)),
|
|
45
|
+
undo: () => commit(undo(state).state),
|
|
46
|
+
clear: () => commit(clearIgnored())
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const SEV = { error: 0, warning: 1 };
|
|
50
|
+
function Inspector({ findings, bridgePort, theme, themeStyle, position }) {
|
|
51
|
+
const [tool, setTool] = React.useState(null);
|
|
52
|
+
const [settings, setSettings] = useSettings();
|
|
53
|
+
const phone = usePhone();
|
|
54
|
+
const [panelOrder, setPanelOrder] = React.useState([]);
|
|
55
|
+
const panels = React.useMemo(() => new Set(panelOrder), [panelOrder]);
|
|
56
|
+
const [bar, setBar] = React.useState(() => loadBarPrefs(position));
|
|
57
|
+
const dockH = phone && !bar.collapsed ? DOCK_H : 0;
|
|
58
|
+
const setAnchor = React.useCallback((anchor) => setBar((b) => ({ ...b, anchor })), []);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
if (!settings.reserveSpace) return;
|
|
61
|
+
return reserveSpace(bar.anchor);
|
|
62
|
+
}, [settings.reserveSpace, bar.anchor]);
|
|
63
|
+
const returnFocus = React.useRef(null);
|
|
64
|
+
const setCollapsed = React.useCallback((collapsed) => {
|
|
65
|
+
setBar((b) => ({ ...b, collapsed }));
|
|
66
|
+
if (collapsed) {
|
|
67
|
+
const el = returnFocus.current;
|
|
68
|
+
returnFocus.current = null;
|
|
69
|
+
if (el && el.isConnected) el.focus();
|
|
70
|
+
}
|
|
71
|
+
}, []);
|
|
72
|
+
React.useEffect(() => saveBarPrefs(bar), [bar]);
|
|
73
|
+
const [selected, setSelected] = React.useState(null);
|
|
74
|
+
const [selectedId, setSelectedId] = React.useState(null);
|
|
75
|
+
const [pageFindingId, setPageFindingId] = React.useState(null);
|
|
76
|
+
const [popoverOpen, setPopoverState] = React.useState(false);
|
|
77
|
+
const popoverRef = React.useRef(false);
|
|
78
|
+
const setPopoverOpen = React.useCallback((open) => {
|
|
79
|
+
popoverRef.current = open;
|
|
80
|
+
setPopoverState(open);
|
|
81
|
+
}, []);
|
|
82
|
+
const togglePanel = React.useCallback(
|
|
83
|
+
(id) => {
|
|
84
|
+
if (phone) {
|
|
85
|
+
setPanelOrder((o) => o.includes(id) ? [] : [id]);
|
|
86
|
+
setTool((t) => t === "issues" ? null : t);
|
|
87
|
+
setPopoverOpen(false);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
setPanelOrder((o) => o.includes(id) ? o.filter((x) => x !== id) : [...o, id]);
|
|
91
|
+
},
|
|
92
|
+
[phone, setPopoverOpen]
|
|
93
|
+
);
|
|
94
|
+
const [pageIndex, setPageIndex] = React.useState(0);
|
|
95
|
+
const [notes, setNotes] = React.useState({});
|
|
96
|
+
const [listAside, setListAside] = React.useState(false);
|
|
97
|
+
const [activeId, setActiveId] = React.useState(null);
|
|
98
|
+
const [announce, setAnnounce] = React.useState("");
|
|
99
|
+
const [notice, setNotice] = React.useState("");
|
|
100
|
+
const [journal, setJournal] = React.useState(null);
|
|
101
|
+
const [sentIds, setSentIds] = React.useState(/* @__PURE__ */ new Set());
|
|
102
|
+
const ig = useIgnored();
|
|
103
|
+
const selectedRect = useTrackedRect(selected);
|
|
104
|
+
const effAnchor = avoidAnchor(bar.anchor, selectedRect ? { x: selectedRect.x, y: selectedRect.y, w: selectedRect.w, h: selectedRect.h } : null, typeof window === "undefined" ? 1280 : window.innerWidth, typeof window === "undefined" ? 800 : window.innerHeight, bar.collapsed ? 40 : 300, 40);
|
|
105
|
+
const page = usePageScheme();
|
|
106
|
+
const scheme = controlsScheme(settings.scheme, page);
|
|
107
|
+
const tabId = React.useMemo(() => currentTabId(), []);
|
|
108
|
+
const later = useTimeouts();
|
|
109
|
+
const say = React.useCallback((text) => {
|
|
110
|
+
setNotice(text);
|
|
111
|
+
later(() => setNotice((n) => n === text ? "" : n), 5e3);
|
|
112
|
+
}, [later]);
|
|
113
|
+
const select = React.useCallback((el, id = null) => {
|
|
114
|
+
setSelected(el);
|
|
115
|
+
setSelectedId(id);
|
|
116
|
+
setPageFindingId(null);
|
|
117
|
+
setPageIndex(0);
|
|
118
|
+
if (el) {
|
|
119
|
+
const r = el.getBoundingClientRect();
|
|
120
|
+
setAnnounce(`Selected ${describeElement(el)}, ${Math.round(r.width)} by ${Math.round(r.height)}`);
|
|
121
|
+
} else setAnnounce("");
|
|
122
|
+
}, []);
|
|
123
|
+
const { hovered } = useSelectTool({
|
|
124
|
+
active: tool === "select",
|
|
125
|
+
onSelect: (el) => {
|
|
126
|
+
select(el);
|
|
127
|
+
setPopoverOpen(true);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
const entryByIdRef = React.useRef(/* @__PURE__ */ new Map());
|
|
131
|
+
const elementFindings = React.useMemo(() => {
|
|
132
|
+
if (pageFindingId) {
|
|
133
|
+
const f = findings.find((x) => x.id === pageFindingId);
|
|
134
|
+
return f ? [f] : [];
|
|
135
|
+
}
|
|
136
|
+
if (!selected) return [];
|
|
137
|
+
const mine = findings.filter((f) => resolveTarget(f) === selected);
|
|
138
|
+
const rank = (f) => ig.state.ids.has(f.id) ? 2 : SEV[f.severity];
|
|
139
|
+
return mine.map((f, i) => ({ f, i })).sort((a, b) => rank(a.f) - rank(b.f) || a.i - b.i).map((x) => x.f);
|
|
140
|
+
}, [findings, selected, pageFindingId, ig.state.ids]);
|
|
141
|
+
const noteKey = pageFindingId ?? (selected ? uniqueSelector(selected) : "");
|
|
142
|
+
const note = notes[noteKey] ?? "";
|
|
143
|
+
const counted = React.useMemo(() => findings.filter((f) => !ig.state.ids.has(f.id)), [findings, ig.state.ids]);
|
|
144
|
+
const stats = React.useMemo(() => countFindings(findings, ig.state.ids), [findings, ig.state.ids]);
|
|
145
|
+
const watching = sentIds.size > 0 || tool === "issues";
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
if (!watching) return;
|
|
148
|
+
let alive = true;
|
|
149
|
+
const pull = async () => {
|
|
150
|
+
if (document.hidden) return;
|
|
151
|
+
const r = await readJournal(bridgePort, tabId);
|
|
152
|
+
if (alive) setJournal(r);
|
|
153
|
+
};
|
|
154
|
+
void pull();
|
|
155
|
+
const id = window.setInterval(pull, 2500);
|
|
156
|
+
return () => {
|
|
157
|
+
alive = false;
|
|
158
|
+
window.clearInterval(id);
|
|
159
|
+
};
|
|
160
|
+
}, [watching, bridgePort, tabId]);
|
|
161
|
+
const entryById = React.useMemo(() => new Map((journal?.entries ?? []).map((e) => [e.id, e])), [journal]);
|
|
162
|
+
entryByIdRef.current = entryById;
|
|
163
|
+
const recentAck = (journal?.entries ?? []).some((e) => e.state === "acked" && Date.now() - e.ackedAt < RESCAN_WINDOW_MS + 2e3);
|
|
164
|
+
const now = useNow(recentAck);
|
|
165
|
+
const present = React.useMemo(() => new Set(findings.map((f) => f.id)), [findings]);
|
|
166
|
+
const stateOf = React.useCallback((id) => rowState(entryById.get(id), present.has(id), now), [entryById, present, now]);
|
|
167
|
+
const errorsToSend = React.useMemo(() => {
|
|
168
|
+
const t = Date.now();
|
|
169
|
+
return counted.filter((f) => {
|
|
170
|
+
if (f.severity !== "error") return false;
|
|
171
|
+
const st = rowState(entryByIdRef.current.get(f.id), true, t);
|
|
172
|
+
return st === null || st.kind === "back" || st.kind === "still";
|
|
173
|
+
});
|
|
174
|
+
}, [counted, journal, now]);
|
|
175
|
+
const rescanned = React.useRef(/* @__PURE__ */ new Set());
|
|
176
|
+
React.useEffect(() => {
|
|
177
|
+
for (const e of journal?.entries ?? []) {
|
|
178
|
+
if (e.state !== "acked" || rescanned.current.has(e.id)) continue;
|
|
179
|
+
rescanned.current.add(e.id);
|
|
180
|
+
window.dispatchEvent(new Event(RESCAN_EVENT));
|
|
181
|
+
later(() => window.dispatchEvent(new Event(RESCAN_EVENT)), RESCAN_WINDOW_MS);
|
|
182
|
+
}
|
|
183
|
+
}, [journal, later]);
|
|
184
|
+
const sentEntries = React.useMemo(() => (journal?.entries ?? []).filter((e) => e.state !== "withdrawn"), [journal]);
|
|
185
|
+
const counts = React.useMemo(() => countsFor(sentEntries, new Set(sentEntries.map((e) => e.id))), [sentEntries]);
|
|
186
|
+
const strip = stripSummary(counts);
|
|
187
|
+
const openFinding = React.useCallback(
|
|
188
|
+
(id) => {
|
|
189
|
+
const f = findings.find((x) => x.id === id);
|
|
190
|
+
if (!f) return;
|
|
191
|
+
const el = resolveTarget(f);
|
|
192
|
+
if (!el) {
|
|
193
|
+
if (f.selector === "(page)") {
|
|
194
|
+
setSelected(null);
|
|
195
|
+
setSelectedId(id);
|
|
196
|
+
setPageFindingId(id);
|
|
197
|
+
setPageIndex(0);
|
|
198
|
+
setPopoverOpen(true);
|
|
199
|
+
setAnnounce("");
|
|
200
|
+
} else {
|
|
201
|
+
setAnnounce(STR.gone);
|
|
202
|
+
setSelectedId(id);
|
|
203
|
+
setSelected(null);
|
|
204
|
+
}
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
el.scrollIntoView({ block: "center", inline: "nearest" });
|
|
208
|
+
select(el, id);
|
|
209
|
+
const siblings = findings.filter((x) => resolveTarget(x) === el);
|
|
210
|
+
const rank = (x) => ig.state.ids.has(x.id) ? 2 : SEV[x.severity];
|
|
211
|
+
const ordered = siblings.map((x, i) => ({ x, i })).sort((a, b) => rank(a.x) - rank(b.x) || a.i - b.i).map((v) => v.x);
|
|
212
|
+
setPageIndex(Math.max(0, ordered.findIndex((x) => x.id === id)));
|
|
213
|
+
setPopoverOpen(true);
|
|
214
|
+
},
|
|
215
|
+
[findings, select, ig.state.ids]
|
|
216
|
+
);
|
|
217
|
+
const currentFinding = elementFindings[Math.min(pageIndex, Math.max(0, elementFindings.length - 1))] ?? null;
|
|
218
|
+
const buildOutgoing = React.useCallback(() => {
|
|
219
|
+
const comment = note.trim();
|
|
220
|
+
if (currentFinding) return comment ? { ...currentFinding, comment: comment.slice(0, 2e3) } : currentFinding;
|
|
221
|
+
if (!selected) return null;
|
|
222
|
+
const r = selected.getBoundingClientRect();
|
|
223
|
+
return makeFinding(
|
|
224
|
+
userFindingInput(selected, { x: r.x, y: r.y, w: r.width, h: r.height, scrollX: window.scrollX, scrollY: window.scrollY }, uniqueSelector(selected), contextLabel(selected), comment)
|
|
225
|
+
);
|
|
226
|
+
}, [currentFinding, note, selected]);
|
|
227
|
+
const send = React.useCallback(async () => {
|
|
228
|
+
const out = buildOutgoing();
|
|
229
|
+
if (!out) return "other";
|
|
230
|
+
const r = await sendFindings([out], { tabId, pathname: location.pathname, origin: location.origin }, bridgePort);
|
|
231
|
+
if (!r.ok) return r.reason === "bridge-down" ? "bridge-down" : r.reason === "too-long" ? "too-long" : r.reason === "save-failed" ? "save-failed" : "other";
|
|
232
|
+
setSentIds((prev) => /* @__PURE__ */ new Set([...prev, ...r.accepted]));
|
|
233
|
+
setJournal(await readJournal(bridgePort, tabId));
|
|
234
|
+
return r.agentListening ? "ok" : "ok-no-agent";
|
|
235
|
+
}, [buildOutgoing, tabId, bridgePort]);
|
|
236
|
+
const sendErrors = React.useCallback(async () => {
|
|
237
|
+
const list = errorsToSend.slice(0, 50);
|
|
238
|
+
if (list.length === 0) return;
|
|
239
|
+
const r = await sendFindings(list, { tabId, pathname: location.pathname, origin: location.origin }, bridgePort);
|
|
240
|
+
if (!r.ok) return say(r.reason === "bridge-down" ? STR.bridgeDown : STR.saveFailed);
|
|
241
|
+
setSentIds((prev) => /* @__PURE__ */ new Set([...prev, ...r.accepted]));
|
|
242
|
+
setJournal(await readJournal(bridgePort, tabId));
|
|
243
|
+
say(`Sent ${r.accepted.length} error${r.accepted.length === 1 ? "" : "s"}. ${r.agentListening ? STR.waiting : STR.noAgent}`);
|
|
244
|
+
}, [errorsToSend, tabId, bridgePort, say]);
|
|
245
|
+
const copy = React.useCallback(async () => {
|
|
246
|
+
const out = buildOutgoing();
|
|
247
|
+
if (!out) return false;
|
|
248
|
+
return copyText(buildPrompt({ pathname: location.pathname, finding: out, note: note.trim() }));
|
|
249
|
+
}, [buildOutgoing, note]);
|
|
250
|
+
const ignoreFinding = React.useCallback(
|
|
251
|
+
(id) => {
|
|
252
|
+
ig.ignore(id);
|
|
253
|
+
void withdrawFinding(id, bridgePort);
|
|
254
|
+
setPopoverOpen(false);
|
|
255
|
+
say(STR.ignoredDone);
|
|
256
|
+
},
|
|
257
|
+
[ig, bridgePort, say]
|
|
258
|
+
);
|
|
259
|
+
const [hiddenAll, setHiddenAll] = React.useState(false);
|
|
260
|
+
React.useEffect(() => {
|
|
261
|
+
const onKey = (e) => {
|
|
262
|
+
if (e.altKey && e.shiftKey && e.code === "KeyS") {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
setHiddenAll((h) => !h);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (isTyping(e.target) || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
268
|
+
if (e.key === "Escape") {
|
|
269
|
+
if (popoverRef.current) return;
|
|
270
|
+
if (selected || selectedId) {
|
|
271
|
+
select(null);
|
|
272
|
+
setPageFindingId(null);
|
|
273
|
+
setActiveId(null);
|
|
274
|
+
} else if (panelOrder.length > 0) setPanelOrder((o) => o.slice(0, -1));
|
|
275
|
+
else if (tool) setTool(null);
|
|
276
|
+
else if (!bar.collapsed && e.target?.closest?.("[data-shavin-toolbar]")) setCollapsed(true);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const inBar = !!e.target?.closest?.("[data-shavin-toolbar]");
|
|
280
|
+
if (!tool && !inBar && panelOrder.length === 0) return;
|
|
281
|
+
if (e.key === "Enter" && selected && !popoverOpen && !inBar && !isInspectorElement(e.target)) {
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
setPopoverOpen(true);
|
|
284
|
+
} else if (!settings.shortcuts && /^[vVtTiI,]$/.test(e.key)) {
|
|
285
|
+
} else if (e.key === "v" || e.key === "V") setTool((t) => t === "select" ? null : "select");
|
|
286
|
+
else if (e.key === "i" || e.key === "I") setTool((t) => t === "issues" ? null : "issues");
|
|
287
|
+
else if (e.key === "t" || e.key === "T") togglePanel("theme");
|
|
288
|
+
else if (e.key === ",") togglePanel("settings");
|
|
289
|
+
else if (tool === "select" && selected && e.key.startsWith("Arrow") && !isInspectorElement(e.target)) {
|
|
290
|
+
const next = walk(selected, e.key);
|
|
291
|
+
if (next) {
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
select(next);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
document.addEventListener("keydown", onKey, true);
|
|
298
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
299
|
+
}, [tool, selected, selectedId, popoverOpen, select, bar.collapsed, setCollapsed, panelOrder, togglePanel, settings.shortcuts]);
|
|
300
|
+
const mode = tool === "select" ? STR.selectIdle : tool === "issues" ? `Issues ${stats.total}${counts.pending > 0 ? ` \xB7 ${counts.pending} waiting` : ""}` : "";
|
|
301
|
+
const target = tool === "select" ? hovered ?? selected : selected;
|
|
302
|
+
const mark = tool === "issues" ? /* @__PURE__ */ jsx(IssuesLayer, { findings: counted, activeId, onOpen: openFinding }) : null;
|
|
303
|
+
const popoverOn = popoverOpen && (selected !== null || pageFindingId !== null);
|
|
304
|
+
if (hiddenAll) return /* @__PURE__ */ jsx(Fragment, {});
|
|
305
|
+
return /* @__PURE__ */ jsxs(InspectorRoot, { scheme, reduceMotion: settings.reduceMotion, children: [
|
|
306
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", role: "status", "aria-live": "polite", style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" }, children: announce }),
|
|
307
|
+
mark,
|
|
308
|
+
/* @__PURE__ */ jsx(Highlight, { target, mode: hovered && hovered !== selected ? "hover" : "selected" }),
|
|
309
|
+
tool === "issues" ? /* @__PURE__ */ jsx("div", { style: phone ? { position: "absolute", left: SHEET_GAP, right: SHEET_GAP, bottom: dockH > 0 ? `calc(${dockH}px + env(safe-area-inset-bottom, 0px) + ${SHEET_GAP}px)` : SHEET_GAP, maxHeight: "62vh", display: "flex", pointerEvents: "none", visibility: popoverOn && listAside ? "hidden" : "visible" } : { position: "absolute", ...dockStyle(effAnchor), pointerEvents: "none", visibility: popoverOn && listAside ? "hidden" : "visible" }, children: /* @__PURE__ */ jsx(
|
|
310
|
+
IssuesList,
|
|
311
|
+
{
|
|
312
|
+
findings,
|
|
313
|
+
ignored: ig.state.ids,
|
|
314
|
+
selectedId,
|
|
315
|
+
onActive: setActiveId,
|
|
316
|
+
onOpen: openFinding,
|
|
317
|
+
onUndo: ig.undo,
|
|
318
|
+
canUndo: ig.state.history.some((id) => ig.state.ids.has(id)),
|
|
319
|
+
strip,
|
|
320
|
+
rowState: stateOf,
|
|
321
|
+
errorsToSend: errorsToSend.length,
|
|
322
|
+
onSendErrors: () => void sendErrors(),
|
|
323
|
+
touch: phone,
|
|
324
|
+
style: phone ? { width: "100%" } : void 0
|
|
325
|
+
}
|
|
326
|
+
) }) : null,
|
|
327
|
+
/* @__PURE__ */ jsx(
|
|
328
|
+
FindingPopover,
|
|
329
|
+
{
|
|
330
|
+
open: popoverOn,
|
|
331
|
+
anchor: selected,
|
|
332
|
+
findings: elementFindings,
|
|
333
|
+
index: pageIndex,
|
|
334
|
+
onIndex: setPageIndex,
|
|
335
|
+
note,
|
|
336
|
+
onNote: (v) => setNotes((n) => ({ ...n, [noteKey]: v })),
|
|
337
|
+
isIgnored: (id) => ig.state.ids.has(id),
|
|
338
|
+
stateOf,
|
|
339
|
+
onSend: send,
|
|
340
|
+
onIgnore: ignoreFinding,
|
|
341
|
+
onRestore: ig.restore,
|
|
342
|
+
onCopy: copy,
|
|
343
|
+
onClose: () => setPopoverOpen(false),
|
|
344
|
+
getBar: () => document.querySelector("[data-shavin-toolbar]")?.getBoundingClientRect() ?? null,
|
|
345
|
+
getList: () => document.querySelector("[data-shavin-list]")?.getBoundingClientRect() ?? null,
|
|
346
|
+
getPanels: () => Array.from(document.querySelectorAll("[data-shavin-theme-panel], [data-shavin-settings-panel], [data-shavin-chip]")).map((el) => el.getBoundingClientRect()),
|
|
347
|
+
onListAside: setListAside
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
theme && panels.has("theme") ? /* @__PURE__ */ jsx(
|
|
351
|
+
ThemePanel,
|
|
352
|
+
{
|
|
353
|
+
theme,
|
|
354
|
+
contentStyle: themeStyle ?? {},
|
|
355
|
+
insets: panelInsets(effAnchor, "left"),
|
|
356
|
+
floatStyle: phone ? sheetStyle(dockH) : void 0,
|
|
357
|
+
onClose: () => {
|
|
358
|
+
togglePanel("theme");
|
|
359
|
+
const inside = document.activeElement?.closest?.("[data-shavin-theme-panel]");
|
|
360
|
+
if (inside) document.querySelector('[data-shavin-toolbar] button[aria-label="Theme"]')?.focus();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
) : null,
|
|
364
|
+
panels.has("settings") ? /* @__PURE__ */ jsx(
|
|
365
|
+
SettingsPanel,
|
|
366
|
+
{
|
|
367
|
+
settings,
|
|
368
|
+
insets: panelInsets(effAnchor, "right"),
|
|
369
|
+
floatStyle: phone ? sheetStyle(dockH) : void 0,
|
|
370
|
+
onChange: setSettings,
|
|
371
|
+
ignoredCount: ig.state.ids.size,
|
|
372
|
+
onClearIgnored: ig.clear,
|
|
373
|
+
onOpenBridge: () => window.dispatchEvent(new Event("shavin-open-bridge-panel")),
|
|
374
|
+
onClose: () => {
|
|
375
|
+
togglePanel("settings");
|
|
376
|
+
const inside = document.activeElement?.closest?.("[data-shavin-settings-panel]");
|
|
377
|
+
if (inside) document.querySelector('[data-shavin-toolbar] button[aria-label="Settings"]')?.focus();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
) : null,
|
|
381
|
+
notice ? /* @__PURE__ */ jsx("div", { role: "status", className: "rounded-[var(--radius-lg)] border border-hairline bg-elevated px-2.5 py-1.5 text-xs text-fg shadow-panel", style: { position: "absolute", right: phone ? 8 : 20, bottom: phone ? dockH > 0 ? `calc(${dockH}px + env(safe-area-inset-bottom, 0px) + ${SHEET_GAP}px)` : SHEET_GAP : 76, maxWidth: 320, pointerEvents: "none" }, children: notice }) : null,
|
|
382
|
+
/* @__PURE__ */ jsx(
|
|
383
|
+
Toolbar,
|
|
384
|
+
{
|
|
385
|
+
active: tool,
|
|
386
|
+
panels,
|
|
387
|
+
onPanel: togglePanel,
|
|
388
|
+
onChange: (t) => {
|
|
389
|
+
setTool(t);
|
|
390
|
+
if (phone && t === "issues") setPanelOrder([]);
|
|
391
|
+
if (t === null || t === "select") setPopoverOpen(false);
|
|
392
|
+
if (t !== "select") setSelected((s) => t === "issues" ? s : null);
|
|
393
|
+
},
|
|
394
|
+
errors: stats.errors,
|
|
395
|
+
warnings: stats.warnings,
|
|
396
|
+
mode,
|
|
397
|
+
anchor: effAnchor,
|
|
398
|
+
onAnchor: setAnchor,
|
|
399
|
+
collapsed: bar.collapsed,
|
|
400
|
+
phone,
|
|
401
|
+
onFocusFrom: (el) => returnFocus.current = el,
|
|
402
|
+
onCollapsed: (c) => {
|
|
403
|
+
setCollapsed(c);
|
|
404
|
+
if (c) {
|
|
405
|
+
setTool(null);
|
|
406
|
+
setPanelOrder([]);
|
|
407
|
+
setPopoverOpen(false);
|
|
408
|
+
select(null);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
)
|
|
413
|
+
] });
|
|
414
|
+
}
|
|
415
|
+
export {
|
|
416
|
+
IGNORED_EVENT,
|
|
417
|
+
Inspector,
|
|
418
|
+
RESCAN_EVENT,
|
|
419
|
+
useIgnored
|
|
420
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { PortalContainerProvider } from "../lib/portal-container.js";
|
|
5
|
+
import { ScopedThemeProvider } from "../primitives/ThemeProvider/index.js";
|
|
6
|
+
import { pinnedVars, ROOT_TEXT } from "./pin.js";
|
|
7
|
+
const TOUCH_CSS = '@media (hover: none) { [data-shavin-toolbar] button:not([aria-pressed="true"]):hover, [data-shavin-list] [role="option"]:not([aria-selected="true"]):hover { background-color: transparent; } }';
|
|
8
|
+
const NO_MOTION = {
|
|
9
|
+
"--dur-instant": "0ms",
|
|
10
|
+
"--dur-fast": "0ms",
|
|
11
|
+
"--dur-base": "0ms",
|
|
12
|
+
"--dur-slow": "0ms",
|
|
13
|
+
"--dur-enter": "0ms"
|
|
14
|
+
};
|
|
15
|
+
function InspectorRoot({ scheme, reduceMotion, children }) {
|
|
16
|
+
const rootRef = React.useRef(null);
|
|
17
|
+
const [host, setHost] = React.useState(null);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
const el = rootRef.current;
|
|
20
|
+
if (!el) return;
|
|
21
|
+
try {
|
|
22
|
+
el.setAttribute("popover", "manual");
|
|
23
|
+
el.showPopover?.();
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
try {
|
|
28
|
+
el.hidePopover?.();
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: rootRef,
|
|
37
|
+
"data-shavin-inspector": "",
|
|
38
|
+
"data-scheme": scheme,
|
|
39
|
+
style: {
|
|
40
|
+
position: "fixed",
|
|
41
|
+
inset: 0,
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: "100%",
|
|
44
|
+
margin: 0,
|
|
45
|
+
padding: 0,
|
|
46
|
+
border: 0,
|
|
47
|
+
background: "transparent",
|
|
48
|
+
overflow: "visible",
|
|
49
|
+
pointerEvents: "none",
|
|
50
|
+
zIndex: 2147483e3,
|
|
51
|
+
color: "inherit"
|
|
52
|
+
},
|
|
53
|
+
children: /* @__PURE__ */ jsx(
|
|
54
|
+
ScopedThemeProvider,
|
|
55
|
+
{
|
|
56
|
+
appearance: scheme,
|
|
57
|
+
brandColor: "Monochrome",
|
|
58
|
+
grayColor: "Zinc",
|
|
59
|
+
radius: "medium",
|
|
60
|
+
focusRing: "default",
|
|
61
|
+
"data-shavin-scope": "",
|
|
62
|
+
style: { ...pinnedVars(scheme), ...reduceMotion ? NO_MOTION : null, ...ROOT_TEXT, color: "rgb(var(--fg))", position: "absolute", inset: 0, pointerEvents: "none" },
|
|
63
|
+
children: /* @__PURE__ */ jsxs(PortalContainerProvider, { value: host, children: [
|
|
64
|
+
/* @__PURE__ */ jsx("style", { children: TOUCH_CSS }),
|
|
65
|
+
children,
|
|
66
|
+
/* @__PURE__ */ jsx("div", { ref: setHost, "data-shavin-portal": "", style: { position: "absolute", inset: 0, pointerEvents: "none" } })
|
|
67
|
+
] })
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
InspectorRoot
|
|
75
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { MARKER_LIMITS, inViewport, planMarkers } from "./geometry.js";
|
|
5
|
+
import { resolveTarget } from "./targets.js";
|
|
6
|
+
const clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
7
|
+
function markerAnchor(rect, vw, vh) {
|
|
8
|
+
const side = rect.x < 14 || rect.w < 24;
|
|
9
|
+
const x = side ? rect.x - 8 : rect.x - 6;
|
|
10
|
+
const y = side ? rect.y + rect.h / 2 : rect.y - 6;
|
|
11
|
+
return { x: clamp(x, 12, vw - 12), y: clamp(y, 12, vh - 12) };
|
|
12
|
+
}
|
|
13
|
+
function IssuesLayer({ findings, activeId, onOpen }) {
|
|
14
|
+
const [tick, setTick] = React.useState(0);
|
|
15
|
+
const elements = React.useMemo(() => findings.map((f) => ({ f, el: resolveTarget(f) })).filter((x) => !!x.el), [findings]);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
let frame = 0;
|
|
18
|
+
const schedule = () => {
|
|
19
|
+
if (!frame) frame = requestAnimationFrame(() => {
|
|
20
|
+
frame = 0;
|
|
21
|
+
setTick((t) => t + 1);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
window.addEventListener("scroll", schedule, { capture: true, passive: true });
|
|
25
|
+
window.addEventListener("resize", schedule, { passive: true });
|
|
26
|
+
const poll = window.setInterval(schedule, 700);
|
|
27
|
+
return () => {
|
|
28
|
+
if (frame) cancelAnimationFrame(frame);
|
|
29
|
+
window.removeEventListener("scroll", schedule, { capture: true });
|
|
30
|
+
window.removeEventListener("resize", schedule);
|
|
31
|
+
window.clearInterval(poll);
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
void tick;
|
|
35
|
+
const vw = window.innerWidth;
|
|
36
|
+
const vh = window.innerHeight;
|
|
37
|
+
const placed = [];
|
|
38
|
+
for (const { f, el } of elements) {
|
|
39
|
+
if (!el.isConnected) continue;
|
|
40
|
+
const r = el.getBoundingClientRect();
|
|
41
|
+
const rect = { x: r.x, y: r.y, w: r.width, h: r.height };
|
|
42
|
+
if (rect.w <= 0 || rect.h <= 0 || !inViewport(rect, vw, vh)) continue;
|
|
43
|
+
const at = markerAnchor(rect, vw, vh);
|
|
44
|
+
placed.push({ id: f.id, severity: f.severity, x: at.x, y: at.y, el, rect, radius: getComputedStyle(el).borderRadius });
|
|
45
|
+
}
|
|
46
|
+
const plan = planMarkers(placed, MARKER_LIMITS, findings.length);
|
|
47
|
+
const byId = new Map(placed.map((p) => [p.id, p]));
|
|
48
|
+
const severityOf = new Map(findings.map((f) => [f.id, f.severity]));
|
|
49
|
+
return /* @__PURE__ */ jsxs("div", { "aria-hidden": false, style: { position: "absolute", inset: 0, pointerEvents: "none" }, "data-shavin-markers": "", children: [
|
|
50
|
+
plan.tint ? placed.map((p) => /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
style: { position: "fixed", left: p.rect.x, top: p.rect.y, width: p.rect.w, height: p.rect.h, borderRadius: p.radius, background: `rgb(var(--${p.severity === "error" ? "danger" : "warning"}) / 0.06)`, pointerEvents: "none", transition: "opacity var(--dur-instant) linear" }
|
|
55
|
+
},
|
|
56
|
+
`tint-${p.id}`
|
|
57
|
+
)) : null,
|
|
58
|
+
activeId && byId.get(activeId) ? /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
style: {
|
|
63
|
+
position: "fixed",
|
|
64
|
+
left: byId.get(activeId).rect.x,
|
|
65
|
+
top: byId.get(activeId).rect.y,
|
|
66
|
+
width: byId.get(activeId).rect.w,
|
|
67
|
+
height: byId.get(activeId).rect.h,
|
|
68
|
+
borderRadius: byId.get(activeId).radius,
|
|
69
|
+
border: `1px solid rgb(var(--${severityOf.get(activeId) === "error" ? "danger" : "warning"}))`,
|
|
70
|
+
background: `rgb(var(--${severityOf.get(activeId) === "error" ? "danger" : "warning"}) / 0.11)`,
|
|
71
|
+
boxShadow: "0 0 0 2px rgb(var(--bg-elevated) / 0.6)",
|
|
72
|
+
pointerEvents: "none",
|
|
73
|
+
// ds-lint-disable-next-line no-unknown-class — a CSS value, not a class
|
|
74
|
+
boxSizing: "border-box"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
) : null,
|
|
78
|
+
plan.markers.map((m) => {
|
|
79
|
+
const first = findings.find((f) => f.id === m.ids[0]);
|
|
80
|
+
const label = m.ids.length > 1 ? `${m.ids.length} findings here, first: ${first?.message ?? ""}` : first ? `${first.severity === "error" ? "Error" : "Warning"}: ${first.message}` : "Finding";
|
|
81
|
+
const color = m.severity === "error" ? "danger" : "warning";
|
|
82
|
+
const many = m.ids.length > 1;
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"button",
|
|
85
|
+
{
|
|
86
|
+
type: "button",
|
|
87
|
+
"aria-label": label,
|
|
88
|
+
onClick: () => onOpen(m.ids[0]),
|
|
89
|
+
style: { position: "fixed", left: m.x - 12, top: m.y - 12, width: 24, height: 24, display: "grid", placeItems: "center", background: "transparent", border: 0, padding: 0, cursor: "pointer", pointerEvents: "auto" },
|
|
90
|
+
children: /* @__PURE__ */ jsx(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
"aria-hidden": "true",
|
|
94
|
+
style: {
|
|
95
|
+
display: "grid",
|
|
96
|
+
placeItems: "center",
|
|
97
|
+
width: many ? 18 : 8,
|
|
98
|
+
height: many ? 18 : 8,
|
|
99
|
+
borderRadius: "50%",
|
|
100
|
+
// ds-lint-disable-next-line no-unknown-class — a CSS value, not a class
|
|
101
|
+
boxSizing: "border-box",
|
|
102
|
+
background: m.severity === "error" || many ? `rgb(var(--${color}))` : "transparent",
|
|
103
|
+
border: m.severity === "warning" && !many ? `1.5px solid rgb(var(--${color}))` : "none",
|
|
104
|
+
boxShadow: "0 0 0 1.5px rgb(var(--bg-elevated) / 0.85)",
|
|
105
|
+
color: `rgb(var(--${color}-fg))`,
|
|
106
|
+
fontSize: 10,
|
|
107
|
+
fontWeight: 700,
|
|
108
|
+
lineHeight: 1
|
|
109
|
+
},
|
|
110
|
+
children: many ? m.ids.length : null
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
},
|
|
114
|
+
m.ids.join(",")
|
|
115
|
+
);
|
|
116
|
+
}),
|
|
117
|
+
plan.hidden > 0 ? /* @__PURE__ */ jsxs(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
style: { position: "fixed", left: 12, bottom: 64, pointerEvents: "none" },
|
|
121
|
+
className: "rounded-full border border-hairline bg-elevated px-2 py-0.5 text-[11px] text-fg-muted shadow-panel",
|
|
122
|
+
children: [
|
|
123
|
+
"+",
|
|
124
|
+
plan.hidden,
|
|
125
|
+
" more in the list"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
) : null
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
IssuesLayer,
|
|
133
|
+
markerAnchor
|
|
134
|
+
};
|