@aarsteinmedia/dotlottie-player 6.6.3 → 6.6.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.
@@ -58,7 +58,7 @@
58
58
  ],
59
59
  "superclass": {
60
60
  "name": "DotLottiePlayerBase",
61
- "module": "/dist/chunks/DotLottiePlayerBase-Cjk0_f2y.js"
61
+ "module": "/dist/chunks/DotLottiePlayerBase-CREYTonO.js"
62
62
  },
63
63
  "tagName": "tagName",
64
64
  "customElement": true
package/dist/canvas.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DotLottiePlayerCanvas } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
2
- export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
1
+ import { D as DotLottiePlayerCanvas } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
2
+ export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
3
3
  import '@aarsteinmedia/lottie-web';
4
4
  import '@aarsteinmedia/lottie-web/utils';
5
5
  import './utilities.js';
package/dist/canvas.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  import { loadAnimation } from '@aarsteinmedia/lottie-web/canvas';
3
- import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase-Cjk0_f2y.js';
3
+ import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase-CREYTonO.js';
4
4
  import { t as tagName } from './chunks/utilities-CC4oA5Yh.js';
5
5
  import '@aarsteinmedia/lottie-web/dotlottie';
6
6
 
@@ -10,7 +10,7 @@ function loadControlsModule() {
10
10
 
11
11
  let modulePromise = null;
12
12
  function loadErrorModule() {
13
- modulePromise = modulePromise ?? import('./errorScreen-Do0IgwBv.js');
13
+ modulePromise = modulePromise ?? import('./errorScreen-Bq5V84Fj.js');
14
14
  return modulePromise;
15
15
  }
16
16
 
@@ -1210,7 +1210,6 @@ var controls = /*#__PURE__*/Object.freeze({
1210
1210
  if (name === '_isSettingsOpen' && typeof value === 'boolean' && elements.popover && elements.convert && elements.snapshot) {
1211
1211
  elements.popover.hidden = !value;
1212
1212
  elements.convert.hidden = !this.canConvert;
1213
- elements.snapshot.hidden = this.renderer !== RendererType.SVG;
1214
1213
  }
1215
1214
  }
1216
1215
  /**
@@ -1310,24 +1309,36 @@ var controls = /*#__PURE__*/Object.freeze({
1310
1309
  }
1311
1310
  /**
1312
1311
  * Snapshot and download the current frame as SVG.
1313
- */ snapshot(shouldDownload = true, name = 'AM Lottie') {
1312
+ */ async snapshot(shouldDownload = true, name = 'AM Lottie') {
1314
1313
  try {
1315
1314
  if (!this.shadowRoot || !this._lottieInstance) {
1316
1315
  throw new Error('Unknown error');
1317
1316
  }
1318
- // Get SVG element and serialize markup
1319
- const svgElement = this.shadowRoot.querySelector('.animation svg');
1320
- if (!svgElement) {
1317
+ let data = null;
1318
+ // Get animation element and handle markup
1319
+ const animationElement = this.shadowRoot.querySelector(`.animation ${this.renderer}`);
1320
+ if (!animationElement) {
1321
1321
  throw new Error('Could not retrieve animation from DOM');
1322
1322
  }
1323
- const data = svgElement instanceof Node ? new XMLSerializer().serializeToString(svgElement) : null;
1323
+ const isSVG = this.renderer === RendererType.SVG;
1324
+ if (isSVG) {
1325
+ data = animationElement instanceof Node ? new XMLSerializer().serializeToString(animationElement) : null;
1326
+ } else {
1327
+ const blob = await new Promise((resolve)=>{
1328
+ if (animationElement instanceof HTMLCanvasElement) {
1329
+ animationElement.toBlob(resolve, 'image/png');
1330
+ }
1331
+ });
1332
+ data = await blob?.arrayBuffer() ?? null;
1333
+ }
1324
1334
  if (!data) {
1325
1335
  throw new Error('Could not serialize SVG element');
1326
1336
  }
1337
+ const mimeType = isSVG ? 'image/svg+xml' : 'image/png', extension = isSVG ? 'svg' : 'png';
1327
1338
  if (shouldDownload) {
1328
1339
  download(data, {
1329
- mimeType: 'image/svg+xml',
1330
- name: `${getFilename(this.src || name)}-${frameOutput(this._seeker * this._lottieInstance.totalFrames / 100)}.svg`
1340
+ mimeType,
1341
+ name: `${getFilename(this.src || name)}-${frameOutput(this._seeker * this._lottieInstance.totalFrames / 100)}.${extension}`
1331
1342
  });
1332
1343
  }
1333
1344
  return data;
@@ -159,7 +159,7 @@ declare abstract class DotLottiePlayerBase extends ScrollElement {
159
159
  setSegment(segment: Vector2): void;
160
160
  setSpeed(value?: number): void;
161
161
  setSubframe(value: boolean): void;
162
- snapshot(shouldDownload?: boolean, name?: string): string | null;
162
+ snapshot(shouldDownload?: boolean, name?: string): Promise<string | ArrayBuffer | null>;
163
163
  stop(): void;
164
164
  toggleBoomerang(): void;
165
165
  toggleLoop(): void;
@@ -1,5 +1,5 @@
1
1
  import { PreserveAspectRatio, namespaceSVG } from '@aarsteinmedia/lottie-web/utils';
2
- import { e as escapeHTML } from './DotLottiePlayerBase-Cjk0_f2y.js';
2
+ import { e as escapeHTML } from './DotLottiePlayerBase-CREYTonO.js';
3
3
  import '@aarsteinmedia/lottie-web/dotlottie';
4
4
  import './utilities-CC4oA5Yh.js';
5
5
 
package/dist/full.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as DotLottiePlayer } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
2
- export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
1
+ import { b as DotLottiePlayer } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
2
+ export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
3
3
  import '@aarsteinmedia/lottie-web';
4
4
  import '@aarsteinmedia/lottie-web/utils';
5
5
  import './utilities.js';
package/dist/full.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  import { loadAnimation } from '@aarsteinmedia/lottie-web';
3
- import { D as DotLottiePlayerBase, l as loadDotLottieTools } from './chunks/DotLottiePlayerBase-Cjk0_f2y.js';
3
+ import { D as DotLottiePlayerBase, l as loadDotLottieTools } from './chunks/DotLottiePlayerBase-CREYTonO.js';
4
4
  import { t as tagName } from './chunks/utilities-CC4oA5Yh.js';
5
5
  import '@aarsteinmedia/lottie-web/dotlottie';
6
6
 
package/dist/light.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as DotLottiePlayerLight } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
2
- export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
1
+ import { c as DotLottiePlayerLight } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
2
+ export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
3
3
  import '@aarsteinmedia/lottie-web';
4
4
  import '@aarsteinmedia/lottie-web/utils';
5
5
  import './utilities.js';
package/dist/light.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  import { loadAnimation } from '@aarsteinmedia/lottie-web/light';
3
- import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase-Cjk0_f2y.js';
3
+ import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase-CREYTonO.js';
4
4
  import { t as tagName } from './chunks/utilities-CC4oA5Yh.js';
5
5
  import '@aarsteinmedia/lottie-web/dotlottie';
6
6
 
package/dist/svg.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { d as DotLottiePlayerSVG } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
2
- export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-Bgw-biRK.js';
1
+ import { d as DotLottiePlayerSVG } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
2
+ export { a as DotLottiePlayerBase } from './chunks/DotLottiePlayerCanvas.d-DRzu-rar.js';
3
3
  import '@aarsteinmedia/lottie-web';
4
4
  import '@aarsteinmedia/lottie-web/utils';
5
5
  import './utilities.js';
package/dist/svg.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RendererType, isServer } from '@aarsteinmedia/lottie-web/utils';
2
2
  import { loadAnimation } from '@aarsteinmedia/lottie-web/svg';
3
- import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase-Cjk0_f2y.js';
3
+ import { D as DotLottiePlayerBase } from './chunks/DotLottiePlayerBase-CREYTonO.js';
4
4
  import { t as tagName } from './chunks/utilities-CC4oA5Yh.js';
5
5
  import '@aarsteinmedia/lottie-web/dotlottie';
6
6