@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
package/dist/es/shared-ui/node_modules/motion-dom/dist/es/projection/node/create-projection-node.js
ADDED
|
@@ -0,0 +1,1124 @@
|
|
|
1
|
+
import { animateSingleValue } from "../../animation/animate/single-value.js";
|
|
2
|
+
import { getOptimisedAppearId } from "../../animation/optimized-appear/get-appear-id.js";
|
|
3
|
+
import { getValueTransition } from "../../animation/utils/get-value-transition.js";
|
|
4
|
+
import { microtask } from "../../frameloop/microtask.js";
|
|
5
|
+
import { time } from "../../frameloop/sync-time.js";
|
|
6
|
+
import { scaleCorrectors } from "../styles/scale-correction.js";
|
|
7
|
+
import { delay } from "../../utils/delay.js";
|
|
8
|
+
import { isSVGElement } from "../../utils/is-svg-element.js";
|
|
9
|
+
import { isSVGSVGElement } from "../../utils/is-svg-svg-element.js";
|
|
10
|
+
import { mixNumber } from "../../utils/mix/number.js";
|
|
11
|
+
import { motionValue } from "../../value/index.js";
|
|
12
|
+
import { resolveMotionValue } from "../../value/utils/resolve-motion-value.js";
|
|
13
|
+
import { mixValues } from "../animation/mix-values.js";
|
|
14
|
+
import { copyBoxInto, copyAxisDeltaInto, copyAxisInto } from "../geometry/copy.js";
|
|
15
|
+
import { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from "../geometry/delta-apply.js";
|
|
16
|
+
import { calcLength, calcRelativeBox, calcRelativePosition, calcBoxDelta, isNear } from "../geometry/delta-calc.js";
|
|
17
|
+
import { removeBoxTransforms } from "../geometry/delta-remove.js";
|
|
18
|
+
import { createBox, createDelta } from "../geometry/models.js";
|
|
19
|
+
import { boxEqualsRounded, isDeltaZero, axisDeltaEquals, boxEquals, aspectRatio } from "../geometry/utils.js";
|
|
20
|
+
import { NodeStack } from "../shared/stack.js";
|
|
21
|
+
import { buildProjectionTransform } from "../styles/transform.js";
|
|
22
|
+
import { eachAxis } from "../utils/each-axis.js";
|
|
23
|
+
import { FlatTree } from "../utils/flat-tree.js";
|
|
24
|
+
import { hasTransform, hasScale, has2DTranslate } from "../utils/has-transform.js";
|
|
25
|
+
import { globalProjectionState } from "./state.js";
|
|
26
|
+
import { frame, cancelFrame, frameSteps, frameData } from "../../frameloop/frame.js";
|
|
27
|
+
import { SubscriptionManager } from "../../../../../motion-utils/dist/es/subscription-manager.js";
|
|
28
|
+
import { clamp } from "../../../../../motion-utils/dist/es/clamp.js";
|
|
29
|
+
import { noop } from "../../../../../motion-utils/dist/es/noop.js";
|
|
30
|
+
const transformAxes = ["", "X", "Y", "Z"];
|
|
31
|
+
const animationTarget = 1e3;
|
|
32
|
+
let id = 0;
|
|
33
|
+
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
|
|
34
|
+
const { latestValues } = visualElement;
|
|
35
|
+
if (latestValues[key]) {
|
|
36
|
+
values[key] = latestValues[key];
|
|
37
|
+
visualElement.setStaticValue(key, 0);
|
|
38
|
+
if (sharedAnimationValues) {
|
|
39
|
+
sharedAnimationValues[key] = 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function cancelTreeOptimisedTransformAnimations(projectionNode) {
|
|
44
|
+
projectionNode.hasCheckedOptimisedAppear = true;
|
|
45
|
+
if (projectionNode.root === projectionNode)
|
|
46
|
+
return;
|
|
47
|
+
const { visualElement } = projectionNode.options;
|
|
48
|
+
if (!visualElement)
|
|
49
|
+
return;
|
|
50
|
+
const appearId = getOptimisedAppearId(visualElement);
|
|
51
|
+
if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
|
|
52
|
+
const { layout, layoutId } = projectionNode.options;
|
|
53
|
+
window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId));
|
|
54
|
+
}
|
|
55
|
+
const { parent } = projectionNode;
|
|
56
|
+
if (parent && !parent.hasCheckedOptimisedAppear) {
|
|
57
|
+
cancelTreeOptimisedTransformAnimations(parent);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform }) {
|
|
61
|
+
return class ProjectionNode {
|
|
62
|
+
constructor(latestValues = {}, parent = defaultParent?.()) {
|
|
63
|
+
this.id = id++;
|
|
64
|
+
this.animationId = 0;
|
|
65
|
+
this.animationCommitId = 0;
|
|
66
|
+
this.children = /* @__PURE__ */ new Set();
|
|
67
|
+
this.options = {};
|
|
68
|
+
this.isTreeAnimating = false;
|
|
69
|
+
this.isAnimationBlocked = false;
|
|
70
|
+
this.isLayoutDirty = false;
|
|
71
|
+
this.isProjectionDirty = false;
|
|
72
|
+
this.isSharedProjectionDirty = false;
|
|
73
|
+
this.isTransformDirty = false;
|
|
74
|
+
this.updateManuallyBlocked = false;
|
|
75
|
+
this.updateBlockedByResize = false;
|
|
76
|
+
this.isUpdating = false;
|
|
77
|
+
this.isSVG = false;
|
|
78
|
+
this.needsReset = false;
|
|
79
|
+
this.shouldResetTransform = false;
|
|
80
|
+
this.hasCheckedOptimisedAppear = false;
|
|
81
|
+
this.treeScale = { x: 1, y: 1 };
|
|
82
|
+
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
83
|
+
this.hasTreeAnimated = false;
|
|
84
|
+
this.layoutVersion = 0;
|
|
85
|
+
this.updateScheduled = false;
|
|
86
|
+
this.scheduleUpdate = () => this.update();
|
|
87
|
+
this.projectionUpdateScheduled = false;
|
|
88
|
+
this.checkUpdateFailed = () => {
|
|
89
|
+
if (this.isUpdating) {
|
|
90
|
+
this.isUpdating = false;
|
|
91
|
+
this.clearAllSnapshots();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
this.updateProjection = () => {
|
|
95
|
+
this.projectionUpdateScheduled = false;
|
|
96
|
+
this.nodes.forEach(propagateDirtyNodes);
|
|
97
|
+
this.nodes.forEach(resolveTargetDelta);
|
|
98
|
+
this.nodes.forEach(calcProjection);
|
|
99
|
+
this.nodes.forEach(cleanDirtyNodes);
|
|
100
|
+
};
|
|
101
|
+
this.resolvedRelativeTargetAt = 0;
|
|
102
|
+
this.linkedParentVersion = 0;
|
|
103
|
+
this.hasProjected = false;
|
|
104
|
+
this.isVisible = true;
|
|
105
|
+
this.animationProgress = 0;
|
|
106
|
+
this.sharedNodes = /* @__PURE__ */ new Map();
|
|
107
|
+
this.latestValues = latestValues;
|
|
108
|
+
this.root = parent ? parent.root || parent : this;
|
|
109
|
+
this.path = parent ? [...parent.path, parent] : [];
|
|
110
|
+
this.parent = parent;
|
|
111
|
+
this.depth = parent ? parent.depth + 1 : 0;
|
|
112
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
113
|
+
this.path[i].shouldResetTransform = true;
|
|
114
|
+
}
|
|
115
|
+
if (this.root === this)
|
|
116
|
+
this.nodes = new FlatTree();
|
|
117
|
+
}
|
|
118
|
+
addEventListener(name, handler) {
|
|
119
|
+
if (!this.eventHandlers.has(name)) {
|
|
120
|
+
this.eventHandlers.set(name, new SubscriptionManager());
|
|
121
|
+
}
|
|
122
|
+
return this.eventHandlers.get(name).add(handler);
|
|
123
|
+
}
|
|
124
|
+
notifyListeners(name, ...args) {
|
|
125
|
+
const subscriptionManager = this.eventHandlers.get(name);
|
|
126
|
+
subscriptionManager && subscriptionManager.notify(...args);
|
|
127
|
+
}
|
|
128
|
+
hasListeners(name) {
|
|
129
|
+
return this.eventHandlers.has(name);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Lifecycles
|
|
133
|
+
*/
|
|
134
|
+
mount(instance) {
|
|
135
|
+
if (this.instance)
|
|
136
|
+
return;
|
|
137
|
+
this.isSVG = isSVGElement(instance) && !isSVGSVGElement(instance);
|
|
138
|
+
this.instance = instance;
|
|
139
|
+
const { layoutId, layout, visualElement } = this.options;
|
|
140
|
+
if (visualElement && !visualElement.current) {
|
|
141
|
+
visualElement.mount(instance);
|
|
142
|
+
}
|
|
143
|
+
this.root.nodes.add(this);
|
|
144
|
+
this.parent && this.parent.children.add(this);
|
|
145
|
+
if (this.root.hasTreeAnimated && (layout || layoutId)) {
|
|
146
|
+
this.isLayoutDirty = true;
|
|
147
|
+
}
|
|
148
|
+
if (attachResizeListener) {
|
|
149
|
+
let cancelDelay;
|
|
150
|
+
let innerWidth = 0;
|
|
151
|
+
const resizeUnblockUpdate = () => this.root.updateBlockedByResize = false;
|
|
152
|
+
frame.read(() => {
|
|
153
|
+
innerWidth = window.innerWidth;
|
|
154
|
+
});
|
|
155
|
+
attachResizeListener(instance, () => {
|
|
156
|
+
const newInnerWidth = window.innerWidth;
|
|
157
|
+
if (newInnerWidth === innerWidth)
|
|
158
|
+
return;
|
|
159
|
+
innerWidth = newInnerWidth;
|
|
160
|
+
this.root.updateBlockedByResize = true;
|
|
161
|
+
cancelDelay && cancelDelay();
|
|
162
|
+
cancelDelay = delay(resizeUnblockUpdate, 250);
|
|
163
|
+
if (globalProjectionState.hasAnimatedSinceResize) {
|
|
164
|
+
globalProjectionState.hasAnimatedSinceResize = false;
|
|
165
|
+
this.nodes.forEach(finishAnimation);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (layoutId) {
|
|
170
|
+
this.root.registerSharedNode(layoutId, this);
|
|
171
|
+
}
|
|
172
|
+
if (this.options.animate !== false && visualElement && (layoutId || layout)) {
|
|
173
|
+
this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeLayoutChanged, layout: newLayout }) => {
|
|
174
|
+
if (this.isTreeAnimationBlocked()) {
|
|
175
|
+
this.target = void 0;
|
|
176
|
+
this.relativeTarget = void 0;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const layoutTransition = this.options.transition || visualElement.getDefaultTransition() || defaultLayoutTransition;
|
|
180
|
+
const { onLayoutAnimationStart, onLayoutAnimationComplete } = visualElement.getProps();
|
|
181
|
+
const hasTargetChanged = !this.targetLayout || !boxEqualsRounded(this.targetLayout, newLayout);
|
|
182
|
+
const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeLayoutChanged;
|
|
183
|
+
if (this.options.layoutRoot || this.resumeFrom || hasOnlyRelativeTargetChanged || hasLayoutChanged && (hasTargetChanged || !this.currentAnimation)) {
|
|
184
|
+
if (this.resumeFrom) {
|
|
185
|
+
this.resumingFrom = this.resumeFrom;
|
|
186
|
+
this.resumingFrom.resumingFrom = void 0;
|
|
187
|
+
}
|
|
188
|
+
const animationOptions = {
|
|
189
|
+
...getValueTransition(layoutTransition, "layout"),
|
|
190
|
+
onPlay: onLayoutAnimationStart,
|
|
191
|
+
onComplete: onLayoutAnimationComplete
|
|
192
|
+
};
|
|
193
|
+
if (visualElement.shouldReduceMotion || this.options.layoutRoot) {
|
|
194
|
+
animationOptions.delay = 0;
|
|
195
|
+
animationOptions.type = false;
|
|
196
|
+
}
|
|
197
|
+
this.startAnimation(animationOptions);
|
|
198
|
+
this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged, animationOptions.path);
|
|
199
|
+
} else {
|
|
200
|
+
if (!hasLayoutChanged) {
|
|
201
|
+
finishAnimation(this);
|
|
202
|
+
}
|
|
203
|
+
if (this.isLead() && this.options.onExitComplete) {
|
|
204
|
+
this.options.onExitComplete();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
this.targetLayout = newLayout;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
unmount() {
|
|
212
|
+
this.options.layoutId && this.willUpdate();
|
|
213
|
+
this.root.nodes.remove(this);
|
|
214
|
+
const stack = this.getStack();
|
|
215
|
+
stack && stack.remove(this);
|
|
216
|
+
this.parent && this.parent.children.delete(this);
|
|
217
|
+
this.instance = void 0;
|
|
218
|
+
this.eventHandlers.clear();
|
|
219
|
+
cancelFrame(this.updateProjection);
|
|
220
|
+
}
|
|
221
|
+
// only on the root
|
|
222
|
+
blockUpdate() {
|
|
223
|
+
this.updateManuallyBlocked = true;
|
|
224
|
+
}
|
|
225
|
+
unblockUpdate() {
|
|
226
|
+
this.updateManuallyBlocked = false;
|
|
227
|
+
}
|
|
228
|
+
isUpdateBlocked() {
|
|
229
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
230
|
+
}
|
|
231
|
+
isTreeAnimationBlocked() {
|
|
232
|
+
return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || false;
|
|
233
|
+
}
|
|
234
|
+
// Note: currently only running on root node
|
|
235
|
+
startUpdate() {
|
|
236
|
+
if (this.isUpdateBlocked())
|
|
237
|
+
return;
|
|
238
|
+
this.isUpdating = true;
|
|
239
|
+
this.nodes && this.nodes.forEach(resetSkewAndRotation);
|
|
240
|
+
this.animationId++;
|
|
241
|
+
}
|
|
242
|
+
getTransformTemplate() {
|
|
243
|
+
const { visualElement } = this.options;
|
|
244
|
+
return visualElement && visualElement.getProps().transformTemplate;
|
|
245
|
+
}
|
|
246
|
+
willUpdate(shouldNotifyListeners = true) {
|
|
247
|
+
this.root.hasTreeAnimated = true;
|
|
248
|
+
if (this.root.isUpdateBlocked()) {
|
|
249
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear) {
|
|
253
|
+
cancelTreeOptimisedTransformAnimations(this);
|
|
254
|
+
}
|
|
255
|
+
!this.root.isUpdating && this.root.startUpdate();
|
|
256
|
+
if (this.isLayoutDirty)
|
|
257
|
+
return;
|
|
258
|
+
this.isLayoutDirty = true;
|
|
259
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
260
|
+
const node = this.path[i];
|
|
261
|
+
node.shouldResetTransform = true;
|
|
262
|
+
if (typeof node.latestValues.x === "string" || typeof node.latestValues.y === "string") {
|
|
263
|
+
node.isLayoutDirty = true;
|
|
264
|
+
}
|
|
265
|
+
node.updateScroll("snapshot");
|
|
266
|
+
if (node.options.layoutRoot) {
|
|
267
|
+
node.willUpdate(false);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const { layoutId, layout } = this.options;
|
|
271
|
+
if (layoutId === void 0 && !layout)
|
|
272
|
+
return;
|
|
273
|
+
const transformTemplate = this.getTransformTemplate();
|
|
274
|
+
this.prevTransformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
|
|
275
|
+
this.updateSnapshot();
|
|
276
|
+
shouldNotifyListeners && this.notifyListeners("willUpdate");
|
|
277
|
+
}
|
|
278
|
+
update() {
|
|
279
|
+
this.updateScheduled = false;
|
|
280
|
+
const updateWasBlocked = this.isUpdateBlocked();
|
|
281
|
+
if (updateWasBlocked) {
|
|
282
|
+
const wasBlockedByResize = this.updateBlockedByResize;
|
|
283
|
+
this.unblockUpdate();
|
|
284
|
+
this.updateBlockedByResize = false;
|
|
285
|
+
this.clearAllSnapshots();
|
|
286
|
+
if (wasBlockedByResize) {
|
|
287
|
+
this.nodes.forEach(forceLayoutMeasure);
|
|
288
|
+
}
|
|
289
|
+
this.nodes.forEach(clearMeasurements);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (this.animationId <= this.animationCommitId) {
|
|
293
|
+
this.nodes.forEach(clearIsLayoutDirty);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
this.animationCommitId = this.animationId;
|
|
297
|
+
if (!this.isUpdating) {
|
|
298
|
+
this.nodes.forEach(clearIsLayoutDirty);
|
|
299
|
+
} else {
|
|
300
|
+
this.isUpdating = false;
|
|
301
|
+
this.nodes.forEach(ensureDraggedNodesSnapshotted);
|
|
302
|
+
this.nodes.forEach(resetTransformStyle);
|
|
303
|
+
this.nodes.forEach(updateLayout);
|
|
304
|
+
this.nodes.forEach(notifyLayoutUpdate);
|
|
305
|
+
}
|
|
306
|
+
this.clearAllSnapshots();
|
|
307
|
+
const now = time.now();
|
|
308
|
+
frameData.delta = clamp(0, 1e3 / 60, now - frameData.timestamp);
|
|
309
|
+
frameData.timestamp = now;
|
|
310
|
+
frameData.isProcessing = true;
|
|
311
|
+
frameSteps.update.process(frameData);
|
|
312
|
+
frameSteps.preRender.process(frameData);
|
|
313
|
+
frameSteps.render.process(frameData);
|
|
314
|
+
frameData.isProcessing = false;
|
|
315
|
+
}
|
|
316
|
+
didUpdate() {
|
|
317
|
+
if (!this.updateScheduled) {
|
|
318
|
+
this.updateScheduled = true;
|
|
319
|
+
microtask.read(this.scheduleUpdate);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
clearAllSnapshots() {
|
|
323
|
+
this.nodes.forEach(clearSnapshot);
|
|
324
|
+
this.sharedNodes.forEach(removeLeadSnapshots);
|
|
325
|
+
}
|
|
326
|
+
scheduleUpdateProjection() {
|
|
327
|
+
if (!this.projectionUpdateScheduled) {
|
|
328
|
+
this.projectionUpdateScheduled = true;
|
|
329
|
+
frame.preRender(this.updateProjection, false, true);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
scheduleCheckAfterUnmount() {
|
|
333
|
+
frame.postRender(() => {
|
|
334
|
+
if (this.isLayoutDirty) {
|
|
335
|
+
this.root.didUpdate();
|
|
336
|
+
} else {
|
|
337
|
+
this.root.checkUpdateFailed();
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Update measurements
|
|
343
|
+
*/
|
|
344
|
+
updateSnapshot() {
|
|
345
|
+
if (this.snapshot || !this.instance)
|
|
346
|
+
return;
|
|
347
|
+
this.snapshot = this.measure();
|
|
348
|
+
if (this.snapshot && !calcLength(this.snapshot.measuredBox.x) && !calcLength(this.snapshot.measuredBox.y)) {
|
|
349
|
+
this.snapshot = void 0;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
updateLayout() {
|
|
353
|
+
if (!this.instance)
|
|
354
|
+
return;
|
|
355
|
+
this.updateScroll();
|
|
356
|
+
if (!(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (this.resumeFrom && !this.resumeFrom.instance) {
|
|
360
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
361
|
+
const node = this.path[i];
|
|
362
|
+
node.updateScroll();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const prevLayout = this.layout;
|
|
366
|
+
this.layout = this.measure(false);
|
|
367
|
+
this.layoutVersion++;
|
|
368
|
+
if (!this.layoutCorrected)
|
|
369
|
+
this.layoutCorrected = createBox();
|
|
370
|
+
this.isLayoutDirty = false;
|
|
371
|
+
this.projectionDelta = void 0;
|
|
372
|
+
this.notifyListeners("measure", this.layout.layoutBox);
|
|
373
|
+
const { visualElement } = this.options;
|
|
374
|
+
visualElement && visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : void 0);
|
|
375
|
+
}
|
|
376
|
+
updateScroll(phase = "measure") {
|
|
377
|
+
let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
|
|
378
|
+
if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === phase) {
|
|
379
|
+
needsMeasurement = false;
|
|
380
|
+
}
|
|
381
|
+
if (needsMeasurement && this.instance) {
|
|
382
|
+
const isRoot = checkIsScrollRoot(this.instance);
|
|
383
|
+
this.scroll = {
|
|
384
|
+
animationId: this.root.animationId,
|
|
385
|
+
phase,
|
|
386
|
+
isRoot,
|
|
387
|
+
offset: measureScroll(this.instance),
|
|
388
|
+
wasRoot: this.scroll ? this.scroll.isRoot : isRoot
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
resetTransform() {
|
|
393
|
+
if (!resetTransform)
|
|
394
|
+
return;
|
|
395
|
+
const isResetRequested = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout;
|
|
396
|
+
const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
|
|
397
|
+
const transformTemplate = this.getTransformTemplate();
|
|
398
|
+
const transformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
|
|
399
|
+
const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
|
|
400
|
+
if (isResetRequested && this.instance && (hasProjection || hasTransform(this.latestValues) || transformTemplateHasChanged)) {
|
|
401
|
+
resetTransform(this.instance, transformTemplateValue);
|
|
402
|
+
this.shouldResetTransform = false;
|
|
403
|
+
this.scheduleRender();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
measure(removeTransform = true) {
|
|
407
|
+
const pageBox = this.measurePageBox();
|
|
408
|
+
let layoutBox = this.removeElementScroll(pageBox);
|
|
409
|
+
if (removeTransform) {
|
|
410
|
+
layoutBox = this.removeTransform(layoutBox);
|
|
411
|
+
}
|
|
412
|
+
roundBox(layoutBox);
|
|
413
|
+
return {
|
|
414
|
+
animationId: this.root.animationId,
|
|
415
|
+
measuredBox: pageBox,
|
|
416
|
+
layoutBox,
|
|
417
|
+
latestValues: {},
|
|
418
|
+
source: this.id
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
measurePageBox() {
|
|
422
|
+
const { visualElement } = this.options;
|
|
423
|
+
if (!visualElement)
|
|
424
|
+
return createBox();
|
|
425
|
+
const box = visualElement.measureViewportBox();
|
|
426
|
+
const wasInScrollRoot = this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot);
|
|
427
|
+
if (!wasInScrollRoot) {
|
|
428
|
+
const { scroll } = this.root;
|
|
429
|
+
if (scroll) {
|
|
430
|
+
translateAxis(box.x, scroll.offset.x);
|
|
431
|
+
translateAxis(box.y, scroll.offset.y);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return box;
|
|
435
|
+
}
|
|
436
|
+
removeElementScroll(box) {
|
|
437
|
+
const boxWithoutScroll = createBox();
|
|
438
|
+
copyBoxInto(boxWithoutScroll, box);
|
|
439
|
+
if (this.scroll?.wasRoot) {
|
|
440
|
+
return boxWithoutScroll;
|
|
441
|
+
}
|
|
442
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
443
|
+
const node = this.path[i];
|
|
444
|
+
const { scroll, options } = node;
|
|
445
|
+
if (node !== this.root && scroll && options.layoutScroll) {
|
|
446
|
+
if (scroll.wasRoot) {
|
|
447
|
+
copyBoxInto(boxWithoutScroll, box);
|
|
448
|
+
}
|
|
449
|
+
translateAxis(boxWithoutScroll.x, scroll.offset.x);
|
|
450
|
+
translateAxis(boxWithoutScroll.y, scroll.offset.y);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return boxWithoutScroll;
|
|
454
|
+
}
|
|
455
|
+
applyTransform(box, transformOnly = false, output) {
|
|
456
|
+
const withTransforms = output || createBox();
|
|
457
|
+
copyBoxInto(withTransforms, box);
|
|
458
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
459
|
+
const node = this.path[i];
|
|
460
|
+
if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) {
|
|
461
|
+
translateAxis(withTransforms.x, -node.scroll.offset.x);
|
|
462
|
+
translateAxis(withTransforms.y, -node.scroll.offset.y);
|
|
463
|
+
}
|
|
464
|
+
if (!hasTransform(node.latestValues))
|
|
465
|
+
continue;
|
|
466
|
+
transformBox(withTransforms, node.latestValues, node.layout?.layoutBox);
|
|
467
|
+
}
|
|
468
|
+
if (hasTransform(this.latestValues)) {
|
|
469
|
+
transformBox(withTransforms, this.latestValues, this.layout?.layoutBox);
|
|
470
|
+
}
|
|
471
|
+
return withTransforms;
|
|
472
|
+
}
|
|
473
|
+
removeTransform(box) {
|
|
474
|
+
const boxWithoutTransform = createBox();
|
|
475
|
+
copyBoxInto(boxWithoutTransform, box);
|
|
476
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
477
|
+
const node = this.path[i];
|
|
478
|
+
if (!hasTransform(node.latestValues))
|
|
479
|
+
continue;
|
|
480
|
+
let sourceBox;
|
|
481
|
+
if (node.instance) {
|
|
482
|
+
hasScale(node.latestValues) && node.updateSnapshot();
|
|
483
|
+
sourceBox = createBox();
|
|
484
|
+
copyBoxInto(sourceBox, node.measurePageBox());
|
|
485
|
+
}
|
|
486
|
+
removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot?.layoutBox, sourceBox);
|
|
487
|
+
}
|
|
488
|
+
if (hasTransform(this.latestValues)) {
|
|
489
|
+
removeBoxTransforms(boxWithoutTransform, this.latestValues);
|
|
490
|
+
}
|
|
491
|
+
return boxWithoutTransform;
|
|
492
|
+
}
|
|
493
|
+
setTargetDelta(delta) {
|
|
494
|
+
this.targetDelta = delta;
|
|
495
|
+
this.root.scheduleUpdateProjection();
|
|
496
|
+
this.isProjectionDirty = true;
|
|
497
|
+
}
|
|
498
|
+
setOptions(options) {
|
|
499
|
+
this.options = {
|
|
500
|
+
...this.options,
|
|
501
|
+
...options,
|
|
502
|
+
crossfade: options.crossfade !== void 0 ? options.crossfade : true
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
clearMeasurements() {
|
|
506
|
+
this.scroll = void 0;
|
|
507
|
+
this.layout = void 0;
|
|
508
|
+
this.snapshot = void 0;
|
|
509
|
+
this.prevTransformTemplateValue = void 0;
|
|
510
|
+
this.targetDelta = void 0;
|
|
511
|
+
this.target = void 0;
|
|
512
|
+
this.isLayoutDirty = false;
|
|
513
|
+
}
|
|
514
|
+
forceRelativeParentToResolveTarget() {
|
|
515
|
+
if (!this.relativeParent)
|
|
516
|
+
return;
|
|
517
|
+
if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) {
|
|
518
|
+
this.relativeParent.resolveTargetDelta(true);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
resolveTargetDelta(forceRecalculation = false) {
|
|
522
|
+
const lead = this.getLead();
|
|
523
|
+
this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
|
|
524
|
+
this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
|
|
525
|
+
this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
|
|
526
|
+
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
527
|
+
const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
|
|
528
|
+
if (canSkip)
|
|
529
|
+
return;
|
|
530
|
+
const { layout, layoutId } = this.options;
|
|
531
|
+
if (!this.layout || !(layout || layoutId))
|
|
532
|
+
return;
|
|
533
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
534
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
535
|
+
if (relativeParent && this.linkedParentVersion !== relativeParent.layoutVersion && !relativeParent.options.layoutRoot) {
|
|
536
|
+
this.removeRelativeTarget();
|
|
537
|
+
}
|
|
538
|
+
if (!this.targetDelta && !this.relativeTarget) {
|
|
539
|
+
if (this.options.layoutAnchor !== false && relativeParent && relativeParent.layout) {
|
|
540
|
+
this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
541
|
+
} else {
|
|
542
|
+
this.removeRelativeTarget();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (!this.relativeTarget && !this.targetDelta)
|
|
546
|
+
return;
|
|
547
|
+
if (!this.target) {
|
|
548
|
+
this.target = createBox();
|
|
549
|
+
this.targetWithTransforms = createBox();
|
|
550
|
+
}
|
|
551
|
+
if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) {
|
|
552
|
+
this.forceRelativeParentToResolveTarget();
|
|
553
|
+
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0);
|
|
554
|
+
} else if (this.targetDelta) {
|
|
555
|
+
if (Boolean(this.resumingFrom)) {
|
|
556
|
+
this.applyTransform(this.layout.layoutBox, false, this.target);
|
|
557
|
+
} else {
|
|
558
|
+
copyBoxInto(this.target, this.layout.layoutBox);
|
|
559
|
+
}
|
|
560
|
+
applyBoxDelta(this.target, this.targetDelta);
|
|
561
|
+
} else {
|
|
562
|
+
copyBoxInto(this.target, this.layout.layoutBox);
|
|
563
|
+
}
|
|
564
|
+
if (this.attemptToResolveRelativeTarget) {
|
|
565
|
+
this.attemptToResolveRelativeTarget = false;
|
|
566
|
+
if (this.options.layoutAnchor !== false && relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
|
|
567
|
+
this.createRelativeTarget(relativeParent, this.target, relativeParent.target);
|
|
568
|
+
} else {
|
|
569
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
getClosestProjectingParent() {
|
|
574
|
+
if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
|
|
575
|
+
return void 0;
|
|
576
|
+
}
|
|
577
|
+
if (this.parent.isProjecting()) {
|
|
578
|
+
return this.parent;
|
|
579
|
+
} else {
|
|
580
|
+
return this.parent.getClosestProjectingParent();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
isProjecting() {
|
|
584
|
+
return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
585
|
+
}
|
|
586
|
+
createRelativeTarget(relativeParent, layout, parentLayout) {
|
|
587
|
+
this.relativeParent = relativeParent;
|
|
588
|
+
this.linkedParentVersion = relativeParent.layoutVersion;
|
|
589
|
+
this.forceRelativeParentToResolveTarget();
|
|
590
|
+
this.relativeTarget = createBox();
|
|
591
|
+
this.relativeTargetOrigin = createBox();
|
|
592
|
+
calcRelativePosition(this.relativeTargetOrigin, layout, parentLayout, this.options.layoutAnchor || void 0);
|
|
593
|
+
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
594
|
+
}
|
|
595
|
+
removeRelativeTarget() {
|
|
596
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
597
|
+
}
|
|
598
|
+
calcProjection() {
|
|
599
|
+
const lead = this.getLead();
|
|
600
|
+
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
601
|
+
let canSkip = true;
|
|
602
|
+
if (this.isProjectionDirty || this.parent?.isProjectionDirty) {
|
|
603
|
+
canSkip = false;
|
|
604
|
+
}
|
|
605
|
+
if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
606
|
+
canSkip = false;
|
|
607
|
+
}
|
|
608
|
+
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
|
|
609
|
+
canSkip = false;
|
|
610
|
+
}
|
|
611
|
+
if (canSkip)
|
|
612
|
+
return;
|
|
613
|
+
const { layout, layoutId } = this.options;
|
|
614
|
+
this.isTreeAnimating = Boolean(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation);
|
|
615
|
+
if (!this.isTreeAnimating) {
|
|
616
|
+
this.targetDelta = this.relativeTarget = void 0;
|
|
617
|
+
}
|
|
618
|
+
if (!this.layout || !(layout || layoutId))
|
|
619
|
+
return;
|
|
620
|
+
copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
|
|
621
|
+
const prevTreeScaleX = this.treeScale.x;
|
|
622
|
+
const prevTreeScaleY = this.treeScale.y;
|
|
623
|
+
applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
|
|
624
|
+
if (lead.layout && !lead.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
|
|
625
|
+
lead.target = lead.layout.layoutBox;
|
|
626
|
+
lead.targetWithTransforms = createBox();
|
|
627
|
+
}
|
|
628
|
+
const { target } = lead;
|
|
629
|
+
if (!target) {
|
|
630
|
+
if (this.prevProjectionDelta) {
|
|
631
|
+
this.createProjectionDeltas();
|
|
632
|
+
this.scheduleRender();
|
|
633
|
+
}
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
if (!this.projectionDelta || !this.prevProjectionDelta) {
|
|
637
|
+
this.createProjectionDeltas();
|
|
638
|
+
} else {
|
|
639
|
+
copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
|
|
640
|
+
copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
|
|
641
|
+
}
|
|
642
|
+
calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
|
|
643
|
+
if (this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
|
|
644
|
+
this.hasProjected = true;
|
|
645
|
+
this.scheduleRender();
|
|
646
|
+
this.notifyListeners("projectionUpdate", target);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
hide() {
|
|
650
|
+
this.isVisible = false;
|
|
651
|
+
}
|
|
652
|
+
show() {
|
|
653
|
+
this.isVisible = true;
|
|
654
|
+
}
|
|
655
|
+
scheduleRender(notifyAll = true) {
|
|
656
|
+
this.options.visualElement?.scheduleRender();
|
|
657
|
+
if (notifyAll) {
|
|
658
|
+
const stack = this.getStack();
|
|
659
|
+
stack && stack.scheduleRender();
|
|
660
|
+
}
|
|
661
|
+
if (this.resumingFrom && !this.resumingFrom.instance) {
|
|
662
|
+
this.resumingFrom = void 0;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
createProjectionDeltas() {
|
|
666
|
+
this.prevProjectionDelta = createDelta();
|
|
667
|
+
this.projectionDelta = createDelta();
|
|
668
|
+
this.projectionDeltaWithTransform = createDelta();
|
|
669
|
+
}
|
|
670
|
+
setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false, pathFn) {
|
|
671
|
+
const snapshot = this.snapshot;
|
|
672
|
+
const snapshotLatestValues = snapshot ? snapshot.latestValues : {};
|
|
673
|
+
const mixedValues = { ...this.latestValues };
|
|
674
|
+
const targetDelta = createDelta();
|
|
675
|
+
if (!this.relativeParent || !this.relativeParent.options.layoutRoot) {
|
|
676
|
+
this.relativeTarget = this.relativeTargetOrigin = void 0;
|
|
677
|
+
}
|
|
678
|
+
this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
|
|
679
|
+
const relativeLayout = createBox();
|
|
680
|
+
const snapshotSource = snapshot ? snapshot.source : void 0;
|
|
681
|
+
const layoutSource = this.layout ? this.layout.source : void 0;
|
|
682
|
+
const isSharedLayoutAnimation = snapshotSource !== layoutSource;
|
|
683
|
+
const stack = this.getStack();
|
|
684
|
+
const isOnlyMember = !stack || stack.members.length <= 1;
|
|
685
|
+
const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade));
|
|
686
|
+
this.animationProgress = 0;
|
|
687
|
+
let prevRelativeTarget;
|
|
688
|
+
const interpolate = pathFn?.interpolateProjection(delta);
|
|
689
|
+
this.mixTargetDelta = (latest) => {
|
|
690
|
+
const progress = latest / 1e3;
|
|
691
|
+
const point = interpolate?.(progress);
|
|
692
|
+
if (point) {
|
|
693
|
+
targetDelta.x.translate = point.x;
|
|
694
|
+
targetDelta.x.scale = mixNumber(delta.x.scale, 1, progress);
|
|
695
|
+
targetDelta.x.origin = delta.x.origin;
|
|
696
|
+
targetDelta.x.originPoint = delta.x.originPoint;
|
|
697
|
+
targetDelta.y.translate = point.y;
|
|
698
|
+
targetDelta.y.scale = mixNumber(delta.y.scale, 1, progress);
|
|
699
|
+
targetDelta.y.origin = delta.y.origin;
|
|
700
|
+
targetDelta.y.originPoint = delta.y.originPoint;
|
|
701
|
+
} else {
|
|
702
|
+
mixAxisDeltaLinear(targetDelta.x, delta.x, progress);
|
|
703
|
+
mixAxisDeltaLinear(targetDelta.y, delta.y, progress);
|
|
704
|
+
}
|
|
705
|
+
this.setTargetDelta(targetDelta);
|
|
706
|
+
if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) {
|
|
707
|
+
calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0);
|
|
708
|
+
mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);
|
|
709
|
+
if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) {
|
|
710
|
+
this.isProjectionDirty = false;
|
|
711
|
+
}
|
|
712
|
+
if (!prevRelativeTarget)
|
|
713
|
+
prevRelativeTarget = createBox();
|
|
714
|
+
copyBoxInto(prevRelativeTarget, this.relativeTarget);
|
|
715
|
+
}
|
|
716
|
+
if (isSharedLayoutAnimation) {
|
|
717
|
+
this.animationValues = mixedValues;
|
|
718
|
+
mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
|
|
719
|
+
}
|
|
720
|
+
if (point && point.rotate !== void 0) {
|
|
721
|
+
if (!this.animationValues)
|
|
722
|
+
this.animationValues = mixedValues;
|
|
723
|
+
this.animationValues.pathRotation = point.rotate;
|
|
724
|
+
}
|
|
725
|
+
this.root.scheduleUpdateProjection();
|
|
726
|
+
this.scheduleRender();
|
|
727
|
+
this.animationProgress = progress;
|
|
728
|
+
};
|
|
729
|
+
this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
730
|
+
}
|
|
731
|
+
startAnimation(options) {
|
|
732
|
+
this.notifyListeners("animationStart");
|
|
733
|
+
this.currentAnimation?.stop();
|
|
734
|
+
this.resumingFrom?.currentAnimation?.stop();
|
|
735
|
+
if (this.pendingAnimation) {
|
|
736
|
+
cancelFrame(this.pendingAnimation);
|
|
737
|
+
this.pendingAnimation = void 0;
|
|
738
|
+
}
|
|
739
|
+
this.pendingAnimation = frame.update(() => {
|
|
740
|
+
globalProjectionState.hasAnimatedSinceResize = true;
|
|
741
|
+
this.motionValue || (this.motionValue = motionValue(0));
|
|
742
|
+
this.motionValue.jump(0, false);
|
|
743
|
+
this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], {
|
|
744
|
+
...options,
|
|
745
|
+
velocity: 0,
|
|
746
|
+
isSync: true,
|
|
747
|
+
onUpdate: (latest) => {
|
|
748
|
+
this.mixTargetDelta(latest);
|
|
749
|
+
options.onUpdate && options.onUpdate(latest);
|
|
750
|
+
},
|
|
751
|
+
onStop: () => {
|
|
752
|
+
},
|
|
753
|
+
onComplete: () => {
|
|
754
|
+
options.onComplete && options.onComplete();
|
|
755
|
+
this.completeAnimation();
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
if (this.resumingFrom) {
|
|
759
|
+
this.resumingFrom.currentAnimation = this.currentAnimation;
|
|
760
|
+
}
|
|
761
|
+
this.pendingAnimation = void 0;
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
completeAnimation() {
|
|
765
|
+
if (this.resumingFrom) {
|
|
766
|
+
this.resumingFrom.currentAnimation = void 0;
|
|
767
|
+
this.resumingFrom.preserveOpacity = void 0;
|
|
768
|
+
}
|
|
769
|
+
const stack = this.getStack();
|
|
770
|
+
stack && stack.exitAnimationComplete();
|
|
771
|
+
this.resumingFrom = this.currentAnimation = this.animationValues = void 0;
|
|
772
|
+
this.notifyListeners("animationComplete");
|
|
773
|
+
}
|
|
774
|
+
finishAnimation() {
|
|
775
|
+
if (this.currentAnimation) {
|
|
776
|
+
this.mixTargetDelta && this.mixTargetDelta(animationTarget);
|
|
777
|
+
this.currentAnimation.stop();
|
|
778
|
+
}
|
|
779
|
+
this.completeAnimation();
|
|
780
|
+
}
|
|
781
|
+
applyTransformsToTarget() {
|
|
782
|
+
const lead = this.getLead();
|
|
783
|
+
let { targetWithTransforms, target, layout, latestValues } = lead;
|
|
784
|
+
if (!targetWithTransforms || !target || !layout)
|
|
785
|
+
return;
|
|
786
|
+
if (this !== lead && this.layout && layout && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) {
|
|
787
|
+
target = this.target || createBox();
|
|
788
|
+
const xLength = calcLength(this.layout.layoutBox.x);
|
|
789
|
+
target.x.min = lead.target.x.min;
|
|
790
|
+
target.x.max = target.x.min + xLength;
|
|
791
|
+
const yLength = calcLength(this.layout.layoutBox.y);
|
|
792
|
+
target.y.min = lead.target.y.min;
|
|
793
|
+
target.y.max = target.y.min + yLength;
|
|
794
|
+
}
|
|
795
|
+
copyBoxInto(targetWithTransforms, target);
|
|
796
|
+
transformBox(targetWithTransforms, latestValues);
|
|
797
|
+
calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
|
|
798
|
+
}
|
|
799
|
+
registerSharedNode(layoutId, node) {
|
|
800
|
+
if (!this.sharedNodes.has(layoutId)) {
|
|
801
|
+
this.sharedNodes.set(layoutId, new NodeStack());
|
|
802
|
+
}
|
|
803
|
+
const stack = this.sharedNodes.get(layoutId);
|
|
804
|
+
stack.add(node);
|
|
805
|
+
const config = node.options.initialPromotionConfig;
|
|
806
|
+
node.promote({
|
|
807
|
+
transition: config ? config.transition : void 0,
|
|
808
|
+
preserveFollowOpacity: config && config.shouldPreserveFollowOpacity ? config.shouldPreserveFollowOpacity(node) : void 0
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
isLead() {
|
|
812
|
+
const stack = this.getStack();
|
|
813
|
+
return stack ? stack.lead === this : true;
|
|
814
|
+
}
|
|
815
|
+
getLead() {
|
|
816
|
+
const { layoutId } = this.options;
|
|
817
|
+
return layoutId ? this.getStack()?.lead || this : this;
|
|
818
|
+
}
|
|
819
|
+
getPrevLead() {
|
|
820
|
+
const { layoutId } = this.options;
|
|
821
|
+
return layoutId ? this.getStack()?.prevLead : void 0;
|
|
822
|
+
}
|
|
823
|
+
getStack() {
|
|
824
|
+
const { layoutId } = this.options;
|
|
825
|
+
if (layoutId)
|
|
826
|
+
return this.root.sharedNodes.get(layoutId);
|
|
827
|
+
}
|
|
828
|
+
promote({ needsReset, transition, preserveFollowOpacity } = {}) {
|
|
829
|
+
const stack = this.getStack();
|
|
830
|
+
if (stack)
|
|
831
|
+
stack.promote(this, preserveFollowOpacity);
|
|
832
|
+
if (needsReset) {
|
|
833
|
+
this.projectionDelta = void 0;
|
|
834
|
+
this.needsReset = true;
|
|
835
|
+
}
|
|
836
|
+
if (transition)
|
|
837
|
+
this.setOptions({ transition });
|
|
838
|
+
}
|
|
839
|
+
relegate() {
|
|
840
|
+
const stack = this.getStack();
|
|
841
|
+
if (stack) {
|
|
842
|
+
return stack.relegate(this);
|
|
843
|
+
} else {
|
|
844
|
+
return false;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
resetSkewAndRotation() {
|
|
848
|
+
const { visualElement } = this.options;
|
|
849
|
+
if (!visualElement)
|
|
850
|
+
return;
|
|
851
|
+
let hasDistortingTransform = false;
|
|
852
|
+
const { latestValues } = visualElement;
|
|
853
|
+
if (latestValues.z || latestValues.rotate || latestValues.rotateX || latestValues.rotateY || latestValues.rotateZ || latestValues.skewX || latestValues.skewY) {
|
|
854
|
+
hasDistortingTransform = true;
|
|
855
|
+
}
|
|
856
|
+
if (!hasDistortingTransform)
|
|
857
|
+
return;
|
|
858
|
+
const resetValues = {};
|
|
859
|
+
if (latestValues.z) {
|
|
860
|
+
resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
|
|
861
|
+
}
|
|
862
|
+
for (let i = 0; i < transformAxes.length; i++) {
|
|
863
|
+
resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
864
|
+
resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
865
|
+
}
|
|
866
|
+
visualElement.render();
|
|
867
|
+
for (const key in resetValues) {
|
|
868
|
+
visualElement.setStaticValue(key, resetValues[key]);
|
|
869
|
+
if (this.animationValues) {
|
|
870
|
+
this.animationValues[key] = resetValues[key];
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
visualElement.scheduleRender();
|
|
874
|
+
}
|
|
875
|
+
applyProjectionStyles(targetStyle, styleProp) {
|
|
876
|
+
if (!this.instance || this.isSVG)
|
|
877
|
+
return;
|
|
878
|
+
if (!this.isVisible) {
|
|
879
|
+
targetStyle.visibility = "hidden";
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
const transformTemplate = this.getTransformTemplate();
|
|
883
|
+
if (this.needsReset) {
|
|
884
|
+
this.needsReset = false;
|
|
885
|
+
targetStyle.visibility = "";
|
|
886
|
+
targetStyle.opacity = "";
|
|
887
|
+
targetStyle.pointerEvents = resolveMotionValue(styleProp?.pointerEvents) || "";
|
|
888
|
+
targetStyle.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none";
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
const lead = this.getLead();
|
|
892
|
+
if (!this.projectionDelta || !this.layout || !lead.target) {
|
|
893
|
+
if (this.options.layoutId) {
|
|
894
|
+
targetStyle.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1;
|
|
895
|
+
targetStyle.pointerEvents = resolveMotionValue(styleProp?.pointerEvents) || "";
|
|
896
|
+
}
|
|
897
|
+
if (this.hasProjected && !hasTransform(this.latestValues)) {
|
|
898
|
+
targetStyle.transform = transformTemplate ? transformTemplate({}, "") : "none";
|
|
899
|
+
this.hasProjected = false;
|
|
900
|
+
}
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
targetStyle.visibility = "";
|
|
904
|
+
const valuesToRender = lead.animationValues || lead.latestValues;
|
|
905
|
+
this.applyTransformsToTarget();
|
|
906
|
+
let transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
|
|
907
|
+
if (transformTemplate) {
|
|
908
|
+
transform = transformTemplate(valuesToRender, transform);
|
|
909
|
+
}
|
|
910
|
+
targetStyle.transform = transform;
|
|
911
|
+
const { x, y } = this.projectionDelta;
|
|
912
|
+
targetStyle.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
|
|
913
|
+
if (lead.animationValues) {
|
|
914
|
+
targetStyle.opacity = lead === this ? valuesToRender.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
|
|
915
|
+
} else {
|
|
916
|
+
targetStyle.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
|
|
917
|
+
}
|
|
918
|
+
for (const key in scaleCorrectors) {
|
|
919
|
+
if (valuesToRender[key] === void 0)
|
|
920
|
+
continue;
|
|
921
|
+
const { correct, applyTo, isCSSVariable } = scaleCorrectors[key];
|
|
922
|
+
const corrected = transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
|
|
923
|
+
if (applyTo) {
|
|
924
|
+
const num = applyTo.length;
|
|
925
|
+
for (let i = 0; i < num; i++) {
|
|
926
|
+
targetStyle[applyTo[i]] = corrected;
|
|
927
|
+
}
|
|
928
|
+
} else {
|
|
929
|
+
if (isCSSVariable) {
|
|
930
|
+
this.options.visualElement.renderState.vars[key] = corrected;
|
|
931
|
+
} else {
|
|
932
|
+
targetStyle[key] = corrected;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
if (this.options.layoutId) {
|
|
937
|
+
targetStyle.pointerEvents = lead === this ? resolveMotionValue(styleProp?.pointerEvents) || "" : "none";
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
clearSnapshot() {
|
|
941
|
+
this.resumeFrom = this.snapshot = void 0;
|
|
942
|
+
}
|
|
943
|
+
// Only run on root
|
|
944
|
+
resetTree() {
|
|
945
|
+
this.root.nodes.forEach((node) => node.currentAnimation?.stop());
|
|
946
|
+
this.root.nodes.forEach(clearMeasurements);
|
|
947
|
+
this.root.sharedNodes.clear();
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function updateLayout(node) {
|
|
952
|
+
node.updateLayout();
|
|
953
|
+
}
|
|
954
|
+
function notifyLayoutUpdate(node) {
|
|
955
|
+
const snapshot = node.resumeFrom?.snapshot || node.snapshot;
|
|
956
|
+
if (node.isLead() && node.layout && snapshot && node.hasListeners("didUpdate")) {
|
|
957
|
+
const { layoutBox: layout, measuredBox: measuredLayout } = node.layout;
|
|
958
|
+
const { animationType } = node.options;
|
|
959
|
+
const isShared = snapshot.source !== node.layout.source;
|
|
960
|
+
if (animationType === "size") {
|
|
961
|
+
eachAxis((axis) => {
|
|
962
|
+
const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
|
|
963
|
+
const length = calcLength(axisSnapshot);
|
|
964
|
+
axisSnapshot.min = layout[axis].min;
|
|
965
|
+
axisSnapshot.max = axisSnapshot.min + length;
|
|
966
|
+
});
|
|
967
|
+
} else if (animationType === "x" || animationType === "y") {
|
|
968
|
+
const snapAxis = animationType === "x" ? "y" : "x";
|
|
969
|
+
copyAxisInto(isShared ? snapshot.measuredBox[snapAxis] : snapshot.layoutBox[snapAxis], layout[snapAxis]);
|
|
970
|
+
} else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {
|
|
971
|
+
eachAxis((axis) => {
|
|
972
|
+
const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
|
|
973
|
+
const length = calcLength(layout[axis]);
|
|
974
|
+
axisSnapshot.max = axisSnapshot.min + length;
|
|
975
|
+
if (node.relativeTarget && !node.currentAnimation) {
|
|
976
|
+
node.isProjectionDirty = true;
|
|
977
|
+
node.relativeTarget[axis].max = node.relativeTarget[axis].min + length;
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
const layoutDelta = createDelta();
|
|
982
|
+
calcBoxDelta(layoutDelta, layout, snapshot.layoutBox);
|
|
983
|
+
const visualDelta = createDelta();
|
|
984
|
+
if (isShared) {
|
|
985
|
+
calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox);
|
|
986
|
+
} else {
|
|
987
|
+
calcBoxDelta(visualDelta, layout, snapshot.layoutBox);
|
|
988
|
+
}
|
|
989
|
+
const hasLayoutChanged = !isDeltaZero(layoutDelta);
|
|
990
|
+
let hasRelativeLayoutChanged = false;
|
|
991
|
+
if (!node.resumeFrom) {
|
|
992
|
+
const relativeParent = node.getClosestProjectingParent();
|
|
993
|
+
if (relativeParent && !relativeParent.resumeFrom) {
|
|
994
|
+
const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
|
|
995
|
+
if (parentSnapshot && parentLayout) {
|
|
996
|
+
const anchor = node.options.layoutAnchor || void 0;
|
|
997
|
+
const relativeSnapshot = createBox();
|
|
998
|
+
calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox, anchor);
|
|
999
|
+
const relativeLayout = createBox();
|
|
1000
|
+
calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox, anchor);
|
|
1001
|
+
if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
|
|
1002
|
+
hasRelativeLayoutChanged = true;
|
|
1003
|
+
}
|
|
1004
|
+
if (relativeParent.options.layoutRoot) {
|
|
1005
|
+
node.relativeTarget = relativeLayout;
|
|
1006
|
+
node.relativeTargetOrigin = relativeSnapshot;
|
|
1007
|
+
node.relativeParent = relativeParent;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
node.notifyListeners("didUpdate", {
|
|
1013
|
+
layout,
|
|
1014
|
+
snapshot,
|
|
1015
|
+
delta: visualDelta,
|
|
1016
|
+
layoutDelta,
|
|
1017
|
+
hasLayoutChanged,
|
|
1018
|
+
hasRelativeLayoutChanged
|
|
1019
|
+
});
|
|
1020
|
+
} else if (node.isLead()) {
|
|
1021
|
+
const { onExitComplete } = node.options;
|
|
1022
|
+
onExitComplete && onExitComplete();
|
|
1023
|
+
}
|
|
1024
|
+
node.options.transition = void 0;
|
|
1025
|
+
}
|
|
1026
|
+
function propagateDirtyNodes(node) {
|
|
1027
|
+
if (!node.parent)
|
|
1028
|
+
return;
|
|
1029
|
+
if (!node.isProjecting()) {
|
|
1030
|
+
node.isProjectionDirty = node.parent.isProjectionDirty;
|
|
1031
|
+
}
|
|
1032
|
+
node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty || node.parent.isProjectionDirty || node.parent.isSharedProjectionDirty));
|
|
1033
|
+
node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
|
|
1034
|
+
}
|
|
1035
|
+
function cleanDirtyNodes(node) {
|
|
1036
|
+
node.isProjectionDirty = node.isSharedProjectionDirty = node.isTransformDirty = false;
|
|
1037
|
+
}
|
|
1038
|
+
function clearSnapshot(node) {
|
|
1039
|
+
node.clearSnapshot();
|
|
1040
|
+
}
|
|
1041
|
+
function clearMeasurements(node) {
|
|
1042
|
+
node.clearMeasurements();
|
|
1043
|
+
}
|
|
1044
|
+
function forceLayoutMeasure(node) {
|
|
1045
|
+
node.isLayoutDirty = true;
|
|
1046
|
+
node.updateLayout();
|
|
1047
|
+
}
|
|
1048
|
+
function clearIsLayoutDirty(node) {
|
|
1049
|
+
node.isLayoutDirty = false;
|
|
1050
|
+
}
|
|
1051
|
+
function ensureDraggedNodesSnapshotted(node) {
|
|
1052
|
+
if (node.isAnimationBlocked && node.layout && !node.isLayoutDirty) {
|
|
1053
|
+
node.snapshot = node.layout;
|
|
1054
|
+
node.isLayoutDirty = true;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
function resetTransformStyle(node) {
|
|
1058
|
+
const { visualElement } = node.options;
|
|
1059
|
+
if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
|
|
1060
|
+
visualElement.notify("BeforeLayoutMeasure");
|
|
1061
|
+
}
|
|
1062
|
+
node.resetTransform();
|
|
1063
|
+
}
|
|
1064
|
+
function finishAnimation(node) {
|
|
1065
|
+
node.finishAnimation();
|
|
1066
|
+
node.targetDelta = node.relativeTarget = node.target = void 0;
|
|
1067
|
+
node.isProjectionDirty = true;
|
|
1068
|
+
}
|
|
1069
|
+
function resolveTargetDelta(node) {
|
|
1070
|
+
node.resolveTargetDelta();
|
|
1071
|
+
}
|
|
1072
|
+
function calcProjection(node) {
|
|
1073
|
+
node.calcProjection();
|
|
1074
|
+
}
|
|
1075
|
+
function resetSkewAndRotation(node) {
|
|
1076
|
+
node.resetSkewAndRotation();
|
|
1077
|
+
}
|
|
1078
|
+
function removeLeadSnapshots(stack) {
|
|
1079
|
+
stack.removeLeadSnapshot();
|
|
1080
|
+
}
|
|
1081
|
+
function mixAxisDeltaLinear(output, delta, p) {
|
|
1082
|
+
output.translate = mixNumber(delta.translate, 0, p);
|
|
1083
|
+
output.scale = mixNumber(delta.scale, 1, p);
|
|
1084
|
+
output.origin = delta.origin;
|
|
1085
|
+
output.originPoint = delta.originPoint;
|
|
1086
|
+
}
|
|
1087
|
+
function mixAxis(output, from, to, p) {
|
|
1088
|
+
output.min = mixNumber(from.min, to.min, p);
|
|
1089
|
+
output.max = mixNumber(from.max, to.max, p);
|
|
1090
|
+
}
|
|
1091
|
+
function mixBox(output, from, to, p) {
|
|
1092
|
+
mixAxis(output.x, from.x, to.x, p);
|
|
1093
|
+
mixAxis(output.y, from.y, to.y, p);
|
|
1094
|
+
}
|
|
1095
|
+
function hasOpacityCrossfade(node) {
|
|
1096
|
+
return node.animationValues && node.animationValues.opacityExit !== void 0;
|
|
1097
|
+
}
|
|
1098
|
+
const defaultLayoutTransition = {
|
|
1099
|
+
duration: 0.45,
|
|
1100
|
+
ease: [0.4, 0, 0.1, 1]
|
|
1101
|
+
};
|
|
1102
|
+
const userAgentContains = (string) => typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string);
|
|
1103
|
+
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop;
|
|
1104
|
+
function roundAxis(axis) {
|
|
1105
|
+
axis.min = roundPoint(axis.min);
|
|
1106
|
+
axis.max = roundPoint(axis.max);
|
|
1107
|
+
}
|
|
1108
|
+
function roundBox(box) {
|
|
1109
|
+
roundAxis(box.x);
|
|
1110
|
+
roundAxis(box.y);
|
|
1111
|
+
}
|
|
1112
|
+
function shouldAnimatePositionOnly(animationType, snapshot, layout) {
|
|
1113
|
+
return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2);
|
|
1114
|
+
}
|
|
1115
|
+
function checkNodeWasScrollRoot(node) {
|
|
1116
|
+
return node !== node.root && node.scroll?.wasRoot;
|
|
1117
|
+
}
|
|
1118
|
+
export {
|
|
1119
|
+
cleanDirtyNodes,
|
|
1120
|
+
createProjectionNode,
|
|
1121
|
+
mixAxis,
|
|
1122
|
+
mixBox,
|
|
1123
|
+
propagateDirtyNodes
|
|
1124
|
+
};
|