@aarsteinmedia/dotlottie-player 5.1.0 → 5.1.1

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.1] - 02-06-2025
11
+
12
+ ### Changed
13
+
14
+ - Added button to convert dotLottie to JSON. Helpful when debugging animations.
15
+
10
16
  ## [5.1.0] - 02-06-2025
11
17
 
12
18
  ### Changed
@@ -229,6 +235,8 @@ Changelog was only added since [3.2.3], so it's not exhaustive. [Please report a
229
235
  - Removed dependencies
230
236
  - `@lit`
231
237
 
238
+ [5.1.1]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.1.1
239
+ [5.1.0]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.1.0
232
240
  [5.0.4]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.0.4
233
241
  [5.0.3]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.0.3
234
242
  [5.0.1]: https://www.npmjs.com/package/@aarsteinmedia/dotlottie-player/v/5.0.1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnimationSettings, AnimationDirection, LottieManifest, AnimationData, AnimationItem, Vector2 } from '@aarsteinmedia/lottie-web';
1
+ import { AnimationSettings, AnimationData, LottieManifest, AnimationDirection, AnimationItem, Vector2 } from '@aarsteinmedia/lottie-web';
2
2
 
3
3
  interface Animation extends AnimationSettings {
4
4
  id: string;
@@ -6,6 +6,14 @@ interface Animation extends AnimationSettings {
6
6
  interface AnimationAttributes extends Animation {
7
7
  url: string;
8
8
  }
9
+ interface ConvertParams {
10
+ animations?: AnimationData[];
11
+ fileName?: string;
12
+ manifest?: LottieManifest;
13
+ shouldDownload?: boolean;
14
+ src?: string;
15
+ typeCheck?: boolean;
16
+ }
9
17
  type AnimateOnScroll = boolean | '' | null;
10
18
  type Autoplay = boolean | '' | 'autoplay' | null;
11
19
  type Controls = boolean | '' | 'controls' | null;
@@ -180,14 +188,7 @@ declare class DotLottiePlayer extends PropertyCallbackElement {
180
188
  }>;
181
189
  attributeChangedCallback(name: string, _oldValue: unknown, value: string): Promise<void>;
182
190
  connectedCallback(): Promise<void>;
183
- convert({ animations: animationsFromProps, fileName, manifest, shouldDownload, src: srcFromProps, typeCheck, }: {
184
- typeCheck?: boolean;
185
- manifest?: LottieManifest;
186
- animations?: AnimationData[];
187
- src?: string;
188
- fileName?: string;
189
- shouldDownload?: boolean;
190
- }): Promise<ArrayBuffer | null | undefined>;
191
+ convert({ animations: animationsFromProps, fileName, manifest, shouldDownload, src: srcFromProps, typeCheck, }: ConvertParams): Promise<ArrayBuffer | null | undefined>;
191
192
  destroy(): void;
192
193
  disconnectedCallback(): void;
193
194
  getLottie(): AnimationItem | null;
package/dist/index.js CHANGED
@@ -167,6 +167,10 @@ var css_248z = "* {\n box-sizing: border-box;\n}\n\n:host {\n --lottie-player-
167
167
  if (convert instanceof HTMLButtonElement) {
168
168
  convert.onclick = this.convert;
169
169
  }
170
+ // const convertJSON = this.shadow.querySelector('.convert-json')
171
+ // if (convertJSON instanceof HTMLButtonElement) {
172
+ // convertJSON.onclick = this.convertJSON as unknown as () => void
173
+ // }
170
174
  const snapshot = this.shadow.querySelector('.snapshot');
171
175
  if (snapshot instanceof HTMLButtonElement) {
172
176
  snapshot.onclick = ()=>this.snapshot(true);
@@ -1284,8 +1288,15 @@ const generator = '@aarsteinmedia/dotlottie-player';
1284
1288
  }
1285
1289
  if (name === '_isSettingsOpen' && typeof value === 'boolean' && popover instanceof HTMLDivElement && convert instanceof HTMLButtonElement && snapshot instanceof HTMLButtonElement) {
1286
1290
  popover.hidden = !value;
1287
- convert.hidden = this._isDotLottie;
1291
+ convert.hidden = false;
1288
1292
  snapshot.hidden = this.renderer !== RendererType.SVG;
1293
+ if (this._isDotLottie) {
1294
+ convert.ariaLabel = 'Convert dotLottie to JSON';
1295
+ convert.innerHTML = convert.innerHTML.replace('dotLottie', 'JSON');
1296
+ } else {
1297
+ convert.ariaLabel = 'Convert JSON animation to dotLottie format';
1298
+ convert.innerHTML = convert.innerHTML.replace('JSON', 'dotLottie');
1299
+ }
1289
1300
  }
1290
1301
  }
1291
1302
  /**