@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,315 @@
|
|
|
1
|
+
function hexToTriplet(hex) {
|
|
2
|
+
const m = hex.replace("#", "");
|
|
3
|
+
const full = m.length === 3 ? m.split("").map((c) => c + c).join("") : m;
|
|
4
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
5
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
6
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
7
|
+
return `${r} ${g} ${b}`;
|
|
8
|
+
}
|
|
9
|
+
function hexToRgb(hex) {
|
|
10
|
+
const m = hex.replace("#", "");
|
|
11
|
+
const full = m.length === 3 ? m.split("").map((c) => c + c).join("") : m;
|
|
12
|
+
return {
|
|
13
|
+
r: parseInt(full.slice(0, 2), 16),
|
|
14
|
+
g: parseInt(full.slice(2, 4), 16),
|
|
15
|
+
b: parseInt(full.slice(4, 6), 16)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function tripletToHex(triplet) {
|
|
19
|
+
const [r, g, b] = triplet.split(" ").map(Number);
|
|
20
|
+
return `#${[r, g, b].map((c) => Math.round(c).toString(16).padStart(2, "0")).join("")}`;
|
|
21
|
+
}
|
|
22
|
+
function srgbToLinear(c) {
|
|
23
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
24
|
+
}
|
|
25
|
+
function linearToSrgb(c) {
|
|
26
|
+
return c <= 31308e-7 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055;
|
|
27
|
+
}
|
|
28
|
+
function linearRgbToOklab(lin) {
|
|
29
|
+
const l = 0.4122214708 * lin.r + 0.5363325363 * lin.g + 0.0514459929 * lin.b;
|
|
30
|
+
const m = 0.2119034982 * lin.r + 0.6806995451 * lin.g + 0.1073969566 * lin.b;
|
|
31
|
+
const s = 0.0883024619 * lin.r + 0.2817188376 * lin.g + 0.6299787005 * lin.b;
|
|
32
|
+
const l_ = Math.cbrt(l);
|
|
33
|
+
const m_ = Math.cbrt(m);
|
|
34
|
+
const s_ = Math.cbrt(s);
|
|
35
|
+
return {
|
|
36
|
+
L: 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,
|
|
37
|
+
a: 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,
|
|
38
|
+
b: 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function oklabToLinearRgb(lab) {
|
|
42
|
+
const l_ = lab.L + 0.3963377774 * lab.a + 0.2158037573 * lab.b;
|
|
43
|
+
const m_ = lab.L - 0.1055613458 * lab.a - 0.0638531728 * lab.b;
|
|
44
|
+
const s_ = lab.L - 0.0894841775 * lab.a - 1.291485548 * lab.b;
|
|
45
|
+
const l = l_ ** 3;
|
|
46
|
+
const m = m_ ** 3;
|
|
47
|
+
const s = s_ ** 3;
|
|
48
|
+
return {
|
|
49
|
+
r: 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
50
|
+
g: -1.2684380046 * l + 2.6097570426 * m - 0.3413193965 * s,
|
|
51
|
+
b: -0.0041960863 * l - 0.7034186147 * m + 1.7076149664 * s
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function oklabToOklch(lab) {
|
|
55
|
+
const C = Math.sqrt(lab.a ** 2 + lab.b ** 2);
|
|
56
|
+
let H = Math.atan2(lab.b, lab.a) * 180 / Math.PI;
|
|
57
|
+
if (H < 0) H += 360;
|
|
58
|
+
return { L: lab.L, C, H };
|
|
59
|
+
}
|
|
60
|
+
function oklchToOklab(o) {
|
|
61
|
+
const a = Math.cos(o.H * Math.PI / 180) * o.C;
|
|
62
|
+
const b = Math.sin(o.H * Math.PI / 180) * o.C;
|
|
63
|
+
return { L: o.L, a, b };
|
|
64
|
+
}
|
|
65
|
+
function hexToOklch(hex) {
|
|
66
|
+
const { r, g, b } = hexToRgb(hex);
|
|
67
|
+
const lin = {
|
|
68
|
+
r: srgbToLinear(r / 255),
|
|
69
|
+
g: srgbToLinear(g / 255),
|
|
70
|
+
b: srgbToLinear(b / 255)
|
|
71
|
+
};
|
|
72
|
+
return oklabToOklch(linearRgbToOklab(lin));
|
|
73
|
+
}
|
|
74
|
+
function rgbTripletToOklch(triplet) {
|
|
75
|
+
const [r, g, b] = triplet.split(" ").map(Number);
|
|
76
|
+
const lin = {
|
|
77
|
+
r: srgbToLinear(r / 255),
|
|
78
|
+
g: srgbToLinear(g / 255),
|
|
79
|
+
b: srgbToLinear(b / 255)
|
|
80
|
+
};
|
|
81
|
+
return oklabToOklch(linearRgbToOklab(lin));
|
|
82
|
+
}
|
|
83
|
+
function oklchToRgbTriplet(o) {
|
|
84
|
+
const lin = oklabToLinearRgb(oklchToOklab(o));
|
|
85
|
+
const to255 = (c) => {
|
|
86
|
+
const srgb = linearToSrgb(c);
|
|
87
|
+
return Math.max(0, Math.min(255, Math.round(srgb * 255)));
|
|
88
|
+
};
|
|
89
|
+
return `${to255(lin.r)} ${to255(lin.g)} ${to255(lin.b)}`;
|
|
90
|
+
}
|
|
91
|
+
function oklchToHex(o) {
|
|
92
|
+
return tripletToHex(oklchToRgbTriplet(o));
|
|
93
|
+
}
|
|
94
|
+
function oklchToCss(o, alpha = 1) {
|
|
95
|
+
const L = Math.round(o.L * 1e4) / 1e4;
|
|
96
|
+
const C = Math.round(o.C * 1e4) / 1e4;
|
|
97
|
+
const H = Math.round(o.H * 100) / 100;
|
|
98
|
+
if (alpha >= 1) return `oklch(${L} ${C} ${H})`;
|
|
99
|
+
return `oklch(${L} ${C} ${H} / ${alpha})`;
|
|
100
|
+
}
|
|
101
|
+
function oklchLuminance(o) {
|
|
102
|
+
return o.L;
|
|
103
|
+
}
|
|
104
|
+
const OK_WHITE = { L: 1, C: 0, H: 0 };
|
|
105
|
+
const OK_INK = { L: 0.18, C: 0, H: 0 };
|
|
106
|
+
function tripletLuminance(triplet) {
|
|
107
|
+
const [r, g, b] = triplet.split(" ").map((c) => Number(c) / 255);
|
|
108
|
+
const lin = (c) => c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
109
|
+
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
|
|
110
|
+
}
|
|
111
|
+
function tripletContrast(a, b) {
|
|
112
|
+
const x = tripletLuminance(a);
|
|
113
|
+
const y = tripletLuminance(b);
|
|
114
|
+
return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
|
|
115
|
+
}
|
|
116
|
+
const BRAND_TEXT_CONTRAST = 4.6;
|
|
117
|
+
const LIGHT_TEXT_SURFACES = ["255 255 255", "244 244 245", "241 245 249", "243 244 246", "245 245 245", "245 245 244"];
|
|
118
|
+
const DARK_TEXT_SURFACES = [
|
|
119
|
+
"24 24 27",
|
|
120
|
+
"10 10 12",
|
|
121
|
+
"30 30 33",
|
|
122
|
+
"32 32 35",
|
|
123
|
+
"39 39 42",
|
|
124
|
+
// Zinc
|
|
125
|
+
"15 23 42",
|
|
126
|
+
"2 6 23",
|
|
127
|
+
"23 32 51",
|
|
128
|
+
"30 41 59",
|
|
129
|
+
// Slate
|
|
130
|
+
"17 24 39",
|
|
131
|
+
"3 7 18",
|
|
132
|
+
"24 33 47",
|
|
133
|
+
"31 41 55",
|
|
134
|
+
// Gray
|
|
135
|
+
"23 23 23",
|
|
136
|
+
"10 10 10",
|
|
137
|
+
"31 31 31",
|
|
138
|
+
"38 38 38",
|
|
139
|
+
// Neutral
|
|
140
|
+
"28 25 23",
|
|
141
|
+
"12 10 9",
|
|
142
|
+
"35 31 30",
|
|
143
|
+
"41 37 36"
|
|
144
|
+
// Stone
|
|
145
|
+
];
|
|
146
|
+
const LIGHT_TINT_ALPHAS = [0.08, 0.1, 0.12, 0.15, 0.18];
|
|
147
|
+
const DARK_TINT_ALPHAS = [0.08, 0.1, 0.15, 0.18, 0.22];
|
|
148
|
+
function brandTextSurfaces(fill, isDark) {
|
|
149
|
+
const base = isDark ? DARK_TEXT_SURFACES : LIGHT_TEXT_SURFACES;
|
|
150
|
+
const alphas = isDark ? DARK_TINT_ALPHAS : LIGHT_TINT_ALPHAS;
|
|
151
|
+
const f = fill.split(" ").map(Number);
|
|
152
|
+
const out = [...base];
|
|
153
|
+
for (const s of base) {
|
|
154
|
+
const c = s.split(" ").map(Number);
|
|
155
|
+
for (const a of alphas) {
|
|
156
|
+
const q = Math.round(a * 255) / 255;
|
|
157
|
+
out.push(f.map((v, i) => Math.round(v * q + c[i] * (1 - q))).join(" "));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
function minContrastOn(rgb, bgLums) {
|
|
163
|
+
const x = tripletLuminance(rgb);
|
|
164
|
+
let min = Infinity;
|
|
165
|
+
for (const y of bgLums) min = Math.min(min, (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05));
|
|
166
|
+
return min;
|
|
167
|
+
}
|
|
168
|
+
function oklchForegroundFor(o) {
|
|
169
|
+
const fill = oklchToRgbTriplet(o);
|
|
170
|
+
const white = tripletContrast("255 255 255", fill);
|
|
171
|
+
if (white >= 4.5) return OK_WHITE;
|
|
172
|
+
return tripletContrast(oklchToRgbTriplet(OK_INK), fill) > white ? OK_INK : OK_WHITE;
|
|
173
|
+
}
|
|
174
|
+
function oklchHoverFor(o, isDark, amount = 0.08) {
|
|
175
|
+
const fg = oklchToRgbTriplet(oklchForegroundFor(o));
|
|
176
|
+
const shift = (targetL) => ({ L: o.L + (targetL - o.L) * amount, C: o.C, H: o.H });
|
|
177
|
+
const usual = shift(isDark ? 1 : 0);
|
|
178
|
+
const base = tripletContrast(fg, oklchToRgbTriplet(o));
|
|
179
|
+
if (tripletContrast(fg, oklchToRgbTriplet(usual)) >= Math.min(4.5, base)) return usual;
|
|
180
|
+
return shift(fg === "255 255 255" ? 0 : 1);
|
|
181
|
+
}
|
|
182
|
+
function oklchTextFor(o, isDark) {
|
|
183
|
+
const bgs = brandTextSurfaces(oklchToRgbTriplet(o), isDark).map(tripletLuminance);
|
|
184
|
+
for (let step = 0; step <= 50; step++) {
|
|
185
|
+
const candidate = { L: o.L + ((isDark ? 1 : 0) - o.L) * (step / 50), C: o.C, H: o.H };
|
|
186
|
+
if (minContrastOn(oklchToRgbTriplet(candidate), bgs) >= BRAND_TEXT_CONTRAST) return candidate;
|
|
187
|
+
}
|
|
188
|
+
return isDark ? OK_WHITE : { L: 0, C: 0, H: 0 };
|
|
189
|
+
}
|
|
190
|
+
function oklchBrandForMode(o, isDark) {
|
|
191
|
+
const lum = tripletLuminance(oklchToRgbTriplet(o));
|
|
192
|
+
if (isDark ? lum >= 0.12 : lum <= 0.85) return o;
|
|
193
|
+
const flipped = isDark ? { L: 0.92, C: 0, H: 0 } : { L: 0.18, C: 0, H: 0 };
|
|
194
|
+
if (o.C < 0.03) return flipped;
|
|
195
|
+
const canvas = isDark ? "10 10 12" : "255 255 255";
|
|
196
|
+
for (let step = 1; step <= 100; step++) {
|
|
197
|
+
const candidate = { L: o.L + ((isDark ? 1 : 0) - o.L) * (step / 100), C: o.C, H: o.H };
|
|
198
|
+
if (tripletContrast(oklchToRgbTriplet(candidate), canvas) >= 3) return candidate;
|
|
199
|
+
}
|
|
200
|
+
return flipped;
|
|
201
|
+
}
|
|
202
|
+
const BRAND_SOLID_CONTRAST = 4.6;
|
|
203
|
+
const BRAND_SOLID_MAX_DL = 0.12;
|
|
204
|
+
const roundTo = (v, places) => Math.round(v * 10 ** places) / 10 ** places;
|
|
205
|
+
function fitChroma(L, C, H) {
|
|
206
|
+
let c = C;
|
|
207
|
+
for (let i = 0; i <= 60; i++) {
|
|
208
|
+
const candidate = { L: roundTo(L, 4), C: roundTo(c, 4), H: roundTo(H, 2) };
|
|
209
|
+
if (c <= 0 || Math.abs(rgbTripletToOklch(oklchToRgbTriplet(candidate)).C - candidate.C) < 4e-3) return candidate;
|
|
210
|
+
c -= C / 60;
|
|
211
|
+
}
|
|
212
|
+
return { L: roundTo(L, 4), C: 0, H: roundTo(H, 2) };
|
|
213
|
+
}
|
|
214
|
+
function oklchSolidFor(o) {
|
|
215
|
+
if (tripletContrast("255 255 255", oklchToRgbTriplet(o)) >= BRAND_SOLID_CONTRAST) return { fill: o, changed: false, light: false, dL: 0 };
|
|
216
|
+
for (let step = 1; step * 1e-3 <= BRAND_SOLID_MAX_DL + 1e-9; step++) {
|
|
217
|
+
const candidate = fitChroma(o.L - step * 1e-3, o.C, o.H);
|
|
218
|
+
if (tripletContrast("255 255 255", oklchToRgbTriplet(candidate)) >= BRAND_SOLID_CONTRAST) {
|
|
219
|
+
return { fill: candidate, changed: true, light: false, dL: o.L - candidate.L };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return { fill: o, changed: false, light: true, dL: 0 };
|
|
223
|
+
}
|
|
224
|
+
function oklchSolidHoverFor(fill, fg, isDark, amount = 0.12) {
|
|
225
|
+
const fgT = oklchToRgbTriplet(fg);
|
|
226
|
+
const shift = (targetL) => ({ L: roundTo(fill.L + (targetL - fill.L) * amount, 4), C: roundTo(fill.C, 4), H: roundTo(fill.H, 2) });
|
|
227
|
+
const usual = shift(isDark ? 1 : 0);
|
|
228
|
+
if (tripletContrast(fgT, oklchToRgbTriplet(usual)) >= 4.5) return usual;
|
|
229
|
+
return shift(fgT === "255 255 255" ? 0 : 1);
|
|
230
|
+
}
|
|
231
|
+
function apcaY(triplet) {
|
|
232
|
+
const [r, g, b] = triplet.split(" ").map((c) => (Number(c) / 255) ** 2.4);
|
|
233
|
+
const y = r * 0.2126729 + g * 0.7151522 + b * 0.072175;
|
|
234
|
+
return y < 0.022 ? y + (0.022 - y) ** 1.414 : y;
|
|
235
|
+
}
|
|
236
|
+
function apcaContrast(text, bg) {
|
|
237
|
+
const yt = apcaY(text);
|
|
238
|
+
const yb = apcaY(bg);
|
|
239
|
+
if (Math.abs(yb - yt) < 5e-4) return 0;
|
|
240
|
+
if (yb > yt) {
|
|
241
|
+
const s2 = (yb ** 0.56 - yt ** 0.57) * 1.14;
|
|
242
|
+
return s2 < 0.1 ? 0 : (s2 - 0.027) * 100;
|
|
243
|
+
}
|
|
244
|
+
const s = (yb ** 0.65 - yt ** 0.62) * 1.14;
|
|
245
|
+
return s > -0.1 ? 0 : (s + 0.027) * 100;
|
|
246
|
+
}
|
|
247
|
+
function oklchMix(from, to, amount) {
|
|
248
|
+
let deltaH = to.H - from.H;
|
|
249
|
+
if (deltaH > 180) deltaH -= 360;
|
|
250
|
+
if (deltaH < -180) deltaH += 360;
|
|
251
|
+
return {
|
|
252
|
+
L: from.L + (to.L - from.L) * amount,
|
|
253
|
+
C: from.C + (to.C - from.C) * amount,
|
|
254
|
+
H: (from.H + deltaH * amount + 360) % 360
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function oklchScale(base, steps, anchorIndex) {
|
|
258
|
+
const anchor = anchorIndex ?? Math.floor(steps / 2);
|
|
259
|
+
const minL = 0.05;
|
|
260
|
+
const maxL = 0.98;
|
|
261
|
+
const Lleft = anchor;
|
|
262
|
+
const Lright = steps - 1 - anchor;
|
|
263
|
+
const stepDown = Lleft > 0 ? (base.L - minL) / Lleft : 0;
|
|
264
|
+
const stepUp = Lright > 0 ? (maxL - base.L) / Lright : 0;
|
|
265
|
+
const scale = [];
|
|
266
|
+
for (let i = 0; i < steps; i++) {
|
|
267
|
+
const L = i <= anchor ? base.L - stepDown * (anchor - i) : base.L + stepUp * (i - anchor);
|
|
268
|
+
const distFromAnchor = Math.abs(i - anchor) / Math.max(anchor, steps - 1 - anchor);
|
|
269
|
+
const C = base.C * (1 - distFromAnchor * 0.6);
|
|
270
|
+
scale.push({ L, C: Math.max(0, C), H: base.H });
|
|
271
|
+
}
|
|
272
|
+
return scale;
|
|
273
|
+
}
|
|
274
|
+
function getColorSpace() {
|
|
275
|
+
if (typeof document !== "undefined") {
|
|
276
|
+
const attr = document.documentElement.dataset.colorSpace;
|
|
277
|
+
if (attr === "oklch") return "oklch";
|
|
278
|
+
}
|
|
279
|
+
return "rgb";
|
|
280
|
+
}
|
|
281
|
+
function setColorSpace(cs) {
|
|
282
|
+
if (typeof document !== "undefined") {
|
|
283
|
+
if (cs === "oklch") {
|
|
284
|
+
document.documentElement.dataset.colorSpace = "oklch";
|
|
285
|
+
} else {
|
|
286
|
+
delete document.documentElement.dataset.colorSpace;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
export {
|
|
291
|
+
BRAND_SOLID_CONTRAST,
|
|
292
|
+
BRAND_SOLID_MAX_DL,
|
|
293
|
+
BRAND_TEXT_CONTRAST,
|
|
294
|
+
apcaContrast,
|
|
295
|
+
brandTextSurfaces,
|
|
296
|
+
getColorSpace,
|
|
297
|
+
hexToOklch,
|
|
298
|
+
hexToRgb,
|
|
299
|
+
hexToTriplet,
|
|
300
|
+
oklchBrandForMode,
|
|
301
|
+
oklchForegroundFor,
|
|
302
|
+
oklchHoverFor,
|
|
303
|
+
oklchLuminance,
|
|
304
|
+
oklchMix,
|
|
305
|
+
oklchScale,
|
|
306
|
+
oklchSolidFor,
|
|
307
|
+
oklchSolidHoverFor,
|
|
308
|
+
oklchTextFor,
|
|
309
|
+
oklchToCss,
|
|
310
|
+
oklchToHex,
|
|
311
|
+
oklchToRgbTriplet,
|
|
312
|
+
rgbTripletToOklch,
|
|
313
|
+
setColorSpace,
|
|
314
|
+
tripletToHex
|
|
315
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const PADDING_REM = {
|
|
2
|
+
"0": "0rem",
|
|
3
|
+
"0.5": "0.125rem",
|
|
4
|
+
"1": "0.25rem",
|
|
5
|
+
"1.5": "0.375rem",
|
|
6
|
+
"2": "0.5rem",
|
|
7
|
+
"2.5": "0.625rem",
|
|
8
|
+
"3": "0.75rem",
|
|
9
|
+
"3.5": "0.875rem",
|
|
10
|
+
"4": "1rem",
|
|
11
|
+
"5": "1.25rem",
|
|
12
|
+
"6": "1.5rem",
|
|
13
|
+
"7": "1.75rem",
|
|
14
|
+
"8": "2rem",
|
|
15
|
+
"9": "2.25rem",
|
|
16
|
+
"10": "2.5rem",
|
|
17
|
+
"11": "2.75rem",
|
|
18
|
+
"12": "3rem",
|
|
19
|
+
"14": "3.5rem",
|
|
20
|
+
"16": "4rem",
|
|
21
|
+
"20": "5rem",
|
|
22
|
+
"24": "6rem"
|
|
23
|
+
};
|
|
24
|
+
const CARD_PADDING_MAP = {
|
|
25
|
+
none: "0",
|
|
26
|
+
xs: "2",
|
|
27
|
+
sm: "4",
|
|
28
|
+
md: "5",
|
|
29
|
+
lg: "6",
|
|
30
|
+
xl: "8",
|
|
31
|
+
"2xl": "10",
|
|
32
|
+
"3xl": "12"
|
|
33
|
+
};
|
|
34
|
+
function cardPaddingToScale(padding) {
|
|
35
|
+
if (!padding) return null;
|
|
36
|
+
return CARD_PADDING_MAP[padding] ?? null;
|
|
37
|
+
}
|
|
38
|
+
const CONCENTRIC_FLOOR = "min(var(--radius-lg), calc(var(--radius-panel) / 2))";
|
|
39
|
+
function concentricRadius(paddingScale, opts = {}) {
|
|
40
|
+
const outer = opts.outer ?? "var(--radius-panel)";
|
|
41
|
+
const scale = paddingScale ?? "0";
|
|
42
|
+
if (scale === "0") return opts.border ? `max(0px, calc(${outer} - 1px))` : outer;
|
|
43
|
+
const rem = PADDING_REM[scale];
|
|
44
|
+
if (!rem) return null;
|
|
45
|
+
return `max(${CONCENTRIC_FLOOR}, calc(${outer} - ${rem}))`;
|
|
46
|
+
}
|
|
47
|
+
function concentricContainerStyle(paddingScale, isCardPadding, opts = {}) {
|
|
48
|
+
const scale = isCardPadding ? cardPaddingToScale(paddingScale ?? "none") : paddingScale ?? "0";
|
|
49
|
+
const value = concentricRadius(scale, opts);
|
|
50
|
+
if (!value) return {};
|
|
51
|
+
return { "--radius-panel-inner": value };
|
|
52
|
+
}
|
|
53
|
+
function paddingScaleFromClassName(className) {
|
|
54
|
+
if (!className) return "0";
|
|
55
|
+
let all;
|
|
56
|
+
let x;
|
|
57
|
+
let y;
|
|
58
|
+
for (const cls of className.split(/\s+/)) {
|
|
59
|
+
const m = /^p([xy]?)-(\d+(?:\.5)?)$/.exec(cls);
|
|
60
|
+
if (!m || !PADDING_REM[m[2]]) continue;
|
|
61
|
+
if (m[1] === "x") x = m[2];
|
|
62
|
+
else if (m[1] === "y") y = m[2];
|
|
63
|
+
else all = m[2];
|
|
64
|
+
}
|
|
65
|
+
const h = Number(x ?? all ?? 0);
|
|
66
|
+
const v = Number(y ?? all ?? 0);
|
|
67
|
+
return String(Math.min(h, v));
|
|
68
|
+
}
|
|
69
|
+
function concentricBoundaryResetStyle(_paddingScale) {
|
|
70
|
+
return {
|
|
71
|
+
"--radius-panel-inner": "0px"
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function withConcentricStyle(baseStyle, concentricStyle) {
|
|
75
|
+
return { ...baseStyle ?? {}, ...concentricStyle };
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
CONCENTRIC_FLOOR,
|
|
79
|
+
cardPaddingToScale,
|
|
80
|
+
concentricBoundaryResetStyle,
|
|
81
|
+
concentricContainerStyle,
|
|
82
|
+
concentricRadius,
|
|
83
|
+
paddingScaleFromClassName,
|
|
84
|
+
withConcentricStyle
|
|
85
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function hitAreaClass(hitArea, base = "touch", component) {
|
|
2
|
+
if (hitArea === "none") {
|
|
3
|
+
warnHitAreaNone(component);
|
|
4
|
+
return "hit-area-none";
|
|
5
|
+
}
|
|
6
|
+
if (hitArea === "touch") return base === "input" ? "hit-area-input hit-area-force" : "hit-area-touch hit-area-force";
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
const warned = /* @__PURE__ */ new Set();
|
|
10
|
+
function resetHitAreaWarnings() {
|
|
11
|
+
warned.clear();
|
|
12
|
+
}
|
|
13
|
+
function warnHitAreaNone(component = "component") {
|
|
14
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
|
|
15
|
+
if (typeof window === "undefined") return;
|
|
16
|
+
if (warned.has(component)) return;
|
|
17
|
+
warned.add(component);
|
|
18
|
+
console.warn(
|
|
19
|
+
`[@shavin/ui] ${component} hitArea="none" drops the control below the WCAG 2.2 AA 2.5.8 target size floor (24x24 CSS px) unless it is already 24px or larger; the trade-off is a smaller click and touch target. To restore it: remove the hitArea prop, use hitArea="default" (or "touch"), or make sure the control has a 24px target another way (size, padding, or the hit-area utility).`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
hitAreaClass,
|
|
24
|
+
resetHitAreaWarnings
|
|
25
|
+
};
|