@arshad-shah/cynosure 0.4.0 → 0.5.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/README.md +6 -6
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/adapters/astro/index.d.ts +2 -1
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.js +26 -26
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Announcer/Announcer.d.ts +2 -1
- package/dist/components/Announcer/Announcer.js +31 -33
- package/dist/components/Announcer/Announcer.js.map +1 -1
- package/dist/components/AppShell/AppShell.js +44 -41
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts +19 -5
- package/dist/components/Badge/Badge.js +19 -13
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Button/Button.d.ts +13 -3
- package/dist/components/Button/Button.js +34 -33
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.js +155 -158
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/dates.js +42 -38
- package/dist/components/Calendar/dates.js.map +1 -1
- package/dist/components/Card/Card.d.ts +14 -1
- package/dist/components/Card/Card.js +60 -52
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/ChatMessage/ChatMessage.d.ts +55 -0
- package/dist/components/ChatMessage/ChatMessage.js +50 -0
- package/dist/components/ChatMessage/ChatMessage.js.map +1 -0
- package/dist/components/ChatMessage/index.d.ts +1 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +6 -1
- package/dist/components/CodeBlock/CodeBlock.js +40 -37
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/ColorField/ColorField.d.ts +3 -2
- package/dist/components/ColorField/ColorField.js +138 -139
- package/dist/components/ColorField/ColorField.js.map +1 -1
- package/dist/components/ColorField/read-color.js +5 -6
- package/dist/components/ColorField/read-color.js.map +1 -1
- package/dist/components/ColorSwatches/ColorSwatches.js +42 -33
- package/dist/components/ColorSwatches/ColorSwatches.js.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +13 -2
- package/dist/components/Combobox/Combobox.js +113 -95
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +14 -1
- package/dist/components/CommandPalette/CommandPalette.js +153 -109
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/components/CommandPalette/index.d.ts +1 -1
- package/dist/components/CompareSlider/CompareSlider.js +14 -14
- package/dist/components/CompareSlider/CompareSlider.js.map +1 -1
- package/dist/components/Container/Container.d.ts +1 -1
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Container/Container.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts +27 -13
- package/dist/components/ContextMenu/ContextMenu.js +64 -46
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.js +38 -39
- package/dist/components/CopyButton/CopyButton.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.d.ts +135 -0
- package/dist/components/DataGrid/DataGrid.js +385 -0
- package/dist/components/DataGrid/DataGrid.js.map +1 -0
- package/dist/components/DataGrid/index.d.ts +1 -0
- package/dist/components/DateField/DateField.d.ts +4 -3
- package/dist/components/DateField/DateField.js +70 -59
- package/dist/components/DateField/DateField.js.map +1 -1
- package/dist/components/Dialog/Dialog.js +76 -80
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Disclosure/Disclosure.d.ts +15 -1
- package/dist/components/Disclosure/Disclosure.js +37 -30
- package/dist/components/Disclosure/Disclosure.js.map +1 -1
- package/dist/components/DocumentViewport/DocumentViewport.js +54 -57
- package/dist/components/DocumentViewport/DocumentViewport.js.map +1 -1
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +59 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.js +53 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.js.map +1 -0
- package/dist/components/ErrorBoundary/index.d.ts +1 -0
- package/dist/components/Field/Field.d.ts +38 -5
- package/dist/components/Field/Field.js +47 -39
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/FileDrop/FileDrop.d.ts +26 -1
- package/dist/components/FileDrop/FileDrop.js +149 -98
- package/dist/components/FileDrop/FileDrop.js.map +1 -1
- package/dist/components/FloatingToolbar/FloatingToolbar.js +83 -81
- package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +3 -3
- package/dist/components/Grid/Grid.js +55 -47
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/HighlightedText/HighlightedText.d.ts +40 -0
- package/dist/components/HighlightedText/HighlightedText.js +36 -0
- package/dist/components/HighlightedText/HighlightedText.js.map +1 -0
- package/dist/components/HighlightedText/index.d.ts +2 -0
- package/dist/components/HotkeyField/HotkeyField.d.ts +84 -0
- package/dist/components/HotkeyField/HotkeyField.js +161 -0
- package/dist/components/HotkeyField/HotkeyField.js.map +1 -0
- package/dist/components/HotkeyField/index.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.js +6 -6
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/IconButton/IconButton.js +16 -15
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Inline/Inline.d.ts +2 -2
- package/dist/components/Inline/Inline.js.map +1 -1
- package/dist/components/Kbd/Kbd.d.ts +0 -2
- package/dist/components/Kbd/Kbd.js +16 -22
- package/dist/components/Kbd/Kbd.js.map +1 -1
- package/dist/components/KeyValueEditor/bulk.js +3 -4
- package/dist/components/KeyValueEditor/bulk.js.map +1 -1
- package/dist/components/ListRow/ListRow.d.ts +105 -0
- package/dist/components/ListRow/ListRow.js +164 -0
- package/dist/components/ListRow/ListRow.js.map +1 -0
- package/dist/components/ListRow/index.d.ts +1 -0
- package/dist/components/LoadingDots/LoadingDots.d.ts +7 -2
- package/dist/components/LoadingDots/LoadingDots.js +28 -18
- package/dist/components/LoadingDots/LoadingDots.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +29 -11
- package/dist/components/Menu/Menu.js +204 -111
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Menubar/Menubar.d.ts +40 -0
- package/dist/components/Menubar/Menubar.js +82 -0
- package/dist/components/Menubar/Menubar.js.map +1 -0
- package/dist/components/Menubar/index.d.ts +1 -0
- package/dist/components/Notice/Notice.d.ts +11 -2
- package/dist/components/Notice/Notice.js +31 -28
- package/dist/components/Notice/Notice.js.map +1 -1
- package/dist/components/NumberField/NumberField.d.ts +8 -3
- package/dist/components/NumberField/NumberField.js +151 -100
- package/dist/components/NumberField/NumberField.js.map +1 -1
- package/dist/components/OptionList/OptionList.d.ts +36 -3
- package/dist/components/OptionList/OptionList.js +65 -42
- package/dist/components/OptionList/OptionList.js.map +1 -1
- package/dist/components/OptionList/index.d.ts +1 -1
- package/dist/components/OverlayFrame/OverlayFrame.d.ts +33 -0
- package/dist/components/OverlayFrame/OverlayFrame.js +20 -0
- package/dist/components/OverlayFrame/OverlayFrame.js.map +1 -0
- package/dist/components/OverlayFrame/index.d.ts +1 -0
- package/dist/components/PanZoomCanvas/PanZoomCanvas.d.ts +71 -4
- package/dist/components/PanZoomCanvas/PanZoomCanvas.js +197 -141
- package/dist/components/PanZoomCanvas/PanZoomCanvas.js.map +1 -1
- package/dist/components/PanZoomCanvas/index.d.ts +1 -1
- package/dist/components/PathField/PathField.d.ts +68 -0
- package/dist/components/PathField/PathField.js +67 -0
- package/dist/components/PathField/PathField.js.map +1 -0
- package/dist/components/PathField/index.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +16 -3
- package/dist/components/Popover/Popover.js +51 -42
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +4 -3
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/RowActions/RowActions.d.ts +35 -0
- package/dist/components/RowActions/RowActions.js +38 -0
- package/dist/components/RowActions/RowActions.js.map +1 -0
- package/dist/components/RowActions/index.d.ts +1 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +55 -0
- package/dist/components/ScrollArea/ScrollArea.js +55 -0
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/components/ScrollArea/index.d.ts +1 -0
- package/dist/components/SearchField/SearchField.d.ts +17 -0
- package/dist/components/SearchField/SearchField.js +31 -17
- package/dist/components/SearchField/SearchField.js.map +1 -1
- package/dist/components/SearchField/index.d.ts +1 -1
- package/dist/components/Section/Section.d.ts +1 -1
- package/dist/components/Section/Section.js +1 -1
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +6 -3
- package/dist/components/SegmentedControl/SegmentedControl.js +23 -19
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.d.ts +22 -6
- package/dist/components/Select/Select.js +155 -129
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SelectionFrame/frame-math.js +19 -20
- package/dist/components/SelectionFrame/frame-math.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +13 -1
- package/dist/components/SideNav/SideNav.js +98 -91
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SignaturePad/SignaturePad.js +63 -62
- package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
- package/dist/components/SignaturePad/ink.js +0 -1
- package/dist/components/SignaturePad/ink.js.map +1 -1
- package/dist/components/Slider/Slider.js +88 -91
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/SortButton/SortButton.d.ts +36 -0
- package/dist/components/SortButton/SortButton.js +35 -0
- package/dist/components/SortButton/SortButton.js.map +1 -0
- package/dist/components/SortButton/index.d.ts +1 -0
- package/dist/components/SortableList/SortableList.js +145 -119
- package/dist/components/SortableList/SortableList.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +32 -12
- package/dist/components/SplitPane/SplitPane.js +105 -59
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/Stack/Stack.d.ts +2 -2
- package/dist/components/Stack/Stack.js +24 -17
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/index.d.ts +1 -1
- package/dist/components/Stat/Stat.js +6 -6
- package/dist/components/Stat/Stat.js.map +1 -1
- package/dist/components/StatusBar/StatusBar.d.ts +95 -0
- package/dist/components/StatusBar/StatusBar.js +110 -0
- package/dist/components/StatusBar/StatusBar.js.map +1 -0
- package/dist/components/StatusBar/index.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +6 -6
- package/dist/components/Table/Table.js +71 -99
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +51 -5
- package/dist/components/Tabs/Tabs.js +289 -171
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/TagInput/TagInput.d.ts +10 -2
- package/dist/components/TagInput/TagInput.js +121 -111
- package/dist/components/TagInput/TagInput.js.map +1 -1
- package/dist/components/Text/Text.d.ts +6 -0
- package/dist/components/Text/Text.js +18 -17
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +37 -6
- package/dist/components/TextArea/TextArea.js +200 -72
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +18 -6
- package/dist/components/TextField/TextField.js +59 -54
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TimeField/TimeField.d.ts +4 -3
- package/dist/components/TimeField/TimeField.js +197 -183
- package/dist/components/TimeField/TimeField.js.map +1 -1
- package/dist/components/TitleBar/TitleBar.d.ts +91 -0
- package/dist/components/TitleBar/TitleBar.js +80 -0
- package/dist/components/TitleBar/TitleBar.js.map +1 -0
- package/dist/components/TitleBar/index.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts +17 -2
- package/dist/components/Toast/Toast.js +162 -145
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/Toolbar/Toolbar.js +11 -12
- package/dist/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +18 -1
- package/dist/components/Tooltip/Tooltip.js +50 -31
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tree/Tree.d.ts +92 -11
- package/dist/components/Tree/Tree.js +332 -164
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.d.ts +27 -4
- package/dist/components/VirtualList/VirtualList.js +179 -145
- package/dist/components/VirtualList/VirtualList.js.map +1 -1
- package/dist/components/VirtualList/index.d.ts +1 -1
- package/dist/components/ZoomControls/ZoomControls.d.ts +6 -2
- package/dist/components/ZoomControls/ZoomControls.js +37 -37
- package/dist/components/ZoomControls/ZoomControls.js.map +1 -1
- package/dist/entries/tokens.js +22 -16
- package/dist/foundations/ChoiceBase/ChoiceBase.js +15 -13
- package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
- package/dist/foundations/LiveRegion/LiveRegion.d.ts +33 -0
- package/dist/foundations/LiveRegion/LiveRegion.js +29 -0
- package/dist/foundations/LiveRegion/LiveRegion.js.map +1 -0
- package/dist/foundations/LiveRegion/index.d.ts +1 -0
- package/dist/foundations/canvas-size.d.ts +14 -0
- package/dist/foundations/canvas-size.js +32 -0
- package/dist/foundations/canvas-size.js.map +1 -0
- package/dist/foundations/dir.js +0 -1
- package/dist/foundations/dir.js.map +1 -1
- package/dist/foundations/draft.d.ts +14 -0
- package/dist/foundations/draft.js +22 -0
- package/dist/foundations/draft.js.map +1 -0
- package/dist/foundations/edge.d.ts +20 -0
- package/dist/foundations/edge.js +26 -0
- package/dist/foundations/edge.js.map +1 -0
- package/dist/foundations/focus.d.ts +5 -0
- package/dist/foundations/focus.js +10 -0
- package/dist/foundations/focus.js.map +1 -0
- package/dist/foundations/hotkey.d.ts +23 -1
- package/dist/foundations/hotkey.js +48 -26
- package/dist/foundations/hotkey.js.map +1 -1
- package/dist/foundations/icon-size.d.ts +7 -0
- package/dist/foundations/icon-size.js +6 -0
- package/dist/foundations/icon-size.js.map +1 -0
- package/dist/foundations/keys.js +12 -13
- package/dist/foundations/keys.js.map +1 -1
- package/dist/{components/Stack/space.d.ts → foundations/layout.d.ts} +34 -0
- package/dist/foundations/layout.js +29 -0
- package/dist/foundations/layout.js.map +1 -0
- package/dist/foundations/listbox.d.ts +47 -2
- package/dist/foundations/listbox.js +56 -25
- package/dist/foundations/listbox.js.map +1 -1
- package/dist/foundations/math.d.ts +25 -0
- package/dist/foundations/math.js +14 -3
- package/dist/foundations/math.js.map +1 -1
- package/dist/foundations/media-query.d.ts +5 -0
- package/dist/foundations/media-query.js +14 -0
- package/dist/foundations/media-query.js.map +1 -0
- package/dist/foundations/motion.d.ts +12 -0
- package/dist/foundations/motion.js +21 -0
- package/dist/foundations/motion.js.map +1 -0
- package/dist/foundations/option-icon.d.ts +3 -1
- package/dist/foundations/option-icon.js +6 -6
- package/dist/foundations/option-icon.js.map +1 -1
- package/dist/foundations/qr.js +0 -1
- package/dist/foundations/qr.js.map +1 -1
- package/dist/foundations/refs.d.ts +8 -0
- package/dist/foundations/refs.js +14 -0
- package/dist/foundations/refs.js.map +1 -0
- package/dist/foundations/reorder.js +5 -6
- package/dist/foundations/reorder.js.map +1 -1
- package/dist/foundations/roving-focus.d.ts +10 -0
- package/dist/foundations/roving-focus.js +34 -31
- package/dist/foundations/roving-focus.js.map +1 -1
- package/dist/foundations/scroll-align.d.ts +11 -0
- package/dist/foundations/scroll-align.js +8 -0
- package/dist/foundations/scroll-align.js.map +1 -0
- package/dist/foundations/sort.d.ts +13 -0
- package/dist/foundations/sort.js +26 -0
- package/dist/foundations/sort.js.map +1 -0
- package/dist/foundations/text-match.d.ts +11 -0
- package/dist/foundations/text-match.js +20 -0
- package/dist/foundations/text-match.js.map +1 -0
- package/dist/foundations/tone-icons.js +4 -5
- package/dist/foundations/tone-icons.js.map +1 -1
- package/dist/foundations/use-follow.d.ts +29 -0
- package/dist/foundations/use-follow.js +51 -0
- package/dist/foundations/use-follow.js.map +1 -0
- package/dist/foundations/virtual-window.d.ts +22 -5
- package/dist/foundations/virtual-window.js +58 -54
- package/dist/foundations/virtual-window.js.map +1 -1
- package/dist/foundations/zoom-gestures.d.ts +23 -1
- package/dist/foundations/zoom-gestures.js +123 -84
- package/dist/foundations/zoom-gestures.js.map +1 -1
- package/dist/foundations/zoom.d.ts +10 -4
- package/dist/foundations/zoom.js +16 -17
- package/dist/foundations/zoom.js.map +1 -1
- package/dist/icons/boxes.d.ts +2 -0
- package/dist/icons/boxes.js +34 -0
- package/dist/icons/boxes.js.map +1 -0
- package/dist/icons/by-name.d.ts +11 -0
- package/dist/icons/by-name.js +11 -0
- package/dist/icons/by-name.js.map +1 -0
- package/dist/icons/cable.d.ts +2 -0
- package/dist/icons/cable.js +14 -0
- package/dist/icons/cable.js.map +1 -0
- package/dist/icons/check-check.d.ts +2 -0
- package/dist/icons/check-check.js +17 -0
- package/dist/icons/check-check.js.map +1 -0
- package/dist/icons/clipboard-paste.d.ts +2 -0
- package/dist/icons/clipboard-paste.js +30 -0
- package/dist/icons/clipboard-paste.js.map +1 -0
- package/dist/icons/facet.d.ts +274 -0
- package/dist/icons/facet.js +830 -0
- package/dist/icons/facet.js.map +1 -0
- package/dist/icons/file-plus.d.ts +2 -0
- package/dist/icons/file-plus.js +14 -0
- package/dist/icons/file-plus.js.map +1 -0
- package/dist/icons/file-question.d.ts +2 -0
- package/dist/icons/file-question.js +14 -0
- package/dist/icons/file-question.js.map +1 -0
- package/dist/icons/file-search.d.ts +2 -0
- package/dist/icons/file-search.js +24 -0
- package/dist/icons/file-search.js.map +1 -0
- package/dist/icons/function.d.ts +2 -0
- package/dist/icons/function.js +20 -0
- package/dist/icons/function.js.map +1 -0
- package/dist/icons/gauge.d.ts +2 -0
- package/dist/icons/gauge.js +14 -0
- package/dist/icons/gauge.js.map +1 -0
- package/dist/icons/hourglass.d.ts +2 -0
- package/dist/icons/hourglass.js +14 -0
- package/dist/icons/hourglass.js.map +1 -0
- package/dist/icons/index.d.ts +1 -250
- package/dist/icons/index.js +548 -500
- package/dist/icons/keywords.d.ts +24 -0
- package/dist/icons/keywords.js +185 -0
- package/dist/icons/keywords.js.map +1 -1
- package/dist/icons/languages.d.ts +2 -0
- package/dist/icons/languages.js +14 -0
- package/dist/icons/languages.js.map +1 -0
- package/dist/icons/loader.d.ts +2 -0
- package/dist/icons/loader.js +14 -0
- package/dist/icons/loader.js.map +1 -0
- package/dist/icons/monitor-down.d.ts +2 -0
- package/dist/icons/monitor-down.js +24 -0
- package/dist/icons/monitor-down.js.map +1 -0
- package/dist/icons/panel-right.d.ts +2 -0
- package/dist/icons/panel-right.js +20 -0
- package/dist/icons/panel-right.js.map +1 -0
- package/dist/icons/party-popper.d.ts +2 -0
- package/dist/icons/party-popper.js +14 -0
- package/dist/icons/party-popper.js.map +1 -0
- package/dist/icons/power-off.d.ts +2 -0
- package/dist/icons/power-off.js +14 -0
- package/dist/icons/power-off.js.map +1 -0
- package/dist/icons/rocket.d.ts +2 -0
- package/dist/icons/rocket.js +21 -0
- package/dist/icons/rocket.js.map +1 -0
- package/dist/icons/rows.d.ts +2 -0
- package/dist/icons/rows.js +20 -0
- package/dist/icons/rows.js.map +1 -0
- package/dist/icons/scissors.d.ts +2 -0
- package/dist/icons/scissors.js +26 -0
- package/dist/icons/scissors.js.map +1 -0
- package/dist/icons/shield-question.d.ts +2 -0
- package/dist/icons/shield-question.js +14 -0
- package/dist/icons/shield-question.js.map +1 -0
- package/dist/icons/square-plus.d.ts +2 -0
- package/dist/icons/square-plus.js +20 -0
- package/dist/icons/square-plus.js.map +1 -0
- package/dist/icons/text-select.d.ts +2 -0
- package/dist/icons/text-select.js +14 -0
- package/dist/icons/text-select.js.map +1 -0
- package/dist/icons/window-maximize.d.ts +2 -0
- package/dist/icons/window-maximize.js +14 -0
- package/dist/icons/window-maximize.js.map +1 -0
- package/dist/icons/window-restore.d.ts +2 -0
- package/dist/icons/window-restore.js +20 -0
- package/dist/icons/window-restore.js.map +1 -0
- package/dist/index.d.ts +24 -9
- package/dist/index.js +326 -282
- package/dist/overlay/dismiss.js +15 -13
- package/dist/overlay/dismiss.js.map +1 -1
- package/dist/overlay/floating.d.ts +7 -2
- package/dist/overlay/floating.js +29 -21
- package/dist/overlay/floating.js.map +1 -1
- package/dist/overlay/listbox-layer.d.ts +3 -2
- package/dist/overlay/listbox-layer.js.map +1 -1
- package/dist/overlay/position.d.ts +5 -2
- package/dist/overlay/position.js +19 -19
- package/dist/overlay/position.js.map +1 -1
- package/dist/overlay/toast-host.js +3 -2
- package/dist/overlay/toast-host.js.map +1 -1
- package/dist/overlay/use-anchored-position.d.ts +2 -2
- package/dist/overlay/use-anchored-position.js +25 -25
- package/dist/overlay/use-anchored-position.js.map +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/chat-message.css +1 -0
- package/dist/styles/code-block.css +1 -1
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/data-grid.css +1 -0
- package/dist/styles/disclosure.css +1 -1
- package/dist/styles/error-boundary.css +1 -0
- package/dist/styles/field.css +1 -1
- package/dist/styles/file-drop.css +1 -1
- package/dist/styles/generated-css.d.ts +1 -1
- package/dist/styles/generated-css.js +3 -3
- package/dist/styles/generated-css.js.map +1 -1
- package/dist/styles/highlighted-text.css +1 -0
- package/dist/styles/hotkey-field.css +1 -0
- package/dist/styles/list-row.css +1 -0
- package/dist/styles/loading-dots.css +1 -1
- package/dist/styles/manifest.json +149 -12
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -0
- package/dist/styles/notice.css +1 -1
- package/dist/styles/option-list.css +1 -1
- package/dist/styles/overlay-frame.css +1 -0
- package/dist/styles/pan-zoom-canvas.css +1 -1
- package/dist/styles/path-field.css +1 -0
- package/dist/styles/popover.css +1 -1
- package/dist/styles/progress-bar.css +1 -1
- package/dist/styles/row-actions.css +1 -0
- package/dist/styles/scroll-area.css +1 -0
- package/dist/styles/search-field.css +1 -0
- package/dist/styles/segmented-control.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-nav.css +1 -1
- package/dist/styles/sort-button.css +1 -0
- package/dist/styles/split-pane.css +1 -1
- package/dist/styles/status-bar.css +1 -0
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-area.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text.css +1 -1
- package/dist/styles/title-bar.css +1 -0
- package/dist/styles/toast.css +1 -1
- package/dist/styles/tokens.css +3 -3
- package/dist/styles/tree.css +1 -1
- package/dist/styles/virtual-list.css +1 -1
- package/dist/styles.css +3 -3
- package/dist/theme/CynosureTheme.d.ts +7 -3
- package/dist/theme/CynosureTheme.js +47 -31
- package/dist/theme/CynosureTheme.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/theme-context.d.ts +9 -0
- package/dist/theme/theme-context.js +8 -0
- package/dist/theme/theme-context.js.map +1 -0
- package/dist/theme/theme-init-script.js +0 -1
- package/dist/theme/theme-init-script.js.map +1 -1
- package/dist/theme/use-color-mode.d.ts +3 -2
- package/dist/theme/use-color-mode.js +35 -38
- package/dist/theme/use-color-mode.js.map +1 -1
- package/dist/theme/use-cynosure-theme.d.ts +18 -0
- package/dist/theme/use-cynosure-theme.js +23 -0
- package/dist/theme/use-cynosure-theme.js.map +1 -0
- package/dist/tokens/chart-themes.d.ts +38 -0
- package/dist/tokens/chart-themes.js +35 -0
- package/dist/tokens/chart-themes.js.map +1 -0
- package/dist/tokens/create-theme.d.ts +11 -1
- package/dist/tokens/create-theme.js +161 -121
- package/dist/tokens/create-theme.js.map +1 -1
- package/dist/tokens/defaults.d.ts +3 -3
- package/dist/tokens/defaults.js +1 -0
- package/dist/tokens/defaults.js.map +1 -1
- package/dist/tokens/editor-themes.d.ts +9 -2
- package/dist/tokens/editor-themes.js +43 -42
- package/dist/tokens/editor-themes.js.map +1 -1
- package/dist/tokens/index.d.ts +3 -1
- package/dist/tokens/named-themes.d.ts +41 -0
- package/dist/tokens/named-themes.js +118 -0
- package/dist/tokens/named-themes.js.map +1 -0
- package/dist/tokens/schema.d.ts +24 -1
- package/dist/tokens/schema.js +13 -0
- package/dist/tokens/schema.js.map +1 -0
- package/dist/tokens/to-css.js +34 -31
- package/dist/tokens/to-css.js.map +1 -1
- package/package.json +10 -6
- package/dist/components/Stack/space.js +0 -23
- package/dist/components/Stack/space.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Button as
|
|
3
|
-
import { IconButton as
|
|
4
|
-
import { Menu as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { zoomIn as
|
|
8
|
-
import { zoomOut as
|
|
9
|
-
import { jsx as
|
|
10
|
-
var
|
|
2
|
+
import { Button as k } from "../Button/Button.js";
|
|
3
|
+
import { IconButton as u } from "../IconButton/IconButton.js";
|
|
4
|
+
import { Menu as v } from "../Menu/Menu.js";
|
|
5
|
+
import { Toolbar as z } from "../Toolbar/Toolbar.js";
|
|
6
|
+
import { zoomStep as $ } from "../../foundations/zoom.js";
|
|
7
|
+
import { zoomIn as w } from "../../icons/zoom-in.js";
|
|
8
|
+
import { zoomOut as I } from "../../icons/zoom-out.js";
|
|
9
|
+
import { jsx as r, jsxs as O } from "react/jsx-runtime";
|
|
10
|
+
var Z = {
|
|
11
11
|
group: "Zoom",
|
|
12
12
|
zoomIn: "Zoom in",
|
|
13
13
|
zoomOut: "Zoom out",
|
|
@@ -15,7 +15,7 @@ var x = {
|
|
|
15
15
|
fitWidth: "Fit width",
|
|
16
16
|
fitPage: "Fit page"
|
|
17
17
|
};
|
|
18
|
-
function
|
|
18
|
+
function C({ zoom: e, percent: d, onZoomChange: m, min: n = 25, max: l = 800, presets: f = [
|
|
19
19
|
50,
|
|
20
20
|
75,
|
|
21
21
|
100,
|
|
@@ -23,11 +23,11 @@ function y({ zoom: e, percent: s, onZoomChange: a, presets: u = [
|
|
|
23
23
|
150,
|
|
24
24
|
200,
|
|
25
25
|
400
|
|
26
|
-
], size:
|
|
26
|
+
], size: a = "sm", labels: h, className: c, style: p }) {
|
|
27
27
|
const t = {
|
|
28
|
-
...
|
|
29
|
-
...
|
|
30
|
-
}, i = Math.round(
|
|
28
|
+
...Z,
|
|
29
|
+
...h
|
|
30
|
+
}, i = Math.round(d), b = e.kind === "percent" ? `${e.value}` : e.kind, g = [
|
|
31
31
|
{
|
|
32
32
|
value: "fit-width",
|
|
33
33
|
label: t.fitWidth
|
|
@@ -36,61 +36,61 @@ function y({ zoom: e, percent: s, onZoomChange: a, presets: u = [
|
|
|
36
36
|
value: "fit-page",
|
|
37
37
|
label: t.fitPage
|
|
38
38
|
},
|
|
39
|
-
...
|
|
39
|
+
...f.filter((o) => o >= n && o <= l).map((o) => ({
|
|
40
40
|
value: `${o}`,
|
|
41
41
|
label: `${o}%`
|
|
42
42
|
}))
|
|
43
43
|
].map((o) => ({
|
|
44
44
|
...o,
|
|
45
45
|
kind: "radio",
|
|
46
|
-
checked: o.value ===
|
|
46
|
+
checked: o.value === b,
|
|
47
47
|
keepOpen: !1
|
|
48
|
-
})),
|
|
48
|
+
})), s = (o) => m({
|
|
49
49
|
kind: "percent",
|
|
50
|
-
value:
|
|
50
|
+
value: $(i, o, n, l)
|
|
51
51
|
});
|
|
52
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ O(z, {
|
|
53
53
|
label: t.group,
|
|
54
|
-
className:
|
|
55
|
-
...
|
|
54
|
+
className: c ? `cy-zoom-controls ${c}` : "cy-zoom-controls",
|
|
55
|
+
...p ? { style: p } : {},
|
|
56
56
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
icon:
|
|
57
|
+
/* @__PURE__ */ r(u, {
|
|
58
|
+
icon: I,
|
|
59
59
|
label: t.zoomOut,
|
|
60
60
|
variant: "ghost",
|
|
61
|
-
size:
|
|
62
|
-
disabled: i <=
|
|
63
|
-
onClick: () =>
|
|
61
|
+
size: a,
|
|
62
|
+
disabled: i <= n,
|
|
63
|
+
onClick: () => s(-1)
|
|
64
64
|
}),
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ r(v, {
|
|
66
66
|
label: t.group,
|
|
67
|
-
items:
|
|
68
|
-
onSelect: (o) =>
|
|
67
|
+
items: g,
|
|
68
|
+
onSelect: (o) => m(o === "fit-width" || o === "fit-page" ? { kind: o } : {
|
|
69
69
|
kind: "percent",
|
|
70
70
|
value: Number(o)
|
|
71
71
|
}),
|
|
72
|
-
trigger: (o) => /* @__PURE__ */
|
|
72
|
+
trigger: (o) => /* @__PURE__ */ r(k, {
|
|
73
73
|
...o,
|
|
74
74
|
variant: "ghost",
|
|
75
|
-
size:
|
|
75
|
+
size: a,
|
|
76
76
|
"aria-label": t.menu(i),
|
|
77
77
|
className: "cy-zoom-controls-value",
|
|
78
78
|
children: `${i}%`
|
|
79
79
|
})
|
|
80
80
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
icon:
|
|
81
|
+
/* @__PURE__ */ r(u, {
|
|
82
|
+
icon: w,
|
|
83
83
|
label: t.zoomIn,
|
|
84
84
|
variant: "ghost",
|
|
85
|
-
size:
|
|
86
|
-
disabled: i >=
|
|
87
|
-
onClick: () =>
|
|
85
|
+
size: a,
|
|
86
|
+
disabled: i >= l,
|
|
87
|
+
onClick: () => s(1)
|
|
88
88
|
})
|
|
89
89
|
]
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
export {
|
|
93
|
-
|
|
93
|
+
C as ZoomControls
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
//# sourceMappingURL=ZoomControls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZoomControls.js","names":["Button","IconButton","Menu","
|
|
1
|
+
{"version":3,"file":"ZoomControls.js","names":["Button","IconButton","Menu","Toolbar","zoomStep","zoomIn","zoomOut","jsx","jsxs","DEFAULT_LABELS","percent","ZoomControls","zoom","onZoomChange","min","max","presets","size","labels","className","style","text","shown","choice","items","p","item","step","direction","value","props"],"sources":["../../../src/components/ZoomControls/ZoomControls.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport { MAX_PERCENT, MIN_PERCENT, type ZoomSetting, zoomStep } from \"../../foundations/zoom.js\";\nimport { zoomIn } from \"../../icons/zoom-in.js\";\nimport { zoomOut } from \"../../icons/zoom-out.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Menu, type MenuItem } from \"../Menu/Menu.js\";\nimport { Toolbar } from \"../Toolbar/Toolbar.js\";\n\nexport interface ZoomControlsLabels {\n /** The toolbar. Default \"Zoom\". */\n group: string;\n zoomIn: string;\n zoomOut: string;\n /** The menu button, read with the percent. Default \"Zoom 125%\". */\n menu: (percent: number) => string;\n fitWidth: string;\n fitPage: string;\n}\n\nexport interface ZoomControlsProps {\n /** The setting now (fit or a percent). */\n zoom: ZoomSetting;\n /** The percent it comes to now (DocumentViewport's `onScaleChange` times 100): shown, and stepped from. */\n percent: number;\n /** Called with the new setting when the person zooms in or out, or picks one from the menu. */\n onZoomChange: (zoom: ZoomSetting) => void;\n /** The smallest percent zoom out goes to (a PanZoomCanvas's `min`). Default 25. */\n min?: number;\n /** The largest percent zoom in goes to (a PanZoomCanvas's `max`). Default 800. */\n max?: number;\n /** The percents offered in the menu (those between `min` and `max`). Default 50, 75, 100, 125, 150, 200, 400. */\n presets?: number[];\n /** Size of the three buttons. Default \"sm\". */\n size?: Size;\n /** Replace the built-in English text: the names of the toolbar, the buttons and the fit modes. */\n labels?: Partial<ZoomControlsLabels>;\n /** Added to the toolbar element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: ZoomControlsLabels = {\n group: \"Zoom\",\n zoomIn: \"Zoom in\",\n zoomOut: \"Zoom out\",\n menu: (percent) => `Zoom ${percent}%`,\n fitWidth: \"Fit width\",\n fitPage: \"Fit page\",\n};\n\n/**\n * Zoom out, the current percent (a menu of fit modes and preset percents) and zoom in, for a DocumentViewport or any\n * zoomable view. An APG toolbar: one tab stop, arrow keys between the three.\n */\nexport function ZoomControls({\n zoom,\n percent,\n onZoomChange,\n min = MIN_PERCENT,\n max = MAX_PERCENT,\n presets = [50, 75, 100, 125, 150, 200, 400],\n size = \"sm\",\n labels,\n className,\n style,\n}: ZoomControlsProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const shown = Math.round(percent);\n const choice = zoom.kind === \"percent\" ? `${zoom.value}` : zoom.kind;\n const items: MenuItem[] = [\n { value: \"fit-width\", label: text.fitWidth },\n { value: \"fit-page\", label: text.fitPage },\n ...presets.filter((p) => p >= min && p <= max).map((p) => ({ value: `${p}`, label: `${p}%` })),\n ].map((item) => ({ ...item, kind: \"radio\" as const, checked: item.value === choice, keepOpen: false }));\n const step = (direction: 1 | -1) =>\n onZoomChange({ kind: \"percent\", value: zoomStep(shown, direction, min, max) });\n return (\n <Toolbar\n label={text.group}\n className={className ? `cy-zoom-controls ${className}` : \"cy-zoom-controls\"}\n {...(style ? { style } : {})}\n >\n <IconButton\n icon={zoomOut}\n label={text.zoomOut}\n variant=\"ghost\"\n size={size}\n disabled={shown <= min}\n onClick={() => step(-1)}\n />\n <Menu\n label={text.group}\n items={items}\n onSelect={(value) =>\n onZoomChange(\n value === \"fit-width\" || value === \"fit-page\"\n ? { kind: value }\n : { kind: \"percent\", value: Number(value) },\n )\n }\n trigger={(props) => (\n <Button\n {...props}\n variant=\"ghost\"\n size={size}\n aria-label={text.menu(shown)}\n className=\"cy-zoom-controls-value\"\n >\n {`${shown}%`}\n </Button>\n )}\n />\n <IconButton\n icon={zoomIn}\n label={text.zoomIn}\n variant=\"ghost\"\n size={size}\n disabled={shown >= max}\n onClick={() => step(1)}\n />\n </Toolbar>\n );\n}\n"],"mappings":";;;;;;;;;AA4CA,IAAMS,IAAqC;AAAA,EACzC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAA,CAAOC,MAAY,QAAQA,CAAA;AAAA,EAC3B,UAAU;AAAA,EACV,SAAS;AACX;AAMA,SAAgBC,EAAa,EAC3B,MAAAC,GACA,SAAAF,GACA,cAAAG,GACA,KAAAC,IAAA,IACA,KAAAC,IAAA,KACA,SAAAC,IAAU;AAAA,EAAC;AAAA,EAAI;AAAA,EAAI;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAA,EAAK;AAAG,GAC1C,MAAAC,IAAO,MACP,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACoB;AACpB,QAAMC,IAAO;AAAA,IAAE,GAAGZ;AAAA,IAAgB,GAAGS;AAAA,EAAO,GACtCI,IAAQ,KAAK,MAAMZ,CAAO,GAC1Ba,IAASX,EAAK,SAAS,YAAY,GAAGA,EAAK,KAAA,KAAUA,EAAK,MAC1DY,IAAoB;AAAA,IACxB;AAAA,MAAE,OAAO;AAAA,MAAa,OAAOH,EAAK;AAAA,IAAS;AAAA,IAC3C;AAAA,MAAE,OAAO;AAAA,MAAY,OAAOA,EAAK;AAAA,IAAQ;AAAA,IACzC,GAAGL,EAAQ,OAAA,CAAQS,MAAMA,KAAKX,KAAOW,KAAKV,CAAG,EAAE,IAAA,CAAKU,OAAO;AAAA,MAAE,OAAO,GAAGA,CAAA;AAAA,MAAK,OAAO,GAAGA,CAAA;AAAA,IAAK,EAAE;AAAA,EAC/F,EAAE,IAAA,CAAKC,OAAU;AAAA,IAAE,GAAGA;AAAA,IAAM,MAAM;AAAA,IAAkB,SAASA,EAAK,UAAUH;AAAA,IAAQ,UAAU;AAAA,EAAM,EAAE,GAChGI,IAAA,CAAQC,MACZf,EAAa;AAAA,IAAE,MAAM;AAAA,IAAW,OAAOT,EAASkB,GAAOM,GAAWd,GAAKC,CAAG;AAAA,EAAE,CAAC;AAC/E,SACE,gBAAAP,EAACL,GAAD;AAAA,IACE,OAAOkB,EAAK;AAAA,IACZ,WAAWF,IAAY,oBAAoBA,CAAA,KAAc;AAAA,IACzD,GAAKC,IAAQ,EAAE,OAAAA,EAAM,IAAI,CAAC;AAAA,IAH5B,UAAA;AAAA,MAKE,gBAAAb,EAACN,GAAD;AAAA,QACE,MAAMK;AAAA,QACN,OAAOe,EAAK;AAAA,QACZ,SAAQ;AAAA,QACF,MAAAJ;AAAA,QACN,UAAUK,KAASR;AAAA,QACnB,SAAA,MAAea,EAAK,EAAE;AAAA,MACvB,CAAA;AAAA,MACD,gBAAApB,EAACL,GAAD;AAAA,QACE,OAAOmB,EAAK;AAAA,QACL,OAAAG;AAAA,QACP,UAAA,CAAWK,MACThB,EACEgB,MAAU,eAAeA,MAAU,aAC/B,EAAE,MAAMA,EAAM,IACd;AAAA,UAAE,MAAM;AAAA,UAAW,OAAO,OAAOA,CAAK;AAAA,QAAE,CAC9C;AAAA,QAEF,SAAA,CAAUC,MACR,gBAAAvB,EAACP,GAAD;AAAA,UACE,GAAI8B;AAAA,UACJ,SAAQ;AAAA,UACF,MAAAb;AAAA,UACN,cAAYI,EAAK,KAAKC,CAAK;AAAA,UAC3B,WAAU;AAAA,UAET,UAAA,GAAGA,CAAA;AAAA,QACE,CAAA;AAAA,MAEX,CAAA;AAAA,MACD,gBAAAf,EAACN,GAAD;AAAA,QACE,MAAMI;AAAA,QACN,OAAOgB,EAAK;AAAA,QACZ,SAAQ;AAAA,QACF,MAAAJ;AAAA,QACN,UAAUK,KAASP;AAAA,QACnB,SAAA,MAAeY,EAAK,CAAC;AAAA,MACtB,CAAA;AAAA,IACM;AAAA,E;AAEb"}
|
package/dist/entries/tokens.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import { CynosureThemeError as r, contrastRatio as
|
|
2
|
-
import { DEFAULT_ACCENT as
|
|
3
|
-
import { createTheme as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { CynosureThemeError as r, contrastRatio as o } from "../tokens/color.js";
|
|
2
|
+
import { DEFAULT_ACCENT as t } from "../tokens/defaults.js";
|
|
3
|
+
import { createTheme as T } from "../tokens/create-theme.js";
|
|
4
|
+
import { resolveColors as p, swiftChartTheme as f } from "../tokens/chart-themes.js";
|
|
5
|
+
import { editorColors as C, monacoTheme as a, textMateTheme as E } from "../tokens/editor-themes.js";
|
|
6
|
+
import { createThemeRegistry as n, defineTheme as l } from "../tokens/named-themes.js";
|
|
7
|
+
import { DEFAULT_SELECTOR as L, themeProperties as R, themeToCss as d } from "../tokens/to-css.js";
|
|
8
|
+
import { themeInitScript as y } from "../theme/theme-init-script.js";
|
|
7
9
|
export {
|
|
8
10
|
r as CynosureThemeError,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
t as DEFAULT_ACCENT,
|
|
12
|
+
L as DEFAULT_SELECTOR,
|
|
13
|
+
o as contrastRatio,
|
|
14
|
+
T as createTheme,
|
|
15
|
+
n as createThemeRegistry,
|
|
16
|
+
l as defineTheme,
|
|
17
|
+
C as editorColors,
|
|
18
|
+
a as monacoTheme,
|
|
19
|
+
p as resolveColors,
|
|
20
|
+
f as swiftChartTheme,
|
|
21
|
+
E as textMateTheme,
|
|
22
|
+
y as themeInitScript,
|
|
23
|
+
R as themeProperties,
|
|
24
|
+
d as themeToCss
|
|
19
25
|
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useClientLayoutEffect as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { useClientLayoutEffect as s } from "../client-layout-effect.js";
|
|
3
|
+
import { mergeRefs as u } from "../refs.js";
|
|
4
|
+
import { forwardRef as m, useMemo as a, useRef as p } from "react";
|
|
5
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
6
|
+
var y = m(function({ indeterminate: e = !1, className: o, onChange: c, ...f }, t) {
|
|
7
|
+
const r = p(null), i = a(() => u(r, t), [t]);
|
|
8
|
+
return s(() => {
|
|
9
|
+
r.current && (r.current.indeterminate = e);
|
|
10
|
+
}, [e]), /* @__PURE__ */ l("input", {
|
|
11
|
+
ref: i,
|
|
12
|
+
className: `cy-choice-base${o ? ` ${o}` : ""}`,
|
|
13
|
+
...f,
|
|
14
|
+
onChange: (n) => {
|
|
15
|
+
c?.(n), n.currentTarget.indeterminate = e;
|
|
16
|
+
}
|
|
15
17
|
});
|
|
16
18
|
});
|
|
17
19
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoiceBase.js","names":["useClientLayoutEffect","forwardRef","
|
|
1
|
+
{"version":3,"file":"ChoiceBase.js","names":["useClientLayoutEffect","mergeRefs","forwardRef","useMemo","useRef","jsx","ChoiceBase","indeterminate","className","onChange","rest","forwarded","inner","ref","event"],"sources":["../../../src/foundations/ChoiceBase/ChoiceBase.tsx"],"sourcesContent":["import { type ChangeEvent, forwardRef, type InputHTMLAttributes, useMemo, useRef } from \"react\";\nimport { useClientLayoutEffect } from \"../client-layout-effect.js\";\nimport { mergeRefs } from \"../refs.js\";\n\nexport interface ChoiceBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n /** Which native control to render. */\n type: \"checkbox\" | \"radio\";\n /** Checkbox only: the mixed state (aria-checked=\"mixed\"). */\n indeterminate?: boolean;\n}\n\n/**\n * Foundation: a native checkbox or radio, visually hidden under a Cynosure skin but still focusable, clickable and\n * form-associated (FormData, reset, required) for free.\n */\nexport const ChoiceBase = forwardRef<HTMLInputElement, ChoiceBaseProps>(function ChoiceBase(\n { indeterminate = false, className, onChange, ...rest },\n forwarded,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const ref = useMemo(() => mergeRefs(inner, forwarded), [forwarded]);\n useClientLayoutEffect(() => {\n if (inner.current) inner.current.indeterminate = indeterminate;\n }, [indeterminate]);\n return (\n <input\n ref={ref}\n className={`cy-choice-base${className ? ` ${className}` : \"\"}`}\n {...rest}\n onChange={(event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n // A click clears the browser's mixed state; while the prop still says mixed, put it back.\n event.currentTarget.indeterminate = indeterminate;\n }}\n />\n );\n});\n"],"mappings":";;;;;AAeA,IAAaM,IAAaJ,EAA8C,SACtE,EAAE,eAAAK,IAAgB,IAAO,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GACjDC,GACA;AACA,QAAMC,IAAQR,EAAgC,IAAI,GAC5CS,IAAMV,EAAA,MAAcF,EAAUW,GAAOD,CAAS,GAAG,CAACA,CAAS,CAAC;AAClE,SAAAX,EAAA,MAA4B;AAC1B,IAAIY,EAAM,YAASA,EAAM,QAAQ,gBAAgBL;AAAA,EACnD,GAAG,CAACA,CAAa,CAAC,GAEhB,gBAAAF,EAAC,SAAD;AAAA,IACO,KAAAQ;AAAA,IACL,WAAW,iBAAiBL,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IAC1D,GAAIE;AAAA,IACJ,UAAA,CAAWI,MAAyC;AAClD,MAAAL,IAAWK,CAAK,GAEhBA,EAAM,cAAc,gBAAgBP;AAAA,IACtC;AAAA,EACD,CAAA;AAEL,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** `polite` waits for the screen reader to finish; `assertive` interrupts. Keep assertive for errors. */
|
|
3
|
+
export type Politeness = "polite" | "assertive";
|
|
4
|
+
export interface LiveRegionProps {
|
|
5
|
+
/** What screen readers announce: text or elements (a `Kbd`). Empty (`""`, null, false) says nothing. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Changes with every announcement, so the same words twice in a row are read twice (`useLiveMessage` gives it).
|
|
9
|
+
* Omit it to announce only when the words change.
|
|
10
|
+
*/
|
|
11
|
+
sequence?: number;
|
|
12
|
+
/** `polite` (default, `role="status"`) or `assertive` (`role="alert"`, for errors). */
|
|
13
|
+
politeness?: Politeness;
|
|
14
|
+
/** Added to the region, for the owning component's own rules (a reset, a hidden-host fix). */
|
|
15
|
+
className?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** What `useLiveMessage` hands to `<LiveRegion {...message} />`: the words and their sequence number. */
|
|
18
|
+
export interface LiveMessage {
|
|
19
|
+
/** The words last said, or "" after a clear. */
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/** Goes up by one with every `say`, so the same words again are a new node and read again. */
|
|
22
|
+
sequence: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Foundation: a hidden live region. Screen readers announce what it holds whenever that changes; a new `sequence`
|
|
26
|
+
* re-reads the same words. Out of sight (`.cy-visually-hidden`) but always in the page, so the first message is heard.
|
|
27
|
+
*/
|
|
28
|
+
export declare function LiveRegion({ children, sequence, politeness, className }: LiveRegionProps): import("react").JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* The message of a `LiveRegion`: returns `[message, say]`. `say(words)` announces them, again if they are the same as
|
|
31
|
+
* last time; `say("")` clears the region silently. Render `<LiveRegion {...message} />`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useLiveMessage(): [LiveMessage, (words: ReactNode) => void];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as r, useState as n } from "react";
|
|
3
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
4
|
+
var u = (e) => e === "" || e === null || e === void 0 || typeof e == "boolean";
|
|
5
|
+
function o({ children: e, sequence: a = 0, politeness: s = "polite", className: t }) {
|
|
6
|
+
return /* @__PURE__ */ i("span", {
|
|
7
|
+
className: `cy-visually-hidden${t ? ` ${t}` : ""}`,
|
|
8
|
+
role: s === "assertive" ? "alert" : "status",
|
|
9
|
+
"aria-live": s,
|
|
10
|
+
"aria-atomic": "true",
|
|
11
|
+
children: !u(e) && /* @__PURE__ */ i("span", { children: e }, a)
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function m() {
|
|
15
|
+
const [e, a] = n({
|
|
16
|
+
children: "",
|
|
17
|
+
sequence: 0
|
|
18
|
+
});
|
|
19
|
+
return [e, r((s) => a((t) => ({
|
|
20
|
+
children: s,
|
|
21
|
+
sequence: t.sequence + 1
|
|
22
|
+
})), [])];
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
o as LiveRegion,
|
|
26
|
+
m as useLiveMessage
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=LiveRegion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveRegion.js","names":["useCallback","useState","jsx","empty","node","LiveRegion","children","sequence","politeness","className","useLiveMessage","message","setMessage","words","last"],"sources":["../../../src/foundations/LiveRegion/LiveRegion.tsx"],"sourcesContent":["import { type ReactNode, useCallback, useState } from \"react\";\n\n/** `polite` waits for the screen reader to finish; `assertive` interrupts. Keep assertive for errors. */\nexport type Politeness = \"polite\" | \"assertive\";\n\nexport interface LiveRegionProps {\n /** What screen readers announce: text or elements (a `Kbd`). Empty (`\"\"`, null, false) says nothing. */\n children?: ReactNode;\n /**\n * Changes with every announcement, so the same words twice in a row are read twice (`useLiveMessage` gives it).\n * Omit it to announce only when the words change.\n */\n sequence?: number;\n /** `polite` (default, `role=\"status\"`) or `assertive` (`role=\"alert\"`, for errors). */\n politeness?: Politeness;\n /** Added to the region, for the owning component's own rules (a reset, a hidden-host fix). */\n className?: string | undefined;\n}\n\n/** What `useLiveMessage` hands to `<LiveRegion {...message} />`: the words and their sequence number. */\nexport interface LiveMessage {\n /** The words last said, or \"\" after a clear. */\n children: ReactNode;\n /** Goes up by one with every `say`, so the same words again are a new node and read again. */\n sequence: number;\n}\n\nconst empty = (node: ReactNode) =>\n node === \"\" || node === null || node === undefined || typeof node === \"boolean\";\n\n/**\n * Foundation: a hidden live region. Screen readers announce what it holds whenever that changes; a new `sequence`\n * re-reads the same words. Out of sight (`.cy-visually-hidden`) but always in the page, so the first message is heard.\n */\nexport function LiveRegion({ children, sequence = 0, politeness = \"polite\", className }: LiveRegionProps) {\n return (\n <span\n className={`cy-visually-hidden${className ? ` ${className}` : \"\"}`}\n role={politeness === \"assertive\" ? \"alert\" : \"status\"}\n aria-live={politeness}\n aria-atomic=\"true\"\n >\n {/* A new key on each announcement makes the words a new node, which screen readers read even when unchanged. */}\n {!empty(children) && <span key={sequence}>{children}</span>}\n </span>\n );\n}\n\n/**\n * The message of a `LiveRegion`: returns `[message, say]`. `say(words)` announces them, again if they are the same as\n * last time; `say(\"\")` clears the region silently. Render `<LiveRegion {...message} />`.\n */\nexport function useLiveMessage(): [LiveMessage, (words: ReactNode) => void] {\n const [message, setMessage] = useState<LiveMessage>({ children: \"\", sequence: 0 });\n const say = useCallback(\n (words: ReactNode) => setMessage((last) => ({ children: words, sequence: last.sequence + 1 })),\n [],\n );\n return [message, say];\n}\n"],"mappings":";;;AA2BA,IAAMG,IAAA,CAASC,MACbA,MAAS,MAAMA,MAAS,QAAQA,MAAS,UAAa,OAAOA,KAAS;AAMxE,SAAgBC,EAAW,EAAE,UAAAC,GAAU,UAAAC,IAAW,GAAG,YAAAC,IAAa,UAAU,WAAAC,EAAA,GAA8B;AACxG,SACE,gBAAAP,EAAC,QAAD;AAAA,IACE,WAAW,qBAAqBO,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IAC9D,MAAMD,MAAe,cAAc,UAAU;AAAA,IAC7C,aAAWA;AAAA,IACX,eAAY;AAAA,IAGX,UAAA,CAACL,EAAMG,CAAQ,KAAK,gBAAAJ,EAAC,QAAD,EAAsB,UAAAI,EAAe,GAA1BC,CAA0B;AAAA,EACtD,CAAA;AAEV;AAMA,SAAgBG,IAA4D;AAC1E,QAAM,CAACC,GAASC,CAAA,IAAcX,EAAsB;AAAA,IAAE,UAAU;AAAA,IAAI,UAAU;AAAA,EAAE,CAAC;AAKjF,SAAO,CAACU,GAJIX,EAAA,CACTa,MAAqBD,EAAA,CAAYE,OAAU;AAAA,IAAE,UAAUD;AAAA,IAAO,UAAUC,EAAK,WAAW;AAAA,EAAE,EAAE,GAC7F,CAAC,CAEc,CAAG;AACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type LiveMessage, LiveRegion, type LiveRegionProps, type Politeness, useLiveMessage, } from "./LiveRegion.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/** An element's size in CSS pixels and the screen's density (device pixels per CSS pixel). */
|
|
3
|
+
export interface CanvasSize {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
dpr: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The size of the element in `ref` (its client box, in CSS pixels) and the screen's `devicePixelRatio`, measured on
|
|
10
|
+
* mount, whenever the element resizes and whenever the density changes (the window moves to another screen, the
|
|
11
|
+
* browser zooms), so a canvas sized `width * dpr` by `height * dpr` stays sharp. Before the first measure (and on the
|
|
12
|
+
* server) it is 0 by 0 at density 1. PanZoomCanvas and SignaturePad use it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useCanvasSize(ref: RefObject<HTMLElement | null>): CanvasSize;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useClientLayoutEffect as d } from "./client-layout-effect.js";
|
|
3
|
+
import { useState as a } from "react";
|
|
4
|
+
function v(o) {
|
|
5
|
+
const [s, h] = a({
|
|
6
|
+
width: 0,
|
|
7
|
+
height: 0,
|
|
8
|
+
dpr: 1
|
|
9
|
+
});
|
|
10
|
+
return d(() => {
|
|
11
|
+
const e = o.current;
|
|
12
|
+
let i;
|
|
13
|
+
const t = () => {
|
|
14
|
+
const r = devicePixelRatio;
|
|
15
|
+
i?.removeEventListener("change", t), i = matchMedia(`(resolution: ${r}dppx)`), i.addEventListener("change", t), h((n) => n.width === e.clientWidth && n.height === e.clientHeight && n.dpr === r ? n : {
|
|
16
|
+
width: e.clientWidth,
|
|
17
|
+
height: e.clientHeight,
|
|
18
|
+
dpr: r
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
t();
|
|
22
|
+
const c = new ResizeObserver(t);
|
|
23
|
+
return c.observe(e), () => {
|
|
24
|
+
c.disconnect(), i.removeEventListener("change", t);
|
|
25
|
+
};
|
|
26
|
+
}, []), s;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
v as useCanvasSize
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=canvas-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas-size.js","names":["useClientLayoutEffect","useState","useCanvasSize","ref","size","setSize","el","density","measure","dpr","s","observer"],"sources":["../../src/foundations/canvas-size.ts"],"sourcesContent":["import { type RefObject, useState } from \"react\";\nimport { useClientLayoutEffect } from \"./client-layout-effect.js\";\n\n/** An element's size in CSS pixels and the screen's density (device pixels per CSS pixel). */\nexport interface CanvasSize {\n width: number;\n height: number;\n dpr: number;\n}\n\n/**\n * The size of the element in `ref` (its client box, in CSS pixels) and the screen's `devicePixelRatio`, measured on\n * mount, whenever the element resizes and whenever the density changes (the window moves to another screen, the\n * browser zooms), so a canvas sized `width * dpr` by `height * dpr` stays sharp. Before the first measure (and on the\n * server) it is 0 by 0 at density 1. PanZoomCanvas and SignaturePad use it.\n */\nexport function useCanvasSize(ref: RefObject<HTMLElement | null>): CanvasSize {\n const [size, setSize] = useState<CanvasSize>({ width: 0, height: 0, dpr: 1 });\n useClientLayoutEffect(() => {\n const el = ref.current as HTMLElement;\n // The density is read with the size, and watched for a change from the value just read.\n let density: MediaQueryList | undefined;\n const measure = () => {\n const dpr = devicePixelRatio;\n density?.removeEventListener(\"change\", measure);\n density = matchMedia(`(resolution: ${dpr}dppx)`);\n density.addEventListener(\"change\", measure);\n setSize((s) =>\n s.width === el.clientWidth && s.height === el.clientHeight && s.dpr === dpr\n ? s\n : { width: el.clientWidth, height: el.clientHeight, dpr },\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => {\n observer.disconnect();\n (density as MediaQueryList).removeEventListener(\"change\", measure);\n };\n }, []);\n return size;\n}\n"],"mappings":";;;AAgBA,SAAgBE,EAAcC,GAAgD;AAC5E,QAAM,CAACC,GAAMC,CAAA,IAAWJ,EAAqB;AAAA,IAAE,OAAO;AAAA,IAAG,QAAQ;AAAA,IAAG,KAAK;AAAA,EAAE,CAAC;AAC5E,SAAAD,EAAA,MAA4B;AAC1B,UAAMM,IAAKH,EAAI;AAEf,QAAII;AACJ,UAAMC,IAAA,MAAgB;AACpB,YAAMC,IAAM;AACZ,MAAAF,GAAS,oBAAoB,UAAUC,CAAO,GAC9CD,IAAU,WAAW,gBAAgBE,CAAA,OAAU,GAC/CF,EAAQ,iBAAiB,UAAUC,CAAO,GAC1CH,EAAA,CAASK,MACPA,EAAE,UAAUJ,EAAG,eAAeI,EAAE,WAAWJ,EAAG,gBAAgBI,EAAE,QAAQD,IACpEC,IACA;AAAA,QAAE,OAAOJ,EAAG;AAAA,QAAa,QAAQA,EAAG;AAAA,QAAc,KAAAG;AAAA,MAAI,CAC5D;AAAA,IACF;AACA,IAAAD,EAAQ;AACR,UAAMG,IAAW,IAAI,eAAeH,CAAO;AAC3C,WAAAG,EAAS,QAAQL,CAAE,GACnB,MAAa;AACX,MAAAK,EAAS,WAAW,GACpBJ,EAA4B,oBAAoB,UAAUC,CAAO;AAAA,IACnE;AAAA,EACF,GAAG,CAAC,CAAC,GACEJ;AACT"}
|
package/dist/foundations/dir.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dir.js","names":["isRtl","el"],"sources":["../../src/foundations/dir.ts"],"sourcesContent":["/** Whether `el` lays out right to left (its computed `direction`, so it follows `dir` set on any ancestor). */\nexport const isRtl = (el: Element) => getComputedStyle(el).direction === \"rtl\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dir.js","names":["isRtl","el"],"sources":["../../src/foundations/dir.ts"],"sourcesContent":["/** Whether `el` lays out right to left (its computed `direction`, so it follows `dir` set on any ancestor). */\nexport const isRtl = (el: Element) => getComputedStyle(el).direction === \"rtl\";\n"],"mappings":"AACA,IAAaA,IAAA,CAASC,MAAgB,iBAAiBA,CAAE,EAAE,cAAc"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The text of a typed field (a date, a time) while it is being edited, and the problem shown for it. While the draft is
|
|
4
|
+
* not a value `check` accepts, the input carries `check`'s message as its custom validity, so a form will not submit
|
|
5
|
+
* (the value it would submit is the last good one). `settle()` drops the draft and the problem: after a commit, a pick,
|
|
6
|
+
* or a form reset. DateField and TimeField use it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDraft(input: RefObject<HTMLInputElement | null>, check: (draft: string) => string | null): {
|
|
9
|
+
draft: string | null;
|
|
10
|
+
setDraft: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
11
|
+
problem: string | null;
|
|
12
|
+
setProblem: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
13
|
+
settle: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useClientLayoutEffect as a } from "./client-layout-effect.js";
|
|
3
|
+
import { useCallback as i, useState as u } from "react";
|
|
4
|
+
function m(r, o) {
|
|
5
|
+
const [t, l] = u(null), [s, e] = u(null), n = t === null ? null : o(t);
|
|
6
|
+
return a(() => {
|
|
7
|
+
r.current?.setCustomValidity(n ?? "");
|
|
8
|
+
}, [n]), {
|
|
9
|
+
draft: t,
|
|
10
|
+
setDraft: l,
|
|
11
|
+
problem: s,
|
|
12
|
+
setProblem: e,
|
|
13
|
+
settle: i(() => {
|
|
14
|
+
l(null), e(null);
|
|
15
|
+
}, [])
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
m as useDraft
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=draft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.js","names":["useClientLayoutEffect","useCallback","useState","useDraft","input","check","draft","setDraft","problem","setProblem","invalid"],"sources":["../../src/foundations/draft.ts"],"sourcesContent":["import { type RefObject, useCallback, useState } from \"react\";\nimport { useClientLayoutEffect } from \"./client-layout-effect.js\";\n\n/**\n * The text of a typed field (a date, a time) while it is being edited, and the problem shown for it. While the draft is\n * not a value `check` accepts, the input carries `check`'s message as its custom validity, so a form will not submit\n * (the value it would submit is the last good one). `settle()` drops the draft and the problem: after a commit, a pick,\n * or a form reset. DateField and TimeField use it.\n */\nexport function useDraft(input: RefObject<HTMLInputElement | null>, check: (draft: string) => string | null) {\n const [draft, setDraft] = useState<string | null>(null);\n const [problem, setProblem] = useState<string | null>(null);\n const invalid = draft === null ? null : check(draft);\n useClientLayoutEffect(() => {\n input.current?.setCustomValidity(invalid ?? \"\");\n }, [invalid]);\n const settle = useCallback(() => {\n setDraft(null);\n setProblem(null);\n }, []);\n return { draft, setDraft, problem, setProblem, settle };\n}\n"],"mappings":";;;AASA,SAAgBG,EAASC,GAA2CC,GAAyC;AAC3G,QAAM,CAACC,GAAOC,CAAA,IAAYL,EAAwB,IAAI,GAChD,CAACM,GAASC,CAAA,IAAcP,EAAwB,IAAI,GACpDQ,IAAUJ,MAAU,OAAO,OAAOD,EAAMC,CAAK;AACnD,SAAAN,EAAA,MAA4B;AAC1B,IAAAI,EAAM,SAAS,kBAAkBM,KAAW,EAAE;AAAA,EAChD,GAAG,CAACA,CAAO,CAAC,GAKL;AAAA,IAAE,OAAAJ;AAAA,IAAO,UAAAC;AAAA,IAAU,SAAAC;AAAA,IAAS,YAAAC;AAAA,IAAY,QAJhCR,EAAA,MAAkB;AAC/B,MAAAM,EAAS,IAAI,GACbE,EAAW,IAAI;AAAA,IACjB,GAAG,CAAC,CAC2C;AAAA,EAAO;AACxD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { type Tone } from "../tokens/schema.js";
|
|
3
|
+
/** An accent edge: a tone name, which uses that tone's colour, or any CSS colour. */
|
|
4
|
+
export type Edge = Tone | (string & {});
|
|
5
|
+
/** Whether `value` names a `Tone` (rather than being a CSS colour). */
|
|
6
|
+
export declare function isTone(value: string): value is Tone;
|
|
7
|
+
/**
|
|
8
|
+
* The CSS colour of a tone name or a CSS colour: a tone is its colour token (the ink for neutral), so a theme still
|
|
9
|
+
* recolours it; anything else is returned as it is. Edges (`edgeProps`) and Calendar's mark dots use it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function toneColour(value: Edge): string;
|
|
12
|
+
/**
|
|
13
|
+
* The attributes of an element drawing an accent edge (Card, Disclosure): `data-edge` (the tone, or "custom") for its
|
|
14
|
+
* stylesheet to draw the border, and the edge's colour (`toneColour`) as the private `--_edge` beside the caller's
|
|
15
|
+
* `style`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function edgeProps(edge: Edge | undefined, style: CSSProperties | undefined): {
|
|
18
|
+
"data-edge": string | undefined;
|
|
19
|
+
style: CSSProperties | undefined;
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TONES as t } from "../tokens/schema.js";
|
|
2
|
+
function n(r) {
|
|
3
|
+
return t.includes(r);
|
|
4
|
+
}
|
|
5
|
+
function i(r) {
|
|
6
|
+
return n(r) ? r === "neutral" ? "var(--cy-color-ink)" : `var(--cy-color-${r})` : r;
|
|
7
|
+
}
|
|
8
|
+
function e(r, o) {
|
|
9
|
+
return r ? {
|
|
10
|
+
"data-edge": n(r) ? r : "custom",
|
|
11
|
+
style: {
|
|
12
|
+
"--_edge": i(r),
|
|
13
|
+
...o
|
|
14
|
+
}
|
|
15
|
+
} : {
|
|
16
|
+
"data-edge": void 0,
|
|
17
|
+
style: o
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
e as edgeProps,
|
|
22
|
+
n as isTone,
|
|
23
|
+
i as toneColour
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=edge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.js","names":["TONES","isTone","value","toneColour","edgeProps","edge","style"],"sources":["../../src/foundations/edge.ts"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport { TONES, type Tone } from \"../tokens/schema.js\";\n\n/** An accent edge: a tone name, which uses that tone's colour, or any CSS colour. */\nexport type Edge = Tone | (string & {});\n\n/** Whether `value` names a `Tone` (rather than being a CSS colour). */\nexport function isTone(value: string): value is Tone {\n return (TONES as readonly string[]).includes(value);\n}\n\n/**\n * The CSS colour of a tone name or a CSS colour: a tone is its colour token (the ink for neutral), so a theme still\n * recolours it; anything else is returned as it is. Edges (`edgeProps`) and Calendar's mark dots use it.\n */\nexport function toneColour(value: Edge): string {\n if (!isTone(value)) return value;\n return value === \"neutral\" ? \"var(--cy-color-ink)\" : `var(--cy-color-${value})`;\n}\n\n/**\n * The attributes of an element drawing an accent edge (Card, Disclosure): `data-edge` (the tone, or \"custom\") for its\n * stylesheet to draw the border, and the edge's colour (`toneColour`) as the private `--_edge` beside the caller's\n * `style`.\n */\nexport function edgeProps(\n edge: Edge | undefined,\n style: CSSProperties | undefined,\n): { \"data-edge\": string | undefined; style: CSSProperties | undefined } {\n if (!edge) return { \"data-edge\": undefined, style };\n return {\n \"data-edge\": isTone(edge) ? edge : \"custom\",\n style: { \"--_edge\": toneColour(edge), ...style } as CSSProperties,\n };\n}\n"],"mappings":";AAOA,SAAgBC,EAAOC,GAA8B;AACnD,SAAQF,EAA4B,SAASE,CAAK;AACpD;AAMA,SAAgBC,EAAWD,GAAqB;AAC9C,SAAKD,EAAOC,CAAK,IACVA,MAAU,YAAY,wBAAwB,kBAAkBA,CAAA,MAD5CA;AAE7B;AAOA,SAAgBE,EACdC,GACAC,GACuE;AACvE,SAAKD,IACE;AAAA,IACL,aAAaJ,EAAOI,CAAI,IAAIA,IAAO;AAAA,IACnC,OAAO;AAAA,MAAE,WAAWF,EAAWE,CAAI;AAAA,MAAG,GAAGC;AAAA,IAAM;AAAA,EACjD,IAJkB;AAAA,IAAE,aAAa;AAAA,IAAW,OAAAA;AAAA,EAAM;AAKpD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The focused element, looking inside open shadow roots: `document.activeElement` stops at the shadow host, so a
|
|
3
|
+
* component rendered in a shadow root would otherwise never see its own focused control. Null on the server.
|
|
4
|
+
*/
|
|
5
|
+
export declare function deepActiveElement(doc?: Document | null): HTMLElement | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function n(t = typeof document > "u" ? null : document) {
|
|
2
|
+
let e = t?.activeElement ?? null;
|
|
3
|
+
for (; e?.shadowRoot?.activeElement; ) e = e.shadowRoot.activeElement;
|
|
4
|
+
return e;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
n as deepActiveElement
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.js","names":["deepActiveElement","doc","active"],"sources":["../../src/foundations/focus.ts"],"sourcesContent":["/**\n * The focused element, looking inside open shadow roots: `document.activeElement` stops at the shadow host, so a\n * component rendered in a shadow root would otherwise never see its own focused control. Null on the server.\n */\nexport function deepActiveElement(doc: Document | null = typeof document === \"undefined\" ? null : document) {\n let active = doc?.activeElement ?? null;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;\n return active as HTMLElement | null;\n}\n"],"mappings":"AAIA,SAAgBA,EAAkBC,IAAuB,OAAO,WAAa,MAAc,OAAO,UAAU;AAC1G,MAAIC,IAASD,GAAK,iBAAiB;AACnC,SAAOC,GAAQ,YAAY,gBAAe,CAAAA,IAASA,EAAO,WAAW;AACrE,SAAOA;AACT"}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
/** True on Apple platforms, where `mod` means Command; elsewhere it means Control. */
|
|
2
2
|
export declare const isApple: () => boolean;
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* `isApple()` as a hook, decided after hydration so the server and the first client render agree (false until then).
|
|
5
|
+
* Kbd, HotkeyField and Menu write shortcuts with it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useApple(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Parses "mod+shift+k" into a matcher for keyboard events. The key is compared with the character typed and, when
|
|
10
|
+
* that is not a letter or digit (Option+K types "˚" on macOS, Shift+1 types "!"), with the physical key. A "+" can be
|
|
11
|
+
* the key itself ("mod++").
|
|
12
|
+
*/
|
|
4
13
|
export declare function matchesHotkey(combo: string, event: KeyboardEvent): boolean;
|
|
14
|
+
export interface HotkeyFromEventOptions {
|
|
15
|
+
/** Write for Apple platforms, where Command is `mod` and Control is `ctrl`. Default: this platform. */
|
|
16
|
+
apple?: boolean;
|
|
17
|
+
/** Accept keys without Control, Command or Alt ("k", "shift+/"). Function keys are always accepted. */
|
|
18
|
+
allowBare?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The shortcut a key press makes, written as `useHotkey` reads it ("mod+shift+p"), or null when the press is not one
|
|
22
|
+
* yet: only modifiers held, a key with no name, or (without `allowBare`) a key that types rather than commands. The
|
|
23
|
+
* key is the character typed and, when that is not a letter or digit (Option+K types "˚", Shift+1 types "!", a dead
|
|
24
|
+
* key or another alphabet), the letter or digit printed on the physical key, so `matchesHotkey` matches it again.
|
|
25
|
+
*/
|
|
26
|
+
export declare function hotkeyFromEvent(event: KeyboardEvent, options?: HotkeyFromEventOptions): string | null;
|
|
5
27
|
/**
|
|
6
28
|
* Calls `handler` when `combo` ("mod+k", "shift+?", "/") is pressed anywhere in the page, shadow roots included.
|
|
7
29
|
* Shortcuts without Ctrl, Command or Alt are ignored while typing in a field, so "/" still types a slash. Any element
|