@quan-erp/shared-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -0
- package/dist/common/common.d.ts +2 -0
- package/dist/components/blocks/editor-00/editor.d.ts +8 -0
- package/dist/components/blocks/editor-00/nodes.d.ts +3 -0
- package/dist/components/blocks/editor-00/plugins.d.ts +2 -0
- package/dist/components/custom/confirm-dialog.d.ts +15 -0
- package/dist/components/custom/dashboard.d.ts +22 -0
- package/dist/components/custom/data-table/cursor-based-pagination.d.ts +9 -0
- package/dist/components/custom/data-table/data-table-bulk-action-menu.d.ts +9 -0
- package/dist/components/custom/data-table/data-table-bulk-export.d.ts +8 -0
- package/dist/components/custom/data-table/data-table-column-header.d.ts +9 -0
- package/dist/components/custom/data-table/data-table-grid.d.ts +21 -0
- package/dist/components/custom/data-table/data-table-group-by.types.d.ts +11 -0
- package/dist/components/custom/data-table/data-table-helper.d.ts +2 -0
- package/dist/components/custom/data-table/data-table-list-view.d.ts +13 -0
- package/dist/components/custom/data-table/data-table-page-size.d.ts +11 -0
- package/dist/components/custom/data-table/data-table-pagination.d.ts +9 -0
- package/dist/components/custom/data-table/data-table-toolbar.d.ts +26 -0
- package/dist/components/custom/data-table/data-table-util.d.ts +7 -0
- package/dist/components/custom/data-table/data-table-view-fallback.d.ts +2 -0
- package/dist/components/custom/data-table/data-table-view-options.d.ts +17 -0
- package/dist/components/custom/data-table/data-table-view-preferences.d.ts +22 -0
- package/dist/components/custom/data-table/data-table-view-preferences.storage.d.ts +15 -0
- package/dist/components/custom/data-table/data-table-wrapper.d.ts +51 -0
- package/dist/components/custom/data-table/data-table.d.ts +47 -0
- package/dist/components/custom/data-table/export.d.ts +22 -0
- package/dist/components/custom/data-table/group-table-rows.d.ts +3 -0
- package/dist/components/custom/data-table/types.d.ts +17 -0
- package/dist/components/custom/data-table/use-data-table-page-size.d.ts +41 -0
- package/dist/components/custom/document-title.d.ts +4 -0
- package/dist/components/custom/empty-screen.d.ts +8 -0
- package/dist/components/custom/error-screen.d.ts +9 -0
- package/dist/components/custom/floating-action-btn.d.ts +39 -0
- package/dist/components/custom/index.d.ts +20 -0
- package/dist/components/custom/loading-screen.d.ts +7 -0
- package/dist/components/custom/menu-tab.d.ts +17 -0
- package/dist/components/custom/page.d.ts +35 -0
- package/dist/components/custom/plugin-theme.d.ts +8 -0
- package/dist/components/custom/portal.d.ts +4 -0
- package/dist/components/custom/protected-page.d.ts +26 -0
- package/dist/components/custom/pull-to-refresh.d.ts +16 -0
- package/dist/components/custom/render-in-view.d.ts +12 -0
- package/dist/components/custom/responsive-dialog.d.ts +47 -0
- package/dist/components/custom/safearea.d.ts +5 -0
- package/dist/components/custom/scrollable.d.ts +17 -0
- package/dist/components/custom/search-and-filter-suite.d.ts +16 -0
- package/dist/components/custom/setting.d.ts +30 -0
- package/dist/components/custom/submenu-hub.d.ts +17 -0
- package/dist/components/editor/editor-ui/content-editable.d.ts +9 -0
- package/dist/components/editor/themes/editor-theme.d.ts +3 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/alert-dialog.d.ts +19 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/breadcrumb.d.ts +20 -0
- package/dist/components/ui/button-group.d.ts +12 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/calendar.d.ts +12 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/carousel.d.ts +29 -0
- package/dist/components/ui/chart.d.ts +63 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/command.d.ts +81 -0
- package/dist/components/ui/context-menu.d.ts +28 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/drawer.d.ts +23 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/field.d.ts +25 -0
- package/dist/components/ui/form.d.ts +26 -0
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/index.d.ts +54 -0
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-otp.d.ts +35 -0
- package/dist/components/ui/input.d.ts +10 -0
- package/dist/components/ui/item.d.ts +24 -0
- package/dist/components/ui/kbd.d.ts +4 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/menubar.d.ts +29 -0
- package/dist/components/ui/navigation-menu.d.ts +13 -0
- package/dist/components/ui/pagination.d.ts +28 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/progress.d.ts +5 -0
- package/dist/components/ui/radio-group.d.ts +6 -0
- package/dist/components/ui/resizable.d.ts +24 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/sheet.d.ts +16 -0
- package/dist/components/ui/sidebar.d.ts +71 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/slider.d.ts +12 -0
- package/dist/components/ui/sonner.d.ts +6 -0
- package/dist/components/ui/spinner.d.ts +9 -0
- package/dist/components/ui/switch.d.ts +11 -0
- package/dist/components/ui/table.d.ts +14 -0
- package/dist/components/ui/tabs.d.ts +16 -0
- package/dist/components/ui/textarea.d.ts +10 -0
- package/dist/components/ui/time-picker.d.ts +13 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle.d.ts +10 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/es/common/common.js +4 -0
- package/dist/es/components/blocks/editor-00/editor.js +49 -0
- package/dist/es/components/blocks/editor-00/nodes.js +6 -0
- package/dist/es/components/blocks/editor-00/plugins.js +23 -0
- package/dist/es/components/custom/confirm-dialog.js +34 -0
- package/dist/es/components/custom/dashboard.js +86 -0
- package/dist/es/components/custom/data-table/cursor-based-pagination.js +123 -0
- package/dist/es/components/custom/data-table/data-table-bulk-action-menu.js +112 -0
- package/dist/es/components/custom/data-table/data-table-bulk-export.js +76 -0
- package/dist/es/components/custom/data-table/data-table-column-header.js +102 -0
- package/dist/es/components/custom/data-table/data-table-grid.js +234 -0
- package/dist/es/components/custom/data-table/data-table-helper.js +8 -0
- package/dist/es/components/custom/data-table/data-table-list-view.js +121 -0
- package/dist/es/components/custom/data-table/data-table-page-size.js +49 -0
- package/dist/es/components/custom/data-table/data-table-pagination.js +156 -0
- package/dist/es/components/custom/data-table/data-table-toolbar.js +149 -0
- package/dist/es/components/custom/data-table/data-table-util.js +31 -0
- package/dist/es/components/custom/data-table/data-table-view-fallback.js +7 -0
- package/dist/es/components/custom/data-table/data-table-view-options.js +311 -0
- package/dist/es/components/custom/data-table/data-table-view-preferences.js +71 -0
- package/dist/es/components/custom/data-table/data-table-view-preferences.storage.js +115 -0
- package/dist/es/components/custom/data-table/data-table.js +425 -0
- package/dist/es/components/custom/data-table/group-table-rows.js +16 -0
- package/dist/es/components/custom/data-table/use-data-table-page-size.js +155 -0
- package/dist/es/components/custom/empty-screen.js +28 -0
- package/dist/es/components/custom/error-screen.js +84 -0
- package/dist/es/components/custom/floating-action-btn.js +200 -0
- package/dist/es/components/custom/loading-screen.js +26 -0
- package/dist/es/components/custom/menu-tab.js +45 -0
- package/dist/es/components/custom/page.js +105 -0
- package/dist/es/components/custom/plugin-theme.js +13 -0
- package/dist/es/components/custom/portal.js +13 -0
- package/dist/es/components/custom/protected-page.js +74 -0
- package/dist/es/components/custom/pull-to-refresh.js +378 -0
- package/dist/es/components/custom/render-in-view.js +35 -0
- package/dist/es/components/custom/responsive-dialog.js +163 -0
- package/dist/es/components/custom/safearea.js +8 -0
- package/dist/es/components/custom/scrollable.js +96 -0
- package/dist/es/components/custom/setting.js +39 -0
- package/dist/es/components/editor/editor-ui/content-editable.js +26 -0
- package/dist/es/components/editor/themes/editor-theme.js +119 -0
- package/dist/es/components/ui/accordion.js +47 -0
- package/dist/es/components/ui/alert-dialog.js +178 -0
- package/dist/es/components/ui/alert.js +51 -0
- package/dist/es/components/ui/avatar.js +42 -0
- package/dist/es/components/ui/badge.js +27 -0
- package/dist/es/components/ui/breadcrumb.js +93 -0
- package/dist/es/components/ui/button-group.js +76 -0
- package/dist/es/components/ui/button.js +57 -0
- package/dist/es/components/ui/calendar.js +402 -0
- package/dist/es/components/ui/card.js +91 -0
- package/dist/es/components/ui/carousel.js +194 -0
- package/dist/es/components/ui/chart.js +239 -0
- package/dist/es/components/ui/checkbox.js +27 -0
- package/dist/es/components/ui/collapsible.js +9 -0
- package/dist/es/components/ui/command.js +115 -0
- package/dist/es/components/ui/context-menu.js +153 -0
- package/dist/es/components/ui/dialog.js +137 -0
- package/dist/es/components/ui/drawer.js +107 -0
- package/dist/es/components/ui/dropdown-menu.js +152 -0
- package/dist/es/components/ui/field.js +226 -0
- package/dist/es/components/ui/form.js +109 -0
- package/dist/es/components/ui/hover-card.js +25 -0
- package/dist/es/components/ui/input-group.js +155 -0
- package/dist/es/components/ui/input-otp.js +49 -0
- package/dist/es/components/ui/input.js +37 -0
- package/dist/es/components/ui/item.js +188 -0
- package/dist/es/components/ui/kbd.js +31 -0
- package/dist/es/components/ui/label.js +23 -0
- package/dist/es/components/ui/menubar.js +202 -0
- package/dist/es/components/ui/navigation-menu.js +107 -0
- package/dist/es/components/ui/pagination.js +101 -0
- package/dist/es/components/ui/popover.js +27 -0
- package/dist/es/components/ui/progress.js +26 -0
- package/dist/es/components/ui/radio-group.js +35 -0
- package/dist/es/components/ui/resizable.js +38 -0
- package/dist/es/components/ui/scroll-area.js +38 -0
- package/dist/es/components/ui/select.js +124 -0
- package/dist/es/components/ui/separator.js +27 -0
- package/dist/es/components/ui/sheet.js +129 -0
- package/dist/es/components/ui/sidebar.js +604 -0
- package/dist/es/components/ui/skeleton.js +17 -0
- package/dist/es/components/ui/slider.js +62 -0
- package/dist/es/components/ui/sonner.js +26 -0
- package/dist/es/components/ui/spinner.js +34 -0
- package/dist/es/components/ui/switch.js +54 -0
- package/dist/es/components/ui/table.js +90 -0
- package/dist/es/components/ui/tabs.js +84 -0
- package/dist/es/components/ui/textarea.js +32 -0
- package/dist/es/components/ui/time-picker.js +199 -0
- package/dist/es/components/ui/toggle-group.js +43 -0
- package/dist/es/components/ui/toggle.js +44 -0
- package/dist/es/components/ui/tooltip.js +56 -0
- package/dist/es/hooks/use-debounce-value.js +16 -0
- package/dist/es/hooks/use-is-inview.js +25 -0
- package/dist/es/hooks/use-mobile-back-dialog.js +34 -0
- package/dist/es/hooks/use-mobile.js +43 -0
- package/dist/es/hooks/use-mounted.js +14 -0
- package/dist/es/hooks/use-scroll-direction.js +26 -0
- package/dist/es/hooks/use-user-hand-behavior.js +20 -0
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +487 -0
- package/dist/es/lib/utils.js +8 -0
- package/dist/es/locale/locale.js +87 -0
- package/dist/es/node_modules/@tanstack/react-table/build/lib/index.js +93 -0
- package/dist/es/node_modules/@tanstack/table-core/build/lib/index.js +2737 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +85 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +49 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +86 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.js +19 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.js +14 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/LayoutGroupContext.js +5 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/LazyContext.js +5 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/MotionConfigContext.js +9 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/MotionContext/create.js +13 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/MotionContext/index.js +5 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +15 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/PresenceContext.js +5 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.js +5 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/events/add-pointer-event.js +8 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/events/event-info.js +14 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +432 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/drag/index.js +38 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +93 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/focus.js +35 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/hover.js +31 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +215 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/pan/index.js +50 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/gestures/press.js +38 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +60 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/animation/index.js +40 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/animations.js +13 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/definitions.js +42 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/drag.js +17 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/gestures.js +21 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +111 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/layout.js +11 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/load-features.js +15 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +64 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/features/viewport/observers.js +33 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/index.js +69 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/utils/symbol.js +4 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +35 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +106 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +66 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/motion/utils/valid-prop.js +39 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/components/create-proxy.js +35 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/components/motion/feature-bundle.js +13 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/components/motion/proxy.js +7 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +13 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/dom/use-render.js +21 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.js +31 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.js +29 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.js +10 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/html/use-props.js +44 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.js +9 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.js +30 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/svg/use-props.js +24 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.js +10 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.js +8 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/utils/distance.js +10 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/utils/get-context-window.js +6 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/utils/is-browser.js +4 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/utils/is-ref-object.js +6 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/utils/use-composed-ref.js +38 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/utils/use-constant.js +11 -0
- package/dist/es/shared-ui/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.js +153 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/JSAnimation.js +294 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/NativeAnimation.js +160 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.js +51 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/animate/single-value.js +11 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/drivers/frame.js +17 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/generators/inertia.js +67 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/generators/keyframes.js +37 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/generators/spring.js +246 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/generators/utils/calc-duration.js +15 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/generators/utils/create-generator-easing.js +16 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/generators/utils/is-generator.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/generators/utils/velocity.js +9 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/interfaces/motion-value.js +69 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.js +78 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-variant.js +36 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/interfaces/visual-element.js +22 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.js +107 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.js +131 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/get-final.js +10 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/offsets/default.js +9 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/offsets/fill.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/offsets/time.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.js +8 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/utils/is-none.js +13 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.js +22 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.js +43 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/optimized-appear/data-id.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/optimized-appear/get-appear-id.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/WithPromise.js +27 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/calc-child-stagger.js +10 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/can-animate.js +31 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.js +31 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/default-transitions.js +33 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/get-value-transition.js +11 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/is-animatable.js +16 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/is-css-variable.js +20 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.js +22 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/make-animation-instant.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/replace-transition-type.js +18 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/utils/resolve-transition.js +10 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/easing/map-easing.js +21 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/easing/supported.js +15 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.js +26 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.js +36 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/utils/apply-generator.js +14 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/utils/is-browser-color.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/utils/linear.js +11 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.js +19 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/events/add-dom-event.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/frameloop/batcher.js +67 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/frameloop/frame.js +9 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/frameloop/microtask.js +5 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/frameloop/order.js +21 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/frameloop/render-step.js +64 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/frameloop/sync-time.js +21 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/drag/state/is-active.js +11 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/drag/state/set-active.js +25 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/hover.js +62 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/press/index.js +62 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js +18 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.js +32 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/press/utils/state.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/utils/is-node-or-child.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/utils/is-primary-pointer.js +10 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/gestures/utils/setup.js +15 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/animation/mix-values.js +60 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/geometry/conversion.js +26 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/geometry/copy.js +19 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/geometry/delta-apply.js +86 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.js +57 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.js +40 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/geometry/models.js +21 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/geometry/utils.js +34 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.js +13 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.js +28 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/node/create-projection-node.js +1124 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/node/state.js +15 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/shared/stack.js +83 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/styles/scale-border-radius.js +26 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/styles/scale-box-shadow.js +25 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/styles/scale-correction.js +21 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/styles/transform.js +38 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/utils/compare-by-depth.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/utils/each-axis.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/utils/flat-tree.js +24 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/utils/has-transform.js +20 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/utils/measure.js +18 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/Feature.js +11 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/VisualElement.js +426 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/dom/DOMVisualElement.js +37 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/dom/is-css-var.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/dom/parse-transform.js +83 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/dom/style-set.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.js +40 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/html/utils/build-styles.js +42 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/html/utils/build-transform.js +53 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/html/utils/render.js +14 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.js +18 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/store.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.js +45 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.js +59 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/svg/utils/camel-case-attrs.js +28 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/svg/utils/is-svg-tag.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/svg/utils/path.js +17 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/svg/utils/render.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.js +16 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/animation-state.js +223 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/get-variant-context.js +26 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/is-animation-controls.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/is-controlling-variants.js +13 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.js +9 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/is-keyframes-target.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/is-variant-label.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/keys-position.js +13 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/keys-transform.js +24 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/motion-values.js +33 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.js +20 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/reduced-motion/state.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/resolve-dynamic-variants.js +8 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/resolve-variants.js +25 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/setters.js +25 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/shallow-compare.js +15 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/render/utils/variant-props.js +14 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/resize/handle-element.js +61 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/resize/handle-window.js +31 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/resize/index.js +8 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/delay.js +17 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/interpolate.js +53 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/is-html-element.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/is-svg-element.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/is-svg-svg-element.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/mix/color.js +44 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/mix/complex.js +83 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/mix/immediate.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/mix/index.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/mix/number.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/mix/visibility.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/resolve-elements.js +16 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/supports/flags.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/supports/linear-easing.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/supports/memo.js +9 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/utils/supports/scroll-timeline.js +5 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/index.js +286 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/auto.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/color/hex.js +37 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/color/hsla-to-rgba.js +39 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/color/hsla.js +14 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/color/index.js +26 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/color/rgba.js +18 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/color/utils.js +21 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/complex/filter.js +27 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/complex/index.js +91 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/complex/mask.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/dimensions.js +10 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/int.js +8 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/maps/defaults.js +28 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/maps/number.js +70 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/maps/transform.js +37 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/numbers/index.js +19 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/numbers/units.js +23 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/test.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.js +14 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/color-regex.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/find.js +9 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/float-regex.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/get-as-type.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/is-nullish.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/sanitize.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/types/utils/single-color-regex.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/utils/is-motion-value.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/will-change/add-will-change.js +15 -0
- package/dist/es/shared-ui/node_modules/motion-dom/dist/es/value/will-change/is.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/array.js +13 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/clamp.js +10 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/anticipate.js +5 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/back.js +11 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/circ.js +10 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/cubic-bezier.js +29 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/ease.js +9 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/modifiers/mirror.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/modifiers/reverse.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/utils/is-bezier-definition.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/utils/is-easing-array.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/easing/utils/map.js +38 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/errors.js +21 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/format-error-message.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/global-config.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/is-numerical-string.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/is-object.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/is-zero-value-string.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/memo.js +12 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/noop.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/pipe.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/progress.js +7 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/subscription-manager.js +32 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/time-conversion.js +6 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/velocity-per-second.js +4 -0
- package/dist/es/shared-ui/node_modules/motion-utils/dist/es/warn-once.js +11 -0
- package/dist/es/shared-ui.css +95 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/use-debounce-value.d.ts +2 -0
- package/dist/hooks/use-inview.d.ts +7 -0
- package/dist/hooks/use-is-inview.d.ts +7 -0
- package/dist/hooks/use-mobile-back-dialog.d.ts +6 -0
- package/dist/hooks/use-mobile.d.ts +9 -0
- package/dist/hooks/use-mounted.d.ts +2 -0
- package/dist/hooks/use-scroll-direction.d.ts +3 -0
- package/dist/hooks/use-user-hand-behavior.d.ts +7 -0
- package/dist/index.d.ts +13 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/locale.d.ts +26 -0
- package/package.json +118 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { time } from "../frameloop/sync-time.js";
|
|
2
|
+
import { frame } from "../frameloop/frame.js";
|
|
3
|
+
import { warnOnce } from "../../../../motion-utils/dist/es/warn-once.js";
|
|
4
|
+
import { SubscriptionManager } from "../../../../motion-utils/dist/es/subscription-manager.js";
|
|
5
|
+
import { velocityPerSecond } from "../../../../motion-utils/dist/es/velocity-per-second.js";
|
|
6
|
+
const MAX_VELOCITY_DELTA = 30;
|
|
7
|
+
const isFloat = (value) => {
|
|
8
|
+
return !isNaN(parseFloat(value));
|
|
9
|
+
};
|
|
10
|
+
class MotionValue {
|
|
11
|
+
/**
|
|
12
|
+
* @param init - The initiating value
|
|
13
|
+
* @param config - Optional configuration options
|
|
14
|
+
*
|
|
15
|
+
* - `transformer`: A function to transform incoming values with.
|
|
16
|
+
*/
|
|
17
|
+
constructor(init, options = {}) {
|
|
18
|
+
this.canTrackVelocity = null;
|
|
19
|
+
this.events = {};
|
|
20
|
+
this.updateAndNotify = (v) => {
|
|
21
|
+
const currentTime = time.now();
|
|
22
|
+
if (this.updatedAt !== currentTime) {
|
|
23
|
+
this.setPrevFrameValue();
|
|
24
|
+
}
|
|
25
|
+
this.prev = this.current;
|
|
26
|
+
this.setCurrent(v);
|
|
27
|
+
if (this.current !== this.prev) {
|
|
28
|
+
this.events.change?.notify(this.current);
|
|
29
|
+
if (this.dependents) {
|
|
30
|
+
for (const dependent of this.dependents) {
|
|
31
|
+
dependent.dirty();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.hasAnimated = false;
|
|
37
|
+
this.setCurrent(init);
|
|
38
|
+
this.owner = options.owner;
|
|
39
|
+
}
|
|
40
|
+
setCurrent(current) {
|
|
41
|
+
this.current = current;
|
|
42
|
+
this.updatedAt = time.now();
|
|
43
|
+
if (this.canTrackVelocity === null && current !== void 0) {
|
|
44
|
+
this.canTrackVelocity = isFloat(this.current);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
setPrevFrameValue(prevFrameValue = this.current) {
|
|
48
|
+
this.prevFrameValue = prevFrameValue;
|
|
49
|
+
this.prevUpdatedAt = this.updatedAt;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
53
|
+
*
|
|
54
|
+
* It returns a function that, when called, will cancel the subscription.
|
|
55
|
+
*
|
|
56
|
+
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
57
|
+
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
58
|
+
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
59
|
+
*
|
|
60
|
+
* ```jsx
|
|
61
|
+
* export const MyComponent = () => {
|
|
62
|
+
* const x = useMotionValue(0)
|
|
63
|
+
* const y = useMotionValue(0)
|
|
64
|
+
* const opacity = useMotionValue(1)
|
|
65
|
+
*
|
|
66
|
+
* useEffect(() => {
|
|
67
|
+
* function updateOpacity() {
|
|
68
|
+
* const maxXY = Math.max(x.get(), y.get())
|
|
69
|
+
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
70
|
+
* opacity.set(newOpacity)
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* const unsubscribeX = x.on("change", updateOpacity)
|
|
74
|
+
* const unsubscribeY = y.on("change", updateOpacity)
|
|
75
|
+
*
|
|
76
|
+
* return () => {
|
|
77
|
+
* unsubscribeX()
|
|
78
|
+
* unsubscribeY()
|
|
79
|
+
* }
|
|
80
|
+
* }, [])
|
|
81
|
+
*
|
|
82
|
+
* return <motion.div style={{ x }} />
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @param subscriber - A function that receives the latest value.
|
|
87
|
+
* @returns A function that, when called, will cancel this subscription.
|
|
88
|
+
*
|
|
89
|
+
* @deprecated
|
|
90
|
+
*/
|
|
91
|
+
onChange(subscription) {
|
|
92
|
+
if (process.env.NODE_ENV !== "production") {
|
|
93
|
+
warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
|
|
94
|
+
}
|
|
95
|
+
return this.on("change", subscription);
|
|
96
|
+
}
|
|
97
|
+
on(eventName, callback) {
|
|
98
|
+
if (!this.events[eventName]) {
|
|
99
|
+
this.events[eventName] = new SubscriptionManager();
|
|
100
|
+
}
|
|
101
|
+
const unsubscribe = this.events[eventName].add(callback);
|
|
102
|
+
if (eventName === "change") {
|
|
103
|
+
return () => {
|
|
104
|
+
unsubscribe();
|
|
105
|
+
frame.read(() => {
|
|
106
|
+
if (!this.events.change.getSize()) {
|
|
107
|
+
this.stop();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return unsubscribe;
|
|
113
|
+
}
|
|
114
|
+
clearListeners() {
|
|
115
|
+
for (const eventManagers in this.events) {
|
|
116
|
+
this.events[eventManagers].clear();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Attaches a passive effect to the `MotionValue`.
|
|
121
|
+
*/
|
|
122
|
+
attach(passiveEffect, stopPassiveEffect) {
|
|
123
|
+
this.passiveEffect = passiveEffect;
|
|
124
|
+
this.stopPassiveEffect = stopPassiveEffect;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Sets the state of the `MotionValue`.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
*
|
|
131
|
+
* ```jsx
|
|
132
|
+
* const x = useMotionValue(0)
|
|
133
|
+
* x.set(10)
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @param latest - Latest value to set.
|
|
137
|
+
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
set(v) {
|
|
142
|
+
if (!this.passiveEffect) {
|
|
143
|
+
this.updateAndNotify(v);
|
|
144
|
+
} else {
|
|
145
|
+
this.passiveEffect(v, this.updateAndNotify);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
setWithVelocity(prev, current, delta) {
|
|
149
|
+
this.set(current);
|
|
150
|
+
this.prev = void 0;
|
|
151
|
+
this.prevFrameValue = prev;
|
|
152
|
+
this.prevUpdatedAt = this.updatedAt - delta;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Set the state of the `MotionValue`, stopping any active animations,
|
|
156
|
+
* effects, and resets velocity to `0`.
|
|
157
|
+
*/
|
|
158
|
+
jump(v, endAnimation = true) {
|
|
159
|
+
this.updateAndNotify(v);
|
|
160
|
+
this.prev = v;
|
|
161
|
+
this.prevUpdatedAt = this.prevFrameValue = void 0;
|
|
162
|
+
endAnimation && this.stop();
|
|
163
|
+
if (this.stopPassiveEffect)
|
|
164
|
+
this.stopPassiveEffect();
|
|
165
|
+
}
|
|
166
|
+
dirty() {
|
|
167
|
+
this.events.change?.notify(this.current);
|
|
168
|
+
}
|
|
169
|
+
addDependent(dependent) {
|
|
170
|
+
if (!this.dependents) {
|
|
171
|
+
this.dependents = /* @__PURE__ */ new Set();
|
|
172
|
+
}
|
|
173
|
+
this.dependents.add(dependent);
|
|
174
|
+
}
|
|
175
|
+
removeDependent(dependent) {
|
|
176
|
+
if (this.dependents) {
|
|
177
|
+
this.dependents.delete(dependent);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Returns the latest state of `MotionValue`
|
|
182
|
+
*
|
|
183
|
+
* @returns - The latest state of `MotionValue`
|
|
184
|
+
*
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
get() {
|
|
188
|
+
return this.current;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @public
|
|
192
|
+
*/
|
|
193
|
+
getPrevious() {
|
|
194
|
+
return this.prev;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Returns the latest velocity of `MotionValue`
|
|
198
|
+
*
|
|
199
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
200
|
+
*
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
203
|
+
getVelocity() {
|
|
204
|
+
const currentTime = time.now();
|
|
205
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
209
|
+
return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Registers a new animation to control this `MotionValue`. Only one
|
|
213
|
+
* animation can drive a `MotionValue` at one time.
|
|
214
|
+
*
|
|
215
|
+
* ```jsx
|
|
216
|
+
* value.start()
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* @param animation - A function that starts the provided animation
|
|
220
|
+
*/
|
|
221
|
+
start(startAnimation) {
|
|
222
|
+
this.stop();
|
|
223
|
+
return new Promise((resolve) => {
|
|
224
|
+
this.hasAnimated = true;
|
|
225
|
+
this.animation = startAnimation(resolve);
|
|
226
|
+
if (this.events.animationStart) {
|
|
227
|
+
this.events.animationStart.notify();
|
|
228
|
+
}
|
|
229
|
+
}).then(() => {
|
|
230
|
+
if (this.events.animationComplete) {
|
|
231
|
+
this.events.animationComplete.notify();
|
|
232
|
+
}
|
|
233
|
+
this.clearAnimation();
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Stop the currently active animation.
|
|
238
|
+
*
|
|
239
|
+
* @public
|
|
240
|
+
*/
|
|
241
|
+
stop() {
|
|
242
|
+
if (this.animation) {
|
|
243
|
+
this.animation.stop();
|
|
244
|
+
if (this.events.animationCancel) {
|
|
245
|
+
this.events.animationCancel.notify();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
this.clearAnimation();
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Returns `true` if this value is currently animating.
|
|
252
|
+
*
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
isAnimating() {
|
|
256
|
+
return !!this.animation;
|
|
257
|
+
}
|
|
258
|
+
clearAnimation() {
|
|
259
|
+
delete this.animation;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
263
|
+
*
|
|
264
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
265
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
266
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
267
|
+
*
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
destroy() {
|
|
271
|
+
this.dependents?.clear();
|
|
272
|
+
this.events.destroy?.notify();
|
|
273
|
+
this.clearListeners();
|
|
274
|
+
this.stop();
|
|
275
|
+
if (this.stopPassiveEffect) {
|
|
276
|
+
this.stopPassiveEffect();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function motionValue(init, options) {
|
|
281
|
+
return new MotionValue(init, options);
|
|
282
|
+
}
|
|
283
|
+
export {
|
|
284
|
+
MotionValue,
|
|
285
|
+
motionValue
|
|
286
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { rgba } from "./rgba.js";
|
|
2
|
+
import { isColorString } from "./utils.js";
|
|
3
|
+
function parseHex(v) {
|
|
4
|
+
let r = "";
|
|
5
|
+
let g = "";
|
|
6
|
+
let b = "";
|
|
7
|
+
let a = "";
|
|
8
|
+
if (v.length > 5) {
|
|
9
|
+
r = v.substring(1, 3);
|
|
10
|
+
g = v.substring(3, 5);
|
|
11
|
+
b = v.substring(5, 7);
|
|
12
|
+
a = v.substring(7, 9);
|
|
13
|
+
} else {
|
|
14
|
+
r = v.substring(1, 2);
|
|
15
|
+
g = v.substring(2, 3);
|
|
16
|
+
b = v.substring(3, 4);
|
|
17
|
+
a = v.substring(4, 5);
|
|
18
|
+
r += r;
|
|
19
|
+
g += g;
|
|
20
|
+
b += b;
|
|
21
|
+
a += a;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
red: parseInt(r, 16),
|
|
25
|
+
green: parseInt(g, 16),
|
|
26
|
+
blue: parseInt(b, 16),
|
|
27
|
+
alpha: a ? parseInt(a, 16) / 255 : 1
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const hex = {
|
|
31
|
+
test: /* @__PURE__ */ isColorString("#"),
|
|
32
|
+
parse: parseHex,
|
|
33
|
+
transform: rgba.transform
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
hex
|
|
37
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function hueToRgb(p, q, t) {
|
|
2
|
+
if (t < 0)
|
|
3
|
+
t += 1;
|
|
4
|
+
if (t > 1)
|
|
5
|
+
t -= 1;
|
|
6
|
+
if (t < 1 / 6)
|
|
7
|
+
return p + (q - p) * 6 * t;
|
|
8
|
+
if (t < 1 / 2)
|
|
9
|
+
return q;
|
|
10
|
+
if (t < 2 / 3)
|
|
11
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
12
|
+
return p;
|
|
13
|
+
}
|
|
14
|
+
function hslaToRgba({ hue, saturation, lightness, alpha }) {
|
|
15
|
+
hue /= 360;
|
|
16
|
+
saturation /= 100;
|
|
17
|
+
lightness /= 100;
|
|
18
|
+
let red = 0;
|
|
19
|
+
let green = 0;
|
|
20
|
+
let blue = 0;
|
|
21
|
+
if (!saturation) {
|
|
22
|
+
red = green = blue = lightness;
|
|
23
|
+
} else {
|
|
24
|
+
const q = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
|
|
25
|
+
const p = 2 * lightness - q;
|
|
26
|
+
red = hueToRgb(p, q, hue + 1 / 3);
|
|
27
|
+
green = hueToRgb(p, q, hue);
|
|
28
|
+
blue = hueToRgb(p, q, hue - 1 / 3);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
red: Math.round(red * 255),
|
|
32
|
+
green: Math.round(green * 255),
|
|
33
|
+
blue: Math.round(blue * 255),
|
|
34
|
+
alpha
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
hslaToRgba
|
|
39
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { alpha } from "../numbers/index.js";
|
|
2
|
+
import { percent } from "../numbers/units.js";
|
|
3
|
+
import { sanitize } from "../utils/sanitize.js";
|
|
4
|
+
import { splitColor, isColorString } from "./utils.js";
|
|
5
|
+
const hsla = {
|
|
6
|
+
test: /* @__PURE__ */ isColorString("hsl", "hue"),
|
|
7
|
+
parse: /* @__PURE__ */ splitColor("hue", "saturation", "lightness"),
|
|
8
|
+
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
|
|
9
|
+
return "hsla(" + Math.round(hue) + ", " + percent.transform(sanitize(saturation)) + ", " + percent.transform(sanitize(lightness)) + ", " + sanitize(alpha.transform(alpha$1)) + ")";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
hsla
|
|
14
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { hex } from "./hex.js";
|
|
2
|
+
import { hsla } from "./hsla.js";
|
|
3
|
+
import { rgba } from "./rgba.js";
|
|
4
|
+
const color = {
|
|
5
|
+
test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
|
|
6
|
+
parse: (v) => {
|
|
7
|
+
if (rgba.test(v)) {
|
|
8
|
+
return rgba.parse(v);
|
|
9
|
+
} else if (hsla.test(v)) {
|
|
10
|
+
return hsla.parse(v);
|
|
11
|
+
} else {
|
|
12
|
+
return hex.parse(v);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
transform: (v) => {
|
|
16
|
+
return typeof v === "string" ? v : v.hasOwnProperty("red") ? rgba.transform(v) : hsla.transform(v);
|
|
17
|
+
},
|
|
18
|
+
getAnimatableNone: (v) => {
|
|
19
|
+
const parsed = color.parse(v);
|
|
20
|
+
parsed.alpha = 0;
|
|
21
|
+
return color.transform(parsed);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
color
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { number, alpha } from "../numbers/index.js";
|
|
2
|
+
import { sanitize } from "../utils/sanitize.js";
|
|
3
|
+
import { splitColor, isColorString } from "./utils.js";
|
|
4
|
+
import { clamp } from "../../../../../../motion-utils/dist/es/clamp.js";
|
|
5
|
+
const clampRgbUnit = (v) => clamp(0, 255, v);
|
|
6
|
+
const rgbUnit = {
|
|
7
|
+
...number,
|
|
8
|
+
transform: (v) => Math.round(clampRgbUnit(v))
|
|
9
|
+
};
|
|
10
|
+
const rgba = {
|
|
11
|
+
test: /* @__PURE__ */ isColorString("rgb", "red"),
|
|
12
|
+
parse: /* @__PURE__ */ splitColor("red", "green", "blue"),
|
|
13
|
+
transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" + rgbUnit.transform(red) + ", " + rgbUnit.transform(green) + ", " + rgbUnit.transform(blue) + ", " + sanitize(alpha.transform(alpha$1)) + ")"
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
rgbUnit,
|
|
17
|
+
rgba
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { floatRegex } from "../utils/float-regex.js";
|
|
2
|
+
import { isNullish } from "../utils/is-nullish.js";
|
|
3
|
+
import { singleColorRegex } from "../utils/single-color-regex.js";
|
|
4
|
+
const isColorString = (type, testProp) => (v) => {
|
|
5
|
+
return Boolean(typeof v === "string" && singleColorRegex.test(v) && v.startsWith(type) || testProp && !isNullish(v) && Object.prototype.hasOwnProperty.call(v, testProp));
|
|
6
|
+
};
|
|
7
|
+
const splitColor = (aName, bName, cName) => (v) => {
|
|
8
|
+
if (typeof v !== "string")
|
|
9
|
+
return v;
|
|
10
|
+
const [a, b, c, alpha] = v.match(floatRegex);
|
|
11
|
+
return {
|
|
12
|
+
[aName]: parseFloat(a),
|
|
13
|
+
[bName]: parseFloat(b),
|
|
14
|
+
[cName]: parseFloat(c),
|
|
15
|
+
alpha: alpha !== void 0 ? parseFloat(alpha) : 1
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
isColorString,
|
|
20
|
+
splitColor
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { complex } from "./index.js";
|
|
2
|
+
import { floatRegex } from "../utils/float-regex.js";
|
|
3
|
+
const maxDefaults = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
4
|
+
function applyDefaultFilter(v) {
|
|
5
|
+
const [name, value] = v.slice(0, -1).split("(");
|
|
6
|
+
if (name === "drop-shadow")
|
|
7
|
+
return v;
|
|
8
|
+
const [number] = value.match(floatRegex) || [];
|
|
9
|
+
if (!number)
|
|
10
|
+
return v;
|
|
11
|
+
const unit = value.replace(number, "");
|
|
12
|
+
let defaultValue = maxDefaults.has(name) ? 1 : 0;
|
|
13
|
+
if (number !== value)
|
|
14
|
+
defaultValue *= 100;
|
|
15
|
+
return name + "(" + defaultValue + unit + ")";
|
|
16
|
+
}
|
|
17
|
+
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
|
|
18
|
+
const filter = {
|
|
19
|
+
...complex,
|
|
20
|
+
getAnimatableNone: (v) => {
|
|
21
|
+
const functions = v.match(functionRegex);
|
|
22
|
+
return functions ? functions.map(applyDefaultFilter).join(" ") : v;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
filter
|
|
27
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { color } from "../color/index.js";
|
|
2
|
+
import { colorRegex } from "../utils/color-regex.js";
|
|
3
|
+
import { floatRegex } from "../utils/float-regex.js";
|
|
4
|
+
import { sanitize } from "../utils/sanitize.js";
|
|
5
|
+
function test(v) {
|
|
6
|
+
return isNaN(v) && typeof v === "string" && (v.match(floatRegex)?.length || 0) + (v.match(colorRegex)?.length || 0) > 0;
|
|
7
|
+
}
|
|
8
|
+
const NUMBER_TOKEN = "number";
|
|
9
|
+
const COLOR_TOKEN = "color";
|
|
10
|
+
const VAR_TOKEN = "var";
|
|
11
|
+
const VAR_FUNCTION_TOKEN = "var(";
|
|
12
|
+
const SPLIT_TOKEN = "${}";
|
|
13
|
+
const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
|
|
14
|
+
function analyseComplexValue(value) {
|
|
15
|
+
const originalValue = value.toString();
|
|
16
|
+
const values = [];
|
|
17
|
+
const indexes = {
|
|
18
|
+
color: [],
|
|
19
|
+
number: [],
|
|
20
|
+
var: []
|
|
21
|
+
};
|
|
22
|
+
const types = [];
|
|
23
|
+
let i = 0;
|
|
24
|
+
const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
|
|
25
|
+
if (color.test(parsedValue)) {
|
|
26
|
+
indexes.color.push(i);
|
|
27
|
+
types.push(COLOR_TOKEN);
|
|
28
|
+
values.push(color.parse(parsedValue));
|
|
29
|
+
} else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
|
|
30
|
+
indexes.var.push(i);
|
|
31
|
+
types.push(VAR_TOKEN);
|
|
32
|
+
values.push(parsedValue);
|
|
33
|
+
} else {
|
|
34
|
+
indexes.number.push(i);
|
|
35
|
+
types.push(NUMBER_TOKEN);
|
|
36
|
+
values.push(parseFloat(parsedValue));
|
|
37
|
+
}
|
|
38
|
+
++i;
|
|
39
|
+
return SPLIT_TOKEN;
|
|
40
|
+
});
|
|
41
|
+
const split = tokenised.split(SPLIT_TOKEN);
|
|
42
|
+
return { values, split, indexes, types };
|
|
43
|
+
}
|
|
44
|
+
function parseComplexValue(v) {
|
|
45
|
+
return analyseComplexValue(v).values;
|
|
46
|
+
}
|
|
47
|
+
function buildTransformer({ split, types }) {
|
|
48
|
+
const numSections = split.length;
|
|
49
|
+
return (v) => {
|
|
50
|
+
let output = "";
|
|
51
|
+
for (let i = 0; i < numSections; i++) {
|
|
52
|
+
output += split[i];
|
|
53
|
+
if (v[i] !== void 0) {
|
|
54
|
+
const type = types[i];
|
|
55
|
+
if (type === NUMBER_TOKEN) {
|
|
56
|
+
output += sanitize(v[i]);
|
|
57
|
+
} else if (type === COLOR_TOKEN) {
|
|
58
|
+
output += color.transform(v[i]);
|
|
59
|
+
} else {
|
|
60
|
+
output += v[i];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return output;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function createTransformer(source) {
|
|
68
|
+
return buildTransformer(analyseComplexValue(source));
|
|
69
|
+
}
|
|
70
|
+
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : color.test(v) ? color.getAnimatableNone(v) : v;
|
|
71
|
+
const convertToZero = (value, splitBefore) => {
|
|
72
|
+
if (typeof value === "number") {
|
|
73
|
+
return splitBefore?.trim().endsWith("/") ? value : 0;
|
|
74
|
+
}
|
|
75
|
+
return convertNumbersToZero(value);
|
|
76
|
+
};
|
|
77
|
+
function getAnimatableNone(v) {
|
|
78
|
+
const info = analyseComplexValue(v);
|
|
79
|
+
const transformer = buildTransformer(info);
|
|
80
|
+
return transformer(info.values.map((value, i) => convertToZero(value, info.split[i])));
|
|
81
|
+
}
|
|
82
|
+
const complex = {
|
|
83
|
+
test,
|
|
84
|
+
parse: parseComplexValue,
|
|
85
|
+
createTransformer,
|
|
86
|
+
getAnimatableNone
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
analyseComplexValue,
|
|
90
|
+
complex
|
|
91
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { complex } from "./index.js";
|
|
2
|
+
const mask = {
|
|
3
|
+
...complex,
|
|
4
|
+
getAnimatableNone: (v) => {
|
|
5
|
+
const parsed = complex.parse(v);
|
|
6
|
+
const transformer = complex.createTransformer(v);
|
|
7
|
+
return transformer(parsed.map((v2) => typeof v2 === "number" ? 0 : typeof v2 === "object" ? { ...v2, alpha: 1 } : v2));
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
mask
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { auto } from "./auto.js";
|
|
2
|
+
import { number } from "./numbers/index.js";
|
|
3
|
+
import { px, percent, degrees, vw, vh } from "./numbers/units.js";
|
|
4
|
+
import { testValueType } from "./test.js";
|
|
5
|
+
const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
|
|
6
|
+
const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));
|
|
7
|
+
export {
|
|
8
|
+
dimensionValueTypes,
|
|
9
|
+
findDimensionValueType
|
|
10
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { color } from "../color/index.js";
|
|
2
|
+
import { filter } from "../complex/filter.js";
|
|
3
|
+
import { mask } from "../complex/mask.js";
|
|
4
|
+
import { numberValueTypes } from "./number.js";
|
|
5
|
+
const defaultValueTypes = {
|
|
6
|
+
...numberValueTypes,
|
|
7
|
+
// Color props
|
|
8
|
+
color,
|
|
9
|
+
backgroundColor: color,
|
|
10
|
+
outlineColor: color,
|
|
11
|
+
fill: color,
|
|
12
|
+
stroke: color,
|
|
13
|
+
// Border props
|
|
14
|
+
borderColor: color,
|
|
15
|
+
borderTopColor: color,
|
|
16
|
+
borderRightColor: color,
|
|
17
|
+
borderBottomColor: color,
|
|
18
|
+
borderLeftColor: color,
|
|
19
|
+
filter,
|
|
20
|
+
WebkitFilter: filter,
|
|
21
|
+
mask,
|
|
22
|
+
WebkitMask: mask
|
|
23
|
+
};
|
|
24
|
+
const getDefaultValueType = (key) => defaultValueTypes[key];
|
|
25
|
+
export {
|
|
26
|
+
defaultValueTypes,
|
|
27
|
+
getDefaultValueType
|
|
28
|
+
};
|