@aarsteinmedia/dotlottie-player 5.2.2 → 5.2.4

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/CHANGELOG.md CHANGED
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  Changelog was only added since [3.2.3], so it's not exhaustive. [Please report any missing noteable changes to us](https://github.com/aarsteinmedia/dotlottie-player/issues), and we'll add them promptly.
9
9
 
10
- ## [5.2.2] - 11-06-2025
10
+ ## [5.2.4] - 11-06-2025
11
11
 
12
12
  ### Changed
13
13
 
@@ -289,6 +289,7 @@ Changelog was only added since [3.2.3], so it's not exhaustive. [Please report a
289
289
  - Removed dependencies
290
290
  - `@lit`
291
291
 
292
+ [5.2.4]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.2.4
292
293
  [5.2.0]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.2.0
293
294
  [5.1.13]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.1.13
294
295
  [5.1.11]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.1.11
@@ -368,6 +368,16 @@
368
368
  ],
369
369
  "description": "Handles click and drag actions on the progress track."
370
370
  },
371
+ {
372
+ "kind": "method",
373
+ "name": "_handleSettingsClick",
374
+ "parameters": [
375
+ {
376
+ "name": "{ target }"
377
+ }
378
+ ],
379
+ "description": "Handle settings click event."
380
+ },
371
381
  {
372
382
  "kind": "method",
373
383
  "name": "_addEventListeners",
@@ -586,10 +596,6 @@
586
596
  },
587
597
  "default": "[]"
588
598
  },
