@snowui-design-system/components 0.3.0-alpha.1 → 0.3.0-alpha.12
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/AGENTS.md +39 -0
- package/LICENSE +152 -91
- package/README.md +41 -7
- package/THIRD_PARTY_NOTICES.md +41 -0
- package/component-catalog.json +531 -84
- package/dist/client/blocks/Sidebar.js +183 -141
- package/dist/client/blocks/SidebarItem.js +27 -13
- package/dist/client/blocks/SidebarSection.js +11 -3
- package/dist/client/blocks/index.js +2 -0
- package/dist/client/compat.js +2 -0
- package/dist/client/components/Accordion.d.ts +2 -0
- package/dist/client/components/Accordion.js +37 -16
- package/dist/client/components/AccordionItem.js +1 -1
- package/dist/client/components/BarChart.js +10 -3
- package/dist/client/components/Breadcrumb.d.ts +1 -0
- package/dist/client/components/Breadcrumb.js +44 -18
- package/dist/client/components/Button.d.ts +2 -0
- package/dist/client/components/Button.js +6 -1
- package/dist/client/components/ChartGroup.js +23 -10
- package/dist/client/components/Checkbox.d.ts +2 -0
- package/dist/client/components/Checkbox.js +19 -4
- package/dist/client/components/Chip.js +2 -2
- package/dist/client/components/CircularChart.js +10 -3
- package/dist/client/components/CodeBlock.js +283 -226
- package/dist/client/components/CopyButton.js +5 -2
- package/dist/client/components/CopyLink.js +1 -1
- package/dist/client/components/DataTable.d.ts +8 -2
- package/dist/client/components/DataTable.js +9 -3
- package/dist/client/components/Dialog.js +1 -1
- package/dist/client/components/ExpandButton.js +10 -3
- package/dist/client/components/Field.js +3 -2
- package/dist/client/components/Frame.js +24 -16
- package/dist/client/components/GaugeChart.js +10 -3
- package/dist/client/components/Icon.js +6 -3
- package/dist/client/components/Image.d.ts +2 -0
- package/dist/client/components/Image.js +14 -2
- package/dist/client/components/ImageViewer.js +51 -27
- package/dist/client/components/Indicator.js +5 -3
- package/dist/client/components/Input.d.ts +1 -0
- package/dist/client/components/Input.js +51 -24
- package/dist/client/components/LineChart.js +10 -3
- package/dist/client/components/Link.d.ts +1 -1
- package/dist/client/components/Link.js +58 -30
- package/dist/client/components/Listbox.d.ts +2 -0
- package/dist/client/components/Listbox.js +98 -43
- package/dist/client/components/MenuItem.d.ts +2 -0
- package/dist/client/components/MenuItem.js +15 -2
- package/dist/client/components/OTPInput.d.ts +32 -0
- package/dist/client/components/OTPInput.js +556 -0
- package/dist/client/components/OverflowAction.d.ts +2 -0
- package/dist/client/components/OverflowAction.js +146 -65
- package/dist/client/components/OverflowActions.d.ts +7 -1
- package/dist/client/components/OverflowActions.js +102 -26
- package/dist/client/components/Pagination.js +117 -68
- package/dist/client/components/Radio.d.ts +2 -0
- package/dist/client/components/Radio.js +20 -5
- package/dist/client/components/ScrambleText.js +4 -1
- package/dist/client/components/ScrollArea.js +11 -5
- package/dist/client/components/SearchBox.d.ts +1 -0
- package/dist/client/components/SearchBox.js +32 -7
- package/dist/client/components/SearchInput.js +43 -3
- package/dist/client/components/Select.d.ts +1 -0
- package/dist/client/components/Select.js +65 -27
- package/dist/client/components/SidePanel.js +81 -54
- package/dist/client/components/Slider.d.ts +1 -1
- package/dist/client/components/Slider.js +36 -13
- package/dist/client/components/SnowUILogo.js +1 -1
- package/dist/client/components/Spinner.js +9 -2
- package/dist/client/components/Switch.d.ts +2 -0
- package/dist/client/components/Switch.js +18 -3
- package/dist/client/components/Tab.js +90 -81
- package/dist/client/components/Table.js +30 -16
- package/dist/client/components/TableBody.js +10 -4
- package/dist/client/components/TableCell.d.ts +1 -0
- package/dist/client/components/TableCell.js +100 -50
- package/dist/client/components/TableHead.js +72 -39
- package/dist/client/components/TableToolbar.js +217 -141
- package/dist/client/components/Tag.js +21 -3
- package/dist/client/components/Text.js +163 -83
- package/dist/client/components/Textarea.js +8 -2
- package/dist/client/components/Toast.js +9 -2
- package/dist/client/components/Toaster.d.ts +2 -0
- package/dist/client/components/Toaster.js +51 -37
- package/dist/client/components/Tooltip.js +229 -201
- package/dist/client/context.js +2 -0
- package/dist/client/dev.js +2 -0
- package/dist/client/i18n/messages.d.ts +2 -2
- package/dist/client/i18n/messages.js +177 -1
- package/dist/client/index.d.ts +4 -1
- package/dist/client/index.js +5 -1
- package/dist/client/internal/code-block/prettier-svelte.d.ts +2 -0
- package/dist/client/internal/component-icon/index.js +2 -0
- package/dist/client/internal/snow-ui-logo/Wordmark.js +21 -9
- package/dist/client/internal/snow-ui-logo/emoji-metrics.js +2 -0
- package/dist/client/keys.d.ts +1 -0
- package/dist/client/keys.js +3 -0
- package/dist/client/lib/adaptive-contrast-renderer.js +2 -0
- package/dist/client/lib/chart/ChartHoverPanel.js +1 -1
- package/dist/client/lib/chart/appearance-timeline.js +2 -0
- package/dist/client/lib/chart/arc-path.js +2 -0
- package/dist/client/lib/chart/colors.js +2 -0
- package/dist/client/lib/chart/size.js +2 -0
- package/dist/client/lib/clipboard.js +2 -0
- package/dist/client/lib/color.js +2 -0
- package/dist/client/lib/date-format.js +2 -0
- package/dist/client/lib/edge-fade.js +2 -0
- package/dist/client/lib/media-loading.d.ts +7 -0
- package/dist/client/lib/media-loading.js +12 -0
- package/dist/client/lib/number-format.js +8 -0
- package/dist/client/lib/overflow-actions-motion.js +2 -0
- package/dist/client/lib/overlay-scrollbar.d.ts +1 -0
- package/dist/client/lib/overlay-scrollbar.js +9 -0
- package/dist/client/lib/overlay-trigger-timing.js +2 -0
- package/dist/client/lib/progressive-blur.d.ts +13 -0
- package/dist/client/lib/progressive-blur.js +54 -0
- package/dist/client/lib/responsive-exit.js +2 -0
- package/dist/client/lib/search-filter.js +2 -0
- package/dist/client/lib/side-panel.js +2 -0
- package/dist/client/lib/split-pane.js +2 -0
- package/dist/client/lib/table-column-motion.js +2 -0
- package/dist/client/lib/table-context.d.ts +5 -0
- package/dist/client/lib/table-context.js +4 -1
- package/dist/client/lib/table-responsive.d.ts +1 -1
- package/dist/client/lib/table-responsive.js +41 -7
- package/dist/client/lib/table-selection-fade.js +2 -0
- package/dist/client/lib/table-truncation.js +2 -0
- package/dist/client/lib/text-motion/animation.js +2 -0
- package/dist/client/lib/text-motion/character.js +2 -0
- package/dist/client/lib/text-motion/color.js +2 -0
- package/dist/client/lib/text-motion/layout.js +2 -0
- package/dist/client/lib/text-motion/preference.js +2 -0
- package/dist/client/lib/text-motion/sequence.js +2 -0
- package/dist/client/lib/text-motion/typography.js +2 -0
- package/dist/client/lib/tooltip-delay.js +2 -0
- package/dist/client/lib/tooltip-motion-dismiss.js +2 -0
- package/dist/client/lib/tooltip-pointer-speed.js +2 -0
- package/dist/client/lib/truncate.js +2 -0
- package/dist/client/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/client/logic/ComponentPartsBoundary.js +15 -0
- package/dist/client/logic/content-line.d.ts +5 -0
- package/dist/client/logic/content-line.js +13 -0
- package/dist/client/logic/frame-dom-runtime.d.ts +3 -1
- package/dist/client/logic/frame-dom-runtime.js +5 -3
- package/dist/client/logic/frame-field-control.js +2 -0
- package/dist/client/logic/frame-inline-style.js +2 -3
- package/dist/client/logic/frame-layout.js +3 -0
- package/dist/client/logic/frame-motion-defaults.js +2 -0
- package/dist/client/logic/frame-prop-filter.d.ts +1 -1
- package/dist/client/logic/frame-prop-filter.js +3 -0
- package/dist/client/logic/frame-responsive.js +22 -6
- package/dist/client/logic/frame-types.d.ts +2 -0
- package/dist/client/logic/geometry-cache.js +2 -0
- package/dist/client/logic/layout-flip.js +2 -0
- package/dist/client/logic/morph.js +2 -0
- package/dist/client/logic/motion-engine.js +2 -0
- package/dist/client/logic/motion-orchestration.js +2 -0
- package/dist/client/logic/motion-types.js +2 -0
- package/dist/client/logic/overflow-actions.d.ts +11 -2
- package/dist/client/logic/overflow-actions.js +5 -0
- package/dist/client/logic/toast.js +7 -4
- package/dist/client/logic/wc-adapter.js +2 -0
- package/dist/client/motion/bridge.js +2 -0
- package/dist/client/motion/content-crossfade.js +2 -0
- package/dist/client/motion/expand.js +2 -0
- package/dist/client/motion/fade-in.js +2 -0
- package/dist/client/motion/fade-out.js +2 -0
- package/dist/client/motion/morph.js +2 -0
- package/dist/client/motion/move.js +2 -0
- package/dist/client/motion/number.js +2 -0
- package/dist/client/motion/replace.js +2 -0
- package/dist/client/motion/rotate.css +2 -0
- package/dist/client/motion/rotate.js +2 -0
- package/dist/client/motion/scale-in.js +2 -0
- package/dist/client/motion/tokens.js +2 -0
- package/dist/client/motion/while-2xl.js +2 -0
- package/dist/client/motion/while-active.js +2 -0
- package/dist/client/motion/while-appear.js +2 -0
- package/dist/client/motion/while-click.js +2 -0
- package/dist/client/motion/while-collapsed.js +2 -0
- package/dist/client/motion/while-disabled.js +2 -0
- package/dist/client/motion/while-disappear.js +2 -0
- package/dist/client/motion/while-drag.js +2 -0
- package/dist/client/motion/while-editing.js +2 -0
- package/dist/client/motion/while-expanded.js +2 -0
- package/dist/client/motion/while-focus.js +2 -0
- package/dist/client/motion/while-hover.js +2 -0
- package/dist/client/motion/while-idle.js +2 -0
- package/dist/client/motion/while-key.js +2 -0
- package/dist/client/motion/while-lg.js +2 -0
- package/dist/client/motion/while-load.js +2 -0
- package/dist/client/motion/while-md.js +2 -0
- package/dist/client/motion/while-reload.js +2 -0
- package/dist/client/motion/while-scroll.js +2 -0
- package/dist/client/motion/while-sm.js +2 -0
- package/dist/client/motion/while-uploading.js +2 -0
- package/dist/client/motion/while-validating.js +2 -0
- package/dist/client/motion/while-xl.js +2 -0
- package/dist/client/motion/while-xs.js +2 -0
- package/dist/client/styles/auto-layout.css +23 -1
- package/dist/client/styles/backdrop.css +2 -0
- package/dist/client/styles/components.css +14 -6
- package/dist/client/styles/index.css +2 -0
- package/dist/client/styles/layout.css +32 -6
- package/dist/client/styles/scale.css +2 -0
- package/dist/client/styles/scrollbar.css +16 -1
- package/dist/client/styles/themes.css +7 -4
- package/dist/client/styles/tokens.css +2 -0
- package/dist/client/vite-env.d.ts +2 -0
- package/dist/server/blocks/Sidebar.js +45 -25
- package/dist/server/blocks/SidebarItem.js +5 -3
- package/dist/server/blocks/SidebarSection.js +11 -3
- package/dist/server/blocks/index.js +2 -0
- package/dist/server/compat.js +2 -0
- package/dist/server/components/Accordion.d.ts +2 -0
- package/dist/server/components/Accordion.js +12 -1
- package/dist/server/components/AccordionItem.js +1 -1
- package/dist/server/components/BarChart.js +6 -3
- package/dist/server/components/Breadcrumb.d.ts +1 -0
- package/dist/server/components/Breadcrumb.js +26 -5
- package/dist/server/components/Button.d.ts +2 -0
- package/dist/server/components/Button.js +6 -1
- package/dist/server/components/ChartGroup.js +6 -3
- package/dist/server/components/Checkbox.d.ts +2 -0
- package/dist/server/components/Checkbox.js +16 -3
- package/dist/server/components/Chip.js +2 -2
- package/dist/server/components/CircularChart.js +6 -3
- package/dist/server/components/CodeBlock.js +27 -14
- package/dist/server/components/CopyButton.js +6 -2
- package/dist/server/components/CopyLink.js +1 -1
- package/dist/server/components/DataTable.d.ts +8 -2
- package/dist/server/components/DataTable.js +9 -3
- package/dist/server/components/Dialog.js +1 -1
- package/dist/server/components/ExpandButton.js +7 -3
- package/dist/server/components/Field.js +3 -2
- package/dist/server/components/Frame.js +19 -10
- package/dist/server/components/GaugeChart.js +6 -3
- package/dist/server/components/Icon.js +5 -4
- package/dist/server/components/Image.d.ts +2 -0
- package/dist/server/components/Image.js +11 -4
- package/dist/server/components/ImageViewer.js +6 -3
- package/dist/server/components/Indicator.js +5 -3
- package/dist/server/components/Input.d.ts +1 -0
- package/dist/server/components/Input.js +32 -22
- package/dist/server/components/LineChart.js +6 -3
- package/dist/server/components/Link.d.ts +1 -1
- package/dist/server/components/Link.js +22 -3
- package/dist/server/components/Listbox.d.ts +2 -0
- package/dist/server/components/Listbox.js +81 -22
- package/dist/server/components/MenuItem.d.ts +2 -0
- package/dist/server/components/MenuItem.js +9 -2
- package/dist/server/components/OTPInput.d.ts +32 -0
- package/dist/server/components/OTPInput.js +401 -0
- package/dist/server/components/OverflowAction.d.ts +2 -0
- package/dist/server/components/OverflowAction.js +70 -26
- package/dist/server/components/OverflowActions.d.ts +7 -1
- package/dist/server/components/OverflowActions.js +88 -30
- package/dist/server/components/Pagination.js +42 -22
- package/dist/server/components/Radio.d.ts +2 -0
- package/dist/server/components/Radio.js +15 -5
- package/dist/server/components/ScrambleText.js +4 -1
- package/dist/server/components/ScrollArea.js +5 -2
- package/dist/server/components/SearchBox.d.ts +1 -0
- package/dist/server/components/SearchBox.js +25 -5
- package/dist/server/components/SearchInput.js +12 -3
- package/dist/server/components/Select.d.ts +1 -0
- package/dist/server/components/Select.js +55 -20
- package/dist/server/components/SidePanel.js +33 -12
- package/dist/server/components/Slider.d.ts +1 -1
- package/dist/server/components/Slider.js +34 -11
- package/dist/server/components/SnowUILogo.js +1 -1
- package/dist/server/components/Spinner.js +4 -2
- package/dist/server/components/Switch.d.ts +2 -0
- package/dist/server/components/Switch.js +14 -3
- package/dist/server/components/Tab.js +62 -52
- package/dist/server/components/Table.js +16 -6
- package/dist/server/components/TableBody.js +9 -2
- package/dist/server/components/TableCell.d.ts +1 -0
- package/dist/server/components/TableCell.js +68 -25
- package/dist/server/components/TableHead.js +35 -8
- package/dist/server/components/TableToolbar.js +104 -55
- package/dist/server/components/Tag.js +17 -3
- package/dist/server/components/Text.js +64 -15
- package/dist/server/components/Textarea.js +5 -2
- package/dist/server/components/Toast.js +5 -2
- package/dist/server/components/Toaster.d.ts +2 -0
- package/dist/server/components/Toaster.js +17 -2
- package/dist/server/components/Tooltip.js +39 -16
- package/dist/server/context.js +2 -0
- package/dist/server/dev.js +2 -0
- package/dist/server/i18n/messages.d.ts +2 -2
- package/dist/server/i18n/messages.js +177 -1
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +5 -1
- package/dist/server/internal/code-block/prettier-svelte.d.ts +2 -0
- package/dist/server/internal/component-icon/index.js +2 -0
- package/dist/server/internal/snow-ui-logo/Wordmark.js +15 -7
- package/dist/server/internal/snow-ui-logo/emoji-metrics.js +2 -0
- package/dist/server/keys.d.ts +1 -0
- package/dist/server/keys.js +3 -0
- package/dist/server/lib/adaptive-contrast-renderer.js +2 -0
- package/dist/server/lib/chart/ChartHoverPanel.js +1 -1
- package/dist/server/lib/chart/appearance-timeline.js +2 -0
- package/dist/server/lib/chart/arc-path.js +2 -0
- package/dist/server/lib/chart/colors.js +2 -0
- package/dist/server/lib/chart/size.js +2 -0
- package/dist/server/lib/clipboard.js +2 -0
- package/dist/server/lib/color.js +2 -0
- package/dist/server/lib/date-format.js +2 -0
- package/dist/server/lib/edge-fade.js +2 -0
- package/dist/server/lib/media-loading.d.ts +7 -0
- package/dist/server/lib/media-loading.js +12 -0
- package/dist/server/lib/number-format.js +8 -0
- package/dist/server/lib/overflow-actions-motion.js +2 -0
- package/dist/server/lib/overlay-scrollbar.d.ts +1 -0
- package/dist/server/lib/overlay-scrollbar.js +9 -0
- package/dist/server/lib/overlay-trigger-timing.js +2 -0
- package/dist/server/lib/progressive-blur.d.ts +13 -0
- package/dist/server/lib/progressive-blur.js +54 -0
- package/dist/server/lib/responsive-exit.js +2 -0
- package/dist/server/lib/search-filter.js +2 -0
- package/dist/server/lib/side-panel.js +2 -0
- package/dist/server/lib/split-pane.js +2 -0
- package/dist/server/lib/table-column-motion.js +2 -0
- package/dist/server/lib/table-context.d.ts +5 -0
- package/dist/server/lib/table-context.js +4 -1
- package/dist/server/lib/table-responsive.d.ts +1 -1
- package/dist/server/lib/table-responsive.js +41 -7
- package/dist/server/lib/table-selection-fade.js +2 -0
- package/dist/server/lib/table-truncation.js +2 -0
- package/dist/server/lib/text-motion/animation.js +2 -0
- package/dist/server/lib/text-motion/character.js +2 -0
- package/dist/server/lib/text-motion/color.js +2 -0
- package/dist/server/lib/text-motion/layout.js +2 -0
- package/dist/server/lib/text-motion/preference.js +2 -0
- package/dist/server/lib/text-motion/sequence.js +2 -0
- package/dist/server/lib/text-motion/typography.js +2 -0
- package/dist/server/lib/tooltip-delay.js +2 -0
- package/dist/server/lib/tooltip-motion-dismiss.js +2 -0
- package/dist/server/lib/tooltip-pointer-speed.js +2 -0
- package/dist/server/lib/truncate.js +2 -0
- package/dist/server/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/server/logic/ComponentPartsBoundary.js +12 -0
- package/dist/server/logic/content-line.d.ts +5 -0
- package/dist/server/logic/content-line.js +13 -0
- package/dist/server/logic/frame-dom-runtime.d.ts +3 -1
- package/dist/server/logic/frame-dom-runtime.js +5 -3
- package/dist/server/logic/frame-field-control.js +2 -0
- package/dist/server/logic/frame-inline-style.js +2 -3
- package/dist/server/logic/frame-layout.js +3 -0
- package/dist/server/logic/frame-motion-defaults.js +2 -0
- package/dist/server/logic/frame-prop-filter.d.ts +1 -1
- package/dist/server/logic/frame-prop-filter.js +3 -0
- package/dist/server/logic/frame-responsive.js +22 -6
- package/dist/server/logic/frame-types.d.ts +2 -0
- package/dist/server/logic/geometry-cache.js +2 -0
- package/dist/server/logic/layout-flip.js +2 -0
- package/dist/server/logic/morph.js +2 -0
- package/dist/server/logic/motion-engine.js +2 -0
- package/dist/server/logic/motion-orchestration.js +2 -0
- package/dist/server/logic/motion-types.js +2 -0
- package/dist/server/logic/overflow-actions.d.ts +11 -2
- package/dist/server/logic/overflow-actions.js +5 -0
- package/dist/server/logic/toast.js +7 -4
- package/dist/server/logic/wc-adapter.js +2 -0
- package/dist/server/motion/bridge.js +2 -0
- package/dist/server/motion/content-crossfade.js +2 -0
- package/dist/server/motion/expand.js +2 -0
- package/dist/server/motion/fade-in.js +2 -0
- package/dist/server/motion/fade-out.js +2 -0
- package/dist/server/motion/morph.js +2 -0
- package/dist/server/motion/move.js +2 -0
- package/dist/server/motion/number.js +2 -0
- package/dist/server/motion/replace.js +2 -0
- package/dist/server/motion/rotate.css +2 -0
- package/dist/server/motion/rotate.js +2 -0
- package/dist/server/motion/scale-in.js +2 -0
- package/dist/server/motion/tokens.js +2 -0
- package/dist/server/motion/while-2xl.js +2 -0
- package/dist/server/motion/while-active.js +2 -0
- package/dist/server/motion/while-appear.js +2 -0
- package/dist/server/motion/while-click.js +2 -0
- package/dist/server/motion/while-collapsed.js +2 -0
- package/dist/server/motion/while-disabled.js +2 -0
- package/dist/server/motion/while-disappear.js +2 -0
- package/dist/server/motion/while-drag.js +2 -0
- package/dist/server/motion/while-editing.js +2 -0
- package/dist/server/motion/while-expanded.js +2 -0
- package/dist/server/motion/while-focus.js +2 -0
- package/dist/server/motion/while-hover.js +2 -0
- package/dist/server/motion/while-idle.js +2 -0
- package/dist/server/motion/while-key.js +2 -0
- package/dist/server/motion/while-lg.js +2 -0
- package/dist/server/motion/while-load.js +2 -0
- package/dist/server/motion/while-md.js +2 -0
- package/dist/server/motion/while-reload.js +2 -0
- package/dist/server/motion/while-scroll.js +2 -0
- package/dist/server/motion/while-sm.js +2 -0
- package/dist/server/motion/while-uploading.js +2 -0
- package/dist/server/motion/while-validating.js +2 -0
- package/dist/server/motion/while-xl.js +2 -0
- package/dist/server/motion/while-xs.js +2 -0
- package/dist/server/styles/auto-layout.css +23 -1
- package/dist/server/styles/backdrop.css +2 -0
- package/dist/server/styles/components.css +14 -6
- package/dist/server/styles/index.css +2 -0
- package/dist/server/styles/layout.css +32 -6
- package/dist/server/styles/scale.css +2 -0
- package/dist/server/styles/scrollbar.css +16 -1
- package/dist/server/styles/themes.css +7 -4
- package/dist/server/styles/tokens.css +2 -0
- package/dist/server/vite-env.d.ts +2 -0
- package/llms.txt +8 -0
- package/package.json +15 -6
|
@@ -16,19 +16,22 @@ var rest_excludes = new Set([
|
|
|
16
16
|
'icon',
|
|
17
17
|
'disabled',
|
|
18
18
|
'href',
|
|
19
|
+
'iconOnly',
|
|
19
20
|
'onclick',
|
|
20
21
|
'children',
|
|
22
|
+
'control',
|
|
21
23
|
'parts',
|
|
22
24
|
'as'
|
|
23
25
|
]);
|
|
24
26
|
|
|
25
27
|
var root = $.from_html(`<!> `, 1);
|
|
26
28
|
var root_1 = $.from_html(`<span><!></span>`);
|
|
27
|
-
var root_2 = $.from_html(`<span class="snowui-overflow-action-
|
|
29
|
+
var root_2 = $.from_html(`<span class="snowui-overflow-action-measure" aria-hidden="true" inert=""><span><!></span> <!></span>`);
|
|
30
|
+
var root_3 = $.from_html(`<span class="snowui-overflow-action-visual"><!></span> <!>`, 1);
|
|
28
31
|
|
|
29
32
|
const $$css = {
|
|
30
33
|
hash: 'svelte-tc9pz8',
|
|
31
|
-
code: ':where(.snowui-overflow-action-visual) {display:inline-flex;opacity:var(--snowui-responsive-exit-opacity, 1);}\n @media (prefers-reduced-motion: reduce) {:where(.snowui-overflow-action-visual) {opacity:1;}\n }:where(.snowui-overflow-action) {position:relative;display:inline-flex;flex:0 0 auto;min-width:0;font-size:inherit;line-height:inherit;}:where(.snowui-overflow-action
|
|
34
|
+
code: ':where(.snowui-overflow-action-visual) {display:inline-flex;opacity:var(--snowui-responsive-exit-opacity, 1);}\n @media (prefers-reduced-motion: reduce) {:where(.snowui-overflow-action-visual) {opacity:1;}\n }:where(.snowui-overflow-action) {position:relative;display:inline-flex;flex:0 0 auto;min-width:0;font-size:inherit;line-height:inherit;}:where(.snowui-overflow-action-measure) {position:absolute;inset:0 auto auto 0;display:inline-flex;visibility:hidden;pointer-events:none;contain:layout style;white-space:nowrap;}:where(.snowui-overflow-action[data-overflow-mode="hidden"]) {display:none;}'
|
|
32
35
|
};
|
|
33
36
|
|
|
34
37
|
export default function OverflowAction($$anchor, $$props) {
|
|
@@ -81,20 +84,24 @@ export default function OverflowAction($$anchor, $$props) {
|
|
|
81
84
|
$.append($$anchor, fragment_4);
|
|
82
85
|
};
|
|
83
86
|
|
|
87
|
+
var consequent_3 = ($$anchor) => {
|
|
88
|
+
renderIcon($$anchor);
|
|
89
|
+
};
|
|
90
|
+
|
|
84
91
|
var alternate = ($$anchor) => {
|
|
85
|
-
var
|
|
86
|
-
var node_4 = $.first_child(
|
|
92
|
+
var fragment_6 = root();
|
|
93
|
+
var node_4 = $.first_child(fragment_6);
|
|
87
94
|
|
|
88
95
|
renderIcon(node_4);
|
|
89
96
|
|
|
90
97
|
var text = $.sibling(node_4);
|
|
91
98
|
|
|
92
99
|
$.template_effect(() => $.set_text(text, ` ${$$props.label ?? ''}`));
|
|
93
|
-
$.append($$anchor,
|
|
100
|
+
$.append($$anchor, fragment_6);
|
|
94
101
|
};
|
|
95
102
|
|
|
96
103
|
$.if(node_2, ($$render) => {
|
|
97
|
-
if (children()) $$render(consequent_2); else $$render(alternate, -1);
|
|
104
|
+
if (children()) $$render(consequent_2); else if (iconOnly()) $$render(consequent_3, 1); else $$render(alternate, -1);
|
|
98
105
|
});
|
|
99
106
|
}
|
|
100
107
|
|
|
@@ -104,8 +111,10 @@ export default function OverflowAction($$anchor, $$props) {
|
|
|
104
111
|
let icon = $.prop($$props, 'icon', 3, undefined),
|
|
105
112
|
disabled = $.prop($$props, 'disabled', 3, false),
|
|
106
113
|
href = $.prop($$props, 'href', 3, undefined),
|
|
114
|
+
iconOnly = $.prop($$props, 'iconOnly', 3, false),
|
|
107
115
|
onclick = $.prop($$props, 'onclick', 3, undefined),
|
|
108
116
|
children = $.prop($$props, 'children', 3, undefined),
|
|
117
|
+
control = $.prop($$props, 'control', 3, undefined),
|
|
109
118
|
parts = $.prop($$props, 'parts', 3, undefined),
|
|
110
119
|
as = $.prop($$props, 'as', 3, undefined),
|
|
111
120
|
rest = $.rest_props($$props, rest_excludes);
|
|
@@ -113,6 +122,7 @@ export default function OverflowAction($$anchor, $$props) {
|
|
|
113
122
|
const owner = getOverflowActionsContext();
|
|
114
123
|
const resolvedButtonProps = $.derived(() => mergeComponentPartProps(mergeComponentPartProps(owner?.buttonProps, parts()?.Button ?? {}), rest));
|
|
115
124
|
let rootElement = $.state(undefined);
|
|
125
|
+
let visualElement = $.state(undefined);
|
|
116
126
|
let fullMeasureElement = $.state(undefined);
|
|
117
127
|
let compactMeasureElement = $.state(undefined);
|
|
118
128
|
const mode = $.derived(() => owner?.getMode($$props.id) ?? "full");
|
|
@@ -154,12 +164,35 @@ export default function OverflowAction($$anchor, $$props) {
|
|
|
154
164
|
return href();
|
|
155
165
|
},
|
|
156
166
|
|
|
167
|
+
get target() {
|
|
168
|
+
return $$props.target;
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
get rel() {
|
|
172
|
+
return $$props.rel;
|
|
173
|
+
},
|
|
174
|
+
|
|
157
175
|
execute(event) {
|
|
158
176
|
onclick()?.(event);
|
|
159
177
|
},
|
|
160
178
|
getElement: () => $.get(rootElement),
|
|
161
|
-
|
|
162
|
-
|
|
179
|
+
getWidth(mode) {
|
|
180
|
+
const hidden = $.get(rootElement)?.dataset.overflowMode === "hidden";
|
|
181
|
+
|
|
182
|
+
if (hidden && $.get(rootElement)) $.get(rootElement).style.display = "inline-flex";
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
const element = control()
|
|
186
|
+
? $.get(visualElement)
|
|
187
|
+
: mode === "compact"
|
|
188
|
+
? $.get(compactMeasureElement)
|
|
189
|
+
: $.get(fullMeasureElement);
|
|
190
|
+
|
|
191
|
+
return element?.getBoundingClientRect().width ?? 0;
|
|
192
|
+
} finally {
|
|
193
|
+
if (hidden && $.get(rootElement)) $.get(rootElement).style.removeProperty("display");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
163
196
|
});
|
|
164
197
|
});
|
|
165
198
|
|
|
@@ -169,6 +202,8 @@ export default function OverflowAction($$anchor, $$props) {
|
|
|
169
202
|
icon();
|
|
170
203
|
disabled();
|
|
171
204
|
href();
|
|
205
|
+
iconOnly();
|
|
206
|
+
control();
|
|
172
207
|
$.get(resolvedButtonProps);
|
|
173
208
|
owner?.requestLayout();
|
|
174
209
|
});
|
|
@@ -205,12 +240,21 @@ export default function OverflowAction($$anchor, $$props) {
|
|
|
205
240
|
},
|
|
206
241
|
|
|
207
242
|
children: ($$anchor, $$slotProps) => {
|
|
208
|
-
var
|
|
209
|
-
var span = $.first_child(
|
|
243
|
+
var fragment_8 = root_3();
|
|
244
|
+
var span = $.first_child(fragment_8);
|
|
245
|
+
let styles;
|
|
210
246
|
var node_5 = $.child(span);
|
|
211
247
|
|
|
212
248
|
{
|
|
213
|
-
var
|
|
249
|
+
var consequent_4 = ($$anchor) => {
|
|
250
|
+
var fragment_9 = $.comment();
|
|
251
|
+
var node_6 = $.first_child(fragment_9);
|
|
252
|
+
|
|
253
|
+
$.snippet(node_6, control, () => execute, () => $.get(resolvedDisabled));
|
|
254
|
+
$.append($$anchor, fragment_9);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
var consequent_5 = ($$anchor) => {
|
|
214
258
|
Button($$anchor, $.spread_props(() => $.get(resolvedButtonProps), {
|
|
215
259
|
iconOnly: true,
|
|
216
260
|
get 'aria-label'() {
|
|
@@ -237,76 +281,113 @@ export default function OverflowAction($$anchor, $$props) {
|
|
|
237
281
|
};
|
|
238
282
|
|
|
239
283
|
var alternate_1 = ($$anchor) => {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
284
|
+
{
|
|
285
|
+
let $0 = $.derived(() => iconOnly() ? $$props.label : undefined);
|
|
286
|
+
|
|
287
|
+
Button($$anchor, $.spread_props(() => $.get(resolvedButtonProps), {
|
|
288
|
+
get iconOnly() {
|
|
289
|
+
return iconOnly();
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
get 'aria-label'() {
|
|
293
|
+
return $.get($0);
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
get disabled() {
|
|
297
|
+
return $.get(resolvedDisabled);
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
get href() {
|
|
301
|
+
return href();
|
|
302
|
+
},
|
|
303
|
+
onclick: execute,
|
|
304
|
+
children: ($$anchor, $$slotProps) => {
|
|
305
|
+
renderFull($$anchor);
|
|
306
|
+
},
|
|
307
|
+
$$slots: { default: true }
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
254
310
|
};
|
|
255
311
|
|
|
256
312
|
$.if(node_5, ($$render) => {
|
|
257
|
-
if ($.get(mode) === "compact") $$render(
|
|
313
|
+
if (control()) $$render(consequent_4); else if ($.get(mode) === "compact") $$render(consequent_5, 1); else $$render(alternate_1, -1);
|
|
258
314
|
});
|
|
259
315
|
}
|
|
260
316
|
|
|
261
317
|
$.reset(span);
|
|
318
|
+
$.bind_this(span, ($$value) => $.set(visualElement, $$value), () => $.get(visualElement));
|
|
262
319
|
|
|
263
|
-
var
|
|
264
|
-
var span_2 = $.child(span_1);
|
|
265
|
-
var node_6 = $.child(span_2);
|
|
266
|
-
|
|
267
|
-
Button(node_6, $.spread_props(() => $.get(resolvedButtonProps), {
|
|
268
|
-
tabindex: -1,
|
|
269
|
-
children: ($$anchor, $$slotProps) => {
|
|
270
|
-
renderFull($$anchor);
|
|
271
|
-
},
|
|
272
|
-
$$slots: { default: true }
|
|
273
|
-
}));
|
|
274
|
-
|
|
275
|
-
$.reset(span_2);
|
|
276
|
-
$.bind_this(span_2, ($$value) => $.set(fullMeasureElement, $$value), () => $.get(fullMeasureElement));
|
|
277
|
-
|
|
278
|
-
var node_7 = $.sibling(span_2, 2);
|
|
320
|
+
var node_7 = $.sibling(span, 2);
|
|
279
321
|
|
|
280
322
|
{
|
|
281
|
-
var
|
|
282
|
-
var
|
|
283
|
-
var
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
323
|
+
var consequent_7 = ($$anchor) => {
|
|
324
|
+
var span_1 = root_2();
|
|
325
|
+
var span_2 = $.child(span_1);
|
|
326
|
+
var node_8 = $.child(span_2);
|
|
327
|
+
|
|
328
|
+
{
|
|
329
|
+
let $0 = $.derived(() => iconOnly() ? $$props.label : undefined);
|
|
330
|
+
|
|
331
|
+
Button(node_8, $.spread_props(() => $.get(resolvedButtonProps), {
|
|
332
|
+
get iconOnly() {
|
|
333
|
+
return iconOnly();
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
get 'aria-label'() {
|
|
337
|
+
return $.get($0);
|
|
338
|
+
},
|
|
339
|
+
tabindex: -1,
|
|
340
|
+
children: ($$anchor, $$slotProps) => {
|
|
341
|
+
renderFull($$anchor);
|
|
342
|
+
},
|
|
343
|
+
$$slots: { default: true }
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
$.reset(span_2);
|
|
348
|
+
$.bind_this(span_2, ($$value) => $.set(fullMeasureElement, $$value), () => $.get(fullMeasureElement));
|
|
349
|
+
|
|
350
|
+
var node_9 = $.sibling(span_2, 2);
|
|
351
|
+
|
|
352
|
+
{
|
|
353
|
+
var consequent_6 = ($$anchor) => {
|
|
354
|
+
var span_3 = root_1();
|
|
355
|
+
var node_10 = $.child(span_3);
|
|
356
|
+
|
|
357
|
+
Button(node_10, $.spread_props(() => $.get(resolvedButtonProps), {
|
|
358
|
+
iconOnly: true,
|
|
359
|
+
tabindex: -1,
|
|
360
|
+
get 'aria-label'() {
|
|
361
|
+
return $$props.label;
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
children: ($$anchor, $$slotProps) => {
|
|
365
|
+
renderIcon($$anchor);
|
|
366
|
+
},
|
|
367
|
+
$$slots: { default: true }
|
|
368
|
+
}));
|
|
369
|
+
|
|
370
|
+
$.reset(span_3);
|
|
371
|
+
$.bind_this(span_3, ($$value) => $.set(compactMeasureElement, $$value), () => $.get(compactMeasureElement));
|
|
372
|
+
$.append($$anchor, span_3);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
$.if(node_9, ($$render) => {
|
|
376
|
+
if (icon()) $$render(consequent_6);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
$.reset(span_1);
|
|
381
|
+
$.append($$anchor, span_1);
|
|
301
382
|
};
|
|
302
383
|
|
|
303
384
|
$.if(node_7, ($$render) => {
|
|
304
|
-
if (
|
|
385
|
+
if (!control()) $$render(consequent_7);
|
|
305
386
|
});
|
|
306
387
|
}
|
|
307
388
|
|
|
308
|
-
$.
|
|
309
|
-
$.append($$anchor,
|
|
389
|
+
$.template_effect(() => styles = $.set_style(span, '', styles, { visibility: $.get(mode) === "hidden" ? "hidden" : undefined }));
|
|
390
|
+
$.append($$anchor, fragment_8);
|
|
310
391
|
},
|
|
311
392
|
$$slots: { default: true }
|
|
312
393
|
}
|
|
@@ -5,11 +5,12 @@ import SelectButton from "./SelectButton.js";
|
|
|
5
5
|
import Listbox from "./Listbox.js";
|
|
6
6
|
import MenuItem from "./MenuItem.js";
|
|
7
7
|
import Separator from "./Separator.js";
|
|
8
|
+
import OverflowAction from "./OverflowAction.js";
|
|
8
9
|
import { type OverflowActionIcon } from "../logic/overflow-actions.js";
|
|
9
10
|
import { type ComponentPartsOf } from "../logic/component-parts.js";
|
|
10
11
|
type ButtonProps = ComponentProps<typeof Button>;
|
|
11
12
|
type ControlledGlobalButtonKeys = "children" | "as" | "iconOnly" | "disabled" | "href" | "onclick" | "aria-label" | "title";
|
|
12
|
-
type GlobalButtonProps = Omit<ButtonProps, ControlledGlobalButtonKeys>;
|
|
13
|
+
export type GlobalButtonProps = Omit<ButtonProps, ControlledGlobalButtonKeys>;
|
|
13
14
|
export interface OverflowActionsActionItem {
|
|
14
15
|
type?: "action";
|
|
15
16
|
id: string;
|
|
@@ -17,7 +18,11 @@ export interface OverflowActionsActionItem {
|
|
|
17
18
|
icon?: OverflowActionIcon;
|
|
18
19
|
disabled?: boolean;
|
|
19
20
|
href?: string;
|
|
21
|
+
target?: string;
|
|
22
|
+
rel?: string;
|
|
20
23
|
onAction?: () => void;
|
|
24
|
+
buttonProps?: GlobalButtonProps;
|
|
25
|
+
parts?: ComponentProps<typeof OverflowAction>["parts"];
|
|
21
26
|
}
|
|
22
27
|
export interface OverflowActionsSeparatorItem {
|
|
23
28
|
type: "separator";
|
|
@@ -43,6 +48,7 @@ interface Props extends Omit<FrameProps, "children"> {
|
|
|
43
48
|
overflow?: "all" | "progressive";
|
|
44
49
|
overflowFrom?: "start" | "end";
|
|
45
50
|
availableWidth?: number;
|
|
51
|
+
maxVisible?: number;
|
|
46
52
|
moreLabel?: string;
|
|
47
53
|
align?: "start" | "end";
|
|
48
54
|
disabled?: boolean;
|
|
@@ -12,8 +12,14 @@ import OverflowAction from "./OverflowAction.js";
|
|
|
12
12
|
import { createOverflowActionsMotion } from "../lib/overflow-actions-motion.js";
|
|
13
13
|
import { createResponsiveExit } from "../lib/responsive-exit.js";
|
|
14
14
|
import { resizeManager } from "../logic/observer.js";
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
OVERFLOW_ACTIONS_CONTEXT_KEY,
|
|
18
|
+
getOverflowActionsLayoutContext
|
|
19
|
+
} from "../logic/overflow-actions.js";
|
|
20
|
+
|
|
16
21
|
import { mergeComponentPartProps } from "../logic/component-parts.js";
|
|
22
|
+
import { useLocale } from "../i18n/locale.js";
|
|
17
23
|
|
|
18
24
|
const renderMenuIcon = ($$anchor, icon = $.noop) => {
|
|
19
25
|
var fragment = $.comment();
|
|
@@ -54,6 +60,7 @@ var rest_excludes = new Set([
|
|
|
54
60
|
'overflow',
|
|
55
61
|
'overflowFrom',
|
|
56
62
|
'availableWidth',
|
|
63
|
+
'maxVisible',
|
|
57
64
|
'moreLabel',
|
|
58
65
|
'align',
|
|
59
66
|
'disabled',
|
|
@@ -71,7 +78,7 @@ var root_3 = $.from_html(`<!> <!> <span class="snowui-overflow-actions-fade-meas
|
|
|
71
78
|
|
|
72
79
|
const $$css = {
|
|
73
80
|
hash: 'svelte-ewzjdd',
|
|
74
|
-
code: ':where(.snowui-overflow-actions-more-visual) {display:inline-flex;flex:0 0 auto;}:where(.snowui-overflow-actions-fade-measure) {position:absolute;width:var(--size-5);height:0;visibility:hidden;pointer-events:none;}:where(.snowui-overflow-actions) {position:relative;display:inline-flex;align-items:center;flex-wrap:nowrap;gap:var(--snowui-overflow-actions-gap-override, var(--gap-2, 0.5rem));width:100%;min-width:0;max-width:100%;white-space:nowrap;font-size:inherit;line-height:inherit;}:where(.snowui-overflow-actions > [data-as="separator"]) {height:var(--snowui-overflow-actions-separator-length, var(--size-3));}:where(.snowui-overflow-actions > [data-as="separator"])[hidden] {display:none;}:where(.snowui-overflow-actions-more-measure) {position:absolute;inset:0 auto auto 0;display:inline-flex;visibility:hidden;pointer-events:none;contain:layout style;}'
|
|
81
|
+
code: ':where(.snowui-overflow-actions-more-visual) {display:inline-flex;flex:0 0 auto;}:where(.snowui-overflow-actions-fade-measure) {position:absolute;width:var(--size-5);height:0;visibility:hidden;pointer-events:none;}:where(.snowui-overflow-actions) {position:relative;display:inline-flex;align-items:center;flex-wrap:nowrap;gap:max(4px, var(--snowui-overflow-actions-gap-override, var(--gap-2, 0.5rem)));width:100%;min-width:0;max-width:100%;white-space:nowrap;font-size:inherit;line-height:inherit;}:where(.snowui-overflow-actions > [data-as="separator"]) {height:var(--snowui-overflow-actions-separator-length, var(--size-3));}:where(.snowui-overflow-actions > [data-as="separator"])[hidden] {display:none;}:where(.snowui-overflow-actions-more-measure) {position:absolute;inset:0 auto auto 0;display:inline-flex;visibility:hidden;pointer-events:none;contain:layout style;}'
|
|
75
82
|
};
|
|
76
83
|
|
|
77
84
|
export default function OverflowActions($$anchor, $$props) {
|
|
@@ -81,10 +88,11 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
81
88
|
// SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
|
|
82
89
|
let items = $.prop($$props, 'items', 19, () => []),
|
|
83
90
|
compact = $.prop($$props, 'compact', 3, "auto"),
|
|
84
|
-
overflow = $.prop($$props, 'overflow', 3,
|
|
91
|
+
overflow = $.prop($$props, 'overflow', 3, undefined),
|
|
85
92
|
overflowFrom = $.prop($$props, 'overflowFrom', 3, "end"),
|
|
86
93
|
availableWidth = $.prop($$props, 'availableWidth', 3, undefined),
|
|
87
|
-
|
|
94
|
+
maxVisible = $.prop($$props, 'maxVisible', 3, undefined),
|
|
95
|
+
moreLabel = $.prop($$props, 'moreLabel', 3, undefined),
|
|
88
96
|
align = $.prop($$props, 'align', 3, "end"),
|
|
89
97
|
disabled = $.prop($$props, 'disabled', 3, false),
|
|
90
98
|
buttonProps = $.prop($$props, 'buttonProps', 3, undefined),
|
|
@@ -94,10 +102,26 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
94
102
|
userClass = $.prop($$props, 'class', 3, ""),
|
|
95
103
|
rest = $.rest_props($$props, rest_excludes);
|
|
96
104
|
|
|
105
|
+
const locale = useLocale();
|
|
106
|
+
const layoutContext = getOverflowActionsLayoutContext();
|
|
107
|
+
const resolvedOverflow = $.derived(() => overflow() ?? layoutContext?.overflow ?? "all");
|
|
108
|
+
|
|
109
|
+
const resolvedMaxVisible = $.derived(() => {
|
|
110
|
+
const value = maxVisible() ?? layoutContext?.maxVisible;
|
|
111
|
+
|
|
112
|
+
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : Infinity;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const resolvedAvailableWidth = $.derived(() => layoutContext?.availableWidth === undefined
|
|
116
|
+
? availableWidth()
|
|
117
|
+
: Math.min(availableWidth() ?? Infinity, layoutContext.availableWidth));
|
|
118
|
+
|
|
119
|
+
const resolvedMoreLabel = $.derived(() => moreLabel() ?? locale.t("overflowActions.more"));
|
|
97
120
|
let rootElement = $.state(undefined);
|
|
98
121
|
let moreMeasureElement = $.state(undefined);
|
|
99
122
|
let fadeMeasureElement;
|
|
100
123
|
const separatorWidths = new Map();
|
|
124
|
+
const actionWidths = new Map();
|
|
101
125
|
let modes = $.state($.proxy({}));
|
|
102
126
|
let menuEntries = $.state($.proxy([]));
|
|
103
127
|
let hasOverflow = $.state(false);
|
|
@@ -164,11 +188,23 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
164
188
|
onAction()?.({ id, item, source, originalEvent });
|
|
165
189
|
|
|
166
190
|
if (source === "menu" && action.href && typeof window !== "undefined") {
|
|
167
|
-
|
|
191
|
+
if (action.target && action.target !== "_self") {
|
|
192
|
+
window.open(action.href, action.target, action.rel?.includes("noreferrer") ? "noopener,noreferrer" : "noopener");
|
|
193
|
+
} else {
|
|
194
|
+
window.location.assign(action.href);
|
|
195
|
+
}
|
|
168
196
|
}
|
|
169
197
|
}
|
|
170
198
|
|
|
171
199
|
function requestLayout() {
|
|
200
|
+
// 内容或 Props 改变时才重新测量;连续拖动只复用固有宽度。
|
|
201
|
+
actionWidths.clear();
|
|
202
|
+
|
|
203
|
+
separatorWidths.clear();
|
|
204
|
+
scheduleLayout();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function scheduleLayout() {
|
|
172
208
|
if (!isMounted || layoutFrame) return;
|
|
173
209
|
|
|
174
210
|
layoutFrame = requestAnimationFrame(() => {
|
|
@@ -245,11 +281,7 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
245
281
|
return separatorWidths.get(entry.element) ?? 0;
|
|
246
282
|
}
|
|
247
283
|
|
|
248
|
-
|
|
249
|
-
? entry.action.getCompactMeasureElement()
|
|
250
|
-
: entry.action.getFullMeasureElement();
|
|
251
|
-
|
|
252
|
-
return element?.getBoundingClientRect().width ?? 0;
|
|
284
|
+
return actionWidths.get(entry.action.id)?.[mode] ?? 0;
|
|
253
285
|
}
|
|
254
286
|
|
|
255
287
|
function totalWidth(entries, mode, includeMore, gap) {
|
|
@@ -270,16 +302,26 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
270
302
|
const actions = entries.filter((entry) => entry.type === "action").map((entry) => entry.action);
|
|
271
303
|
const allIds = new Set(actions.map((action) => action.id));
|
|
272
304
|
const normalizedAll = normalizeEntries(entries, allIds);
|
|
273
|
-
const width = Math.max(0, availableWidth() ?? $.get(rootElement).getBoundingClientRect().width);
|
|
274
305
|
const computed = getComputedStyle($.get(rootElement));
|
|
306
|
+
|
|
307
|
+
// 与 Table 一样读取小数布局宽度;clientWidth 的整数取整会在临界点往返跳变。
|
|
308
|
+
const width = Math.max(0, $.get(resolvedAvailableWidth) ?? (Number.parseFloat(computed.width) || $.get(rootElement).clientWidth));
|
|
309
|
+
|
|
275
310
|
const gap = Number.parseFloat(computed.columnGap || computed.gap) || 0;
|
|
276
311
|
const canCompact = compact() === "auto" && actions.length > 0 && actions.every((action) => !!action.icon);
|
|
277
312
|
|
|
278
|
-
//
|
|
279
|
-
|
|
313
|
+
// 隐藏项只在内容变化后测量一次,避免拖动时反复切换 display 触发布局反馈。
|
|
314
|
+
for (const action of actions) {
|
|
315
|
+
if (!actionWidths.has(action.id)) {
|
|
316
|
+
actionWidths.set(action.id, {
|
|
317
|
+
full: action.getWidth("full"),
|
|
318
|
+
compact: action.getWidth("compact")
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
280
322
|
|
|
281
323
|
for (const entry of entries) {
|
|
282
|
-
if (entry.type !== "separator") continue;
|
|
324
|
+
if (entry.type !== "separator" || separatorWidths.has(entry.element)) continue;
|
|
283
325
|
|
|
284
326
|
const hidden = entry.element.hidden;
|
|
285
327
|
|
|
@@ -293,11 +335,11 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
293
335
|
let nextMenuEntries = [];
|
|
294
336
|
let visibleEntries = normalizedAll;
|
|
295
337
|
|
|
296
|
-
if (totalWidth(normalizedAll, "full", false, gap) <= budget) {
|
|
338
|
+
if (actions.length <= $.get(resolvedMaxVisible) && totalWidth(normalizedAll, "full", false, gap) <= budget) {
|
|
297
339
|
// Full is the preferred stable state.
|
|
298
|
-
} else if (canCompact && totalWidth(normalizedAll, "compact", false, gap) <= budget) {
|
|
340
|
+
} else if (canCompact && actions.length <= $.get(resolvedMaxVisible) && totalWidth(normalizedAll, "compact", false, gap) <= budget) {
|
|
299
341
|
nextModes = Object.fromEntries(actions.map((action) => [action.id, "compact"]));
|
|
300
|
-
} else if (
|
|
342
|
+
} else if ($.get(resolvedOverflow) === "all") {
|
|
301
343
|
nextModes = Object.fromEntries(actions.map((action) => [action.id, "hidden"]));
|
|
302
344
|
visibleEntries = [];
|
|
303
345
|
nextMenuEntries = normalizedAll;
|
|
@@ -309,7 +351,7 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
309
351
|
for (const candidate of candidates) {
|
|
310
352
|
const normalizedVisible = normalizeEntries(entries, visibleIds);
|
|
311
353
|
|
|
312
|
-
if (totalWidth(normalizedVisible, baseMode, true, gap) <= budget) break;
|
|
354
|
+
if (visibleIds.size <= $.get(resolvedMaxVisible) && totalWidth(normalizedVisible, baseMode, true, gap) <= budget) break;
|
|
313
355
|
|
|
314
356
|
visibleIds.delete(candidate.id);
|
|
315
357
|
}
|
|
@@ -397,16 +439,27 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
397
439
|
requestLayout();
|
|
398
440
|
}
|
|
399
441
|
|
|
442
|
+
function handleViewportResize() {
|
|
443
|
+
// 窗口缩放时在下一次绘制前同步求解,观察器随后交付同一宽度也不会重新测量。
|
|
444
|
+
updateLayout();
|
|
445
|
+
}
|
|
446
|
+
|
|
400
447
|
onMount(() => {
|
|
401
448
|
isMounted = true;
|
|
402
449
|
|
|
403
450
|
if ($.get(rootElement)) movement = createOverflowActionsMotion($.get(rootElement));
|
|
404
451
|
|
|
452
|
+
window.addEventListener('resize', handleViewportResize);
|
|
453
|
+
document.fonts?.addEventListener('loadingdone', requestLayout);
|
|
405
454
|
requestLayout();
|
|
406
455
|
});
|
|
407
456
|
|
|
408
457
|
onDestroy(() => {
|
|
409
458
|
isMounted = false;
|
|
459
|
+
|
|
460
|
+
if (typeof window !== 'undefined') window.removeEventListener('resize', handleViewportResize);
|
|
461
|
+
if (typeof document !== 'undefined') document.fonts?.removeEventListener('loadingdone', requestLayout);
|
|
462
|
+
|
|
410
463
|
movement?.destroy();
|
|
411
464
|
exit.destroy();
|
|
412
465
|
|
|
@@ -416,17 +469,22 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
416
469
|
$.user_effect(() => {
|
|
417
470
|
const node = $.get(rootElement);
|
|
418
471
|
|
|
419
|
-
if (
|
|
472
|
+
if ($.get(resolvedAvailableWidth) !== undefined || !node) return;
|
|
420
473
|
|
|
421
474
|
return resizeManager.watch(node, () => {
|
|
422
|
-
|
|
475
|
+
// 观察器已在动画帧交付,直接求解,避免额外一帧的旧位置与新位置叠画。
|
|
476
|
+
if (layoutFrame) cancelAnimationFrame(layoutFrame);
|
|
477
|
+
|
|
478
|
+
layoutFrame = 0;
|
|
479
|
+
updateLayout();
|
|
423
480
|
});
|
|
424
481
|
});
|
|
425
482
|
|
|
426
483
|
$.user_effect(() => {
|
|
427
|
-
availableWidth();
|
|
428
484
|
compact();
|
|
429
485
|
overflow();
|
|
486
|
+
$.get(resolvedMaxVisible);
|
|
487
|
+
$.get(resolvedOverflow);
|
|
430
488
|
overflowFrom();
|
|
431
489
|
items();
|
|
432
490
|
buttonProps();
|
|
@@ -435,6 +493,13 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
435
493
|
requestLayout();
|
|
436
494
|
});
|
|
437
495
|
|
|
496
|
+
$.user_effect(() => {
|
|
497
|
+
$.get(resolvedAvailableWidth);
|
|
498
|
+
|
|
499
|
+
// 外部列宽也可能逐帧变化;只更新预算,不使固有宽度缓存失效。
|
|
500
|
+
if (isMounted) void flushLayout();
|
|
501
|
+
});
|
|
502
|
+
|
|
438
503
|
{
|
|
439
504
|
let $0 = $.derived(() => `snowui-overflow-actions${userClass() ? ` ${userClass()}` : ""}`);
|
|
440
505
|
let $1 = $.derived(() => $.get(hasOverflow) || undefined);
|
|
@@ -495,7 +560,10 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
495
560
|
};
|
|
496
561
|
|
|
497
562
|
var alternate = ($$anchor) => {
|
|
498
|
-
OverflowAction($$anchor, {
|
|
563
|
+
OverflowAction($$anchor, $.spread_props(() => $.get(item).buttonProps, {
|
|
564
|
+
get parts() {
|
|
565
|
+
return $.get(item).parts;
|
|
566
|
+
},
|
|
499
567
|
as: 'item',
|
|
500
568
|
get id() {
|
|
501
569
|
return $.get(item).id;
|
|
@@ -517,10 +585,18 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
517
585
|
return $.get(item).href;
|
|
518
586
|
},
|
|
519
587
|
|
|
588
|
+
get target() {
|
|
589
|
+
return $.get(item).target;
|
|
590
|
+
},
|
|
591
|
+
|
|
592
|
+
get rel() {
|
|
593
|
+
return $.get(item).rel;
|
|
594
|
+
},
|
|
595
|
+
|
|
520
596
|
get onclick() {
|
|
521
597
|
return $.get(item).onAction;
|
|
522
598
|
}
|
|
523
|
-
});
|
|
599
|
+
}));
|
|
524
600
|
};
|
|
525
601
|
|
|
526
602
|
$.if(node_6, ($$render) => {
|
|
@@ -558,11 +634,11 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
558
634
|
showIndicator: false,
|
|
559
635
|
selectionMode: 'action',
|
|
560
636
|
get ariaLabel() {
|
|
561
|
-
return
|
|
637
|
+
return $.get(resolvedMoreLabel);
|
|
562
638
|
},
|
|
563
639
|
|
|
564
640
|
get title() {
|
|
565
|
-
return
|
|
641
|
+
return $.get(resolvedMoreLabel);
|
|
566
642
|
},
|
|
567
643
|
|
|
568
644
|
get disabled() {
|
|
@@ -669,7 +745,7 @@ export default function OverflowActions($$anchor, $$props) {
|
|
|
669
745
|
showIndicator: false,
|
|
670
746
|
selectionMode: 'action',
|
|
671
747
|
get ariaLabel() {
|
|
672
|
-
return
|
|
748
|
+
return $.get(resolvedMoreLabel);
|
|
673
749
|
},
|
|
674
750
|
tabindex: -1,
|
|
675
751
|
get parts() {
|