@aarsteinmedia/dotlottie-player 6.3.4 → 6.3.5

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.
package/dist/canvas.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { RendererType, PreserveAspectRatio } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
- import { D as DotLottiePlayerBase, a as DotLottieAnimationInstance } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
4
- export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
3
+ import * as _aarsteinmedia_lottie_web from '@aarsteinmedia/lottie-web';
5
4
  import { AnimationConfiguration, Vector2 } from '@aarsteinmedia/lottie-web';
5
+ import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
6
+ export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
6
7
 
7
8
  declare class DotLottiePlayerCanvas extends DotLottiePlayerBase {
8
9
  get renderer(): RendererType;
9
10
  constructor();
10
- loadAnimation(config: AnimationConfiguration): DotLottieAnimationInstance;
11
+ loadAnimation(config: AnimationConfiguration): _aarsteinmedia_lottie_web.AnimationItem;
11
12
  protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, }: {
12
13
  container?: HTMLElement;
13
14
  rendererType: RendererType;
package/dist/canvas.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
3
  import Lottie from '@aarsteinmedia/lottie-web/canvas';
4
- import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
5
- export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
4
+ import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
5
+ export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
6
6
  import '@aarsteinmedia/lottie-web/dotlottie';
7
7
 
8
8
  /**
@@ -299,6 +299,13 @@ const pauseIcon = /* HTML */ `
299
299
  }
300
300
  }
301
301
  return res;
302
+ }, isEnum = (val, _enum)=>{
303
+ if (val === undefined || val === null) {
304
+ return false;
305
+ }
306
+ // Numeric enums have reverse-mapping keys like "0", "1", etc.
307
+ const enumKeys = Object.keys(_enum).filter((k)=>Number.isNaN(Number(k)));
308
+ return enumKeys.some((k)=>_enum[k] === val);
302
309
  }, isLottie = (json)=>{
303
310
  const mandatory = [
304
311
  'v',
@@ -317,6 +324,24 @@ const notImplemented = 'Method is not implemented', getStyles = async ()=>{
317
324
  await styleSheet.replace(css_248z);
318
325
  return styleSheet;
319
326
  };
327
+ // export interface DotLottieAnimationInstance {
328
+ // addEventListener: (name: string, callback: (...args: any[]) => void) => void
329
+ // autoplay?: boolean
330
+ // currentFrame: number
331
+ // destroy: () => void
332
+ // goToAndPlay: (value: number, isFrame?: boolean) => void
333
+ // goToAndStop: (value: number, isFrame?: boolean) => void
334
+ // pause: () => void
335
+ // play: () => void
336
+ // playDirection: number
337
+ // removeEventListener: (name: string, callback: (...args: any[]) => void) => void
338
+ // setDirection: (direction: AnimationDirection) => void
339
+ // setLoop: (loop: boolean) => void
340
+ // setSpeed: (speed: number) => void
341
+ // setSubframe: (useSubframe: boolean) => void
342
+ // stop: () => void
343
+ // totalFrames: number
344
+ // }
320
345
  /**
321
346
  * DotLottie Player Web Component.
322
347
  */ class DotLottiePlayerBase extends PropertyCallbackElement {
@@ -521,7 +546,7 @@ const notImplemented = 'Method is not implemented', getStyles = async ()=>{
521
546
  }
522
547
  get objectfit() {
523
548
  const val = this.getAttribute('objectfit');
524
- if (val && Object.values(ObjectFit).includes(val)) {
549
+ if (isEnum(val, ObjectFit)) {
525
550
  return val;
526
551
  }
527
552
  return ObjectFit.Contain;
@@ -561,7 +586,7 @@ const notImplemented = 'Method is not implemented', getStyles = async ()=>{
561
586
  }
562
587
  get preserveAspectRatio() {
563
588
  const val = this.getAttribute('preserveAspectRatio');
564
- if (val && Object.values(PreserveAspectRatio).includes(val)) {
589
+ if (isEnum(val, PreserveAspectRatio)) {
565
590
  return val;
566
591
  }
567
592
  return null;
@@ -756,6 +781,9 @@ const notImplemented = 'Method is not implemented', getStyles = async ()=>{
756
781
  case 'mode':
757
782
  {
758
783
  const toggleBoomerang = this.shadow.querySelector('.toggleBoomerang');
784
+ if (!isEnum(value, PlayMode)) {
785
+ break;
786
+ }
759
787
  if (toggleBoomerang instanceof HTMLButtonElement) {
760
788
  toggleBoomerang.dataset.active = (value === PlayMode.Bounce).toString();
761
789
  }
@@ -1,4 +1,4 @@
1
- import { HTMLBooleanAttribute, AnimationData, AnimationDirection, AddAnimationParams, Result, ConvertParams, LottieManifest, AnimationSettings, Vector2, AnimationConfiguration } from '@aarsteinmedia/lottie-web';
1
+ import { HTMLBooleanAttribute, AnimationData, AnimationDirection, AddAnimationParams, Result, ConvertParams, AnimationItem, LottieManifest, AnimationSettings, Vector2, AnimationConfiguration } from '@aarsteinmedia/lottie-web';
2
2
  import { PlayMode, PreserveAspectRatio, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
3
 
4
4
  declare abstract class PropertyCallbackElement extends HTMLElement {
@@ -29,27 +29,9 @@ declare enum PlayerState {
29
29
  }
30
30
  declare const tagName = "dotlottie-player";
31
31
 
32
- interface DotLottieAnimationInstance {
33
- addEventListener: (name: string, callback: (...args: any[]) => void) => void;
34
- autoplay?: boolean;
35
- currentFrame: number;
36
- destroy: () => void;
37
- goToAndPlay: (value: number, isFrame?: boolean) => void;
38
- goToAndStop: (value: number, isFrame?: boolean) => void;
39
- pause: () => void;
40
- play: () => void;
41
- playDirection: number;
42
- removeEventListener: (name: string, callback: (...args: any[]) => void) => void;
43
- setDirection: (direction: AnimationDirection) => void;
44
- setLoop: (loop: boolean) => void;
45
- setSpeed: (speed: number) => void;
46
- setSubframe: (useSubframe: boolean) => void;
47
- stop: () => void;
48
- totalFrames: number;
49
- }
50
32
  declare abstract class DotLottiePlayerBase extends PropertyCallbackElement {
51
33
  static get observedAttributes(): readonly ["animateOnScroll", "autoplay", "controls", "direction", "hover", "loop", "mode", "playOnClick", "playOnVisible", "selector", "speed", "src", "subframe"];
52
- static get observedProperties(): string[];
34
+ static get observedProperties(): readonly ["playerState", "_isSettingsOpen", "_seeker", "_currentAnimation", "_animations"];
53
35
  static get styles(): () => Promise<CSSStyleSheet>;
54
36
  isLight: boolean;
55
37
  playerState: PlayerState;
@@ -141,12 +123,12 @@ declare abstract class DotLottiePlayerBase extends PropertyCallbackElement {
141
123
  convert(_params: ConvertParams): Promise<Result>;
142
124
  destroy(): void;
143
125
  disconnectedCallback(): void;
144
- getLottie(): DotLottieAnimationInstance | null;
126
+ getLottie(): AnimationItem | null;
145
127
  getManifest(): LottieManifest | undefined;
146
128
  getMultiAnimationSettings(): AnimationSettings[];
147
129
  getSegment(): Vector2 | undefined;
148
130
  load(src: string | null): Promise<void>;
149
- loadAnimation(_config: AnimationConfiguration): DotLottieAnimationInstance;
131
+ loadAnimation(_config: AnimationConfiguration): AnimationItem;
150
132
  next(): void;
151
133
  pause(): void;
152
134
  play(): void;
@@ -201,4 +183,3 @@ declare abstract class DotLottiePlayerBase extends PropertyCallbackElement {
201
183
  }
202
184
 
203
185
  export { DotLottiePlayerBase as D, MouseOut as M, PlayerState as P, tagName as t };
204
- export type { DotLottieAnimationInstance as a };
package/dist/full.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { RendererType, PreserveAspectRatio } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
- import { D as DotLottiePlayerBase, a as DotLottieAnimationInstance } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
4
- export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
3
+ import * as _aarsteinmedia_lottie_web from '@aarsteinmedia/lottie-web';
5
4
  import { AnimationConfiguration, Vector2 } from '@aarsteinmedia/lottie-web';
6
5
  import { addAnimation, convert } from '@aarsteinmedia/lottie-web/dotlottie';
6
+ import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
7
+ export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
7
8
 
8
9
  declare class DotLottiePlayer extends DotLottiePlayerBase {
9
10
  addAnimation: typeof addAnimation;
10
11
  convert: typeof convert;
11
- loadAnimation(config: AnimationConfiguration): DotLottieAnimationInstance;
12
+ loadAnimation(config: AnimationConfiguration): _aarsteinmedia_lottie_web.AnimationItem;
12
13
  protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, rendererType }: {
13
14
  container?: undefined | HTMLElement;
14
15
  rendererType: RendererType;
package/dist/full.js CHANGED
@@ -2,8 +2,8 @@ import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
3
  import Lottie from '@aarsteinmedia/lottie-web';
4
4
  import { addAnimation, convert } from '@aarsteinmedia/lottie-web/dotlottie';
5
- import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
6
- export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
5
+ import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
6
+ export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
7
7
 
8
8
  /**
9
9
  * DotLottie Player Web Component.
@@ -38,9 +38,7 @@ export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-B6
38
38
  {
39
39
  options.rendererSettings = {
40
40
  ...options.rendererSettings,
41
- // `clearCanvas` is canvas-only, but `rendererSettings` is typed as a
42
- // renderer union, so we have to narrow/cast in this branch.
43
- clearCanvas: true,
41
+ // clearCanvas: true,
44
42
  preserveAspectRatio,
45
43
  progressiveLoad: true
46
44
  };
package/dist/light.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { RendererType, PreserveAspectRatio } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
- import { D as DotLottiePlayerBase, a as DotLottieAnimationInstance } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
4
- export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
3
+ import * as _aarsteinmedia_lottie_web from '@aarsteinmedia/lottie-web';
5
4
  import { AnimationConfiguration, Vector2 } from '@aarsteinmedia/lottie-web';
5
+ import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
6
+ export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
6
7
 
7
8
  declare class DotLottiePlayerLight extends DotLottiePlayerBase {
8
9
  get renderer(): RendererType;
9
10
  constructor();
10
- loadAnimation(config: AnimationConfiguration): DotLottieAnimationInstance;
11
+ loadAnimation(config: AnimationConfiguration): _aarsteinmedia_lottie_web.AnimationItem;
11
12
  protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, }: {
12
13
  container?: HTMLElement;
13
14
  rendererType: RendererType;
package/dist/light.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
3
  import Lottie from '@aarsteinmedia/lottie-web/light';
4
- import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
5
- export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
4
+ import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
5
+ export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
6
6
  import '@aarsteinmedia/lottie-web/dotlottie';
7
7
 
8
8
  /**
package/dist/svg.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { RendererType, PreserveAspectRatio } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
- import { D as DotLottiePlayerBase, a as DotLottieAnimationInstance } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
4
- export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-COx4pY8X.js';
3
+ import * as _aarsteinmedia_lottie_web from '@aarsteinmedia/lottie-web';
5
4
  import { AnimationConfiguration, Vector2 } from '@aarsteinmedia/lottie-web';
5
+ import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
6
+ export { M as MouseOut, P as PlayerState, t as tagName } from './chunks/DotLottiePlayerBase.d-BSagzEPB.js';
6
7
 
7
8
  declare class DotLottiePlayerSVG extends DotLottiePlayerBase {
8
9
  get renderer(): RendererType;
9
10
  constructor();
10
- loadAnimation(config: AnimationConfiguration): DotLottieAnimationInstance;
11
+ loadAnimation(config: AnimationConfiguration): _aarsteinmedia_lottie_web.AnimationItem;
11
12
  protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, }: {
12
13
  container?: undefined | HTMLElement;
13
14
  rendererType: RendererType;
package/dist/svg.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayMode, PlayerEvents, RendererType } from '@aarsteinmedia/lottie-web/utils';
3
3
  import Lottie from '@aarsteinmedia/lottie-web/svg';
4
- import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
5
- export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-B6CMicGB.js';
4
+ import { D as DotLottiePlayerBase, t as tagName } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
5
+ export { M as MouseOut, P as PlayerState } from './chunks/DotLottiePlayerBase-BBHa6yP8.js';
6
6
  import '@aarsteinmedia/lottie-web/dotlottie';
7
7
 
8
8
  /**