@aarsteinmedia/dotlottie-player 5.0.4 → 5.1.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ 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.1.0] - 02-06-2025
11
+
12
+ ### Changed
13
+
14
+ - Dropped `lottie-web` as dependency in favour of `@aarsteinmedia/lottie-web`. This animation engine is based on `lottie-web`, has the same features + it works better in Node SSR environments, it doesn't rely on `eval()` to execute AE expressions, and it is hopefully easier to maintain and expand.
15
+
10
16
  ## [5.0.4] - 31-05-2025
11
17
 
12
18
  ### Changed
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { isServer as isServer$1, createElementID, PreserveAspectRatio as PreserveAspectRatio$1 } from '@aarsteinmedia/lottie-web/utils';
2
- import Lottie from 'lottie-web';
1
+ import { isServer, createElementID, PreserveAspectRatio as PreserveAspectRatio$1 } from '@aarsteinmedia/lottie-web/utils';
2
+ import Lottie from '@aarsteinmedia/lottie-web';
3
3
  import { strToU8, strFromU8, zip, unzip as unzip$1 } from 'fflate';
4
4
 
5
5
  /**
6
6
  * Credit to: Leonardo Favre https://github.com/leofavre/observed-properties.
7
7
  */ const updateOnConnected = Symbol('UPDATE_ON_CONNECTED');
8
- if (isServer$1()) {
8
+ if (isServer()) {
9
9
  // Mock HTMLElement for server-side rendering
10
10
  global.HTMLElement = // eslint-disable-next-line @typescript-eslint/no-extraneous-class
11
11
  class EmptyHTMLElement {
@@ -205,7 +205,7 @@ class CustomError extends Error {
205
205
  throw new Error('No animations listed in manifest');
206
206
  }
207
207
  return manifest;
208
- }, isServer = ()=>!(typeof window !== 'undefined' && window.document);
208
+ };
209
209
  /**
210
210
  * Methods used only locally.
211
211
  */ const hasExt = (path)=>{
@@ -1181,7 +1181,6 @@ const generator = '@aarsteinmedia/dotlottie-player';
1181
1181
  this.playerState = PlayerState.Playing;
1182
1182
  }
1183
1183
  // Initialize lottie player and load animation
1184
- // @ts-expect-error TODO:
1185
1184
  this._lottieInstance = Lottie.loadAnimation({
1186
1185
  ...this._getOptions(),
1187
1186
  animationData: animations[this._currentAnimation]
@@ -1258,7 +1257,7 @@ const generator = '@aarsteinmedia/dotlottie-player';
1258
1257
  if (!this.shadow) {
1259
1258
  return;
1260
1259
  }
1261
- const togglePlay = this.shadow.querySelector('.togglePlay'), stop = this.shadow.querySelector('.stop'), prev = this.shadow.querySelector('.prev'), next = this.shadow.querySelector('.next'), seeker = this.shadow.querySelector('.seeker'), progress = this.shadow.querySelector('progress'), popover = this.shadow.querySelector('.popover'), convert = this.shadow.querySelector('.convert');
1260
+ const togglePlay = this.shadow.querySelector('.togglePlay'), stop = this.shadow.querySelector('.stop'), prev = this.shadow.querySelector('.prev'), next = this.shadow.querySelector('.next'), seeker = this.shadow.querySelector('.seeker'), progress = this.shadow.querySelector('progress'), popover = this.shadow.querySelector('.popover'), convert = this.shadow.querySelector('.convert'), snapshot = this.shadow.querySelector('.snapshot');
1262
1261
  if (!(togglePlay instanceof HTMLButtonElement) || !(stop instanceof HTMLButtonElement) || !(next instanceof HTMLButtonElement) || !(prev instanceof HTMLButtonElement) || !(seeker instanceof HTMLInputElement) || !(progress instanceof HTMLProgressElement)) {
1263
1262
  return;
1264
1263
  }
@@ -1280,20 +1279,13 @@ const generator = '@aarsteinmedia/dotlottie-player';
1280
1279
  next.hidden = false;
1281
1280
  }
1282
1281
  if (name === '_currentAnimation' && typeof value === 'number') {
1283
- if (value + 1 >= this._animations.length) {
1284
- next.hidden = true;
1285
- } else {
1286
- next.hidden = false;
1287
- }
1288
- if (value) {
1289
- prev.hidden = false;
1290
- } else {
1291
- prev.hidden = true;
1292
- }
1282
+ next.hidden = value + 1 >= this._animations.length;
1283
+ prev.hidden = Boolean(value);
1293
1284
  }
1294
- if (name === '_isSettingsOpen' && typeof value === 'boolean' && popover instanceof HTMLDivElement && convert instanceof HTMLButtonElement) {
1285
+ if (name === '_isSettingsOpen' && typeof value === 'boolean' && popover instanceof HTMLDivElement && convert instanceof HTMLButtonElement && snapshot instanceof HTMLButtonElement) {
1295
1286
  popover.hidden = !value;
1296
1287
  convert.hidden = this._isDotLottie;
1288
+ snapshot.hidden = this.renderer !== RendererType.SVG;
1297
1289
  }
1298
1290
  }
1299
1291
  /**
@@ -1804,7 +1796,6 @@ const generator = '@aarsteinmedia/dotlottie-player';
1804
1796
  this._lottieInstance.destroy();
1805
1797
  }
1806
1798
  // Re-initialize lottie player
1807
- // @ts-expect-error TODO:
1808
1799
  this._lottieInstance = Lottie.loadAnimation({
1809
1800
  ...this._getOptions(),
1810
1801
  animationData: this._animations[this._currentAnimation]