@snowui-design-system/components 0.3.0-alpha.0 → 0.3.0-alpha.11
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 +52 -11
- package/THIRD_PARTY_NOTICES.md +41 -0
- package/component-catalog.json +532 -106
- package/dist/client/blocks/Sidebar.js +185 -143
- package/dist/client/blocks/SidebarItem.js +29 -15
- package/dist/client/blocks/SidebarSection.js +13 -5
- package/dist/client/blocks/index.js +2 -0
- package/dist/client/compat.d.ts +1 -1
- package/dist/client/compat.js +3 -1
- 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/BlurText.js +2 -2
- 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 +11 -5
- 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/FlowText.js +2 -2
- package/dist/client/components/Frame.d.ts +9 -0
- package/dist/client/components/Frame.js +106 -40
- package/dist/client/components/GaugeChart.js +10 -3
- package/dist/client/components/GradientMotion.d.ts +1 -1
- package/dist/client/components/GradientMotion.js +2 -2
- 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/NumberFlow.js +4 -4
- package/dist/client/components/NumericText.js +2 -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 +6 -3
- 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 +84 -57
- package/dist/client/components/Slider.d.ts +1 -1
- package/dist/client/components/Slider.js +36 -13
- package/dist/client/components/SlotText.js +2 -2
- 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 +52 -38
- 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 -2
- package/dist/client/index.js +8 -6
- 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 +22 -10
- 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 +3 -1
- 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/resizable.d.ts +1 -1
- 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-motion.d.ts +15 -23
- package/dist/client/logic/frame-motion.js +196 -30
- 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-state.d.ts +2 -14
- package/dist/client/logic/frame-state.js +60 -9
- 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.d.ts +3 -3
- package/dist/client/motion/number.js +5 -3
- 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 +28 -20
- package/dist/client/styles/index.css +2 -0
- package/dist/client/styles/layout.css +33 -7
- 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 +47 -27
- package/dist/server/blocks/SidebarItem.js +7 -5
- package/dist/server/blocks/SidebarSection.js +13 -5
- package/dist/server/blocks/index.js +2 -0
- package/dist/server/compat.d.ts +1 -1
- package/dist/server/compat.js +3 -1
- 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/BlurText.js +2 -2
- 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 +11 -5
- 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/FlowText.js +2 -2
- package/dist/server/components/Frame.d.ts +9 -0
- package/dist/server/components/Frame.js +71 -34
- package/dist/server/components/GaugeChart.js +6 -3
- package/dist/server/components/GradientMotion.d.ts +1 -1
- package/dist/server/components/GradientMotion.js +2 -2
- 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/NumberFlow.js +4 -4
- package/dist/server/components/NumericText.js +2 -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 +6 -3
- 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 +36 -15
- package/dist/server/components/Slider.d.ts +1 -1
- package/dist/server/components/Slider.js +34 -11
- package/dist/server/components/SlotText.js +2 -2
- 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 +18 -3
- 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 -2
- package/dist/server/index.js +8 -6
- 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 +16 -8
- 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 +3 -1
- 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/resizable.d.ts +1 -1
- 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-motion.d.ts +15 -23
- package/dist/server/logic/frame-motion.js +75 -29
- 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-state.d.ts +2 -14
- package/dist/server/logic/frame-state.js +60 -9
- 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.d.ts +3 -3
- package/dist/server/motion/number.js +5 -3
- 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 +28 -20
- package/dist/server/styles/index.css +2 -0
- package/dist/server/styles/layout.css +33 -7
- 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 +16 -7
- package/dist/client/components/FramePro.d.ts +0 -23
- package/dist/client/components/FramePro.js +0 -412
- package/dist/client/logic/frame-pro-motion.d.ts +0 -26
- package/dist/client/logic/frame-pro-motion.js +0 -310
- package/dist/client/logic/frame-pro-state.d.ts +0 -39
- package/dist/client/logic/frame-pro-state.js +0 -538
- package/dist/server/components/FramePro.d.ts +0 -23
- package/dist/server/components/FramePro.js +0 -301
- package/dist/server/logic/frame-pro-motion.d.ts +0 -26
- package/dist/server/logic/frame-pro-motion.js +0 -176
- package/dist/server/logic/frame-pro-state.d.ts +0 -39
- package/dist/server/logic/frame-pro-state.js +0 -445
|
@@ -1,63 +1,216 @@
|
|
|
1
1
|
/* frame-motion.svelte.js generated by Svelte v5.56.4 */
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
|
+
import { hasMotionConfig } from "./frame-utils.js";
|
|
3
4
|
import { captureFlipRect, beginFlipEnter, applyFlipExit } from "./layout-flip.js";
|
|
4
5
|
|
|
5
6
|
export class FrameMotion {
|
|
6
7
|
#props;
|
|
8
|
+
#motion;
|
|
7
9
|
#state;
|
|
10
|
+
#responsive;
|
|
8
11
|
#getId;
|
|
9
12
|
#getElement;
|
|
10
13
|
|
|
11
|
-
constructor(props, state, getId, getElement) {
|
|
14
|
+
constructor(props, motion, state, responsive, getId, getElement) {
|
|
12
15
|
this.#props = props;
|
|
16
|
+
this.#motion = motion;
|
|
13
17
|
this.#state = state;
|
|
18
|
+
this.#responsive = responsive;
|
|
14
19
|
this.#getId = getId;
|
|
15
20
|
this.#getElement = getElement;
|
|
16
21
|
|
|
17
|
-
//
|
|
18
|
-
// OSS 不向编排器 notify,断点动效由 frame-motion-defaults 写入 CSS bridge 完成)
|
|
19
|
-
// === 独立 FLIP 进场 ===
|
|
20
|
-
// layoutId/itemId 存在时尝试从模块注册表(layout-flip.ts)读取起点并播放进场动效。
|
|
21
|
-
// 与 PRO 不同:OSS 不向 Motion 编排器注册,所以这是唯一的 FLIP 进场路径。
|
|
22
|
+
// 注册到编排器,并触发独立 FLIP 进场(无需 Motion 上下文)
|
|
22
23
|
$.user_effect(() => {
|
|
24
|
+
const id = this.#getId();
|
|
23
25
|
const element = this.#getElement();
|
|
26
|
+
|
|
27
|
+
// 独立 FLIP 进场:layoutId/itemId 存在时尝试从模块注册表读取起点
|
|
24
28
|
const flipId = this.#props.itemId ?? this.#props.layoutId;
|
|
25
29
|
|
|
26
30
|
if (flipId && element) {
|
|
27
31
|
beginFlipEnter(flipId, element);
|
|
28
32
|
}
|
|
33
|
+
|
|
34
|
+
if (!this.#motion || !this.shouldRegister || !element || !id) return;
|
|
35
|
+
|
|
36
|
+
return this.#motion.register({
|
|
37
|
+
id,
|
|
38
|
+
element,
|
|
39
|
+
timeline: this.#props.timeline,
|
|
40
|
+
scroll: this.#props.scroll,
|
|
41
|
+
layoutId: this.#props.itemId ?? this.#props.layoutId,
|
|
42
|
+
scope: this.#props.scope
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// === 状态变化 -> 动效通知 (合并优化) ===
|
|
47
|
+
// 使用单一 effect 替代多个独立 effect,减少响应式订阅开销
|
|
48
|
+
// 缓存上一次的触发器状态,用于差量更新
|
|
49
|
+
let prevTriggerStates = {};
|
|
50
|
+
|
|
51
|
+
$.user_effect(() => {
|
|
52
|
+
if (!this.#motion) return;
|
|
53
|
+
|
|
54
|
+
// 收集所有触发器状态
|
|
55
|
+
const currentStates = {
|
|
56
|
+
whileHover: this.#state.hovered,
|
|
57
|
+
whileClick: this.#state.pressed,
|
|
58
|
+
whileFocus: this.#state.focused,
|
|
59
|
+
whileDrag: this.#state.isDragging,
|
|
60
|
+
whileScroll: this.#state.isScrolling,
|
|
61
|
+
whileKey: this.#state.isKeyActive,
|
|
62
|
+
whileLoad: this.#state.currentState === "StartLoad" || this.#state.currentState === "Load" || !!this.#props.loading,
|
|
63
|
+
whileReload: this.#state.currentState === "Reload" || !!this.#props.whileReload,
|
|
64
|
+
whileActive: this.#state.currentState === "Active" || !!this.#props.whileActive,
|
|
65
|
+
whileDisabled: this.#state.currentState === "Disabled" || !!this.#props.whileDisabled,
|
|
66
|
+
whileValidating: this.#state.currentState === "Validating" || !!this.#props.whileValidating,
|
|
67
|
+
whileUploading: this.#state.currentState === "Uploading" || !!this.#props.whileUploading,
|
|
68
|
+
whileEditing: this.#state.currentState === "Editing" || !!this.#props.whileEditing,
|
|
69
|
+
whileCollapsed: !!this.#props.collapsed,
|
|
70
|
+
whileExpanded: !!this.#props.expanded,
|
|
71
|
+
whileIdle: !this.#state.isAnyTriggerActive
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// 仅通知发生变化的触发器
|
|
75
|
+
for (const [event, active] of Object.entries(currentStates)) {
|
|
76
|
+
if (prevTriggerStates[event] !== active) {
|
|
77
|
+
this.#notify(event, { active });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
prevTriggerStates = currentStates;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// 生命周期通知 (单独保留,因为需要 cleanup)
|
|
85
|
+
$.user_effect(() => {
|
|
86
|
+
this.#notify("whileAppear", { active: true });
|
|
87
|
+
|
|
88
|
+
// === 编排触发逻辑 ===
|
|
89
|
+
// 根据 orchestrateTrigger 决定何时触发编排
|
|
90
|
+
const trigger = this.#props.orchestrateTrigger ?? "appear";
|
|
91
|
+
|
|
92
|
+
if (this.#props.orchestrate && trigger === "appear") {
|
|
93
|
+
const id = this.#getId();
|
|
94
|
+
|
|
95
|
+
if (id && this.#motion) {
|
|
96
|
+
// 使用微任务或下一帧确保子组件已挂载并注册
|
|
97
|
+
requestAnimationFrame(() => {
|
|
98
|
+
this.#motion?.Play(id);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return () => this.#notify("whileDisappear", { active: true });
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// === orchestrateTrigger: hover ===
|
|
107
|
+
$.user_effect(() => {
|
|
108
|
+
const trigger = this.#props.orchestrateTrigger;
|
|
109
|
+
|
|
110
|
+
if (this.#props.orchestrate && trigger === "hover" && this.#state.hovered) {
|
|
111
|
+
const id = this.#getId();
|
|
112
|
+
|
|
113
|
+
if (id && this.#motion) {
|
|
114
|
+
this.#motion.Play(id);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// === orchestrateTrigger: click ===
|
|
120
|
+
$.user_effect(() => {
|
|
121
|
+
const trigger = this.#props.orchestrateTrigger;
|
|
122
|
+
|
|
123
|
+
if (this.#props.orchestrate && trigger === "click" && this.#state.pressed) {
|
|
124
|
+
const id = this.#getId();
|
|
125
|
+
|
|
126
|
+
if (id && this.#motion) {
|
|
127
|
+
this.#motion.Play(id);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// === orchestrateTrigger: scroll ===
|
|
133
|
+
$.user_effect(() => {
|
|
134
|
+
const trigger = this.#props.orchestrateTrigger;
|
|
135
|
+
|
|
136
|
+
if (this.#props.orchestrate && trigger === "scroll" && this.#state.isScrolling) {
|
|
137
|
+
const id = this.#getId();
|
|
138
|
+
|
|
139
|
+
if (id && this.#motion) {
|
|
140
|
+
this.#motion.Play(id);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
29
143
|
});
|
|
30
144
|
|
|
31
|
-
//
|
|
145
|
+
// 响应式断点通知
|
|
146
|
+
let prevBreakpoint;
|
|
147
|
+
|
|
148
|
+
$.user_effect(() => {
|
|
149
|
+
if (!this.#motion || !this.#responsive) return;
|
|
150
|
+
|
|
151
|
+
const breakpoint = this.#responsive.breakpoint;
|
|
152
|
+
|
|
153
|
+
if (!breakpoint || breakpoint === prevBreakpoint) return;
|
|
154
|
+
|
|
155
|
+
const eventMap = {
|
|
156
|
+
xs: "whileXs",
|
|
157
|
+
sm: "whileSm",
|
|
158
|
+
md: "whileMd",
|
|
159
|
+
lg: "whileLg",
|
|
160
|
+
xl: "whileXl",
|
|
161
|
+
"2xl": "while2xl"
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const eventName = eventMap[breakpoint];
|
|
165
|
+
|
|
166
|
+
if (eventName) this.#notify(eventName, { active: true });
|
|
167
|
+
|
|
168
|
+
prevBreakpoint = breakpoint;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Setup whileScroll trigger
|
|
32
172
|
$.user_effect(() => {
|
|
33
173
|
if (this.#props.whileScroll) {
|
|
34
174
|
return this.#setupWhileScroll();
|
|
35
175
|
}
|
|
36
176
|
});
|
|
37
|
-
|
|
38
|
-
// 注:OSS 不实现 PRO 的以下能力
|
|
39
|
-
// - 注册到 Motion 编排器(PRO line 49-58)
|
|
40
|
-
// - 状态→Motion notify 差量更新(PRO line 67-111)
|
|
41
|
-
// - 生命周期 whileAppear/whileDisappear notify(PRO line 114-132)
|
|
42
|
-
// - orchestrateTrigger: appear/hover/click/scroll(PRO line 121-165)
|
|
43
|
-
// - 响应式断点 whileXs/Sm/Md/Lg/Xl/2xl notify(PRO line 168-185)
|
|
44
|
-
//
|
|
45
|
-
// 在 OSS 中:
|
|
46
|
-
// - 状态驱动的视觉变化(hover/focus/active 等)通过 frame-inline-style 注入的 CSS bridge
|
|
47
|
-
// 变量配合组件 CSS 的 transition 实现,由浏览器原生执行
|
|
48
|
-
// - whileAppear 生命周期进入组合动效通过 frame-motion-defaults 写入 CSS 变量后
|
|
49
|
-
// 组件 CSS / Frame 默认 CSS 完成
|
|
50
|
-
// - 跨组件编排(orchestrate*)属 PRO,OSS 静默忽略相关 props
|
|
51
177
|
}
|
|
52
178
|
|
|
53
|
-
/** OSS 不需要 shouldRegister 概念,但保留 getter 以兼容旧调用方(始终返回 false) */
|
|
54
179
|
get shouldRegister() {
|
|
55
|
-
|
|
180
|
+
const id = this.#getId();
|
|
181
|
+
|
|
182
|
+
return !!id || hasMotionConfig(this.#props);
|
|
56
183
|
}
|
|
57
184
|
|
|
58
185
|
get controller() {
|
|
59
186
|
return {
|
|
60
|
-
|
|
187
|
+
play: (options) => {
|
|
188
|
+
const id = this.#getId();
|
|
189
|
+
|
|
190
|
+
if (id && this.#motion) this.#motion.Play(id, options);
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
captureLayout: (layoutId) => {
|
|
194
|
+
const id = layoutId ?? this.#props.itemId ?? this.#props.layoutId ?? this.#getId();
|
|
195
|
+
const element = this.#getElement();
|
|
196
|
+
|
|
197
|
+
if (id && element && this.#motion) {
|
|
198
|
+
this.#motion.captureLayout(id, element);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
playLayoutTo: (target, options) => {
|
|
203
|
+
const id = options?.layoutId ?? this.#props.itemId ?? this.#props.layoutId ?? this.#getId();
|
|
204
|
+
const element = this.#getElement();
|
|
205
|
+
|
|
206
|
+
if (id && element && this.#motion) {
|
|
207
|
+
this.#motion.playLayoutTo(id, element, target, options);
|
|
208
|
+
} else {
|
|
209
|
+
options?.onComplete?.();
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
/** 捕获当前 Frame 位置写入模块级 FLIP 注册表,无需 initMotion 上下文。 */
|
|
61
214
|
captureFlip: (layoutId) => {
|
|
62
215
|
const id = layoutId ?? this.#props.itemId ?? this.#props.layoutId ?? this.#getId();
|
|
63
216
|
const element = this.#getElement();
|
|
@@ -65,7 +218,7 @@ export class FrameMotion {
|
|
|
65
218
|
if (id && element) captureFlipRect(id, element);
|
|
66
219
|
},
|
|
67
220
|
|
|
68
|
-
/** 将当前 Frame 以 FLIP 方式过渡到目标位置,无需
|
|
221
|
+
/** 将当前 Frame 以 FLIP 方式过渡到目标位置,无需 initMotion 上下文。 */
|
|
69
222
|
playFlipTo: (target, options) => {
|
|
70
223
|
const element = this.#getElement();
|
|
71
224
|
|
|
@@ -74,15 +227,28 @@ export class FrameMotion {
|
|
|
74
227
|
} else {
|
|
75
228
|
options?.onComplete?.();
|
|
76
229
|
}
|
|
77
|
-
}
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
reset: () => {
|
|
233
|
+
const id = this.#getId();
|
|
234
|
+
|
|
235
|
+
if (id && this.#motion) this.#motion.Reset(id);
|
|
236
|
+
},
|
|
78
237
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// 如需以上能力请使用 FramePro。
|
|
238
|
+
pause: () => {
|
|
239
|
+
// TODO
|
|
240
|
+
}
|
|
83
241
|
};
|
|
84
242
|
}
|
|
85
243
|
|
|
244
|
+
#notify(event, detail) {
|
|
245
|
+
const id = this.#getId();
|
|
246
|
+
|
|
247
|
+
if (!this.#motion || !this.shouldRegister || !id) return;
|
|
248
|
+
|
|
249
|
+
this.#motion.notify(id, event, detail);
|
|
250
|
+
}
|
|
251
|
+
|
|
86
252
|
#setupWhileScroll() {
|
|
87
253
|
const element = this.#getElement();
|
|
88
254
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* - 过滤内部关键字,避免透传到 DOM
|
|
5
5
|
* - 为 Input / Textarea 这类“Frame 外壳 + 原生宿主元素”组件提供共享的 props 分发能力
|
|
6
6
|
*/
|
|
7
|
-
export declare const FRAME_INTERNAL_PROP_KEYS: readonly ["enableResponsive", "enableContext", "enableScaleObserver", "enableDefaultMotion", "enableAutoLayout", "componentParts", "contentFill", "contentHug", "pinOffset", "pinOffsetX", "pinOffsetY", "scope", "lines", "onTruncate", "access", "responsive", "scaleHeightVar", "scaleWidthVar", "scaleAspectRatioVar", "scaleSizeVar", "scaleObserverTarget", "scaleBasis", "scaleMixHeightWeight", "scaleAspectBaseRatio", "sizeRatio", "iconSizeRatio", "avatarSizeRatio", "loopMotion", "loading", "disabled", "skeleton", "renderHints", "customStates", "stateContent", "styles", "padding", "gap", "radius", "border", "innerBorder", "fontSize", "minWidth", "minHeight", "width", "height", "opacity", "size", "iconSize", "avatarSize", "collapsed", "expanded", "row", "firstLine", "column", "grid", "reverse", "whileHover", "whileClick", "whileFocus", "whileDrag", "whileScroll", "whileKey", "whileLoad", "whileReload", "whileActive", "whileDisabled", "whileAppear", "whileDisappear", "whileIdle", "whileValidating", "whileUploading", "whileEditing", "whileCollapsed", "whileExpanded", "whileXs", "whileSm", "whileMd", "whileLg", "whileXl", "while2xl", "variants", "scroll", "timeline", "layoutId", "itemId", "orchestrate", "orchestrateMode", "orchestrateDelay", "orchestrateOrder", "orchestrateTrigger", "orchestrateTarget", "orchestrateGroup", "morph", "tag", "as", "element", "use", "currentState", "Click", "Hover", "Focus", "Key", "Drag", "Scroll", "Active", "Load", "Reload", "StartLoad", "Appear", "Disappear", "Idle", "Disabled", "Validating", "Uploading", "Editing", "onReload", "stateVars", "stateClass", "stateStyle"];
|
|
7
|
+
export declare const FRAME_INTERNAL_PROP_KEYS: readonly ["enableResponsive", "enableContext", "enableScaleObserver", "enableDefaultMotion", "enableAutoLayout", "componentParts", "contentFill", "contentHug", "pinOffset", "pinOffsetX", "pinOffsetY", "scope", "lines", "onTruncate", "access", "responsive", "scaleHeightVar", "scaleWidthVar", "scaleAspectRatioVar", "scaleSizeVar", "scaleObserverTarget", "scaleBasis", "scaleMixHeightWeight", "scaleAspectBaseRatio", "sizeRatio", "iconSizeRatio", "avatarSizeRatio", "loopMotion", "loading", "disabled", "skeleton", "renderHints", "customStates", "stateContent", "styles", "padding", "gap", "radius", "border", "innerBorder", "fontSize", "minWidth", "minHeight", "width", "height", "opacity", "size", "iconSize", "avatarSize", "collapsed", "expanded", "row", "firstLine", "singleLine", "column", "grid", "reverse", "whileHover", "whileClick", "whileFocus", "whileDrag", "whileScroll", "whileKey", "whileLoad", "whileReload", "whileActive", "whileDisabled", "whileAppear", "whileDisappear", "whileIdle", "whileValidating", "whileUploading", "whileEditing", "whileCollapsed", "whileExpanded", "whileXs", "whileSm", "whileMd", "whileLg", "whileXl", "while2xl", "variants", "scroll", "timeline", "layoutId", "itemId", "orchestrate", "orchestrateMode", "orchestrateDelay", "orchestrateOrder", "orchestrateTrigger", "orchestrateTarget", "orchestrateGroup", "morph", "tag", "as", "element", "use", "currentState", "Click", "Hover", "Focus", "Key", "Drag", "Scroll", "Active", "Load", "Reload", "StartLoad", "Appear", "Disappear", "Idle", "Disabled", "Validating", "Uploading", "Editing", "onReload", "stateVars", "stateClass", "stateStyle"];
|
|
8
8
|
export declare const FRAME_INTERNAL_PROP_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
9
9
|
export interface FrameEventHandlers {
|
|
10
10
|
[key: string]: any;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
|
|
2
|
+
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
1
3
|
/**
|
|
2
4
|
* Frame 属性过滤器
|
|
3
5
|
* - 分离原生事件处理器
|
|
@@ -81,6 +83,7 @@ export const FRAME_INTERNAL_PROP_KEYS = [
|
|
|
81
83
|
"expanded",
|
|
82
84
|
"row",
|
|
83
85
|
"firstLine",
|
|
86
|
+
"singleLine",
|
|
84
87
|
"column",
|
|
85
88
|
"grid",
|
|
86
89
|
"reverse",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
4
|
import { FRAME_BREAKPOINTS_CONTEXT_KEY } from "../keys.js";
|
|
5
|
+
import { isSingleLineLayout } from "./content-line.js";
|
|
5
6
|
import { resizeManager } from "./observer.js";
|
|
6
7
|
|
|
7
8
|
const DEFAULT_MIN_SPACING = 4;
|
|
@@ -126,7 +127,7 @@ export class FrameResponsive {
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
get fitDirection() {
|
|
129
|
-
return this.fitActive ? this.config?.direction : undefined;
|
|
130
|
+
return this.fitActive && !isSingleLineLayout(this.#getProps()) ? this.config?.direction : undefined;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
get breakpoint() {
|
|
@@ -202,7 +203,7 @@ export class FrameResponsive {
|
|
|
202
203
|
#applyFallbackAttributes(node) {
|
|
203
204
|
const config = this.config;
|
|
204
205
|
|
|
205
|
-
if (!this.fitActive || !config) {
|
|
206
|
+
if (!this.fitActive || !config || isSingleLineLayout(this.#getProps())) {
|
|
206
207
|
node.removeAttribute("data-responsive-layout");
|
|
207
208
|
node.removeAttribute("data-responsive-align");
|
|
208
209
|
node.removeAttribute("data-responsive-justify");
|
|
@@ -246,8 +247,16 @@ export class FrameResponsive {
|
|
|
246
247
|
this.#restoreSpacing(node);
|
|
247
248
|
|
|
248
249
|
const computed = getComputedStyle(node);
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
let gap = px(computed.columnGap === "normal" ? "0" : computed.columnGap);
|
|
251
|
+
|
|
252
|
+
if (isSingleLineLayout(this.#getProps()) && gap < 4) {
|
|
253
|
+
gap = 4;
|
|
254
|
+
node.style.setProperty("gap", "4px");
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const gapFloor = isSingleLineLayout(this.#getProps())
|
|
258
|
+
? Math.max(4, resolveFloor(gap, this.config?.minGap))
|
|
259
|
+
: resolveFloor(gap, this.config?.minGap);
|
|
251
260
|
|
|
252
261
|
node.style.setProperty("gap", `${gapFloor}px`);
|
|
253
262
|
|
|
@@ -272,7 +281,12 @@ export class FrameResponsive {
|
|
|
272
281
|
const isFlex = computed.display === "flex" || computed.display === "inline-flex";
|
|
273
282
|
const isRow = isFlex && (direction === "row" || direction === "row-reverse");
|
|
274
283
|
const children = Array.from(node.children).filter(isMeasurableChild);
|
|
275
|
-
|
|
284
|
+
let gap = px(computed.columnGap === "normal" ? "0" : computed.columnGap);
|
|
285
|
+
|
|
286
|
+
if (isSingleLineLayout(this.#getProps()) && gap < 4) {
|
|
287
|
+
gap = 4;
|
|
288
|
+
node.style.setProperty("gap", "4px");
|
|
289
|
+
}
|
|
276
290
|
|
|
277
291
|
const padding = {
|
|
278
292
|
top: px(computed.paddingTop),
|
|
@@ -297,7 +311,9 @@ export class FrameResponsive {
|
|
|
297
311
|
|
|
298
312
|
if (preferredWidth <= width + EPSILON) return;
|
|
299
313
|
|
|
300
|
-
const gapFloor =
|
|
314
|
+
const gapFloor = isSingleLineLayout(this.#getProps())
|
|
315
|
+
? Math.max(4, resolveFloor(gap, this.config?.minGap))
|
|
316
|
+
: resolveFloor(gap, this.config?.minGap);
|
|
301
317
|
|
|
302
318
|
const paddingFloor = {
|
|
303
319
|
top: resolvePaddingFloor(padding.top, this.config?.minPadding, "top"),
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OSS Frame 状态机(v1.0.0 起在 OSS)
|
|
3
|
-
*
|
|
4
|
-
* 与 PRO 版本(components/src/logic/frame-pro-state.svelte.ts)的差异:
|
|
5
|
-
* - 不含 §8 联动控制(linkageControl / Motion 依赖)
|
|
6
|
-
* - 构造函数不接收 motion 参数
|
|
7
|
-
* - 事件处理器中的 `if ("target" in config) { ... }` 分支被剥离
|
|
8
|
-
*
|
|
9
|
-
* 作用半径:1 个 Frame(仅修改自身 currentState 与交互状态)
|
|
10
|
-
*
|
|
11
|
-
* PRO 版本独立维护一份完整实现,FramePro 使用 PRO 版本。
|
|
12
|
-
* 详见 ../components/Frame.md §1 切割原则与 /Frame-Refactor-Plan.md §3.4。
|
|
13
|
-
*/
|
|
14
1
|
import type { FrameProps, CoreState } from "./frame-types";
|
|
2
|
+
import type { Motion } from "./motion.js";
|
|
15
3
|
export declare class FrameState {
|
|
16
4
|
#private;
|
|
17
5
|
hovered: boolean;
|
|
@@ -21,7 +9,7 @@ export declare class FrameState {
|
|
|
21
9
|
isScrolling: boolean;
|
|
22
10
|
isKeyActive: boolean;
|
|
23
11
|
currentState: CoreState;
|
|
24
|
-
constructor(props: FrameProps);
|
|
12
|
+
constructor(props: FrameProps, motion?: Motion | undefined);
|
|
25
13
|
get interactionState(): (string & {}) | "StartLoad" | "Load" | "Reload" | "Appear" | "Disappear" | "Idle" | "Active" | "Disabled" | "Validating" | "Uploading" | "Editing" | "Click" | "Hover" | "Focus" | "Drag" | "Scroll";
|
|
26
14
|
get isAnyTriggerActive(): boolean | undefined;
|
|
27
15
|
handleClick: (e: MouseEvent) => void;
|
|
@@ -4,6 +4,7 @@ import { resolveFrameWhileMotionConfig } from "./frame-motion-defaults.js";
|
|
|
4
4
|
|
|
5
5
|
export class FrameState {
|
|
6
6
|
#props;
|
|
7
|
+
#motion;
|
|
7
8
|
|
|
8
9
|
#hovered = // === 交互状态 (Internal Interaction States) ===
|
|
9
10
|
$.state(false);
|
|
@@ -76,8 +77,9 @@ export class FrameState {
|
|
|
76
77
|
$.set(this.#currentState, value, true);
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
constructor(props) {
|
|
80
|
+
constructor(props, motion = undefined) {
|
|
80
81
|
this.#props = props;
|
|
82
|
+
this.#motion = motion;
|
|
81
83
|
|
|
82
84
|
$.user_effect(() => {
|
|
83
85
|
const controlledState = this.#props.currentState;
|
|
@@ -230,7 +232,7 @@ export class FrameState {
|
|
|
230
232
|
return false;
|
|
231
233
|
}
|
|
232
234
|
|
|
233
|
-
// 这些字段属于普通 Trigger/Linkage
|
|
235
|
+
// 这些字段属于普通 Trigger/Linkage 配置,不视为“按状态映射”
|
|
234
236
|
const reservedKeys = [
|
|
235
237
|
"run",
|
|
236
238
|
"target",
|
|
@@ -289,8 +291,9 @@ export class FrameState {
|
|
|
289
291
|
this.currentState = config.next;
|
|
290
292
|
}
|
|
291
293
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
if ("target" in config) {
|
|
295
|
+
this.#handleLinkageControl(config);
|
|
296
|
+
}
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
299
|
|
|
@@ -341,7 +344,9 @@ export class FrameState {
|
|
|
341
344
|
Hover.run(e);
|
|
342
345
|
}
|
|
343
346
|
|
|
344
|
-
|
|
347
|
+
if ("target" in Hover) {
|
|
348
|
+
this.#handleLinkageControl(Hover);
|
|
349
|
+
}
|
|
345
350
|
}
|
|
346
351
|
}
|
|
347
352
|
};
|
|
@@ -400,7 +405,9 @@ export class FrameState {
|
|
|
400
405
|
Focus.run(e);
|
|
401
406
|
}
|
|
402
407
|
|
|
403
|
-
|
|
408
|
+
if ("target" in Focus) {
|
|
409
|
+
this.#handleLinkageControl(Focus);
|
|
410
|
+
}
|
|
404
411
|
}
|
|
405
412
|
}
|
|
406
413
|
};
|
|
@@ -422,9 +429,9 @@ export class FrameState {
|
|
|
422
429
|
Key.run(e);
|
|
423
430
|
} else if ("state" in Key) {
|
|
424
431
|
this.currentState = Key.state;
|
|
432
|
+
} else if ("target" in Key) {
|
|
433
|
+
this.#handleLinkageControl(Key);
|
|
425
434
|
}
|
|
426
|
-
|
|
427
|
-
// OSS 忽略 target/action(§8 联动控制属 PRO)
|
|
428
435
|
}
|
|
429
436
|
};
|
|
430
437
|
|
|
@@ -467,7 +474,9 @@ export class FrameState {
|
|
|
467
474
|
Drag.run(e);
|
|
468
475
|
}
|
|
469
476
|
|
|
470
|
-
|
|
477
|
+
if ("target" in Drag) {
|
|
478
|
+
this.#handleLinkageControl(Drag);
|
|
479
|
+
}
|
|
471
480
|
}
|
|
472
481
|
}
|
|
473
482
|
};
|
|
@@ -484,4 +493,46 @@ export class FrameState {
|
|
|
484
493
|
handleScroll = (_e) => {
|
|
485
494
|
// Reserved
|
|
486
495
|
};
|
|
496
|
+
|
|
497
|
+
#handleLinkageControl(config) {
|
|
498
|
+
if (config.target) {
|
|
499
|
+
// 1. Resolve Target Controller
|
|
500
|
+
let controller;
|
|
501
|
+
|
|
502
|
+
if (typeof config.target === 'string') {
|
|
503
|
+
// String ID -> Use internal motion instance
|
|
504
|
+
// No controller object for string IDs, handled in step 2 directly via this.#motion
|
|
505
|
+
} else if (typeof config.target === 'object') {
|
|
506
|
+
// Object Ref -> Try to get controller
|
|
507
|
+
// Case A: Svelte 5 bind:this instance with exported getController
|
|
508
|
+
if ('getController' in config.target && typeof config.target.getController === 'function') {
|
|
509
|
+
controller = config.target.getController();
|
|
510
|
+
} else // Case B: Maybe it IS the controller?
|
|
511
|
+
{
|
|
512
|
+
controller = config.target;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// 2. Execute Action
|
|
517
|
+
if (typeof config.target === 'string' && this.#motion) {
|
|
518
|
+
// Legacy String ID Logic
|
|
519
|
+
if (config.action === "play") {
|
|
520
|
+
this.#motion.Play(config.target, { reverse: config.reverse });
|
|
521
|
+
} else if (config.action === "reset") {
|
|
522
|
+
this.#motion.Reset(config.target);
|
|
523
|
+
} else if (config.action === "pause") {
|
|
524
|
+
this.#motion.pause(config.target);
|
|
525
|
+
}
|
|
526
|
+
} else if (controller) {
|
|
527
|
+
// Object Controller Logic
|
|
528
|
+
if (config.action === "play" && controller.play) {
|
|
529
|
+
controller.play({ reverse: config.reverse });
|
|
530
|
+
} else if (config.action === "reset" && controller.reset) {
|
|
531
|
+
controller.reset();
|
|
532
|
+
} else if (config.action === "pause" && controller.pause) {
|
|
533
|
+
controller.pause();
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
487
538
|
}
|
|
@@ -330,6 +330,8 @@ export interface FrameProps {
|
|
|
330
330
|
row?: boolean;
|
|
331
331
|
/** Row 附件与正文首行行框居中;正文继承宿主行高,默认关闭。 */
|
|
332
332
|
firstLine?: boolean;
|
|
333
|
+
/** 单行图文组合:横排、附件Hug、有效gap至少4 CSS px;文字截断仍归Text。 */
|
|
334
|
+
singleLine?: boolean;
|
|
333
335
|
column?: boolean;
|
|
334
336
|
grid?: boolean;
|
|
335
337
|
reverse?: boolean;
|
|
@@ -7,10 +7,11 @@ export interface OverflowActionRegistration {
|
|
|
7
7
|
icon?: OverflowActionIcon;
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
href?: string;
|
|
10
|
+
target?: string;
|
|
11
|
+
rel?: string;
|
|
10
12
|
execute: (event?: MouseEvent) => void;
|
|
11
13
|
getElement: () => HTMLElement | undefined;
|
|
12
|
-
|
|
13
|
-
getCompactMeasureElement: () => HTMLElement | undefined;
|
|
14
|
+
getWidth: (mode: "full" | "compact") => number;
|
|
14
15
|
}
|
|
15
16
|
export interface OverflowActionsContext {
|
|
16
17
|
register: (action: OverflowActionRegistration) => () => void;
|
|
@@ -21,4 +22,12 @@ export interface OverflowActionsContext {
|
|
|
21
22
|
buttonProps?: Record<string, any>;
|
|
22
23
|
}
|
|
23
24
|
export declare const OVERFLOW_ACTIONS_CONTEXT_KEY: unique symbol;
|
|
25
|
+
/** 宿主只提供布局约束,不接管显式子项的按钮视觉。 */
|
|
26
|
+
export interface OverflowActionsLayoutContext {
|
|
27
|
+
readonly availableWidth: number | undefined;
|
|
28
|
+
readonly maxVisible: number | undefined;
|
|
29
|
+
readonly overflow: "all" | "progressive" | undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare const OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY: unique symbol;
|
|
32
|
+
export declare function getOverflowActionsLayoutContext(): OverflowActionsLayoutContext | undefined;
|
|
24
33
|
export declare function getOverflowActionsContext(): OverflowActionsContext | undefined;
|
|
@@ -3,6 +3,11 @@ import * as $ from 'svelte/internal/client';
|
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
4
|
|
|
5
5
|
export const OVERFLOW_ACTIONS_CONTEXT_KEY = Symbol("snowui-overflow-actions");
|
|
6
|
+
export const OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY = Symbol("snowui-overflow-actions-layout");
|
|
7
|
+
|
|
8
|
+
export function getOverflowActionsLayoutContext() {
|
|
9
|
+
return getContext(OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY);
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
export function getOverflowActionsContext() {
|
|
8
13
|
return getContext(OVERFLOW_ACTIONS_CONTEXT_KEY);
|
|
@@ -53,8 +53,9 @@ export function toast(input) {
|
|
|
53
53
|
...opts
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
//
|
|
57
|
-
|
|
56
|
+
// 替换队列数组,确保退出标记更新后,后续入队仍使宿主分组重新求值。
|
|
57
|
+
// 最新条目位于数组尾部;Toaster 渲染时将其展示在前。
|
|
58
|
+
toastStore.items = [...toastStore.items, item];
|
|
58
59
|
|
|
59
60
|
return id;
|
|
60
61
|
}
|
|
@@ -93,8 +94,9 @@ export function dismissToast(id, exitFromIndex) {
|
|
|
93
94
|
|
|
94
95
|
if (removeIdx === -1) return;
|
|
95
96
|
|
|
96
|
-
const removed = toastStore.items
|
|
97
|
+
const removed = toastStore.items[removeIdx];
|
|
97
98
|
|
|
99
|
+
toastStore.items = toastStore.items.filter((candidate) => candidate.id !== id);
|
|
98
100
|
removed?.onDismiss?.();
|
|
99
101
|
},
|
|
100
102
|
TOAST_EXIT_DURATION
|
|
@@ -126,8 +128,9 @@ export function pushOutToast(id, exitFromIndex) {
|
|
|
126
128
|
|
|
127
129
|
if (removeIdx === -1) return;
|
|
128
130
|
|
|
129
|
-
const removed = toastStore.items
|
|
131
|
+
const removed = toastStore.items[removeIdx];
|
|
130
132
|
|
|
133
|
+
toastStore.items = toastStore.items.filter((candidate) => candidate.id !== id);
|
|
131
134
|
removed?.onDismiss?.();
|
|
132
135
|
},
|
|
133
136
|
TOAST_EXIT_DURATION
|