Files
ai-course/node_modules/.cache/babel-loader/d1c04a5dd461b7a956eaa3ad69bcd55c71297918cc868fb732c9362c4048198b.json

1 line
11 KiB
JSON
Raw Permalink Normal View History

{"ast":null,"code":"import _objectSpread from \"/Users/apple/Documents/cursor/Web\\u8BFE\\u4EF6/AI\\u8BFE/education_web_\\u591AAgent\\u534F\\u4F5C\\u7CFB\\u7EDF/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";\nimport _objectWithoutProperties from \"/Users/apple/Documents/cursor/Web\\u8BFE\\u4EF6/AI\\u8BFE/education_web_\\u591AAgent\\u534F\\u4F5C\\u7CFB\\u7EDF/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js\";\nconst _excluded = [\"transition\", \"transitionEnd\"];\nimport { getValueTransition, frame, positionalKeys } from 'motion-dom';\nimport { setTarget } from '../../render/utils/setters.mjs';\nimport { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';\nimport { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';\nimport { animateMotionValue } from './motion-value.mjs';\n\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(_ref, key) {\n let {\n protectedKeys,\n needsAnimating\n } = _ref;\n const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;\n needsAnimating[key] = false;\n return shouldBlock;\n}\nfunction animateTarget(visualElement, targetAndTransition) {\n let {\n delay = 0,\n transitionOverride,\n type\n } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n let {\n transition = visualElement.getDefaultTransition(),\n transitionEnd\n } = targetAndTransition,\n target = _objectWithoutProperties(targetAndTransition, _excluded);\n if (transitionOverride) transition = transitionOverride;\n const animations = [];\n const animationTypeState = type && visualElement.animationState && visualElement.animationState.getState()[type];\n for (const key in target) {\n var _visualElement$latest;\n const value = visualElement.getValue(key, (_visualElement$latest = visualElement.latestValues[key]) !== null && _visualElement$latest !== void 0 ? _visualElement$latest : null);\n const valueTarget = target[key];\n if (valueTarget === undefined || animationTypeState && shouldBlockAnimation(animationTypeState, key)) {\n continue;\n }\n const valueTransition = _objectSpread({\n delay\n }, getValueTransition(transition || {}, key));\n /**\n * If the value is already at the defined target, skip the animation.\n */\n const currentValue = value.get();\n if (currentValue !== undefined && !value.isAnimating && !Array.isArray(valueTarget) && valueTarget === currentValue && !valueTransition.velocity) {\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 (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 value.start(animateMotionValue(key, value, valueTarget, visualElement.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 Promise.all(animations).then(() => {\n frame.update(() => {\n transitionEnd && setTarget(visualElement, transitionEnd);\n });\n });\n }\n return animations;\n}\nexport { animateTarget };","map":{"version":3,"names":["getValueTransition","frame","positionalKeys","setTarget","addValueToWillChange","getOptimisedAppearId","animate