@nethesis/phone-island 1.1.5 → 1.1.6
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/dist/App.js.map +1 -1
- package/dist/components/AlertView/index.js.map +1 -1
- package/dist/components/AudioBars.js.map +1 -1
- package/dist/components/AudioPlayerView/PlayerFooterActions.js +1 -1
- package/dist/components/AudioPlayerView/PlayerFooterActions.js.map +1 -1
- package/dist/components/AudioPlayerView/Progress.js.map +1 -1
- package/dist/components/AudioPlayerView/index.js +1 -1
- package/dist/components/AudioPlayerView/index.js.map +1 -1
- package/dist/components/CallView/Actions.js +1 -1
- package/dist/components/CallView/Actions.js.map +1 -1
- package/dist/components/CallView/BackCall.js +1 -1
- package/dist/components/CallView/BackCall.js.map +1 -1
- package/dist/components/CallView/DeviceIcon.js +1 -1
- package/dist/components/CallView/DeviceIcon.js.map +1 -1
- package/dist/components/CallView/DisplayName.js +1 -1
- package/dist/components/CallView/DisplayName.js.map +1 -1
- package/dist/components/CallView/DisplayNameUtils.js.map +1 -1
- package/dist/components/CallView/Number.js +1 -1
- package/dist/components/CallView/Number.js.map +1 -1
- package/dist/components/CallView/NumberPopover.js +1 -1
- package/dist/components/CallView/NumberPopover.js.map +1 -1
- package/dist/components/CallView/index.js +1 -1
- package/dist/components/CallView/index.js.map +1 -1
- package/dist/components/ConferenceView/ConferenceUsersList.js +1 -1
- package/dist/components/ConferenceView/ConferenceUsersList.js.map +1 -1
- package/dist/components/ConferenceView/index.js +1 -1
- package/dist/components/ConferenceView/index.js.map +1 -1
- package/dist/components/ContactView/ContactListView.js +1 -1
- package/dist/components/ContactView/ContactListView.js.map +1 -1
- package/dist/components/ContactView/SelectContactNumberView.js +1 -1
- package/dist/components/ContactView/SelectContactNumberView.js.map +1 -1
- package/dist/components/ContactView/TransferActions.js +1 -1
- package/dist/components/ContactView/TransferActions.js.map +1 -1
- package/dist/components/Hangup.js +1 -1
- package/dist/components/Hangup.js.map +1 -1
- package/dist/components/KeypadView/index.js +1 -1
- package/dist/components/KeypadView/index.js.map +1 -1
- package/dist/components/OperatorBusyView/index.js +1 -1
- package/dist/components/OperatorBusyView/index.js.map +1 -1
- package/dist/components/PhysicalRecorderView/index.js +1 -1
- package/dist/components/PhysicalRecorderView/index.js.map +1 -1
- package/dist/components/RecorderView/Actions.js +1 -1
- package/dist/components/RecorderView/Actions.js.map +1 -1
- package/dist/components/RecorderView/BarsGroup.js.map +1 -1
- package/dist/components/RecorderView/index.js +1 -1
- package/dist/components/RecorderView/index.js.map +1 -1
- package/dist/components/SettingsView/AudioView.js +1 -1
- package/dist/components/SettingsView/AudioView.js.map +1 -1
- package/dist/components/SettingsView/MicrophoneView.js +1 -1
- package/dist/components/SettingsView/MicrophoneView.js.map +1 -1
- package/dist/components/SettingsView/SettingsHeader.js +1 -1
- package/dist/components/SettingsView/SettingsHeader.js.map +1 -1
- package/dist/components/SettingsView/ThemeView.js +1 -1
- package/dist/components/SettingsView/ThemeView.js.map +1 -1
- package/dist/components/SettingsView/index.js +1 -1
- package/dist/components/SettingsView/index.js.map +1 -1
- package/dist/components/SideView/SideView.js +1 -1
- package/dist/components/SideView/SideView.js.map +1 -1
- package/dist/components/SideView/hooks/useSideViewLogic.js.map +1 -1
- package/dist/components/Socket.js.map +1 -1
- package/dist/components/SwitchDeviceView/index.js +1 -1
- package/dist/components/SwitchDeviceView/index.js.map +1 -1
- package/dist/components/SwitchInputView/DropdownContent.js +1 -1
- package/dist/components/SwitchInputView/DropdownContent.js.map +1 -1
- package/dist/components/SwitchInputView/Index.js +1 -1
- package/dist/components/TextScroll.js +1 -1
- package/dist/components/TextScroll.js.map +1 -1
- package/dist/components/TranscriptionView/TranscriptionView.js +1 -1
- package/dist/components/TranscriptionView/TranscriptionView.js.map +1 -1
- package/dist/components/VideoStreamingEmptyState/index.js +1 -1
- package/dist/components/VideoStreamingEmptyState/index.js.map +1 -1
- package/dist/components/VideoStreamingSkeleton/index.js +1 -1
- package/dist/components/VideoStreamingSkeleton/index.js.map +1 -1
- package/dist/components/VideoView/index.js.map +1 -1
- package/dist/components/WebRTC.js.map +1 -1
- package/dist/events/SocketEvents.js.map +1 -1
- package/dist/lib/i18n.js +1 -1
- package/dist/lib/i18n.js.map +1 -1
- package/dist/lib/phone/call.js +1 -1
- package/dist/lib/phone/call.js.map +1 -1
- package/dist/lib/phone/counterpartDevice.js.map +1 -1
- package/dist/lib/phone/video.js.map +1 -1
- package/dist/lib/player/audio.js.map +1 -1
- package/dist/lib/user/default_device.js.map +1 -1
- package/dist/lib/user/extensions.js.map +1 -1
- package/dist/models/currentCall.js.map +1 -1
- package/dist/models/island.js.map +1 -1
- package/dist/models/player.js +1 -1
- package/dist/models/player.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/animation/hooks/animation-controls.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/animation/hooks/animation-controls.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/hover.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/hover.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/press.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/press.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/index.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/index.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs.js.map +1 -1
- package/dist/node_modules/i18next/dist/esm/i18next.js +1 -1
- package/dist/node_modules/i18next/dist/esm/i18next.js.map +1 -1
- package/dist/node_modules/js-base64/base64.mjs.js +1 -1
- package/dist/node_modules/js-base64/base64.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/generators/inertia.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/generators/inertia.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/generators/keyframes.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/generators/keyframes.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/generators/spring.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/generators/spring.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/can-animate.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/can-animate.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/transforms/TransformAnimation.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/transforms/TransformAnimation.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/transforms/groups.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/needs-mixer.mjs.js +2 -0
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/needs-mixer.mjs.js.map +1 -0
- package/dist/node_modules/motion-dom/dist/es/gestures/drag/VisualElementDragControls.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/drag/VisualElementDragControls.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/pan/PanSession.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/pan/PanSession.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-apply.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-apply.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/round.mjs.js +2 -0
- package/dist/node_modules/motion-dom/dist/es/projection/geometry/round.mjs.js.map +1 -0
- package/dist/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/styles/transform.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/styles/transform.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/utils/has-transform.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/utils/has-transform.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/utils/measure.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/utils/measure.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/VisualElement.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/VisualElement.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/dom/parse-transform.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/dom/parse-transform.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/utils/animation-state.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/utils/animation-state.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js +2 -0
- package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js.map +1 -0
- package/dist/node_modules/motion-dom/dist/es/utils/interpolate.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/interpolate.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/is-ref-object.mjs.js.map +1 -0
- package/dist/node_modules/motion-dom/dist/es/utils/mix/color.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/mix/color.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/mix/complex.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/mix/complex.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/index.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/index.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/types/color/hex.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/types/color/hex.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/types/complex/index.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/types/complex/index.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.mjs.js.map +1 -1
- package/dist/node_modules/motion-utils/dist/es/easing/utils/map.mjs.js +1 -1
- package/dist/node_modules/motion-utils/dist/es/easing/utils/map.mjs.js.map +1 -1
- package/dist/node_modules/react-i18next/dist/es/context.js +1 -1
- package/dist/node_modules/react-i18next/dist/es/context.js.map +1 -1
- package/dist/node_modules/react-i18next/dist/es/defaults.js +1 -1
- package/dist/node_modules/react-i18next/dist/es/defaults.js.map +1 -1
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +1 -1
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js.map +1 -1
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +1 -1
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js.map +1 -1
- package/dist/node_modules/react-i18next/dist/es/unescape.js +1 -1
- package/dist/node_modules/react-i18next/dist/es/unescape.js.map +1 -1
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +1 -1
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js.map +1 -1
- package/dist/node_modules/react-i18next/dist/es/utils.js +1 -1
- package/dist/node_modules/react-i18next/dist/es/utils.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/services/astproxy.js +1 -1
- package/dist/services/astproxy.js.map +1 -1
- package/dist/services/phonebook.js +1 -1
- package/dist/services/phonebook.js.map +1 -1
- package/dist/utils/customHooks/useLocalStorage.js.map +1 -1
- package/dist/utils/deviceUtils.js.map +1 -1
- package/package.json +10 -5
- package/dist/_virtual/arrayLikeToArray.js +0 -2
- package/dist/_virtual/arrayLikeToArray.js.map +0 -1
- package/dist/_virtual/arrayWithHoles.js +0 -2
- package/dist/_virtual/arrayWithHoles.js.map +0 -1
- package/dist/_virtual/classCallCheck.js +0 -2
- package/dist/_virtual/classCallCheck.js.map +0 -1
- package/dist/_virtual/createClass.js +0 -2
- package/dist/_virtual/createClass.js.map +0 -1
- package/dist/_virtual/defineProperty.js +0 -2
- package/dist/_virtual/defineProperty.js.map +0 -1
- package/dist/_virtual/iterableToArrayLimit.js +0 -2
- package/dist/_virtual/iterableToArrayLimit.js.map +0 -1
- package/dist/_virtual/nonIterableRest.js +0 -2
- package/dist/_virtual/nonIterableRest.js.map +0 -1
- package/dist/_virtual/objectWithoutProperties.js +0 -2
- package/dist/_virtual/objectWithoutProperties.js.map +0 -1
- package/dist/_virtual/objectWithoutPropertiesLoose.js +0 -2
- package/dist/_virtual/objectWithoutPropertiesLoose.js.map +0 -1
- package/dist/_virtual/slicedToArray.js +0 -2
- package/dist/_virtual/slicedToArray.js.map +0 -1
- package/dist/_virtual/toPrimitive.js +0 -2
- package/dist/_virtual/toPrimitive.js.map +0 -1
- package/dist/_virtual/toPropertyKey.js +0 -2
- package/dist/_virtual/toPropertyKey.js.map +0 -1
- package/dist/_virtual/typeof.js +0 -2
- package/dist/_virtual/typeof.js.map +0 -1
- package/dist/_virtual/unsupportedIterableToArray.js +0 -2
- package/dist/_virtual/unsupportedIterableToArray.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/arrayLikeToArray.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/arrayWithHoles.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/classCallCheck.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/createClass.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/createClass.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/defineProperty.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/defineProperty.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/inherits.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/toArray.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/nonIterableRest.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/objectWithoutProperties.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/slicedToArray.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/toPrimitive.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/toPropertyKey.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/typeof.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/typeof.js.map +0 -1
- package/dist/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -2
- package/dist/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +0 -1
- package/dist/node_modules/framer-motion/dist/es/utils/get-context-window.mjs.js +0 -2
- package/dist/node_modules/framer-motion/dist/es/utils/get-context-window.mjs.js.map +0 -1
- package/dist/node_modules/framer-motion/dist/es/utils/is-ref-object.mjs.js.map +0 -1
- package/dist/node_modules/html-parse-stringify/dist/html-parse-stringify.js +0 -2
- package/dist/node_modules/html-parse-stringify/dist/html-parse-stringify.js.map +0 -1
- package/dist/node_modules/void-elements/index.js +0 -2
- package/dist/node_modules/void-elements/index.js.map +0 -1
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/utils/is-ref-object.mjs.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../waapi/utils/linear.mjs.js"),t=require("./utils/calc-duration.mjs.js"),s=require("./utils/create-generator-easing.mjs.js"),n=require("../../../../../motion-utils/dist/es/time-conversion.mjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../waapi/utils/linear.mjs.js"),t=require("./utils/calc-duration.mjs.js"),s=require("./utils/create-generator-easing.mjs.js"),n=require("../../../../../motion-utils/dist/es/time-conversion.mjs.js"),i=require("../../../../../motion-utils/dist/es/errors.mjs.js"),o=require("../../../../../motion-utils/dist/es/clamp.mjs.js");const a=e=>e<0?1/Math.max(1+e,.05):Math.max(1-e,.05);function r(e,t){if(!(e>1))return 1;const s=Math.sqrt(e*e-1),n=e-s,i=e+s,o=2*s*Math.exp(-t)*(1+t);return d(e=>i*Math.exp(-n*e)-n*Math.exp(-i*e)-o,e=>Math.exp(-i*e)-Math.exp(-n*e),t)/t}function c(e,t){return e*Math.sqrt(1-t*t)}const l=12;function d(e,t,s){let n=s;for(let s=1;s<l;s++)n-=e(n)/t(n);return n}const u=.001;const p=(e,t)=>(t?e>=0:e>0)&&e<1/0;function m(e,t){if(p(e,t))return e;"production"!==process.env.NODE_ENV&&i.warning(void 0===e,"Spring stiffness and mass must be positive, damping 0 or greater","spring-invalid-physics")}function f(e){const t=m(e.stiffness),s=m(e.damping,!0),l=m(e.mass),f={...e,stiffness:t??100,damping:s??10,mass:l??1,isResolvedFromDuration:!1,isTimeDefined:void 0===(t??s??l)&&(void 0!==e.duration||void 0!==e.bounce)};if(f.isTimeDefined){if(e.visualDuration){const t=a(e.bounce||0),s=2*Math.PI/(1.2*e.visualDuration)*r(t,2*Math.PI/1.2);f.stiffness=s*s,f.damping=2*t*Math.sqrt(f.stiffness)}else Object.assign(f,function({duration:e=800,bounce:t=.3}){let s,l;"production"!==process.env.NODE_ENV&&i.warning(e<=n.secondsToMilliseconds(10),"Spring duration must be 10 seconds or less","spring-duration-limit");const p=a(t);e=o.clamp(.01,10,n.millisecondsToSeconds(e)),p<1?(s=t=>{const s=t*p,n=s*e,i=c(t,p),o=Math.exp(-n);return u-s/i*o},l=t=>{const n=t*p*e,i=p*p*t*t*e,o=Math.exp(-n),a=c(t*t,p);return(-s(t)+u>0?-1:1)*-i*o/a}):(s=t=>Math.exp(-t*e)*(t*e+1)-.001,l=t=>Math.exp(-t*e)*(e*e*-t));const m=d(s,l,5/e),f=m*r(p,m*e),M=f*f;return{stiffness:M,damping:2*p*Math.sqrt(M),duration:n.secondsToMilliseconds(e)}}(f)),f.isResolvedFromDuration=!0;p(f.stiffness)&&p(f.damping,!0)||(f.stiffness=100,f.damping=10)}return f}function M(s=.3,i=.3){const o="object"!=typeof s?{visualDuration:s,keyframes:[0,1],bounce:i}:s,a=o.keyframes[0],r=o.keyframes[o.keyframes.length-1],l={done:!1,value:a},{stiffness:d,damping:u,mass:p,duration:m,isResolvedFromDuration:M,isTimeDefined:g}=f({...o}),h=e=>g?0:-n.millisecondsToSeconds(e),v=u/(2*Math.sqrt(d*p)),x=n.millisecondsToSeconds(Math.sqrt(d/p)),D=v*x,y={target:r,delta:r-a,velocity:h(o.velocity||0)||0,restSpeed:0,restDelta:0},j=()=>{const e=Math.abs(y.delta)<5;y.restSpeed=o.restSpeed||(e?.01:2),y.restDelta=o.restDelta||(e?.005:.5)};let S,b,q;if(j(),v<1){const e=c(x,v),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};q=()=>{t.A=(y.velocity+D*y.delta)/e,t.sinC=D*t.A+y.delta*e,t.cosC=D*y.delta-t.A*e};const s=s=>{s!==t.t&&(t.t=s,t.env=Math.exp(-D*s),t.sin=Math.sin(e*s),t.cos=Math.cos(e*s))};S=e=>(s(e),y.target-t.env*(t.A*t.sin+y.delta*t.cos)),b=e=>(s(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(1===v){S=e=>y.target-Math.exp(-x*e)*(y.delta+(y.velocity+x*y.delta)*e);const e={C:0};q=()=>{e.C=y.velocity+x*y.delta},b=t=>Math.exp(-x*t)*(x*e.C*t-y.velocity)}else{const e=x*Math.sqrt(v*v-1),t=D-e,s=D+e,n=e<1||g?1/0:300/e,i=(e,t)=>Math.exp(t>n?(D-e)*n-D*t:-e*t),o={S:0,F:0};q=()=>{const t=(y.velocity+D*y.delta)/e;o.S=(y.delta+t)/2,o.F=(y.delta-t)/2},S=e=>y.target-o.S*i(t,e)-o.F*i(s,e),b=e=>t*o.S*i(t,e)+s*o.F*i(s,e)}q();const T=M&&m||null,C={calculatedDuration:T,retarget:(e,t)=>{y.target=e[e.length-1],y.delta=y.target-e[0],y.velocity=h(t),o.restSpeed&&o.restDelta||j(),C.calculatedDuration=T,l.done=!1,q()},velocity:e=>n.secondsToMilliseconds(b(e)),next:e=>{const t=S(e);if(M)l.done=e>=m;else{const s=n.secondsToMilliseconds(b(e));l.done=Math.abs(s)<=y.restSpeed&&Math.abs(y.target-t)<=y.restDelta}return l.value=l.done?y.target:t,l},toString:()=>{const s=Math.min(t.calcGeneratorDuration(C),t.maxGeneratorDuration),n=e.generateLinearEasing(e=>C.next(s*e).value,s,30);return s+"ms "+n},toTransition:()=>{}};return C}const g=Object.assign(M,{applyToOptions:e=>{const t=s.createGeneratorEasing(e,100,M);return e.ease=t.ease,e.duration=n.secondsToMilliseconds(t.duration),e.type="keyframes",e}});exports.spring=g;
|
|
2
2
|
//# sourceMappingURL=spring.mjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spring.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/generators/spring.mjs"],"sourcesContent":["import { secondsToMilliseconds, millisecondsToSeconds, warning, clamp } from 'motion-utils';\nimport { generateLinearEasing } from '../waapi/utils/linear.mjs';\nimport { calcGeneratorDuration, maxGeneratorDuration } from './utils/calc-duration.mjs';\nimport { createGeneratorEasing } from './utils/create-generator-easing.mjs';\n\nconst springDefaults = {\n // Default spring physics\n stiffness: 100,\n damping: 10,\n mass: 1.0,\n // Default duration/bounce-based options\n duration: 800, // in ms\n bounce: 0.3,\n visualDuration: 0.3, // in seconds\n // Rest thresholds\n restSpeed: {\n granular: 0.01,\n default: 2,\n },\n restDelta: {\n granular: 0.005,\n default: 0.5,\n },\n // Limits\n minDuration: 0.01, // in seconds\n maxDuration: 10.0, // in seconds\n minDamping: 0.05,\n};\n/**\n * Maps bounce to a damping ratio as SwiftUI does: 0 is critically damped, and\n * it approaches undamped towards 1 and infinitely overdamped towards -1. Both\n * ends are limited so the spring still moves and settles.\n */\nconst bounceToDampingRatio = (bounce) => bounce < 0\n ? 1 / Math.max(1 + bounce, springDefaults.minDamping)\n : Math.max(1 - bounce, springDefaults.minDamping);\n/**\n * Scales an overdamped spring's undamped frequency so that, at its defining\n * time, it has as far left to go as the critically damped spring that's\n * criticalFreqTime radians in by then. A negative bounce then changes the\n * shape of the curve, not when it arrives. 1 at a damping ratio of 1, so\n * there's no jump at a bounce of 0.\n *\n * Solved by Newton on the remaining distance (times fast - slow), which is\n * convex from criticalFreqTime onwards. criticalFreqTime is always below the\n * answer, so it converges from below without overshooting.\n */\nfunction overdampedFreqScale(dampingRatio, criticalFreqTime) {\n if (!(dampingRatio > 1))\n return 1;\n const root = Math.sqrt(dampingRatio * dampingRatio - 1);\n const slow = dampingRatio - root;\n const fast = dampingRatio + root;\n const target = 2 * root * Math.exp(-criticalFreqTime) * (1 + criticalFreqTime);\n return (approximateRoot((freqTime) => fast * Math.exp(-slow * freqTime) -\n slow * Math.exp(-fast * freqTime) -\n target, (freqTime) => Math.exp(-fast * freqTime) - Math.exp(-slow * freqTime), criticalFreqTime) / criticalFreqTime);\n}\nfunction calcAngularFreq(undampedFreq, dampingRatio) {\n return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);\n}\nconst rootIterations = 12;\nfunction approximateRoot(envelope, derivative, initialGuess) {\n let result = initialGuess;\n for (let i = 1; i < rootIterations; i++) {\n result = result - envelope(result) / derivative(result);\n }\n return result;\n}\n/**\n * This is ported from the Framer implementation of duration-based spring resolution.\n */\nconst safeMin = 0.001;\n/**\n * Assumes zero initial velocity and the default mass: time-defined springs\n * ignore inherited velocity and only resolve without valid physics. Returns\n * NaN physics when the root search doesn't converge.\n */\nfunction findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, }) {\n let envelope;\n let derivative;\n warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), \"Spring duration must be 10 seconds or less\", \"spring-duration-limit\");\n const dampingRatio = bounceToDampingRatio(bounce);\n duration = clamp(springDefaults.minDuration, springDefaults.maxDuration, millisecondsToSeconds(duration));\n if (dampingRatio < 1) {\n /**\n * Underdamped spring\n */\n envelope = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const b = calcAngularFreq(undampedFreq, dampingRatio);\n const c = Math.exp(-delta);\n return safeMin - (exponentialDecay / b) * c;\n };\n derivative = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const e = dampingRatio *\n dampingRatio *\n undampedFreq *\n undampedFreq *\n duration;\n const f = Math.exp(-delta);\n const g = calcAngularFreq(undampedFreq * undampedFreq, dampingRatio);\n const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;\n return (factor * -e * f) / g;\n };\n }\n else {\n /**\n * Critically-damped spring. Overdamped springs reuse this root,\n * scaled below.\n */\n envelope = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = undampedFreq * duration + 1;\n return -safeMin + a * b;\n };\n derivative = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = -undampedFreq * (duration * duration);\n return a * b;\n };\n }\n const initialGuess = 5 / duration;\n const criticalFreq = approximateRoot(envelope, derivative, initialGuess);\n const undampedFreq = criticalFreq *\n overdampedFreqScale(dampingRatio, criticalFreq * duration);\n const stiffness = undampedFreq * undampedFreq;\n return {\n stiffness,\n damping: dampingRatio * 2 * Math.sqrt(stiffness),\n duration: secondsToMilliseconds(duration),\n };\n}\n/**\n * Spring physics must be finite. stiffness and mass are also divisors so must\n * be positive, whereas a damping of 0 is a valid, perpetually oscillating\n * spring. Relational rather than Number.isFinite so numeric strings still\n * coerce.\n */\nconst isValidPhysics = (value, canBeZero) => (canBeZero ? value >= 0 : value > 0) && value < Infinity;\n/**\n * Returns value if it's usable spring physics, otherwise undefined so callers\n * fall back to the default. An explicit `undefined`, e.g. from a forwarded\n * optional prop, must fall back too. Invalid physics would otherwise resolve\n * to NaN spring values that never report done.\n */\nfunction resolvePhysics(value, canBeZero) {\n if (isValidPhysics(value, canBeZero))\n return value;\n if (process.env.NODE_ENV !== \"production\") {\n warning(value === undefined, \"Spring stiffness and mass must be positive, damping 0 or greater\", \"spring-invalid-physics\");\n }\n return undefined;\n}\nfunction getSpringOptions(options) {\n /**\n * Resolve physics before choosing between physics- and duration-based\n * resolution, so an invalid stiffness doesn't also silently discard a\n * valid duration/bounce.\n */\n const validStiffness = resolvePhysics(options.stiffness);\n const validDamping = resolvePhysics(options.damping, true);\n const validMass = resolvePhysics(options.mass);\n const springOptions = {\n ...options,\n stiffness: validStiffness ?? springDefaults.stiffness,\n damping: validDamping ?? springDefaults.damping,\n mass: validMass ?? springDefaults.mass,\n isResolvedFromDuration: false,\n // stiffness/damping/mass overrides duration/bounce\n isTimeDefined: (validStiffness ?? validDamping ?? validMass) === undefined &&\n (options.duration !== undefined || options.bounce !== undefined),\n };\n if (springOptions.isTimeDefined) {\n if (options.visualDuration) {\n const dampingRatio = bounceToDampingRatio(options.bounce || 0);\n const root = ((2 * Math.PI) / (options.visualDuration * 1.2)) *\n overdampedFreqScale(dampingRatio, (2 * Math.PI) / 1.2);\n springOptions.stiffness = root * root;\n springOptions.damping =\n 2 * dampingRatio * Math.sqrt(springOptions.stiffness);\n }\n else {\n Object.assign(springOptions, findSpring(springOptions));\n springOptions.isResolvedFromDuration = true;\n }\n /**\n * Time options can degenerate: a NaN bounce gives a NaN damping, an\n * infinite visualDuration a 0 stiffness, and findSpring NaN for both\n * when it doesn't converge. Replace the two together, so the\n * relationship duration resolution establishes between them is never\n * left half-overwritten.\n */\n if (!isValidPhysics(springOptions.stiffness) ||\n !isValidPhysics(springOptions.damping, true)) {\n springOptions.stiffness = springDefaults.stiffness;\n springOptions.damping = springDefaults.damping;\n }\n }\n return springOptions;\n}\nfunction springGenerator(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {\n const options = typeof optionsOrVisualDuration !== \"object\"\n ? {\n visualDuration: optionsOrVisualDuration,\n keyframes: [0, 1],\n bounce,\n }\n : optionsOrVisualDuration;\n const origin = options.keyframes[0];\n const target = options.keyframes[options.keyframes.length - 1];\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state = { done: false, value: origin };\n const { stiffness, damping, mass, duration, isResolvedFromDuration, isTimeDefined, } = getSpringOptions({ ...options });\n /**\n * Time-defined springs ignore inherited velocity. Velocity from\n * interrupted animations causes massive oscillation on small-range\n * animations.\n */\n const inheritVelocity = (velocity) => isTimeDefined ? 0 : -millisecondsToSeconds(velocity);\n const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));\n const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));\n const decay = dampingRatio * undampedAngularFreq;\n /**\n * Everything that changes when the spring is retargeted: written by\n * retarget() and update(), read by the resolvers. Grouped on one object,\n * like the coefficients (c) below. Writing doubles to object fields\n * measured marginally faster than to captured let variables in optimised\n * code; neither allocates, so this is a grouping choice, not a GC one.\n */\n const s = {\n target,\n delta: target - origin,\n velocity: inheritVelocity(options.velocity || 0) || 0,\n restSpeed: 0,\n restDelta: 0,\n };\n /**\n * If we're working on a granular scale, use smaller defaults for determining\n * when the spring is finished.\n *\n * These defaults have been selected empirically based on what strikes a good\n * ratio between feeling good and finishing as soon as changes are imperceptible.\n */\n const setRestThresholds = () => {\n const isGranularScale = Math.abs(s.delta) < 5;\n s.restSpeed =\n options.restSpeed ||\n (isGranularScale\n ? springDefaults.restSpeed.granular\n : springDefaults.restSpeed.default);\n s.restDelta =\n options.restDelta ||\n (isGranularScale\n ? springDefaults.restDelta.granular\n : springDefaults.restDelta.default);\n };\n setRestThresholds();\n let resolveSpring;\n let resolveVelocity;\n /**\n * Derives the coefficients that depend on origin, target and initial\n * velocity. Called once now and again whenever the spring is retargeted.\n */\n let update;\n if (dampingRatio < 1) {\n const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);\n /**\n * A is the position coefficient, sinC/cosC the coefficients of the\n * analytical derivative (px/ms). The exp/sin/cos terms depend only\n * on t, so they're memoized by t independently of the target: a\n * spring retargeted every frame samples the same t each frame and\n * skips the transcendentals entirely.\n */\n const c = { A: 0, sinC: 0, cosC: 0, t: -1, env: 0, sin: 0, cos: 0 };\n update = () => {\n c.A = (s.velocity + decay * s.delta) / angularFreq;\n c.sinC = decay * c.A + s.delta * angularFreq;\n c.cosC = decay * s.delta - c.A * angularFreq;\n };\n const sample = (t) => {\n if (t !== c.t) {\n c.t = t;\n c.env = Math.exp(-decay * t);\n c.sin = Math.sin(angularFreq * t);\n c.cos = Math.cos(angularFreq * t);\n }\n };\n // Underdamped spring\n resolveSpring = (t) => {\n sample(t);\n return s.target - c.env * (c.A * c.sin + s.delta * c.cos);\n };\n resolveVelocity = (t) => {\n sample(t);\n return c.env * (c.sinC * c.sin + c.cosC * c.cos);\n };\n }\n else if (dampingRatio === 1) {\n // Critically damped spring\n resolveSpring = (t) => s.target -\n Math.exp(-undampedAngularFreq * t) *\n (s.delta + (s.velocity + undampedAngularFreq * s.delta) * t);\n // Analytical derivative of critically damped spring (px/ms)\n const c = { C: 0 };\n update = () => {\n c.C = s.velocity + undampedAngularFreq * s.delta;\n };\n resolveVelocity = (t) => Math.exp(-undampedAngularFreq * t) *\n (undampedAngularFreq * c.C * t - s.velocity);\n }\n else {\n /**\n * Overdamped spring: the sum of a slow and a fast decaying\n * exponential, so no term can overflow however heavily it's damped.\n */\n const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);\n const slow = decay - dampedAngularFreq;\n const fast = decay + dampedAngularFreq;\n /**\n * Physics-defined springs keep a non-physical limit: once\n * dampedAngularFreq * t passes 300, both terms decay at the damping\n * rate. Heavily overdamped drag springs (dragElastic: 0,\n * dragTransition) rely on this to settle almost at once rather than\n * creep at stiffness / damping. Negative bounce needs the exact\n * curve, so time-defined springs are exempt.\n */\n const limit = isTimeDefined ? Infinity : 300 / dampedAngularFreq;\n const decayAt = (rate, t) => Math.exp(t > limit ? -rate * limit - decay * (t - limit) : -rate * t);\n const c = { S: 0, F: 0 };\n update = () => {\n const P = (s.velocity + decay * s.delta) / dampedAngularFreq;\n c.S = (s.delta + P) / 2;\n c.F = (s.delta - P) / 2;\n };\n resolveSpring = (t) => s.target - c.S * decayAt(slow, t) - c.F * decayAt(fast, t);\n // Analytical derivative of overdamped spring (px/ms)\n resolveVelocity = (t) => slow * c.S * decayAt(slow, t) + fast * c.F * decayAt(fast, t);\n }\n update();\n const calculatedDuration = isResolvedFromDuration ? duration || null : null;\n const generator = {\n calculatedDuration,\n /**\n * Aim the spring at a new target from its current position and\n * velocity, reusing the resolved physics and closures.\n */\n retarget: (keyframes, newVelocity) => {\n s.target = keyframes[keyframes.length - 1];\n s.delta = s.target - keyframes[0];\n s.velocity = inheritVelocity(newVelocity);\n // Default thresholds depend on the scale of the new delta\n if (!(options.restSpeed && options.restDelta))\n setRestThresholds();\n // Invalidate any duration lazily cached by JSAnimation\n generator.calculatedDuration = calculatedDuration;\n state.done = false;\n update();\n },\n velocity: (t) => secondsToMilliseconds(resolveVelocity(t)),\n next: (t) => {\n const current = resolveSpring(t);\n if (!isResolvedFromDuration) {\n const currentVelocity = secondsToMilliseconds(resolveVelocity(t));\n state.done =\n Math.abs(currentVelocity) <= s.restSpeed &&\n Math.abs(s.target - current) <= s.restDelta;\n }\n else {\n state.done = t >= duration;\n }\n state.value = state.done ? s.target : current;\n return state;\n },\n toString: () => {\n const easingDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);\n const easing = generateLinearEasing((progress) => generator.next(easingDuration * progress).value, easingDuration, 30);\n return easingDuration + \"ms \" + easing;\n },\n toTransition: () => { },\n };\n return generator;\n}\nconst spring = /* @__PURE__ */ Object.assign(springGenerator, {\n applyToOptions: (options) => {\n const generatorOptions = createGeneratorEasing(options, 100, springGenerator);\n options.ease = generatorOptions.ease;\n options.duration = secondsToMilliseconds(generatorOptions.duration);\n options.type = \"keyframes\";\n return options;\n },\n});\n\nexport { spring };\n//# sourceMappingURL=spring.mjs.map\n"],"names":["springDefaults","granular","default","bounceToDampingRatio","bounce","Math","max","overdampedFreqScale","dampingRatio","criticalFreqTime","root","sqrt","slow","fast","target","exp","approximateRoot","freqTime","calcAngularFreq","undampedFreq","rootIterations","envelope","derivative","initialGuess","result","i","safeMin","isValidPhysics","value","canBeZero","Infinity","resolvePhysics","process","env","NODE_ENV","warning","undefined","getSpringOptions","options","validStiffness","stiffness","validDamping","damping","validMass","mass","springOptions","isResolvedFromDuration","isTimeDefined","duration","visualDuration","PI","Object","assign","secondsToMilliseconds","clamp","millisecondsToSeconds","exponentialDecay","delta","b","c","e","f","g","criticalFreq","findSpring","springGenerator","optionsOrVisualDuration","keyframes","origin","length","state","done","inheritVelocity","velocity","undampedAngularFreq","decay","s","restSpeed","restDelta","setRestThresholds","isGranularScale","abs","resolveSpring","resolveVelocity","update","angularFreq","A","sinC","cosC","t","sin","cos","sample","C","dampedAngularFreq","limit","decayAt","rate","S","F","P","calculatedDuration","generator","retarget","newVelocity","next","current","currentVelocity","toString","easingDuration","min","calcGeneratorDuration","maxGeneratorDuration","easing","generateLinearEasing","progress","toTransition","spring","applyToOptions","generatorOptions","createGeneratorEasing","ease","type"],"mappings":"qZAoBA,MAAMA,EAES,IAFTA,EAGO,GAHPA,EAII,EAJJA,EAOQ,IAPRA,EAQM,GARNA,EASc,GATdA,EAYS,CACPC,SAAU,IACVC,QAAS,GAdXF,EAgBS,CACPC,SAAU,KACVC,QAAS,IAlBXF,EAsBW,IAtBXA,EAuBW,GAvBXA,EAwBU,IAQVG,EAAwBC,GAC1BA,EAAS,EACH,EAAIC,KAAKC,IAAI,EAAIF,EAAQJ,GACzBK,KAAKC,IAAI,EAAIF,EAAQJ,GAa/B,SAASO,EAAoBC,EAAsBC,GAC/C,KAAMD,EAAe,GAAI,OAAO,EAEhC,MAAME,EAAOL,KAAKM,KAAKH,EAAeA,EAAe,GAC/CI,EAAOJ,EAAeE,EACtBG,EAAOL,EAAeE,EACtBI,EACF,EAAIJ,EAAOL,KAAKU,KAAKN,IAAqB,EAAIA,GAElD,OACIO,EACKC,GACGJ,EAAOR,KAAKU,KAAKH,EAAOK,GACxBL,EAAOP,KAAKU,KAAKF,EAAOI,GACxBH,EACHG,GACGZ,KAAKU,KAAKF,EAAO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AAMe,EAAyBlE,OAAOC,OAAOa,EAAiB,CAC1DqD,eAAiBhF,IACb,MAAMiF,EAAmBC,EAAqBA,sBAC1ClF,EACA,IACA2B,GAMJ,OAHA3B,EAAQmF,KAAOF,EAAiBE,KAChCnF,EAAQU,SAAWK,EAAAA,sBAAsBkE,EAAiBvE,UAC1DV,EAAQoF,KAAO,YACRpF"}
|
|
1
|
+
{"version":3,"file":"spring.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/generators/spring.mjs"],"sourcesContent":["import { secondsToMilliseconds, millisecondsToSeconds, warning, clamp } from 'motion-utils';\nimport { generateLinearEasing } from '../waapi/utils/linear.mjs';\nimport { calcGeneratorDuration, maxGeneratorDuration } from './utils/calc-duration.mjs';\nimport { createGeneratorEasing } from './utils/create-generator-easing.mjs';\n\n// Default spring physics\nconst defaultStiffness = 100;\nconst defaultDamping = 10;\nconst defaultMass = 1.0;\n// Default duration/bounce-based options\nconst defaultDuration = 800; // in ms\nconst defaultBounce = 0.3;\nconst defaultVisualDuration = 0.3; // in seconds\n// Rest thresholds\nconst restSpeedGranular = 0.01;\nconst restSpeedDefault = 2;\nconst restDeltaGranular = 0.005;\nconst restDeltaDefault = 0.5;\n// Limits\nconst minDuration = 0.01; // in seconds\nconst maxDuration = 10.0; // in seconds\nconst minDamping = 0.05;\n/**\n * Maps bounce to a damping ratio as SwiftUI does: 0 is critically damped, and\n * it approaches undamped towards 1 and infinitely overdamped towards -1. Both\n * ends are limited so the spring still moves and settles.\n */\nconst bounceToDampingRatio = (bounce) => bounce < 0\n ? 1 / Math.max(1 + bounce, minDamping)\n : Math.max(1 - bounce, minDamping);\n/**\n * Scales an overdamped spring's undamped frequency so that, at its defining\n * time, it has as far left to go as the critically damped spring that's\n * criticalFreqTime radians in by then. A negative bounce then changes the\n * shape of the curve, not when it arrives. 1 at a damping ratio of 1, so\n * there's no jump at a bounce of 0.\n *\n * Solved by Newton on the remaining distance (times fast - slow), which is\n * convex from criticalFreqTime onwards. criticalFreqTime is always below the\n * answer, so it converges from below without overshooting.\n */\nfunction overdampedFreqScale(dampingRatio, criticalFreqTime) {\n if (!(dampingRatio > 1))\n return 1;\n const root = Math.sqrt(dampingRatio * dampingRatio - 1);\n const slow = dampingRatio - root;\n const fast = dampingRatio + root;\n const target = 2 * root * Math.exp(-criticalFreqTime) * (1 + criticalFreqTime);\n return (approximateRoot((freqTime) => fast * Math.exp(-slow * freqTime) -\n slow * Math.exp(-fast * freqTime) -\n target, (freqTime) => Math.exp(-fast * freqTime) - Math.exp(-slow * freqTime), criticalFreqTime) / criticalFreqTime);\n}\nfunction calcAngularFreq(undampedFreq, dampingRatio) {\n return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);\n}\nconst rootIterations = 12;\nfunction approximateRoot(envelope, derivative, initialGuess) {\n let result = initialGuess;\n for (let i = 1; i < rootIterations; i++) {\n result = result - envelope(result) / derivative(result);\n }\n return result;\n}\n/**\n * This is ported from the Framer implementation of duration-based spring resolution.\n */\nconst safeMin = 0.001;\n/**\n * Assumes zero initial velocity and the default mass: time-defined springs\n * ignore inherited velocity and only resolve without valid physics. Returns\n * NaN physics when the root search doesn't converge.\n */\nfunction findSpring({ duration = defaultDuration, bounce = defaultBounce, }) {\n let envelope;\n let derivative;\n process.env.NODE_ENV !== \"production\" &&\n warning(duration <= secondsToMilliseconds(maxDuration), \"Spring duration must be 10 seconds or less\", \"spring-duration-limit\");\n const dampingRatio = bounceToDampingRatio(bounce);\n duration = clamp(minDuration, maxDuration, millisecondsToSeconds(duration));\n if (dampingRatio < 1) {\n /**\n * Underdamped spring\n */\n envelope = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const b = calcAngularFreq(undampedFreq, dampingRatio);\n const c = Math.exp(-delta);\n return safeMin - (exponentialDecay / b) * c;\n };\n derivative = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const e = dampingRatio *\n dampingRatio *\n undampedFreq *\n undampedFreq *\n duration;\n const f = Math.exp(-delta);\n const g = calcAngularFreq(undampedFreq * undampedFreq, dampingRatio);\n const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;\n return (factor * -e * f) / g;\n };\n }\n else {\n /**\n * Critically-damped spring. Overdamped springs reuse this root,\n * scaled below.\n */\n envelope = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = undampedFreq * duration + 1;\n return -safeMin + a * b;\n };\n derivative = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = -undampedFreq * (duration * duration);\n return a * b;\n };\n }\n const initialGuess = 5 / duration;\n const criticalFreq = approximateRoot(envelope, derivative, initialGuess);\n const undampedFreq = criticalFreq *\n overdampedFreqScale(dampingRatio, criticalFreq * duration);\n const stiffness = undampedFreq * undampedFreq;\n return {\n stiffness,\n damping: dampingRatio * 2 * Math.sqrt(stiffness),\n duration: secondsToMilliseconds(duration),\n };\n}\n/**\n * Spring physics must be finite. stiffness and mass are also divisors so must\n * be positive, whereas a damping of 0 is a valid, perpetually oscillating\n * spring. Relational rather than Number.isFinite so numeric strings still\n * coerce.\n */\nconst isValidPhysics = (value, canBeZero) => (canBeZero ? value >= 0 : value > 0) && value < Infinity;\n/**\n * Returns value if it's usable spring physics, otherwise undefined so callers\n * fall back to the default. An explicit `undefined`, e.g. from a forwarded\n * optional prop, must fall back too. Invalid physics would otherwise resolve\n * to NaN spring values that never report done.\n */\nfunction resolvePhysics(value, canBeZero) {\n if (isValidPhysics(value, canBeZero))\n return value;\n if (process.env.NODE_ENV !== \"production\") {\n warning(value === undefined, \"Spring stiffness and mass must be positive, damping 0 or greater\", \"spring-invalid-physics\");\n }\n return undefined;\n}\nfunction getSpringOptions(options) {\n /**\n * Resolve physics before choosing between physics- and duration-based\n * resolution, so an invalid stiffness doesn't also silently discard a\n * valid duration/bounce.\n */\n const validStiffness = resolvePhysics(options.stiffness);\n const validDamping = resolvePhysics(options.damping, true);\n const validMass = resolvePhysics(options.mass);\n const springOptions = {\n ...options,\n stiffness: validStiffness ?? defaultStiffness,\n damping: validDamping ?? defaultDamping,\n mass: validMass ?? defaultMass,\n isResolvedFromDuration: false,\n // stiffness/damping/mass overrides duration/bounce\n isTimeDefined: (validStiffness ?? validDamping ?? validMass) === undefined &&\n (options.duration !== undefined || options.bounce !== undefined),\n };\n if (springOptions.isTimeDefined) {\n if (options.visualDuration) {\n const dampingRatio = bounceToDampingRatio(options.bounce || 0);\n const root = ((2 * Math.PI) / (options.visualDuration * 1.2)) *\n overdampedFreqScale(dampingRatio, (2 * Math.PI) / 1.2);\n springOptions.stiffness = root * root;\n springOptions.damping =\n 2 * dampingRatio * Math.sqrt(springOptions.stiffness);\n }\n else {\n Object.assign(springOptions, findSpring(springOptions));\n springOptions.isResolvedFromDuration = true;\n }\n /**\n * Time options can degenerate: a NaN bounce gives a NaN damping, an\n * infinite visualDuration a 0 stiffness, and findSpring NaN for both\n * when it doesn't converge. Replace the two together, so the\n * relationship duration resolution establishes between them is never\n * left half-overwritten.\n */\n if (!isValidPhysics(springOptions.stiffness) ||\n !isValidPhysics(springOptions.damping, true)) {\n springOptions.stiffness = defaultStiffness;\n springOptions.damping = defaultDamping;\n }\n }\n return springOptions;\n}\nfunction springGenerator(optionsOrVisualDuration = defaultVisualDuration, bounce = defaultBounce) {\n const options = typeof optionsOrVisualDuration !== \"object\"\n ? {\n visualDuration: optionsOrVisualDuration,\n keyframes: [0, 1],\n bounce,\n }\n : optionsOrVisualDuration;\n const origin = options.keyframes[0];\n const target = options.keyframes[options.keyframes.length - 1];\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state = { done: false, value: origin };\n const { stiffness, damping, mass, duration, isResolvedFromDuration, isTimeDefined, } = getSpringOptions({ ...options });\n /**\n * Time-defined springs ignore inherited velocity. Velocity from\n * interrupted animations causes massive oscillation on small-range\n * animations.\n */\n const inheritVelocity = (velocity) => isTimeDefined ? 0 : -millisecondsToSeconds(velocity);\n const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));\n const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));\n const decay = dampingRatio * undampedAngularFreq;\n /**\n * Everything that changes when the spring is retargeted: written by\n * retarget() and update(), read by the resolvers. Grouped on one object,\n * like the coefficients (c) below. Writing doubles to object fields\n * measured marginally faster than to captured let variables in optimised\n * code; neither allocates, so this is a grouping choice, not a GC one.\n */\n const s = {\n target,\n delta: target - origin,\n velocity: inheritVelocity(options.velocity || 0) || 0,\n restSpeed: 0,\n restDelta: 0,\n };\n /**\n * If we're working on a granular scale, use smaller defaults for determining\n * when the spring is finished.\n *\n * These defaults have been selected empirically based on what strikes a good\n * ratio between feeling good and finishing as soon as changes are imperceptible.\n */\n const setRestThresholds = () => {\n const isGranularScale = Math.abs(s.delta) < 5;\n s.restSpeed =\n options.restSpeed ||\n (isGranularScale ? restSpeedGranular : restSpeedDefault);\n s.restDelta =\n options.restDelta ||\n (isGranularScale ? restDeltaGranular : restDeltaDefault);\n };\n setRestThresholds();\n let resolveSpring;\n let resolveVelocity;\n /**\n * Derives the coefficients that depend on origin, target and initial\n * velocity. Called once now and again whenever the spring is retargeted.\n */\n let update;\n if (dampingRatio < 1) {\n const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);\n /**\n * A is the position coefficient, sinC/cosC the coefficients of the\n * analytical derivative (px/ms). The exp/sin/cos terms depend only\n * on t, so they're memoized by t independently of the target: a\n * spring retargeted every frame samples the same t each frame and\n * skips the transcendentals entirely.\n */\n const c = { A: 0, sinC: 0, cosC: 0, t: -1, env: 0, sin: 0, cos: 0 };\n update = () => {\n c.A = (s.velocity + decay * s.delta) / angularFreq;\n c.sinC = decay * c.A + s.delta * angularFreq;\n c.cosC = decay * s.delta - c.A * angularFreq;\n };\n const sample = (t) => {\n if (t !== c.t) {\n c.t = t;\n c.env = Math.exp(-decay * t);\n c.sin = Math.sin(angularFreq * t);\n c.cos = Math.cos(angularFreq * t);\n }\n };\n // Underdamped spring\n resolveSpring = (t) => {\n sample(t);\n return s.target - c.env * (c.A * c.sin + s.delta * c.cos);\n };\n resolveVelocity = (t) => {\n sample(t);\n return c.env * (c.sinC * c.sin + c.cosC * c.cos);\n };\n }\n else if (dampingRatio === 1) {\n // Critically damped spring\n resolveSpring = (t) => s.target -\n Math.exp(-undampedAngularFreq * t) *\n (s.delta + (s.velocity + undampedAngularFreq * s.delta) * t);\n // Analytical derivative of critically damped spring (px/ms)\n const c = { C: 0 };\n update = () => {\n c.C = s.velocity + undampedAngularFreq * s.delta;\n };\n resolveVelocity = (t) => Math.exp(-undampedAngularFreq * t) *\n (undampedAngularFreq * c.C * t - s.velocity);\n }\n else {\n /**\n * Overdamped spring: the sum of a slow and a fast decaying\n * exponential, so no term can overflow however heavily it's damped.\n */\n const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);\n const slow = decay - dampedAngularFreq;\n const fast = decay + dampedAngularFreq;\n /**\n * Physics-defined springs keep a non-physical limit: once\n * dampedAngularFreq * t passes 300, both terms decay at the damping\n * rate. Heavily overdamped drag springs (dragElastic: 0,\n * dragTransition) rely on this to settle almost at once rather than\n * creep at stiffness / damping. It only applies when reached within\n * 300ms (a dampedAngularFreq of 1 rad/ms), so it reads as a stiff\n * spring snapping into place: any later and it cuts off a slow spring\n * that's visibly still moving (#1207). Negative bounce needs the\n * exact curve, so time-defined springs are exempt.\n */\n const limit = dampedAngularFreq < 1 || isTimeDefined\n ? Infinity\n : 300 / dampedAngularFreq;\n const decayAt = (rate, t) => Math.exp(t > limit ? (decay - rate) * limit - decay * t : -rate * t);\n const c = { S: 0, F: 0 };\n update = () => {\n const P = (s.velocity + decay * s.delta) / dampedAngularFreq;\n c.S = (s.delta + P) / 2;\n c.F = (s.delta - P) / 2;\n };\n resolveSpring = (t) => s.target - c.S * decayAt(slow, t) - c.F * decayAt(fast, t);\n // Analytical derivative of overdamped spring (px/ms)\n resolveVelocity = (t) => slow * c.S * decayAt(slow, t) + fast * c.F * decayAt(fast, t);\n }\n update();\n const calculatedDuration = isResolvedFromDuration ? duration || null : null;\n const generator = {\n calculatedDuration,\n /**\n * Aim the spring at a new target from its current position and\n * velocity, reusing the resolved physics and closures.\n */\n retarget: (keyframes, newVelocity) => {\n s.target = keyframes[keyframes.length - 1];\n s.delta = s.target - keyframes[0];\n s.velocity = inheritVelocity(newVelocity);\n // Default thresholds depend on the scale of the new delta\n if (!(options.restSpeed && options.restDelta))\n setRestThresholds();\n // Invalidate any duration lazily cached by JSAnimation\n generator.calculatedDuration = calculatedDuration;\n state.done = false;\n update();\n },\n velocity: (t) => secondsToMilliseconds(resolveVelocity(t)),\n next: (t) => {\n const current = resolveSpring(t);\n if (!isResolvedFromDuration) {\n const currentVelocity = secondsToMilliseconds(resolveVelocity(t));\n state.done =\n Math.abs(currentVelocity) <= s.restSpeed &&\n Math.abs(s.target - current) <= s.restDelta;\n }\n else {\n state.done = t >= duration;\n }\n state.value = state.done ? s.target : current;\n return state;\n },\n toString: () => {\n const easingDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);\n const easing = generateLinearEasing((progress) => generator.next(easingDuration * progress).value, easingDuration, 30);\n return easingDuration + \"ms \" + easing;\n },\n toTransition: () => { },\n };\n return generator;\n}\nconst spring = /* @__PURE__ */ Object.assign(springGenerator, {\n applyToOptions: (options) => {\n const generatorOptions = createGeneratorEasing(options, 100, springGenerator);\n options.ease = generatorOptions.ease;\n options.duration = secondsToMilliseconds(generatorOptions.duration);\n options.type = \"keyframes\";\n return options;\n },\n});\n\nexport { spring };\n//# sourceMappingURL=spring.mjs.map\n"],"names":["bounceToDampingRatio","bounce","Math","max","overdampedFreqScale","dampingRatio","criticalFreqTime","root","sqrt","slow","fast","target","exp","approximateRoot","freqTime","calcAngularFreq","undampedFreq","rootIterations","envelope","derivative","initialGuess","result","i","safeMin","isValidPhysics","value","canBeZero","Infinity","resolvePhysics","process","env","NODE_ENV","warning","undefined","getSpringOptions","options","validStiffness","stiffness","validDamping","damping","validMass","mass","springOptions","isResolvedFromDuration","isTimeDefined","duration","visualDuration","PI","Object","assign","secondsToMilliseconds","clamp","millisecondsToSeconds","exponentialDecay","delta","b","c","e","f","g","criticalFreq","findSpring","springGenerator","optionsOrVisualDuration","keyframes","origin","length","state","done","inheritVelocity","velocity","undampedAngularFreq","decay","s","restSpeed","restDelta","setRestThresholds","isGranularScale","abs","resolveSpring","resolveVelocity","update","angularFreq","A","sinC","cosC","t","sin","cos","sample","C","dampedAngularFreq","limit","decayAt","rate","S","F","P","calculatedDuration","generator","retarget","newVelocity","next","current","currentVelocity","toString","easingDuration","min","calcGeneratorDuration","maxGeneratorDuration","easing","generateLinearEasing","progress","toTransition","spring","applyToOptions","generatorOptions","createGeneratorEasing","ease","type"],"mappings":"qZAqBA,MAyBMA,EAAwBC,GAC1BA,EAAS,EACH,EAAIC,KAAKC,IAAI,EAAIF,EATR,KAUTC,KAAKC,IAAI,EAAIF,EAVJ,KAuBnB,SAASG,EAAoBC,EAAsBC,GAC/C,KAAMD,EAAe,GAAI,OAAO,EAEhC,MAAME,EAAOL,KAAKM,KAAKH,EAAeA,EAAe,GAC/CI,EAAOJ,EAAeE,EACtBG,EAAOL,EAAeE,EACtBI,EACF,EAAIJ,EAAOL,KAAKU,KAAKN,IAAqB,EAAIA,GAElD,OACIO,EACKC,GACGJ,EAAOR,KAAKU,KAAKH,EAAOK,GACxBL,EAAOP,KAAKU,KAAKF,EAAOI,GACxBH,EACHG,GACGZ,KAAKU,KAAKF,EAAOI,GAAYZ,KAAKU,KAAKH,EAAOK,GAClDR,GACAA,CAEZ,CAEA,SAASS,EAAgBC,EAAsBX,GAC3C,OAAOW,EAAed,KAAKM,KAAK,EAAIH,EAAeA,EACvD,CAEA,MAAMY,EAAiB,GACvB,SAASJ,EACLK,EACAC,EACAC,GAEA,IAAIC,EAASD,EACb,IAAK,IAAIE,EAAI,EAAGA,EAAIL,EAAgBK,IAChCD,GAA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modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../utils/get-value-transition.mjs.js"),t=require("../utils/resolve-transition.mjs.js"),i=require("../../render/utils/keys-position.mjs.js"),n=require("../../render/utils/setters.mjs.js"),a=require("../../value/will-change/add-will-change.mjs.js"),s=require("../optimized-appear/get-appear-id.mjs.js"),o=require("./motion-value.mjs.js"),r=require("../../frameloop/frame.mjs.js");const l="undefined"!=typeof window;function u({protectedKeys:e,needsAnimating:t},i){const n=i in e&&!t[i];return t[i]=!1,n}exports.animateTarget=function(d,m,{delay:c=0,transitionOverride:p,type:f}={}){let{transition:g,transitionEnd:j,...y}=m;const v=d.getDefaultTransition();g=g?t.resolveTransition(g,v):v;const V=g?.reduceMotion,h=g?.skipAnimations;p&&(g=p);const A=[],q=f&&d.animationState?.getState()[f],w=g?.path;w&&(w.animateValues?w.animateValues(e=>d.getValue(e,d.latestValues[e]??0),y,g,c,A):w.animateVisualElement?.(d,y,g,c,A));for(const t in y){const n=d.getValue(t,d.latestValues[t]??null),m=y[t];if(void 0===m||q&&u(q,t))continue;const p={delay:c,...e.getValueTransition(g||{},t)};h&&(p.skipAnimations=!0);const f=n.get();if(void 0!==f&&!n.isAnimating()&&!Array.isArray(m)&&m===f&&!p.velocity){r.frame.update(()=>n.set(m));continue}let j=!1;if(l&&window.MotionHandoffAnimation){const e=s.getOptimisedAppearId(d);if(e){const i=window.MotionHandoffAnimation(e,t,r.frame);null!==i&&(p.startTime=i,j=!0)}}a.addValueToWillChange(d,t);const v=V??d.shouldReduceMotion;n.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../utils/get-value-transition.mjs.js"),t=require("../utils/resolve-transition.mjs.js"),i=require("../../render/utils/keys-position.mjs.js"),n=require("../../render/utils/setters.mjs.js"),a=require("../../value/will-change/add-will-change.mjs.js"),s=require("../optimized-appear/get-appear-id.mjs.js"),o=require("./motion-value.mjs.js"),r=require("../../frameloop/frame.mjs.js");const l="undefined"!=typeof window;function u({protectedKeys:e,needsAnimating:t},i){const n=i in e&&!t[i];return t[i]=!1,n}exports.animateTarget=function(d,m,{delay:c=0,transitionOverride:p,type:f}={}){let{transition:g,transitionEnd:j,...y}=m;const v=d.getDefaultTransition();g=g?t.resolveTransition(g,v):v;const V=g?.reduceMotion,h=g?.skipAnimations;p&&(g=p);const A=[],q=f&&d.animationState?.getState()[f],w=g?.path;w&&(w.animateValues?w.animateValues(e=>d.getValue(e,d.latestValues[e]??0),y,g,c,A):w.animateVisualElement?.(d,y,g,c,A));for(const t in y){const n=d.getValue(t,d.latestValues[t]??null),m=y[t];if(void 0===m||q&&u(q,t))continue;const p={delay:c,...e.getValueTransition(q?.out[t]||g||{},t)};h&&(p.skipAnimations=!0);const f=n.get();if(void 0!==f&&!n.isAnimating()&&!Array.isArray(m)&&m===f&&!p.velocity){r.frame.update(()=>n.set(m));continue}let j=!1;if(l&&window.MotionHandoffAnimation){const e=s.getOptimisedAppearId(d);if(e){const i=window.MotionHandoffAnimation(e,t,r.frame);null!==i&&(p.startTime=i,j=!0)}}a.addValueToWillChange(d,t);const v=V??d.shouldReduceMotion;n.run(o.animateMotionValue(t,n,m,v&&i.positionalKeys.has(t)?{type:!1}:p,d,j));const w=n.animation;w&&A.push(w)}if(j){const e=()=>r.frame.update(()=>{j&&n.setTarget(d,j)});A.length?Promise.all(A).then(e):e()}return A};
|
|
2
2
|
//# sourceMappingURL=visual-element-target.mjs.js.map
|
package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-element-target.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs"],"sourcesContent":["import { getValueTransition } from '../utils/get-value-transition.mjs';\nimport { resolveTransition } from '../utils/resolve-transition.mjs';\nimport { positionalKeys } from '../../render/utils/keys-position.mjs';\nimport { setTarget } from '../../render/utils/setters.mjs';\nimport { addValueToWillChange } from '../../value/will-change/add-will-change.mjs';\nimport { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';\nimport { animateMotionValue } from './motion-value.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\n\nconst isBrowser = typeof window !== \"undefined\";\n/**\n * Decide whether we should block this animation. Previously, we achieved this\n * just by checking whether the key was listed in protectedKeys, but this\n * posed problems if an animation was triggered by afterChildren and protectedKeys\n * had been set to true in the meantime.\n */\nfunction shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {\n const shouldBlock = key in protectedKeys && !needsAnimating[key];\n needsAnimating[key] = false;\n return shouldBlock;\n}\nfunction animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {\n let { transition, transitionEnd, ...target } = targetAndTransition;\n const defaultTransition = visualElement.getDefaultTransition();\n transition = transition\n ? resolveTransition(transition, defaultTransition)\n : defaultTransition;\n const reduceMotion = transition?.reduceMotion;\n const skipAnimations = transition?.skipAnimations;\n if (transitionOverride)\n transition = transitionOverride;\n const animations = [];\n const animationTypeState = type && visualElement.animationState?.getState()[type];\n const path = transition?.path;\n if (path) {\n // path mutates `target` to claim x/y; loop below skips them.\n path.animateValues\n ? path.animateValues((key) => visualElement.getValue(key, visualElement.latestValues[key] ?? 0), target, transition, delay, animations)\n : path.animateVisualElement?.(visualElement, target, transition, delay, animations);\n }\n for (const key in target) {\n const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);\n const valueTarget = target[key];\n if (valueTarget === undefined ||\n (animationTypeState &&\n shouldBlockAnimation(animationTypeState, key))) {\n continue;\n }\n const valueTransition = {\n delay,\n ...getValueTransition(transition || {}, key),\n };\n if (skipAnimations)\n valueTransition.skipAnimations = true;\n /**\n * If the value is already at the defined target, skip the animation.\n * We still re-assert the value via frame.update to take precedence\n * over any stale transitionEnd callbacks from previous animations.\n */\n const currentValue = value.get();\n if (currentValue !== undefined &&\n !value.isAnimating() &&\n !Array.isArray(valueTarget) &&\n valueTarget === currentValue &&\n !valueTransition.velocity) {\n frame.update(() => value.set(valueTarget));\n continue;\n }\n /**\n * If this is the first time a value is being animated, check\n * to see if we're handling off from an existing animation.\n */\n let isHandoff = false;\n if (isBrowser && window.MotionHandoffAnimation) {\n const appearId = getOptimisedAppearId(visualElement);\n if (appearId) {\n const startTime = window.MotionHandoffAnimation(appearId, key, frame);\n if (startTime !== null) {\n valueTransition.startTime = startTime;\n isHandoff = true;\n }\n }\n }\n addValueToWillChange(visualElement, key);\n const shouldReduceMotion = reduceMotion ?? visualElement.shouldReduceMotion;\n value.
|
|
1
|
+
{"version":3,"file":"visual-element-target.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs"],"sourcesContent":["import { getValueTransition } from '../utils/get-value-transition.mjs';\nimport { resolveTransition } from '../utils/resolve-transition.mjs';\nimport { positionalKeys } from '../../render/utils/keys-position.mjs';\nimport { setTarget } from '../../render/utils/setters.mjs';\nimport { addValueToWillChange } from '../../value/will-change/add-will-change.mjs';\nimport { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';\nimport { animateMotionValue } from './motion-value.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\n\nconst isBrowser = typeof window !== \"undefined\";\n/**\n * Decide whether we should block this animation. Previously, we achieved this\n * just by checking whether the key was listed in protectedKeys, but this\n * posed problems if an animation was triggered by afterChildren and protectedKeys\n * had been set to true in the meantime.\n */\nfunction shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {\n const shouldBlock = key in protectedKeys && !needsAnimating[key];\n needsAnimating[key] = false;\n return shouldBlock;\n}\nfunction animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {\n let { transition, transitionEnd, ...target } = targetAndTransition;\n const defaultTransition = visualElement.getDefaultTransition();\n transition = transition\n ? resolveTransition(transition, defaultTransition)\n : defaultTransition;\n const reduceMotion = transition?.reduceMotion;\n const skipAnimations = transition?.skipAnimations;\n if (transitionOverride)\n transition = transitionOverride;\n const animations = [];\n const animationTypeState = type && visualElement.animationState?.getState()[type];\n const path = transition?.path;\n if (path) {\n // path mutates `target` to claim x/y; loop below skips them.\n path.animateValues\n ? path.animateValues((key) => visualElement.getValue(key, visualElement.latestValues[key] ?? 0), target, transition, delay, animations)\n : path.animateVisualElement?.(visualElement, target, transition, delay, animations);\n }\n for (const key in target) {\n const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);\n const valueTarget = target[key];\n if (valueTarget === undefined ||\n (animationTypeState &&\n shouldBlockAnimation(animationTypeState, key))) {\n continue;\n }\n const valueTransition = {\n delay,\n ...getValueTransition(animationTypeState?.out[key] || transition || {}, key),\n };\n if (skipAnimations)\n valueTransition.skipAnimations = true;\n /**\n * If the value is already at the defined target, skip the animation.\n * We still re-assert the value via frame.update to take precedence\n * over any stale transitionEnd callbacks from previous animations.\n */\n const currentValue = value.get();\n if (currentValue !== undefined &&\n !value.isAnimating() &&\n !Array.isArray(valueTarget) &&\n valueTarget === currentValue &&\n !valueTransition.velocity) {\n frame.update(() => value.set(valueTarget));\n continue;\n }\n /**\n * If this is the first time a value is being animated, check\n * to see if we're handling off from an existing animation.\n */\n let isHandoff = false;\n if (isBrowser && window.MotionHandoffAnimation) {\n const appearId = getOptimisedAppearId(visualElement);\n if (appearId) {\n const startTime = window.MotionHandoffAnimation(appearId, key, frame);\n if (startTime !== null) {\n valueTransition.startTime = startTime;\n isHandoff = true;\n }\n }\n }\n addValueToWillChange(visualElement, key);\n const shouldReduceMotion = reduceMotion ?? visualElement.shouldReduceMotion;\n value.run(animateMotionValue(key, value, valueTarget, shouldReduceMotion && positionalKeys.has(key)\n ? { type: false }\n : valueTransition, visualElement, isHandoff));\n const animation = value.animation;\n if (animation) {\n animations.push(animation);\n }\n }\n if (transitionEnd) {\n const applyTransitionEnd = () => frame.update(() => {\n transitionEnd && setTarget(visualElement, transitionEnd);\n });\n if (animations.length) {\n Promise.all(animations).then(applyTransitionEnd);\n }\n else {\n applyTransitionEnd();\n }\n }\n return animations;\n}\n\nexport { animateTarget };\n//# sourceMappingURL=visual-element-target.mjs.map\n"],"names":["isBrowser","window","shouldBlockAnimation","protectedKeys","needsAnimating","key","shouldBlock","animateTarget","visualElement","targetAndTransition","delay","transitionOverride","type","transition","transitionEnd","target","defaultTransition","getDefaultTransition","resolveTransition","reduceMotion","skipAnimations","animations","animationTypeState","animationState","getState","path","animateValues","getValue","latestValues","animateVisualElement","value","valueTarget","undefined","valueTransition","getValueTransition","out","currentValue","get","isAnimating","Array","isArray","velocity","frame","update","set","isHandoff","MotionHandoffAnimation","appearId","getOptimisedAppearId","startTime","addValueToWillChange","shouldReduceMotion","run","animateMotionValue","positionalKeys","has","animation","push","applyTransitionEnd","setTarget","length","Promise","all","then"],"mappings":"6cAeA,MAAMA,EAA8B,oBAAXC,OAQzB,SAASC,GACLC,cAAEA,EAAaC,eAAEA,GACjBC,GAEA,MAAMC,EAAcD,KAAOF,IAAkBC,EAAeC,GAG5D,OADAD,EAAeC,IAAO,EACfC,CACX,uBAEgBC,SACZC,EACAC,GACAC,MAAEA,EAAQ,EAACC,mBAAEA,EAAkBC,KAAEA,GAAwC,IAEzE,IAAIC,WACAA,EAAUC,cACVA,KACGC,GACHN,EAEJ,MAAMO,EAAoBR,EAAcS,uBACxCJ,EAAaA,EACPK,EAAiBA,kBAACL,EAAYG,GAC9BA,EAEN,MAAMG,EAAgBN,GAA2CM,aAC3DC,EAAiBP,GAAYO,eAE/BT,IAAoBE,EAAaF,GAErC,MAAMU,EAAkD,GAElDC,EACFV,GAAQJ,EAAce,gBAAgBC,WAAWZ,GAE/Ca,EAAQZ,GAAkDY,KAC5DA,IAEAA,EAAKC,cACCD,EAAKC,cACArB,GACGG,EAAcmB,SACVtB,EACAG,EAAcoB,aAAavB,IAAQ,GAE3CU,EACAF,EACAH,EACAW,GAEJI,EAAKI,uBACDrB,EACAO,EACAF,EACAH,EACA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eyframesResolver.mjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../render/utils/keys-position.mjs.js"),s=require("../../value/types/dimensions.mjs.js"),r=require("../utils/css-variables-conversion.mjs.js"),t=require("../utils/is-css-variable.mjs.js"),n=require("./KeyframesResolver.mjs.js"),i=require("./utils/is-none.mjs.js"),a=require("./utils/make-none-animatable.mjs.js"),o=require("./utils/unit-conversion.mjs.js");class l extends n.KeyframeResolver{constructor(e,s,r,t,n){super(e,s,r,t,n,!0)}scheduleResolve(){if(this.canReadNow()&&(this.readKeyframes(),!this.needsMeasurement))return this.complete();super.scheduleResolve()}canReadNow(){const{unresolvedKeyframes:e,element:s,motionValue:r}=this,n=e[0]??r?.get();if(!s?.current||void 0===n)return!1;for(let s=0;s<e.length;s++)if(t.containsCSSVariable(s?e[s]:n))return!1;return!0}readKeyframes(){const{unresolvedKeyframes:n,element:i,name:a}=this;if(!i
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../render/utils/keys-position.mjs.js"),s=require("../../value/types/dimensions.mjs.js"),r=require("../utils/css-variables-conversion.mjs.js"),t=require("../utils/is-css-variable.mjs.js"),n=require("./KeyframesResolver.mjs.js"),i=require("./utils/is-none.mjs.js"),a=require("./utils/make-none-animatable.mjs.js"),o=require("./utils/unit-conversion.mjs.js");class l extends n.KeyframeResolver{constructor(e,s,r,t,n){super(e,s,r,t,n,!0)}scheduleResolve(){if(this.canReadNow()&&(this.readKeyframes(),!this.needsMeasurement))return this.complete();super.scheduleResolve()}canReadNow(){const{unresolvedKeyframes:e,element:s,motionValue:r}=this,n=e[0]??r?.get();if(!s?.current||void 0===n)return!1;for(let s=0;s<e.length;s++)if(t.containsCSSVariable(s?e[s]:n))return!1;return!0}readKeyframes(){const{unresolvedKeyframes:n,element:i,name:a}=this;if(!i?.current)return;super.readKeyframes();for(let e=0;e<n.length;e++){let s=n[e];if("string"==typeof s&&(s=s.trim(),t.isCSSVariableToken(s))){const t=r.getVariableValue(s,i.current);void 0!==t&&(n[e]=t),e===n.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!e.positionalKeys.has(a)||2!==n.length)return;const[l,u]=n;if("number"==typeof l&&"number"==typeof u)return;const m=s.findDimensionValueType(l),f=s.findDimensionValueType(u);if(t.containsCSSVariable(l)!==t.containsCSSVariable(u)&&o.positionalValues[a])this.needsMeasurement=!0;else if(m!==f)if(o.isNumOrPxType(m)&&o.isNumOrPxType(f))for(let e=0;e<n.length;e++){const s=n[e];"string"==typeof s&&(n[e]=parseFloat(s))}else o.positionalValues[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,r=[];for(let s=0;s<e.length;s++)(null===e[s]||i.isNone(e[s]))&&r.push(s);r.length&&a.makeNoneKeyframesAnimatable(e,r,s)}measure(){const{element:e,name:s}=this;return o.positionalValues[s](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:r}=this;if(!e?.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),s[0]=this.measuredOrigin;const t=s[s.length-1];void 0!==t&&this.motionValue?.jump(t,!1)}measureEndState(){const{element:e,unresolvedKeyframes:s}=this;if(!e?.current)return;this.motionValue?.jump(this.measuredOrigin,!1);const r=s.length-1,t=s[r];s[r]=this.measure(),null!==t&&void 0===this.finalKeyframe&&(this.finalKeyframe=t),this.resolveNoneKeyframes()}}exports.DOMKeyframesResolver=l;
|
|
2
2
|
//# sourceMappingURL=DOMKeyframesResolver.mjs.js.map
|
package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DOMKeyframesResolver.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs"],"sourcesContent":["import { positionalKeys } from '../../render/utils/keys-position.mjs';\nimport { findDimensionValueType } from '../../value/types/dimensions.mjs';\nimport { getVariableValue } from '../utils/css-variables-conversion.mjs';\nimport { containsCSSVariable, isCSSVariableToken } from '../utils/is-css-variable.mjs';\nimport { KeyframeResolver } from './KeyframesResolver.mjs';\nimport { isNone } from './utils/is-none.mjs';\nimport { makeNoneKeyframesAnimatable } from './utils/make-none-animatable.mjs';\nimport { positionalValues, isNumOrPxType } from './utils/unit-conversion.mjs';\n\nclass DOMKeyframesResolver extends KeyframeResolver {\n constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {\n super(unresolvedKeyframes, onComplete, name, motionValue, element, true);\n }\n /**\n * Keyframes that don't need reading from the DOM, or measuring,\n * resolve straight away rather than in the frame loop's batched read.\n */\n scheduleResolve() {\n if (this.canReadNow()) {\n this.readKeyframes();\n if (!this.needsMeasurement)\n return this.complete();\n }\n super.scheduleResolve();\n }\n canReadNow() {\n const { unresolvedKeyframes, element, motionValue } = this;\n const origin = unresolvedKeyframes[0] ?? motionValue?.get();\n if (!element?.current || origin === undefined)\n return false;\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n if (containsCSSVariable(i ? unresolvedKeyframes[i] : origin)) {\n return false;\n }\n }\n return true;\n }\n readKeyframes() {\n const { unresolvedKeyframes, element, name } = this;\n if (!element || !element.current)\n return;\n super.readKeyframes();\n /**\n * If any keyframe is a CSS variable, we need to find its value by sampling the element\n */\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n let keyframe = unresolvedKeyframes[i];\n if (typeof keyframe === \"string\") {\n keyframe = keyframe.trim();\n if (isCSSVariableToken(keyframe)) {\n const resolved = getVariableValue(keyframe, element.current);\n if (resolved !== undefined) {\n unresolvedKeyframes[i] = resolved;\n }\n if (i === unresolvedKeyframes.length - 1) {\n this.finalKeyframe = keyframe;\n }\n }\n }\n }\n /**\n * Resolve \"none\" values. We do this potentially twice - once before and once after measuring keyframes.\n * This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which\n * have a far bigger performance impact.\n */\n this.resolveNoneKeyframes();\n /**\n * Check to see if unit type has changed. If so schedule jobs that will\n * temporarily set styles to the destination keyframes.\n * Skip if we have more than two keyframes or this isn't a positional value.\n * TODO: We can throw if there are multiple keyframes and the value type changes.\n */\n if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {\n return;\n }\n const [origin, target] = unresolvedKeyframes;\n // Two numbers share a unit, so skip the value type search.\n if (typeof origin === \"number\" && typeof target === \"number\")\n return;\n const originType = findDimensionValueType(origin);\n const targetType = findDimensionValueType(target);\n /**\n * If one keyframe contains embedded CSS variables (e.g. in calc()) and the other\n * doesn't, we need to measure to convert to pixels. This handles GitHub issue #3410.\n */\n const originHasVar = containsCSSVariable(origin);\n const targetHasVar = containsCSSVariable(target);\n if (originHasVar !== targetHasVar && positionalValues[name]) {\n this.needsMeasurement = true;\n return;\n }\n /**\n * Either we don't recognise these value types or we can animate between them.\n */\n if (originType === targetType)\n return;\n /**\n * If both values are numbers or pixels, we can animate between them by\n * converting them to numbers.\n */\n if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n const value = unresolvedKeyframes[i];\n if (typeof value === \"string\") {\n unresolvedKeyframes[i] = parseFloat(value);\n }\n }\n }\n else if (positionalValues[name]) {\n /**\n * Else, the only way to resolve this is by measuring the element.\n */\n this.needsMeasurement = true;\n }\n }\n resolveNoneKeyframes() {\n const { unresolvedKeyframes, name } = this;\n const noneKeyframeIndexes = [];\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n if (unresolvedKeyframes[i] === null ||\n isNone(unresolvedKeyframes[i])) {\n noneKeyframeIndexes.push(i);\n }\n }\n if (noneKeyframeIndexes.length) {\n makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);\n }\n }\n measure() {\n const { element, name } = this;\n return positionalValues[name](window.getComputedStyle(element.current), () => element.measureViewportBox());\n }\n measureInitialState() {\n const { element, unresolvedKeyframes, name } = this;\n if (!element || !element.current)\n return;\n if (name === \"height\") {\n this.suspendedScrollY = window.pageYOffset;\n }\n this.measuredOrigin = this.measure();\n unresolvedKeyframes[0] = this.measuredOrigin;\n // Set final key frame to measure after next render\n const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];\n if (measureKeyframe !== undefined) {\n this.motionValue?.jump(measureKeyframe, false);\n }\n }\n measureEndState() {\n const { element, unresolvedKeyframes } = this;\n if (!element || !element.current)\n return;\n this.motionValue?.jump(this.measuredOrigin, false);\n const finalKeyframeIndex = unresolvedKeyframes.length - 1;\n const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];\n unresolvedKeyframes[finalKeyframeIndex] = this.measure();\n if (finalKeyframe !== null && this.finalKeyframe === undefined) {\n this.finalKeyframe = finalKeyframe;\n }\n // If we removed transform values, reapply them before the next render\n if (this.removedTransforms?.length) {\n this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {\n element\n .getValue(unsetTransformName)\n .set(unsetTransformValue);\n });\n }\n this.resolveNoneKeyframes();\n }\n}\n\nexport { DOMKeyframesResolver };\n//# sourceMappingURL=DOMKeyframesResolver.mjs.map\n"],"names":["DOMKeyframesResolver","KeyframeResolver","constructor","unresolvedKeyframes","onComplete","name","motionValue","element","super","scheduleResolve","this","canReadNow","readKeyframes","needsMeasurement","complete","origin","get","current","undefined","i","length","containsCSSVariable","keyframe","trim","isCSSVariableToken","resolved","getVariableValue","finalKeyframe","resolveNoneKeyframes","positionalKeys","has","target","originType","findDimensionValueType","targetType","positionalValues","isNumOrPxType","value","parseFloat","noneKeyframeIndexes","isNone","push","makeNoneKeyframesAnimatable","measure","window","getComputedStyle","measureViewportBox","measureInitialState","suspendedScrollY","pageYOffset","measuredOrigin","measureKeyframe","jump","measureEndState","finalKeyframeIndex","removedTransforms","forEach","unsetTransformName","unsetTransformValue","getValue","set"],"mappings":"0bAmBM,MAAOA,UAEHC,EAAAA,iBA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,EAAqBnD,EAAoBiB,OAAS,EAClDO,EAAgBxB,EAAoBmD,GAE1CnD,EAAoBmD,GAAsB5C,KAAKiC,UAEzB,OAAlBhB,QAAiDT,IAAvBR,KAAKiB,gBAC/BjB,KAAKiB,cAAgBA,GAIrBjB,KAAK6C,mBAAmBnC,QACxBV,KAAK6C,kBAAkBC,QACnB,EAAEC,EAAoBC,MAClBnD,EACKoD,SAASF,GACTG,IAAIF,KAKrBhD,KAAKkB,sBACT"}
|
|
1
|
+
{"version":3,"file":"DOMKeyframesResolver.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs"],"sourcesContent":["import { positionalKeys } from '../../render/utils/keys-position.mjs';\nimport { findDimensionValueType } from '../../value/types/dimensions.mjs';\nimport { getVariableValue } from '../utils/css-variables-conversion.mjs';\nimport { containsCSSVariable, isCSSVariableToken } from '../utils/is-css-variable.mjs';\nimport { KeyframeResolver } from './KeyframesResolver.mjs';\nimport { isNone } from './utils/is-none.mjs';\nimport { makeNoneKeyframesAnimatable } from './utils/make-none-animatable.mjs';\nimport { positionalValues, isNumOrPxType } from './utils/unit-conversion.mjs';\n\nclass DOMKeyframesResolver extends KeyframeResolver {\n /**\n * Passes isAsync to the base constructor rather than setting it as a\n * class field, which would compile to a constructor that spreads\n * `arguments` into super(). That spread is slow in the interpreter,\n * and animate() constructs one resolver per value.\n */\n constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {\n super(unresolvedKeyframes, onComplete, name, motionValue, element, true);\n }\n /**\n * Keyframes that don't need reading from the DOM, or measuring,\n * resolve straight away rather than in the frame loop's batched read.\n */\n scheduleResolve() {\n if (this.canReadNow()) {\n this.readKeyframes();\n if (!this.needsMeasurement)\n return this.complete();\n }\n super.scheduleResolve();\n }\n canReadNow() {\n const { unresolvedKeyframes, element, motionValue } = this;\n const origin = unresolvedKeyframes[0] ?? motionValue?.get();\n if (!element?.current || origin === undefined)\n return false;\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n if (containsCSSVariable(i ? unresolvedKeyframes[i] : origin)) {\n return false;\n }\n }\n return true;\n }\n readKeyframes() {\n const { unresolvedKeyframes, element, name } = this;\n if (!element?.current)\n return;\n super.readKeyframes();\n /**\n * If any keyframe is a CSS variable, we need to find its value by sampling the element\n */\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n let keyframe = unresolvedKeyframes[i];\n if (typeof keyframe === \"string\") {\n keyframe = keyframe.trim();\n if (isCSSVariableToken(keyframe)) {\n const resolved = getVariableValue(keyframe, element.current);\n if (resolved !== undefined) {\n unresolvedKeyframes[i] = resolved;\n }\n if (i === unresolvedKeyframes.length - 1) {\n this.finalKeyframe = keyframe;\n }\n }\n }\n }\n /**\n * Resolve \"none\" values. We do this potentially twice - once before and once after measuring keyframes.\n * This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which\n * have a far bigger performance impact.\n */\n this.resolveNoneKeyframes();\n /**\n * Check to see if unit type has changed. If so schedule jobs that will\n * temporarily set styles to the destination keyframes.\n * Skip if we have more than two keyframes or this isn't a positional value.\n * TODO: We can throw if there are multiple keyframes and the value type changes.\n */\n if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {\n return;\n }\n const [origin, target] = unresolvedKeyframes;\n // Two numbers share a unit, so skip the value type search.\n if (typeof origin === \"number\" && typeof target === \"number\")\n return;\n const originType = findDimensionValueType(origin);\n const targetType = findDimensionValueType(target);\n /**\n * If one keyframe contains embedded CSS variables (e.g. in calc()) and the other\n * doesn't, we need to measure to convert to pixels. This handles GitHub issue #3410.\n */\n const originHasVar = containsCSSVariable(origin);\n const targetHasVar = containsCSSVariable(target);\n if (originHasVar !== targetHasVar && positionalValues[name]) {\n this.needsMeasurement = true;\n return;\n }\n /**\n * Either we don't recognise these value types or we can animate between them.\n */\n if (originType === targetType)\n return;\n /**\n * If both values are numbers or pixels, we can animate between them by\n * converting them to numbers.\n */\n if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n const value = unresolvedKeyframes[i];\n if (typeof value === \"string\") {\n unresolvedKeyframes[i] = parseFloat(value);\n }\n }\n }\n else if (positionalValues[name]) {\n /**\n * Else, the only way to resolve this is by measuring the element.\n */\n this.needsMeasurement = true;\n }\n }\n resolveNoneKeyframes() {\n const { unresolvedKeyframes, name } = this;\n const noneKeyframeIndexes = [];\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n if (unresolvedKeyframes[i] === null ||\n isNone(unresolvedKeyframes[i])) {\n noneKeyframeIndexes.push(i);\n }\n }\n if (noneKeyframeIndexes.length) {\n makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);\n }\n }\n measure() {\n const { element, name } = this;\n return positionalValues[name](window.getComputedStyle(element.current), () => element.measureViewportBox());\n }\n measureInitialState() {\n const { element, unresolvedKeyframes, name } = this;\n if (!element?.current)\n return;\n if (name === \"height\")\n this.suspendedScrollY = window.pageYOffset;\n this.measuredOrigin = this.measure();\n unresolvedKeyframes[0] = this.measuredOrigin;\n // Set final key frame to measure after next render\n const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];\n if (measureKeyframe !== undefined) {\n this.motionValue?.jump(measureKeyframe, false);\n }\n }\n measureEndState() {\n const { element, unresolvedKeyframes } = this;\n if (!element?.current)\n return;\n this.motionValue?.jump(this.measuredOrigin, false);\n const finalKeyframeIndex = unresolvedKeyframes.length - 1;\n const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];\n unresolvedKeyframes[finalKeyframeIndex] = this.measure();\n if (finalKeyframe !== null && this.finalKeyframe === undefined) {\n this.finalKeyframe = finalKeyframe;\n }\n this.resolveNoneKeyframes();\n }\n}\n\nexport { DOMKeyframesResolver };\n//# sourceMappingURL=DOMKeyframesResolver.mjs.map\n"],"names":["DOMKeyframesResolver","KeyframeResolver","constructor","unresolvedKeyframes","onComplete","name","motionValue","element","super","scheduleResolve","this","canReadNow","readKeyframes","needsMeasurement","complete","origin","get","current","undefined","i","length","containsCSSVariable","keyframe","trim","isCSSVariableToken","resolved","getVariableValue","finalKeyframe","resolveNoneKeyframes","positionalKeys","has","target","originType","findDimensionValueType","targetType","positionalValues","isNumOrPxType","value","parseFloat","noneKeyframeIndexes","isNone","push","makeNoneKeyframesAnimatable","measure","window","getComputedStyle","measureViewportBox","measureInitialState","suspendedScrollY","pageYOffset","measuredOrigin","measureKeyframe","jump","measureEndState","finalKeyframeIndex"],"mappings":"0bAmBM,MAAOA,UAEHC,EAAAA,iBAYNC,WAAAA,CACIC,EACAC,EACAC,EACAC,EACAC,GAEAC,MAAML,EAAqBC,EAAYC,EAAMC,EAAaC,GAAS,EACvE,CAMAE,eAAAA,GACI,GAAIC,KAAKC,eACLD,KAAKE,iBACAF,KAAKG,kBAAkB,OAAOH,KAAKI,WAG5CN,MAAMC,iBACV,CAEQE,UAAAA,GACJ,MAAMR,oBAAEA,EAAmBI,QAAEA,EAAOD,YAAEA,GAAgBI,KAChDK,EAASZ,EAAoB,IAAMG,GAAaU,MAEtD,IAAKT,GAASU,cAAsBC,IAAXH,EAAsB,OAAO,EAEtD,IAAK,IAAII,EAAI,EAAGA,EAAIhB,EAAoBiB,OAAQD,IAC5C,GAAIE,EAAAA,oBAAoBF,EAAIhB,EAAoBgB,GAAKJ,GACjD,OAAO,EAIf,OAAO,CACX,CAEAH,aAAAA,GACI,MAAMT,oBAAEA,EAAmBI,QAAEA,EAAOF,KAAEA,GAASK,KAE/C,IAAKH,GAASU,QAAS,OAEvBT,MAAMI,gBAKN,IAAK,IAAIO,EAAI,EAAGA,EAAIhB,EAAoBiB,OAAQD,IAAK,CACjD,IAAIG,EAAWnB,EAAoBgB,GAEnC,GAAwB,iBAAbG,IACPA,EAAWA,EAASC,OAEhBC,EAAAA,mBAAmBF,IAAW,CAC9B,MAAMG,EAAWC,EAAgBA,iBAACJ,EAAUf,EAAQU,cAEnCC,IAAbO,IACAtB,EAAoBgB,GAAKM,GAGzBN,IAAMhB,EAAoB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AAiBxC,KAAKiC,UAE3BxC,EAAoB,GAAKO,KAAKwC,eAG9B,MAAMC,EACFhD,EAAoBA,EAAoBiB,OAAS,QAE7BF,IAApBiC,GACAzC,KAAKJ,aAAa8C,KAAKD,GAAsB,EAErD,CAEAE,eAAAA,GACI,MAAM9C,QAAEA,EAAOJ,oBAAEA,GAAwBO,KAEzC,IAAKH,GAASU,QAAS,OAEvBP,KAAKJ,aAAa8C,KAAK1C,KAAKwC,gBAAqB,GAEjD,MAAMI,EAAqBnD,EAAoBiB,OAAS,EAClDO,EAAgBxB,EAAoBmD,GAE1CnD,EAAoBmD,GAAsB5C,KAAKiC,UAEzB,OAAlBhB,QAAiDT,IAAvBR,KAAKiB,gBAC/BjB,KAAKiB,cAAgBA,GAGzBjB,KAAKkB,sBACT"}
|
package/dist/node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyframesResolver.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs"],"sourcesContent":["import { isNumericalString, isZeroValueString } from 'motion-utils';\nimport { complex } from '../../value/types/complex/index.mjs';\nimport { getAnimatableNone } from '../../value/types/utils/animatable-none.mjs';\nimport { fillWildcards } from './utils/fill-wildcards.mjs';\nimport { boxDependentValues, removeNonTranslationalTransform } from './utils/unit-conversion.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\n\nconst toResolve = new Set();\nlet isScheduled = false;\nlet anyNeedsMeasurement = false;\nlet isForced = false;\nfunction measureAllKeyframes() {\n if (anyNeedsMeasurement) {\n const resolversToMeasure = [];\n const elementsToMeasure = new Set();\n const elementsToUntransform = new Set();\n toResolve.forEach((resolver) => {\n if (!resolver.needsMeasurement)\n return;\n resolversToMeasure.push(resolver);\n elementsToMeasure.add(resolver.element);\n if (boxDependentValues.has(resolver.name)) {\n elementsToUntransform.add(resolver.element);\n }\n });\n const transformsToRestore = new Map();\n /**\n * Write pass\n * Values measured from the bounding box need bounding box-changing\n * transforms removed first. Values read from computed style don't.\n */\n elementsToUntransform.forEach((element) => {\n const removedTransforms = removeNonTranslationalTransform(element);\n if (!removedTransforms.length)\n return;\n transformsToRestore.set(element, removedTransforms);\n element.render();\n });\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureInitialState());\n // Write\n elementsToMeasure.forEach((element) => {\n element.render();\n const restore = transformsToRestore.get(element);\n if (restore) {\n restore.forEach(([key, value]) => {\n element.getValue(key)?.set(value);\n });\n }\n });\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureEndState());\n // Write\n resolversToMeasure.forEach((resolver) => {\n if (resolver.suspendedScrollY !== undefined) {\n window.scrollTo(0, resolver.suspendedScrollY);\n }\n });\n }\n anyNeedsMeasurement = false;\n isScheduled = false;\n toResolve.forEach((resolver) => resolver.complete(isForced));\n toResolve.clear();\n}\nfunction readAllKeyframes() {\n toResolve.forEach((resolver) => {\n resolver.readKeyframes();\n if (resolver.needsMeasurement) {\n anyNeedsMeasurement = true;\n }\n });\n}\nfunction flushKeyframeResolvers() {\n isForced = true;\n readAllKeyframes();\n measureAllKeyframes();\n isForced = false;\n}\n/**\n * Normalise a value read from the subject into an animation origin: a\n * number read as a string (\"0\", \"200\") becomes a number, and a value\n * that isn't animatable (e.g. \"none\") but whose target is becomes an\n * animatable zero in the shape of the target.\n */\nfunction readOrigin(value, name, target) {\n if (typeof value === \"string\") {\n if (isNumericalString(value) || isZeroValueString(value)) {\n return parseFloat(value);\n }\n else if (!complex.test(value) && complex.test(target)) {\n return getAnimatableNone(name, target);\n }\n }\n return value ?? undefined;\n}\nclass KeyframeResolver {\n constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {\n this.state = \"pending\";\n /**\n * Track whether this resolver is async. If it is, it'll be added to the\n * resolver queue and flushed in the next frame. Resolvers that aren't going\n * to trigger read/write thrashing don't need to be async.\n */\n this.isAsync = false;\n /**\n * Track whether this resolver needs to perform a measurement\n * to resolve its keyframes.\n */\n this.needsMeasurement = false;\n this.unresolvedKeyframes = [...unresolvedKeyframes];\n this.onComplete = onComplete;\n this.name = name;\n this.motionValue = motionValue;\n this.element = element;\n this.isAsync = isAsync;\n }\n scheduleResolve() {\n this.state = \"scheduled\";\n if (this.isAsync) {\n toResolve.add(this);\n if (!isScheduled) {\n isScheduled = true;\n frame.read(readAllKeyframes);\n frame.resolveKeyframes(measureAllKeyframes);\n }\n }\n else {\n this.readKeyframes();\n this.complete();\n }\n }\n readKeyframes() {\n const { unresolvedKeyframes, name, element, motionValue } = this;\n // If initial keyframe is null we need to read it from the DOM\n if (unresolvedKeyframes[0] === null) {\n const currentValue = motionValue?.get();\n // TODO: This doesn't work if the final keyframe is a wildcard\n const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];\n if (currentValue !== undefined) {\n unresolvedKeyframes[0] = currentValue;\n }\n else if (element && name) {\n const valueAsRead = readOrigin(element.readValue(name, finalKeyframe), name, finalKeyframe);\n if (valueAsRead !== undefined) {\n unresolvedKeyframes[0] = valueAsRead;\n }\n }\n if (unresolvedKeyframes[0] === undefined) {\n unresolvedKeyframes[0] = finalKeyframe;\n }\n if (motionValue && currentValue === undefined) {\n motionValue.set(unresolvedKeyframes[0]);\n }\n }\n fillWildcards(unresolvedKeyframes);\n }\n setFinalKeyframe() { }\n measureInitialState() { }\n renderEndStyles() { }\n measureEndState() { }\n complete(isForcedComplete = false) {\n this.state = \"complete\";\n this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, isForcedComplete);\n toResolve.delete(this);\n }\n cancel() {\n if (this.state === \"scheduled\") {\n toResolve.delete(this);\n this.state = \"pending\";\n }\n }\n resume() {\n if (this.state === \"pending\")\n this.scheduleResolve();\n }\n}\n\nexport { KeyframeResolver, flushKeyframeResolvers };\n//# sourceMappingURL=KeyframesResolver.mjs.map\n"],"names":["toResolve","Set","isScheduled","anyNeedsMeasurement","isForced","measureAllKeyframes","resolversToMeasure","elementsToMeasure","elementsToUntransform","forEach","resolver","needsMeasurement","push","add","element","boxDependentValues","has","name","transformsToRestore","Map","removedTransforms","removeNonTranslationalTransform","length","set","render","measureInitialState","restore","get","key","value","getValue","measureEndState","undefined","suspendedScrollY","window","scrollTo","complete","clear","readAllKeyframes","readKeyframes","constructor","unresolvedKeyframes","onComplete","motionValue","isAsync","this","state","scheduleResolve","frame","read","resolveKeyframes","currentValue","finalKeyframe","valueAsRead","target","isNumericalString","isZeroValueString","parseFloat","complex","test","getAnimatableNone","readOrigin","readValue","fillWildcards","setFinalKeyframe","renderEndStyles","isForcedComplete","delete","cancel","resume","flushKeyframeResolvers"],"mappings":"kdAiBA,MAAMA,EAAY,IAAIC,IACtB,IAAIC,GAAc,EACdC,GAAsB,EACtBC,GAAW,EAEf,SAASC,IACL,GAAIF,EAAqB,CACrB,MAAMG,EAAyC,GACzCC,EAAoB,IAAIN,IACxBO,EAAwB,IAAIP,IAElCD,EAAUS,QAASC,IACVA,EAASC,mBAEdL,EAAmBM,KAAKF,GACxBH,EAAkBM,IAAIH,EAASI,SAE3BC,qBAAmBC,IAAIN,EAASO,OAChCT,EAAsBK,IAAIH,EAASI,YAI3C,MAAMI,EAAsB,IAAIC,IAUhCX,EAAsBC,QAASK,IAC3B,MAAMM,EAAoBC,kCACtBP,GAGCM,EAAkBE,SAEvBJ,EAAoBK,IAAIT,EAASM,GAEjCN,EAAQU,YAIZlB,EAAmBG,QAASC,GAAaA,EAASe,uBAGlDlB,EAAkBE,QAASK,IACvBA,EAAQU,SAER,MAAME,EAAUR,EAAoBS,IAAIb,GACpCY,GACAA,EAAQjB,QAAQ,EAAEmB,EAAKC,MACnBf,EAAQgB,SAASF,IAAML,IAAIM,OAMvCvB,EAAmBG,QAASC,GAAaA,EAASqB,mBAGlDzB,EAAmBG,QAASC,SACUsB,IAA9BtB,EAASuB,kBACTC,OAAOC,SAAS,EAAGzB,EAASuB,mBAGxC,CAEA9B,GAAsB,EACtBD,GAAc,EAEdF,EAAUS,QA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,EAAoB,GAAKY,EAEjC,MAE+BrB,IAA3BS,EAAoB,KACpBA,EAAoB,GAAKW,GAGzBT,QAAgCX,IAAjBmB,GACfR,EAAYpB,IAAIkB,EAAoB,GAE5C,CAEAsB,EAAaA,cAACtB,EAClB,CAEAuB,gBAAAA,GAAoB,CACpBvC,mBAAAA,GAAuB,CACvBwC,eAAAA,GAAmB,CACnBlC,eAAAA,GAAmB,CAEnBK,QAAAA,CAAS8B,GAAmB,GACxBrB,KAAKC,MAAQ,WAEbD,KAAKH,WACDG,KAAKJ,oBACLI,KAAKO,cACLc,GAGJlE,EAAUmE,OAAOtB,KACrB,CAEAuB,MAAAA,GACuB,cAAfvB,KAAKC,QACL9C,EAAUmE,OAAOtB,MACjBA,KAAKC,MAAQ,UAErB,CAEAuB,MAAAA,GACuB,YAAfxB,KAAKC,OAAqBD,KAAKE,iBACvC,kCA7JYuB,WACZlE,GAAW,EACXkC,IACAjC,IACAD,GAAW,CACf"}
|
|
1
|
+
{"version":3,"file":"KeyframesResolver.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs"],"sourcesContent":["import { isNumericalString, isZeroValueString } from 'motion-utils';\nimport { complex } from '../../value/types/complex/index.mjs';\nimport { getAnimatableNone } from '../../value/types/utils/animatable-none.mjs';\nimport { fillWildcards } from './utils/fill-wildcards.mjs';\nimport { boxDependentValues, removeNonTranslationalTransform } from './utils/unit-conversion.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\n\nconst toResolve = new Set();\nlet isScheduled = false;\nlet anyNeedsMeasurement = false;\nlet isForced = false;\nfunction measureAllKeyframes() {\n if (anyNeedsMeasurement) {\n const resolversToMeasure = [];\n const elementsToMeasure = new Set();\n const elementsToUntransform = new Set();\n toResolve.forEach((resolver) => {\n if (!resolver.needsMeasurement)\n return;\n resolversToMeasure.push(resolver);\n elementsToMeasure.add(resolver.element);\n if (boxDependentValues.has(resolver.name)) {\n elementsToUntransform.add(resolver.element);\n }\n });\n const transformsToRestore = new Map();\n /**\n * Write pass\n * Values measured from the bounding box need bounding box-changing\n * transforms removed first. Values read from computed style don't.\n */\n elementsToUntransform.forEach((element) => {\n const removedTransforms = removeNonTranslationalTransform(element);\n if (!removedTransforms.length)\n return;\n transformsToRestore.set(element, removedTransforms);\n element.render();\n });\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureInitialState());\n // Write\n elementsToMeasure.forEach((element) => {\n element.render();\n const restore = transformsToRestore.get(element);\n if (restore) {\n restore.forEach(([key, value]) => {\n element.getValue(key)?.set(value);\n });\n }\n });\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureEndState());\n // Write\n resolversToMeasure.forEach((resolver) => {\n if (resolver.suspendedScrollY !== undefined) {\n window.scrollTo(0, resolver.suspendedScrollY);\n }\n });\n }\n anyNeedsMeasurement = false;\n isScheduled = false;\n toResolve.forEach((resolver) => resolver.complete(isForced));\n toResolve.clear();\n}\nfunction readAllKeyframes() {\n toResolve.forEach((resolver) => {\n resolver.readKeyframes();\n if (resolver.needsMeasurement) {\n anyNeedsMeasurement = true;\n }\n });\n}\nfunction flushKeyframeResolvers() {\n isForced = true;\n readAllKeyframes();\n measureAllKeyframes();\n isForced = false;\n}\n/**\n * Normalise a value read from the subject into an animation origin: a\n * number read as a string (\"0\", \"200\") becomes a number, and a value\n * that isn't animatable (e.g. \"none\") but whose target is becomes an\n * animatable zero in the shape of the target.\n */\nfunction readOrigin(value, name, target) {\n if (typeof value === \"string\") {\n if (isNumericalString(value) || isZeroValueString(value)) {\n return parseFloat(value);\n }\n else if (!complex.test(value) && complex.test(target)) {\n return getAnimatableNone(name, target);\n }\n }\n return value ?? undefined;\n}\nclass KeyframeResolver {\n constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {\n this.state = \"pending\";\n /**\n * Track whether this resolver is async. If it is, it'll be added to the\n * resolver queue and flushed in the next frame. Resolvers that aren't going\n * to trigger read/write thrashing don't need to be async.\n */\n this.isAsync = false;\n /**\n * Track whether this resolver needs to perform a measurement\n * to resolve its keyframes.\n */\n this.needsMeasurement = false;\n this.unresolvedKeyframes = [...unresolvedKeyframes];\n this.onComplete = onComplete;\n this.name = name;\n this.motionValue = motionValue;\n this.element = element;\n this.isAsync = isAsync;\n }\n scheduleResolve() {\n this.state = \"scheduled\";\n if (this.isAsync) {\n toResolve.add(this);\n if (!isScheduled) {\n isScheduled = true;\n frame.read(readAllKeyframes);\n frame.resolveKeyframes(measureAllKeyframes);\n }\n }\n else {\n this.readKeyframes();\n this.complete();\n }\n }\n readKeyframes() {\n const { unresolvedKeyframes, name, element, motionValue } = this;\n // If initial keyframe is null we need to read it from the DOM\n if (unresolvedKeyframes[0] === null) {\n const currentValue = motionValue?.get();\n // TODO: This doesn't work if the final keyframe is a wildcard\n const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];\n if (currentValue !== undefined) {\n unresolvedKeyframes[0] = currentValue;\n }\n else if (element && name) {\n const valueAsRead = readOrigin(element.readValue(name, finalKeyframe), name, finalKeyframe);\n if (valueAsRead !== undefined) {\n unresolvedKeyframes[0] = valueAsRead;\n }\n }\n if (unresolvedKeyframes[0] === undefined) {\n unresolvedKeyframes[0] = finalKeyframe;\n }\n if (motionValue && currentValue === undefined) {\n motionValue.set(unresolvedKeyframes[0]);\n }\n }\n fillWildcards(unresolvedKeyframes);\n }\n setFinalKeyframe() { }\n measureInitialState() { }\n renderEndStyles() { }\n measureEndState() { }\n complete(isForcedComplete = false) {\n this.state = \"complete\";\n this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, isForcedComplete);\n toResolve.delete(this);\n }\n cancel() {\n if (this.state === \"scheduled\") {\n toResolve.delete(this);\n this.state = \"pending\";\n }\n }\n resume() {\n if (this.state === \"pending\")\n this.scheduleResolve();\n }\n}\n\nexport { KeyframeResolver, flushKeyframeResolvers };\n//# sourceMappingURL=KeyframesResolver.mjs.map\n"],"names":["toResolve","Set","isScheduled","anyNeedsMeasurement","isForced","measureAllKeyframes","resolversToMeasure","elementsToMeasure","elementsToUntransform","forEach","resolver","needsMeasurement","push","add","element","boxDependentValues","has","name","transformsToRestore","Map","removedTransforms","removeNonTranslationalTransform","length","set","render","measureInitialState","restore","get","key","value","getValue","measureEndState","undefined","suspendedScrollY","window","scrollTo","complete","clear","readAllKeyframes","readKeyframes","constructor","unresolvedKeyframes","onComplete","motionValue","isAsync","this","state","scheduleResolve","frame","read","resolveKeyframes","currentValue","finalKeyframe","valueAsRead","target","isNumericalString","isZeroValueString","parseFloat","complex","test","getAnimatableNone","readOrigin","readValue","fillWildcards","setFinalKeyframe","renderEndStyles","isForcedComplete","delete","cancel","resume","flushKeyframeResolvers"],"mappings":"kdAiBA,MAAMA,EAAY,IAAIC,IACtB,IAAIC,GAAc,EACdC,GAAsB,EACtBC,GAAW,EAEf,SAASC,IACL,GAAIF,EAAqB,CACrB,MAAMG,EAAyC,GACzCC,EAAoB,IAAIN,IACxBO,EAAwB,IAAIP,IAElCD,EAAUS,QAASC,IACVA,EAASC,mBAEdL,EAAmBM,KAAKF,GACxBH,EAAkBM,IAAIH,EAASI,SAE3BC,qBAAmBC,IAAIN,EAASO,OAChCT,EAAsBK,IAAIH,EAASI,YAI3C,MAAMI,EAAsB,IAAIC,IAUhCX,EAAsBC,QAASK,IAC3B,MAAMM,EAAoBC,kCACtBP,GAGCM,EAAkBE,SAEvBJ,EAAoBK,IAAIT,EAASM,GAEjCN,EAAQU,YAIZlB,EAAmBG,QAASC,GAAaA,EAASe,uBAGlDlB,EAAkBE,QAASK,IACvBA,EAAQU,SAER,MAAME,EAAUR,EAAoBS,IAAIb,GACpCY,GACAA,EAAQjB,QAAQ,EAAEmB,EAAKC,MACnBf,EAAQgB,SAASF,IAAML,IAAIM,OAMvCvB,EAAmBG,QAASC,GAAaA,EAASqB,mBAGlDzB,EAAmBG,QAASC,SACUsB,IAA9BtB,EAASuB,kBACTC,OAAOC,SAAS,EAAGzB,EAASuB,mBAGxC,CAEA9B,GAAsB,EACtBD,GA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BpB,IAAhBqB,IACAZ,EAAoB,GAAKY,EAEjC,MAE+BrB,IAA3BS,EAAoB,KACpBA,EAAoB,GAAKW,GAGzBT,QAAgCX,IAAjBmB,GACfR,EAAYpB,IAAIkB,EAAoB,GAE5C,CAEAsB,EAAaA,cAACtB,EAClB,CAEAuB,gBAAAA,GAAoB,CACpBvC,mBAAAA,GAAuB,CACvBwC,eAAAA,GAAmB,CACnBlC,eAAAA,GAAmB,CAEnBK,QAAAA,CAAS8B,GAAmB,GACxBrB,KAAKC,MAAQ,WAEbD,KAAKH,WACDG,KAAKJ,oBACLI,KAAKO,cACLc,GAGJlE,EAAUmE,OAAOtB,KACrB,CAEAuB,MAAAA,GACuB,cAAfvB,KAAKC,QACL9C,EAAUmE,OAAOtB,MACjBA,KAAKC,MAAQ,UAErB,CAEAuB,MAAAA,GACuB,YAAfxB,KAAKC,OAAqBD,KAAKE,iBACvC,kCA7JYuB,WACZlE,GAAW,EACXkC,IACAjC,IACAD,GAAW,CACf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0})
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFinalKeyframe=function(e,{repeat:t,repeatType:o="loop"},r,l=1){let n,p,s=0;for(let t=0;t<e.length;t++){const o=e[t];null!==o&&(s++||(n=o),p=o)}const u=l<0||t&&"loop"!==o&&t%2==1?0:s-1;return u&&void 0!==r?r:u?p:n};
|
|
2
2
|
//# sourceMappingURL=get-final.mjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-final.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"get-final.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs"],"sourcesContent":["function getFinalKeyframe(keyframes, { repeat, repeatType = \"loop\" }, finalKeyframe, speed = 1) {\n /**\n * The first and last keyframes that aren't null, and how many there\n * are. Found in one pass rather than filtering into a new array, as\n * this runs for every value of every animation.\n */\n let first;\n let last;\n let numResolved = 0;\n for (let i = 0; i < keyframes.length; i++) {\n const keyframe = keyframes[i];\n if (keyframe !== null) {\n if (!numResolved++)\n first = keyframe;\n last = keyframe;\n }\n }\n const useFirstKeyframe = speed < 0 || (repeat && repeatType !== \"loop\" && repeat % 2 === 1);\n const index = useFirstKeyframe ? 0 : numResolved - 1;\n return !index || finalKeyframe === undefined\n ? (index ? last : first)\n : finalKeyframe;\n}\n\nexport { getFinalKeyframe };\n//# sourceMappingURL=get-final.mjs.map\n"],"names":["keyframes","repeat","repeatType","finalKeyframe","speed","first","last","numResolved","i","length","keyframe","index","undefined"],"mappings":"sGAGIA,GACAC,OAAEA,EAAMC,WAAEA,EAAa,QACvBC,EACAC,EAAgB,GAOhB,IAAIC,EACAC,EACAC,EAAc,EAClB,IAAK,IAAIC,EAAI,EAAGA,EAAIR,EAAUS,OAAQD,IAAK,CACvC,MAAME,EAAWV,EAAUQ,GACV,OAAbE,IACKH,MAAeF,EAAQK,GAC5BJ,EAAOI,EAEf,CAEA,MAEMC,EADFP,EAAQ,GAAMH,GAAyB,SAAfC,GAAyBD,EAAS,GAAM,EACnC,EAAIM,EAAc,EAEnD,OAAQI,QAA2BC,IAAlBT,EAEXA,EADEQ,EAAQL,EAAOD,CAE3B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../generators/utils/is-generator.mjs.js"),t=require("./is-animatable.mjs.js"),r=require("../../../../../motion-utils/dist/es/errors.mjs.js");exports.canAnimate=function(i,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../generators/utils/is-generator.mjs.js"),t=require("./is-animatable.mjs.js"),r=require("../../../../../motion-utils/dist/es/errors.mjs.js");exports.canAnimate=function(n,i,s,a){const o=n[0];if(null===o)return!1;if("display"===i||"visibility"===i)return!0;const u=n[n.length-1],l=t.isAnimatable(o,i),m=t.isAnimatable(u,i);return l&&m?function(e){const t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(n)||("spring"===s||e.isGenerator(s))&&a:(l!==m&&"production"!==process.env.NODE_ENV&&r.warning(!1,`You are trying to animate ${i} from "${o}" to "${u}". "${l?u:o}" is not an animatable value.`,"value-not-animatable"),!1)};
|
|
2
2
|
//# sourceMappingURL=can-animate.mjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-animate.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/utils/can-animate.mjs"],"sourcesContent":["import { warning } from 'motion-utils';\nimport { isGenerator } from '../generators/utils/is-generator.mjs';\nimport { isAnimatable } from './is-animatable.mjs';\n\nfunction hasKeyframesChanged(keyframes) {\n const current = keyframes[0];\n if (keyframes.length === 1)\n return true;\n for (let i = 0; i < keyframes.length; i++) {\n if (keyframes[i] !== current)\n return true;\n }\n}\nfunction canAnimate(keyframes, name, type, velocity) {\n /**\n * Check if we're able to animate between the start and end keyframes,\n * and throw a warning if we're attempting to animate between one that's\n * animatable and another that isn't.\n */\n const originKeyframe = keyframes[0];\n if (originKeyframe === null) {\n return false;\n }\n /**\n * These aren't traditionally animatable but we do support them.\n * In future we could look into making this more generic or replacing\n * this function with mix() === mixImmediate\n */\n if (name === \"display\" || name === \"visibility\")\n return true;\n const targetKeyframe = keyframes[keyframes.length - 1];\n const isOriginAnimatable = isAnimatable(originKeyframe, name);\n const isTargetAnimatable = isAnimatable(targetKeyframe, name);\n // Always skip if any of these are true\n if (!isOriginAnimatable || !isTargetAnimatable) {\n // Only build the message when we're going to warn\n isOriginAnimatable !== isTargetAnimatable &&\n warning(false, `You are trying to animate ${name} from \"${originKeyframe}\" to \"${targetKeyframe}\". \"${isOriginAnimatable ? targetKeyframe : originKeyframe}\" is not an animatable value.`, \"value-not-animatable\");\n return false;\n }\n return (hasKeyframesChanged(keyframes) ||\n ((type === \"spring\" || isGenerator(type)) && velocity));\n}\n\nexport { canAnimate };\n//# sourceMappingURL=can-animate.mjs.map\n"],"names":["keyframes","name","type","velocity","originKeyframe","targetKeyframe","length","isOriginAnimatable","isAnimatable","isTargetAnimatable","current","i","hasKeyframesChanged","isGenerator","warning"],"mappings":"mPAcM,SACFA,EACAC,EACAC,EACAC,GAOA,MAAMC,EAAiBJ,EAAU,GACjC,GAAuB,OAAnBI,EACA,OAAO,EAQX,GAAa,YAATH,GAA+B,eAATA,EAAuB,OAAO,EAExD,MAAMI,EAAiBL,EAAUA,EAAUM,OAAS,GAC9CC,EAAqBC,EAAAA,aAAaJ,EAAgBH,GAClDQ,EAAqBD,EAAAA,aAAaH,EAAgBJ,GAGxD,OAAKM,GAAuBE,EApChC,SAA6BT,GACzB,MAAMU,EAAUV,EAAU,GAC1B,GAAyB,IAArBA,EAAUM,OAAc,OAAO,EACnC,IAAK,IAAIK,EAAI,EAAGA,EAAIX,EAAUM,OAAQK,IAClC,GAAIX,EAAUW,KAAOD,EAAS,OAAO,CAE7C,
|
|
1
|
+
{"version":3,"file":"can-animate.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/utils/can-animate.mjs"],"sourcesContent":["import { warning } from 'motion-utils';\nimport { isGenerator } from '../generators/utils/is-generator.mjs';\nimport { isAnimatable } from './is-animatable.mjs';\n\nfunction hasKeyframesChanged(keyframes) {\n const current = keyframes[0];\n if (keyframes.length === 1)\n return true;\n for (let i = 0; i < keyframes.length; i++) {\n if (keyframes[i] !== current)\n return true;\n }\n}\nfunction canAnimate(keyframes, name, type, velocity) {\n /**\n * Check if we're able to animate between the start and end keyframes,\n * and throw a warning if we're attempting to animate between one that's\n * animatable and another that isn't.\n */\n const originKeyframe = keyframes[0];\n if (originKeyframe === null) {\n return false;\n }\n /**\n * These aren't traditionally animatable but we do support them.\n * In future we could look into making this more generic or replacing\n * this function with mix() === mixImmediate\n */\n if (name === \"display\" || name === \"visibility\")\n return true;\n const targetKeyframe = keyframes[keyframes.length - 1];\n const isOriginAnimatable = isAnimatable(originKeyframe, name);\n const isTargetAnimatable = isAnimatable(targetKeyframe, name);\n // Always skip if any of these are true\n if (!isOriginAnimatable || !isTargetAnimatable) {\n // Only build the message when we're going to warn\n isOriginAnimatable !== isTargetAnimatable &&\n process.env.NODE_ENV !== \"production\" &&\n warning(false, `You are trying to animate ${name} from \"${originKeyframe}\" to \"${targetKeyframe}\". \"${isOriginAnimatable ? targetKeyframe : originKeyframe}\" is not an animatable value.`, \"value-not-animatable\");\n return false;\n }\n return (hasKeyframesChanged(keyframes) ||\n ((type === \"spring\" || isGenerator(type)) && velocity));\n}\n\nexport { canAnimate };\n//# sourceMappingURL=can-animate.mjs.map\n"],"names":["keyframes","name","type","velocity","originKeyframe","targetKeyframe","length","isOriginAnimatable","isAnimatable","isTargetAnimatable","current","i","hasKeyframesChanged","isGenerator","process","env","NODE_ENV","warning"],"mappings":"mPAcM,SACFA,EACAC,EACAC,EACAC,GAOA,MAAMC,EAAiBJ,EAAU,GACjC,GAAuB,OAAnBI,EACA,OAAO,EAQX,GAAa,YAATH,GAA+B,eAATA,EAAuB,OAAO,EAExD,MAAMI,EAAiBL,EAAUA,EAAUM,OAAS,GAC9CC,EAAqBC,EAAAA,aAAaJ,EAAgBH,GAClDQ,EAAqBD,EAAAA,aAAaH,EAAgBJ,GAGxD,OAAKM,GAAuBE,EApChC,SAA6BT,GACzB,MAAMU,EAAUV,EAAU,GAC1B,GAAyB,IAArBA,EAAUM,OAAc,OAAO,EACnC,IAAK,IAAIK,EAAI,EAAGA,EAAIX,EAAUM,OAAQK,IAClC,GAAIX,EAAUW,KAAOD,EAAS,OAAO,CAE7C,CA8CQE,CAAoBZ,KACT,WAATE,GAAqBW,EAAWA,YAACX,KAAUC,GAf7CI,IAAuBE,GACM,eAAzBK,QAAQC,IAAIC,UACZC,WACI,EACA,6BAA6BhB,WAAcG,UAAuBC,QAC9DE,EAAqBF,EAAiBD,iCAE1C,yBAGD,EAOf"}
|
package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./is-css-variable.mjs.js"),r=require("../../../../../motion-utils/dist/es/errors.mjs.js"),t=require("../../../../../motion-utils/dist/es/is-numerical-string.mjs.js");const i=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function s(e){const r=i.exec(e);if(!r)return[,];const[,t,s,a]=r;return[`--${t??s}`,a]}exports.getVariableValue=function i(a,n,o=1){r.invariant(o<=4,`Max CSS variable fallback depth detected in property "${a}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[c,u]=s(a);if(!c)return;const l=window.getComputedStyle(n).getPropertyValue(c);if(l){const e=l.trim();return t.isNumericalString(e)?parseFloat(e):e}return e.isCSSVariableToken(u)?i(u,n,o+1):u},exports.parseCSSVariable=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./is-css-variable.mjs.js"),r=require("../../../../../motion-utils/dist/es/errors.mjs.js"),t=require("../../../../../motion-utils/dist/es/is-numerical-string.mjs.js");const i=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function s(e){const r=i.exec(e);if(!r)return[,];const[,t,s,a]=r;return[`--${t??s}`,a]}exports.getVariableValue=function i(a,n,o=1){"production"!==process.env.NODE_ENV&&r.invariant(o<=4,`Max CSS variable fallback depth detected in property "${a}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[c,u]=s(a);if(!c)return;const l=window.getComputedStyle(n).getPropertyValue(c);if(l){const e=l.trim();return t.isNumericalString(e)?parseFloat(e):e}return e.isCSSVariableToken(u)?i(u,n,o+1):u},exports.parseCSSVariable=s;
|
|
2
2
|
//# sourceMappingURL=css-variables-conversion.mjs.js.map
|
package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-variables-conversion.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs"],"sourcesContent":["import { invariant, isNumericalString } from 'motion-utils';\nimport { isCSSVariableToken } from './is-css-variable.mjs';\n\n/**\n * Parse Framer's special CSS variable format into a CSS token and a fallback.\n *\n * ```\n * `var(--foo, #fff)` => [`--foo`, '#fff']\n * ```\n *\n * @param current\n */\nconst splitCSSVariableRegex = \n// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words\n/^var\\(--(?:([\\w-]+)|([\\w-]+), ?([a-zA-Z\\d ()%#.,-]+))\\)/u;\nfunction parseCSSVariable(current) {\n const match = splitCSSVariableRegex.exec(current);\n if (!match)\n return [,];\n const [, token1, token2, fallback] = match;\n return [`--${token1 ?? token2}`, fallback];\n}\nconst maxDepth = 4;\nfunction getVariableValue(current, element, depth = 1) {\n invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property \"${current}\". This may indicate a circular fallback dependency.`, \"max-css-var-depth\");\n const [token, fallback] = parseCSSVariable(current);\n // No CSS variable detected\n if (!token)\n return;\n // Attempt to read this CSS variable off the element\n const resolved = window.getComputedStyle(element).getPropertyValue(token);\n if (resolved) {\n const trimmed = resolved.trim();\n return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;\n }\n return isCSSVariableToken(fallback)\n ? getVariableValue(fallback, element, depth + 1)\n : fallback;\n}\n\nexport { getVariableValue, parseCSSVariable };\n//# sourceMappingURL=css-variables-conversion.mjs.map\n"],"names":["splitCSSVariableRegex","parseCSSVariable","current","match","exec","token1","token2","fallback","getVariableValue","element","depth","invariant","token","resolved","window","getComputedStyle","getPropertyValue","trimmed","trim","isNumericalString","parseFloat","isCSSVariableToken"],"mappings":"yPAcA,MAAMA,EAEF,2DACE,SAAUC,EAAiBC,GAC7B,MAAMC,EAAQH,EAAsBI,KAAKF,GACzC,IAAKC,EAAO,MAAO,IAEnB,MAASE,CAAAA,EAAQC,EAAQC,GAAYJ,EACrC,MAAO,CAAC,KAAKE,GAAUC,IAAUC,EACrC,0BAGM,SAAUC,EACZN,EACAO,EACAC,EAAQ,
|
|
1
|
+
{"version":3,"file":"css-variables-conversion.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs"],"sourcesContent":["import { invariant, isNumericalString } from 'motion-utils';\nimport { isCSSVariableToken } from './is-css-variable.mjs';\n\n/**\n * Parse Framer's special CSS variable format into a CSS token and a fallback.\n *\n * ```\n * `var(--foo, #fff)` => [`--foo`, '#fff']\n * ```\n *\n * @param current\n */\nconst splitCSSVariableRegex = \n// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words\n/^var\\(--(?:([\\w-]+)|([\\w-]+), ?([a-zA-Z\\d ()%#.,-]+))\\)/u;\nfunction parseCSSVariable(current) {\n const match = splitCSSVariableRegex.exec(current);\n if (!match)\n return [,];\n const [, token1, token2, fallback] = match;\n return [`--${token1 ?? token2}`, fallback];\n}\nconst maxDepth = 4;\nfunction getVariableValue(current, element, depth = 1) {\n process.env.NODE_ENV !== \"production\" &&\n invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property \"${current}\". This may indicate a circular fallback dependency.`, \"max-css-var-depth\");\n const [token, fallback] = parseCSSVariable(current);\n // No CSS variable detected\n if (!token)\n return;\n // Attempt to read this CSS variable off the element\n const resolved = window.getComputedStyle(element).getPropertyValue(token);\n if (resolved) {\n const trimmed = resolved.trim();\n return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;\n }\n return isCSSVariableToken(fallback)\n ? getVariableValue(fallback, element, depth + 1)\n : fallback;\n}\n\nexport { getVariableValue, parseCSSVariable };\n//# sourceMappingURL=css-variables-conversion.mjs.map\n"],"names":["splitCSSVariableRegex","parseCSSVariable","current","match","exec","token1","token2","fallback","getVariableValue","element","depth","process","env","NODE_ENV","invariant","token","resolved","window","getComputedStyle","getPropertyValue","trimmed","trim","isNumericalString","parseFloat","isCSSVariableToken"],"mappings":"yPAcA,MAAMA,EAEF,2DACE,SAAUC,EAAiBC,GAC7B,MAAMC,EAAQH,EAAsBI,KAAKF,GACzC,IAAKC,EAAO,MAAO,IAEnB,MAASE,CAAAA,EAAQC,EAAQC,GAAYJ,EACrC,MAAO,CAAC,KAAKE,GAAUC,IAAUC,EACrC,0BAGM,SAAUC,EACZN,EACAO,EACAC,EAAQ,GAEiB,eAAzBC,QAAQC,IAAIC,UACRC,EAASA,UACLJ,GARK,EASL,yDAAyDR,wDACzD,qBAGR,MAAOa,EAAOR,GAAYN,EAAiBC,GAG3C,IAAKa,EAAO,OAGZ,MAAMC,EAAWC,OAAOC,iBAAiBT,GAASU,iBAAiBJ,GAEnE,GAAIC,EAAU,CACV,MAAMI,EAAUJ,EAASK,OACzB,OAAOC,EAAAA,kBAAkBF,GAAWG,WAAWH,GAAWA,CAC9D,CAEA,OAAOI,EAAkBA,mBAACjB,GACpBC,EAAiBD,EAAUE,EAASC,EAAQ,GAC5CH,CACV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);exports.isTransitionDefined=function(r){for(const t in r)if(!e.has(t))return!0;return!1};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed","out","mixer"]);exports.isTransitionDefined=function(r){for(const t in r)if(!e.has(t))return!0;return!1};
|
|
2
2
|
//# sourceMappingURL=is-transition-defined.mjs.js.map
|
package/dist/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-transition-defined.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs"],"sourcesContent":["const orchestrationKeys = new Set([\n \"when\",\n \"delay\",\n \"delayChildren\",\n \"staggerChildren\",\n \"staggerDirection\",\n \"repeat\",\n \"repeatType\",\n \"repeatDelay\",\n \"from\",\n \"elapsed\",\n]);\n/**\n * Decide whether a transition is defined on a given Transition.\n * This filters out orchestration options and returns true\n * if any options are left.\n */\nfunction isTransitionDefined(transition) {\n for (const key in transition) {\n if (!orchestrationKeys.has(key))\n return true;\n }\n return false;\n}\n\nexport { isTransitionDefined };\n//# sourceMappingURL=is-transition-defined.mjs.map\n"],"names":["orchestrationKeys","Set","transition","key","has"],"mappings":"oEAGA,MAAMA,EAAoB,IAAIC,IAAI,CAC9B,OACA,QACA,gBACA,kBACA,mBACA,SACA,aACA,cACA,OACA,
|
|
1
|
+
{"version":3,"file":"is-transition-defined.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs"],"sourcesContent":["const orchestrationKeys = new Set([\n \"when\",\n \"delay\",\n \"delayChildren\",\n \"staggerChildren\",\n \"staggerDirection\",\n \"repeat\",\n \"repeatType\",\n \"repeatDelay\",\n \"from\",\n \"elapsed\",\n \"out\",\n \"mixer\",\n]);\n/**\n * Decide whether a transition is defined on a given Transition.\n * This filters out orchestration options and returns true\n * if any options are left.\n */\nfunction isTransitionDefined(transition) {\n for (const key in transition) {\n if (!orchestrationKeys.has(key))\n return true;\n }\n return false;\n}\n\nexport { isTransitionDefined };\n//# sourceMappingURL=is-transition-defined.mjs.map\n"],"names":["orchestrationKeys","Set","transition","key","has"],"mappings":"oEAGA,MAAMA,EAAoB,IAAIC,IAAI,CAC9B,OACA,QACA,gBACA,kBACA,mBACA,SACA,aACA,cACA,OACA,UACA,MACA,sCAQE,SACFC,GAEA,IAAK,MAAMC,KAAOD,EACd,IAAKF,EAAkBI,IAAID,GAAM,OAAO,EAE5C,OAAO,CACX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../utils/accelerated-values.mjs.js"),r=require("../utils/is-browser-color.mjs.js"),o=require("../../../../../../motion-utils/dist/es/global-config.mjs.js");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../utils/accelerated-values.mjs.js"),r=require("../utils/is-browser-color.mjs.js"),o=require("../utils/needs-mixer.mjs.js"),t=require("../../../../../../motion-utils/dist/es/global-config.mjs.js");const s=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),n=()=>!t.MotionGlobalConfig.useManualTiming&&Object.hasOwnProperty.call(Element.prototype,"animate");exports.supportsBrowserAnimation=function(t){const{motionValue:a,name:l,repeatDelay:i,repeatType:u,damping:c,type:m,keyframes:p}=t;if(!l||!e.acceleratedValues.has(l)&&!s.has(l))return!1;const d=a?.owner?.current;if(!(d instanceof HTMLElement||d instanceof SVGElement))return!1;const{onUpdate:f,transformTemplate:b}=a.owner.getProps();return n()&&(e.acceleratedValues.has(l)||s.has(l)&&r.hasBrowserOnlyColors(p))&&("transform"!==l||!b)&&!f&&!i&&"mirror"!==u&&0!==c&&"inertia"!==m&&!o.needsMixer(t)},exports.supportsWaapi=n;
|
|
2
2
|
//# sourceMappingURL=waapi.mjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waapi.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs"],"sourcesContent":["import { MotionGlobalConfig } from 'motion-utils';\nimport { acceleratedValues } from '../utils/accelerated-values.mjs';\nimport { hasBrowserOnlyColors } from '../utils/is-browser-color.mjs';\n\nconst colorProperties = new Set([\n \"color\",\n \"backgroundColor\",\n \"outlineColor\",\n \"fill\",\n \"stroke\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n]);\n/**\n * WAAPI runs on the browser's clock, so on a manual clock every animation\n * runs in JS where processFrame can drive it. Set the flag before starting\n * animations: running WAAPI animations stay on the browser's clock.\n */\nconst supportsWaapi = () => !MotionGlobalConfig.useManualTiming &&\n Object.hasOwnProperty.call(Element.prototype, \"animate\");\nfunction supportsBrowserAnimation(options) {\n const { motionValue, name, repeatDelay, repeatType, damping, type, keyframes, } = options;\n /**\n * Most values can't be accelerated at all, so check the name before\n * looking at the element or its props.\n */\n if (!name ||\n !(acceleratedValues.has(name) || colorProperties.has(name))) {\n return false;\n }\n const subject = motionValue?.owner?.current;\n /**\n * We use instanceof checks instead of isHTMLElement()/isSVGElement()\n * because we explicitly **don't** want elements in different timing\n * contexts (i.e. popups) to be accelerated, as it's not possible to sync\n * these animations properly with those driven from the main window\n * frameloop.\n */\n if (!(subject instanceof HTMLElement) &&\n !(subject instanceof SVGElement)) {\n return false;\n }\n const { onUpdate, transformTemplate } = motionValue.owner.getProps();\n return (supportsWaapi() &&\n /**\n * Force WAAPI for color properties with browser-only color formats\n * (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.\n */\n (acceleratedValues.has(name) ||\n (colorProperties.has(name) &&\n hasBrowserOnlyColors(keyframes))) &&\n (name !== \"transform\" || !transformTemplate) &&\n /**\n * If we're outputting values to onUpdate then we can't use WAAPI as there's\n * no way to read the value from WAAPI every frame.\n */\n !onUpdate &&\n !repeatDelay &&\n repeatType !== \"mirror\" &&\n damping !== 0 &&\n type !== \"inertia\");\n}\n\nexport { supportsBrowserAnimation, supportsWaapi };\n//# sourceMappingURL=waapi.mjs.map\n"],"names":["colorProperties","Set","supportsWaapi","MotionGlobalConfig","useManualTiming","Object","hasOwnProperty","call","Element","prototype","options","motionValue","name","repeatDelay","repeatType","damping","type","keyframes","acceleratedValues","has","subject","owner","current","HTMLElement","SVGElement","onUpdate","transformTemplate","getProps","hasBrowserOnlyColors"],"mappings":"
|
|
1
|
+
{"version":3,"file":"waapi.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs"],"sourcesContent":["import { MotionGlobalConfig } from 'motion-utils';\nimport { acceleratedValues } from '../utils/accelerated-values.mjs';\nimport { hasBrowserOnlyColors } from '../utils/is-browser-color.mjs';\nimport { needsMixer } from '../utils/needs-mixer.mjs';\n\nconst colorProperties = new Set([\n \"color\",\n \"backgroundColor\",\n \"outlineColor\",\n \"fill\",\n \"stroke\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n]);\n/**\n * WAAPI runs on the browser's clock, so on a manual clock every animation\n * runs in JS where processFrame can drive it. Set the flag before starting\n * animations: running WAAPI animations stay on the browser's clock.\n */\nconst supportsWaapi = () => !MotionGlobalConfig.useManualTiming &&\n Object.hasOwnProperty.call(Element.prototype, \"animate\");\nfunction supportsBrowserAnimation(options) {\n const { motionValue, name, repeatDelay, repeatType, damping, type, keyframes, } = options;\n /**\n * Most values can't be accelerated at all, so check the name before\n * looking at the element or its props.\n */\n if (!name ||\n !(acceleratedValues.has(name) || colorProperties.has(name))) {\n return false;\n }\n const subject = motionValue?.owner?.current;\n /**\n * We use instanceof checks instead of isHTMLElement()/isSVGElement()\n * because we explicitly **don't** want elements in different timing\n * contexts (i.e. popups) to be accelerated, as it's not possible to sync\n * these animations properly with those driven from the main window\n * frameloop.\n */\n if (!(subject instanceof HTMLElement) &&\n !(subject instanceof SVGElement)) {\n return false;\n }\n const { onUpdate, transformTemplate } = motionValue.owner.getProps();\n return (supportsWaapi() &&\n /**\n * Force WAAPI for color properties with browser-only color formats\n * (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.\n */\n (acceleratedValues.has(name) ||\n (colorProperties.has(name) &&\n hasBrowserOnlyColors(keyframes))) &&\n (name !== \"transform\" || !transformTemplate) &&\n /**\n * If we're outputting values to onUpdate then we can't use WAAPI as there's\n * no way to read the value from WAAPI every frame.\n */\n !onUpdate &&\n !repeatDelay &&\n repeatType !== \"mirror\" &&\n damping !== 0 &&\n type !== \"inertia\" &&\n !needsMixer(options));\n}\n\nexport { supportsBrowserAnimation, supportsWaapi };\n//# sourceMappingURL=waapi.mjs.map\n"],"names":["colorProperties","Set","supportsWaapi","MotionGlobalConfig","useManualTiming","Object","hasOwnProperty","call","Element","prototype","options","motionValue","name","repeatDelay","repeatType","damping","type","keyframes","acceleratedValues","has","subject","owner","current","HTMLElement","SVGElement","onUpdate","transformTemplate","getProps","hasBrowserOnlyColors","needsMixer"],"mappings":"wRASA,MAAMA,EAAkB,IAAIC,IAAI,CAC5B,QACA,kBACA,eACA,OACA,SACA,cACA,iBACA,mBACA,oBACA,oBAQSC,EAAgBA,KACxBC,EAAkBA,mBAACC,iBACpBC,OAAOC,eAAeC,KAAKC,QAAQC,UAAW,4CAE5C,SACFC,GAEA,MAAMC,YACFA,EAAWC,KACXA,EAAIC,YACJA,EAAWC,WACXA,EAAUC,QACVA,EAAOC,KACPA,EAAIC,UACJA,GACAP,EAMJ,IACKE,IACCM,EAAAA,kBAAkBC,IAAIP,KAASZ,EAAgBmB,IAAIP,GAErD,OAAO,EAGX,MAAMQ,EAAUT,GAAaU,OAAOC,QASpC,KACMF,aAAmBG,aACnBH,aAAmBI,YAErB,OAAO,EAGX,MAAMC,SAAEA,EAAQC,kBAAEA,GAAsBf,EAAaU,MAAOM,WAE5D,OACIzB,MAKCgB,EAAAA,kBAAkBC,IAAIP,IAClBZ,EAAgBmB,IAAIP,IACjBgB,EAAoBA,qBAACX,MACnB,cAATL,IAAyBc,KAKzBD,IACAZ,GACc,WAAfC,GACY,IAAZC,GACS,YAATC,IACCa,EAAUA,WAACnB,EAEpB"}
|
package/dist/node_modules/motion-dom/dist/es/animation/waapi/transforms/TransformAnimation.mjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../frameloop/frame.mjs.js"),t=require("../../../frameloop/frame-data.mjs.js"),s=require("../../../frameloop/sync-time.mjs.js"),r=require("../../../render/html/utils/build-transform.mjs.js"),i=require("../../../render/utils/keys-transform.mjs.js"),n=require("../../../utils/mix/number.mjs.js"),o=require("../../../value/types/maps/number.mjs.js"),a=require("../../../value/types/utils/get-as-type.mjs.js"),u=require("../../drivers/frame.mjs.js"),c=require("../../generators/keyframes.mjs.js"),l=require("../../keyframes/offsets/default.mjs.js"),m=require("../../JSAnimation.mjs.js"),f=require("../../NativeAnimationExtended.mjs.js"),p=require("../easing/cubic-bezier.mjs.js"),h=require("../easing/supported.mjs.js"),d=require("../supports/waapi.mjs.js"),j=require("../../../utils/supports/linear-easing.mjs.js"),g=require("./groups.mjs.js"),y=require("../../../../../../motion-utils/dist/es/easing/utils/is-bezier-definition.mjs.js"),b=require("../../../../../../motion-utils/dist/es/time-conversion.mjs.js"),A=require("../../../../../../motion-utils/dist/es/clamp.mjs.js"),M=require("../../../../../../motion-utils/dist/es/progress.mjs.js");const v=.001,q=(e,t)=>e-t,T=(e,t,s)=>{const r=[];for(let i=0;i<=s;i++)r.push(n.mixNumber(e,t,i/s));return r},w=e=>e.motionValue.owner,S=e=>g.transformGroups.get(e),k=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get();class D extends m.JSAnimation{constructor(e){const t=w(e).current,{driver:s=u.frameloopDriver}=e;let r;const i=function(e){const t=w(e),{onUpdate:s,transformTemplate:r}=t.getProps();return!(e.isHandoff||s||e.hasOnUpdate||r||"inertia"===e.type||"none"!==(k(t,"transform")||"none")||k(t,"pathRotation")||t.projection?.isProjecting())}(e);e.driver=e=>{const i=s(e);return{js:i,now:i.now,start:(e=!0)=>{const s=S(t);!s||s.isJS?i.start(e):s.schedule(!1,!e)},stop:()=>{i.stop();const e=S(t);e&&!e.isFinishing&&e.release(r)}}},super(e),r=this,this.canAccelerate=i;const{stop:n}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),n()}}get group(){return S(w(this.options).current)}get js(){return this.driver?.js}get name(){return this.options.name}timing(){const{startTime:e,speed:t,totalDuration:s}=this,{delay:r=0,repeatType:i}=this.options;return null!==this.holdTime?[1/0,0]:s===1/0?[e+r/t,this.resolvedDuration*("loop"===i?1:2)/t||1]:[e+(r+s)/t,0]}isAccelerated(){const{group:e,state:t}=this;return e?.tracks.has(this)&&!e.isJS&&this.canAccelerate&&("running"===t||"paused"===t)}liveValue(){return this.isAccelerated()?this.sampleAt(s.time.now()):void 0}tween(){const{keyframes:e,type:t,ease:s,times:r,repeat:i,delay:n=0}=this.options,o=y.isBezierDefinition(s)?p.cubicBezierAsString(s):(e=>/^(linear|ease(In|Out|InOut))$/.test(e))(s)&&h.supportedWaapiEasing[s];if(o&&!i&&!r&&2===e.length&&t===c.keyframes&&null===this.holdTime){const e=this.startTime+n/this.speed;return[e,e+this.resolvedDuration/this.speed,o]}}boundaries(e,t){const{startTime:s,speed:r,resolvedDuration:i,options:n}=this,{delay:o=0,repeat:a=0,repeatDelay:u=0,repeatType:m,times:f,keyframes:p,type:h}=n,d=(h||c.keyframes)===c.keyframes?f||l.defaultOffset(p):[0,1],j=s+o/r,g=[];if(null!==this.holdTime||!(i>0))return g;for(let s=Math.max(0,Math.floor((e-j)*r/i));s<=a;s++){const n=j+s*i/r;if(n>t)break;for(const o of d){const a=n+(s%2&&m&&"loop"!==m?1-o:o)*(i-u)/r;a>e&&a<t&&g.push(a)}}return g}numberAt(e){return parseFloat(this.sampleAt(e,!0))}sync(){const e=s.time.now();this.options.motionValue.setWithVelocity(this.sampleAt(e-f.sampleDelta,!0),this.sampleAt(e,!0),f.sampleDelta)}play(){this.isStopped||((this.group||function(n){const u=n.current,c=new Set,l=new Map;let p={},h=[],d=new Map,j=[],y=!1,b=!1,A=!1,w=!1,D=-1/0;const E=e=>{for(const t of c)if(t.name===e)return!0},J=(e,t)=>{const s={};for(const r of void 0===e?i.transformPropOrder:h){const i=l.get(r),o=void 0===e?k(n,r):i?i.sampleAt(t>e&&!i.timing()[1]?t:e):p[r];void 0!==o&&(s[r]=o)}return s},x=(e,t)=>{let s="";const i=J(e,t);for(const e in i)s+=(r.translateAlias[e]||e)+"("+a.getValueAsType(i[e],o.numberValueTypes[e])+") ";return s||"none"},V=(e=J())=>{u.style.transform=r.buildTransform(e,{})},O=(e=!0)=>{e&&V(),j.forEach(({animation:e})=>e.cancel()),j=[]},P=(e,t,r=1/0)=>{const i={animation:e,offset:t,end:r};e.startTime=s.time.now()+t,r<1/0&&(e.onfinish=()=>{i.isDone=!0,j.some(e=>e.end===1/0)&&(e.cancel(),j=j.filter(e=>e!==i)),R.schedule(!1)}),e.oncancel=()=>j.includes(i)&&R.demote(),j.push(i)},F=(e,t,s)=>{const r=(t,s)=>Math.abs(e(s)-e(t)),i=r(t,s);for(;s-t>.01;){const e=(t+s)/2;r(t,e)>r(e,s)?s=e:t=e}return r(t,s)>i/2?[t,s]:[]},z=(e,t,s,r)=>{const i=Math.min(200,Math.max(2,Math.ceil((s-t)/f.sampleDelta)));if(4*r.length>i)return;const n=T(t,s,i).concat(r).sort(q),o=e=>M.progress(t,s,e);let a,u;for(const t of e){const e=n.map(e=>t.numberAt(e)),[s]=e,r=e.map(e=>e-s),i=r[r.length-1],o=r.some(e=>Math.abs(e)*v>Math.abs(i))?0:i,c=r.map(e=>o?e/o:e);if(o)if(a){if(c.some((e,t)=>!(Math.abs(e-a[t])<=v)))return}else a=c,u=e=>(t.numberAt(e)-s)/o;else if(c.some(e=>!(Math.abs(e)<=v)))return}if(!a||a.every((e,t)=>Math.abs(e-o(n[t]))<=v))return"linear";const c=[],l=(e,t=u(e))=>c.push(m.round(t)+" "+m.round(100*o(e))+"%");return a.forEach((e,t)=>{t&&Math.abs(e-a[t-1])>.2&&F(u,n[t-1],n[t]).forEach(e=>l(e)),l(n[t],e)}),"linear("+c+")"},W=(e,t,s,r)=>{const i=[t],n=(t,s)=>e.every(e=>!(Math.abs(e.numberAt((t+s)/2)-(e.numberAt(t)+e.numberAt(s))/2)>(e.name.startsWith("scale")?.001:.1))),o=(t,s,r)=>{if(s-t<1||n(t,s))i.push(s);else if(r<4)o(t,(t+s)/2,r+1),o((t+s)/2,s,r+1);else{for(const r of e)i.push(...F(e=>r.numberAt(e),t,s));i.push(s)}},a=T(t,s,Math.ceil((s-t)/100));for(const e of r)a.push(e,Math.min(e+.01,s));let u=t;for(const e of a.sort(q))e>u&&o(u,e,0),u=e;return i.sort(q)},G=e=>{let t;for(const s of e){const e=s.tween();if(!e||t?.some((t,s)=>s<2?Math.abs(e[s]-t)>1:e[s]!==t))return;t=e}return t},B=(e,t,s,r={fill:"both"},i,n)=>{const o=e.flatMap(e=>e.boundaries(t,s)),a=n||z(e,t,s,o),c=a?[t,s]:W(e,t,s,o),l=c.map(e=>x(e,i));let m={transform:l};return a||(m.offset=c.map(e=>M.progress(t,s,e))),l.every(e=>e===l[0])&&(V(J(t,i)),m=null),u.animate(m,{...r,duration:s-t,easing:a||"linear"})},H=e=>{let t=e,s=0,r=0;const o=[],a=[],m=new Set;l.clear(),d=new Map;for(const i of c){l.set(i.name,i);const[n,u]=i.timing(),c=n===1/0;if(d.set(i,[i.at(e),i.speed,c]),c)i.sync();else{if(i.speed<0)return;if(u){if(s){const e=(n-r)/u;if(Math.abs(u-s)>1||Math.abs(e-Math.round(e))*s>1)return}else s=u,r=n;a.push(i)}else m.add(n);o.push(i),t=Math.max(t,n)}}p={},h=i.transformPropOrder.filter(e=>{if(l.has(e))return!0;const t=p[e]=k(n,e);return void 0!==t&&parseFloat(t)!==(e.startsWith("scale")?1:0)}),O(!1);const f=!s&&G(o);try{if(f&&f[1]>e){const[t,s,r]=f;P(B(o,t,s,void 0,void 0,r),t-e,s-t)}else t>e&&(P(B(o,e,t),0,t-e),m.forEach(s=>s<t-1&&P(u.animate(null,{duration:s-e}),0,s-e)));if(s){const i=r+Math.floor((t-r)/s)*s;P(B(a,i,i+s,{iterations:1/0,iterationStart:(t-i)/s,fill:"forwards"},t),t-e)}}catch{return}return j.length||O(),!0},I=e=>{let t,s=0;for(const r of c){const i=d.get(r);if(!i)return!1;const[n,o,a]=i,u=r.at(e),c=r.timing()[0]===1/0;if(a){if(c&&u===n)continue;return!1}const l=(u-n)/o,m=c?0:r.speed/o;if(void 0===t)t=l,s=m;else if(Math.abs(l-t)>1||m!==s)return!1}if(void 0===t)return!0;if(!j.length)return!1;for(const{offset:e,end:s,isDone:r}of j){const i=t-e;if(s<1/0&&(r?i<s-1:i<0||i>=s))return!1}for(const{animation:r,offset:i,isDone:n}of j){if(n)continue;const o=t-i;s?(r.playbackRate=s,r.startTime=e-o/s):(r.pause(),r.currentTime=o)}return!0},L=()=>!c.size&&(A=!0,S(u)===R&&g.transformGroups.delete(u),R.isJS||O(),!0),N=()=>{const e=s.time.now();if(R.isJS||(R.isFinishing=!0,c.forEach(t=>{const[s,r]=t.timing();"running"===t.state&&t.speed>0&&!r&&s<=e+1&&(t.complete(),p[t.name]=k(n,t.name),d.has(t)||(y=!0))}),R.isFinishing=!1),b=!1,A)return;if(c.forEach(({state:e},t)=>{"idle"!==e&&"finished"!==e||c.delete(t)}),L())return;for(const e of c)if(!e.canAccelerate)return R.demote(!0);R.isJS&&(R.isJS=!1,y=!0,c.forEach(e=>e.js?.stop()));const t=y,r=w;if(y=w=!1,t||!I(e)){if(r){if(e-D<100)return R.demote();D=e}if(!H(e))return R.demote()}},R={tracks:c,isJS:!1,isFinishing:!1,schedule(s,r){A||(y||(y=s),w||(w=!!r),b||(b=!0,t.frameData.isProcessing?e.frame.render(N,!1,!0):queueMicrotask(N)))},release(e){const{state:t}=e;"idle"!==t&&"finished"!==t||c.delete(e),L()||R.schedule(!0)},check(){if(!R.isJS)for(const e in p)if(k(n,e)!==p[e]&&!E(e))return R.schedule(!0,!0)},demote(e){R.isJS||A||(c.forEach(t=>{t.isAccelerated()&&t.sync(),e||(t.canAccelerate=!1)}),R.isJS=!0,d=new Map,O(),c.forEach(e=>"running"===e.state&&e.js?.start()))}};return g.transformGroups.set(u,R),R}(w(this.options))).tracks.add(this),super.play())}pause(){super.pause(),this.isAccelerated()&&(this.sync(),this.group.schedule(!1))}complete(){super.complete();const{group:e}=this;e&&!e.isJS&&this.canAccelerate&&this.tick(s.time.now())}get time(){return this.isAccelerated()?b.millisecondsToSeconds(A.clamp(0,this.totalDuration,this.at(s.time.now())-(this.options.delay||0))):super.time}set time(e){super.time=e,this.isAccelerated()&&this.sync()}attachTimeline(e){return this.canAccelerate=!1,this.group?.demote(!0),super.attachTimeline(e)}}exports.TransformAnimation=D,exports.canGroupTransform=({name:e,motionValue:t})=>e&&i.transformPropOrder.includes(e)&&t?.owner?.current instanceof HTMLElement&&d.supportsWaapi()&&j.supportsLinearEasing();
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../frameloop/frame.mjs.js"),t=require("../../../frameloop/frame-data.mjs.js"),s=require("../../../frameloop/sync-time.mjs.js"),r=require("../../../render/html/utils/build-transform.mjs.js"),i=require("../../../render/utils/keys-transform.mjs.js"),n=require("../../../utils/mix/number.mjs.js"),o=require("../../drivers/frame.mjs.js"),a=require("../../generators/keyframes.mjs.js"),u=require("../../keyframes/offsets/default.mjs.js"),c=require("../../JSAnimation.mjs.js"),f=require("../../NativeAnimationExtended.mjs.js"),l=require("../easing/cubic-bezier.mjs.js"),m=require("../easing/supported.mjs.js"),h=require("../supports/waapi.mjs.js"),p=require("../utils/needs-mixer.mjs.js"),d=require("../../../utils/supports/linear-easing.mjs.js"),g=require("./groups.mjs.js"),j=require("../../../../../../motion-utils/dist/es/easing/utils/is-easing-array.mjs.js"),y=require("../../../../../../motion-utils/dist/es/easing/utils/is-bezier-definition.mjs.js"),b=require("../../../../../../motion-utils/dist/es/easing/utils/map.mjs.js"),v=require("../../../../../../motion-utils/dist/es/time-conversion.mjs.js"),A=require("../../../../../../motion-utils/dist/es/clamp.mjs.js"),M=require("../../../../../../motion-utils/dist/es/progress.mjs.js");const w=.001,S=100,T=new Set(["linear","easeIn","easeOut","easeInOut"]),D=new WeakMap,k=(e,t)=>Math.min(200,Math.max(2,Math.ceil((t-e)/f.sampleDelta))),q=(e,t)=>Math.abs(e-t)<=.001,J=(e,t)=>e-t,E=(e,t,s)=>u.defaultOffset(Array(s+1)).map(s=>n.mixNumber(e,t,s)),O=e=>e.motionValue.owner,x=e=>g.transformGroups.get(e),P=({state:e})=>"idle"===e||"finished"===e,V=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get();class F{constructor(e,t,s,r){this.element=e,this.update=t,this.makeDriver=s,this.animation=r}get js(){return this.driver||(this.driver=this.makeDriver(this.update))}now(){return this.driver||this.makeDriver!==o.frameloopDriver?this.js.now():t.frameData.isProcessing?t.frameData.timestamp:s.time.now()}start(e=!0){const t=x(this.element);!t||t.isJS?this.js.start(e):t.schedule(!1,!e)}stopJS(){this.driver?.stop()}stop(){this.stopJS();const e=x(this.element);e&&!e.isFinishing&&e.release(this.animation)}}let R,z;class W extends c.JSAnimation{constructor(e){const t=O(e).current,{driver:s=o.frameloopDriver}=e;let r;const i=function(e){const t=O(e),{onUpdate:s,transformTemplate:r}=t.getProps();return!(e.isHandoff||s||e.hasOnUpdate||r||"inertia"===e.type||"none"!==(V(t,"transform")||"none")||V(t,"pathRotation")||t.projection?.isProjecting()||p.needsMixer(e))}(e);e.driver=e=>new F(t,e,s,r),super(e),r=this;const n=this.driver;n&&(n.animation=this),this.canAccelerate=i;const{stop:a}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),a()}}offsets(){const{keyframes:e,times:t}=this.options;return t||(this.offsetsOf!==e&&(this.offsetsOf=e,this.cachedOffsets=u.defaultOffset(e)),this.cachedOffsets)}get group(){return x(O(this.options).current)}get js(){return this.driver?.js}stopJS(){this.driver?.stopJS()}get name(){return this.options.name}timing(){const{startTime:e,speed:t,totalDuration:s}=this,{delay:r=0,repeatType:i}=this.options;return null!==this.holdTime?[1/0,0]:s===1/0?[e+r/t,this.resolvedDuration*("loop"===i?1:2)/t||1]:[e+(r+s)/t,0]}isAccelerated(){const{group:e,state:t}=this;return e?.tracks.has(this)&&!e.isJS&&this.canAccelerate&&("running"===t||"paused"===t)}liveValue(){return this.isAccelerated()?this.sampleAt(s.time.now()):void 0}tween(){const{keyframes:e,type:t,repeat:s,delay:r=0}=this.options;let i=-1;if(s||t!==a.keyframes||null!==this.holdTime)return;for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]){if(i>=0)return;i=t-1}let{ease:n}=this.options;j.isEasingArray(n)&&(n=n[i]);const o=this.offsets(),u=e=>this.startTime+(r+o[e]*this.totalDuration)/this.speed;if(i>=0){const e=y.isBezierDefinition(n)?l.cubicBezierAsString(n):(e=>T.has(e))(n)?m.supportedWaapiEasing[n]:b.easingDefinitionToFunction(n);return[u(i),u(i+1),"string"==typeof e||q(e(0),0)&&q(e(1),1)?e:void 0]}}boundaries(e,t){const{startTime:s,speed:r,resolvedDuration:i,options:n}=this,{delay:o=0,repeat:u=0,repeatDelay:c=0,repeatType:f,type:l}=n,m=(l||a.keyframes)===a.keyframes?this.offsets():[0,1],h=s+o/r,p=[];if(null!==this.holdTime||!(i>0))return p;for(let s=Math.max(0,Math.floor((e-h)*r/i));s<=u;s++){const n=h+s*i/r;if(n>t)break;for(const o of m){const a=n+(s%2&&f&&"loop"!==f?1-o:o)*(i-c)/r;a>e&&a<t&&p.push(a)}}return p}numberAt(e){return parseFloat(this.sampleAt(e,!0))}sync(){const e=s.time.now(),t=this.sampleAt(e,!0);this.options.motionValue.setWithVelocity(null===this.holdTime?this.sampleAt(e-f.sampleDelta,!0):t,t,f.sampleDelta)}play(){this.isStopped||((this.group||function(n){const o=n.current,a=new Set,f=new Map;let l,m,h={},p=[],d=new Map,j=[],y=!1,b=!1,v=!1,A=!1,T=-1/0,O=1/0;const F=e=>{for(const t of a)if(t.name===e)return!0},R=(e,t)=>{const s={};for(const r of void 0===e?i.transformPropOrder:p){const i=f.get(r),o=void 0===e?V(n,r):i?i.sampleAt(t>e&&!i.timing()[1]?t:e):h[r];void 0!==o&&(s[r]=o)}return s},z=(e,t)=>{let s="";for(const i in e){const n=e[i];t&&r.isDefaultTransform(i,n)||(s+=r.transformFunction(i,n)+" ")}return(t?s.trim():s)||"none"},W=(e,t)=>z(R(e,t)),N=(e=R())=>{o.style.transform=z(e,!0)},B=e=>{e.onfinish=e.oncancel=null,e.cancel()},H=(e=!0)=>{clearTimeout(l),O=1/0,m=void 0,e&&N(),j.forEach(({animation:e})=>B(e)),j=[]},I=(e,t)=>new Animation(new KeyframeEffect(o,e,t)),L=(e,t,r=1/0)=>{const i={animation:e,offset:t,end:r};e.startTime=s.time.now()+t,r<1/0&&(e.onfinish=()=>{i.isDone=!0,j.some(e=>e.end===1/0)&&(B(e),j=j.filter(e=>e!==i)),te.schedule(!1)}),e.oncancel=()=>j.includes(i)&&te.demote(),j.push(i)},U=(e,t,s)=>{const r=(t,s)=>Math.abs(e(s)-e(t)),i=r(t,s);for(;s-t>.01;){const e=(t+s)/2;r(t,e)>r(e,s)?s=e:t=e}return r(t,s)>i/2?[t,s]:[]},_=(e,t,s,r)=>{const i=k(t,s);if(4*r.length>i)return;let n;for(const r of e){const e=r.numberAt(t),i=(r.numberAt((t+s)/2)-e)/(r.numberAt(s)-e);if(i==i)if(void 0===n)n=i;else if(!q(i,n))return}const o=E(t,s,i).concat(r).sort(J),a=e=>M.progress(t,s,e);let u,f;for(const s of e){const e=s.numberAt(t),r=o.map(t=>s.numberAt(t)-e),i=r[r.length-1],n=r.some(e=>Math.abs(e)*w>Math.abs(i))?0:i,a=r.map(e=>n?e/n:e);if(n&&!u)u=a,f=t=>(s.numberAt(t)-e)/n;else if(a.some((e,t)=>!q(e,n&&u[t])))return}if(!u||u.every((e,t)=>q(e,a(o[t]))))return"linear";const l=[],m=(e,t=f(e))=>l.push(c.round(t)+" "+c.round(100*a(e))+"%");return u.forEach((e,t)=>{t&&Math.abs(e-u[t-1])>.2&&U(f,o[t-1],o[t]).forEach(e=>m(e)),m(o[t],e)}),"linear("+l+")"},K=(e,t,s,r)=>{const i=[t],n=[];let o=s,a=t;for(const r of e){const e=r.tween();if("linear"!==e?.[2]){const[i,u]=r.timing(),[c,f]=e||[t,u?s:i];o=Math.min(o,c),a=Math.max(a,f),n.push(r)}}o=Math.max(t,o),a=Math.min(s,a);const u=(e,t)=>n.every(s=>!(Math.abs(s.numberAt((e+t)/2)-(s.numberAt(e)+s.numberAt(t))/2)>(s.name.startsWith("scale")?.001:.1))),c=(t,s,r)=>{if(s-t<1||u(t,s))i.push(s);else if(r<4)c(t,(t+s)/2,r+1),c((t+s)/2,s,r+1);else{for(const r of e)i.push(...U(e=>r.numberAt(e),t,s));i.push(s)}},f=a>o?E(o,a,Math.ceil((a-o)/100)):[];f.push(s);for(const e of r)f.push(e,Math.min(e+.01,s));let l=t;for(const e of f.sort(J))e>l&&c(l,e,0),l=e;return i.sort(J)},C=e=>{let t;for(const s of e){const e=s.tween();if(!e||t&&(Math.abs(e[0]-t[0])>1||Math.abs(e[1]-t[1])>1))return;t=[e[0],e[1],t&&e[2]!==t[2]?void 0:e[2]]}return t},Q=(e,t,s,r,i={fill:"both"},n)=>{const o=r?[]:e.flatMap(e=>e.boundaries(t,s)),a=r||_(e,t,s,o),u=a?[t,s]:K(e,t,s,o),c=u.map(e=>W(e,n));let f={transform:c};return a||(f.offset=u.map(e=>M.progress(t,s,e))),c.every(e=>e===c[0])&&(N(R(t,n)),f=null),I(f,{...i,duration:s-t,easing:a||"linear"})},X=e=>{const t=s.time.now()+e;t<O&&(clearTimeout(l),O=t,l=setTimeout(()=>{O=1/0,te.schedule(!1)},e))},Y=e=>{let t=e,s=0,o=0;const l=[],g=[],y=new Set;f.clear(),d=new Map;for(const r of a){f.set(r.name,r);const[i,n]=r.timing(),a=i===1/0;if(d.set(r,[r.at(e),r.speed,a]),!a){if(r.speed<0)return;if(n){if(s){const e=(i-o)/n;if(Math.abs(n-s)>1||Math.abs(e-Math.round(e))*s>1)return}else s=n,o=i;g.push(r)}else y.add(i);l.push(r),t=Math.max(t,i)}}h={},p=i.transformPropOrder.filter(e=>{if(f.has(e))return!0;const t=h[e]=V(n,e);return void 0!==t&&!r.isDefaultTransform(e,t)}),H(!1);const b=!s&&C(l);try{if(t>e){let s;if(b&&b[1]>e){const[r,i,n]=b;if(r-e>S)return l.forEach(e=>e.sync()),X(m=r-e-S),!0;s="string"==typeof n?n:n?((e,t)=>{let s=D.get(e);return s?.[0]!==t&&(s=[t,"linear("+u.defaultOffset(Array(t+1)).map(t=>c.round(e(t))+" "+c.round(100*t)+"%")+")"],D.set(e,s)),s[1]})(n,k(r,i)):_(l,r,i,[]),s&&L(Q(l,r,i,s,{fill:"both",endDelay:t-i}),r-e,t-r)}s||L(Q(l,e,t),0,t-e),y.forEach(s=>s<t-1&&L(I(null,{duration:s-e}),0,s-e))}if(s){const r=o+Math.floor((t-o)/s)*s;L(Q(g,r,r+s,void 0,{iterations:1/0,iterationStart:(t-r)/s,fill:"forwards"},t),t-e)}}catch{return}return j.length||H(),!0},Z=(e,t)=>{let s,r=0;for(const t of a){const i=d.get(t);if(!i)return!1;const[n,o,a]=i,u=t.at(e),c=t.timing()[0]===1/0;if(a){if(c&&(u===n||!j.length))continue;return!1}const f=(u-n)/o,l=c?0:t.speed/o;if(void 0===s)s=f,r=l;else if(Math.abs(f-s)>1||l!==r)return!1}if(void 0===s)return!0;if(!j.length){if(void 0===m||t&&r)return!1;if(r){const e=(m-s)/r;if(e<1)return!1;X(e)}return!0}for(const{offset:e,end:r,isDone:i}of j){const n=s-e;if(r<1/0&&(i?n<r-1:n<0&&(t||e<=0)||n>=r))return!1}for(const{animation:t,offset:i,isDone:n}of j){if(n)continue;const o=s-i;r&&t.updatePlaybackRate&&"running"===t.playState&&Math.abs(Number(t.currentTime)-o)<20?t.playbackRate!==r&&t.updatePlaybackRate(r):r?(t.playbackRate!==r&&(t.playbackRate=r),t.startTime=e-o/r):(t.startTime=null,t.currentTime=o)}return!0},$=()=>!a.size&&(v=!0,x(o)===te&&g.transformGroups.delete(o),te.isJS||H(),!0),ee=()=>{const e=s.time.now();if(te.isJS||(te.isFinishing=!0,a.forEach(t=>{const[s,r]=t.timing();"running"===t.state&&t.speed>0&&!r&&s<=e+1&&(t.complete(),h[t.name]=V(n,t.name),d.has(t)||(y=!0))}),te.isFinishing=!1),b=!1,v)return;if(a.forEach(e=>P(e)&&a.delete(e)),$())return;for(const e of a)if(!e.canAccelerate)return te.demote(!0);te.isJS&&(te.isJS=!1,y=!0,a.forEach(e=>e.stopJS()));const t=y,r=A;if(y=A=!1,t||!Z(e,r)){if(r){if(e-T<100)return te.demote();T=e}if(!Y(e))return te.demote()}else if(void 0!==m&&!r)return;a.forEach(e=>e.timing()[0]===1/0&&e.sync())},te={tracks:a,isJS:!1,isFinishing:!1,schedule(s,r){v||(y||(y=s),A||(A=!!r),b||(b=!0,t.frameData.isProcessing?e.frame.render(ee,!1,!0):G(ee)))},release(e){P(e)&&a.delete(e),$()||te.schedule(!0)},check(){if(!te.isJS)for(const e in h)if(V(n,e)!==h[e]&&!F(e))return te.schedule(!0,!0)},demote(e){if(!te.isJS&&!v)return a.forEach(t=>{t.isAccelerated()&&t.sync(),e||(t.canAccelerate=!1)}),te.isJS=!0,d=new Map,H(),a.forEach(e=>"running"===e.state&&e.js?.start()),!0}};return g.transformGroups.set(o,te),te}(O(this.options))).tracks.add(this),super.play())}pause(){super.pause(),this.isAccelerated()&&this.group.schedule(!1)}complete(){super.complete();const{group:e}=this;e&&!e.isJS&&this.tick(s.time.now())}get time(){return this.isAccelerated()?v.millisecondsToSeconds(A.clamp(0,this.totalDuration,this.at(s.time.now())-(this.options.delay||0))):super.time}set time(e){(R??(R=Object.getOwnPropertyDescriptor(c.JSAnimation.prototype,"time").set)).call(this,e)}attachTimeline(e){return this.canAccelerate=!1,this.group?.demote(!0),super.attachTimeline(e)}}const G=e=>{z||queueMicrotask(()=>{const e=z;z=void 0,e.forEach(e=>e())}),(z||(z=[])).push(e)};exports.TransformAnimation=W,exports.canGroupTransform=({name:e,motionValue:t})=>e&&i.transformPropOrder.includes(e)&&t?.owner?.current instanceof HTMLElement&&h.supportsWaapi()&&d.supportsLinearEasing();
|
|
2
2
|
//# sourceMappingURL=TransformAnimation.mjs.js.map
|