@wix/motion 1.658.0 → 1.659.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,12 +51,15 @@ function getWebAnimation(target, animationOptions, trigger, options, ownerDocume
51
51
  // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate
52
52
  const mouseAnimationPreset = (0, _common.getNamedEffect)(effectOptions);
53
53
  const mouseAnimationFactory = getWebAnimationEffect(mouseAnimationPreset, animationOptions, element, trigger, options);
54
- return mouseAnimationFactory(element);
54
+ return typeof mouseAnimationFactory === 'function' ? mouseAnimationFactory(element) : null;
55
55
  }
56
56
 
57
57
  // get the preset for the given animation options
58
58
  const namedEffect = (0, _common.getNamedEffect)(animationOptions);
59
59
  const animationsData = getWebAnimationEffect(namedEffect, animationOptions, element, trigger, options);
60
+ if (!animationsData) {
61
+ return null;
62
+ }
60
63
  const data = (0, _common.getEffectsData)(animationsData, trigger, animationOptions.effectId);
61
64
  let timeline;
62
65
  const isViewProgress = (trigger == null ? void 0 : trigger.trigger) === 'view-progress';
@@ -1 +1 @@
1
- {"version":3,"names":["_CustomAnimation","require","_AnimationGroup","_common","_fastdom","_interopRequireDefault","getWebAnimationEffect","preset","animation","target","trigger","options","isNotAScrubTrigger","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","measure","mutate","web","getWebAnimation","animationOptions","ownerDocument","element","getElement","effectOptions","customEffect","namedEffect","id","type","mouseAnimationPreset","getNamedEffect","mouseAnimationFactory","animationsData","data","getEffectsData","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","effect","part","effectTarget","getElementMotionPart","keyframeEffect","KeyframeEffect","fastdom","updateTiming","timing","setKeyframes","keyframes","timingOptions","CustomAnimation","Animation","start","end","getRanges","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","AnimationGroup","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n getElementMotionPart,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n isNotAScrubTrigger,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n trigger?: Partial<TriggerVariant>,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n trigger,\n options,\n ) as MouseAnimationFactory;\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n trigger,\n options,\n ) as AnimationData[];\n const data = getEffectsData(\n animationsData,\n trigger,\n animationOptions.effectId,\n );\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part ? getElementMotionPart(element, part) : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline\n ? { timeline: timeline as AnimationTimeline }\n : {};\n const animation: Animation | CustomAnimation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":";;;;;AAWA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAUA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,SAASK,qBAAqBA,CAC5BC,MAAuE,EACvEC,SAA2B,EAC3BC,MAAmC,EACnCC,OAAiC,EACjCC,OAA6B,EACY;EACzC,IAAIJ,MAAM,EAAE;IACV;IACA,IAAI,IAAAK,0BAAkB,EAACF,OAAO,CAAC,EAAE;MAC/BF,SAAS,CAACK,QAAQ,GAAGL,SAAS,CAACK,QAAQ,IAAI,CAAC;MAE5C,IAAIF,OAAO,YAAPA,OAAO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AAG/B,MAAM,CAA4BgC;YAC1C,CAAC;YACDjB,GAAG,EAAE;cACHa,IAAI,EAAEH,gBAAgB,CAAEG,IAAI;cAC5BC,MAAM,GAAAN,QAAA,GAAEE,gBAAgB,CAAEI,MAAM,qBAAxBN,QAAA,CAA0BO,KAAK;cACvCC,GAAG,EAAG/B,MAAM,CAA4BiC;YAC1C;UACF,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF;IAEA,IAAIlD,EAAE,EAAE;MACNtB,SAAS,CAACsB,EAAE,GAAGA,EAAE;IACnB;IAEA,OAAOtB,SAAS;EAClB,CACF,CAAC;;EAED;EACA,OAAO,IAAIyE,8BAAc,CAACpC,UAAU,EAAE;IACpC,GAAGtB,gBAAgB;IACnBb,OAAO,EAAE;MAAE,IAAIA,OAAO,IAAK,CAAC,CAA6B;IAAE,CAAC;IAC5D;IACAwE,QAAQ,EAAE,IAAIC,OAAO,CAAEC,OAAO,IAAK/B,gBAAO,CAACjC,MAAM,CAACgE,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_CustomAnimation","require","_AnimationGroup","_common","_fastdom","_interopRequireDefault","getWebAnimationEffect","preset","animation","target","trigger","options","isNotAScrubTrigger","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","measure","mutate","web","getWebAnimation","animationOptions","ownerDocument","element","getElement","effectOptions","customEffect","namedEffect","id","type","mouseAnimationPreset","getNamedEffect","mouseAnimationFactory","animationsData","data","getEffectsData","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","effect","part","effectTarget","getElementMotionPart","keyframeEffect","KeyframeEffect","fastdom","updateTiming","timing","setKeyframes","keyframes","timingOptions","CustomAnimation","Animation","start","end","getRanges","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","AnimationGroup","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n getElementMotionPart,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n isNotAScrubTrigger,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n trigger?: Partial<TriggerVariant>,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance | null {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n trigger,\n options,\n ) as MouseAnimationFactory;\n\n return typeof mouseAnimationFactory === 'function'\n ? mouseAnimationFactory(element as HTMLElement)\n : null;\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n trigger,\n options,\n ) as AnimationData[];\n\n if (!animationsData) {\n return null;\n }\n\n const data = getEffectsData(\n animationsData,\n trigger,\n animationOptions.effectId,\n );\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part ? getElementMotionPart(element, part) : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline\n ? { timeline: timeline as AnimationTimeline }\n : {};\n const animation: Animation | CustomAnimation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":";;;;;AAWA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAUA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,SAASK,qBAAqBA,CAC5BC,MAAuE,EACvEC,SAA2B,EAC3BC,MAAmC,EACnCC,OAAiC,EACjCC,OAA6B,EACY;EACzC,IAAIJ,MAAM,EAAE;IACV;IACA,IAAI,IAAAK,0BAAkB,EAACF,OAAO,CAAC,EAAE;MAC/BF,SAAS,CAACK,QAAQ,GAAGL,SAAS,CAACK,QAAQ,IAAI,CAAC;MAE5C,IAAIF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AkB,CAAEI,IAAI;cAC9BC,MAAM,GAAAP,OAAA,GAAEE,kBAAkB,CAAEK,MAAM,qBAA1BP,OAAA,CAA4BQ,KAAK;cACzCC,GAAG,EAAG/B,MAAM,CAA4BgC;YAC1C,CAAC;YACDjB,GAAG,EAAE;cACHa,IAAI,EAAEH,gBAAgB,CAAEG,IAAI;cAC5BC,MAAM,GAAAN,QAAA,GAAEE,gBAAgB,CAAEI,MAAM,qBAAxBN,QAAA,CAA0BO,KAAK;cACvCC,GAAG,EAAG/B,MAAM,CAA4BiC;YAC1C;UACF,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF;IAEA,IAAIlD,EAAE,EAAE;MACNtB,SAAS,CAACsB,EAAE,GAAGA,EAAE;IACnB;IAEA,OAAOtB,SAAS;EAClB,CACF,CAAC;;EAED;EACA,OAAO,IAAIyE,8BAAc,CAACpC,UAAU,EAAE;IACpC,GAAGtB,gBAAgB;IACnBb,OAAO,EAAE;MAAE,IAAIA,OAAO,IAAK,CAAC,CAA6B;IAAE,CAAC;IAC5D;IACAwE,QAAQ,EAAE,IAAIC,OAAO,CAAEC,OAAO,IAAK/B,gBAAO,CAACjC,MAAM,CAACgE,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -56,6 +56,9 @@ function getScrubScene(target, animationOptions, trigger, sceneOptions = {}) {
56
56
  ...rest
57
57
  } = sceneOptions;
58
58
  const animation = (0, _webAnimations.getWebAnimation)(target, animationOptions, trigger, rest);
59
+ if (!animation) {
60
+ return null;
61
+ }
59
62
  let typeSpecificOptions = {};
60
63
  if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {
61
64
  // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects
@@ -1 +1 @@
1
- {"version":3,"names":["_AnimationGroup","require","_utils","exports","getEasing","_webAnimations","getWebAnimation","_cssAnimations","getCSSAnimation","_prepare","prepareAnimation","_common","getElementCSSAnimation","target","animationOptions","namedEffect","getNamedEffect","style","effectId","getElementAnimation","effectNames","getNames","element","getElement","animations","getAnimations","animationNames","map","anim","animationName","filteredAnimations","forEach","name","includes","push","find","length","AnimationGroup","filter","id","startsWith","getScrubScene","trigger","sceneOptions","disabled","allowActiveEvent","rest","animation","typeSpecificOptions","window","ViewTimeline","viewSource","componentId","ready","partialAnimation","start","end","getProgress","effect","__","p","activeDuration","getComputedTiming","delay","getTiming","currentTime","destroy","cancel","centeredToTarget","transitionDuration","transitionEasing","customEffect","getJsEasing","v","active","progress","getAnimation","reducedMotion","Promise","resolve"],"sources":["../../src/motion.ts"],"sourcesContent":["import type {\n AnimationOptions,\n ScrubAnimationOptions,\n TriggerVariant,\n MouseAnimationInstance,\n AnimationEffectAPI,\n CustomMouseAnimationInstance,\n ScrubScrollScene,\n ScrubPointerScene,\n} from './types';\nimport { AnimationGroup } from './AnimationGroup';\nimport { getEasing, getJsEasing } from './utils';\nimport { getWebAnimation } from './api/webAnimations';\nimport { getCSSAnimation } from './api/cssAnimations';\nimport { prepareAnimation } from './api/prepare';\nimport { getElement, getNamedEffect } from './api/common';\n\nfunction getElementCSSAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n): AnimationGroup | null {\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n if (!namedEffect) {\n return null;\n }\n\n if (!namedEffect.style) {\n // if this named effect does not have a style method, attempt to get group of Web Animations\n if (animationOptions.effectId && target) {\n return getElementAnimation(target, animationOptions.effectId);\n }\n\n return null;\n }\n\n const effectNames = namedEffect.getNames(animationOptions);\n const element = typeof target === 'string' ? getElement(target) : target;\n const animations = element?.getAnimations();\n const animationNames =\n animations?.map((anim) => (anim as CSSAnimation).animationName) ||\n ([] as string[]);\n const filteredAnimations: CSSAnimation[] = [];\n\n effectNames.forEach((name) => {\n if (animationNames.includes(name)) {\n filteredAnimations.push(\n animations?.find(\n (anim) => (anim as CSSAnimation).animationName === name,\n ) as CSSAnimation,\n );\n }\n });\n\n return filteredAnimations?.length\n ? new AnimationGroup(filteredAnimations)\n : null;\n}\n\nfunction getElementAnimation(\n target: HTMLElement | string,\n effectId: string,\n): AnimationGroup | null {\n const element = typeof target === 'string' ? getElement(target) : target;\n // somehow get the right animations\n const animations = element\n ?.getAnimations()\n .filter((anim: Animation | CSSAnimation) => {\n const id = anim.id || (anim as CSSAnimation).animationName;\n // if no id/name just return all animations\n return id ? id.startsWith(effectId) : true;\n });\n\n return animations?.length ? new AnimationGroup(animations) : null;\n}\n\nfunction getScrubScene(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger: Partial<TriggerVariant> & { element?: HTMLElement },\n sceneOptions: Record<string, any> = {},\n): ScrubScrollScene[] | ScrubPointerScene {\n const { disabled, allowActiveEvent, ...rest } = sceneOptions;\n const animation = getWebAnimation(target, animationOptions, trigger, rest);\n\n let typeSpecificOptions = {} as Record<string, any>;\n\n if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {\n // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects\n const viewSource = trigger.element || getElement(trigger.componentId!);\n const { ready } = animation as AnimationGroup;\n\n return (animation as AnimationGroup).animations.map((partialAnimation) => {\n return {\n /* we use getters for start and end in order to access the animation's start and end\n only when initializing the scrub scene rather than immediately */\n get start() {\n return partialAnimation.start;\n },\n get end() {\n return partialAnimation.end;\n },\n viewSource,\n ready,\n getProgress() {\n return (animation as AnimationGroup).getProgress();\n },\n effect(__: any, p: number) {\n const { activeDuration } =\n partialAnimation.effect!.getComputedTiming();\n const { delay } = partialAnimation.effect!.getTiming();\n\n partialAnimation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n },\n disabled,\n destroy() {\n partialAnimation.cancel();\n },\n } as ScrubScrollScene;\n });\n } else if (trigger.trigger === 'pointer-move') {\n const { centeredToTarget, transitionDuration, transitionEasing } =\n animationOptions as ScrubAnimationOptions;\n\n typeSpecificOptions = {\n target: (animation as MouseAnimationInstance).target,\n centeredToTarget,\n allowActiveEvent,\n };\n\n if (animationOptions.customEffect && transitionDuration) {\n typeSpecificOptions.transitionDuration = transitionDuration;\n typeSpecificOptions.transitionEasing = getJsEasing(transitionEasing);\n }\n }\n\n return {\n ...typeSpecificOptions,\n getProgress() {\n return (\n animation as AnimationGroup | CustomMouseAnimationInstance\n ).getProgress();\n },\n effect(\n __: any,\n p: number | { x: number; y: number },\n v?: { x: number; y: number },\n active?: boolean,\n ) {\n animation.progress(\n v\n ? {\n // @ts-expect-error spread error on p\n ...p,\n v,\n active,\n }\n : p,\n );\n },\n disabled,\n destroy() {\n animation.cancel();\n },\n } as ScrubPointerScene;\n}\n\nfunction getAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n reducedMotion: boolean = false,\n): AnimationGroup | MouseAnimationInstance | null {\n const animation = getElementCSSAnimation(target, animationOptions);\n\n if (animation) {\n animation.ready = new Promise((resolve) => {\n prepareAnimation(target, animationOptions, resolve);\n });\n\n return animation;\n }\n\n return getWebAnimation(target, animationOptions, trigger, { reducedMotion });\n}\n\nexport {\n getCSSAnimation,\n getWebAnimation,\n getElementCSSAnimation,\n getElementAnimation,\n getScrubScene,\n prepareAnimation,\n getAnimation,\n getEasing,\n};\n\nexport type { AnimationGroup };\n"],"mappings":";;;;;;;AAUA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAiDE,OAAA,CAAAC,SAAA,GAAAF,MAAA,CAAAE,SAAA;AACjD,IAAAC,cAAA,GAAAJ,OAAA;AAAsDE,OAAA,CAAAG,eAAA,GAAAD,cAAA,CAAAC,eAAA;AACtD,IAAAC,cAAA,GAAAN,OAAA;AAAsDE,OAAA,CAAAK,eAAA,GAAAD,cAAA,CAAAC,eAAA;AACtD,IAAAC,QAAA,GAAAR,OAAA;AAAiDE,OAAA,CAAAO,gBAAA,GAAAD,QAAA,CAAAC,gBAAA;AACjD,IAAAC,OAAA,GAAAV,OAAA;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;MACA3B,SAAS,CAAC4B,QAAQ,CAChBF,CAAC,GACG;QACE;QACA,GAAGb,CAAC;QACJa,CAAC;QACDC;MACF,CAAC,GACDd,CACN,CAAC;IACH,CAAC;IACDhB,QAAQ;IACRsB,OAAOA,CAAA,EAAG;MACRnB,SAAS,CAACoB,MAAM,CAAC,CAAC;IACpB;EACF,CAAC;AACH;AAEA,SAASS,YAAYA,CACnB/D,MAAmC,EACnCC,gBAAkC,EAClC4B,OAA6D,EAC7DmC,aAAsB,GAAG,KAAK,EACkB;EAChD,MAAM9B,SAAS,GAAGnC,sBAAsB,CAACC,MAAM,EAAEC,gBAAgB,CAAC;EAElE,IAAIiC,SAAS,EAAE;IACbA,SAAS,CAACM,KAAK,GAAG,IAAIyB,OAAO,CAAEC,OAAO,IAAK;MACzC,IAAArE,yBAAgB,EAACG,MAAM,EAAEC,gBAAgB,EAAEiE,OAAO,CAAC;IACrD,CAAC,CAAC;IAEF,OAAOhC,SAAS;EAClB;EAEA,OAAO,IAAAzC,8BAAe,EAACO,MAAM,EAAEC,gBAAgB,EAAE4B,OAAO,EAAE;IAAEmC;EAAc,CAAC,CAAC;AAC9E","ignoreList":[]}
1
+ {"version":3,"names":["_AnimationGroup","require","_utils","exports","getEasing","_webAnimations","getWebAnimation","_cssAnimations","getCSSAnimation","_prepare","prepareAnimation","_common","getElementCSSAnimation","target","animationOptions","namedEffect","getNamedEffect","style","effectId","getElementAnimation","effectNames","getNames","element","getElement","animations","getAnimations","animationNames","map","anim","animationName","filteredAnimations","forEach","name","includes","push","find","length","AnimationGroup","filter","id","startsWith","getScrubScene","trigger","sceneOptions","disabled","allowActiveEvent","rest","animation","typeSpecificOptions","window","ViewTimeline","viewSource","componentId","ready","partialAnimation","start","end","getProgress","effect","__","p","activeDuration","getComputedTiming","delay","getTiming","currentTime","destroy","cancel","centeredToTarget","transitionDuration","transitionEasing","customEffect","getJsEasing","v","active","progress","getAnimation","reducedMotion","Promise","resolve"],"sources":["../../src/motion.ts"],"sourcesContent":["import type {\n AnimationOptions,\n ScrubAnimationOptions,\n TriggerVariant,\n MouseAnimationInstance,\n AnimationEffectAPI,\n CustomMouseAnimationInstance,\n ScrubScrollScene,\n ScrubPointerScene,\n} from './types';\nimport { AnimationGroup } from './AnimationGroup';\nimport { getEasing, getJsEasing } from './utils';\nimport { getWebAnimation } from './api/webAnimations';\nimport { getCSSAnimation } from './api/cssAnimations';\nimport { prepareAnimation } from './api/prepare';\nimport { getElement, getNamedEffect } from './api/common';\n\nfunction getElementCSSAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n): AnimationGroup | null {\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n if (!namedEffect) {\n return null;\n }\n\n if (!namedEffect.style) {\n // if this named effect does not have a style method, attempt to get group of Web Animations\n if (animationOptions.effectId && target) {\n return getElementAnimation(target, animationOptions.effectId);\n }\n\n return null;\n }\n\n const effectNames = namedEffect.getNames(animationOptions);\n const element = typeof target === 'string' ? getElement(target) : target;\n const animations = element?.getAnimations();\n const animationNames =\n animations?.map((anim) => (anim as CSSAnimation).animationName) ||\n ([] as string[]);\n const filteredAnimations: CSSAnimation[] = [];\n\n effectNames.forEach((name) => {\n if (animationNames.includes(name)) {\n filteredAnimations.push(\n animations?.find(\n (anim) => (anim as CSSAnimation).animationName === name,\n ) as CSSAnimation,\n );\n }\n });\n\n return filteredAnimations?.length\n ? new AnimationGroup(filteredAnimations)\n : null;\n}\n\nfunction getElementAnimation(\n target: HTMLElement | string,\n effectId: string,\n): AnimationGroup | null {\n const element = typeof target === 'string' ? getElement(target) : target;\n // somehow get the right animations\n const animations = element\n ?.getAnimations()\n .filter((anim: Animation | CSSAnimation) => {\n const id = anim.id || (anim as CSSAnimation).animationName;\n // if no id/name just return all animations\n return id ? id.startsWith(effectId) : true;\n });\n\n return animations?.length ? new AnimationGroup(animations) : null;\n}\n\nfunction getScrubScene(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger: Partial<TriggerVariant> & { element?: HTMLElement },\n sceneOptions: Record<string, any> = {},\n): ScrubScrollScene[] | ScrubPointerScene | null {\n const { disabled, allowActiveEvent, ...rest } = sceneOptions;\n const animation = getWebAnimation(target, animationOptions, trigger, rest);\n\n if (!animation) {\n return null;\n }\n\n let typeSpecificOptions = {} as Record<string, any>;\n\n if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {\n // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects\n const viewSource = trigger.element || getElement(trigger.componentId!);\n const { ready } = animation as AnimationGroup;\n\n return (animation as AnimationGroup).animations.map((partialAnimation) => {\n return {\n /* we use getters for start and end in order to access the animation's start and end\n only when initializing the scrub scene rather than immediately */\n get start() {\n return partialAnimation.start;\n },\n get end() {\n return partialAnimation.end;\n },\n viewSource,\n ready,\n getProgress() {\n return (animation as AnimationGroup).getProgress();\n },\n effect(__: any, p: number) {\n const { activeDuration } =\n partialAnimation.effect!.getComputedTiming();\n const { delay } = partialAnimation.effect!.getTiming();\n\n partialAnimation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n },\n disabled,\n destroy() {\n partialAnimation.cancel();\n },\n } as ScrubScrollScene;\n });\n } else if (trigger.trigger === 'pointer-move') {\n const { centeredToTarget, transitionDuration, transitionEasing } =\n animationOptions as ScrubAnimationOptions;\n\n typeSpecificOptions = {\n target: (animation as MouseAnimationInstance).target,\n centeredToTarget,\n allowActiveEvent,\n };\n\n if (animationOptions.customEffect && transitionDuration) {\n typeSpecificOptions.transitionDuration = transitionDuration;\n typeSpecificOptions.transitionEasing = getJsEasing(transitionEasing);\n }\n }\n\n return {\n ...typeSpecificOptions,\n getProgress() {\n return (\n animation as AnimationGroup | CustomMouseAnimationInstance\n ).getProgress();\n },\n effect(\n __: any,\n p: number | { x: number; y: number },\n v?: { x: number; y: number },\n active?: boolean,\n ) {\n animation.progress(\n v\n ? {\n // @ts-expect-error spread error on p\n ...p,\n v,\n active,\n }\n : p,\n );\n },\n disabled,\n destroy() {\n animation.cancel();\n },\n } as ScrubPointerScene;\n}\n\nfunction getAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n reducedMotion: boolean = false,\n): AnimationGroup | MouseAnimationInstance | null {\n const animation = getElementCSSAnimation(target, animationOptions);\n\n if (animation) {\n animation.ready = new Promise((resolve) => {\n prepareAnimation(target, animationOptions, resolve);\n });\n\n return animation;\n }\n\n return getWebAnimation(target, animationOptions, trigger, { reducedMotion });\n}\n\nexport {\n getCSSAnimation,\n getWebAnimation,\n getElementCSSAnimation,\n getElementAnimation,\n getScrubScene,\n prepareAnimation,\n getAnimation,\n getEasing,\n};\n\nexport type { AnimationGroup };\n"],"mappings":";;;;;;;AAUA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAiDE,OAAA,CAAAC,SAAA,GAAAF,MAAA,CAAAE,SAAA;AACjD,IAAAC,cAAA,GAAAJ,OAAA;AAAsDE,OAAA,CAAAG,eAAA,GAAAD,cAAA,CAAAC,eAAA;AACtD,IAAAC,cAAA,GAAAN,OAAA;AAAsDE,OAAA,CAAAK,eAAA,GAAAD,cAAA,CAAAC,eAAA;AACtD,IAAAC,QAAA,GAAAR,OAAA;AAAiDE,OAAA,CAAAO,gBAAA,GAAAD,QAAA,CAAAC,gBAAA;AACjD,IAAAC,OAAA,GAAAV,OAAA;AAEA,SAASW,sBAAsBA,CAC7BC,MAAmC,EACnCC,gBAAkC,EACX;EACvB,MAAMC,WAAW,GAAG,IAAAC,sBAAc,EAChCF,gBACF,CAAmC;EAEnC,IAAI,CAACC,WAAW,EAAE;IAChB,OAAO,IAAI;EACb;EAEA,IAAI,CAACA,WAAW,CAACE,KAAK,EAAE;IACtB;IACA,IAAIH,gBAAgB,CAACI,QAAQ,IAAIL,MAAM,EAAE;MACvC,OAAOM,mBAAmB,CAACN,MAAM,EAAEC,gBAAgB,CAACI,QAAQ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AClC4B,OAA6D,EAC7DmC,aAAsB,GAAG,KAAK,EACkB;EAChD,MAAM9B,SAAS,GAAGnC,sBAAsB,CAACC,MAAM,EAAEC,gBAAgB,CAAC;EAElE,IAAIiC,SAAS,EAAE;IACbA,SAAS,CAACM,KAAK,GAAG,IAAIyB,OAAO,CAAEC,OAAO,IAAK;MACzC,IAAArE,yBAAgB,EAACG,MAAM,EAAEC,gBAAgB,EAAEiE,OAAO,CAAC;IACrD,CAAC,CAAC;IAEF,OAAOhC,SAAS;EAClB;EAEA,OAAO,IAAAzC,8BAAe,EAACO,MAAM,EAAEC,gBAAgB,EAAE4B,OAAO,EAAE;IAAEmC;EAAc,CAAC,CAAC;AAC9E","ignoreList":[]}
@@ -46,12 +46,15 @@ function getWebAnimation(target, animationOptions, trigger, options, ownerDocume
46
46
  // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate
47
47
  const mouseAnimationPreset = getNamedEffect(effectOptions);
48
48
  const mouseAnimationFactory = getWebAnimationEffect(mouseAnimationPreset, animationOptions, element, trigger, options);
49
- return mouseAnimationFactory(element);
49
+ return typeof mouseAnimationFactory === 'function' ? mouseAnimationFactory(element) : null;
50
50
  }
51
51
 
52
52
  // get the preset for the given animation options
53
53
  const namedEffect = getNamedEffect(animationOptions);
54
54
  const animationsData = getWebAnimationEffect(namedEffect, animationOptions, element, trigger, options);
55
+ if (!animationsData) {
56
+ return null;
57
+ }
55
58
  const data = getEffectsData(animationsData, trigger, animationOptions.effectId);
56
59
  let timeline;
57
60
  const isViewProgress = (trigger == null ? void 0 : trigger.trigger) === 'view-progress';
@@ -1 +1 @@
1
- {"version":3,"names":["CustomAnimation","AnimationGroup","getElement","getElementMotionPart","measure","mutate","getRanges","getNamedEffect","getEffectsData","isNotAScrubTrigger","fastdom","getWebAnimationEffect","preset","animation","target","trigger","options","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","web","getWebAnimation","animationOptions","ownerDocument","element","effectOptions","customEffect","namedEffect","id","type","mouseAnimationPreset","mouseAnimationFactory","animationsData","data","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","_ref","effect","part","effectTarget","keyframeEffect","KeyframeEffect","updateTiming","timing","setKeyframes","keyframes","timingOptions","Animation","start","end","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n getElementMotionPart,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n isNotAScrubTrigger,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n trigger?: Partial<TriggerVariant>,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n trigger,\n options,\n ) as MouseAnimationFactory;\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n trigger,\n options,\n ) as AnimationData[];\n const data = getEffectsData(\n animationsData,\n trigger,\n animationOptions.effectId,\n );\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part ? getElementMotionPart(element, part) : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline\n ? { timeline: timeline as AnimationTimeline }\n : {};\n const animation: Animation | CustomAnimation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":"AAWA,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SACEC,UAAU,EACVC,oBAAoB,EACpBC,OAAO,EACPC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,cAAc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,CAA2BgB,WAAW,IAAIA,WAAW;UAC9D,MAAMK,gBAAgB,GACnBrB,MAAM,CAA2BiB,SAAS,IAAIA,SAAS;UAE1DK,MAAM,CAACC,MAAM,CAACzD,SAAS,EAAE;YACvB6C,KAAK,EAAE;cACLa,IAAI,EAAEJ,kBAAkB,CAAEI,IAAI;cAC9BC,MAAM,GAAAP,OAAA,GAAEE,kBAAkB,CAAEK,MAAM,qBAA1BP,OAAA,CAA4BQ,KAAK;cACzCC,GAAG,EAAG3B,MAAM,CAA4B4B;YAC1C,CAAC;YACDhB,GAAG,EAAE;cACHY,IAAI,EAAEH,gBAAgB,CAAEG,IAAI;cAC5BC,MAAM,GAAAN,QAAA,GAAEE,gBAAgB,CAAEI,MAAM,qBAAxBN,QAAA,CAA0BO,KAAK;cACvCC,GAAG,EAAG3B,MAAM,CAA4B6B;YAC1C;UACF,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF;IAEA,IAAI7C,EAAE,EAAE;MACNlB,SAAS,CAACkB,EAAE,GAAGA,EAAE;IACnB;IAEA,OAAOlB,SAAS;EAClB,CACF,CAAC;;EAED;EACA,OAAO,IAAIZ,cAAc,CAAC2C,UAAU,EAAE;IACpC,GAAGnB,gBAAgB;IACnBV,OAAO,EAAE;MAAE,IAAIA,OAAO,IAAK,CAAC,CAA6B;IAAE,CAAC;IAC5D;IACA8D,QAAQ,EAAE,IAAIC,OAAO,CAAEC,OAAO,IAAKrE,OAAO,CAACL,MAAM,CAAC0E,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ;AAEA,SAASvD,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["CustomAnimation","AnimationGroup","getElement","getElementMotionPart","measure","mutate","getRanges","getNamedEffect","getEffectsData","isNotAScrubTrigger","fastdom","getWebAnimationEffect","preset","animation","target","trigger","options","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","web","getWebAnimation","animationOptions","ownerDocument","element","effectOptions","customEffect","namedEffect","id","type","mouseAnimationPreset","mouseAnimationFactory","animationsData","data","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","_ref","effect","part","effectTarget","keyframeEffect","KeyframeEffect","updateTiming","timing","setKeyframes","keyframes","timingOptions","Animation","start","end","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n getElementMotionPart,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n isNotAScrubTrigger,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n trigger?: Partial<TriggerVariant>,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance | null {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n trigger,\n options,\n ) as MouseAnimationFactory;\n\n return typeof mouseAnimationFactory === 'function'\n ? mouseAnimationFactory(element as HTMLElement)\n : null;\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n trigger,\n options,\n ) as AnimationData[];\n\n if (!animationsData) {\n return null;\n }\n\n const data = getEffectsData(\n animationsData,\n trigger,\n animationOptions.effectId,\n );\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part ? getElementMotionPart(element, part) : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline\n ? { timeline: timeline as AnimationTimeline }\n : {};\n const animation: Animation | CustomAnimation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":"AAWA,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SACEC,UAAU,EACVC,oBAAoB,EACpBC,OAAO,EACPC,MAAM,EACN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,GAC9BvC,gBAAyC;;QAE3C;QACAf,OAAO,CAACL,MAAM,CAAC,MAAM;UAAA,IAAA4D,OAAA,EAAAC,QAAA;UACnB,MAAMC,kBAAkB,GACrBpB,MAAM,CAA2BgB,WAAW,IAAIA,WAAW;UAC9D,MAAMK,gBAAgB,GACnBrB,MAAM,CAA2BiB,SAAS,IAAIA,SAAS;UAE1DK,MAAM,CAACC,MAAM,CAACzD,SAAS,EAAE;YACvB6C,KAAK,EAAE;cACLa,IAAI,EAAEJ,kBAAkB,CAAEI,IAAI;cAC9BC,MAAM,GAAAP,OAAA,GAAEE,kBAAkB,CAAEK,MAAM,qBAA1BP,OAAA,CAA4BQ,KAAK;cACzCC,GAAG,EAAG3B,MAAM,CAA4B4B;YAC1C,CAAC;YACDhB,GAAG,EAAE;cACHY,IAAI,EAAEH,gBAAgB,CAAEG,IAAI;cAC5BC,MAAM,GAAAN,QAAA,GAAEE,gBAAgB,CAAEI,MAAM,qBAAxBN,QAAA,CAA0BO,KAAK;cACvCC,GAAG,EAAG3B,MAAM,CAA4B6B;YAC1C;UACF,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF;IAEA,IAAI7C,EAAE,EAAE;MACNlB,SAAS,CAACkB,EAAE,GAAGA,EAAE;IACnB;IAEA,OAAOlB,SAAS;EAClB,CACF,CAAC;;EAED;EACA,OAAO,IAAIZ,cAAc,CAAC2C,UAAU,EAAE;IACpC,GAAGnB,gBAAgB;IACnBV,OAAO,EAAE;MAAE,IAAIA,OAAO,IAAK,CAAC,CAA6B;IAAE,CAAC;IAC5D;IACA8D,QAAQ,EAAE,IAAIC,OAAO,CAAEC,OAAO,IAAKrE,OAAO,CAACL,MAAM,CAAC0E,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ;AAEA,SAASvD,eAAe","ignoreList":[]}
@@ -48,6 +48,9 @@ function getScrubScene(target, animationOptions, trigger, sceneOptions) {
48
48
  ...rest
49
49
  } = sceneOptions;
50
50
  const animation = getWebAnimation(target, animationOptions, trigger, rest);
51
+ if (!animation) {
52
+ return null;
53
+ }
51
54
  let typeSpecificOptions = {};
52
55
  if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {
53
56
  // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects
@@ -1 +1 @@
1
- {"version":3,"names":["AnimationGroup","getEasing","getJsEasing","getWebAnimation","getCSSAnimation","prepareAnimation","getElement","getNamedEffect","getElementCSSAnimation","target","animationOptions","namedEffect","style","effectId","getElementAnimation","effectNames","getNames","element","animations","getAnimations","animationNames","map","anim","animationName","filteredAnimations","forEach","name","includes","push","find","length","filter","id","startsWith","getScrubScene","trigger","sceneOptions","disabled","allowActiveEvent","rest","animation","typeSpecificOptions","window","ViewTimeline","viewSource","componentId","ready","partialAnimation","start","end","getProgress","effect","__","p","activeDuration","getComputedTiming","delay","getTiming","currentTime","destroy","cancel","centeredToTarget","transitionDuration","transitionEasing","customEffect","v","active","progress","getAnimation","reducedMotion","Promise","resolve"],"sources":["../../src/motion.ts"],"sourcesContent":["import type {\n AnimationOptions,\n ScrubAnimationOptions,\n TriggerVariant,\n MouseAnimationInstance,\n AnimationEffectAPI,\n CustomMouseAnimationInstance,\n ScrubScrollScene,\n ScrubPointerScene,\n} from './types';\nimport { AnimationGroup } from './AnimationGroup';\nimport { getEasing, getJsEasing } from './utils';\nimport { getWebAnimation } from './api/webAnimations';\nimport { getCSSAnimation } from './api/cssAnimations';\nimport { prepareAnimation } from './api/prepare';\nimport { getElement, getNamedEffect } from './api/common';\n\nfunction getElementCSSAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n): AnimationGroup | null {\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n if (!namedEffect) {\n return null;\n }\n\n if (!namedEffect.style) {\n // if this named effect does not have a style method, attempt to get group of Web Animations\n if (animationOptions.effectId && target) {\n return getElementAnimation(target, animationOptions.effectId);\n }\n\n return null;\n }\n\n const effectNames = namedEffect.getNames(animationOptions);\n const element = typeof target === 'string' ? getElement(target) : target;\n const animations = element?.getAnimations();\n const animationNames =\n animations?.map((anim) => (anim as CSSAnimation).animationName) ||\n ([] as string[]);\n const filteredAnimations: CSSAnimation[] = [];\n\n effectNames.forEach((name) => {\n if (animationNames.includes(name)) {\n filteredAnimations.push(\n animations?.find(\n (anim) => (anim as CSSAnimation).animationName === name,\n ) as CSSAnimation,\n );\n }\n });\n\n return filteredAnimations?.length\n ? new AnimationGroup(filteredAnimations)\n : null;\n}\n\nfunction getElementAnimation(\n target: HTMLElement | string,\n effectId: string,\n): AnimationGroup | null {\n const element = typeof target === 'string' ? getElement(target) : target;\n // somehow get the right animations\n const animations = element\n ?.getAnimations()\n .filter((anim: Animation | CSSAnimation) => {\n const id = anim.id || (anim as CSSAnimation).animationName;\n // if no id/name just return all animations\n return id ? id.startsWith(effectId) : true;\n });\n\n return animations?.length ? new AnimationGroup(animations) : null;\n}\n\nfunction getScrubScene(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger: Partial<TriggerVariant> & { element?: HTMLElement },\n sceneOptions: Record<string, any> = {},\n): ScrubScrollScene[] | ScrubPointerScene {\n const { disabled, allowActiveEvent, ...rest } = sceneOptions;\n const animation = getWebAnimation(target, animationOptions, trigger, rest);\n\n let typeSpecificOptions = {} as Record<string, any>;\n\n if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {\n // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects\n const viewSource = trigger.element || getElement(trigger.componentId!);\n const { ready } = animation as AnimationGroup;\n\n return (animation as AnimationGroup).animations.map((partialAnimation) => {\n return {\n /* we use getters for start and end in order to access the animation's start and end\n only when initializing the scrub scene rather than immediately */\n get start() {\n return partialAnimation.start;\n },\n get end() {\n return partialAnimation.end;\n },\n viewSource,\n ready,\n getProgress() {\n return (animation as AnimationGroup).getProgress();\n },\n effect(__: any, p: number) {\n const { activeDuration } =\n partialAnimation.effect!.getComputedTiming();\n const { delay } = partialAnimation.effect!.getTiming();\n\n partialAnimation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n },\n disabled,\n destroy() {\n partialAnimation.cancel();\n },\n } as ScrubScrollScene;\n });\n } else if (trigger.trigger === 'pointer-move') {\n const { centeredToTarget, transitionDuration, transitionEasing } =\n animationOptions as ScrubAnimationOptions;\n\n typeSpecificOptions = {\n target: (animation as MouseAnimationInstance).target,\n centeredToTarget,\n allowActiveEvent,\n };\n\n if (animationOptions.customEffect && transitionDuration) {\n typeSpecificOptions.transitionDuration = transitionDuration;\n typeSpecificOptions.transitionEasing = getJsEasing(transitionEasing);\n }\n }\n\n return {\n ...typeSpecificOptions,\n getProgress() {\n return (\n animation as AnimationGroup | CustomMouseAnimationInstance\n ).getProgress();\n },\n effect(\n __: any,\n p: number | { x: number; y: number },\n v?: { x: number; y: number },\n active?: boolean,\n ) {\n animation.progress(\n v\n ? {\n // @ts-expect-error spread error on p\n ...p,\n v,\n active,\n }\n : p,\n );\n },\n disabled,\n destroy() {\n animation.cancel();\n },\n } as ScrubPointerScene;\n}\n\nfunction getAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n reducedMotion: boolean = false,\n): AnimationGroup | MouseAnimationInstance | null {\n const animation = getElementCSSAnimation(target, animationOptions);\n\n if (animation) {\n animation.ready = new Promise((resolve) => {\n prepareAnimation(target, animationOptions, resolve);\n });\n\n return animation;\n }\n\n return getWebAnimation(target, animationOptions, trigger, { reducedMotion });\n}\n\nexport {\n getCSSAnimation,\n getWebAnimation,\n getElementCSSAnimation,\n getElementAnimation,\n getScrubScene,\n prepareAnimation,\n getAnimation,\n getEasing,\n};\n\nexport type { AnimationGroup };\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ,kBAAkB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,SAAS;AAChD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,eAAe,QAAQ,qBAAqB;AACrD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jB,CAAC;IACDC,MAAMA,CACJC,EAAO,EACPC,CAAoC,EACpCY,CAA4B,EAC5BC,MAAgB,EAChB;MACA1B,SAAS,CAAC2B,QAAQ,CAChBF,CAAC,GACG;QACE;QACA,GAAGZ,CAAC;QACJY,CAAC;QACDC;MACF,CAAC,GACDb,CACN,CAAC;IACH,CAAC;IACDhB,QAAQ;IACRsB,OAAOA,CAAA,EAAG;MACRnB,SAAS,CAACoB,MAAM,CAAC,CAAC;IACpB;EACF,CAAC;AACH;AAEA,SAASQ,YAAYA,CACnB3D,MAAmC,EACnCC,gBAAkC,EAClCyB,OAA6D,EAC7DkC,aAAsB,EAC0B;EAAA,IADhDA,aAAsB;IAAtBA,aAAsB,GAAG,KAAK;EAAA;EAE9B,MAAM7B,SAAS,GAAGhC,sBAAsB,CAACC,MAAM,EAAEC,gBAAgB,CAAC;EAElE,IAAI8B,SAAS,EAAE;IACbA,SAAS,CAACM,KAAK,GAAG,IAAIwB,OAAO,CAAEC,OAAO,IAAK;MACzClE,gBAAgB,CAACI,MAAM,EAAEC,gBAAgB,EAAE6D,OAAO,CAAC;IACrD,CAAC,CAAC;IAEF,OAAO/B,SAAS;EAClB;EAEA,OAAOrC,eAAe,CAACM,MAAM,EAAEC,gBAAgB,EAAEyB,OAAO,EAAE;IAAEkC;EAAc,CAAC,CAAC;AAC9E;AAEA,SACEjE,eAAe,EACfD,eAAe,EACfK,sBAAsB,EACtBM,mBAAmB,EACnBoB,aAAa,EACb7B,gBAAgB,EAChB+D,YAAY,EACZnE,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["AnimationGroup","getEasing","getJsEasing","getWebAnimation","getCSSAnimation","prepareAnimation","getElement","getNamedEffect","getElementCSSAnimation","target","animationOptions","namedEffect","style","effectId","getElementAnimation","effectNames","getNames","element","animations","getAnimations","animationNames","map","anim","animationName","filteredAnimations","forEach","name","includes","push","find","length","filter","id","startsWith","getScrubScene","trigger","sceneOptions","disabled","allowActiveEvent","rest","animation","typeSpecificOptions","window","ViewTimeline","viewSource","componentId","ready","partialAnimation","start","end","getProgress","effect","__","p","activeDuration","getComputedTiming","delay","getTiming","currentTime","destroy","cancel","centeredToTarget","transitionDuration","transitionEasing","customEffect","v","active","progress","getAnimation","reducedMotion","Promise","resolve"],"sources":["../../src/motion.ts"],"sourcesContent":["import type {\n AnimationOptions,\n ScrubAnimationOptions,\n TriggerVariant,\n MouseAnimationInstance,\n AnimationEffectAPI,\n CustomMouseAnimationInstance,\n ScrubScrollScene,\n ScrubPointerScene,\n} from './types';\nimport { AnimationGroup } from './AnimationGroup';\nimport { getEasing, getJsEasing } from './utils';\nimport { getWebAnimation } from './api/webAnimations';\nimport { getCSSAnimation } from './api/cssAnimations';\nimport { prepareAnimation } from './api/prepare';\nimport { getElement, getNamedEffect } from './api/common';\n\nfunction getElementCSSAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n): AnimationGroup | null {\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n if (!namedEffect) {\n return null;\n }\n\n if (!namedEffect.style) {\n // if this named effect does not have a style method, attempt to get group of Web Animations\n if (animationOptions.effectId && target) {\n return getElementAnimation(target, animationOptions.effectId);\n }\n\n return null;\n }\n\n const effectNames = namedEffect.getNames(animationOptions);\n const element = typeof target === 'string' ? getElement(target) : target;\n const animations = element?.getAnimations();\n const animationNames =\n animations?.map((anim) => (anim as CSSAnimation).animationName) ||\n ([] as string[]);\n const filteredAnimations: CSSAnimation[] = [];\n\n effectNames.forEach((name) => {\n if (animationNames.includes(name)) {\n filteredAnimations.push(\n animations?.find(\n (anim) => (anim as CSSAnimation).animationName === name,\n ) as CSSAnimation,\n );\n }\n });\n\n return filteredAnimations?.length\n ? new AnimationGroup(filteredAnimations)\n : null;\n}\n\nfunction getElementAnimation(\n target: HTMLElement | string,\n effectId: string,\n): AnimationGroup | null {\n const element = typeof target === 'string' ? getElement(target) : target;\n // somehow get the right animations\n const animations = element\n ?.getAnimations()\n .filter((anim: Animation | CSSAnimation) => {\n const id = anim.id || (anim as CSSAnimation).animationName;\n // if no id/name just return all animations\n return id ? id.startsWith(effectId) : true;\n });\n\n return animations?.length ? new AnimationGroup(animations) : null;\n}\n\nfunction getScrubScene(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger: Partial<TriggerVariant> & { element?: HTMLElement },\n sceneOptions: Record<string, any> = {},\n): ScrubScrollScene[] | ScrubPointerScene | null {\n const { disabled, allowActiveEvent, ...rest } = sceneOptions;\n const animation = getWebAnimation(target, animationOptions, trigger, rest);\n\n if (!animation) {\n return null;\n }\n\n let typeSpecificOptions = {} as Record<string, any>;\n\n if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {\n // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects\n const viewSource = trigger.element || getElement(trigger.componentId!);\n const { ready } = animation as AnimationGroup;\n\n return (animation as AnimationGroup).animations.map((partialAnimation) => {\n return {\n /* we use getters for start and end in order to access the animation's start and end\n only when initializing the scrub scene rather than immediately */\n get start() {\n return partialAnimation.start;\n },\n get end() {\n return partialAnimation.end;\n },\n viewSource,\n ready,\n getProgress() {\n return (animation as AnimationGroup).getProgress();\n },\n effect(__: any, p: number) {\n const { activeDuration } =\n partialAnimation.effect!.getComputedTiming();\n const { delay } = partialAnimation.effect!.getTiming();\n\n partialAnimation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n },\n disabled,\n destroy() {\n partialAnimation.cancel();\n },\n } as ScrubScrollScene;\n });\n } else if (trigger.trigger === 'pointer-move') {\n const { centeredToTarget, transitionDuration, transitionEasing } =\n animationOptions as ScrubAnimationOptions;\n\n typeSpecificOptions = {\n target: (animation as MouseAnimationInstance).target,\n centeredToTarget,\n allowActiveEvent,\n };\n\n if (animationOptions.customEffect && transitionDuration) {\n typeSpecificOptions.transitionDuration = transitionDuration;\n typeSpecificOptions.transitionEasing = getJsEasing(transitionEasing);\n }\n }\n\n return {\n ...typeSpecificOptions,\n getProgress() {\n return (\n animation as AnimationGroup | CustomMouseAnimationInstance\n ).getProgress();\n },\n effect(\n __: any,\n p: number | { x: number; y: number },\n v?: { x: number; y: number },\n active?: boolean,\n ) {\n animation.progress(\n v\n ? {\n // @ts-expect-error spread error on p\n ...p,\n v,\n active,\n }\n : p,\n );\n },\n disabled,\n destroy() {\n animation.cancel();\n },\n } as ScrubPointerScene;\n}\n\nfunction getAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n reducedMotion: boolean = false,\n): AnimationGroup | MouseAnimationInstance | null {\n const animation = getElementCSSAnimation(target, animationOptions);\n\n if (animation) {\n animation.ready = new Promise((resolve) => {\n prepareAnimation(target, animationOptions, resolve);\n });\n\n return animation;\n }\n\n return getWebAnimation(target, animationOptions, trigger, { reducedMotion });\n}\n\nexport {\n getCSSAnimation,\n getWebAnimation,\n getElementCSSAnimation,\n getElementAnimation,\n getScrubScene,\n prepareAnimation,\n getAnimation,\n getEasing,\n};\n\nexport type { AnimationGroup };\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ,kBAAkB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,SAAS;AAChD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,UAAU,EAAEC,cAAc,QAAQ,cAAc;AAEzD,SAASC,sBAAsBA,CAC7BC,MAAmC,EACnCC,gBAAkC,EACX;EACvB,MAAMC,WAAW,GAAGJ,cAAc,CAChCG,gBACF,CAAmC;EAEnC,IAAI,CAACC,WAAW,EAAE;IAChB,OAAO,IAAI;EACb;EAEA,IAAI,CAACA,WAAW,CAACC,KAAK,EAAE;IACtB;IACA,IAAIF,gBAAgB,CAACG,QAAQ,IAAIJ,MAAM,EAAE;MACvC,OAAOK,mBAAmB,CAACL,MAAM,EAAEC,gBAAgB,CAACG,QAAQ,CAAC;IAC/D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EAClCyB,OAA6D,EAC7DkC,aAAsB,EAC0B;EAAA,IADhDA,aAAsB;IAAtBA,aAAsB,GAAG,KAAK;EAAA;EAE9B,MAAM7B,SAAS,GAAGhC,sBAAsB,CAACC,MAAM,EAAEC,gBAAgB,CAAC;EAElE,IAAI8B,SAAS,EAAE;IACbA,SAAS,CAACM,KAAK,GAAG,IAAIwB,OAAO,CAAEC,OAAO,IAAK;MACzClE,gBAAgB,CAACI,MAAM,EAAEC,gBAAgB,EAAE6D,OAAO,CAAC;IACrD,CAAC,CAAC;IAEF,OAAO/B,SAAS;EAClB;EAEA,OAAOrC,eAAe,CAACM,MAAM,EAAEC,gBAAgB,EAAEyB,OAAO,EAAE;IAAEkC;EAAc,CAAC,CAAC;AAC9E;AAEA,SACEjE,eAAe,EACfD,eAAe,EACfK,sBAAsB,EACtBM,mBAAmB,EACnBoB,aAAa,EACb7B,gBAAgB,EAChB+D,YAAY,EACZnE,SAAS","ignoreList":[]}
@@ -2,6 +2,6 @@ import type { AnimationOptions, MouseAnimationInstance, TriggerVariant } from '.
2
2
  import { AnimationGroup } from '../AnimationGroup';
3
3
  declare function getWebAnimation(target: HTMLElement | string | null, animationOptions: AnimationOptions, trigger?: Partial<TriggerVariant> & {
4
4
  element?: HTMLElement;
5
- }, options?: Record<string, any>, ownerDocument?: Document): AnimationGroup | MouseAnimationInstance;
5
+ }, options?: Record<string, any>, ownerDocument?: Document): AnimationGroup | MouseAnimationInstance | null;
6
6
  export { getWebAnimation };
7
7
  //# sourceMappingURL=webAnimations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webAnimations.d.ts","sourceRoot":"","sources":["../../../src/api/webAnimations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,gBAAgB,EAEhB,sBAAsB,EAEtB,cAAc,EAEf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA+CnD,iBAAS,eAAe,CACtB,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,EAC7D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,aAAa,CAAC,EAAE,QAAQ,GACvB,cAAc,GAAG,sBAAsB,CAoJzC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"webAnimations.d.ts","sourceRoot":"","sources":["../../../src/api/webAnimations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,gBAAgB,EAEhB,sBAAsB,EAEtB,cAAc,EAEf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA+CnD,iBAAS,eAAe,CACtB,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,EAC7D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,aAAa,CAAC,EAAE,QAAQ,GACvB,cAAc,GAAG,sBAAsB,GAAG,IAAI,CA2JhD;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -8,7 +8,7 @@ declare function getElementCSSAnimation(target: HTMLElement | string | null, ani
8
8
  declare function getElementAnimation(target: HTMLElement | string, effectId: string): AnimationGroup | null;
9
9
  declare function getScrubScene(target: HTMLElement | string | null, animationOptions: AnimationOptions, trigger: Partial<TriggerVariant> & {
10
10
  element?: HTMLElement;
11
- }, sceneOptions?: Record<string, any>): ScrubScrollScene[] | ScrubPointerScene;
11
+ }, sceneOptions?: Record<string, any>): ScrubScrollScene[] | ScrubPointerScene | null;
12
12
  declare function getAnimation(target: HTMLElement | string | null, animationOptions: AnimationOptions, trigger?: Partial<TriggerVariant> & {
13
13
  element?: HTMLElement;
14
14
  }, reducedMotion?: boolean): AnimationGroup | MouseAnimationInstance | null;
@@ -1 +1 @@
1
- {"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../src/motion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,cAAc,EACd,sBAAsB,EAGtB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAe,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,iBAAS,sBAAsB,CAC7B,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,EAAE,gBAAgB,GACjC,cAAc,GAAG,IAAI,CAuCvB;AAED,iBAAS,mBAAmB,CAC1B,MAAM,EAAE,WAAW,GAAG,MAAM,EAC5B,QAAQ,EAAE,MAAM,GACf,cAAc,GAAG,IAAI,CAYvB;AAED,iBAAS,aAAa,CACpB,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,EAC5D,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACrC,gBAAgB,EAAE,GAAG,iBAAiB,CAqFxC;AAED,iBAAS,YAAY,CACnB,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,OAAO,CAAC,cA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G,iBAAiB,GAAG,IAAI,CAyF/C;AAED,iBAAS,YAAY,CACnB,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,EAC7D,aAAa,GAAE,OAAe,GAC7B,cAAc,GAAG,sBAAsB,GAAG,IAAI,CAYhD;AAED,OAAO,EACL,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,SAAS,GACV,CAAC;AAEF,YAAY,EAAE,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/motion",
3
- "version": "1.658.0",
3
+ "version": "1.659.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "wow!Team",
@@ -83,5 +83,5 @@
83
83
  "wallaby": {
84
84
  "autoDetect": true
85
85
  },
86
- "falconPackageHash": "883c85ba1d1e2599c82aed9f9a9eff9d7403600364de9e259665cf18"
86
+ "falconPackageHash": "9a4dfe84a53dcc74d3078bad3d67f4327488453b8e263a6098fb227f"
87
87
  }