@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,560 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect, useRef, useMemo } from "react";
|
|
4
|
+
import { useTimeouts } from "../useTimeouts.js";
|
|
5
|
+
import {
|
|
6
|
+
BRAND_PRESETS,
|
|
7
|
+
GRAY_PRESETS,
|
|
8
|
+
SCALING_PRESETS,
|
|
9
|
+
DISPLAY_FONTS,
|
|
10
|
+
BODY_FONTS,
|
|
11
|
+
THEME_PRESETS,
|
|
12
|
+
applyBrandColor,
|
|
13
|
+
applyGrayColor,
|
|
14
|
+
applyRadiusPreset,
|
|
15
|
+
applyScalingPreset,
|
|
16
|
+
applyPanelBackground,
|
|
17
|
+
applyDisplayFontPreset,
|
|
18
|
+
applyBodyFontPreset,
|
|
19
|
+
applySubheadingFont,
|
|
20
|
+
applyThemePreset,
|
|
21
|
+
tripletToHex,
|
|
22
|
+
resolveBrandTriplet
|
|
23
|
+
} from "../../lib/theme-presets.js";
|
|
24
|
+
const DEFAULT_FALLBACK_HEX = "#000000";
|
|
25
|
+
function matchBrandPreset(hex, isDark) {
|
|
26
|
+
const lower = hex.toLowerCase();
|
|
27
|
+
const m = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(lower);
|
|
28
|
+
const neutral = !!m && Math.max(...[1, 2, 3].map((i) => parseInt(m[i], 16))) - Math.min(...[1, 2, 3].map((i) => parseInt(m[i], 16))) <= 8;
|
|
29
|
+
return BRAND_PRESETS.find((p) => p.hex.toLowerCase() === lower) ?? (neutral ? BRAND_PRESETS.find((p) => p.name === "Monochrome") : void 0) ?? BRAND_PRESETS.find((p) => {
|
|
30
|
+
try {
|
|
31
|
+
return tripletToHex(resolveBrandTriplet(p.hex, isDark)).toLowerCase() === lower;
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function useThemeController() {
|
|
38
|
+
const [themeName, setThemeName] = useState("Monochrome");
|
|
39
|
+
const [dark, setDark] = useState(false);
|
|
40
|
+
const [brandHex, setBrandHex] = useState(() => {
|
|
41
|
+
if (typeof window !== "undefined") {
|
|
42
|
+
try {
|
|
43
|
+
const saved = localStorage.getItem("shavin-brand");
|
|
44
|
+
if (saved && saved.startsWith("#")) return saved;
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return "#3b82f6";
|
|
49
|
+
});
|
|
50
|
+
const [brandName, setBrandName] = useState("Blue");
|
|
51
|
+
const [grayName, setGrayName] = useState("Zinc");
|
|
52
|
+
const [radiusName, setRadiusName] = useState("medium");
|
|
53
|
+
const [scaling, setScaling] = useState(100);
|
|
54
|
+
const [translucent, setTranslucent] = useState(false);
|
|
55
|
+
const [displayFont, setDisplayFont] = useState("Rethink Sans");
|
|
56
|
+
const [bodyFont, setBodyFont] = useState("Inter");
|
|
57
|
+
const [subheadingFont, setSubheadingFont] = useState("body");
|
|
58
|
+
const initialSubheadingRef = useRef("body");
|
|
59
|
+
const initialProjectConfigRef = useRef(null);
|
|
60
|
+
const [detectedHeadingFont, setDetectedHeadingFont] = useState(null);
|
|
61
|
+
const [detectedBodyFont, setDetectedBodyFont] = useState(null);
|
|
62
|
+
const [copied, setCopied] = useState(false);
|
|
63
|
+
const later = useTimeouts();
|
|
64
|
+
const [customFontHelp, setCustomFontHelp] = useState(false);
|
|
65
|
+
const customFontHelpRef = useRef(null);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (customFontHelp) customFontHelpRef.current?.scrollIntoView({ block: "nearest" });
|
|
68
|
+
}, [customFontHelp]);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
let initialHeading = "Rethink Sans";
|
|
71
|
+
let initialBody = "Inter";
|
|
72
|
+
let initialBrandHex = "#3b82f6";
|
|
73
|
+
let initialBrandName = "Blue";
|
|
74
|
+
if (typeof document !== "undefined") {
|
|
75
|
+
try {
|
|
76
|
+
const computed = getComputedStyle(document.documentElement);
|
|
77
|
+
const rawDisplay = computed.getPropertyValue("--font-display").trim().replace(/['"]/g, "");
|
|
78
|
+
const primaryDisplay = rawDisplay ? rawDisplay.split(",")[0].trim() : "";
|
|
79
|
+
if (primaryDisplay && !DISPLAY_FONTS.some((f) => f.name.toLowerCase() === primaryDisplay.toLowerCase())) {
|
|
80
|
+
setDetectedHeadingFont(primaryDisplay);
|
|
81
|
+
setDisplayFont(primaryDisplay);
|
|
82
|
+
initialHeading = primaryDisplay;
|
|
83
|
+
}
|
|
84
|
+
const rawBody = computed.getPropertyValue("--font-body").trim().replace(/['"]/g, "");
|
|
85
|
+
const primaryBody = rawBody ? rawBody.split(",")[0].trim() : "";
|
|
86
|
+
if (primaryBody && !BODY_FONTS.some((f) => f.name.toLowerCase() === primaryBody.toLowerCase())) {
|
|
87
|
+
setDetectedBodyFont(primaryBody);
|
|
88
|
+
setBodyFont(primaryBody);
|
|
89
|
+
initialBody = primaryBody;
|
|
90
|
+
}
|
|
91
|
+
const rawBrand = computed.getPropertyValue("--brand").trim();
|
|
92
|
+
if (rawBrand) {
|
|
93
|
+
const detectedHex = rawBrand.includes(" ") ? tripletToHex(rawBrand) : rawBrand.startsWith("#") ? rawBrand : null;
|
|
94
|
+
if (detectedHex) {
|
|
95
|
+
initialBrandHex = detectedHex;
|
|
96
|
+
const matched = matchBrandPreset(detectedHex, document.documentElement.classList.contains("dark"));
|
|
97
|
+
if (matched) initialBrandName = matched.name;
|
|
98
|
+
setBrandHex(matched ? matched.hex : detectedHex);
|
|
99
|
+
setBrandName(initialBrandName);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} catch {
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!initialProjectConfigRef.current) {
|
|
106
|
+
initialProjectConfigRef.current = {
|
|
107
|
+
themeName: "Monochrome",
|
|
108
|
+
// ds-lint-disable-next-line no-hex — initial devtools fallback color
|
|
109
|
+
brandHex: initialBrandHex,
|
|
110
|
+
brandName: initialBrandName,
|
|
111
|
+
grayName: "Zinc",
|
|
112
|
+
radiusName: "medium",
|
|
113
|
+
scaling: 100,
|
|
114
|
+
translucent: false,
|
|
115
|
+
displayFont: initialHeading,
|
|
116
|
+
bodyFont: initialBody
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}, []);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (typeof document !== "undefined") {
|
|
122
|
+
setDark(document.documentElement.classList.contains("dark"));
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (typeof window === "undefined") return;
|
|
127
|
+
const handleThemeChange = () => {
|
|
128
|
+
try {
|
|
129
|
+
const root = document.documentElement;
|
|
130
|
+
const computed = getComputedStyle(root);
|
|
131
|
+
setDark(root.classList.contains("dark"));
|
|
132
|
+
const rawBrand = computed.getPropertyValue("--brand").trim();
|
|
133
|
+
if (rawBrand) {
|
|
134
|
+
const detectedHex = rawBrand.includes(" ") ? tripletToHex(rawBrand) : rawBrand.startsWith("#") ? rawBrand : null;
|
|
135
|
+
if (detectedHex) {
|
|
136
|
+
const matched = matchBrandPreset(detectedHex, root.classList.contains("dark"));
|
|
137
|
+
setBrandHex(matched ? matched.hex : detectedHex);
|
|
138
|
+
if (matched) setBrandName(matched.name);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const savedGray = localStorage.getItem("shavin-gray");
|
|
142
|
+
if (savedGray) setGrayName(savedGray);
|
|
143
|
+
const savedRadius = localStorage.getItem("shavin-radius");
|
|
144
|
+
if (savedRadius) setRadiusName(savedRadius);
|
|
145
|
+
const savedScaling = localStorage.getItem("shavin-scaling");
|
|
146
|
+
if (savedScaling) setScaling(Number(savedScaling) || 100);
|
|
147
|
+
setTranslucent(root.classList.contains("translucent-panels"));
|
|
148
|
+
const savedDisplayFont = localStorage.getItem("shavin-display-font");
|
|
149
|
+
if (savedDisplayFont) setDisplayFont(savedDisplayFont);
|
|
150
|
+
const savedBodyFont = localStorage.getItem("shavin-body-font");
|
|
151
|
+
if (savedBodyFont) setBodyFont(savedBodyFont);
|
|
152
|
+
const savedBrandHex = localStorage.getItem("shavin-brand");
|
|
153
|
+
const savedPanel = localStorage.getItem("shavin-panel");
|
|
154
|
+
const isDarkMode = root.classList.contains("dark");
|
|
155
|
+
const matchedPreset = THEME_PRESETS.find((p) => {
|
|
156
|
+
const pHex = BRAND_PRESETS.find(
|
|
157
|
+
(a) => a.name.toLowerCase() === p.brandColor.toLowerCase()
|
|
158
|
+
)?.hex ?? DEFAULT_FALLBACK_HEX;
|
|
159
|
+
return pHex.toLowerCase() === (savedBrandHex || "").toLowerCase() && (p.grayColor || "").toLowerCase() === (savedGray || "").toLowerCase() && (p.radius || "").toLowerCase() === (savedRadius || "").toLowerCase() && (p.scaling || 100) === (Number(savedScaling) || 100) && (p.panelBackground || "solid") === (savedPanel === "translucent" ? "translucent" : "solid") && (p.displayFont || "Inter").toLowerCase() === (savedDisplayFont || "").toLowerCase() && (p.bodyFont || "Inter").toLowerCase() === (savedBodyFont || "").toLowerCase() && p.appearance === (isDarkMode ? "dark" : "light");
|
|
160
|
+
});
|
|
161
|
+
setThemeName(matchedPreset ? matchedPreset.name : "Custom");
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
window.addEventListener("shavin-theme-change", handleThemeChange);
|
|
166
|
+
return () => {
|
|
167
|
+
window.removeEventListener("shavin-theme-change", handleThemeChange);
|
|
168
|
+
};
|
|
169
|
+
}, []);
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (typeof window === "undefined") return;
|
|
172
|
+
const canon = (list, v) => v ? list.find((x) => x.name.toLowerCase() === v.toLowerCase())?.name : void 0;
|
|
173
|
+
const applyInit = (cfg) => {
|
|
174
|
+
try {
|
|
175
|
+
const gray = canon(GRAY_PRESETS, cfg.gray) ?? "Zinc";
|
|
176
|
+
const radius = (cfg.radius ?? "medium").toLowerCase();
|
|
177
|
+
const scaling2 = cfg.scaling ?? 100;
|
|
178
|
+
const rendered = (el) => {
|
|
179
|
+
if (!el) return void 0;
|
|
180
|
+
const first = getComputedStyle(el).fontFamily.split(",")[0]?.trim().replace(/['"]/g, "");
|
|
181
|
+
const name = first?.replace(/^__/, "").replace(/_Fallback/, "").replace(/_[a-f0-9]{6,}$/i, "").replace(/_/g, " ");
|
|
182
|
+
return name || void 0;
|
|
183
|
+
};
|
|
184
|
+
const heading = canon(DISPLAY_FONTS, cfg.displayFont) ?? cfg.displayFont ?? canon(DISPLAY_FONTS, rendered(document.querySelector("h1, h2"))) ?? rendered(document.querySelector("h1, h2")) ?? "Rethink Sans";
|
|
185
|
+
const body = canon(BODY_FONTS, cfg.bodyFont) ?? cfg.bodyFont ?? canon(BODY_FONTS, rendered(document.body)) ?? rendered(document.body) ?? "Inter";
|
|
186
|
+
const brandPreset = cfg.brand ? BRAND_PRESETS.find((a) => a.name.toLowerCase() === cfg.brand.toLowerCase()) : void 0;
|
|
187
|
+
const brandHex2 = brandPreset?.hex ?? (cfg.brand && cfg.brand.startsWith("#") ? cfg.brand : null);
|
|
188
|
+
localStorage.setItem("shavin-gray", gray);
|
|
189
|
+
localStorage.setItem("shavin-radius", radius);
|
|
190
|
+
localStorage.setItem("shavin-scaling", String(scaling2));
|
|
191
|
+
localStorage.setItem("shavin-panel", cfg.translucentPanels ? "translucent" : "solid");
|
|
192
|
+
localStorage.setItem("shavin-display-font", heading);
|
|
193
|
+
localStorage.setItem("shavin-body-font", body);
|
|
194
|
+
if (brandHex2) localStorage.setItem("shavin-brand", brandHex2);
|
|
195
|
+
if (!DISPLAY_FONTS.some((f) => f.name.toLowerCase() === heading.toLowerCase())) setDetectedHeadingFont(heading);
|
|
196
|
+
if (!BODY_FONTS.some((f) => f.name.toLowerCase() === body.toLowerCase())) setDetectedBodyFont(body);
|
|
197
|
+
initialProjectConfigRef.current = {
|
|
198
|
+
themeName: canon(THEME_PRESETS, cfg.theme) ?? "Custom",
|
|
199
|
+
brandHex: brandHex2 ?? initialProjectConfigRef.current?.brandHex ?? DEFAULT_FALLBACK_HEX,
|
|
200
|
+
brandName: brandPreset?.name ?? initialProjectConfigRef.current?.brandName ?? "Custom",
|
|
201
|
+
grayName: gray,
|
|
202
|
+
radiusName: radius,
|
|
203
|
+
scaling: scaling2,
|
|
204
|
+
translucent: cfg.translucentPanels,
|
|
205
|
+
displayFont: heading,
|
|
206
|
+
bodyFont: body
|
|
207
|
+
};
|
|
208
|
+
{
|
|
209
|
+
const sub = cfg.subheadingFont?.toLowerCase() === "display" ? "display" : "body";
|
|
210
|
+
initialSubheadingRef.current = sub;
|
|
211
|
+
setSubheadingFont(sub);
|
|
212
|
+
}
|
|
213
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
214
|
+
} catch {
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const onInit = (e) => applyInit(e.detail);
|
|
218
|
+
window.addEventListener("shavin-theme-init", onInit);
|
|
219
|
+
const existing = window.__SHAVIN_THEME_CONFIG__;
|
|
220
|
+
if (existing) applyInit(existing);
|
|
221
|
+
return () => window.removeEventListener("shavin-theme-init", onInit);
|
|
222
|
+
}, []);
|
|
223
|
+
const handleSelectTheme = (name) => {
|
|
224
|
+
setThemeName(name);
|
|
225
|
+
if (name === "Custom") return;
|
|
226
|
+
const p = THEME_PRESETS.find((t) => t.name === name);
|
|
227
|
+
if (!p) return;
|
|
228
|
+
applyThemePreset(name);
|
|
229
|
+
const targetHex = BRAND_PRESETS.find((a) => a.name.toLowerCase() === p.brandColor.toLowerCase())?.hex ?? DEFAULT_FALLBACK_HEX;
|
|
230
|
+
setBrandHex(targetHex);
|
|
231
|
+
setBrandName(p.brandColor);
|
|
232
|
+
setGrayName(p.grayColor);
|
|
233
|
+
setRadiusName(p.radius);
|
|
234
|
+
setScaling(p.scaling);
|
|
235
|
+
setTranslucent(p.panelBackground === "translucent");
|
|
236
|
+
setDisplayFont(p.displayFont);
|
|
237
|
+
setBodyFont(p.bodyFont);
|
|
238
|
+
const isDarkMode = p.appearance === "dark";
|
|
239
|
+
setDark(isDarkMode);
|
|
240
|
+
if (typeof document !== "undefined") {
|
|
241
|
+
document.documentElement.classList.toggle("dark", isDarkMode);
|
|
242
|
+
try {
|
|
243
|
+
localStorage.setItem("shavin-appearance", isDarkMode ? "dark" : "light");
|
|
244
|
+
localStorage.setItem("theme", isDarkMode ? "dark" : "light");
|
|
245
|
+
localStorage.setItem("shavin-brand", targetHex);
|
|
246
|
+
localStorage.setItem("shavin-gray", p.grayColor);
|
|
247
|
+
localStorage.setItem("shavin-radius", p.radius);
|
|
248
|
+
localStorage.setItem("shavin-scaling", String(p.scaling));
|
|
249
|
+
localStorage.setItem("shavin-panel", p.panelBackground === "translucent" ? "translucent" : "solid");
|
|
250
|
+
localStorage.setItem("shavin-display-font", p.displayFont);
|
|
251
|
+
localStorage.setItem("shavin-body-font", p.bodyFont);
|
|
252
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
253
|
+
} catch {
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
const handleBrand = (hexOrName, name) => {
|
|
258
|
+
setThemeName("Custom");
|
|
259
|
+
setBrandHex(hexOrName);
|
|
260
|
+
if (name) setBrandName(name);
|
|
261
|
+
applyBrandColor(hexOrName);
|
|
262
|
+
try {
|
|
263
|
+
localStorage.setItem("shavin-brand", hexOrName);
|
|
264
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
265
|
+
} catch {
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const handleGray = (name) => {
|
|
269
|
+
setThemeName("Custom");
|
|
270
|
+
setGrayName(name);
|
|
271
|
+
applyGrayColor(name);
|
|
272
|
+
try {
|
|
273
|
+
localStorage.setItem("shavin-gray", name);
|
|
274
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
275
|
+
} catch {
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
const handleAppearance = (val) => {
|
|
279
|
+
const isDarkMode = val === "dark";
|
|
280
|
+
setThemeName("Custom");
|
|
281
|
+
setDark(isDarkMode);
|
|
282
|
+
if (typeof document !== "undefined") {
|
|
283
|
+
document.documentElement.classList.toggle("dark", isDarkMode);
|
|
284
|
+
try {
|
|
285
|
+
localStorage.setItem("shavin-appearance", isDarkMode ? "dark" : "light");
|
|
286
|
+
localStorage.setItem("theme", isDarkMode ? "dark" : "light");
|
|
287
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
288
|
+
} catch {
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
applyBrandColor(brandHex);
|
|
292
|
+
};
|
|
293
|
+
const handleRadius = (name) => {
|
|
294
|
+
setThemeName("Custom");
|
|
295
|
+
setRadiusName(name);
|
|
296
|
+
applyRadiusPreset(name);
|
|
297
|
+
try {
|
|
298
|
+
localStorage.setItem("shavin-radius", name);
|
|
299
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
300
|
+
} catch {
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const handleScaling = (val) => {
|
|
304
|
+
const num = parseInt(val, 10);
|
|
305
|
+
if (!isNaN(num)) {
|
|
306
|
+
setThemeName("Custom");
|
|
307
|
+
setScaling(num);
|
|
308
|
+
applyScalingPreset(num);
|
|
309
|
+
try {
|
|
310
|
+
localStorage.setItem("shavin-scaling", String(num));
|
|
311
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
312
|
+
} catch {
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const handlePanelStyle = (val) => {
|
|
317
|
+
const isTranslucent = val === "translucent";
|
|
318
|
+
setThemeName("Custom");
|
|
319
|
+
setTranslucent(isTranslucent);
|
|
320
|
+
applyPanelBackground(isTranslucent);
|
|
321
|
+
try {
|
|
322
|
+
localStorage.setItem("shavin-panel", isTranslucent ? "translucent" : "solid");
|
|
323
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
324
|
+
} catch {
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
const handleDisplayFont = (val) => {
|
|
328
|
+
if (val === "__add_custom_font__") {
|
|
329
|
+
setCustomFontHelp(true);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
setThemeName("Custom");
|
|
333
|
+
setDisplayFont(val);
|
|
334
|
+
applyDisplayFontPreset(val);
|
|
335
|
+
try {
|
|
336
|
+
localStorage.setItem("shavin-display-font", val);
|
|
337
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
338
|
+
} catch {
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const handleBodyFont = (val) => {
|
|
342
|
+
if (val === "__add_custom_font__") {
|
|
343
|
+
setCustomFontHelp(true);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
setThemeName("Custom");
|
|
347
|
+
setBodyFont(val);
|
|
348
|
+
applyBodyFontPreset(val);
|
|
349
|
+
try {
|
|
350
|
+
localStorage.setItem("shavin-body-font", val);
|
|
351
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
352
|
+
} catch {
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const handleSubheadingFont = (val) => {
|
|
356
|
+
const next = val === "display" ? "display" : "body";
|
|
357
|
+
setSubheadingFont(next);
|
|
358
|
+
applySubheadingFont(next);
|
|
359
|
+
try {
|
|
360
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
361
|
+
} catch {
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
const resetAll = () => {
|
|
365
|
+
setSubheadingFont(initialSubheadingRef.current);
|
|
366
|
+
applySubheadingFont(initialSubheadingRef.current);
|
|
367
|
+
if (initialProjectConfigRef.current) {
|
|
368
|
+
const init = initialProjectConfigRef.current;
|
|
369
|
+
setThemeName(init.themeName);
|
|
370
|
+
setBrandHex(init.brandHex);
|
|
371
|
+
setBrandName(init.brandName);
|
|
372
|
+
setGrayName(init.grayName);
|
|
373
|
+
setRadiusName(init.radiusName);
|
|
374
|
+
setScaling(init.scaling);
|
|
375
|
+
setTranslucent(init.translucent);
|
|
376
|
+
setDisplayFont(init.displayFont);
|
|
377
|
+
setBodyFont(init.bodyFont);
|
|
378
|
+
applyBrandColor(init.brandHex);
|
|
379
|
+
applyGrayColor(init.grayName);
|
|
380
|
+
applyRadiusPreset(init.radiusName);
|
|
381
|
+
applyScalingPreset(init.scaling);
|
|
382
|
+
applyPanelBackground(init.translucent);
|
|
383
|
+
applyDisplayFontPreset(init.displayFont);
|
|
384
|
+
applyBodyFontPreset(init.bodyFont);
|
|
385
|
+
try {
|
|
386
|
+
localStorage.removeItem("shavin-theme");
|
|
387
|
+
localStorage.removeItem("shavin-brand");
|
|
388
|
+
localStorage.removeItem("shavin-gray");
|
|
389
|
+
localStorage.removeItem("shavin-radius");
|
|
390
|
+
localStorage.removeItem("shavin-scaling");
|
|
391
|
+
localStorage.removeItem("shavin-display-font");
|
|
392
|
+
localStorage.removeItem("shavin-body-font");
|
|
393
|
+
sessionStorage.removeItem("shavin-theme");
|
|
394
|
+
sessionStorage.removeItem("shavin-brand");
|
|
395
|
+
sessionStorage.removeItem("shavin-gray");
|
|
396
|
+
sessionStorage.removeItem("shavin-radius");
|
|
397
|
+
sessionStorage.removeItem("shavin-scaling");
|
|
398
|
+
window.dispatchEvent(new CustomEvent("shavin-theme-change"));
|
|
399
|
+
} catch {
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
handleSelectTheme("Monochrome");
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
const customGraySwatch = GRAY_PRESETS.find((g) => g.name.toLowerCase() === grayName.toLowerCase())?.swatch ?? DEFAULT_FALLBACK_HEX;
|
|
406
|
+
const themeOptions = [
|
|
407
|
+
...THEME_PRESETS.map((p) => {
|
|
408
|
+
const aHex = BRAND_PRESETS.find((a) => a.name.toLowerCase() === p.brandColor.toLowerCase())?.hex ?? DEFAULT_FALLBACK_HEX;
|
|
409
|
+
const gSwatch = GRAY_PRESETS.find((g) => g.name.toLowerCase() === p.grayColor.toLowerCase())?.swatch ?? DEFAULT_FALLBACK_HEX;
|
|
410
|
+
return {
|
|
411
|
+
value: p.name,
|
|
412
|
+
label: p.name,
|
|
413
|
+
prefix: /* @__PURE__ */ jsxs("span", { "data-swatch": "true", className: "inline-flex items-center gap-0.5 shrink-0", title: `${p.brandColor} + ${p.grayColor}`, children: [
|
|
414
|
+
/* @__PURE__ */ jsx("span", { "data-swatch": "true", className: "h-3 w-3.5 rounded-[var(--radius-sm)] border border-hairline", style: { backgroundColor: aHex } }),
|
|
415
|
+
/* @__PURE__ */ jsx("span", { "data-swatch": "true", className: "h-3 w-3.5 rounded-[var(--radius-sm)] border border-hairline", style: { backgroundColor: gSwatch } })
|
|
416
|
+
] })
|
|
417
|
+
};
|
|
418
|
+
}),
|
|
419
|
+
{
|
|
420
|
+
value: "Custom",
|
|
421
|
+
label: "Custom",
|
|
422
|
+
prefix: /* @__PURE__ */ jsxs("span", { "data-swatch": "true", className: "inline-flex items-center gap-0.5 shrink-0", title: "Custom theme settings", children: [
|
|
423
|
+
/* @__PURE__ */ jsx(
|
|
424
|
+
"span",
|
|
425
|
+
{
|
|
426
|
+
"data-swatch": "true",
|
|
427
|
+
className: "h-3 w-3.5 rounded-[var(--radius-sm)] border border-hairline",
|
|
428
|
+
style: { backgroundColor: brandHex.startsWith("#") ? brandHex : DEFAULT_FALLBACK_HEX }
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
/* @__PURE__ */ jsx(
|
|
432
|
+
"span",
|
|
433
|
+
{
|
|
434
|
+
"data-swatch": "true",
|
|
435
|
+
className: "h-3 w-3.5 rounded-[var(--radius-sm)] border border-hairline",
|
|
436
|
+
style: { backgroundColor: customGraySwatch }
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
] })
|
|
440
|
+
}
|
|
441
|
+
];
|
|
442
|
+
const scalingOptions = SCALING_PRESETS.map((pct) => ({
|
|
443
|
+
value: String(pct),
|
|
444
|
+
label: `${pct}%`
|
|
445
|
+
}));
|
|
446
|
+
const displayFontOptions = [
|
|
447
|
+
...detectedHeadingFont ? [{ value: detectedHeadingFont, label: `${detectedHeadingFont} (Project Font)` }] : [],
|
|
448
|
+
...DISPLAY_FONTS.filter((f) => f.name.toLowerCase() !== (detectedHeadingFont || "").toLowerCase()).map((f) => ({
|
|
449
|
+
value: f.name,
|
|
450
|
+
label: f.name
|
|
451
|
+
})),
|
|
452
|
+
{ value: "__add_custom_font__", label: "+ Add custom font..." }
|
|
453
|
+
];
|
|
454
|
+
const bodyFontOptions = [
|
|
455
|
+
...detectedBodyFont ? [{ value: detectedBodyFont, label: `${detectedBodyFont} (Project Font)` }] : [],
|
|
456
|
+
...BODY_FONTS.filter((f) => f.name.toLowerCase() !== (detectedBodyFont || "").toLowerCase()).map((f) => ({
|
|
457
|
+
value: f.name,
|
|
458
|
+
label: f.name
|
|
459
|
+
})),
|
|
460
|
+
{ value: "__add_custom_font__", label: "+ Add custom font..." }
|
|
461
|
+
];
|
|
462
|
+
const isPresetActive = themeName && themeName !== "Custom";
|
|
463
|
+
const activePreset = isPresetActive ? THEME_PRESETS.find((p) => p.name.toLowerCase() === themeName.toLowerCase()) : null;
|
|
464
|
+
const normalizeBrand = (a) => {
|
|
465
|
+
const s = (a || "").toLowerCase();
|
|
466
|
+
return s === "black" ? "monochrome" : s;
|
|
467
|
+
};
|
|
468
|
+
const isExactPreset = activePreset && normalizeBrand(activePreset.brandColor) === normalizeBrand(brandName) && (activePreset.grayColor || "").toLowerCase() === (grayName || "").toLowerCase() && (activePreset.radius || "").toLowerCase() === (radiusName || "").toLowerCase() && (activePreset.scaling || 100) === scaling && (activePreset.panelBackground || "solid") === (translucent ? "translucent" : "solid") && (activePreset.displayFont || "Inter").toLowerCase() === displayFont.toLowerCase() && (activePreset.bodyFont || "Inter").toLowerCase() === bodyFont.toLowerCase();
|
|
469
|
+
const generatedSnippet = isPresetActive && isExactPreset ? `<ThemeProvider theme="${themeName}">
|
|
470
|
+
{children}
|
|
471
|
+
</ThemeProvider>` : `<ThemeProvider
|
|
472
|
+
brandColor="${brandName || brandHex}"
|
|
473
|
+
grayColor="${grayName.toLowerCase()}"
|
|
474
|
+
radius="${radiusName}"
|
|
475
|
+
scaling={${scaling}}
|
|
476
|
+
panelBackground="${translucent ? "translucent" : "solid"}"
|
|
477
|
+
displayFont="${displayFont}"
|
|
478
|
+
bodyFont="${bodyFont}"${subheadingFont === "display" ? '\n subheadingFont="display"' : ""}
|
|
479
|
+
>
|
|
480
|
+
{children}
|
|
481
|
+
</ThemeProvider>`;
|
|
482
|
+
const rootFileHint = useMemo(() => {
|
|
483
|
+
if (typeof document === "undefined") return "layout.tsx / app root";
|
|
484
|
+
if (document.querySelector("next-route-announcer") || document.querySelector("script[src*='/_next/']")) {
|
|
485
|
+
return document.getElementById("__next") ? "pages/_app.tsx" : "app/layout.tsx";
|
|
486
|
+
}
|
|
487
|
+
if (document.getElementById("root")) return "src/App.tsx";
|
|
488
|
+
if (document.getElementById("__remix")) return "app/root.tsx";
|
|
489
|
+
return "layout.tsx / app root";
|
|
490
|
+
}, []);
|
|
491
|
+
const copyCode = () => {
|
|
492
|
+
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
493
|
+
navigator.clipboard.writeText(generatedSnippet);
|
|
494
|
+
setCopied(true);
|
|
495
|
+
later(() => setCopied(false), 2e3);
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
return {
|
|
499
|
+
themeName,
|
|
500
|
+
setThemeName,
|
|
501
|
+
dark,
|
|
502
|
+
setDark,
|
|
503
|
+
brandHex,
|
|
504
|
+
setBrandHex,
|
|
505
|
+
brandName,
|
|
506
|
+
setBrandName,
|
|
507
|
+
grayName,
|
|
508
|
+
setGrayName,
|
|
509
|
+
radiusName,
|
|
510
|
+
setRadiusName,
|
|
511
|
+
scaling,
|
|
512
|
+
setScaling,
|
|
513
|
+
translucent,
|
|
514
|
+
setTranslucent,
|
|
515
|
+
displayFont,
|
|
516
|
+
setDisplayFont,
|
|
517
|
+
bodyFont,
|
|
518
|
+
setBodyFont,
|
|
519
|
+
subheadingFont,
|
|
520
|
+
setSubheadingFont,
|
|
521
|
+
initialSubheadingRef,
|
|
522
|
+
initialProjectConfigRef,
|
|
523
|
+
detectedHeadingFont,
|
|
524
|
+
setDetectedHeadingFont,
|
|
525
|
+
detectedBodyFont,
|
|
526
|
+
setDetectedBodyFont,
|
|
527
|
+
copied,
|
|
528
|
+
setCopied,
|
|
529
|
+
customFontHelp,
|
|
530
|
+
setCustomFontHelp,
|
|
531
|
+
customFontHelpRef,
|
|
532
|
+
handleSelectTheme,
|
|
533
|
+
handleBrand,
|
|
534
|
+
handleGray,
|
|
535
|
+
handleAppearance,
|
|
536
|
+
handleRadius,
|
|
537
|
+
handleScaling,
|
|
538
|
+
handlePanelStyle,
|
|
539
|
+
handleDisplayFont,
|
|
540
|
+
handleBodyFont,
|
|
541
|
+
handleSubheadingFont,
|
|
542
|
+
resetAll,
|
|
543
|
+
customGraySwatch,
|
|
544
|
+
themeOptions,
|
|
545
|
+
scalingOptions,
|
|
546
|
+
displayFontOptions,
|
|
547
|
+
bodyFontOptions,
|
|
548
|
+
isPresetActive,
|
|
549
|
+
activePreset,
|
|
550
|
+
normalizeBrand,
|
|
551
|
+
isExactPreset,
|
|
552
|
+
generatedSnippet,
|
|
553
|
+
rootFileHint,
|
|
554
|
+
copyCode
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
export {
|
|
558
|
+
DEFAULT_FALLBACK_HEX,
|
|
559
|
+
useThemeController
|
|
560
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { isSheetWidth } from "./placement.js";
|
|
3
|
+
function usePhone() {
|
|
4
|
+
const [phone, setPhone] = useState(() => typeof window !== "undefined" && isSheetWidth(window.innerWidth));
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const update = () => setPhone(isSheetWidth(window.innerWidth));
|
|
7
|
+
update();
|
|
8
|
+
window.addEventListener("resize", update, { passive: true });
|
|
9
|
+
return () => window.removeEventListener("resize", update);
|
|
10
|
+
}, []);
|
|
11
|
+
return phone;
|
|
12
|
+
}
|
|
13
|
+
const DOCK_H = 56;
|
|
14
|
+
const TILE_PHONE = 44;
|
|
15
|
+
const SHEET_GAP = 8;
|
|
16
|
+
const sheetStyle = (dockH) => ({
|
|
17
|
+
position: "fixed",
|
|
18
|
+
left: SHEET_GAP,
|
|
19
|
+
right: SHEET_GAP,
|
|
20
|
+
top: "auto",
|
|
21
|
+
// The dock is 56 px plus the device's bottom safe area; the sheet sits 8 px above both.
|
|
22
|
+
bottom: dockH > 0 ? `calc(${dockH}px + env(safe-area-inset-bottom, 0px) + ${SHEET_GAP}px)` : SHEET_GAP,
|
|
23
|
+
width: "auto",
|
|
24
|
+
maxHeight: "62vh"
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
DOCK_H,
|
|
28
|
+
SHEET_GAP,
|
|
29
|
+
TILE_PHONE,
|
|
30
|
+
sheetStyle,
|
|
31
|
+
usePhone
|
|
32
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
const INSPECTOR = "[data-shavin-inspector], .shavin-dev-tools-root, [data-radix-popper-content-wrapper]";
|
|
3
|
+
const HOVER_INTENT_MS = 40;
|
|
4
|
+
const isInspectorElement = (el) => !!el && !!el.closest(INSPECTOR);
|
|
5
|
+
function pickElement(x, y) {
|
|
6
|
+
const el = document.elementFromPoint(x, y);
|
|
7
|
+
if (!el || isInspectorElement(el)) return null;
|
|
8
|
+
if (el === document.documentElement || el === document.body) return null;
|
|
9
|
+
return el;
|
|
10
|
+
}
|
|
11
|
+
function useSelectTool({ active, onSelect }) {
|
|
12
|
+
const [hovered, setHovered] = useState(null);
|
|
13
|
+
const select = useRef(onSelect);
|
|
14
|
+
select.current = onSelect;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!active) {
|
|
17
|
+
setHovered(null);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let timer = 0;
|
|
21
|
+
let frame = 0;
|
|
22
|
+
let pending = null;
|
|
23
|
+
let last = { x: 0, y: 0 };
|
|
24
|
+
const settle = () => {
|
|
25
|
+
frame = 0;
|
|
26
|
+
const el = pickElement(last.x, last.y);
|
|
27
|
+
if (el === pending) return;
|
|
28
|
+
pending = el;
|
|
29
|
+
window.clearTimeout(timer);
|
|
30
|
+
timer = window.setTimeout(() => setHovered(pending), HOVER_INTENT_MS);
|
|
31
|
+
};
|
|
32
|
+
const onMove = (e) => {
|
|
33
|
+
if (e.pointerType === "touch") return;
|
|
34
|
+
last = { x: e.clientX, y: e.clientY };
|
|
35
|
+
if (!frame) frame = requestAnimationFrame(settle);
|
|
36
|
+
};
|
|
37
|
+
const swallow = (e) => {
|
|
38
|
+
const t = e.target;
|
|
39
|
+
if (!t || isInspectorElement(t)) return;
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
e.stopImmediatePropagation();
|
|
42
|
+
};
|
|
43
|
+
const onClick = (e) => {
|
|
44
|
+
const t = e.target;
|
|
45
|
+
if (!t || isInspectorElement(t)) return;
|
|
46
|
+
const el = pickElement(e.clientX, e.clientY) ?? t;
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopImmediatePropagation();
|
|
49
|
+
if (el !== document.documentElement && el !== document.body) select.current(el);
|
|
50
|
+
};
|
|
51
|
+
document.addEventListener("pointermove", onMove, { capture: true, passive: true });
|
|
52
|
+
document.addEventListener("click", onClick, true);
|
|
53
|
+
for (const type of ["auxclick", "dblclick", "submit"]) document.addEventListener(type, swallow, true);
|
|
54
|
+
return () => {
|
|
55
|
+
window.clearTimeout(timer);
|
|
56
|
+
if (frame) cancelAnimationFrame(frame);
|
|
57
|
+
document.removeEventListener("pointermove", onMove, { capture: true });
|
|
58
|
+
document.removeEventListener("click", onClick, true);
|
|
59
|
+
for (const type of ["auxclick", "dblclick", "submit"]) document.removeEventListener(type, swallow, true);
|
|
60
|
+
};
|
|
61
|
+
}, [active]);
|
|
62
|
+
return { hovered, setHovered };
|
|
63
|
+
}
|
|
64
|
+
function walk(el, key) {
|
|
65
|
+
const ok = (n) => n && !isInspectorElement(n) && n !== document.body && n !== document.documentElement ? n : null;
|
|
66
|
+
switch (key) {
|
|
67
|
+
case "ArrowUp":
|
|
68
|
+
return ok(el.parentElement);
|
|
69
|
+
case "ArrowDown":
|
|
70
|
+
return ok(el.firstElementChild);
|
|
71
|
+
case "ArrowLeft":
|
|
72
|
+
return ok(el.previousElementSibling);
|
|
73
|
+
case "ArrowRight":
|
|
74
|
+
return ok(el.nextElementSibling);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
isInspectorElement,
|
|
79
|
+
pickElement,
|
|
80
|
+
useSelectTool,
|
|
81
|
+
walk
|
|
82
|
+
};
|