@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,426 @@
|
|
|
1
|
+
import { KeyframeResolver } from "../animation/keyframes/KeyframesResolver.js";
|
|
2
|
+
import { NativeAnimation } from "../animation/NativeAnimation.js";
|
|
3
|
+
import { acceleratedValues } from "../animation/waapi/utils/accelerated-values.js";
|
|
4
|
+
import { microtask } from "../frameloop/microtask.js";
|
|
5
|
+
import { time } from "../frameloop/sync-time.js";
|
|
6
|
+
import { createBox } from "../projection/geometry/models.js";
|
|
7
|
+
import { motionValue } from "../value/index.js";
|
|
8
|
+
import { complex } from "../value/types/complex/index.js";
|
|
9
|
+
import { getAnimatableNone } from "../value/types/utils/animatable-none.js";
|
|
10
|
+
import { findValueType } from "../value/types/utils/find.js";
|
|
11
|
+
import { isMotionValue } from "../value/utils/is-motion-value.js";
|
|
12
|
+
import { visualElementStore } from "./store.js";
|
|
13
|
+
import { isControllingVariants, isVariantNode } from "./utils/is-controlling-variants.js";
|
|
14
|
+
import { transformProps } from "./utils/keys-transform.js";
|
|
15
|
+
import { updateMotionValuesFromProps } from "./utils/motion-values.js";
|
|
16
|
+
import { initPrefersReducedMotion } from "./utils/reduced-motion/index.js";
|
|
17
|
+
import { resolveVariantFromProps } from "./utils/resolve-variants.js";
|
|
18
|
+
import { hasReducedMotionListener, prefersReducedMotion } from "./utils/reduced-motion/state.js";
|
|
19
|
+
import { frame, cancelFrame } from "../frameloop/frame.js";
|
|
20
|
+
import { warnOnce } from "../../../../motion-utils/dist/es/warn-once.js";
|
|
21
|
+
import { secondsToMilliseconds } from "../../../../motion-utils/dist/es/time-conversion.js";
|
|
22
|
+
import { isNumericalString } from "../../../../motion-utils/dist/es/is-numerical-string.js";
|
|
23
|
+
import { isZeroValueString } from "../../../../motion-utils/dist/es/is-zero-value-string.js";
|
|
24
|
+
import { SubscriptionManager } from "../../../../motion-utils/dist/es/subscription-manager.js";
|
|
25
|
+
const propEventHandlers = [
|
|
26
|
+
"AnimationStart",
|
|
27
|
+
"AnimationComplete",
|
|
28
|
+
"Update",
|
|
29
|
+
"BeforeLayoutMeasure",
|
|
30
|
+
"LayoutMeasure",
|
|
31
|
+
"LayoutAnimationStart",
|
|
32
|
+
"LayoutAnimationComplete"
|
|
33
|
+
];
|
|
34
|
+
let featureDefinitions = {};
|
|
35
|
+
function setFeatureDefinitions(definitions) {
|
|
36
|
+
featureDefinitions = definitions;
|
|
37
|
+
}
|
|
38
|
+
function getFeatureDefinitions() {
|
|
39
|
+
return featureDefinitions;
|
|
40
|
+
}
|
|
41
|
+
class VisualElement {
|
|
42
|
+
/**
|
|
43
|
+
* This method takes React props and returns found MotionValues. For example, HTML
|
|
44
|
+
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
|
|
45
|
+
*
|
|
46
|
+
* This isn't an abstract method as it needs calling in the constructor, but it is
|
|
47
|
+
* intended to be one.
|
|
48
|
+
*/
|
|
49
|
+
scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState }, options = {}) {
|
|
53
|
+
this.current = null;
|
|
54
|
+
this.children = /* @__PURE__ */ new Set();
|
|
55
|
+
this.isVariantNode = false;
|
|
56
|
+
this.isControllingVariants = false;
|
|
57
|
+
this.shouldReduceMotion = null;
|
|
58
|
+
this.shouldSkipAnimations = false;
|
|
59
|
+
this.values = /* @__PURE__ */ new Map();
|
|
60
|
+
this.KeyframeResolver = KeyframeResolver;
|
|
61
|
+
this.features = {};
|
|
62
|
+
this.valueSubscriptions = /* @__PURE__ */ new Map();
|
|
63
|
+
this.prevMotionValues = {};
|
|
64
|
+
this.hasBeenMounted = false;
|
|
65
|
+
this.events = {};
|
|
66
|
+
this.propEventSubscriptions = {};
|
|
67
|
+
this.notifyUpdate = () => this.notify("Update", this.latestValues);
|
|
68
|
+
this.render = () => {
|
|
69
|
+
if (!this.current)
|
|
70
|
+
return;
|
|
71
|
+
this.triggerBuild();
|
|
72
|
+
this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
|
|
73
|
+
};
|
|
74
|
+
this.renderScheduledAt = 0;
|
|
75
|
+
this.scheduleRender = () => {
|
|
76
|
+
const now = time.now();
|
|
77
|
+
if (this.renderScheduledAt < now) {
|
|
78
|
+
this.renderScheduledAt = now;
|
|
79
|
+
frame.render(this.render, false, true);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const { latestValues, renderState } = visualState;
|
|
83
|
+
this.latestValues = latestValues;
|
|
84
|
+
this.baseTarget = { ...latestValues };
|
|
85
|
+
this.initialValues = props.initial ? { ...latestValues } : {};
|
|
86
|
+
this.renderState = renderState;
|
|
87
|
+
this.parent = parent;
|
|
88
|
+
this.props = props;
|
|
89
|
+
this.presenceContext = presenceContext;
|
|
90
|
+
this.depth = parent ? parent.depth + 1 : 0;
|
|
91
|
+
this.reducedMotionConfig = reducedMotionConfig;
|
|
92
|
+
this.skipAnimationsConfig = skipAnimations;
|
|
93
|
+
this.options = options;
|
|
94
|
+
this.blockInitialAnimation = Boolean(blockInitialAnimation);
|
|
95
|
+
this.isControllingVariants = isControllingVariants(props);
|
|
96
|
+
this.isVariantNode = isVariantNode(props);
|
|
97
|
+
if (this.isVariantNode) {
|
|
98
|
+
this.variantChildren = /* @__PURE__ */ new Set();
|
|
99
|
+
}
|
|
100
|
+
this.manuallyAnimateOnMount = Boolean(parent && parent.current);
|
|
101
|
+
const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);
|
|
102
|
+
for (const key in initialMotionValues) {
|
|
103
|
+
const value = initialMotionValues[key];
|
|
104
|
+
if (latestValues[key] !== void 0 && isMotionValue(value)) {
|
|
105
|
+
value.set(latestValues[key]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
mount(instance) {
|
|
110
|
+
if (this.hasBeenMounted) {
|
|
111
|
+
for (const key in this.initialValues) {
|
|
112
|
+
this.values.get(key)?.jump(this.initialValues[key]);
|
|
113
|
+
this.latestValues[key] = this.initialValues[key];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
this.current = instance;
|
|
117
|
+
visualElementStore.set(instance, this);
|
|
118
|
+
if (this.projection && !this.projection.instance) {
|
|
119
|
+
this.projection.mount(instance);
|
|
120
|
+
}
|
|
121
|
+
if (this.parent && this.isVariantNode && !this.isControllingVariants) {
|
|
122
|
+
this.removeFromVariantTree = this.parent.addVariantChild(this);
|
|
123
|
+
}
|
|
124
|
+
this.values.forEach((value, key) => this.bindToMotionValue(key, value));
|
|
125
|
+
if (this.reducedMotionConfig === "never") {
|
|
126
|
+
this.shouldReduceMotion = false;
|
|
127
|
+
} else if (this.reducedMotionConfig === "always") {
|
|
128
|
+
this.shouldReduceMotion = true;
|
|
129
|
+
} else {
|
|
130
|
+
if (!hasReducedMotionListener.current) {
|
|
131
|
+
initPrefersReducedMotion();
|
|
132
|
+
}
|
|
133
|
+
this.shouldReduceMotion = prefersReducedMotion.current;
|
|
134
|
+
}
|
|
135
|
+
if (process.env.NODE_ENV !== "production") {
|
|
136
|
+
warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled");
|
|
137
|
+
}
|
|
138
|
+
this.shouldSkipAnimations = this.skipAnimationsConfig ?? false;
|
|
139
|
+
this.parent?.addChild(this);
|
|
140
|
+
this.update(this.props, this.presenceContext);
|
|
141
|
+
this.hasBeenMounted = true;
|
|
142
|
+
}
|
|
143
|
+
unmount() {
|
|
144
|
+
this.projection && this.projection.unmount();
|
|
145
|
+
cancelFrame(this.notifyUpdate);
|
|
146
|
+
cancelFrame(this.render);
|
|
147
|
+
this.valueSubscriptions.forEach((remove) => remove());
|
|
148
|
+
this.valueSubscriptions.clear();
|
|
149
|
+
this.removeFromVariantTree && this.removeFromVariantTree();
|
|
150
|
+
this.parent?.removeChild(this);
|
|
151
|
+
for (const key in this.events) {
|
|
152
|
+
this.events[key].clear();
|
|
153
|
+
}
|
|
154
|
+
for (const key in this.features) {
|
|
155
|
+
const feature = this.features[key];
|
|
156
|
+
if (feature) {
|
|
157
|
+
feature.unmount();
|
|
158
|
+
feature.isMounted = false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
this.current = null;
|
|
162
|
+
}
|
|
163
|
+
addChild(child) {
|
|
164
|
+
this.children.add(child);
|
|
165
|
+
this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set());
|
|
166
|
+
this.enteringChildren.add(child);
|
|
167
|
+
}
|
|
168
|
+
removeChild(child) {
|
|
169
|
+
this.children.delete(child);
|
|
170
|
+
this.enteringChildren && this.enteringChildren.delete(child);
|
|
171
|
+
}
|
|
172
|
+
bindToMotionValue(key, value) {
|
|
173
|
+
if (this.valueSubscriptions.has(key)) {
|
|
174
|
+
this.valueSubscriptions.get(key)();
|
|
175
|
+
}
|
|
176
|
+
if (value.accelerate && acceleratedValues.has(key) && this.current instanceof HTMLElement) {
|
|
177
|
+
const { factory, keyframes, times, ease, duration } = value.accelerate;
|
|
178
|
+
const animation = new NativeAnimation({
|
|
179
|
+
element: this.current,
|
|
180
|
+
name: key,
|
|
181
|
+
keyframes,
|
|
182
|
+
times,
|
|
183
|
+
ease,
|
|
184
|
+
duration: secondsToMilliseconds(duration)
|
|
185
|
+
});
|
|
186
|
+
const cleanup = factory(animation);
|
|
187
|
+
this.valueSubscriptions.set(key, () => {
|
|
188
|
+
cleanup();
|
|
189
|
+
animation.cancel();
|
|
190
|
+
});
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const valueIsTransform = transformProps.has(key);
|
|
194
|
+
if (valueIsTransform && this.onBindTransform) {
|
|
195
|
+
this.onBindTransform();
|
|
196
|
+
}
|
|
197
|
+
const removeOnChange = value.on("change", (latestValue) => {
|
|
198
|
+
this.latestValues[key] = latestValue;
|
|
199
|
+
this.props.onUpdate && frame.preRender(this.notifyUpdate);
|
|
200
|
+
if (valueIsTransform && this.projection) {
|
|
201
|
+
this.projection.isTransformDirty = true;
|
|
202
|
+
}
|
|
203
|
+
this.scheduleRender();
|
|
204
|
+
});
|
|
205
|
+
let removeSyncCheck;
|
|
206
|
+
if (typeof window !== "undefined" && window.MotionCheckAppearSync) {
|
|
207
|
+
removeSyncCheck = window.MotionCheckAppearSync(this, key, value);
|
|
208
|
+
}
|
|
209
|
+
this.valueSubscriptions.set(key, () => {
|
|
210
|
+
removeOnChange();
|
|
211
|
+
if (removeSyncCheck)
|
|
212
|
+
removeSyncCheck();
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
sortNodePosition(other) {
|
|
216
|
+
if (!this.current || !this.sortInstanceNodePosition || this.type !== other.type) {
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
return this.sortInstanceNodePosition(this.current, other.current);
|
|
220
|
+
}
|
|
221
|
+
updateFeatures() {
|
|
222
|
+
let key = "animation";
|
|
223
|
+
for (key in featureDefinitions) {
|
|
224
|
+
const featureDefinition = featureDefinitions[key];
|
|
225
|
+
if (!featureDefinition)
|
|
226
|
+
continue;
|
|
227
|
+
const { isEnabled, Feature: FeatureConstructor } = featureDefinition;
|
|
228
|
+
if (!this.features[key] && FeatureConstructor && isEnabled(this.props)) {
|
|
229
|
+
this.features[key] = new FeatureConstructor(this);
|
|
230
|
+
}
|
|
231
|
+
if (this.features[key]) {
|
|
232
|
+
const feature = this.features[key];
|
|
233
|
+
if (feature.isMounted) {
|
|
234
|
+
feature.update();
|
|
235
|
+
} else {
|
|
236
|
+
feature.mount();
|
|
237
|
+
feature.isMounted = true;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
triggerBuild() {
|
|
243
|
+
this.build(this.renderState, this.latestValues, this.props);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Measure the current viewport box with or without transforms.
|
|
247
|
+
* Only measures axis-aligned boxes, rotate and skew must be manually
|
|
248
|
+
* removed with a re-render to work.
|
|
249
|
+
*/
|
|
250
|
+
measureViewportBox() {
|
|
251
|
+
return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox();
|
|
252
|
+
}
|
|
253
|
+
getStaticValue(key) {
|
|
254
|
+
return this.latestValues[key];
|
|
255
|
+
}
|
|
256
|
+
setStaticValue(key, value) {
|
|
257
|
+
this.latestValues[key] = value;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Update the provided props. Ensure any newly-added motion values are
|
|
261
|
+
* added to our map, old ones removed, and listeners updated.
|
|
262
|
+
*/
|
|
263
|
+
update(props, presenceContext) {
|
|
264
|
+
if (props.transformTemplate || this.props.transformTemplate) {
|
|
265
|
+
this.scheduleRender();
|
|
266
|
+
}
|
|
267
|
+
this.prevProps = this.props;
|
|
268
|
+
this.props = props;
|
|
269
|
+
this.prevPresenceContext = this.presenceContext;
|
|
270
|
+
this.presenceContext = presenceContext;
|
|
271
|
+
for (let i = 0; i < propEventHandlers.length; i++) {
|
|
272
|
+
const key = propEventHandlers[i];
|
|
273
|
+
if (this.propEventSubscriptions[key]) {
|
|
274
|
+
this.propEventSubscriptions[key]();
|
|
275
|
+
delete this.propEventSubscriptions[key];
|
|
276
|
+
}
|
|
277
|
+
const listenerName = "on" + key;
|
|
278
|
+
const listener = props[listenerName];
|
|
279
|
+
if (listener) {
|
|
280
|
+
this.propEventSubscriptions[key] = this.on(key, listener);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps || {}, this), this.prevMotionValues);
|
|
284
|
+
if (this.handleChildMotionValue) {
|
|
285
|
+
this.handleChildMotionValue();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
getProps() {
|
|
289
|
+
return this.props;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Returns the variant definition with a given name.
|
|
293
|
+
*/
|
|
294
|
+
getVariant(name) {
|
|
295
|
+
return this.props.variants ? this.props.variants[name] : void 0;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Returns the defined default transition on this component.
|
|
299
|
+
*/
|
|
300
|
+
getDefaultTransition() {
|
|
301
|
+
return this.props.transition;
|
|
302
|
+
}
|
|
303
|
+
getTransformPagePoint() {
|
|
304
|
+
return this.props.transformPagePoint;
|
|
305
|
+
}
|
|
306
|
+
getClosestVariantNode() {
|
|
307
|
+
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Add a child visual element to our set of children.
|
|
311
|
+
*/
|
|
312
|
+
addVariantChild(child) {
|
|
313
|
+
const closestVariantNode = this.getClosestVariantNode();
|
|
314
|
+
if (closestVariantNode) {
|
|
315
|
+
closestVariantNode.variantChildren && closestVariantNode.variantChildren.add(child);
|
|
316
|
+
return () => closestVariantNode.variantChildren.delete(child);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Add a motion value and bind it to this visual element.
|
|
321
|
+
*/
|
|
322
|
+
addValue(key, value) {
|
|
323
|
+
const existingValue = this.values.get(key);
|
|
324
|
+
if (value !== existingValue) {
|
|
325
|
+
if (existingValue)
|
|
326
|
+
this.removeValue(key);
|
|
327
|
+
this.bindToMotionValue(key, value);
|
|
328
|
+
this.values.set(key, value);
|
|
329
|
+
this.latestValues[key] = value.get();
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Remove a motion value and unbind any active subscriptions.
|
|
334
|
+
*/
|
|
335
|
+
removeValue(key) {
|
|
336
|
+
this.values.delete(key);
|
|
337
|
+
const unsubscribe = this.valueSubscriptions.get(key);
|
|
338
|
+
if (unsubscribe) {
|
|
339
|
+
unsubscribe();
|
|
340
|
+
this.valueSubscriptions.delete(key);
|
|
341
|
+
}
|
|
342
|
+
delete this.latestValues[key];
|
|
343
|
+
this.removeValueFromRenderState(key, this.renderState);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Check whether we have a motion value for this key
|
|
347
|
+
*/
|
|
348
|
+
hasValue(key) {
|
|
349
|
+
return this.values.has(key);
|
|
350
|
+
}
|
|
351
|
+
getValue(key, defaultValue) {
|
|
352
|
+
if (this.props.values && this.props.values[key]) {
|
|
353
|
+
return this.props.values[key];
|
|
354
|
+
}
|
|
355
|
+
let value = this.values.get(key);
|
|
356
|
+
if (value === void 0 && defaultValue !== void 0) {
|
|
357
|
+
value = motionValue(defaultValue === null ? void 0 : defaultValue, { owner: this });
|
|
358
|
+
this.addValue(key, value);
|
|
359
|
+
}
|
|
360
|
+
return value;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* If we're trying to animate to a previously unencountered value,
|
|
364
|
+
* we need to check for it in our state and as a last resort read it
|
|
365
|
+
* directly from the instance (which might have performance implications).
|
|
366
|
+
*/
|
|
367
|
+
readValue(key, target) {
|
|
368
|
+
let value = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : this.getBaseTargetFromProps(this.props, key) ?? this.readValueFromInstance(this.current, key, this.options);
|
|
369
|
+
if (value !== void 0 && value !== null) {
|
|
370
|
+
if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) {
|
|
371
|
+
value = parseFloat(value);
|
|
372
|
+
} else if (!findValueType(value) && complex.test(target)) {
|
|
373
|
+
value = getAnimatableNone(key, target);
|
|
374
|
+
}
|
|
375
|
+
this.setBaseTarget(key, isMotionValue(value) ? value.get() : value);
|
|
376
|
+
}
|
|
377
|
+
return isMotionValue(value) ? value.get() : value;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Set the base target to later animate back to. This is currently
|
|
381
|
+
* only hydrated on creation and when we first read a value.
|
|
382
|
+
*/
|
|
383
|
+
setBaseTarget(key, value) {
|
|
384
|
+
this.baseTarget[key] = value;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Find the base target for a value thats been removed from all animation
|
|
388
|
+
* props.
|
|
389
|
+
*/
|
|
390
|
+
getBaseTarget(key) {
|
|
391
|
+
const { initial } = this.props;
|
|
392
|
+
let valueFromInitial;
|
|
393
|
+
if (typeof initial === "string" || typeof initial === "object") {
|
|
394
|
+
const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom);
|
|
395
|
+
if (variant) {
|
|
396
|
+
valueFromInitial = variant[key];
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (initial && valueFromInitial !== void 0) {
|
|
400
|
+
return valueFromInitial;
|
|
401
|
+
}
|
|
402
|
+
const target = this.getBaseTargetFromProps(this.props, key);
|
|
403
|
+
if (target !== void 0 && !isMotionValue(target))
|
|
404
|
+
return target;
|
|
405
|
+
return this.initialValues[key] !== void 0 && valueFromInitial === void 0 ? void 0 : this.baseTarget[key];
|
|
406
|
+
}
|
|
407
|
+
on(eventName, callback) {
|
|
408
|
+
if (!this.events[eventName]) {
|
|
409
|
+
this.events[eventName] = new SubscriptionManager();
|
|
410
|
+
}
|
|
411
|
+
return this.events[eventName].add(callback);
|
|
412
|
+
}
|
|
413
|
+
notify(eventName, ...args) {
|
|
414
|
+
if (this.events[eventName]) {
|
|
415
|
+
this.events[eventName].notify(...args);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
scheduleRenderMicrotask() {
|
|
419
|
+
microtask.render(this.render);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
export {
|
|
423
|
+
VisualElement,
|
|
424
|
+
getFeatureDefinitions,
|
|
425
|
+
setFeatureDefinitions
|
|
426
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isMotionValue } from "../../value/utils/is-motion-value.js";
|
|
2
|
+
import { DOMKeyframesResolver } from "../../animation/keyframes/DOMKeyframesResolver.js";
|
|
3
|
+
import { VisualElement } from "../VisualElement.js";
|
|
4
|
+
class DOMVisualElement extends VisualElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.KeyframeResolver = DOMKeyframesResolver;
|
|
8
|
+
}
|
|
9
|
+
sortInstanceNodePosition(a, b) {
|
|
10
|
+
return a.compareDocumentPosition(b) & 2 ? 1 : -1;
|
|
11
|
+
}
|
|
12
|
+
getBaseTargetFromProps(props, key) {
|
|
13
|
+
const style = props.style;
|
|
14
|
+
return style ? style[key] : void 0;
|
|
15
|
+
}
|
|
16
|
+
removeValueFromRenderState(key, { vars, style }) {
|
|
17
|
+
delete vars[key];
|
|
18
|
+
delete style[key];
|
|
19
|
+
}
|
|
20
|
+
handleChildMotionValue() {
|
|
21
|
+
if (this.childSubscription) {
|
|
22
|
+
this.childSubscription();
|
|
23
|
+
delete this.childSubscription;
|
|
24
|
+
}
|
|
25
|
+
const { children } = this.props;
|
|
26
|
+
if (isMotionValue(children)) {
|
|
27
|
+
this.childSubscription = children.on("change", (latest) => {
|
|
28
|
+
if (this.current) {
|
|
29
|
+
this.current.textContent = `${latest}`;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
DOMVisualElement
|
|
37
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const radToDeg = (rad) => rad * 180 / Math.PI;
|
|
2
|
+
const rotate = (v) => {
|
|
3
|
+
const angle = radToDeg(Math.atan2(v[1], v[0]));
|
|
4
|
+
return rebaseAngle(angle);
|
|
5
|
+
};
|
|
6
|
+
const matrix2dParsers = {
|
|
7
|
+
x: 4,
|
|
8
|
+
y: 5,
|
|
9
|
+
translateX: 4,
|
|
10
|
+
translateY: 5,
|
|
11
|
+
scaleX: 0,
|
|
12
|
+
scaleY: 3,
|
|
13
|
+
scale: (v) => (Math.abs(v[0]) + Math.abs(v[3])) / 2,
|
|
14
|
+
rotate,
|
|
15
|
+
rotateZ: rotate,
|
|
16
|
+
skewX: (v) => radToDeg(Math.atan(v[1])),
|
|
17
|
+
skewY: (v) => radToDeg(Math.atan(v[2])),
|
|
18
|
+
skew: (v) => (Math.abs(v[1]) + Math.abs(v[2])) / 2
|
|
19
|
+
};
|
|
20
|
+
const rebaseAngle = (angle) => {
|
|
21
|
+
angle = angle % 360;
|
|
22
|
+
if (angle < 0)
|
|
23
|
+
angle += 360;
|
|
24
|
+
return angle;
|
|
25
|
+
};
|
|
26
|
+
const rotateZ = rotate;
|
|
27
|
+
const scaleX = (v) => Math.sqrt(v[0] * v[0] + v[1] * v[1]);
|
|
28
|
+
const scaleY = (v) => Math.sqrt(v[4] * v[4] + v[5] * v[5]);
|
|
29
|
+
const matrix3dParsers = {
|
|
30
|
+
x: 12,
|
|
31
|
+
y: 13,
|
|
32
|
+
z: 14,
|
|
33
|
+
translateX: 12,
|
|
34
|
+
translateY: 13,
|
|
35
|
+
translateZ: 14,
|
|
36
|
+
scaleX,
|
|
37
|
+
scaleY,
|
|
38
|
+
scale: (v) => (scaleX(v) + scaleY(v)) / 2,
|
|
39
|
+
rotateX: (v) => rebaseAngle(radToDeg(Math.atan2(v[6], v[5]))),
|
|
40
|
+
rotateY: (v) => rebaseAngle(radToDeg(Math.atan2(-v[2], v[0]))),
|
|
41
|
+
rotateZ,
|
|
42
|
+
rotate: rotateZ,
|
|
43
|
+
skewX: (v) => radToDeg(Math.atan(v[4])),
|
|
44
|
+
skewY: (v) => radToDeg(Math.atan(v[1])),
|
|
45
|
+
skew: (v) => (Math.abs(v[1]) + Math.abs(v[4])) / 2
|
|
46
|
+
};
|
|
47
|
+
function defaultTransformValue(name) {
|
|
48
|
+
return name.includes("scale") ? 1 : 0;
|
|
49
|
+
}
|
|
50
|
+
function parseValueFromTransform(transform, name) {
|
|
51
|
+
if (!transform || transform === "none") {
|
|
52
|
+
return defaultTransformValue(name);
|
|
53
|
+
}
|
|
54
|
+
const matrix3dMatch = transform.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
55
|
+
let parsers;
|
|
56
|
+
let match;
|
|
57
|
+
if (matrix3dMatch) {
|
|
58
|
+
parsers = matrix3dParsers;
|
|
59
|
+
match = matrix3dMatch;
|
|
60
|
+
} else {
|
|
61
|
+
const matrix2dMatch = transform.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
62
|
+
parsers = matrix2dParsers;
|
|
63
|
+
match = matrix2dMatch;
|
|
64
|
+
}
|
|
65
|
+
if (!match) {
|
|
66
|
+
return defaultTransformValue(name);
|
|
67
|
+
}
|
|
68
|
+
const valueParser = parsers[name];
|
|
69
|
+
const values = match[1].split(",").map(convertTransformToNumber);
|
|
70
|
+
return typeof valueParser === "function" ? valueParser(values) : values[valueParser];
|
|
71
|
+
}
|
|
72
|
+
const readTransformValue = (instance, name) => {
|
|
73
|
+
const { transform = "none" } = getComputedStyle(instance);
|
|
74
|
+
return parseValueFromTransform(transform, name);
|
|
75
|
+
};
|
|
76
|
+
function convertTransformToNumber(value) {
|
|
77
|
+
return parseFloat(value.trim());
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
defaultTransformValue,
|
|
81
|
+
parseValueFromTransform,
|
|
82
|
+
readTransformValue
|
|
83
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isCSSVariableName } from "../../animation/utils/is-css-variable.js";
|
|
2
|
+
import { transformProps } from "../utils/keys-transform.js";
|
|
3
|
+
import { defaultTransformValue, readTransformValue } from "../dom/parse-transform.js";
|
|
4
|
+
import { measureViewportBox } from "../../projection/utils/measure.js";
|
|
5
|
+
import { DOMVisualElement } from "../dom/DOMVisualElement.js";
|
|
6
|
+
import { buildHTMLStyles } from "./utils/build-styles.js";
|
|
7
|
+
import { renderHTML } from "./utils/render.js";
|
|
8
|
+
import { scrapeMotionValuesFromProps } from "./utils/scrape-motion-values.js";
|
|
9
|
+
function getComputedStyle(element) {
|
|
10
|
+
return window.getComputedStyle(element);
|
|
11
|
+
}
|
|
12
|
+
class HTMLVisualElement extends DOMVisualElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.type = "html";
|
|
16
|
+
this.renderInstance = renderHTML;
|
|
17
|
+
}
|
|
18
|
+
readValueFromInstance(instance, key) {
|
|
19
|
+
if (transformProps.has(key)) {
|
|
20
|
+
return this.projection?.isProjecting ? defaultTransformValue(key) : readTransformValue(instance, key);
|
|
21
|
+
} else {
|
|
22
|
+
const computedStyle = getComputedStyle(instance);
|
|
23
|
+
const value = (isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0;
|
|
24
|
+
return typeof value === "string" ? value.trim() : value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
measureInstanceViewportBox(instance, { transformPagePoint }) {
|
|
28
|
+
return measureViewportBox(instance, transformPagePoint);
|
|
29
|
+
}
|
|
30
|
+
build(renderState, latestValues, props) {
|
|
31
|
+
buildHTMLStyles(renderState, latestValues, props.transformTemplate);
|
|
32
|
+
}
|
|
33
|
+
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
34
|
+
return scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
HTMLVisualElement,
|
|
39
|
+
getComputedStyle
|
|
40
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getValueAsType } from "../../../value/types/utils/get-as-type.js";
|
|
2
|
+
import { numberValueTypes } from "../../../value/types/maps/number.js";
|
|
3
|
+
import { transformProps } from "../../utils/keys-transform.js";
|
|
4
|
+
import { isCSSVariableName } from "../../../animation/utils/is-css-variable.js";
|
|
5
|
+
import { buildTransform } from "./build-transform.js";
|
|
6
|
+
function buildHTMLStyles(state, latestValues, transformTemplate) {
|
|
7
|
+
const { style, vars, transformOrigin } = state;
|
|
8
|
+
let hasTransform = false;
|
|
9
|
+
let hasTransformOrigin = false;
|
|
10
|
+
for (const key in latestValues) {
|
|
11
|
+
const value = latestValues[key];
|
|
12
|
+
if (transformProps.has(key)) {
|
|
13
|
+
hasTransform = true;
|
|
14
|
+
continue;
|
|
15
|
+
} else if (isCSSVariableName(key)) {
|
|
16
|
+
vars[key] = value;
|
|
17
|
+
continue;
|
|
18
|
+
} else {
|
|
19
|
+
const valueAsType = getValueAsType(value, numberValueTypes[key]);
|
|
20
|
+
if (key.startsWith("origin")) {
|
|
21
|
+
hasTransformOrigin = true;
|
|
22
|
+
transformOrigin[key] = valueAsType;
|
|
23
|
+
} else {
|
|
24
|
+
style[key] = valueAsType;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!latestValues.transform) {
|
|
29
|
+
if (hasTransform || transformTemplate) {
|
|
30
|
+
style.transform = buildTransform(latestValues, state.transform, transformTemplate);
|
|
31
|
+
} else if (style.transform) {
|
|
32
|
+
style.transform = "none";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (hasTransformOrigin) {
|
|
36
|
+
const { originX = "50%", originY = "50%", originZ = 0 } = transformOrigin;
|
|
37
|
+
style.transformOrigin = `${originX} ${originY} ${originZ}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
buildHTMLStyles
|
|
42
|
+
};
|