@wix/motion 1.580.0 → 1.582.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.
|
@@ -83,6 +83,9 @@ class AnimationGroup {
|
|
|
83
83
|
console.warn('animation was interrupted - aborting onFinish callback - ', _error);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
get finished() {
|
|
87
|
+
return Promise.all(this.animations.map(animation => animation.finished));
|
|
88
|
+
}
|
|
86
89
|
get playState() {
|
|
87
90
|
var _this$animations$2;
|
|
88
91
|
return (_this$animations$2 = this.animations[0]) == null ? void 0 : _this$animations$2.playState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AnimationGroup","constructor","animations","options","_defineProperty2","default","ready","measured","Promise","resolve","getProgress","_this$animations$","effect","getComputedTiming","progress","play","callback","animation","all","map","pause","reverse","p","activeDuration","delay","getTiming","currentTime","cancel","setPlaybackRate","rate","playbackRate","onFinish","finished","_error","console","warn","playState","_this$animations$2","exports"],"sources":["../../src/AnimationGroup.ts"],"sourcesContent":["import { AnimationGroupOptions, RangeOffset } from './types';\n\n/**\n * @class AnimationGroup\n *\n * A wrapper object for simulating a GroupEffect and managing multiple animations.\n * See: https://www.w3.org/TR/web-animations-2/#grouping-and-synchronization\n */\nexport class AnimationGroup {\n animations: (Animation & {\n start?: RangeOffset;\n end?: RangeOffset;\n })[];\n options?: AnimationGroupOptions;\n ready: Promise<void>;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n }\n\n getProgress() {\n return this.animations[0]?.effect?.getComputedTiming().progress || 0;\n }\n\n async play(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.play();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n pause() {\n for (const animation of this.animations) {\n animation.pause();\n }\n }\n\n async reverse(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.reverse();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n progress(p: number) {\n for (const animation of this.animations) {\n const { activeDuration } = animation.effect!.getComputedTiming();\n const { delay } = animation.effect!.getTiming();\n animation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n }\n }\n\n cancel() {\n for (const animation of this.animations) {\n animation.cancel();\n }\n }\n\n setPlaybackRate(rate: number) {\n for (const animation of this.animations) {\n animation.playbackRate = rate;\n }\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animations.map((animation) => animation.finished));\n callback();\n } catch (_error) {\n console.warn(\n 'animation was interrupted - aborting onFinish callback - ',\n _error,\n );\n }\n }\n\n get playState() {\n return this.animations[0]?.playState;\n }\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,CAAC;EAQ1BC,WAAWA,CAACC,UAAuB,EAAEC,OAA+B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IACpE,IAAI,CAACH,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACG,KAAK,GAAG,CAAAH,OAAO,oBAAPA,OAAO,CAAEI,QAAQ,KAAIC,OAAO,CAACC,OAAO,CAAC,CAAC;EACrD;EAEAC,WAAWA,CAAA,EAAG;IAAA,IAAAC,iBAAA;IACZ,OAAO,EAAAA,iBAAA,OAAI,CAACT,UAAU,CAAC,CAAC,CAAC,cAAAS,iBAAA,GAAlBA,iBAAA,CAAoBC,MAAM,qBAA1BD,iBA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AAI,CAAC,KAAMD,cAAc,IAAe,CAAC,CAAC,IAAID,CAAC;IAC1D;EACF;EAEAK,MAAMA,CAAA,EAAG;IACP,KAAK,MAAMV,SAAS,IAAI,IAAI,CAACf,UAAU,EAAE;MACvCe,SAAS,CAACU,MAAM,CAAC,CAAC;IACpB;EACF;EAEAC,eAAeA,CAACC,IAAY,EAAE;IAC5B,KAAK,MAAMZ,SAAS,IAAI,IAAI,CAACf,UAAU,EAAE;MACvCe,SAAS,CAACa,YAAY,GAAGD,IAAI;IAC/B;EACF;EAEA,MAAME,QAAQA,CAACf,QAAoB,EAAiB;IAClD,IAAI;MACF,MAAMR,OAAO,CAACU,GAAG,CAAC,IAAI,CAAChB,UAAU,CAACiB,GAAG,CAAEF,SAAS,IAAKA,SAAS,CAACe,QAAQ,CAAC,CAAC;MACzEhB,QAAQ,CAAC,CAAC;IACZ,CAAC,CAAC,OAAOiB,MAAM,EAAE;MACfC,OAAO,CAACC,IAAI,CACV,2DAA2D,EAC3DF,MACF,CAAC;IACH;EACF;EAEA,
|
|
1
|
+
{"version":3,"names":["AnimationGroup","constructor","animations","options","_defineProperty2","default","ready","measured","Promise","resolve","getProgress","_this$animations$","effect","getComputedTiming","progress","play","callback","animation","all","map","pause","reverse","p","activeDuration","delay","getTiming","currentTime","cancel","setPlaybackRate","rate","playbackRate","onFinish","finished","_error","console","warn","playState","_this$animations$2","exports"],"sources":["../../src/AnimationGroup.ts"],"sourcesContent":["import { AnimationGroupOptions, RangeOffset } from './types';\n\n/**\n * @class AnimationGroup\n *\n * A wrapper object for simulating a GroupEffect and managing multiple animations.\n * See: https://www.w3.org/TR/web-animations-2/#grouping-and-synchronization\n */\nexport class AnimationGroup {\n animations: (Animation & {\n start?: RangeOffset;\n end?: RangeOffset;\n })[];\n options?: AnimationGroupOptions;\n ready: Promise<void>;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n }\n\n getProgress() {\n return this.animations[0]?.effect?.getComputedTiming().progress || 0;\n }\n\n async play(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.play();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n pause() {\n for (const animation of this.animations) {\n animation.pause();\n }\n }\n\n async reverse(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.reverse();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n progress(p: number) {\n for (const animation of this.animations) {\n const { activeDuration } = animation.effect!.getComputedTiming();\n const { delay } = animation.effect!.getTiming();\n animation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n }\n }\n\n cancel() {\n for (const animation of this.animations) {\n animation.cancel();\n }\n }\n\n setPlaybackRate(rate: number) {\n for (const animation of this.animations) {\n animation.playbackRate = rate;\n }\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animations.map((animation) => animation.finished));\n callback();\n } catch (_error) {\n console.warn(\n 'animation was interrupted - aborting onFinish callback - ',\n _error,\n );\n }\n }\n\n get finished() {\n return Promise.all(this.animations.map((animation) => animation.finished));\n }\n\n get playState() {\n return this.animations[0]?.playState;\n }\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,CAAC;EAQ1BC,WAAWA,CAACC,UAAuB,EAAEC,OAA+B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IACpE,IAAI,CAACH,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAA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ACE,OAAA,CAAAtC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -78,6 +78,9 @@ export class AnimationGroup {
|
|
|
78
78
|
console.warn('animation was interrupted - aborting onFinish callback - ', _error);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
get finished() {
|
|
82
|
+
return Promise.all(this.animations.map(animation => animation.finished));
|
|
83
|
+
}
|
|
81
84
|
get playState() {
|
|
82
85
|
var _this$animations$2;
|
|
83
86
|
return (_this$animations$2 = this.animations[0]) == null ? void 0 : _this$animations$2.playState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AnimationGroup","constructor","animations","options","_defineProperty","ready","measured","Promise","resolve","getProgress","_this$animations$","effect","getComputedTiming","progress","play","callback","animation","all","map","pause","reverse","p","activeDuration","delay","getTiming","currentTime","cancel","setPlaybackRate","rate","playbackRate","onFinish","finished","_error","console","warn","playState","_this$animations$2"],"sources":["../../src/AnimationGroup.ts"],"sourcesContent":["import { AnimationGroupOptions, RangeOffset } from './types';\n\n/**\n * @class AnimationGroup\n *\n * A wrapper object for simulating a GroupEffect and managing multiple animations.\n * See: https://www.w3.org/TR/web-animations-2/#grouping-and-synchronization\n */\nexport class AnimationGroup {\n animations: (Animation & {\n start?: RangeOffset;\n end?: RangeOffset;\n })[];\n options?: AnimationGroupOptions;\n ready: Promise<void>;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n }\n\n getProgress() {\n return this.animations[0]?.effect?.getComputedTiming().progress || 0;\n }\n\n async play(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.play();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n pause() {\n for (const animation of this.animations) {\n animation.pause();\n }\n }\n\n async reverse(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.reverse();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n progress(p: number) {\n for (const animation of this.animations) {\n const { activeDuration } = animation.effect!.getComputedTiming();\n const { delay } = animation.effect!.getTiming();\n animation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n }\n }\n\n cancel() {\n for (const animation of this.animations) {\n animation.cancel();\n }\n }\n\n setPlaybackRate(rate: number) {\n for (const animation of this.animations) {\n animation.playbackRate = rate;\n }\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animations.map((animation) => animation.finished));\n callback();\n } catch (_error) {\n console.warn(\n 'animation was interrupted - aborting onFinish callback - ',\n _error,\n );\n }\n }\n\n get playState() {\n return this.animations[0]?.playState;\n }\n}\n"],"mappings":";AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,CAAC;EAQ1BC,WAAWA,CAACC,UAAuB,EAAEC,OAA+B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACpE,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,KAAK,GAAG,CAAAF,OAAO,oBAAPA,OAAO,CAAEG,QAAQ,KAAIC,OAAO,CAACC,OAAO,CAAC,CAAC;EACrD;EAEAC,WAAWA,CAAA,EAAG;IAAA,IAAAC,iBAAA;IACZ,OAAO,EAAAA,iBAAA,OAAI,CAACR,UAAU,CAAC,CAAC,CAAC,cAAAQ,iBAAA,GAAlBA,iBAAA,CAAoBC,MAAM,qBAA1BD,iBAAA,CAA4BE,iBAAiB,CAAC,CAAC,CAACC,QAAQ,KAAI,CAAC;EACtE;EAEA,MAAMC,IAAIA,CAACC,QAAqB,EAAiB;IAC/C,MAAM,IAAI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AI,CAACd,UAAU,EAAE;MACvCc,SAAS,CAACU,MAAM,CAAC,CAAC;IACpB;EACF;EAEAC,eAAeA,CAACC,IAAY,EAAE;IAC5B,KAAK,MAAMZ,SAAS,IAAI,IAAI,CAACd,UAAU,EAAE;MACvCc,SAAS,CAACa,YAAY,GAAGD,IAAI;IAC/B;EACF;EAEA,MAAME,QAAQA,CAACf,QAAoB,EAAiB;IAClD,IAAI;MACF,MAAMR,OAAO,CAACU,GAAG,CAAC,IAAI,CAACf,UAAU,CAACgB,GAAG,CAAEF,SAAS,IAAKA,SAAS,CAACe,QAAQ,CAAC,CAAC;MACzEhB,QAAQ,CAAC,CAAC;IACZ,CAAC,CAAC,OAAOiB,MAAM,EAAE;MACfC,OAAO,CAACC,IAAI,CACV,2DAA2D,EAC3DF,MACF,CAAC;IACH;EACF;EAEA,
|
|
1
|
+
{"version":3,"names":["AnimationGroup","constructor","animations","options","_defineProperty","ready","measured","Promise","resolve","getProgress","_this$animations$","effect","getComputedTiming","progress","play","callback","animation","all","map","pause","reverse","p","activeDuration","delay","getTiming","currentTime","cancel","setPlaybackRate","rate","playbackRate","onFinish","finished","_error","console","warn","playState","_this$animations$2"],"sources":["../../src/AnimationGroup.ts"],"sourcesContent":["import { AnimationGroupOptions, RangeOffset } from './types';\n\n/**\n * @class AnimationGroup\n *\n * A wrapper object for simulating a GroupEffect and managing multiple animations.\n * See: https://www.w3.org/TR/web-animations-2/#grouping-and-synchronization\n */\nexport class AnimationGroup {\n animations: (Animation & {\n start?: RangeOffset;\n end?: RangeOffset;\n })[];\n options?: AnimationGroupOptions;\n ready: Promise<void>;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n }\n\n getProgress() {\n return this.animations[0]?.effect?.getComputedTiming().progress || 0;\n }\n\n async play(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.play();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n pause() {\n for (const animation of this.animations) {\n animation.pause();\n }\n }\n\n async reverse(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.reverse();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n progress(p: number) {\n for (const animation of this.animations) {\n const { activeDuration } = animation.effect!.getComputedTiming();\n const { delay } = animation.effect!.getTiming();\n animation.currentTime =\n ((delay || 0) + ((activeDuration as number) || 0)) * p;\n }\n }\n\n cancel() {\n for (const animation of this.animations) {\n animation.cancel();\n }\n }\n\n setPlaybackRate(rate: number) {\n for (const animation of this.animations) {\n animation.playbackRate = rate;\n }\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animations.map((animation) => animation.finished));\n callback();\n } catch (_error) {\n console.warn(\n 'animation was interrupted - aborting onFinish callback - ',\n _error,\n );\n }\n }\n\n get finished() {\n return Promise.all(this.animations.map((animation) => animation.finished));\n }\n\n get playState() {\n return this.animations[0]?.playState;\n }\n}\n"],"mappings":";AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,CAAC;EAQ1BC,WAAWA,CAACC,UAAuB,EAAEC,OAA+B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACpE,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,KAAK,GAAG,CAAAF,OAAO,oBAAPA,OAAO,CAAEG,QAAQ,KAAIC,OAAO,CAACC,OAAO,CAAC,CAAC;EACrD;EAEAC,WAAWA,CAAA,EAAG;IAAA,IAAAC,iBAAA;IACZ,OAAO,EAAAA,iBAAA,OAAI,CAACR,UAA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CAAEa,SAAS,CAAC,CAAC;MAC/CR,SAAS,CAACS,WAAW,GACnB,CAAC,CAACF,KAAK,IAAI,CAAC,KAAMD,cAAc,IAAe,CAAC,CAAC,IAAID,CAAC;IAC1D;EACF;EAEAK,MAAMA,CAAA,EAAG;IACP,KAAK,MAAMV,SAAS,IAAI,IAAI,CAACd,UAAU,EAAE;MACvCc,SAAS,CAACU,MAAM,CAAC,CAAC;IACpB;EACF;EAEAC,eAAeA,CAACC,IAAY,EAAE;IAC5B,KAAK,MAAMZ,SAAS,IAAI,IAAI,CAACd,UAAU,EAAE;MACvCc,SAAS,CAACa,YAAY,GAAGD,IAAI;IAC/B;EACF;EAEA,MAAME,QAAQA,CAACf,QAAoB,EAAiB;IAClD,IAAI;MACF,MAAMR,OAAO,CAACU,GAAG,CAAC,IAAI,CAACf,UAAU,CAACgB,GAAG,CAAEF,SAAS,IAAKA,SAAS,CAACe,QAAQ,CAAC,CAAC;MACzEhB,QAAQ,CAAC,CAAC;IACZ,CAAC,CAAC,OAAOiB,MAAM,EAAE;MACfC,OAAO,CAACC,IAAI,CACV,2DAA2D,EAC3DF,MACF,CAAC;IACH;EACF;EAEA,IAAID,QAAQA,CAAA,EAAG;IACb,OAAOxB,OAAO,CAACU,GAAG,CAAC,IAAI,CAACf,UAAU,CAACgB,GAAG,CAAEF,SAAS,IAAKA,SAAS,CAACe,QAAQ,CAAC,CAAC;EAC5E;EAEA,IAAII,SAASA,CAAA,EAAG;IAAA,IAAAC,kBAAA;IACd,QAAAA,kBAAA,GAAO,IAAI,CAAClC,UAAU,CAAC,CAAC,CAAC,qBAAlBkC,kBAAA,CAAoBD,SAAS;EACtC;AACF","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ export declare class AnimationGroup {
|
|
|
21
21
|
cancel(): void;
|
|
22
22
|
setPlaybackRate(rate: number): void;
|
|
23
23
|
onFinish(callback: () => void): Promise<void>;
|
|
24
|
+
get finished(): Promise<Animation[]>;
|
|
24
25
|
get playState(): AnimationPlayState;
|
|
25
26
|
}
|
|
26
27
|
//# sourceMappingURL=AnimationGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationGroup.d.ts","sourceRoot":"","sources":["../../src/AnimationGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,UAAU,EAAE,CAAC,SAAS,GAAG;QACvB,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,GAAG,CAAC,EAAE,WAAW,CAAC;KACnB,CAAC,EAAE,CAAC;IACL,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAET,UAAU,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAMpE,WAAW;IAIL,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBhD,KAAK;IAMC,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBnD,QAAQ,CAAC,CAAC,EAAE,MAAM;IASlB,MAAM;IAMN,eAAe,CAAC,IAAI,EAAE,MAAM;IAMtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAYnD,IAAI,SAAS,uBAEZ;CACF"}
|
|
1
|
+
{"version":3,"file":"AnimationGroup.d.ts","sourceRoot":"","sources":["../../src/AnimationGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,UAAU,EAAE,CAAC,SAAS,GAAG;QACvB,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,GAAG,CAAC,EAAE,WAAW,CAAC;KACnB,CAAC,EAAE,CAAC;IACL,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAET,UAAU,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAMpE,WAAW;IAIL,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBhD,KAAK;IAMC,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBnD,QAAQ,CAAC,CAAC,EAAE,MAAM;IASlB,MAAM;IAMN,eAAe,CAAC,IAAI,EAAE,MAAM;IAMtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAYnD,IAAI,QAAQ,yBAEX;IAED,IAAI,SAAS,uBAEZ;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/motion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.582.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": "
|
|
86
|
+
"falconPackageHash": "13c3ab57e43536afd63dbf7d839558d0616366e0d45cb48803202fb8"
|
|
87
87
|
}
|