@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,2050 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect, useRef, useCallback, useMemo } from "react";
|
|
4
|
+
import { resolveBridgePort, bridgeUrl, bridgeDashboardUrl } from "../../lib/bridge.js";
|
|
5
|
+
import {
|
|
6
|
+
countFindings,
|
|
7
|
+
domHooks,
|
|
8
|
+
inspectDocument,
|
|
9
|
+
installConsoleCapture,
|
|
10
|
+
rankFindings,
|
|
11
|
+
tokenFindings
|
|
12
|
+
} from "../../lib/inspector/index.js";
|
|
13
|
+
import { Inspector, IGNORED_EVENT, RESCAN_EVENT } from "../../inspector/index.js";
|
|
14
|
+
import { useThemeController, DEFAULT_FALLBACK_HEX } from "../../inspector/theme/useThemeController.js";
|
|
15
|
+
import { loadIgnored } from "../../inspector/ignored.js";
|
|
16
|
+
import { loadGoogleFont, preloadGoogleFontsBundle } from "../../lib/theme-presets.js";
|
|
17
|
+
import { Button } from "../Button/index.js";
|
|
18
|
+
import { Popover, PopoverTrigger, PopoverContent } from "../Popover/index.js";
|
|
19
|
+
import { Switch } from "../Switch/index.js";
|
|
20
|
+
import { Row } from "../Row/index.js";
|
|
21
|
+
import { cn } from "../../lib/cn.js";
|
|
22
|
+
import { SHAVIN_META } from "../../lib/meta.js";
|
|
23
|
+
const CORNER_STYLES = {
|
|
24
|
+
"bottom-left": { bottom: "20px", left: "20px" },
|
|
25
|
+
"bottom-right": { bottom: "20px", right: "20px" },
|
|
26
|
+
"top-left": { top: "20px", left: "20px" },
|
|
27
|
+
"top-right": { top: "20px", right: "20px" }
|
|
28
|
+
};
|
|
29
|
+
function detectBrowserName() {
|
|
30
|
+
if (typeof window === "undefined") return "Chrome";
|
|
31
|
+
const ua = navigator.userAgent;
|
|
32
|
+
if (Boolean(navigator.brave)) {
|
|
33
|
+
return "Brave";
|
|
34
|
+
}
|
|
35
|
+
const brands = navigator.userAgentData?.brands;
|
|
36
|
+
let isChromiumGeneric = false;
|
|
37
|
+
if (brands && Array.isArray(brands)) {
|
|
38
|
+
const brandNames = brands.map((b) => b.brand.toLowerCase());
|
|
39
|
+
if (brandNames.some((b) => b.includes("brave"))) return "Brave";
|
|
40
|
+
if (brandNames.some((b) => b.includes("edge") || b.includes("edg"))) return "Edge";
|
|
41
|
+
const hasChromium = brandNames.some((b) => b.includes("chromium"));
|
|
42
|
+
const hasGoogle = brandNames.some((b) => b.includes("chrome") || b.includes("google"));
|
|
43
|
+
if (hasChromium && !hasGoogle) {
|
|
44
|
+
isChromiumGeneric = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (Boolean(window.arc) || isChromiumGeneric || typeof document !== "undefined" && (document.documentElement.getAttribute("data-arc") !== null || Boolean(document.querySelector("style#arc-injected-styles")) || getComputedStyle(document.documentElement).getPropertyValue("--arc-palette-title") !== "" || getComputedStyle(document.documentElement).getPropertyValue("--arc-palette-hover") !== "")) {
|
|
48
|
+
return "Arc";
|
|
49
|
+
}
|
|
50
|
+
if (brands && Array.isArray(brands)) {
|
|
51
|
+
if (brands.some((b) => b.brand.toLowerCase().includes("chrome") || b.brand.toLowerCase().includes("google"))) return "Chrome";
|
|
52
|
+
}
|
|
53
|
+
if (ua.includes("Edg/")) return "Edge";
|
|
54
|
+
if (ua.includes("Firefox/")) return "Firefox";
|
|
55
|
+
if (ua.includes("Safari/") && !ua.includes("Chrome/") && !ua.includes("Chromium/")) return "Safari";
|
|
56
|
+
if (ua.includes("Chrome/") || ua.includes("Chromium/")) return "Chrome";
|
|
57
|
+
return "Chrome";
|
|
58
|
+
}
|
|
59
|
+
function calculateContrast(fgHex, isDark) {
|
|
60
|
+
const getLum = (hex) => {
|
|
61
|
+
let clean = (hex || DEFAULT_FALLBACK_HEX).replace("#", "");
|
|
62
|
+
if (clean.length === 3) clean = clean.split("").map((c) => c + c).join("");
|
|
63
|
+
if (clean.length !== 6) return 0.5;
|
|
64
|
+
const r = parseInt(clean.slice(0, 2), 16) / 255;
|
|
65
|
+
const g = parseInt(clean.slice(2, 4), 16) / 255;
|
|
66
|
+
const b = parseInt(clean.slice(4, 6), 16) / 255;
|
|
67
|
+
const lin = (c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
68
|
+
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
let l1 = getLum(fgHex);
|
|
72
|
+
if (isDark && l1 < 0.12) {
|
|
73
|
+
l1 = 1;
|
|
74
|
+
} else if (!isDark && l1 > 0.85) {
|
|
75
|
+
l1 = 0;
|
|
76
|
+
}
|
|
77
|
+
const l2 = isDark ? 0.015 : 1;
|
|
78
|
+
const lighter = Math.max(l1, l2);
|
|
79
|
+
const darker = Math.min(l1, l2);
|
|
80
|
+
const ratio = Math.round((lighter + 0.05) / (darker + 0.05) * 10) / 10;
|
|
81
|
+
if (ratio >= 7) return { ratio, level: "AAA", label: `${ratio}:1 (AAA Pass)` };
|
|
82
|
+
if (ratio >= 4.5) return { ratio, level: "AA", label: `${ratio}:1 (AA Pass)` };
|
|
83
|
+
return { ratio, level: "Fail", label: `${ratio}:1 (Fail < 4.5)` };
|
|
84
|
+
} catch {
|
|
85
|
+
return { ratio: 0, level: "Unknown", label: "unknown (colour could not be read)" };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const MCP_TOOL_DESC = {
|
|
89
|
+
get_project_context: "The project's design profile and the tool workflow. Call first",
|
|
90
|
+
inspect_environment: "Checks the setup: package, Tailwind, CSS imports, ThemeProvider, agent files",
|
|
91
|
+
get_setup_instructions: "Wiring steps for Next.js or React, Tailwind v3 or v4",
|
|
92
|
+
plan_page: "Turns a brief into a section plan from the layout compositions",
|
|
93
|
+
check_page: "Checks a page plan, then the built code against it",
|
|
94
|
+
render_check: "Loads a local page headless and reports overlap, contrast and overflow, with screenshots",
|
|
95
|
+
get_components: `Exact props and variants for any of the ${SHAVIN_META.primitiveCount} primitives`,
|
|
96
|
+
get_tokens: "The semantic colour, surface, radius, shadow and motion tokens",
|
|
97
|
+
get_block_template: "A ready-made block's verified template",
|
|
98
|
+
get_studio_schema: "Block registry: key, name, category and tier",
|
|
99
|
+
synthesize_layout: "Scaffolds token-pure starter sections",
|
|
100
|
+
get_guidelines: "Rules from AGENTS.md, optionally one section",
|
|
101
|
+
validate_code: "Lints JSX against the token and radius rules",
|
|
102
|
+
autofix_code: "Rewrites raw colours and radii to tokens",
|
|
103
|
+
audit_source: "Scans .tsx files for issues the live audit can't see",
|
|
104
|
+
get_live_audit: "The latest audit from this page, read through the bridge",
|
|
105
|
+
trigger_live_rescan: "Asks open pages to re-run the audit now",
|
|
106
|
+
wait_for_live_clean: "Waits until the page reports no problems",
|
|
107
|
+
await_finding: "Waits for a finding you sent from the page and leases it to the agent",
|
|
108
|
+
list_findings: "Lists the findings you sent from the page and where each stands",
|
|
109
|
+
list_skills: "The agent skills and their sections",
|
|
110
|
+
get_skill: "One skill, or one section of it",
|
|
111
|
+
get_skill_mode: "Structural, marketing, editorial or hybrid mode for a task",
|
|
112
|
+
install_skills: `Installs the ${SHAVIN_META.consumerSkillCount} skills into .agents/skills`,
|
|
113
|
+
list_commands: "The slash commands in .agents/commands",
|
|
114
|
+
shavin_steer: "Audit, polish, harden or roll back a design",
|
|
115
|
+
connect_studio: "Pairs with a Studio canvas using its 6-character code",
|
|
116
|
+
get_studio_state: "Reads the Studio canvas: frames, blocks and theme",
|
|
117
|
+
compose_to_canvas: "Builds a page from a prompt on the Studio canvas",
|
|
118
|
+
inject_blocks: "Puts blocks or TSX onto the Studio canvas",
|
|
119
|
+
set_studio_theme: "Changes the Studio canvas theme",
|
|
120
|
+
clear_studio_canvas: "Empties the Studio canvas",
|
|
121
|
+
duplicate_frame: "Copies a Studio frame next to the original",
|
|
122
|
+
resize_frame: "Resizes a Studio frame to a device, social preset or custom size",
|
|
123
|
+
export_frame: "Saves a Studio frame as PNG, JPG or WebP",
|
|
124
|
+
disconnect_studio: "Ends the Studio session"
|
|
125
|
+
};
|
|
126
|
+
const MCP_TOOL_INFO = Object.keys(MCP_TOOL_DESC).map((name) => ({
|
|
127
|
+
name,
|
|
128
|
+
desc: MCP_TOOL_DESC[name],
|
|
129
|
+
cmd: `Use the Shavin MCP tool ${name}`
|
|
130
|
+
}));
|
|
131
|
+
function DevToolsPanel({
|
|
132
|
+
className,
|
|
133
|
+
position = "bottom-right",
|
|
134
|
+
bridgePort,
|
|
135
|
+
...props
|
|
136
|
+
}) {
|
|
137
|
+
const bPort = resolveBridgePort(bridgePort);
|
|
138
|
+
const [mounted, setMounted] = useState(false);
|
|
139
|
+
const consoleCaptureRef = useRef(null);
|
|
140
|
+
const [inspectorFindings, setInspectorFindings] = useState([]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
const capture = installConsoleCapture();
|
|
143
|
+
consoleCaptureRef.current = capture;
|
|
144
|
+
let timer = 0;
|
|
145
|
+
const unsubscribe = capture.subscribe(() => {
|
|
146
|
+
window.clearTimeout(timer);
|
|
147
|
+
timer = window.setTimeout(() => window.dispatchEvent(new Event(RESCAN_EVENT)), 400);
|
|
148
|
+
});
|
|
149
|
+
return () => {
|
|
150
|
+
window.clearTimeout(timer);
|
|
151
|
+
unsubscribe();
|
|
152
|
+
capture.dispose();
|
|
153
|
+
consoleCaptureRef.current = null;
|
|
154
|
+
};
|
|
155
|
+
}, []);
|
|
156
|
+
const [open, setOpen] = useState(false);
|
|
157
|
+
const [tab, setTab] = useState("audit");
|
|
158
|
+
const [corner, setCorner] = useState(position);
|
|
159
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
160
|
+
const [dragOffset, setDragOffset] = useState(null);
|
|
161
|
+
const pointerDownRef = useRef(null);
|
|
162
|
+
const justDraggedRef = useRef(false);
|
|
163
|
+
const buttonRef = useRef(null);
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
const openPanel = () => setOpen(true);
|
|
166
|
+
window.addEventListener("shavin-open-bridge-panel", openPanel);
|
|
167
|
+
return () => window.removeEventListener("shavin-open-bridge-panel", openPanel);
|
|
168
|
+
}, []);
|
|
169
|
+
const [popoverPos, setPopoverPos] = useState({ x: 0, y: 0 });
|
|
170
|
+
const popoverDragRef = useRef(null);
|
|
171
|
+
const [isPopoverDragging, setIsPopoverDragging] = useState(false);
|
|
172
|
+
const theme = useThemeController();
|
|
173
|
+
const {
|
|
174
|
+
themeName,
|
|
175
|
+
setThemeName,
|
|
176
|
+
dark,
|
|
177
|
+
setDark,
|
|
178
|
+
brandHex,
|
|
179
|
+
setBrandHex,
|
|
180
|
+
brandName,
|
|
181
|
+
setBrandName,
|
|
182
|
+
grayName,
|
|
183
|
+
setGrayName,
|
|
184
|
+
radiusName,
|
|
185
|
+
setRadiusName,
|
|
186
|
+
scaling,
|
|
187
|
+
setScaling,
|
|
188
|
+
translucent,
|
|
189
|
+
setTranslucent,
|
|
190
|
+
displayFont,
|
|
191
|
+
setDisplayFont,
|
|
192
|
+
bodyFont,
|
|
193
|
+
setBodyFont,
|
|
194
|
+
subheadingFont,
|
|
195
|
+
setSubheadingFont,
|
|
196
|
+
initialSubheadingRef,
|
|
197
|
+
initialProjectConfigRef,
|
|
198
|
+
detectedHeadingFont,
|
|
199
|
+
setDetectedHeadingFont,
|
|
200
|
+
detectedBodyFont,
|
|
201
|
+
setDetectedBodyFont,
|
|
202
|
+
copied,
|
|
203
|
+
setCopied,
|
|
204
|
+
customFontHelp,
|
|
205
|
+
setCustomFontHelp,
|
|
206
|
+
customFontHelpRef,
|
|
207
|
+
handleSelectTheme,
|
|
208
|
+
handleBrand,
|
|
209
|
+
handleGray,
|
|
210
|
+
handleAppearance,
|
|
211
|
+
handleRadius,
|
|
212
|
+
handleScaling,
|
|
213
|
+
handlePanelStyle,
|
|
214
|
+
handleDisplayFont,
|
|
215
|
+
handleBodyFont,
|
|
216
|
+
handleSubheadingFont,
|
|
217
|
+
resetAll,
|
|
218
|
+
customGraySwatch,
|
|
219
|
+
themeOptions,
|
|
220
|
+
scalingOptions,
|
|
221
|
+
displayFontOptions,
|
|
222
|
+
bodyFontOptions,
|
|
223
|
+
isPresetActive,
|
|
224
|
+
activePreset,
|
|
225
|
+
normalizeBrand,
|
|
226
|
+
isExactPreset,
|
|
227
|
+
generatedSnippet,
|
|
228
|
+
rootFileHint,
|
|
229
|
+
copyCode
|
|
230
|
+
} = theme;
|
|
231
|
+
const [auditIssues, setAuditIssues] = useState([]);
|
|
232
|
+
const [auditTimestamp, setAuditTimestamp] = useState(null);
|
|
233
|
+
const [copiedTool, setCopiedTool] = useState(null);
|
|
234
|
+
const [copiedIssueId, setCopiedIssueId] = useState(null);
|
|
235
|
+
const [copiedAllIssues, setCopiedAllIssues] = useState(false);
|
|
236
|
+
const [bridgeConnected, setBridgeConnected] = useState(false);
|
|
237
|
+
const [streamEvents, setStreamEvents] = useState([]);
|
|
238
|
+
const [selectedEventId, setSelectedEventId] = useState(null);
|
|
239
|
+
const [expandedIssueId, setExpandedIssueId] = useState(null);
|
|
240
|
+
const [streamHowItWorksOpen, setStreamHowItWorksOpen] = useState(false);
|
|
241
|
+
const [expandedToolName, setExpandedToolName] = useState(null);
|
|
242
|
+
const [triggeringRescan, setTriggeringRescan] = useState(false);
|
|
243
|
+
const [showSourceWarnings, setShowSourceWarnings] = useState(false);
|
|
244
|
+
const [sourceWarnings, setSourceWarnings] = useState([]);
|
|
245
|
+
const [sourceAuditLoading, setSourceAuditLoading] = useState(false);
|
|
246
|
+
const [sourceAuditTimestamp, setSourceAuditTimestamp] = useState(null);
|
|
247
|
+
const [sourceAuditError, setSourceAuditError] = useState(null);
|
|
248
|
+
const mutationDebounceRef = useRef(null);
|
|
249
|
+
const bridgeSyncDebounceRef = useRef(null);
|
|
250
|
+
const lastAuditSigRef = useRef("");
|
|
251
|
+
const aliveRef = useRef(true);
|
|
252
|
+
const bridgeRequestsRef = useRef(/* @__PURE__ */ new Set());
|
|
253
|
+
useEffect(() => {
|
|
254
|
+
aliveRef.current = true;
|
|
255
|
+
const requests = bridgeRequestsRef.current;
|
|
256
|
+
return () => {
|
|
257
|
+
aliveRef.current = false;
|
|
258
|
+
requests.forEach((c) => c.abort());
|
|
259
|
+
requests.clear();
|
|
260
|
+
if (mutationDebounceRef.current) clearTimeout(mutationDebounceRef.current);
|
|
261
|
+
if (bridgeSyncDebounceRef.current) clearTimeout(bridgeSyncDebounceRef.current);
|
|
262
|
+
};
|
|
263
|
+
}, []);
|
|
264
|
+
const bridgeFetch = (url, init) => {
|
|
265
|
+
const controller = new AbortController();
|
|
266
|
+
bridgeRequestsRef.current.add(controller);
|
|
267
|
+
return fetch(url, { ...init, signal: controller.signal }).finally(() => bridgeRequestsRef.current.delete(controller));
|
|
268
|
+
};
|
|
269
|
+
const laterIfMounted = (fn, ms) => setTimeout(() => {
|
|
270
|
+
if (aliveRef.current) fn();
|
|
271
|
+
}, ms);
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
setMounted(true);
|
|
274
|
+
preloadGoogleFontsBundle();
|
|
275
|
+
loadGoogleFont("Rethink Sans");
|
|
276
|
+
loadGoogleFont("Inter");
|
|
277
|
+
}, []);
|
|
278
|
+
useEffect(() => {
|
|
279
|
+
try {
|
|
280
|
+
const saved = sessionStorage.getItem("shavin-inspector-corner") || localStorage.getItem("shavin-inspector-corner");
|
|
281
|
+
if (saved && CORNER_STYLES[saved]) {
|
|
282
|
+
setCorner(saved);
|
|
283
|
+
}
|
|
284
|
+
} catch {
|
|
285
|
+
}
|
|
286
|
+
}, []);
|
|
287
|
+
const addStreamEvent = useCallback((evt) => {
|
|
288
|
+
const newEvt = {
|
|
289
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
290
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
|
|
291
|
+
...evt
|
|
292
|
+
};
|
|
293
|
+
setStreamEvents((prev) => [newEvt, ...prev].slice(0, 60));
|
|
294
|
+
}, []);
|
|
295
|
+
const isExcludedNode = (node) => {
|
|
296
|
+
if (!node || node.nodeType !== Node.ELEMENT_NODE) return true;
|
|
297
|
+
const html = node;
|
|
298
|
+
if (html.closest(".shavin-dev-tools-root")) return true;
|
|
299
|
+
if (html.closest("[data-shavin-inspector]")) return true;
|
|
300
|
+
if (html.closest("[data-radix-popper-content-wrapper]")) return true;
|
|
301
|
+
if (html.closest("#shavin-audit-focus-beacon") || html.id === "shavin-audit-focus-beacon") return true;
|
|
302
|
+
if (html.getAttribute("aria-hidden") === "true") return true;
|
|
303
|
+
return false;
|
|
304
|
+
};
|
|
305
|
+
const isSwatchElement = (el) => {
|
|
306
|
+
if (!el || el.nodeType !== Node.ELEMENT_NODE) return false;
|
|
307
|
+
if (el.tagName === "INPUT") return true;
|
|
308
|
+
if (el.closest(".shavin-dev-tools-root")) return true;
|
|
309
|
+
if (el.getAttribute("data-swatch") === "true" || el.closest("[data-swatch='true']") || el.closest("[data-swatch]")) return true;
|
|
310
|
+
if (el.getAttribute("data-overlay") === "true" || el.closest("[data-overlay='true']") || el.closest("[data-overlay]")) return true;
|
|
311
|
+
if (el.getAttribute("data-gradient") === "true" || el.closest("[data-gradient='true']") || el.closest("[data-gradient]")) return true;
|
|
312
|
+
if (el.getAttribute("data-scope-theme") === "true" || el.closest("[data-scope-theme='true']") || el.closest("[data-scope-theme]")) return true;
|
|
313
|
+
if (el.closest("[data-color-picker]") || el.closest("[data-configurator]") || el.closest("#shavin-configurator") || el.closest(".shavin-configurator")) return true;
|
|
314
|
+
const btn = el.closest("button, label, [role='option'], [role='tab'], [role='button']");
|
|
315
|
+
const aria = (el.getAttribute("aria-label") || btn?.getAttribute("aria-label") || "").toLowerCase();
|
|
316
|
+
const title = (el.getAttribute("title") || btn?.getAttribute("title") || "").toLowerCase();
|
|
317
|
+
if (aria.includes("color") || aria.includes("brand") || aria.includes("gray") || aria.includes("swatch") || aria.includes("theme") || aria.startsWith("select ") || title.includes("color") || title.includes("brand") || title.includes("gray") || title.includes("swatch") || title.includes("theme") || title.startsWith("select ")) {
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
if (el.closest(".color-picker, .theme-picker, .palette-picker, [data-palette], [data-scale-grid], [data-color-doc], [data-color-demo], [data-swatches]")) return true;
|
|
321
|
+
return false;
|
|
322
|
+
};
|
|
323
|
+
const getComponentContext = (el) => {
|
|
324
|
+
const directComp = el.getAttribute("data-component") || el.getAttribute("data-slot");
|
|
325
|
+
if (directComp) return directComp;
|
|
326
|
+
const switchRoot = el.closest('[role="switch"]');
|
|
327
|
+
if (switchRoot || el.getAttribute("role") === "switch") {
|
|
328
|
+
if (el.tagName === "SPAN" || el.classList.contains("block")) {
|
|
329
|
+
return "Switch > Thumb";
|
|
330
|
+
}
|
|
331
|
+
return "Switch";
|
|
332
|
+
}
|
|
333
|
+
const dialogParent = el.closest('[role="dialog"]');
|
|
334
|
+
if (dialogParent) {
|
|
335
|
+
const heading = dialogParent.querySelector('h2, h3, [data-slot="title"]')?.textContent?.trim().slice(0, 15);
|
|
336
|
+
return `Dialog${heading ? ` [${heading}...]` : ""} > ${el.tagName.toLowerCase()}`;
|
|
337
|
+
}
|
|
338
|
+
const btnParent = el.closest("button") || (el.tagName === "BUTTON" ? el : null);
|
|
339
|
+
if (btnParent) {
|
|
340
|
+
const btnText = btnParent.textContent?.trim().slice(0, 16);
|
|
341
|
+
return `Button${btnText ? ` [${btnText}]` : ""}${el !== btnParent ? ` > ${el.tagName.toLowerCase()}` : ""}`;
|
|
342
|
+
}
|
|
343
|
+
const tabParent = el.closest('[role="tab"]');
|
|
344
|
+
if (tabParent) {
|
|
345
|
+
const tabText = tabParent.textContent?.trim().slice(0, 16);
|
|
346
|
+
return `Tab${tabText ? ` [${tabText}]` : ""}`;
|
|
347
|
+
}
|
|
348
|
+
const compAncestor = el.parentElement?.closest("[data-component]");
|
|
349
|
+
if (compAncestor) {
|
|
350
|
+
const compName = compAncestor.getAttribute("data-component");
|
|
351
|
+
return `${compName} > ${el.tagName.toLowerCase()}${el.id ? `#${el.id}` : ""}`;
|
|
352
|
+
}
|
|
353
|
+
const sectionAncestor = el.closest("section[id], section, header, footer, nav, aside, main");
|
|
354
|
+
const sectionTag = sectionAncestor ? sectionAncestor.id ? `#${sectionAncestor.id}` : sectionAncestor.tagName.toLowerCase() : "";
|
|
355
|
+
const tag = el.tagName.toLowerCase();
|
|
356
|
+
const id = el.id ? `#${el.id}` : "";
|
|
357
|
+
const directText = el.childNodes.length === 1 && el.childNodes[0].nodeType === Node.TEXT_NODE ? el.textContent?.trim().slice(0, 18) : "";
|
|
358
|
+
const textLabel = directText ? ` [${directText}]` : "";
|
|
359
|
+
if (sectionTag) {
|
|
360
|
+
return `${sectionTag} > ${tag}${id}${textLabel}`;
|
|
361
|
+
}
|
|
362
|
+
return `${tag}${id}${textLabel}`;
|
|
363
|
+
};
|
|
364
|
+
const runLiveAudit = useCallback(() => {
|
|
365
|
+
if (typeof document === "undefined") return;
|
|
366
|
+
const issues = [];
|
|
367
|
+
const TW_COLORS = [
|
|
368
|
+
"slate",
|
|
369
|
+
"gray",
|
|
370
|
+
"zinc",
|
|
371
|
+
"neutral",
|
|
372
|
+
"stone",
|
|
373
|
+
"red",
|
|
374
|
+
"orange",
|
|
375
|
+
"amber",
|
|
376
|
+
"yellow",
|
|
377
|
+
"lime",
|
|
378
|
+
"green",
|
|
379
|
+
"emerald",
|
|
380
|
+
"teal",
|
|
381
|
+
"cyan",
|
|
382
|
+
"sky",
|
|
383
|
+
"blue",
|
|
384
|
+
"indigo",
|
|
385
|
+
"violet",
|
|
386
|
+
"purple",
|
|
387
|
+
"fuchsia",
|
|
388
|
+
"pink",
|
|
389
|
+
"rose"
|
|
390
|
+
];
|
|
391
|
+
const TW_COLOR_PREFIXES = ["bg-", "text-", "border-", "ring-", "fill-", "stroke-", "from-", "to-", "via-"];
|
|
392
|
+
const twPaletteRe = new RegExp(
|
|
393
|
+
`(?:^|\\s)((?:${TW_COLOR_PREFIXES.join("|")})(?:${TW_COLORS.join("|")})(?:-\\d{2,4})?|(?:bg|text|border)-(?:white|black))(?:\\s|$)`,
|
|
394
|
+
"g"
|
|
395
|
+
);
|
|
396
|
+
const arbitraryColorRe = /(?:^|\s)((?:bg|text|border|ring)-\[(?:#[0-9a-fA-F]{3,8}|rgba?\(.+?\)|hsla?\(.+?\)|[a-zA-Z]+)\])(?:\s|$)/g;
|
|
397
|
+
const arbitraryRadiusRe = /rounded-\[\d+(?:\.\d+)?px\]/;
|
|
398
|
+
const RAW_SHADOWS = ["shadow-sm", "shadow", "shadow-md", "shadow-lg", "shadow-xl", "shadow-2xl"];
|
|
399
|
+
const nVarRe = /var\(--n-/;
|
|
400
|
+
const fontSizeRe = /font-size\s*:\s*\d+(\.\d+)?px/i;
|
|
401
|
+
const allElements = document.body.querySelectorAll("*");
|
|
402
|
+
allElements.forEach((el, idx) => {
|
|
403
|
+
if (isExcludedNode(el)) return;
|
|
404
|
+
const htmlEl = el;
|
|
405
|
+
const selector = getComponentContext(htmlEl);
|
|
406
|
+
const classStr = typeof htmlEl.className === "string" ? htmlEl.className : "";
|
|
407
|
+
const styleAttr = htmlEl.getAttribute("style") || "";
|
|
408
|
+
const isSwatch = isSwatchElement(htmlEl);
|
|
409
|
+
const inlineColor = htmlEl.style?.color?.trim();
|
|
410
|
+
if (!isSwatch && inlineColor && !inlineColor.includes("var(") && !["inherit", "currentcolor", "transparent", "initial", "unset", ""].includes(inlineColor.toLowerCase())) {
|
|
411
|
+
issues.push({
|
|
412
|
+
id: `color-${idx}`,
|
|
413
|
+
category: "Token Purity",
|
|
414
|
+
severity: "error",
|
|
415
|
+
selector,
|
|
416
|
+
detail: `Hardcoded text color "${inlineColor}" in inline style \u2014 use semantic token (e.g. text-fg, text-fg-subtle, text-brand-text)`,
|
|
417
|
+
domNode: htmlEl
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
const inlineBg = htmlEl.style?.backgroundColor?.trim() || htmlEl.style?.background?.trim();
|
|
421
|
+
if (!isSwatch && inlineBg && !inlineBg.includes("var(") && !["inherit", "currentcolor", "transparent", "initial", "unset", "none", ""].includes(inlineBg.toLowerCase())) {
|
|
422
|
+
issues.push({
|
|
423
|
+
id: `bg-${idx}`,
|
|
424
|
+
category: "Token Purity",
|
|
425
|
+
severity: "error",
|
|
426
|
+
selector,
|
|
427
|
+
detail: `Hardcoded background "${inlineBg}" in inline style \u2014 use semantic token (e.g. bg-surface, bg-canvas)`,
|
|
428
|
+
domNode: htmlEl
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
const inlineBorder = htmlEl.style?.borderColor?.trim();
|
|
432
|
+
if (!isSwatch && inlineBorder && !inlineBorder.includes("var(") && !["inherit", "currentcolor", "transparent", "initial", "unset", ""].includes(inlineBorder.toLowerCase())) {
|
|
433
|
+
issues.push({
|
|
434
|
+
id: `border-${idx}`,
|
|
435
|
+
category: "Token Purity",
|
|
436
|
+
severity: "error",
|
|
437
|
+
selector,
|
|
438
|
+
detail: `Hardcoded border color "${inlineBorder}" in inline style \u2014 use border-hairline or border-hairline-strong`,
|
|
439
|
+
domNode: htmlEl
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
if (!isSwatch && styleAttr) {
|
|
443
|
+
const nonCustomPropertyWithNVar = /(?:^|;)\s*(?!--)[a-zA-Z-]+:\s*[^;]*var\(--n-/;
|
|
444
|
+
if (nonCustomPropertyWithNVar.test(styleAttr)) {
|
|
445
|
+
issues.push({
|
|
446
|
+
id: `nvar-${idx}`,
|
|
447
|
+
category: "Token Purity",
|
|
448
|
+
severity: "error",
|
|
449
|
+
selector,
|
|
450
|
+
detail: `Foundation --n-* variable in inline style \u2014 use semantic token (e.g. bg-surface, text-fg)`,
|
|
451
|
+
domNode: htmlEl
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (!isSwatch && classStr) {
|
|
456
|
+
twPaletteRe.lastIndex = 0;
|
|
457
|
+
const paletteMatches = [];
|
|
458
|
+
let m;
|
|
459
|
+
while ((m = twPaletteRe.exec(" " + classStr + " ")) !== null) {
|
|
460
|
+
paletteMatches.push(m[1]);
|
|
461
|
+
}
|
|
462
|
+
if (paletteMatches.length > 0) {
|
|
463
|
+
issues.push({
|
|
464
|
+
id: `tw-${idx}`,
|
|
465
|
+
category: "Semantic Tokens",
|
|
466
|
+
severity: "warning",
|
|
467
|
+
selector,
|
|
468
|
+
detail: `Non-semantic Tailwind palette class${paletteMatches.length > 1 ? "es" : ""}: ${paletteMatches.slice(0, 3).join(", ")}${paletteMatches.length > 3 ? " \u2026" : ""}`,
|
|
469
|
+
domNode: htmlEl
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
arbitraryColorRe.lastIndex = 0;
|
|
473
|
+
const arbMatches = [];
|
|
474
|
+
const nVarArbMatches = [];
|
|
475
|
+
let am;
|
|
476
|
+
while ((am = arbitraryColorRe.exec(" " + classStr + " ")) !== null) {
|
|
477
|
+
const match = am[1];
|
|
478
|
+
if (/var\(--n-/.test(match)) {
|
|
479
|
+
nVarArbMatches.push(match);
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
const hasSemanticVar = /var\(--(?!n-)[a-zA-Z0-9_-]+\)/.test(match);
|
|
483
|
+
if (!hasSemanticVar) {
|
|
484
|
+
arbMatches.push(match);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
if (nVarArbMatches.length > 0) {
|
|
488
|
+
issues.push({
|
|
489
|
+
id: `nvar-class-${idx}`,
|
|
490
|
+
category: "Token Purity",
|
|
491
|
+
severity: "error",
|
|
492
|
+
selector,
|
|
493
|
+
detail: `Foundation --n-* variable in utility class: ${nVarArbMatches.join(", ")} \u2014 use semantic token (e.g. bg-surface, text-fg)`,
|
|
494
|
+
domNode: htmlEl
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
if (arbMatches.length > 0) {
|
|
498
|
+
issues.push({
|
|
499
|
+
id: `arb-color-${idx}`,
|
|
500
|
+
category: "Token Purity",
|
|
501
|
+
severity: "error",
|
|
502
|
+
selector,
|
|
503
|
+
detail: `Arbitrary color utility${arbMatches.length > 1 ? "es" : ""}: ${arbMatches.join(", ")} \u2014 use semantic token`,
|
|
504
|
+
domNode: htmlEl
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (classStr && arbitraryRadiusRe.test(classStr)) {
|
|
509
|
+
const match = classStr.match(arbitraryRadiusRe);
|
|
510
|
+
issues.push({
|
|
511
|
+
id: `rad-${idx}`,
|
|
512
|
+
category: "Concentric Radius",
|
|
513
|
+
severity: "error",
|
|
514
|
+
selector,
|
|
515
|
+
detail: `Arbitrary radius "${match ? match[0] : ""}" \u2014 use rounded-[var(--radius-panel)] or rounded-[var(--radius-lg)]`,
|
|
516
|
+
domNode: htmlEl
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
if (classStr) {
|
|
520
|
+
const badShadow = RAW_SHADOWS.find((s) => {
|
|
521
|
+
const re = new RegExp(`(?:^|\\s)${s.replace("-", "\\-")}(?:\\s|$)`);
|
|
522
|
+
return re.test(classStr);
|
|
523
|
+
});
|
|
524
|
+
if (badShadow) {
|
|
525
|
+
issues.push({
|
|
526
|
+
id: `shadow-${idx}`,
|
|
527
|
+
category: "Surface Elevation",
|
|
528
|
+
severity: "warning",
|
|
529
|
+
selector,
|
|
530
|
+
detail: `Raw shadow "${badShadow}" \u2014 use shadow-card, shadow-modal, or data-panel attribute`,
|
|
531
|
+
domNode: htmlEl
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (styleAttr && fontSizeRe.test(styleAttr)) {
|
|
536
|
+
const match = styleAttr.match(fontSizeRe);
|
|
537
|
+
issues.push({
|
|
538
|
+
id: `fs-${idx}`,
|
|
539
|
+
category: "Typography Scale",
|
|
540
|
+
severity: "warning",
|
|
541
|
+
selector,
|
|
542
|
+
detail: `Hardcoded ${match ? match[0].replace(/\s/g, "") : "font-size:Npx"} \u2014 use Text size prop or typography token`,
|
|
543
|
+
domNode: htmlEl
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
try {
|
|
548
|
+
const sheets = Array.from(document.styleSheets);
|
|
549
|
+
sheets.forEach((sheet, sheetIdx) => {
|
|
550
|
+
const ownerNode = sheet.ownerNode;
|
|
551
|
+
if (ownerNode?.id === "shavin-audit-highlight-styles" || ownerNode?.closest?.(".shavin-dev-tools-root")) return;
|
|
552
|
+
let rules = null;
|
|
553
|
+
try {
|
|
554
|
+
rules = sheet.cssRules;
|
|
555
|
+
} catch {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
if (!rules) return;
|
|
559
|
+
const href = sheet.href || "";
|
|
560
|
+
if (href.includes("fonts.googleapis") || href.includes("lucide") || href.includes("phosphor") || href.includes("chrome-extension")) return;
|
|
561
|
+
for (let rIdx = 0; rIdx < rules.length; rIdx++) {
|
|
562
|
+
const rule = rules[rIdx];
|
|
563
|
+
if (!(rule instanceof CSSStyleRule)) continue;
|
|
564
|
+
const sel = rule.selectorText?.trim();
|
|
565
|
+
if (!sel) continue;
|
|
566
|
+
if (sel.includes("*") || sel.includes("::before") || sel.includes("::after") || sel.startsWith("::") || sel === "html" || sel === "body" || sel === ":root" || sel === ".dark" || sel === ".light" || sel === ":root, .light" || sel.startsWith("::backdrop")) {
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
if (sel.includes("shavin-") || sel.includes("[data-radix-") || sel.includes("nextjs") || sel.includes("__next")) continue;
|
|
570
|
+
if (sel.includes("\\:") || sel.includes("\\[") || sel.includes("\\]") || sel.includes("\\/") || /^\s*\.(?:ring|shadow|inset|outline|brand|caret|fill|stroke|rounded|bg|text|border|p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|w|h|max|min|flex|grid|col|row|gap|space|items|justify|self|place|order|float|clear|box|display|table|caption|inline|block|hidden|visible|invisible|static|fixed|absolute|relative|sticky|top|bottom|left|right|z|overflow|overscroll|scroll|truncate|font|tracking|leading|list|align|whitespace|break|hyphens|content|transition|duration|ease|delay|animate|transform|scale|rotate|translate|skew|origin|opacity|blend|blur|brightness|contrast|drop|grayscale|hue|invert|saturate|sepia|filter|backdrop|cursor|select|resize|snap|touch|pointer|will)-/.test(sel) || /^\s*\.(?:flex|grid|block|inline|hidden|relative|absolute|fixed|sticky|truncate|italic|underline|uppercase|lowercase|capitalize|antialiased)\b/.test(sel)) {
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
const isClassOrId = /(?:^|\s+)[.#][a-zA-Z0-9_-]+/.test(sel);
|
|
574
|
+
if (!isClassOrId) continue;
|
|
575
|
+
const style = rule.style;
|
|
576
|
+
if (!style || !style.length) continue;
|
|
577
|
+
const reportRuleViolation = (category, detail, severity, baseId) => {
|
|
578
|
+
try {
|
|
579
|
+
const matchedElements = document.querySelectorAll(sel);
|
|
580
|
+
if (matchedElements.length > 0) {
|
|
581
|
+
matchedElements.forEach((mEl, mIdx) => {
|
|
582
|
+
if (isExcludedNode(mEl) || isSwatchElement(mEl)) return;
|
|
583
|
+
const compCtx = getComponentContext(mEl);
|
|
584
|
+
issues.push({
|
|
585
|
+
id: `${baseId}-${mIdx}`,
|
|
586
|
+
category,
|
|
587
|
+
severity,
|
|
588
|
+
selector: `${compCtx} (via ${sel})`,
|
|
589
|
+
detail,
|
|
590
|
+
domNode: mEl
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
} catch {
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
const ruleCss = style.cssText || "";
|
|
598
|
+
if (nVarRe.test(ruleCss)) {
|
|
599
|
+
reportRuleViolation(
|
|
600
|
+
"Token Purity",
|
|
601
|
+
`CSS rule "${sel}" references foundation --n-* variable \u2014 use semantic token (e.g. var(--bg-surface), var(--fg))`,
|
|
602
|
+
"error",
|
|
603
|
+
`css-nvar-${sheetIdx}-${rIdx}`
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
const col = style.getPropertyValue("color")?.trim();
|
|
607
|
+
if (col && !col.includes("var(--") && !["inherit", "currentcolor", "transparent", "initial", "unset", ""].includes(col.toLowerCase())) {
|
|
608
|
+
if (col.includes("#") || col.startsWith("rgb") || col.startsWith("hsl") || /^[a-zA-Z]+$/.test(col)) {
|
|
609
|
+
reportRuleViolation(
|
|
610
|
+
"Token Purity",
|
|
611
|
+
`Hardcoded color "${col}" in CSS rule "${sel}" \u2014 use semantic token (e.g. var(--fg), var(--fg-subtle))`,
|
|
612
|
+
"error",
|
|
613
|
+
`css-col-${sheetIdx}-${rIdx}`
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const bg = style.getPropertyValue("background-color")?.trim() || style.getPropertyValue("background")?.trim();
|
|
618
|
+
if (bg && !bg.includes("var(--") && !["inherit", "currentcolor", "transparent", "initial", "unset", "none", ""].includes(bg.toLowerCase())) {
|
|
619
|
+
if (bg.includes("#") || bg.startsWith("rgb") || bg.startsWith("hsl")) {
|
|
620
|
+
reportRuleViolation(
|
|
621
|
+
"Token Purity",
|
|
622
|
+
`Hardcoded background "${bg}" in CSS rule "${sel}" \u2014 use semantic token (e.g. var(--bg-surface), var(--bg-canvas))`,
|
|
623
|
+
"error",
|
|
624
|
+
`css-bg-${sheetIdx}-${rIdx}`
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
const borderCol = style.getPropertyValue("border-color")?.trim();
|
|
629
|
+
if (borderCol && !borderCol.includes("var(--") && !["inherit", "currentcolor", "transparent", "initial", "unset", ""].includes(borderCol.toLowerCase())) {
|
|
630
|
+
if (borderCol.includes("#") || borderCol.startsWith("rgb") || borderCol.startsWith("hsl")) {
|
|
631
|
+
reportRuleViolation(
|
|
632
|
+
"Token Purity",
|
|
633
|
+
`Hardcoded border color "${borderCol}" in CSS rule "${sel}" \u2014 use var(--hairline) or var(--hairline-strong)`,
|
|
634
|
+
"error",
|
|
635
|
+
`css-bdr-${sheetIdx}-${rIdx}`
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
const radius = style.getPropertyValue("border-radius")?.trim();
|
|
640
|
+
if (radius && !radius.includes("var(--radius-") && !["inherit", "initial", "unset", "0", "0px", "9999px", "999px", ""].includes(radius.toLowerCase())) {
|
|
641
|
+
if (/\d+px/.test(radius)) {
|
|
642
|
+
reportRuleViolation(
|
|
643
|
+
"Concentric Radius",
|
|
644
|
+
`Hardcoded radius "${radius}" in CSS rule "${sel}" \u2014 use var(--radius-panel) or var(--radius-lg)`,
|
|
645
|
+
"error",
|
|
646
|
+
`css-rad-${sheetIdx}-${rIdx}`
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
const shadow = style.getPropertyValue("box-shadow")?.trim();
|
|
651
|
+
if (shadow && !shadow.includes("var(--shadow-") && !["none", "inherit", "initial", "unset", ""].includes(shadow.toLowerCase())) {
|
|
652
|
+
reportRuleViolation(
|
|
653
|
+
"Surface Elevation",
|
|
654
|
+
`Hardcoded box-shadow in CSS rule "${sel}" \u2014 use var(--shadow-card), var(--shadow-panel), or var(--shadow-modal)`,
|
|
655
|
+
"warning",
|
|
656
|
+
`css-shadow-${sheetIdx}-${rIdx}`
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
} catch {
|
|
662
|
+
}
|
|
663
|
+
const newSig = issues.map((i) => `${i.id}:${i.category}:${i.detail}:${i.selector}`).join("|");
|
|
664
|
+
if (newSig !== lastAuditSigRef.current) {
|
|
665
|
+
lastAuditSigRef.current = newSig;
|
|
666
|
+
setAuditIssues(issues);
|
|
667
|
+
setAuditTimestamp((/* @__PURE__ */ new Date()).toLocaleTimeString());
|
|
668
|
+
}
|
|
669
|
+
if (typeof window !== "undefined") {
|
|
670
|
+
if (bridgeSyncDebounceRef.current) clearTimeout(bridgeSyncDebounceRef.current);
|
|
671
|
+
bridgeSyncDebounceRef.current = setTimeout(() => {
|
|
672
|
+
if (!aliveRef.current) return;
|
|
673
|
+
try {
|
|
674
|
+
const errCount = issues.filter((i) => i.severity === "error").length;
|
|
675
|
+
const warnCount = issues.filter((i) => i.severity === "warning").length;
|
|
676
|
+
const hooks = domHooks(document);
|
|
677
|
+
const scanned = inspectDocument({ consoleErrors: consoleCaptureRef.current?.errors() ?? [] });
|
|
678
|
+
const fromTokens = tokenFindings(
|
|
679
|
+
issues.map((i) => ({ category: i.category, severity: i.severity, detail: i.detail, node: i.domNode })),
|
|
680
|
+
{
|
|
681
|
+
selectorOf: (n) => hooks.selectorOf(n),
|
|
682
|
+
contextOf: (n) => hooks.contextOf(n),
|
|
683
|
+
scroll: { x: window.scrollX, y: window.scrollY }
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
const ranked = rankFindings([...scanned.findings, ...fromTokens]);
|
|
687
|
+
setInspectorFindings(
|
|
688
|
+
(prev) => prev.length === ranked.findings.length && prev.every((f, i) => f.id === ranked.findings[i].id && f.severity === ranked.findings[i].severity) ? prev : ranked.findings
|
|
689
|
+
);
|
|
690
|
+
const ignoredIds = loadIgnored();
|
|
691
|
+
const payload = {
|
|
692
|
+
url: window.location.href,
|
|
693
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
694
|
+
findings: ranked.findings.map((f) => ignoredIds.has(f.id) ? { ...f, ignored: true } : f),
|
|
695
|
+
findingStats: { ...countFindings(ranked.findings, ignoredIds), dropped: ranked.dropped + scanned.dropped },
|
|
696
|
+
stats: {
|
|
697
|
+
total: issues.length,
|
|
698
|
+
errors: errCount,
|
|
699
|
+
warnings: warnCount,
|
|
700
|
+
clean: issues.length === 0
|
|
701
|
+
},
|
|
702
|
+
issues: issues.map((iss) => {
|
|
703
|
+
const el = iss.domNode;
|
|
704
|
+
return {
|
|
705
|
+
id: iss.id,
|
|
706
|
+
category: iss.category,
|
|
707
|
+
severity: iss.severity,
|
|
708
|
+
selector: iss.selector,
|
|
709
|
+
detail: iss.detail,
|
|
710
|
+
classes: el && typeof el.className === "string" ? el.className : "",
|
|
711
|
+
style: el?.getAttribute("style") || ""
|
|
712
|
+
};
|
|
713
|
+
}),
|
|
714
|
+
project: typeof document !== "undefined" && document.title ? document.title.split("\u2014")[0].trim() : "App",
|
|
715
|
+
origin: typeof window !== "undefined" ? window.location.origin : "http://localhost:3100",
|
|
716
|
+
pathname: typeof window !== "undefined" ? window.location.pathname : "/",
|
|
717
|
+
tabId: typeof window !== "undefined" ? sessionStorage.getItem("__shavin_tab_id") || (() => {
|
|
718
|
+
const id = `tab_${Math.random().toString(36).slice(2, 9)}`;
|
|
719
|
+
try {
|
|
720
|
+
sessionStorage.setItem("__shavin_tab_id", id);
|
|
721
|
+
} catch {
|
|
722
|
+
}
|
|
723
|
+
return id;
|
|
724
|
+
})() : "default",
|
|
725
|
+
browser: detectBrowserName(),
|
|
726
|
+
title: typeof document !== "undefined" ? document.title : "",
|
|
727
|
+
theme: {
|
|
728
|
+
dark: document.documentElement.classList.contains("dark"),
|
|
729
|
+
brand: brandName,
|
|
730
|
+
gray: grayName,
|
|
731
|
+
radius: radiusName
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
bridgeFetch(bridgeUrl("/api/audit", bPort), {
|
|
735
|
+
method: "POST",
|
|
736
|
+
headers: { "Content-Type": "application/json" },
|
|
737
|
+
body: JSON.stringify(payload),
|
|
738
|
+
mode: "cors"
|
|
739
|
+
}).then((res) => {
|
|
740
|
+
if (!aliveRef.current) return;
|
|
741
|
+
if (res.ok) {
|
|
742
|
+
setBridgeConnected(true);
|
|
743
|
+
addStreamEvent({
|
|
744
|
+
type: "audit_sync",
|
|
745
|
+
direction: "out",
|
|
746
|
+
summary: payload.stats.clean ? "DOM audit clean \u2014 0 design token violations" : `Synced ${payload.stats.total} DOM issue${payload.stats.total !== 1 ? "s" : ""} (${payload.stats.errors} err, ${payload.stats.warnings} warn) to AI Bridge`,
|
|
747
|
+
data: payload
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
}).catch(() => {
|
|
751
|
+
if (aliveRef.current) setBridgeConnected(false);
|
|
752
|
+
});
|
|
753
|
+
} catch {
|
|
754
|
+
}
|
|
755
|
+
}, 300);
|
|
756
|
+
}
|
|
757
|
+
}, [brandName, grayName, radiusName, addStreamEvent]);
|
|
758
|
+
const handleTriggerRescan = useCallback(async () => {
|
|
759
|
+
setTriggeringRescan(true);
|
|
760
|
+
try {
|
|
761
|
+
addStreamEvent({
|
|
762
|
+
type: "rescan_trigger",
|
|
763
|
+
direction: "out",
|
|
764
|
+
summary: "Requested full DOM audit re-scan"
|
|
765
|
+
});
|
|
766
|
+
const res = await bridgeFetch(bridgeUrl("/api/rescan", bPort), {
|
|
767
|
+
method: "POST",
|
|
768
|
+
mode: "cors"
|
|
769
|
+
});
|
|
770
|
+
if (res.ok && aliveRef.current) {
|
|
771
|
+
runLiveAudit();
|
|
772
|
+
}
|
|
773
|
+
} catch {
|
|
774
|
+
} finally {
|
|
775
|
+
laterIfMounted(() => setTriggeringRescan(false), 400);
|
|
776
|
+
}
|
|
777
|
+
}, [addStreamEvent, runLiveAudit]);
|
|
778
|
+
const fetchSourceWarnings = useCallback(async () => {
|
|
779
|
+
setSourceAuditLoading(true);
|
|
780
|
+
setSourceAuditError(null);
|
|
781
|
+
try {
|
|
782
|
+
const res = await bridgeFetch(bridgeUrl("/api/source-audit", bPort), {
|
|
783
|
+
method: "GET",
|
|
784
|
+
mode: "cors"
|
|
785
|
+
});
|
|
786
|
+
if (!aliveRef.current) return;
|
|
787
|
+
if (res.ok) {
|
|
788
|
+
const data = await res.json();
|
|
789
|
+
if (!aliveRef.current) return;
|
|
790
|
+
setSourceWarnings(data.issues || []);
|
|
791
|
+
setSourceAuditTimestamp((/* @__PURE__ */ new Date()).toLocaleTimeString());
|
|
792
|
+
addStreamEvent({
|
|
793
|
+
type: "source_audit",
|
|
794
|
+
direction: "in",
|
|
795
|
+
summary: data.summary?.totalWarnings > 0 ? `Source audit: ${data.summary.totalWarnings} warnings across ${data.summary.filesWithIssues}/${data.summary.filesScanned} files` : `Source audit clean \u2014 0 architecture warnings`
|
|
796
|
+
});
|
|
797
|
+
} else {
|
|
798
|
+
setSourceAuditError("Bridge returned an error");
|
|
799
|
+
}
|
|
800
|
+
} catch {
|
|
801
|
+
if (aliveRef.current) setSourceAuditError(`Cannot reach AI Bridge (:${bPort}). Start it with: npx @shavin/cli bridge`);
|
|
802
|
+
} finally {
|
|
803
|
+
if (aliveRef.current) setSourceAuditLoading(false);
|
|
804
|
+
}
|
|
805
|
+
}, [addStreamEvent]);
|
|
806
|
+
useEffect(() => {
|
|
807
|
+
if (!mounted || typeof window === "undefined" || typeof EventSource === "undefined") return;
|
|
808
|
+
let es = null;
|
|
809
|
+
let heartbeat = null;
|
|
810
|
+
let disposed = false;
|
|
811
|
+
try {
|
|
812
|
+
const myTabId = sessionStorage.getItem("__shavin_tab_id") || (() => {
|
|
813
|
+
const id = `tab_${Math.random().toString(36).slice(2, 9)}`;
|
|
814
|
+
try {
|
|
815
|
+
sessionStorage.setItem("__shavin_tab_id", id);
|
|
816
|
+
} catch {
|
|
817
|
+
}
|
|
818
|
+
return id;
|
|
819
|
+
})();
|
|
820
|
+
const myBrowser = detectBrowserName();
|
|
821
|
+
es = new EventSource(`${bridgeUrl("/api/events", bPort)}?tabId=${encodeURIComponent(myTabId)}&browser=${encodeURIComponent(myBrowser)}`);
|
|
822
|
+
es.onopen = () => {
|
|
823
|
+
if (disposed || !aliveRef.current) return;
|
|
824
|
+
setBridgeConnected(true);
|
|
825
|
+
addStreamEvent({
|
|
826
|
+
type: "sse_connected",
|
|
827
|
+
direction: "in",
|
|
828
|
+
summary: `Connected to local AI Bridge (:${bPort}) as [${myBrowser}] tab ${myTabId}`
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
es.onmessage = (event) => {
|
|
832
|
+
if (disposed || !aliveRef.current) return;
|
|
833
|
+
try {
|
|
834
|
+
const data = JSON.parse(event.data);
|
|
835
|
+
addStreamEvent({
|
|
836
|
+
type: data?.type || "sse_message",
|
|
837
|
+
direction: "in",
|
|
838
|
+
summary: data?.type === "request_rescan" ? "AI Agent requested fresh page inspection" : data?.type === "connected" ? `Bridge handshake established (${data?.snapshot?.connectedTabs || 1} tab${(data?.snapshot?.connectedTabs || 1) !== 1 ? "s" : ""} active)` : data?.type === "audit_update" ? "Live DOM state updated from browser scan" : `Event received: ${data?.type || "update"}`,
|
|
839
|
+
data
|
|
840
|
+
});
|
|
841
|
+
if (data?.type === "focus_tab") {
|
|
842
|
+
const curTabId = sessionStorage.getItem("__shavin_tab_id");
|
|
843
|
+
if (!data.targetTabId || data.targetTabId === curTabId) {
|
|
844
|
+
window.focus();
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
if (data?.type === "request_rescan") {
|
|
848
|
+
const curTabId = sessionStorage.getItem("__shavin_tab_id");
|
|
849
|
+
const myPath = window.location.pathname;
|
|
850
|
+
if (data.targetTabId && data.targetTabId !== curTabId) return;
|
|
851
|
+
if (data.targetPath && data.targetPath !== myPath && data.targetPath.replace(/\/$/, "") !== myPath.replace(/\/$/, "")) return;
|
|
852
|
+
runLiveAudit();
|
|
853
|
+
}
|
|
854
|
+
} catch {
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
es.onerror = () => {
|
|
858
|
+
if (disposed || !aliveRef.current) return;
|
|
859
|
+
setBridgeConnected(false);
|
|
860
|
+
};
|
|
861
|
+
heartbeat = setInterval(() => {
|
|
862
|
+
try {
|
|
863
|
+
fetch(bridgeUrl("/api/ping", bPort), {
|
|
864
|
+
method: "POST",
|
|
865
|
+
headers: { "Content-Type": "application/json" },
|
|
866
|
+
body: JSON.stringify({
|
|
867
|
+
tabId: myTabId,
|
|
868
|
+
browser: myBrowser,
|
|
869
|
+
url: window.location.href,
|
|
870
|
+
pathname: window.location.pathname,
|
|
871
|
+
title: document.title
|
|
872
|
+
}),
|
|
873
|
+
mode: "cors"
|
|
874
|
+
}).catch(() => {
|
|
875
|
+
});
|
|
876
|
+
} catch {
|
|
877
|
+
}
|
|
878
|
+
}, 15e3);
|
|
879
|
+
} catch {
|
|
880
|
+
}
|
|
881
|
+
return () => {
|
|
882
|
+
disposed = true;
|
|
883
|
+
if (heartbeat) clearInterval(heartbeat);
|
|
884
|
+
if (es) {
|
|
885
|
+
es.onopen = null;
|
|
886
|
+
es.onmessage = null;
|
|
887
|
+
es.onerror = null;
|
|
888
|
+
es.close();
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
}, [mounted, addStreamEvent, runLiveAudit]);
|
|
892
|
+
useEffect(() => {
|
|
893
|
+
if (typeof window === "undefined") return;
|
|
894
|
+
const handleTabUnload = () => {
|
|
895
|
+
try {
|
|
896
|
+
const tabId = sessionStorage.getItem("__shavin_tab_id");
|
|
897
|
+
if (tabId && navigator.sendBeacon) {
|
|
898
|
+
navigator.sendBeacon(
|
|
899
|
+
bridgeUrl("/api/disconnect", bPort),
|
|
900
|
+
new Blob([JSON.stringify({ tabId })], { type: "text/plain" })
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
} catch {
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
window.addEventListener("pagehide", handleTabUnload);
|
|
907
|
+
window.addEventListener("beforeunload", handleTabUnload);
|
|
908
|
+
return () => {
|
|
909
|
+
window.removeEventListener("pagehide", handleTabUnload);
|
|
910
|
+
window.removeEventListener("beforeunload", handleTabUnload);
|
|
911
|
+
};
|
|
912
|
+
}, []);
|
|
913
|
+
useEffect(() => {
|
|
914
|
+
if (mounted) {
|
|
915
|
+
const timer = setTimeout(() => {
|
|
916
|
+
runLiveAudit();
|
|
917
|
+
}, 200);
|
|
918
|
+
return () => clearTimeout(timer);
|
|
919
|
+
}
|
|
920
|
+
}, [mounted, runLiveAudit]);
|
|
921
|
+
useEffect(() => {
|
|
922
|
+
if (open && tab === "audit" && mounted) {
|
|
923
|
+
runLiveAudit();
|
|
924
|
+
}
|
|
925
|
+
}, [open, tab, mounted, runLiveAudit]);
|
|
926
|
+
useEffect(() => {
|
|
927
|
+
const onChange = () => runLiveAudit();
|
|
928
|
+
window.addEventListener(IGNORED_EVENT, onChange);
|
|
929
|
+
window.addEventListener(RESCAN_EVENT, onChange);
|
|
930
|
+
return () => {
|
|
931
|
+
window.removeEventListener(IGNORED_EVENT, onChange);
|
|
932
|
+
window.removeEventListener(RESCAN_EVENT, onChange);
|
|
933
|
+
};
|
|
934
|
+
}, [runLiveAudit]);
|
|
935
|
+
const focusViolation = (issue) => {
|
|
936
|
+
try {
|
|
937
|
+
const el = issue.domNode || document.querySelector(issue.selector);
|
|
938
|
+
if (!el || typeof document === "undefined") return;
|
|
939
|
+
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
940
|
+
const existing = document.getElementById("shavin-audit-focus-beacon");
|
|
941
|
+
if (existing) existing.remove();
|
|
942
|
+
const rect = el.getBoundingClientRect();
|
|
943
|
+
const beacon = document.createElement("div");
|
|
944
|
+
beacon.id = "shavin-audit-focus-beacon";
|
|
945
|
+
beacon.style.position = "fixed";
|
|
946
|
+
beacon.style.top = `${rect.top}px`;
|
|
947
|
+
beacon.style.left = `${rect.left}px`;
|
|
948
|
+
beacon.style.width = `${rect.width}px`;
|
|
949
|
+
beacon.style.height = `${rect.height}px`;
|
|
950
|
+
beacon.style.pointerEvents = "none";
|
|
951
|
+
beacon.style.zIndex = "999999";
|
|
952
|
+
beacon.style.borderRadius = "var(--radius-panel, 8px)";
|
|
953
|
+
beacon.style.border = "3px solid rgb(var(--danger))";
|
|
954
|
+
beacon.style.boxShadow = "0 0 0 4px rgba(239, 68, 68, 0.35), 0 0 24px rgba(239, 68, 68, 0.5)";
|
|
955
|
+
beacon.style.transition = "all 0.25s cubic-bezier(0.16, 1, 0.3, 1)";
|
|
956
|
+
const badge = document.createElement("div");
|
|
957
|
+
badge.textContent = `\u26A0\uFE0F Focus: ${issue.selector}`;
|
|
958
|
+
badge.style.position = "absolute";
|
|
959
|
+
badge.style.top = "-24px";
|
|
960
|
+
badge.style.left = "0";
|
|
961
|
+
badge.style.background = "rgb(var(--danger))";
|
|
962
|
+
badge.style.color = "rgb(var(--danger-fg))";
|
|
963
|
+
badge.style.fontFamily = "monospace";
|
|
964
|
+
badge.style.fontSize = "11px";
|
|
965
|
+
badge.style.fontWeight = "bold";
|
|
966
|
+
badge.style.padding = "2px 6px";
|
|
967
|
+
badge.style.borderRadius = "4px";
|
|
968
|
+
badge.style.whiteSpace = "nowrap";
|
|
969
|
+
badge.style.boxShadow = "0 2px 8px rgba(0,0,0,0.3)";
|
|
970
|
+
beacon.appendChild(badge);
|
|
971
|
+
document.body.appendChild(beacon);
|
|
972
|
+
const updateBeaconPos = () => {
|
|
973
|
+
const updatedRect = el.getBoundingClientRect();
|
|
974
|
+
beacon.style.top = `${updatedRect.top}px`;
|
|
975
|
+
beacon.style.left = `${updatedRect.left}px`;
|
|
976
|
+
beacon.style.width = `${updatedRect.width}px`;
|
|
977
|
+
beacon.style.height = `${updatedRect.height}px`;
|
|
978
|
+
};
|
|
979
|
+
window.addEventListener("scroll", updateBeaconPos, { passive: true });
|
|
980
|
+
window.addEventListener("resize", updateBeaconPos, { passive: true });
|
|
981
|
+
el.animate(
|
|
982
|
+
[
|
|
983
|
+
{ outline: "3px solid rgb(var(--danger, 239 68 68))", transform: "scale(1.02)" },
|
|
984
|
+
{ outline: "2px dashed rgb(var(--danger, 239 68 68))", transform: "scale(1)" }
|
|
985
|
+
],
|
|
986
|
+
{ duration: 400, iterations: 3 }
|
|
987
|
+
);
|
|
988
|
+
setTimeout(() => {
|
|
989
|
+
if (typeof window !== "undefined") {
|
|
990
|
+
window.removeEventListener("scroll", updateBeaconPos);
|
|
991
|
+
window.removeEventListener("resize", updateBeaconPos);
|
|
992
|
+
}
|
|
993
|
+
beacon.style.opacity = "0";
|
|
994
|
+
setTimeout(() => beacon.remove(), 300);
|
|
995
|
+
}, 3500);
|
|
996
|
+
} catch {
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
useEffect(() => {
|
|
1000
|
+
if (typeof document === "undefined" || !mounted) return;
|
|
1001
|
+
const observer = new MutationObserver((mutations) => {
|
|
1002
|
+
const shouldIgnore = mutations.every((m) => {
|
|
1003
|
+
const target = m.target;
|
|
1004
|
+
if (!target) return true;
|
|
1005
|
+
if (target.id === "shavin-audit-highlight-style" || target.id === "shavin-audit-focus-beacon") return true;
|
|
1006
|
+
if (target.closest?.("#shavin-audit-focus-beacon")) return true;
|
|
1007
|
+
if (target.closest?.(".shavin-dev-tools-root")) return true;
|
|
1008
|
+
if (target.closest?.("[data-shavin-inspector]")) return true;
|
|
1009
|
+
if (target.closest?.("[data-radix-popper-content-wrapper]")) return true;
|
|
1010
|
+
return false;
|
|
1011
|
+
});
|
|
1012
|
+
if (shouldIgnore) return;
|
|
1013
|
+
if (mutationDebounceRef.current) clearTimeout(mutationDebounceRef.current);
|
|
1014
|
+
mutationDebounceRef.current = setTimeout(() => {
|
|
1015
|
+
if (aliveRef.current) runLiveAudit();
|
|
1016
|
+
}, 250);
|
|
1017
|
+
});
|
|
1018
|
+
observer.observe(document.body, {
|
|
1019
|
+
attributes: true,
|
|
1020
|
+
attributeFilter: ["class", "style", "data-theme", "id"],
|
|
1021
|
+
childList: true,
|
|
1022
|
+
subtree: true,
|
|
1023
|
+
characterData: true
|
|
1024
|
+
});
|
|
1025
|
+
return () => {
|
|
1026
|
+
observer.disconnect();
|
|
1027
|
+
if (mutationDebounceRef.current) clearTimeout(mutationDebounceRef.current);
|
|
1028
|
+
};
|
|
1029
|
+
}, [mounted, runLiveAudit]);
|
|
1030
|
+
const handlePointerDown = (e) => {
|
|
1031
|
+
if (open) return;
|
|
1032
|
+
pointerDownRef.current = {
|
|
1033
|
+
startX: e.clientX,
|
|
1034
|
+
startY: e.clientY,
|
|
1035
|
+
pointerId: e.pointerId,
|
|
1036
|
+
hasDragged: false
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
const handlePointerMove = (e) => {
|
|
1040
|
+
if (!pointerDownRef.current) return;
|
|
1041
|
+
const dx = Math.abs(e.clientX - pointerDownRef.current.startX);
|
|
1042
|
+
const dy = Math.abs(e.clientY - pointerDownRef.current.startY);
|
|
1043
|
+
if (!pointerDownRef.current.hasDragged && (dx > 4 || dy > 4)) {
|
|
1044
|
+
pointerDownRef.current.hasDragged = true;
|
|
1045
|
+
setIsDragging(true);
|
|
1046
|
+
try {
|
|
1047
|
+
e.currentTarget.setPointerCapture(pointerDownRef.current.pointerId);
|
|
1048
|
+
} catch {
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
if (pointerDownRef.current.hasDragged) {
|
|
1052
|
+
setDragOffset({ x: e.clientX, y: e.clientY });
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
const handlePointerUp = (e) => {
|
|
1056
|
+
if (!pointerDownRef.current) return;
|
|
1057
|
+
const { hasDragged, pointerId } = pointerDownRef.current;
|
|
1058
|
+
pointerDownRef.current = null;
|
|
1059
|
+
if (hasDragged) {
|
|
1060
|
+
try {
|
|
1061
|
+
e.currentTarget.releasePointerCapture(pointerId);
|
|
1062
|
+
} catch {
|
|
1063
|
+
}
|
|
1064
|
+
setIsDragging(false);
|
|
1065
|
+
setDragOffset(null);
|
|
1066
|
+
justDraggedRef.current = true;
|
|
1067
|
+
setTimeout(() => {
|
|
1068
|
+
justDraggedRef.current = false;
|
|
1069
|
+
}, 150);
|
|
1070
|
+
const x = e.clientX;
|
|
1071
|
+
const y = e.clientY;
|
|
1072
|
+
const w = window.innerWidth;
|
|
1073
|
+
const h = window.innerHeight;
|
|
1074
|
+
const dTL = Math.hypot(x - 20, y - 20);
|
|
1075
|
+
const dTR = Math.hypot(w - 20 - x, y - 20);
|
|
1076
|
+
const dBL = Math.hypot(x - 20, h - 20 - y);
|
|
1077
|
+
const dBR = Math.hypot(w - 20 - x, h - 20 - y);
|
|
1078
|
+
const min = Math.min(dTL, dTR, dBL, dBR);
|
|
1079
|
+
let closest = "bottom-left";
|
|
1080
|
+
if (min === dTL) closest = "top-left";
|
|
1081
|
+
else if (min === dTR) closest = "top-right";
|
|
1082
|
+
else if (min === dBL) closest = "bottom-left";
|
|
1083
|
+
else if (min === dBR) closest = "bottom-right";
|
|
1084
|
+
setCorner(closest);
|
|
1085
|
+
try {
|
|
1086
|
+
sessionStorage.setItem("shavin-inspector-corner", closest);
|
|
1087
|
+
localStorage.setItem("shavin-inspector-corner", closest);
|
|
1088
|
+
} catch {
|
|
1089
|
+
}
|
|
1090
|
+
} else {
|
|
1091
|
+
setIsDragging(false);
|
|
1092
|
+
setDragOffset(null);
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
const handlePopoverHeaderPointerDown = (e) => {
|
|
1096
|
+
if (e.target.closest("button, input, select, a, [role='button']")) return;
|
|
1097
|
+
e.preventDefault();
|
|
1098
|
+
e.stopPropagation();
|
|
1099
|
+
const target = e.currentTarget;
|
|
1100
|
+
const pointerId = e.pointerId;
|
|
1101
|
+
try {
|
|
1102
|
+
target.setPointerCapture(pointerId);
|
|
1103
|
+
} catch {
|
|
1104
|
+
}
|
|
1105
|
+
const startX = e.clientX;
|
|
1106
|
+
const startY = e.clientY;
|
|
1107
|
+
const initialX = popoverPos.x;
|
|
1108
|
+
const initialY = popoverPos.y;
|
|
1109
|
+
setIsPopoverDragging(true);
|
|
1110
|
+
const onPointerMove = (moveEvent) => {
|
|
1111
|
+
moveEvent.preventDefault();
|
|
1112
|
+
const dx = moveEvent.clientX - startX;
|
|
1113
|
+
const dy = moveEvent.clientY - startY;
|
|
1114
|
+
setPopoverPos({
|
|
1115
|
+
x: initialX + dx,
|
|
1116
|
+
y: initialY + dy
|
|
1117
|
+
});
|
|
1118
|
+
};
|
|
1119
|
+
const onPointerUp = () => {
|
|
1120
|
+
setIsPopoverDragging(false);
|
|
1121
|
+
try {
|
|
1122
|
+
target.releasePointerCapture(pointerId);
|
|
1123
|
+
} catch {
|
|
1124
|
+
}
|
|
1125
|
+
window.removeEventListener("pointermove", onPointerMove);
|
|
1126
|
+
window.removeEventListener("pointerup", onPointerUp);
|
|
1127
|
+
window.removeEventListener("pointercancel", onPointerUp);
|
|
1128
|
+
};
|
|
1129
|
+
window.addEventListener("pointermove", onPointerMove);
|
|
1130
|
+
window.addEventListener("pointerup", onPointerUp);
|
|
1131
|
+
window.addEventListener("pointercancel", onPointerUp);
|
|
1132
|
+
};
|
|
1133
|
+
const handleButtonClick = (e) => {
|
|
1134
|
+
if (justDraggedRef.current) {
|
|
1135
|
+
e.preventDefault();
|
|
1136
|
+
e.stopPropagation();
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
if (!open && auditIssues.length > 0) {
|
|
1140
|
+
setTab("audit");
|
|
1141
|
+
}
|
|
1142
|
+
setOpen((prev) => !prev);
|
|
1143
|
+
};
|
|
1144
|
+
const handleCopyToolCmd = (cmd, toolName) => {
|
|
1145
|
+
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
1146
|
+
navigator.clipboard.writeText(cmd);
|
|
1147
|
+
setCopiedTool(toolName);
|
|
1148
|
+
laterIfMounted(() => setCopiedTool(null), 2e3);
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
const copyIssueForAgent = (issue, e) => {
|
|
1152
|
+
if (e) e.stopPropagation();
|
|
1153
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
1154
|
+
const el = issue.domNode;
|
|
1155
|
+
const classes = el ? typeof el.className === "string" ? el.className.trim() : "" : "";
|
|
1156
|
+
const styleAttr = el?.getAttribute("style") || "";
|
|
1157
|
+
const promptText = [
|
|
1158
|
+
`[DS Violation] \`${issue.selector}\``,
|
|
1159
|
+
`\u2022 Rule: ${issue.category} (${issue.severity === "error" ? "ERR" : "WARN"})`,
|
|
1160
|
+
`\u2022 Issue: ${issue.detail}`,
|
|
1161
|
+
classes ? `\u2022 Class: \`${classes.length > 80 ? classes.slice(0, 80) + "..." : classes}\`` : null,
|
|
1162
|
+
styleAttr ? `\u2022 Style: \`${styleAttr}\`` : null,
|
|
1163
|
+
`\u2022 Fix: Replace with @shavin/ui semantic tokens (e.g. bg-surface, text-fg, border-hairline, shadow-card, rounded-[var(--radius-panel)]).`
|
|
1164
|
+
].filter(Boolean).join("\n");
|
|
1165
|
+
navigator.clipboard.writeText(promptText);
|
|
1166
|
+
setCopiedIssueId(issue.id);
|
|
1167
|
+
laterIfMounted(() => setCopiedIssueId(null), 2e3);
|
|
1168
|
+
};
|
|
1169
|
+
const copyAllIssuesForAgent = () => {
|
|
1170
|
+
if (typeof navigator === "undefined" || !navigator.clipboard || auditIssues.length === 0) return;
|
|
1171
|
+
const summaryRows = auditIssues.map((issue, i) => {
|
|
1172
|
+
return `| ${i + 1} | \`${issue.selector}\` | ${issue.category} | ${issue.severity === "error" ? "ERR" : "WARN"} | ${issue.detail} |`;
|
|
1173
|
+
}).join("\n");
|
|
1174
|
+
const fullPrompt = [
|
|
1175
|
+
`### @shavin/ui Audit (${auditIssues.length} Violations)`,
|
|
1176
|
+
`| # | Component / Context | Category | Sev | Issue Detail |`,
|
|
1177
|
+
`|---|---|---|---|---|`,
|
|
1178
|
+
summaryRows,
|
|
1179
|
+
``,
|
|
1180
|
+
`**Action**: Refactor offending tokens using @shavin/ui semantic tokens (bg-surface, text-fg, border-hairline, shadow-card, rounded-[var(--radius-panel)]).`
|
|
1181
|
+
].join("\n");
|
|
1182
|
+
navigator.clipboard.writeText(fullPrompt);
|
|
1183
|
+
setCopiedAllIssues(true);
|
|
1184
|
+
laterIfMounted(() => setCopiedAllIssues(false), 2e3);
|
|
1185
|
+
};
|
|
1186
|
+
const buttonStyle = dragOffset ? {
|
|
1187
|
+
position: "fixed",
|
|
1188
|
+
left: `${dragOffset.x - 20}px`,
|
|
1189
|
+
top: `${dragOffset.y - 20}px`,
|
|
1190
|
+
transition: "none",
|
|
1191
|
+
zIndex: 9999999,
|
|
1192
|
+
touchAction: "none"
|
|
1193
|
+
} : {
|
|
1194
|
+
position: "fixed",
|
|
1195
|
+
...CORNER_STYLES[corner],
|
|
1196
|
+
transition: isDragging ? "none" : "all 0.25s cubic-bezier(0.16, 1, 0.3, 1)",
|
|
1197
|
+
zIndex: 9999999,
|
|
1198
|
+
touchAction: "none"
|
|
1199
|
+
};
|
|
1200
|
+
const popoverSide = corner.startsWith("bottom") ? "top" : "bottom";
|
|
1201
|
+
const popoverAlign = corner.endsWith("left") ? "start" : "end";
|
|
1202
|
+
const INSPECTOR_THEME_STYLE = {
|
|
1203
|
+
fontFamily: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
1204
|
+
fontSize: "12px",
|
|
1205
|
+
lineHeight: "1.5",
|
|
1206
|
+
zIndex: 9999999,
|
|
1207
|
+
// @ts-ignore
|
|
1208
|
+
"--radius-lg": "0.5rem",
|
|
1209
|
+
// @ts-ignore
|
|
1210
|
+
"--radius-xl": "0.75rem",
|
|
1211
|
+
// @ts-ignore
|
|
1212
|
+
"--radius-panel": "0.75rem",
|
|
1213
|
+
// @ts-ignore
|
|
1214
|
+
"--radius-panel-inner": "var(--radius-panel)",
|
|
1215
|
+
// @ts-ignore
|
|
1216
|
+
"--panel-opacity": "1"
|
|
1217
|
+
};
|
|
1218
|
+
const a11yResult = useMemo(() => calculateContrast(brandHex, dark), [brandHex, dark]);
|
|
1219
|
+
if (!mounted) return null;
|
|
1220
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1221
|
+
/* @__PURE__ */ jsx("div", { style: buttonStyle, className: cn("shavin-dev-tools-root", className), ...props, children: /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
1222
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1223
|
+
"button",
|
|
1224
|
+
{
|
|
1225
|
+
ref: buttonRef,
|
|
1226
|
+
type: "button",
|
|
1227
|
+
onPointerDown: handlePointerDown,
|
|
1228
|
+
onPointerMove: handlePointerMove,
|
|
1229
|
+
onPointerUp: handlePointerUp,
|
|
1230
|
+
onPointerCancel: handlePointerUp,
|
|
1231
|
+
onClick: handleButtonClick,
|
|
1232
|
+
style: { touchAction: "none", visibility: "hidden" },
|
|
1233
|
+
tabIndex: -1,
|
|
1234
|
+
className: cn(
|
|
1235
|
+
"relative flex h-10 w-10 items-center justify-center rounded-full bg-fg text-surface",
|
|
1236
|
+
"border border-hairline shadow-card ring-1 ring-black/10 dark:ring-white/10",
|
|
1237
|
+
"transition-transform active:scale-95 cursor-pointer select-none",
|
|
1238
|
+
// Stays visible while the panel is open: it is the toggle and carries the audit dot.
|
|
1239
|
+
open && "ring-2 ring-brand-text"
|
|
1240
|
+
),
|
|
1241
|
+
title: open ? "Close the inspector, or drag to snap corner" : "Click to open or drag to snap corner",
|
|
1242
|
+
"aria-label": "Toggle Shavin Dev Inspector",
|
|
1243
|
+
"aria-expanded": open,
|
|
1244
|
+
children: [
|
|
1245
|
+
/* @__PURE__ */ jsxs(
|
|
1246
|
+
"svg",
|
|
1247
|
+
{
|
|
1248
|
+
width: "20",
|
|
1249
|
+
height: "20",
|
|
1250
|
+
viewBox: "0 0 200 200",
|
|
1251
|
+
fill: "none",
|
|
1252
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1253
|
+
className: "h-5 w-5",
|
|
1254
|
+
children: [
|
|
1255
|
+
/* @__PURE__ */ jsx(
|
|
1256
|
+
"path",
|
|
1257
|
+
{
|
|
1258
|
+
d: "M84.3402 106.157L84.6281 78.6112L84.6281 50.7042L17.2256 50.7042L17.2256 24.6892L182.776 24.6892L163.067 50.7042L108.278 50.7042L108.278 78.6112L107.99 86.4491C107.99 86.4491 98.8581 92.2253 95.1816 95.6855C91.5052 99.1457 84.3402 106.157 84.3402 106.157Z",
|
|
1259
|
+
fill: "currentColor"
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
/* @__PURE__ */ jsx(
|
|
1263
|
+
"path",
|
|
1264
|
+
{
|
|
1265
|
+
d: "M185.14 136.998C185.14 149.611 181.593 159.15 174.498 165.614C167.245 172.079 156.918 175.311 143.516 175.311L114.348 175.311L134.056 150.715L145.408 150.715C156.129 150.715 161.49 146.221 161.49 137.234C161.49 132.82 160.229 129.509 157.706 127.301C155.026 124.936 150.769 123.754 144.935 123.754C137.998 123.754 131.928 125.331 126.725 128.484C121.364 131.637 114.978 137.471 107.568 145.985C98.1081 156.706 89.5941 164.195 82.0261 168.452C74.3004 172.709 65.6288 174.838 56.0111 174.838C42.9248 174.838 32.8341 171.527 25.7391 164.905C18.4864 158.283 14.8601 148.665 14.8601 136.052C14.8601 123.596 18.4864 114.215 25.7391 107.908C32.8341 101.444 43.0824 98.2119 56.4841 98.2119L63.3426 98.2119L63.3426 122.808L54.8286 122.808C49.1526 122.808 45.0533 123.912 42.5306 126.119C39.8503 128.326 38.5101 131.558 38.5101 135.815C38.5101 144.487 43.7919 148.823 54.3556 148.823C60.3469 148.823 65.9441 147.246 71.1471 144.093C76.3501 140.782 82.6568 134.869 90.0671 126.355C99.5271 115.476 108.12 107.987 115.846 103.888C123.571 99.7886 132.637 97.7389 143.043 97.7389C156.602 97.7389 167.008 101.129 174.261 107.908C181.514 114.53 185.14 124.227 185.14 136.998Z",
|
|
1266
|
+
fill: "currentColor"
|
|
1267
|
+
}
|
|
1268
|
+
)
|
|
1269
|
+
]
|
|
1270
|
+
}
|
|
1271
|
+
),
|
|
1272
|
+
(() => {
|
|
1273
|
+
const errCount = auditIssues.filter((i) => i.severity === "error").length;
|
|
1274
|
+
const warnCount = auditIssues.filter((i) => i.severity === "warning").length;
|
|
1275
|
+
if (errCount > 0) {
|
|
1276
|
+
return /* @__PURE__ */ jsx(
|
|
1277
|
+
"span",
|
|
1278
|
+
{
|
|
1279
|
+
className: "absolute top-0 right-0 h-2.5 w-2.5 rounded-full bg-danger ring-2 ring-surface shadow-card",
|
|
1280
|
+
"aria-label": `${errCount} DS error${errCount !== 1 ? "s" : ""}`
|
|
1281
|
+
}
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
if (warnCount > 0) {
|
|
1285
|
+
return /* @__PURE__ */ jsx(
|
|
1286
|
+
"span",
|
|
1287
|
+
{
|
|
1288
|
+
className: "absolute top-0 right-0 h-2.5 w-2.5 rounded-full bg-warning ring-2 ring-surface shadow-card",
|
|
1289
|
+
"aria-label": `${warnCount} DS warning${warnCount !== 1 ? "s" : ""}`
|
|
1290
|
+
}
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
return null;
|
|
1294
|
+
})(),
|
|
1295
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Shavin Dev Inspector" })
|
|
1296
|
+
]
|
|
1297
|
+
}
|
|
1298
|
+
) }),
|
|
1299
|
+
/* @__PURE__ */ jsxs(
|
|
1300
|
+
PopoverContent,
|
|
1301
|
+
{
|
|
1302
|
+
side: popoverSide,
|
|
1303
|
+
align: popoverAlign,
|
|
1304
|
+
sideOffset: 12,
|
|
1305
|
+
onWheel: (e) => e.stopPropagation(),
|
|
1306
|
+
style: {
|
|
1307
|
+
...INSPECTOR_THEME_STYLE,
|
|
1308
|
+
translate: `${popoverPos.x}px ${popoverPos.y}px`,
|
|
1309
|
+
transform: popoverPos.x !== 0 || popoverPos.y !== 0 ? `translate3d(${popoverPos.x}px, ${popoverPos.y}px, 0)` : void 0
|
|
1310
|
+
},
|
|
1311
|
+
className: cn(
|
|
1312
|
+
"z-[9999999] w-[380px] max-w-[calc(100vw-64px)] h-[660px] max-h-[calc(100vh-80px)] p-0 flex flex-col overflow-hidden overscroll-contain",
|
|
1313
|
+
"rounded-[var(--radius-panel)] border border-hairline bg-surface shadow-modal backdrop-blur-md text-fg",
|
|
1314
|
+
isPopoverDragging && "select-none transition-none cursor-grabbing"
|
|
1315
|
+
),
|
|
1316
|
+
children: [
|
|
1317
|
+
/* @__PURE__ */ jsxs(
|
|
1318
|
+
"div",
|
|
1319
|
+
{
|
|
1320
|
+
onPointerDown: handlePopoverHeaderPointerDown,
|
|
1321
|
+
style: { touchAction: "none" },
|
|
1322
|
+
className: "flex items-center justify-between border-b border-hairline p-4 pb-2.5 shrink-0 cursor-grab active:cursor-grabbing select-none",
|
|
1323
|
+
children: [
|
|
1324
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx("span", { className: "font-bold text-sm tracking-tight text-fg", children: "Shavin Dev Inspector" }) }),
|
|
1325
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5", children: /* @__PURE__ */ jsx(
|
|
1326
|
+
"button",
|
|
1327
|
+
{
|
|
1328
|
+
type: "button",
|
|
1329
|
+
onClick: () => setOpen(false),
|
|
1330
|
+
className: "flex h-6 w-6 items-center justify-center rounded-[var(--radius-lg)] text-fg-muted hover:text-fg hover:bg-surface-hover transition cursor-pointer",
|
|
1331
|
+
title: "Close inspector",
|
|
1332
|
+
"aria-label": "Close inspector",
|
|
1333
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
1334
|
+
}
|
|
1335
|
+
) })
|
|
1336
|
+
]
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center px-4 border-b border-hairline shrink-0 bg-surface mt-2", children: [
|
|
1340
|
+
{ id: "audit", label: "DS Audit" },
|
|
1341
|
+
{ id: "mcp", label: "MCP" },
|
|
1342
|
+
{ id: "bridge", label: "Stream" }
|
|
1343
|
+
].map((t) => /* @__PURE__ */ jsxs(
|
|
1344
|
+
"button",
|
|
1345
|
+
{
|
|
1346
|
+
type: "button",
|
|
1347
|
+
onClick: () => setTab(t.id),
|
|
1348
|
+
className: cn(
|
|
1349
|
+
"px-2.5 py-2 text-xs font-medium -mb-px border-b-2 transition cursor-pointer flex items-center justify-center gap-1.5",
|
|
1350
|
+
tab === t.id ? "border-fg text-fg font-semibold" : "border-transparent text-fg-muted hover:text-fg hover:border-hairline-strong"
|
|
1351
|
+
),
|
|
1352
|
+
children: [
|
|
1353
|
+
/* @__PURE__ */ jsx("span", { children: t.label }),
|
|
1354
|
+
t.id === "audit" && auditIssues.length > 0 && /* @__PURE__ */ jsx("span", { className: "px-1.5 py-0.2 rounded-full text-xs font-bold bg-danger/15 text-danger border border-danger/30", children: auditIssues.length }),
|
|
1355
|
+
t.id === "bridge" && /* @__PURE__ */ jsx(
|
|
1356
|
+
"span",
|
|
1357
|
+
{
|
|
1358
|
+
className: cn(
|
|
1359
|
+
"h-1.5 w-1.5 rounded-full",
|
|
1360
|
+
bridgeConnected ? "bg-success animate-[pulse_0.9s_ease-in-out_infinite]" : "bg-warning"
|
|
1361
|
+
)
|
|
1362
|
+
}
|
|
1363
|
+
)
|
|
1364
|
+
]
|
|
1365
|
+
},
|
|
1366
|
+
t.id
|
|
1367
|
+
)) }),
|
|
1368
|
+
/* @__PURE__ */ jsxs(
|
|
1369
|
+
"div",
|
|
1370
|
+
{
|
|
1371
|
+
onWheel: (e) => e.stopPropagation(),
|
|
1372
|
+
className: "flex-1 min-h-0 overflow-y-auto p-4 py-4 space-y-3.5 overscroll-contain",
|
|
1373
|
+
children: [
|
|
1374
|
+
tab === "audit" && (() => {
|
|
1375
|
+
const allClear = auditIssues.length === 0;
|
|
1376
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4 text-xs transition-all duration-200", children: [
|
|
1377
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-[var(--radius-panel)] border border-hairline p-3 space-y-1.5", children: [
|
|
1378
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1379
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-fg", children: "Live A11y Contrast" }),
|
|
1380
|
+
/* @__PURE__ */ jsxs(
|
|
1381
|
+
"span",
|
|
1382
|
+
{
|
|
1383
|
+
className: cn(
|
|
1384
|
+
"flex items-center gap-1.5 font-bold text-xs",
|
|
1385
|
+
a11yResult.level === "AAA" ? "text-success" : a11yResult.level === "AA" ? "text-warning" : a11yResult.level === "Unknown" ? "text-fg-subtle" : "text-danger"
|
|
1386
|
+
),
|
|
1387
|
+
children: [
|
|
1388
|
+
/* @__PURE__ */ jsx(
|
|
1389
|
+
"span",
|
|
1390
|
+
{
|
|
1391
|
+
className: cn(
|
|
1392
|
+
"h-2 w-2 rounded-full shrink-0",
|
|
1393
|
+
a11yResult.level === "AAA" ? "bg-success" : a11yResult.level === "AA" ? "bg-warning" : a11yResult.level === "Unknown" ? "bg-hairline-strong" : "bg-danger"
|
|
1394
|
+
)
|
|
1395
|
+
}
|
|
1396
|
+
),
|
|
1397
|
+
a11yResult.label
|
|
1398
|
+
]
|
|
1399
|
+
}
|
|
1400
|
+
)
|
|
1401
|
+
] }),
|
|
1402
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-fg-muted leading-relaxed", children: [
|
|
1403
|
+
"Evaluated live against ",
|
|
1404
|
+
dark ? "Dark" : "Light",
|
|
1405
|
+
" background using WCAG 2 relative luminance math."
|
|
1406
|
+
] })
|
|
1407
|
+
] }),
|
|
1408
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-[var(--radius-panel)] border border-hairline p-3 space-y-2.5", children: [
|
|
1409
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1410
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-fg", children: "DOM Token Compliance" }),
|
|
1411
|
+
/* @__PURE__ */ jsxs("span", { className: cn("flex items-center gap-1.5 font-bold text-xs", allClear ? "text-success" : "text-danger"), children: [
|
|
1412
|
+
/* @__PURE__ */ jsx("span", { className: cn("h-2 w-2 rounded-full shrink-0", allClear ? "bg-success" : "bg-danger animate-[pulse_0.9s_ease-in-out_infinite]") }),
|
|
1413
|
+
allClear ? "All Clear" : `${auditIssues.length} DOM Violation${auditIssues.length !== 1 ? "s" : ""} Found`
|
|
1414
|
+
] })
|
|
1415
|
+
] }),
|
|
1416
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-2 border-t border-hairline text-xs text-fg-muted", children: [
|
|
1417
|
+
auditTimestamp && /* @__PURE__ */ jsxs("span", { children: [
|
|
1418
|
+
"Last scan: ",
|
|
1419
|
+
auditTimestamp
|
|
1420
|
+
] }),
|
|
1421
|
+
/* @__PURE__ */ jsxs(
|
|
1422
|
+
Button,
|
|
1423
|
+
{
|
|
1424
|
+
type: "button",
|
|
1425
|
+
variant: "ghost",
|
|
1426
|
+
size: "sm",
|
|
1427
|
+
onClick: runLiveAudit,
|
|
1428
|
+
className: "flex items-center gap-1 h-6 px-2 text-xs font-medium text-fg-muted hover:text-fg hover:bg-surface-hover transition cursor-pointer",
|
|
1429
|
+
title: "Re-scan DOM for violations",
|
|
1430
|
+
children: [
|
|
1431
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-3 w-3 shrink-0", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 1 0 3-6.7M3 4v5h5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
1432
|
+
/* @__PURE__ */ jsx("span", { children: "Re-scan" })
|
|
1433
|
+
]
|
|
1434
|
+
}
|
|
1435
|
+
)
|
|
1436
|
+
] })
|
|
1437
|
+
] }),
|
|
1438
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-[var(--radius-panel)] border border-hairline px-3 py-2.5 space-y-2.5", children: [
|
|
1439
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1440
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
1441
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-fg text-xs", children: "Source Architecture Warnings" }),
|
|
1442
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-fg-muted font-normal", children: "(opt-in)" })
|
|
1443
|
+
] }),
|
|
1444
|
+
/* @__PURE__ */ jsx(
|
|
1445
|
+
Switch,
|
|
1446
|
+
{
|
|
1447
|
+
checked: showSourceWarnings,
|
|
1448
|
+
onCheckedChange: (checked) => {
|
|
1449
|
+
setShowSourceWarnings(checked);
|
|
1450
|
+
if (checked && sourceWarnings.length === 0 && !sourceAuditLoading) {
|
|
1451
|
+
fetchSourceWarnings();
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
size: "sm",
|
|
1455
|
+
"aria-label": "Include source-level architecture warnings"
|
|
1456
|
+
}
|
|
1457
|
+
)
|
|
1458
|
+
] }),
|
|
1459
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] text-fg-muted leading-relaxed", children: "Scans .tsx/.jsx source for raw HTML elements, deep imports, missing cva()/cn(). Warnings only \u2014 safe to ignore when mixing frameworks." })
|
|
1460
|
+
] }),
|
|
1461
|
+
showSourceWarnings && /* @__PURE__ */ jsxs("div", { className: "space-y-2 pt-1", children: [
|
|
1462
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1463
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm font-semibold text-fg", children: [
|
|
1464
|
+
"Source Warnings (",
|
|
1465
|
+
sourceWarnings.length,
|
|
1466
|
+
")",
|
|
1467
|
+
sourceAuditTimestamp && /* @__PURE__ */ jsxs("span", { className: "text-xs text-fg-muted font-normal ml-2", children: [
|
|
1468
|
+
"\xB7 ",
|
|
1469
|
+
sourceAuditTimestamp
|
|
1470
|
+
] })
|
|
1471
|
+
] }),
|
|
1472
|
+
/* @__PURE__ */ jsxs(
|
|
1473
|
+
Button,
|
|
1474
|
+
{
|
|
1475
|
+
type: "button",
|
|
1476
|
+
variant: "ghost",
|
|
1477
|
+
size: "sm",
|
|
1478
|
+
onClick: fetchSourceWarnings,
|
|
1479
|
+
disabled: sourceAuditLoading,
|
|
1480
|
+
className: cn(
|
|
1481
|
+
"h-6 px-2 text-xs font-medium cursor-pointer flex items-center gap-1",
|
|
1482
|
+
sourceAuditLoading ? "text-fg-muted opacity-60" : "text-fg-muted hover:text-fg hover:bg-surface-hover"
|
|
1483
|
+
),
|
|
1484
|
+
title: "Re-scan source files",
|
|
1485
|
+
children: [
|
|
1486
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-3 w-3 shrink-0", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 1 0 3-6.7M3 4v5h5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
1487
|
+
/* @__PURE__ */ jsx("span", { children: sourceAuditLoading ? "Scanning\u2026" : "Re-scan" })
|
|
1488
|
+
]
|
|
1489
|
+
}
|
|
1490
|
+
)
|
|
1491
|
+
] }),
|
|
1492
|
+
sourceAuditError && /* @__PURE__ */ jsx("div", { className: "rounded-[var(--radius-panel)] border border-warning/30 p-2.5", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-warning leading-relaxed", children: sourceAuditError }) }),
|
|
1493
|
+
sourceWarnings.length > 0 ? /* @__PURE__ */ jsx(
|
|
1494
|
+
"div",
|
|
1495
|
+
{
|
|
1496
|
+
onWheel: (e) => e.stopPropagation(),
|
|
1497
|
+
className: "space-y-1.5 max-h-56 overflow-y-auto pr-0.5 overscroll-contain",
|
|
1498
|
+
children: sourceWarnings.map((warn, idx) => /* @__PURE__ */ jsxs(
|
|
1499
|
+
"div",
|
|
1500
|
+
{
|
|
1501
|
+
className: "w-full text-left rounded-[var(--radius-panel)] border border-warning/20 hover:border-warning/40 text-xs transition overflow-hidden p-2.5",
|
|
1502
|
+
children: [
|
|
1503
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
1504
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-warning truncate shrink-0", children: warn.type === "raw-element" && warn.element ? `${warn.count || 1}\xD7 <${warn.element}>` : warn.type === "deep-import" ? "Deep import" : warn.type === "missing-cva" ? "Missing cva()" : "Missing cn()" }),
|
|
1505
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg-muted text-xs shrink-0 font-normal", children: "\u2192" }),
|
|
1506
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg-subtle truncate font-mono text-[11px]", children: warn.file })
|
|
1507
|
+
] }),
|
|
1508
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] text-fg-muted leading-relaxed mt-1 pt-1 border-t border-hairline/40", children: warn.type === "raw-element" ? `Use <${warn.primitive}> instead \u2014 ${warn.reason || "Shavin primitive available"}` : warn.message })
|
|
1509
|
+
]
|
|
1510
|
+
},
|
|
1511
|
+
`src-warn-${idx}`
|
|
1512
|
+
))
|
|
1513
|
+
}
|
|
1514
|
+
) : !sourceAuditLoading && !sourceAuditError && /* @__PURE__ */ jsx("div", { className: "rounded-[var(--radius-panel)] border border-hairline p-2.5", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-success font-medium", children: "\u2713 Source architecture is clean" }) })
|
|
1515
|
+
] }),
|
|
1516
|
+
auditIssues.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2 pt-1", children: [
|
|
1517
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1518
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm font-semibold text-fg", children: [
|
|
1519
|
+
"Detected Violations (",
|
|
1520
|
+
auditIssues.length,
|
|
1521
|
+
")"
|
|
1522
|
+
] }),
|
|
1523
|
+
/* @__PURE__ */ jsx(
|
|
1524
|
+
Button,
|
|
1525
|
+
{
|
|
1526
|
+
type: "button",
|
|
1527
|
+
variant: "ghost",
|
|
1528
|
+
size: "sm",
|
|
1529
|
+
onClick: copyAllIssuesForAgent,
|
|
1530
|
+
className: cn(
|
|
1531
|
+
"h-6 px-2 text-xs font-medium cursor-pointer flex items-center gap-1",
|
|
1532
|
+
copiedAllIssues ? "text-success" : "text-fg-muted hover:text-fg hover:bg-surface-hover"
|
|
1533
|
+
),
|
|
1534
|
+
title: "Copy full markdown report of all violations",
|
|
1535
|
+
children: copiedAllIssues ? "Copied all!" : "Copy all"
|
|
1536
|
+
}
|
|
1537
|
+
)
|
|
1538
|
+
] }),
|
|
1539
|
+
/* @__PURE__ */ jsx(
|
|
1540
|
+
"div",
|
|
1541
|
+
{
|
|
1542
|
+
onWheel: (e) => e.stopPropagation(),
|
|
1543
|
+
className: "space-y-1.5 max-h-56 overflow-y-auto pr-0.5 overscroll-contain",
|
|
1544
|
+
children: auditIssues.map((issue) => {
|
|
1545
|
+
const isCopied = copiedIssueId === issue.id;
|
|
1546
|
+
const isExpanded = expandedIssueId === issue.id;
|
|
1547
|
+
return /* @__PURE__ */ jsxs(
|
|
1548
|
+
"div",
|
|
1549
|
+
{
|
|
1550
|
+
className: cn(
|
|
1551
|
+
"w-full text-left rounded-[var(--radius-panel)] border text-xs transition cursor-pointer overflow-hidden",
|
|
1552
|
+
issue.severity === "error" ? "border-danger/30 hover:border-danger/60" : "border-warning/30 hover:border-warning/60"
|
|
1553
|
+
),
|
|
1554
|
+
children: [
|
|
1555
|
+
/* @__PURE__ */ jsxs(
|
|
1556
|
+
"div",
|
|
1557
|
+
{
|
|
1558
|
+
onClick: () => {
|
|
1559
|
+
focusViolation(issue);
|
|
1560
|
+
setExpandedIssueId(isExpanded ? null : issue.id);
|
|
1561
|
+
},
|
|
1562
|
+
className: "flex items-center justify-between gap-2 p-2.5",
|
|
1563
|
+
children: [
|
|
1564
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 min-w-0 flex-1 text-xs", children: [
|
|
1565
|
+
/* @__PURE__ */ jsx("span", { className: cn("font-medium truncate", issue.severity === "error" ? "text-danger" : "text-warning"), children: issue.selector }),
|
|
1566
|
+
/* @__PURE__ */ jsxs("span", { className: "text-fg-muted text-xs shrink-0 font-normal", children: [
|
|
1567
|
+
"\u2022 ",
|
|
1568
|
+
issue.category
|
|
1569
|
+
] })
|
|
1570
|
+
] }),
|
|
1571
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
1572
|
+
/* @__PURE__ */ jsx(
|
|
1573
|
+
Button,
|
|
1574
|
+
{
|
|
1575
|
+
type: "button",
|
|
1576
|
+
variant: "ghost",
|
|
1577
|
+
size: "sm",
|
|
1578
|
+
onClick: (e) => {
|
|
1579
|
+
e.stopPropagation();
|
|
1580
|
+
copyIssueForAgent(issue, e);
|
|
1581
|
+
},
|
|
1582
|
+
className: cn(
|
|
1583
|
+
"h-6 px-2 text-xs font-medium cursor-pointer",
|
|
1584
|
+
isCopied ? "text-success" : "text-fg-muted hover:text-fg hover:bg-surface-hover"
|
|
1585
|
+
),
|
|
1586
|
+
title: "Copy issue details",
|
|
1587
|
+
children: isCopied ? "Copied!" : "Copy"
|
|
1588
|
+
}
|
|
1589
|
+
),
|
|
1590
|
+
/* @__PURE__ */ jsx(
|
|
1591
|
+
"svg",
|
|
1592
|
+
{
|
|
1593
|
+
viewBox: "0 0 16 16",
|
|
1594
|
+
className: cn(
|
|
1595
|
+
"h-3 w-3 text-fg-muted transition-transform duration-200",
|
|
1596
|
+
isExpanded && "rotate-180"
|
|
1597
|
+
),
|
|
1598
|
+
fill: "none",
|
|
1599
|
+
stroke: "currentColor",
|
|
1600
|
+
strokeWidth: "2",
|
|
1601
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1602
|
+
}
|
|
1603
|
+
)
|
|
1604
|
+
] })
|
|
1605
|
+
]
|
|
1606
|
+
}
|
|
1607
|
+
),
|
|
1608
|
+
/* @__PURE__ */ jsx(
|
|
1609
|
+
"div",
|
|
1610
|
+
{
|
|
1611
|
+
className: cn(
|
|
1612
|
+
"grid transition-all duration-200 ease-out",
|
|
1613
|
+
isExpanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
|
1614
|
+
),
|
|
1615
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "p-2.5 pt-0 border-t border-hairline/40 space-y-1 mt-0.5", children: [
|
|
1616
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-fg leading-relaxed pt-1.5", children: issue.detail }),
|
|
1617
|
+
issue.domNode && issue.domNode.className && typeof issue.domNode.className === "string" && /* @__PURE__ */ jsxs("div", { className: "pt-1 text-xs font-mono text-fg-muted truncate", children: [
|
|
1618
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg-subtle font-sans", children: "Classes: " }),
|
|
1619
|
+
issue.domNode.className
|
|
1620
|
+
] })
|
|
1621
|
+
] }) })
|
|
1622
|
+
}
|
|
1623
|
+
)
|
|
1624
|
+
]
|
|
1625
|
+
},
|
|
1626
|
+
issue.id
|
|
1627
|
+
);
|
|
1628
|
+
})
|
|
1629
|
+
}
|
|
1630
|
+
)
|
|
1631
|
+
] })
|
|
1632
|
+
] });
|
|
1633
|
+
})(),
|
|
1634
|
+
tab === "mcp" && /* @__PURE__ */ jsxs("div", { className: "space-y-4 text-xs transition-all duration-200", children: [
|
|
1635
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-[var(--radius-panel)] border border-hairline p-3.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1636
|
+
/* @__PURE__ */ jsxs(
|
|
1637
|
+
"button",
|
|
1638
|
+
{
|
|
1639
|
+
type: "button",
|
|
1640
|
+
onClick: () => setTab("bridge"),
|
|
1641
|
+
className: "group flex items-center gap-1.5 font-semibold text-fg text-sm hover:text-brand-text transition cursor-pointer",
|
|
1642
|
+
title: "View live stream log in Stream tab",
|
|
1643
|
+
children: [
|
|
1644
|
+
/* @__PURE__ */ jsx("span", { children: "AI Agent Bridge" }),
|
|
1645
|
+
/* @__PURE__ */ jsxs(
|
|
1646
|
+
"svg",
|
|
1647
|
+
{
|
|
1648
|
+
viewBox: "0 0 24 24",
|
|
1649
|
+
className: "h-3.5 w-3.5 text-fg-muted group-hover:text-brand-text group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform",
|
|
1650
|
+
fill: "none",
|
|
1651
|
+
stroke: "currentColor",
|
|
1652
|
+
strokeWidth: "2.2",
|
|
1653
|
+
strokeLinecap: "round",
|
|
1654
|
+
strokeLinejoin: "round",
|
|
1655
|
+
children: [
|
|
1656
|
+
/* @__PURE__ */ jsx("path", { d: "M7 17 17 7" }),
|
|
1657
|
+
/* @__PURE__ */ jsx("path", { d: "M7 7h10v10" })
|
|
1658
|
+
]
|
|
1659
|
+
}
|
|
1660
|
+
)
|
|
1661
|
+
]
|
|
1662
|
+
}
|
|
1663
|
+
),
|
|
1664
|
+
/* @__PURE__ */ jsxs("span", { className: cn(
|
|
1665
|
+
"inline-flex items-center gap-1.5 font-bold text-xs",
|
|
1666
|
+
bridgeConnected ? "text-success" : "text-warning"
|
|
1667
|
+
), children: [
|
|
1668
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
1669
|
+
"h-2 w-2 rounded-full",
|
|
1670
|
+
bridgeConnected ? "bg-success animate-[pulse_0.9s_ease-in-out_infinite]" : "bg-warning"
|
|
1671
|
+
) }),
|
|
1672
|
+
bridgeConnected ? `Connected (:${bPort})` : `Listening (:${bPort})`
|
|
1673
|
+
] })
|
|
1674
|
+
] }) }),
|
|
1675
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-[var(--radius-panel)] border border-hairline p-3.5 space-y-2.5", children: [
|
|
1676
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
|
|
1677
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg-muted font-medium", children: "MCP Daemon" }),
|
|
1678
|
+
/* @__PURE__ */ jsx(
|
|
1679
|
+
Button,
|
|
1680
|
+
{
|
|
1681
|
+
type: "button",
|
|
1682
|
+
variant: "ghost",
|
|
1683
|
+
size: "sm",
|
|
1684
|
+
onClick: () => handleCopyToolCmd("npx @shavin/mcp", "daemon"),
|
|
1685
|
+
className: cn(
|
|
1686
|
+
"font-mono text-xs h-6 px-2 cursor-pointer",
|
|
1687
|
+
copiedTool === "daemon" ? "text-success" : "text-fg hover:text-brand-text hover:bg-surface-hover"
|
|
1688
|
+
),
|
|
1689
|
+
children: copiedTool === "daemon" ? "Copied!" : "npx @shavin/mcp"
|
|
1690
|
+
}
|
|
1691
|
+
)
|
|
1692
|
+
] }),
|
|
1693
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
|
|
1694
|
+
/* @__PURE__ */ jsx("span", { className: "text-fg-muted font-medium", children: "Agent Skills Init" }),
|
|
1695
|
+
/* @__PURE__ */ jsx(
|
|
1696
|
+
Button,
|
|
1697
|
+
{
|
|
1698
|
+
type: "button",
|
|
1699
|
+
variant: "ghost",
|
|
1700
|
+
size: "sm",
|
|
1701
|
+
onClick: () => handleCopyToolCmd("npx @shavin/cli init", "init"),
|
|
1702
|
+
className: cn(
|
|
1703
|
+
"font-mono text-xs h-6 px-2 cursor-pointer",
|
|
1704
|
+
copiedTool === "init" ? "text-success" : "text-fg hover:text-brand-text hover:bg-surface-hover"
|
|
1705
|
+
),
|
|
1706
|
+
children: copiedTool === "init" ? "Copied!" : "npx @shavin/cli init"
|
|
1707
|
+
}
|
|
1708
|
+
)
|
|
1709
|
+
] })
|
|
1710
|
+
] }),
|
|
1711
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
1712
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-1 mb-1", children: /* @__PURE__ */ jsxs("span", { className: "text-sm font-semibold text-fg", children: [
|
|
1713
|
+
"MCP Tools (",
|
|
1714
|
+
MCP_TOOL_INFO.length,
|
|
1715
|
+
")"
|
|
1716
|
+
] }) }),
|
|
1717
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1", children: MCP_TOOL_INFO.map((tool) => {
|
|
1718
|
+
const isCopied = copiedTool === tool.name;
|
|
1719
|
+
const isExpanded = expandedToolName === tool.name;
|
|
1720
|
+
return /* @__PURE__ */ jsxs(
|
|
1721
|
+
"div",
|
|
1722
|
+
{
|
|
1723
|
+
className: cn(
|
|
1724
|
+
"group rounded-[var(--radius-lg)] transition-colors overflow-hidden",
|
|
1725
|
+
isExpanded ? "bg-surface-hover/50" : "hover:bg-surface-hover/60"
|
|
1726
|
+
),
|
|
1727
|
+
children: [
|
|
1728
|
+
/* @__PURE__ */ jsx(
|
|
1729
|
+
Row,
|
|
1730
|
+
{
|
|
1731
|
+
as: "div",
|
|
1732
|
+
onClick: () => setExpandedToolName(isExpanded ? null : tool.name),
|
|
1733
|
+
className: "cursor-pointer select-none py-2 px-2.5",
|
|
1734
|
+
leading: /* @__PURE__ */ jsx(
|
|
1735
|
+
"svg",
|
|
1736
|
+
{
|
|
1737
|
+
viewBox: "0 0 24 24",
|
|
1738
|
+
className: cn(
|
|
1739
|
+
"h-3.5 w-3.5 text-fg-muted transition-transform duration-200 shrink-0",
|
|
1740
|
+
isExpanded && "rotate-90 text-fg"
|
|
1741
|
+
),
|
|
1742
|
+
fill: "none",
|
|
1743
|
+
stroke: "currentColor",
|
|
1744
|
+
strokeWidth: "2",
|
|
1745
|
+
strokeLinecap: "round",
|
|
1746
|
+
strokeLinejoin: "round",
|
|
1747
|
+
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
1748
|
+
}
|
|
1749
|
+
),
|
|
1750
|
+
trailing: /* @__PURE__ */ jsx(
|
|
1751
|
+
Button,
|
|
1752
|
+
{
|
|
1753
|
+
type: "button",
|
|
1754
|
+
variant: "ghost",
|
|
1755
|
+
size: "sm",
|
|
1756
|
+
onClick: (e) => {
|
|
1757
|
+
e.stopPropagation();
|
|
1758
|
+
handleCopyToolCmd(tool.cmd, tool.name);
|
|
1759
|
+
},
|
|
1760
|
+
className: cn(
|
|
1761
|
+
"h-6 px-2 text-xs font-medium cursor-pointer shrink-0 transition-opacity",
|
|
1762
|
+
isCopied ? "text-success opacity-100" : "text-fg-muted hover:text-fg hover:bg-surface-hover opacity-0 group-hover:opacity-100 focus:opacity-100"
|
|
1763
|
+
),
|
|
1764
|
+
title: `Copy: ${tool.cmd}`,
|
|
1765
|
+
children: isCopied ? "Copied!" : "Copy"
|
|
1766
|
+
}
|
|
1767
|
+
),
|
|
1768
|
+
children: /* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-fg text-xs", children: tool.name })
|
|
1769
|
+
}
|
|
1770
|
+
),
|
|
1771
|
+
/* @__PURE__ */ jsx(
|
|
1772
|
+
"div",
|
|
1773
|
+
{
|
|
1774
|
+
className: cn(
|
|
1775
|
+
"grid transition-all duration-200 ease-out",
|
|
1776
|
+
isExpanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
|
1777
|
+
),
|
|
1778
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "px-3 pb-3 pt-1 text-xs text-fg-muted leading-relaxed", children: [
|
|
1779
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-fg-muted", children: tool.desc }),
|
|
1780
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2.5 pt-2 border-t border-hairline/40 text-xs font-mono text-fg-subtle select-all", children: tool.cmd })
|
|
1781
|
+
] }) })
|
|
1782
|
+
}
|
|
1783
|
+
)
|
|
1784
|
+
]
|
|
1785
|
+
},
|
|
1786
|
+
tool.name
|
|
1787
|
+
);
|
|
1788
|
+
}) })
|
|
1789
|
+
] })
|
|
1790
|
+
] }),
|
|
1791
|
+
tab === "bridge" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full space-y-4 text-xs transition-all duration-200", children: [
|
|
1792
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-[var(--radius-panel)] border border-hairline p-3.5 shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1793
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1794
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
1795
|
+
"h-2.5 w-2.5 rounded-full shrink-0",
|
|
1796
|
+
bridgeConnected ? "bg-success animate-[pulse_0.9s_ease-in-out_infinite] shadow-[0_0_8px_rgba(34,197,94,0.5)]" : "bg-warning"
|
|
1797
|
+
) }),
|
|
1798
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1799
|
+
/* @__PURE__ */ jsxs("div", { className: "font-semibold text-fg text-xs flex items-center gap-1.5", children: [
|
|
1800
|
+
/* @__PURE__ */ jsx("span", { children: "AI Agent Bridge" }),
|
|
1801
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-xs text-fg-muted bg-surface-hover px-1.5 py-0.5 rounded border border-hairline", children: [
|
|
1802
|
+
":",
|
|
1803
|
+
bPort
|
|
1804
|
+
] })
|
|
1805
|
+
] }),
|
|
1806
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-fg-muted", children: bridgeConnected ? "Real-time AI Sync Active" : `Listening on localhost:${bPort}` })
|
|
1807
|
+
] })
|
|
1808
|
+
] }),
|
|
1809
|
+
/* @__PURE__ */ jsxs(
|
|
1810
|
+
"a",
|
|
1811
|
+
{
|
|
1812
|
+
href: bridgeDashboardUrl(bPort),
|
|
1813
|
+
target: "_blank",
|
|
1814
|
+
rel: "noopener noreferrer",
|
|
1815
|
+
className: "inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium text-fg-muted hover:text-fg hover:bg-surface-hover rounded-[calc(var(--radius-lg)-2px)] border border-hairline transition cursor-pointer",
|
|
1816
|
+
title: "Open full dashboard monitor in new browser tab",
|
|
1817
|
+
children: [
|
|
1818
|
+
/* @__PURE__ */ jsx("span", { children: "Monitor" }),
|
|
1819
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M6 3h7v7M13 3L6 10" }) })
|
|
1820
|
+
]
|
|
1821
|
+
}
|
|
1822
|
+
)
|
|
1823
|
+
] }) }),
|
|
1824
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 shrink-0", children: [
|
|
1825
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm font-semibold text-fg flex items-center gap-1.5", children: [
|
|
1826
|
+
/* @__PURE__ */ jsx("span", { children: "Live Event Log" }),
|
|
1827
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-fg-muted bg-surface-hover px-1.5 py-0.5 rounded border border-hairline", children: streamEvents.length })
|
|
1828
|
+
] }),
|
|
1829
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
1830
|
+
/* @__PURE__ */ jsxs(
|
|
1831
|
+
Button,
|
|
1832
|
+
{
|
|
1833
|
+
type: "button",
|
|
1834
|
+
variant: "outline",
|
|
1835
|
+
size: "sm",
|
|
1836
|
+
onClick: handleTriggerRescan,
|
|
1837
|
+
disabled: triggeringRescan,
|
|
1838
|
+
className: "text-xs h-6 px-2 py-0.5 gap-1 font-medium cursor-pointer",
|
|
1839
|
+
children: [
|
|
1840
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: cn("h-3 w-3", triggeringRescan && "animate-spin"), fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M14 8A6 6 0 118 2v3M8 2l3 3M8 2L5 5" }) }),
|
|
1841
|
+
/* @__PURE__ */ jsx("span", { children: triggeringRescan ? "Scanning..." : "Rescan" })
|
|
1842
|
+
]
|
|
1843
|
+
}
|
|
1844
|
+
),
|
|
1845
|
+
/* @__PURE__ */ jsx(
|
|
1846
|
+
Button,
|
|
1847
|
+
{
|
|
1848
|
+
type: "button",
|
|
1849
|
+
variant: "ghost",
|
|
1850
|
+
size: "sm",
|
|
1851
|
+
onClick: () => setStreamEvents([]),
|
|
1852
|
+
className: "text-xs h-6 px-2 py-0.5 text-fg-muted hover:text-fg cursor-pointer",
|
|
1853
|
+
children: "Clear"
|
|
1854
|
+
}
|
|
1855
|
+
)
|
|
1856
|
+
] })
|
|
1857
|
+
] }),
|
|
1858
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] overflow-y-auto overscroll-contain flex flex-col", children: streamEvents.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col items-center justify-center text-center p-6 rounded-[var(--radius-panel)] border border-dashed border-hairline/60 bg-surface-hover/10", children: [
|
|
1859
|
+
/* @__PURE__ */ jsx("div", { className: "text-fg font-medium text-xs mb-1", children: "Waiting for Stream Events..." }),
|
|
1860
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-fg-muted leading-relaxed max-w-[260px]", children: "Events triggered by AI agents, DOM audit synchronization, or rescan signals will stream here live." })
|
|
1861
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "space-y-1", children: streamEvents.map((evt) => {
|
|
1862
|
+
const isExpanded = selectedEventId === evt.id;
|
|
1863
|
+
return /* @__PURE__ */ jsxs(
|
|
1864
|
+
"div",
|
|
1865
|
+
{
|
|
1866
|
+
className: cn(
|
|
1867
|
+
"group rounded-[var(--radius-lg)] transition-colors overflow-hidden",
|
|
1868
|
+
isExpanded ? "bg-surface-hover/50" : "hover:bg-surface-hover/60"
|
|
1869
|
+
),
|
|
1870
|
+
children: [
|
|
1871
|
+
/* @__PURE__ */ jsx(
|
|
1872
|
+
Row,
|
|
1873
|
+
{
|
|
1874
|
+
as: "div",
|
|
1875
|
+
onClick: () => setSelectedEventId(isExpanded ? null : evt.id),
|
|
1876
|
+
className: "cursor-pointer select-none py-1.5 px-2.5",
|
|
1877
|
+
leading: evt.direction === "in" ? /* @__PURE__ */ jsxs(
|
|
1878
|
+
"svg",
|
|
1879
|
+
{
|
|
1880
|
+
viewBox: "0 0 24 24",
|
|
1881
|
+
className: "h-3.5 w-3.5 text-brand-text shrink-0",
|
|
1882
|
+
fill: "none",
|
|
1883
|
+
stroke: "currentColor",
|
|
1884
|
+
strokeWidth: "2.2",
|
|
1885
|
+
strokeLinecap: "round",
|
|
1886
|
+
strokeLinejoin: "round",
|
|
1887
|
+
"aria-label": "Incoming event from AI bridge",
|
|
1888
|
+
children: [
|
|
1889
|
+
/* @__PURE__ */ jsx("path", { d: "M17 7 7 17" }),
|
|
1890
|
+
/* @__PURE__ */ jsx("path", { d: "M17 17H7V7" })
|
|
1891
|
+
]
|
|
1892
|
+
}
|
|
1893
|
+
) : /* @__PURE__ */ jsxs(
|
|
1894
|
+
"svg",
|
|
1895
|
+
{
|
|
1896
|
+
viewBox: "0 0 24 24",
|
|
1897
|
+
className: "h-3.5 w-3.5 text-success shrink-0",
|
|
1898
|
+
fill: "none",
|
|
1899
|
+
stroke: "currentColor",
|
|
1900
|
+
strokeWidth: "2.2",
|
|
1901
|
+
strokeLinecap: "round",
|
|
1902
|
+
strokeLinejoin: "round",
|
|
1903
|
+
"aria-label": "Outgoing sync to AI bridge",
|
|
1904
|
+
children: [
|
|
1905
|
+
/* @__PURE__ */ jsx("path", { d: "M7 17 17 7" }),
|
|
1906
|
+
/* @__PURE__ */ jsx("path", { d: "M7 7h10v10" })
|
|
1907
|
+
]
|
|
1908
|
+
}
|
|
1909
|
+
),
|
|
1910
|
+
trailing: /* @__PURE__ */ jsx("span", { className: "text-xs text-fg-muted font-normal font-mono", children: evt.timestamp }),
|
|
1911
|
+
children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 pr-1", children: [
|
|
1912
|
+
/* @__PURE__ */ jsx("div", { className: "font-mono font-medium text-fg text-xs truncate", children: evt.type }),
|
|
1913
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-fg-subtle truncate leading-tight mt-0.5", children: evt.summary })
|
|
1914
|
+
] })
|
|
1915
|
+
}
|
|
1916
|
+
),
|
|
1917
|
+
evt.data && /* @__PURE__ */ jsx(
|
|
1918
|
+
"div",
|
|
1919
|
+
{
|
|
1920
|
+
className: cn(
|
|
1921
|
+
"grid transition-all duration-200 ease-out",
|
|
1922
|
+
isExpanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
|
1923
|
+
),
|
|
1924
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "px-2.5 pb-2.5 pt-1 border-t border-hairline/40", children: [
|
|
1925
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs text-fg-muted mb-1 pt-1", children: [
|
|
1926
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono uppercase text-xs", children: "Payload Data" }),
|
|
1927
|
+
/* @__PURE__ */ jsx(
|
|
1928
|
+
Button,
|
|
1929
|
+
{
|
|
1930
|
+
type: "button",
|
|
1931
|
+
variant: "ghost",
|
|
1932
|
+
size: "sm",
|
|
1933
|
+
onClick: (e) => {
|
|
1934
|
+
e.stopPropagation();
|
|
1935
|
+
navigator.clipboard.writeText(JSON.stringify(evt.data, null, 2));
|
|
1936
|
+
},
|
|
1937
|
+
className: "h-6 px-2 text-xs text-fg-muted hover:text-fg hover:bg-surface-hover cursor-pointer",
|
|
1938
|
+
children: "Copy JSON"
|
|
1939
|
+
}
|
|
1940
|
+
)
|
|
1941
|
+
] }),
|
|
1942
|
+
/* @__PURE__ */ jsx("pre", { className: "p-2 rounded-[calc(var(--radius-lg)-2px)] bg-surface-hover/80 border border-hairline font-mono text-xs text-fg overflow-x-auto max-h-40 whitespace-pre-wrap leading-tight", children: JSON.stringify(evt.data, null, 2) })
|
|
1943
|
+
] }) })
|
|
1944
|
+
}
|
|
1945
|
+
)
|
|
1946
|
+
]
|
|
1947
|
+
},
|
|
1948
|
+
evt.id
|
|
1949
|
+
);
|
|
1950
|
+
}) }) })
|
|
1951
|
+
] })
|
|
1952
|
+
]
|
|
1953
|
+
}
|
|
1954
|
+
),
|
|
1955
|
+
tab === "audit" && /* @__PURE__ */ jsxs("div", { className: "p-4 pt-2.5 pb-3 border-t border-hairline bg-surface shrink-0 flex items-center justify-between text-xs", children: [
|
|
1956
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 text-xs font-medium", children: auditIssues.length === 0 ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-success font-semibold", children: [
|
|
1957
|
+
/* @__PURE__ */ jsx("span", { className: "h-2 w-2 rounded-full bg-success" }),
|
|
1958
|
+
"0 DOM Violations (Clean)",
|
|
1959
|
+
showSourceWarnings && sourceWarnings.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-warning font-normal ml-1.5", children: [
|
|
1960
|
+
"\xB7 ",
|
|
1961
|
+
sourceWarnings.length,
|
|
1962
|
+
" source warnings"
|
|
1963
|
+
] })
|
|
1964
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
1965
|
+
auditIssues.filter((i) => i.severity === "error").length > 0 && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-danger font-semibold", children: [
|
|
1966
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3 w-3", fill: "currentColor", children: [
|
|
1967
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7" }),
|
|
1968
|
+
/* @__PURE__ */ jsx("path", { d: "M8 5v3.5M8 10.5v.5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1969
|
+
] }),
|
|
1970
|
+
auditIssues.filter((i) => i.severity === "error").length,
|
|
1971
|
+
" error",
|
|
1972
|
+
auditIssues.filter((i) => i.severity === "error").length !== 1 ? "s" : ""
|
|
1973
|
+
] }),
|
|
1974
|
+
auditIssues.filter((i) => i.severity === "warning").length > 0 && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-warning font-semibold", children: [
|
|
1975
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3 w-3", fill: "currentColor", children: [
|
|
1976
|
+
/* @__PURE__ */ jsx("path", { d: "M8 1L15 14H1L8 1Z" }),
|
|
1977
|
+
/* @__PURE__ */ jsx("path", { d: "M8 6v3.5M8 11v.5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1978
|
+
] }),
|
|
1979
|
+
auditIssues.filter((i) => i.severity === "warning").length,
|
|
1980
|
+
" warning",
|
|
1981
|
+
auditIssues.filter((i) => i.severity === "warning").length !== 1 ? "s" : ""
|
|
1982
|
+
] })
|
|
1983
|
+
] }) }),
|
|
1984
|
+
/* @__PURE__ */ jsxs(
|
|
1985
|
+
Button,
|
|
1986
|
+
{
|
|
1987
|
+
type: "button",
|
|
1988
|
+
variant: "ghost",
|
|
1989
|
+
size: "sm",
|
|
1990
|
+
onClick: runLiveAudit,
|
|
1991
|
+
className: "flex items-center gap-1 h-7 px-2.5 text-xs font-medium text-fg-muted hover:text-fg hover:bg-surface-hover transition cursor-pointer",
|
|
1992
|
+
title: "Re-scan DOM for violations",
|
|
1993
|
+
children: [
|
|
1994
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-3 w-3 shrink-0", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 1 0 3-6.7M3 4v5h5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
1995
|
+
/* @__PURE__ */ jsx("span", { children: "Re-scan" })
|
|
1996
|
+
]
|
|
1997
|
+
}
|
|
1998
|
+
)
|
|
1999
|
+
] }),
|
|
2000
|
+
tab === "bridge" && /* @__PURE__ */ jsx("div", { className: "p-3 pt-2.5 pb-2.5 border-t border-hairline bg-surface shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "rounded-[var(--radius-panel)] border border-hairline overflow-hidden", children: [
|
|
2001
|
+
/* @__PURE__ */ jsxs(
|
|
2002
|
+
"button",
|
|
2003
|
+
{
|
|
2004
|
+
type: "button",
|
|
2005
|
+
onClick: () => setStreamHowItWorksOpen(!streamHowItWorksOpen),
|
|
2006
|
+
className: "w-full p-2 flex items-center justify-between text-xs font-medium text-fg hover:bg-surface-hover/60 transition cursor-pointer",
|
|
2007
|
+
children: [
|
|
2008
|
+
/* @__PURE__ */ jsx("span", { children: "How it works" }),
|
|
2009
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-fg-muted", children: [
|
|
2010
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs", children: "Real-time Sync" }),
|
|
2011
|
+
/* @__PURE__ */ jsx(
|
|
2012
|
+
"svg",
|
|
2013
|
+
{
|
|
2014
|
+
viewBox: "0 0 16 16",
|
|
2015
|
+
className: cn(
|
|
2016
|
+
"h-3 w-3 transition-transform duration-200",
|
|
2017
|
+
streamHowItWorksOpen && "rotate-180"
|
|
2018
|
+
),
|
|
2019
|
+
fill: "none",
|
|
2020
|
+
stroke: "currentColor",
|
|
2021
|
+
strokeWidth: "2",
|
|
2022
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
2023
|
+
}
|
|
2024
|
+
)
|
|
2025
|
+
] })
|
|
2026
|
+
]
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
/* @__PURE__ */ jsx(
|
|
2030
|
+
"div",
|
|
2031
|
+
{
|
|
2032
|
+
className: cn(
|
|
2033
|
+
"grid transition-all duration-200 ease-out",
|
|
2034
|
+
streamHowItWorksOpen ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
|
2035
|
+
),
|
|
2036
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "p-2.5 pt-0 border-t border-hairline/40 text-xs text-fg-muted leading-relaxed", children: "The bridge syncs live design tokens, active themes, and DOM audit status directly with AI coding agents without manual copy-pasting." }) })
|
|
2037
|
+
}
|
|
2038
|
+
)
|
|
2039
|
+
] }) })
|
|
2040
|
+
]
|
|
2041
|
+
}
|
|
2042
|
+
)
|
|
2043
|
+
] }) }),
|
|
2044
|
+
/* @__PURE__ */ jsx(Inspector, { findings: inspectorFindings, bridgePort: bPort, position, theme, themeStyle: INSPECTOR_THEME_STYLE })
|
|
2045
|
+
] });
|
|
2046
|
+
}
|
|
2047
|
+
var DevToolsPanel_default = DevToolsPanel;
|
|
2048
|
+
export {
|
|
2049
|
+
DevToolsPanel_default as default
|
|
2050
|
+
};
|