589
- {
590
- "kind": "field",
591
- "name": "_handleSettingsClick"
592
- },
593
599
  {
594
600
  "kind": "field",
595
601
  "name": "template"
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { RendererType } from '@aarsteinmedia/lottie-web/utils';
1
2
  export { PlayerEvents } from '@aarsteinmedia/lottie-web/utils';
2
3
  import { AnimationSettings, AnimationData, LottieManifest, AnimationDirection, AnimationItem, Vector2 } from '@aarsteinmedia/lottie-web';
3
4
 
@@ -84,11 +85,6 @@ declare enum PreserveAspectRatio {
84
85
  Initial = "none",
85
86
  None = "xMinYMin slice"
86
87
  }
87
- declare enum RendererType {
88
- Canvas = "canvas",
89
- HTML = "html",
90
- SVG = "svg"
91
- }
92
88
 
93
89
  declare class DotLottiePlayer extends PropertyCallbackElement {
94
90
  static get observedAttributes(): string[];
@@ -196,7 +192,7 @@ declare class DotLottiePlayer extends PropertyCallbackElement {
196
192
  protected _freeze(): void;
197
193
  protected _handleBlur(): void;
198
194
  protected _handleSeekChange({ target }: Event): void;
199
- protected _handleSettingsClick: ({ target }: Event) => void;
195
+ protected _handleSettingsClick({ target }: Event): void;
200
196
  private _addEventListeners;
201
197
  private _addIntersectionObserver;
202
198
  private _complete;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _isServer, createElementID, PreserveAspectRatio as PreserveAspectRatio$1, PlayerEvents } from '@aarsteinmedia/lottie-web/utils';
1
+ import { isServer, createElementID, PreserveAspectRatio as PreserveAspectRatio$1, RendererType, PlayerEvents } from '@aarsteinmedia/lottie-web/utils';
2
2
  export { PlayerEvents } from '@aarsteinmedia/lottie-web/utils';
3
3
  import Lottie from '@aarsteinmedia/lottie-web';
4
4
  import { strToU8, zip, strFromU8, unzip as unzip$1 } from 'fflate';
@@ -6,7 +6,7 @@ import { strToU8, zip, strFromU8, unzip as unzip$1 } from 'fflate';
6
6
  /**
7
7
  * Credit to: Leonardo Favre https://github.com/leofavre/observed-properties.
8
8
  */ const updateOnConnected = Symbol('UPDATE_ON_CONNECTED');
9
- if (_isServer) {
9
+ if (isServer) {
10
10
  // Mock HTMLElement for server-side rendering
11
11
  global.HTMLElement = // eslint-disable-next-line @typescript-eslint/no-extraneous-class
12
12
  class EmptyHTMLElement {
@@ -95,12 +95,6 @@ var PreserveAspectRatio = /*#__PURE__*/ function(PreserveAspectRatio) {
95
95
  PreserveAspectRatio["None"] = "xMinYMin slice";
96
96
  return PreserveAspectRatio;
97
97
  }({});
98
- var RendererType = /*#__PURE__*/ function(RendererType) {
99
- RendererType["Canvas"] = "canvas";
100
- RendererType["HTML"] = "html";
101
- RendererType["SVG"] = "svg";
102
- return RendererType;
103
- }({});
104
98
 
105
99
  /**
106
100
  * Render Controls.
@@ -258,13 +252,13 @@ const hasExt = (path)=>{
258
252
  *
259
253
  * @param str - Base64 encoded string.
260
254
  * @returns UTF-8/Latin-1 binary.
261
- */ base64ToU8 = (str)=>strToU8(_isServer ? Buffer.from(parseBase64(str), 'base64').toString('binary') : atob(parseBase64(str)), true), getExtFromB64 = (str)=>{
255
+ */ base64ToU8 = (str)=>strToU8(isServer ? Buffer.from(parseBase64(str), 'base64').toString('binary') : atob(parseBase64(str)), true), getExtFromB64 = (str)=>{
262
256
  const mime = str.split(':')[1].split(';')[0], ext = mime.split('/')[1].split('+')[0];
263
257
  return ext;
264
258
  }, handleErrors = (err)=>{
265
259
  const res = {
266
260
  message: 'Unknown error',
267
- status: _isServer ? 500 : 400
261
+ status: isServer ? 500 : 400
268
262
  };
269
263
  if (err && typeof err === 'object') {
270
264
  if ('message' in err && typeof err.message === 'string') {
@@ -474,7 +468,7 @@ async function resolveAssets(unzipped, assets) {
474
468
  }
475
469
  toResolve.push(new Promise((resolveAsset)=>{
476
470
  let assetB64;
477
- if (_isServer) {
471
+ if (isServer) {
478
472
  assetB64 = Buffer.from(u8).toString('base64');
479
473
  } else {
480
474
  let result = '';
@@ -875,15 +869,7 @@ const generator = '@aarsteinmedia/dotlottie-player';
875
869
  * Which animation to show, if several.
876
870
  */ this._currentAnimation = 0, this._isBounce = false, this._isDotLottie = false, this._lottieInstance = null, /**
877
871
  * Multi-animation settings.
878
- */ this._multiAnimationSettings = [], /**
879
- * Handle settings click event.
880
- */ this._handleSettingsClick = ({ target })=>{
881
- this._toggleSettings();
882
- // Because Safari does not add focus on click, we need to add it manually, so the onblur event will fire
883
- if (target instanceof HTMLElement) {
884
- target.focus();
885
- }
886
- };
872
+ */ this._multiAnimationSettings = [];
887
873
  this._complete = this._complete.bind(this);
888
874
  this._dataFailed = this._dataFailed.bind(this);
889
875
  this._dataReady = this._dataReady.bind(this);
@@ -899,6 +885,7 @@ const generator = '@aarsteinmedia/dotlottie-player';
899
885
  this._mouseLeave = this._mouseLeave.bind(this);
900
886
  this._onVisibilityChange = this._onVisibilityChange.bind(this);
901
887
  this._switchInstance = this._switchInstance.bind(this);
888
+ this._handleSettingsClick = this._handleSettingsClick.bind(this);
902
889
  this.togglePlay = this.togglePlay.bind(this);
903
890
  this.stop = this.stop.bind(this);
904
891
  this.prev = this.prev.bind(this);
@@ -1123,13 +1110,11 @@ const generator = '@aarsteinmedia/dotlottie-player';
1123
1110
  }
1124
1111
  /**
1125
1112
  * Get Multi-animation settings.
1126
- *
1127
1113
  */ getMultiAnimationSettings() {
1128
1114
  return this._multiAnimationSettings;
1129
1115
  }
1130
1116
  /**
1131
1117
  * Get playback segment.
1132
- *
1133
1118
  */ getSegment() {
1134
1119
  return this._segment;
1135
1120
  }
@@ -1512,6 +1497,15 @@ const generator = '@aarsteinmedia/dotlottie-player';
1512
1497
  this.seek(Math.round(Number(target.value) / 100 * this._lottieInstance.totalFrames));
1513
1498
  }
1514
1499
  /**
1500
+ * Handle settings click event.
1501
+ */ _handleSettingsClick({ target }) {
1502
+ this._toggleSettings();
1503
+ // Because Safari does not add focus on click, we need to add it manually, so the onblur event will fire
1504
+ if (target instanceof HTMLElement) {
1505
+ target.focus();
1506
+ }
1507
+ }
1508
+ /**
1515
1509
  * Add event listeners.
1516
1510
  */ _addEventListeners() {
1517
1511
  this._toggleEventListeners('add');
@@ -1678,7 +1672,7 @@ const generator = '@aarsteinmedia/dotlottie-player';
1678
1672
  if (!this.animateOnScroll || !this._lottieInstance) {
1679
1673
  return;
1680
1674
  }
1681
- if (_isServer) {
1675
+ if (isServer) {
1682
1676
  console.warn('DotLottie: Scroll animations might not work properly in a Server Side Rendering context. Try to wrap this in a client component.');
1683
1677
  return;
1684
1678
  }
@@ -1874,7 +1868,7 @@ const generator = '@aarsteinmedia/dotlottie-player';
1874
1868
  *
1875
1869
  */ globalThis.dotLottiePlayer = ()=>new DotLottiePlayer();
1876
1870
  const tagName = 'dotlottie-player';
1877
- if (!_isServer) {
1871
+ if (!isServer) {
1878
1872
  customElements.define(tagName, DotLottiePlayer);
1879
1873
  }
1880
1874