@wix/motion 1.642.0 → 1.643.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.
@@ -15,9 +15,11 @@ class AnimationGroup {
15
15
  (0, _defineProperty2.default)(this, "animations", void 0);
16
16
  (0, _defineProperty2.default)(this, "options", void 0);
17
17
  (0, _defineProperty2.default)(this, "ready", void 0);
18
+ (0, _defineProperty2.default)(this, "isCSS", void 0);
18
19
  this.animations = animations;
19
20
  this.options = options;
20
21
  this.ready = (options == null ? void 0 : options.measured) || Promise.resolve();
22
+ this.isCSS = animations[0] instanceof CSSAnimation;
21
23
  }
22
24
  getProgress() {
23
25
  var _this$animations$;
@@ -78,6 +80,15 @@ class AnimationGroup {
78
80
  async onFinish(callback) {
79
81
  try {
80
82
  await Promise.all(this.animations.map(animation => animation.finished));
83
+ const a = this.animations[0];
84
+ if (a && !this.isCSS) {
85
+ var _a$effect;
86
+ const target = (_a$effect = a.effect) == null ? void 0 : _a$effect.target;
87
+ if (target) {
88
+ const endEvent = new Event('animationend');
89
+ target.dispatchEvent(endEvent);
90
+ }
91
+ }
81
92
  callback();
82
93
  } catch (_error) {
83
94
  console.warn('animation was interrupted - aborting onFinish callback - ', _error);
@@ -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 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,CAAA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AAA,IAAAC,kBAAA;IACd,QAAAA,kBAAA,GAAO,IAAI,CAACnC,UAAU,CAAC,CAAC,CAAC,qBAAlBmC,kBAAA,CAAoBD,SAAS;EACtC;AACF;AAACE,OAAA,CAAAtC,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"names":["AnimationGroup","constructor","animations","options","_defineProperty2","default","ready","measured","Promise","resolve","isCSS","CSSAnimation","getProgress","_this$animations$","effect","getComputedTiming","progress","play","callback","animation","all","map","pause","reverse","p","activeDuration","delay","getTiming","currentTime","cancel","setPlaybackRate","rate","playbackRate","onFinish","finished","a","_a$effect","target","endEvent","Event","dispatchEvent","_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 isCSS: boolean;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n this.isCSS = animations[0] instanceof CSSAnimation;\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\n const a = this.animations[0];\n\n if (a && !this.isCSS) {\n const target = (a.effect as KeyframeEffect)?.target;\n\n if (target) {\n const endEvent = new Event('animationend');\n target.dispatchEvent(endEvent);\n }\n }\n\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;EAS1BC,WAAWA,CAACC,UAAuB,EAAEC,OAA+B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,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;IACnD,IAAI,CAACC,KAAK,GAAGR,UAAU,CAAC,CAAC,CAAC,YAAYS,YAAY;EACpD;EAEAC,WAAWA,CAAA,EAAG;IAAA,IAAAC,iBAAA;IACZ,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B,GAAG,CAAEF,SAAS,IAAKA,SAAS,CAACe,QAAQ,CAAC,CAAC;EAC5E;EAEA,IAAIU,SAASA,CAAA,EAAG;IAAA,IAAAC,kBAAA;IACd,QAAAA,kBAAA,GAAO,IAAI,CAAC3C,UAAU,CAAC,CAAC,CAAC,qBAAlB2C,kBAAA,CAAoBD,SAAS;EACtC;AACF;AAACE,OAAA,CAAA9C,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -10,9 +10,11 @@ export class AnimationGroup {
10
10
  _defineProperty(this, "animations", void 0);
11
11
  _defineProperty(this, "options", void 0);
12
12
  _defineProperty(this, "ready", void 0);
13
+ _defineProperty(this, "isCSS", void 0);
13
14
  this.animations = animations;
14
15
  this.options = options;
15
16
  this.ready = (options == null ? void 0 : options.measured) || Promise.resolve();
17
+ this.isCSS = animations[0] instanceof CSSAnimation;
16
18
  }
17
19
  getProgress() {
18
20
  var _this$animations$;
@@ -73,6 +75,15 @@ export class AnimationGroup {
73
75
  async onFinish(callback) {
74
76
  try {
75
77
  await Promise.all(this.animations.map(animation => animation.finished));
78
+ const a = this.animations[0];
79
+ if (a && !this.isCSS) {
80
+ var _a$effect;
81
+ const target = (_a$effect = a.effect) == null ? void 0 : _a$effect.target;
82
+ if (target) {
83
+ const endEvent = new Event('animationend');
84
+ target.dispatchEvent(endEvent);
85
+ }
86
+ }
76
87
  callback();
77
88
  } catch (_error) {
78
89
  console.warn('animation was interrupted - aborting onFinish callback - ', _error);
@@ -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 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,OAA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S,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":[]}
1
+ {"version":3,"names":["AnimationGroup","constructor","animations","options","_defineProperty","ready","measured","Promise","resolve","isCSS","CSSAnimation","getProgress","_this$animations$","effect","getComputedTiming","progress","play","callback","animation","all","map","pause","reverse","p","activeDuration","delay","getTiming","currentTime","cancel","setPlaybackRate","rate","playbackRate","onFinish","finished","a","_a$effect","target","endEvent","Event","dispatchEvent","_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 isCSS: boolean;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n this.isCSS = animations[0] instanceof CSSAnimation;\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\n const a = this.animations[0];\n\n if (a && !this.isCSS) {\n const target = (a.effect as KeyframeEffect)?.target;\n\n if (target) {\n const endEvent = new Event('animationend');\n target.dispatchEvent(endEvent);\n }\n }\n\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;EAS1BC,WAAWA,CAACC,UAAuB,EAAEC,OAA+B,EAAE;IAAAC,eAAA;IAAAA,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;IACnD,IAAI,CAACC,KAAK,GAAGP,UAAU,CAAC,CAAC,CAAC,YAAYQ,YAAY;EACpD;EAEAC,WAAWA,CAAA,EAAG;IAAA,IAAAC,iBAAA;IACZ,OAAO,EAAAA,iBAAA,OAAI,CAACV,UAAU,CAAC,CAAC,CAAC,cAAA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AC5E;EAEA,IAAIU,SAASA,CAAA,EAAG;IAAA,IAAAC,kBAAA;IACd,QAAAA,kBAAA,GAAO,IAAI,CAAC1C,UAAU,CAAC,CAAC,CAAC,qBAAlB0C,kBAAA,CAAoBD,SAAS;EACtC;AACF","ignoreList":[]}
@@ -12,6 +12,7 @@ export declare class AnimationGroup {
12
12
  })[];
13
13
  options?: AnimationGroupOptions;
14
14
  ready: Promise<void>;
15
+ isCSS: boolean;
15
16
  constructor(animations: Animation[], options?: AnimationGroupOptions);
16
17
  getProgress(): number;
17
18
  play(callback?: () => void): Promise<void>;
@@ -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,QAAQ,yBAEX;IAED,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;IACrB,KAAK,EAAE,OAAO,CAAC;gBAEH,UAAU,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAOpE,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;IAwBnD,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.642.0",
3
+ "version": "1.643.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": "f29ef2c5e2e1438eef8ed2991eb62b5b8ffad8eb8842fc9f1d5578f7"
86
+ "falconPackageHash": "92396a4338f85304cadafecc6fffd8d8b10d69bdd1a3e55eb04a6e20"
87
87
  }