Files
ETB/ETB-FrontEnd/node_modules/.cache/babel-loader/e40c10ae9c8485749914007f415425d7723fea43303c38eadfe89b772eeaeefb.json
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

1 line
19 KiB
JSON

{"ast":null,"code":"import { secondsToMilliseconds } from 'motion-utils';\nimport { GroupAnimation } from '../animation/GroupAnimation.mjs';\nimport { NativeAnimation } from '../animation/NativeAnimation.mjs';\nimport { NativeAnimationWrapper } from '../animation/NativeAnimationWrapper.mjs';\nimport { getValueTransition } from '../animation/utils/get-value-transition.mjs';\nimport { mapEasingToNativeEasing } from '../animation/waapi/easing/map-easing.mjs';\nimport { applyGeneratorOptions } from '../animation/waapi/utils/apply-generator.mjs';\nimport { chooseLayerType } from './utils/choose-layer-type.mjs';\nimport { css } from './utils/css.mjs';\nimport { getViewAnimationLayerInfo } from './utils/get-layer-info.mjs';\nimport { getViewAnimations } from './utils/get-view-animations.mjs';\nimport { hasTarget } from './utils/has-target.mjs';\nconst definitionNames = [\"layout\", \"enter\", \"exit\", \"new\", \"old\"];\nfunction startViewAnimation(builder) {\n const {\n update,\n targets,\n options: defaultOptions\n } = builder;\n if (!document.startViewTransition) {\n return new Promise(async resolve => {\n await update();\n resolve(new GroupAnimation([]));\n });\n }\n // TODO: Go over existing targets and ensure they all have ids\n /**\n * If we don't have any animations defined for the root target,\n * remove it from being captured.\n */\n if (!hasTarget(\"root\", targets)) {\n css.set(\":root\", {\n \"view-transition-name\": \"none\"\n });\n }\n /**\n * Set the timing curve to linear for all view transition layers.\n * This gets baked into the keyframes, which can't be changed\n * without breaking the generated animation.\n *\n * This allows us to set easing via updateTiming - which can be changed.\n */\n css.set(\"::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)\", {\n \"animation-timing-function\": \"linear !important\"\n });\n css.commit(); // Write\n const transition = document.startViewTransition(async () => {\n await update();\n // TODO: Go over new targets and ensure they all have ids\n });\n transition.finished.finally(() => {\n css.remove(); // Write\n });\n return new Promise(resolve => {\n transition.ready.then(() => {\n const generatedViewAnimations = getViewAnimations();\n const animations = [];\n /**\n * Create animations for each of our explicitly-defined subjects.\n */\n targets.forEach((definition, target) => {\n // TODO: If target is not \"root\", resolve elements\n // and iterate over each\n for (const key of definitionNames) {\n if (!definition[key]) continue;\n const {\n keyframes,\n options\n } = definition[key];\n for (let [valueName, valueKeyframes] of Object.entries(keyframes)) {\n if (!valueKeyframes) continue;\n const valueOptions = {\n ...getValueTransition(defaultOptions, valueName),\n ...getValueTransition(options, valueName)\n };\n const type = chooseLayerType(key);\n /**\n * If this is an opacity animation, and keyframes are not an array,\n * we need to convert them into an array and set an initial value.\n */\n if (valueName === \"opacity\" && !Array.isArray(valueKeyframes)) {\n const initialValue = type === \"new\" ? 0 : 1;\n valueKeyframes = [initialValue, valueKeyframes];\n }\n /**\n * Resolve stagger function if provided.\n */\n if (typeof valueOptions.delay === \"function\") {\n valueOptions.delay = valueOptions.delay(0, 1);\n }\n valueOptions.duration && (valueOptions.duration = secondsToMilliseconds(valueOptions.duration));\n valueOptions.delay && (valueOptions.delay = secondsToMilliseconds(valueOptions.delay));\n const animation = new NativeAnimation({\n ...valueOptions,\n element: document.documentElement,\n name: valueName,\n pseudoElement: `::view-transition-${type}(${target})`,\n keyframes: valueKeyframes\n });\n animations.push(animation);\n }\n }\n });\n /**\n * Handle browser generated animations\n */\n for (const animation of generatedViewAnimations) {\n if (animation.playState === \"finished\") continue;\n const {\n effect\n } = animation;\n if (!effect || !(effect instanceof KeyframeEffect)) continue;\n const {\n pseudoElement\n } = effect;\n if (!pseudoElement) continue;\n const name = getViewAnimationLayerInfo(pseudoElement);\n if (!name) continue;\n const targetDefinition = targets.get(name.layer);\n if (!targetDefinition) {\n /**\n * If transition name is group then update the timing of the animation\n * whereas if it's old or new then we could possibly replace it using\n * the above method.\n */\n const transitionName = name.type === \"group\" ? \"layout\" : \"\";\n let animationTransition = {\n ...getValueTransition(defaultOptions, transitionName)\n };\n animationTransition.duration && (animationTransition.duration = secondsToMilliseconds(animationTransition.duration));\n animationTransition = applyGeneratorOptions(animationTransition);\n const easing = mapEasingToNativeEasing(animationTransition.ease, animationTransition.duration);\n effect.updateTiming({\n delay: secondsToMilliseconds(animationTransition.delay ?? 0),\n duration: animationTransition.duration,\n easing\n });\n animations.push(new NativeAnimationWrapper(animation));\n } else if (hasOpacity(targetDefinition, \"enter\") && hasOpacity(targetDefinition, \"exit\") && effect.getKeyframes().some(keyframe => keyframe.mixBlendMode)) {\n animations.push(new NativeAnimationWrapper(animation));\n } else {\n animation.cancel();\n }\n }\n resolve(new GroupAnimation(animations));\n });\n });\n}\nfunction hasOpacity(target, key) {\n return target?.[key]?.keyframes.opacity;\n}\nexport { startViewAnimation };","map":{"version":3,"names":["secondsToMilliseconds","GroupAnimation","NativeAnimation","NativeAnimationWrapper","getValueTransition","mapEasingToNativeEasing","applyGeneratorOptions","chooseLayerType","css","getViewAnimationLayerInfo","getViewAnimations","hasTarget","definitionNames","startViewAnimation","builder","update","targets","options","defaultOptions","document","startViewTransition","Promise","resolve","set","commit","transition","finished","finally","remove","ready","then","generatedViewAnimations","animations","forEach","definition","target","key","keyframes","valueName","valueKeyframes","Object","entries","valueOptions","type","Array","isArray","initialValue","delay","duration","animation","element","documentElement","name","pseudoElement","push","playState","effect","KeyframeEffect","targetDefinition","get","layer","transitionName","animationTransition","easing","ease","updateTiming","hasOpacity","getKeyframes","some","keyframe","mixBlendMode","cancel","opacity"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/motion-dom/dist/es/view/start.mjs"],"sourcesContent":["import { secondsToMilliseconds } from 'motion-utils';\nimport { GroupAnimation } from '../animation/GroupAnimation.mjs';\nimport { NativeAnimation } from '../animation/NativeAnimation.mjs';\nimport { NativeAnimationWrapper } from '../animation/NativeAnimationWrapper.mjs';\nimport { getValueTransition } from '../animation/utils/get-value-transition.mjs';\nimport { mapEasingToNativeEasing } from '../animation/waapi/easing/map-easing.mjs';\nimport { applyGeneratorOptions } from '../animation/waapi/utils/apply-generator.mjs';\nimport { chooseLayerType } from './utils/choose-layer-type.mjs';\nimport { css } from './utils/css.mjs';\nimport { getViewAnimationLayerInfo } from './utils/get-layer-info.mjs';\nimport { getViewAnimations } from './utils/get-view-animations.mjs';\nimport { hasTarget } from './utils/has-target.mjs';\n\nconst definitionNames = [\"layout\", \"enter\", \"exit\", \"new\", \"old\"];\nfunction startViewAnimation(builder) {\n const { update, targets, options: defaultOptions } = builder;\n if (!document.startViewTransition) {\n return new Promise(async (resolve) => {\n await update();\n resolve(new GroupAnimation([]));\n });\n }\n // TODO: Go over existing targets and ensure they all have ids\n /**\n * If we don't have any animations defined for the root target,\n * remove it from being captured.\n */\n if (!hasTarget(\"root\", targets)) {\n css.set(\":root\", {\n \"view-transition-name\": \"none\",\n });\n }\n /**\n * Set the timing curve to linear for all view transition layers.\n * This gets baked into the keyframes, which can't be changed\n * without breaking the generated animation.\n *\n * This allows us to set easing via updateTiming - which can be changed.\n */\n css.set(\"::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)\", { \"animation-timing-function\": \"linear !important\" });\n css.commit(); // Write\n const transition = document.startViewTransition(async () => {\n await update();\n // TODO: Go over new targets and ensure they all have ids\n });\n transition.finished.finally(() => {\n css.remove(); // Write\n });\n return new Promise((resolve) => {\n transition.ready.then(() => {\n const generatedViewAnimations = getViewAnimations();\n const animations = [];\n /**\n * Create animations for each of our explicitly-defined subjects.\n */\n targets.forEach((definition, target) => {\n // TODO: If target is not \"root\", resolve elements\n // and iterate over each\n for (const key of definitionNames) {\n if (!definition[key])\n continue;\n const { keyframes, options } = definition[key];\n for (let [valueName, valueKeyframes] of Object.entries(keyframes)) {\n if (!valueKeyframes)\n continue;\n const valueOptions = {\n ...getValueTransition(defaultOptions, valueName),\n ...getValueTransition(options, valueName),\n };\n const type = chooseLayerType(key);\n /**\n * If this is an opacity animation, and keyframes are not an array,\n * we need to convert them into an array and set an initial value.\n */\n if (valueName === \"opacity\" &&\n !Array.isArray(valueKeyframes)) {\n const initialValue = type === \"new\" ? 0 : 1;\n valueKeyframes = [initialValue, valueKeyframes];\n }\n /**\n * Resolve stagger function if provided.\n */\n if (typeof valueOptions.delay === \"function\") {\n valueOptions.delay = valueOptions.delay(0, 1);\n }\n valueOptions.duration && (valueOptions.duration = secondsToMilliseconds(valueOptions.duration));\n valueOptions.delay && (valueOptions.delay = secondsToMilliseconds(valueOptions.delay));\n const animation = new NativeAnimation({\n ...valueOptions,\n element: document.documentElement,\n name: valueName,\n pseudoElement: `::view-transition-${type}(${target})`,\n keyframes: valueKeyframes,\n });\n animations.push(animation);\n }\n }\n });\n /**\n * Handle browser generated animations\n */\n for (const animation of generatedViewAnimations) {\n if (animation.playState === \"finished\")\n continue;\n const { effect } = animation;\n if (!effect || !(effect instanceof KeyframeEffect))\n continue;\n const { pseudoElement } = effect;\n if (!pseudoElement)\n continue;\n const name = getViewAnimationLayerInfo(pseudoElement);\n if (!name)\n continue;\n const targetDefinition = targets.get(name.layer);\n if (!targetDefinition) {\n /**\n * If transition name is group then update the timing of the animation\n * whereas if it's old or new then we could possibly replace it using\n * the above method.\n */\n const transitionName = name.type === \"group\" ? \"layout\" : \"\";\n let animationTransition = {\n ...getValueTransition(defaultOptions, transitionName),\n };\n animationTransition.duration && (animationTransition.duration = secondsToMilliseconds(animationTransition.duration));\n animationTransition =\n applyGeneratorOptions(animationTransition);\n const easing = mapEasingToNativeEasing(animationTransition.ease, animationTransition.duration);\n effect.updateTiming({\n delay: secondsToMilliseconds(animationTransition.delay ?? 0),\n duration: animationTransition.duration,\n easing,\n });\n animations.push(new NativeAnimationWrapper(animation));\n }\n else if (hasOpacity(targetDefinition, \"enter\") &&\n hasOpacity(targetDefinition, \"exit\") &&\n effect\n .getKeyframes()\n .some((keyframe) => keyframe.mixBlendMode)) {\n animations.push(new NativeAnimationWrapper(animation));\n }\n else {\n animation.cancel();\n }\n }\n resolve(new GroupAnimation(animations));\n });\n });\n}\nfunction hasOpacity(target, key) {\n return target?.[key]?.ke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