@lottiefiles/dotlottie-svelte 0.5.3 → 0.6.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.
@@ -1,4 +1,4 @@
1
- <script>import { onMount } from "svelte";
1
+ <script lang="ts">import { onMount } from "svelte";
2
2
  import { DotLottie } from "@lottiefiles/dotlottie-web";
3
3
  export function setWasmUrl(url) {
4
4
  DotLottie.setWasmUrl(url);
@@ -15,15 +15,14 @@ export let src = void 0;
15
15
  export let useFrameInterpolation = true;
16
16
  export let marker = void 0;
17
17
  export let layout = void 0;
18
- export let playOnHover = false;
19
18
  export let animationId = "";
20
19
  export let themeId = "";
20
+ export let playOnHover = false;
21
21
  export let themeData = "";
22
22
  export let dotLottieRefCallback = () => {
23
23
  };
24
24
  const hoverHandler = (event) => {
25
- if (!playOnHover || !dotLottie.isLoaded)
26
- return;
25
+ if (!playOnHover || !dotLottie.isLoaded) return;
27
26
  if (event.type === "mouseenter") {
28
27
  dotLottie.play();
29
28
  } else if (event.type === "mouseleave") {
@@ -47,7 +46,9 @@ onMount(() => {
47
46
  segment,
48
47
  useFrameInterpolation,
49
48
  backgroundColor,
50
- mode
49
+ mode,
50
+ animationId,
51
+ themeId
51
52
  });
52
53
  if (dotLottieRefCallback) {
53
54
  dotLottieRefCallback(dotLottie);
@@ -101,54 +102,53 @@ $: {
101
102
  dotLottie.setMode(mode);
102
103
  }
103
104
  }
104
- $:
105
- if (dotLottie && src !== prevSrc) {
106
- dotLottie.load({
107
- src,
108
- autoplay,
109
- loop,
110
- speed,
111
- data,
112
- renderConfig,
113
- segment,
114
- useFrameInterpolation,
115
- backgroundColor,
116
- mode,
117
- marker,
118
- layout
119
- });
120
- prevSrc = src;
121
- }
122
- $:
123
- if (dotLottie && data !== prevData) {
124
- dotLottie.load({
125
- src,
126
- autoplay,
127
- loop,
128
- speed,
129
- data,
130
- renderConfig,
131
- segment,
132
- useFrameInterpolation,
133
- backgroundColor,
134
- mode,
135
- marker,
136
- layout
137
- });
138
- prevData = data;
139
- }
140
- $:
141
- if (dotLottie && dotLottie.isLoaded && dotLottie.activeAnimationId !== animationId) {
142
- dotLottie.loadAnimation(animationId);
143
- }
144
- $:
145
- if (dotLottie && dotLottie.isLoaded && dotLottie.activeThemeId !== themeId) {
146
- dotLottie.setTheme(themeId);
147
- }
148
- $:
149
- if (dotLottie && dotLottie.isLoaded) {
150
- dotLottie.setThemeData(themeData);
151
- }
105
+ $: if (dotLottie && src !== prevSrc) {
106
+ dotLottie.load({
107
+ src,
108
+ autoplay,
109
+ loop,
110
+ speed,
111
+ data,
112
+ renderConfig,
113
+ segment,
114
+ useFrameInterpolation,
115
+ backgroundColor,
116
+ mode,
117
+ marker,
118
+ layout,
119
+ animationId,
120
+ themeId
121
+ });
122
+ prevSrc = src;
123
+ }
124
+ $: if (dotLottie && data !== prevData) {
125
+ dotLottie.load({
126
+ src,
127
+ autoplay,
128
+ loop,
129
+ speed,
130
+ data,
131
+ renderConfig,
132
+ segment,
133
+ useFrameInterpolation,
134
+ backgroundColor,
135
+ mode,
136
+ marker,
137
+ layout,
138
+ animationId,
139
+ themeId
140
+ });
141
+ prevData = data;
142
+ }
143
+ $: if (dotLottie && dotLottie.isLoaded && dotLottie.activeAnimationId !== animationId) {
144
+ dotLottie.loadAnimation(animationId);
145
+ }
146
+ $: if (dotLottie && dotLottie.isLoaded && dotLottie.activeThemeId !== themeId) {
147
+ dotLottie.setTheme(themeId);
148
+ }
149
+ $: if (dotLottie && dotLottie.isLoaded) {
150
+ dotLottie.setThemeData(themeData);
151
+ }
152
152
  </script>
153
153
 
154
154
  <div>
@@ -1,35 +1,40 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { DotLottie, type Config } from '@lottiefiles/dotlottie-web';
3
- declare const __propDef: {
4
- props: {
5
- setWasmUrl?: ((url: string) => void) | undefined;
6
- autoplay?: Config['autoplay'];
7
- backgroundColor?: Config['backgroundColor'];
8
- data?: Config['data'];
9
- loop?: Config['loop'];
10
- mode?: Config['mode'];
11
- renderConfig?: Config['renderConfig'];
12
- segment?: Config['segment'];
13
- speed?: Config['speed'];
14
- src?: Config['src'];
15
- useFrameInterpolation?: Config['useFrameInterpolation'];
16
- marker?: Config['marker'];
17
- layout?: Config['layout'];
18
- playOnHover?: boolean | undefined;
19
- animationId?: string | undefined;
20
- themeId?: string | undefined;
21
- themeData?: string | undefined;
22
- dotLottieRefCallback?: ((dotLottie: DotLottie) => void) | undefined;
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
23
12
  };
24
- events: {
25
- [evt: string]: CustomEvent<any>;
26
- };
27
- slots: {};
28
- };
29
- export type DotlottieProps = typeof __propDef.props;
30
- export type DotlottieEvents = typeof __propDef.events;
31
- export type DotlottieSlots = typeof __propDef.slots;
32
- export default class Dotlottie extends SvelteComponent<DotlottieProps, DotlottieEvents, DotlottieSlots> {
33
- get setWasmUrl(): (url: string) => void;
13
+ z_$$bindings?: Bindings;
34
14
  }
35
- export {};
15
+ declare const Dotlottie: $$__sveltets_2_IsomorphicComponent<{
16
+ setWasmUrl?: (url: string) => void;
17
+ autoplay?: Config["autoplay"];
18
+ backgroundColor?: Config["backgroundColor"];
19
+ data?: Config["data"];
20
+ loop?: Config["loop"];
21
+ mode?: Config["mode"];
22
+ renderConfig?: Config["renderConfig"];
23
+ segment?: Config["segment"];
24
+ speed?: Config["speed"];
25
+ src?: Config["src"];
26
+ useFrameInterpolation?: Config["useFrameInterpolation"];
27
+ marker?: Config["marker"];
28
+ layout?: Config["layout"];
29
+ animationId?: Config["animationId"];
30
+ themeId?: Config["themeId"];
31
+ playOnHover?: boolean;
32
+ themeData?: string;
33
+ dotLottieRefCallback?: (dotLottie: DotLottie) => void;
34
+ }, {
35
+ [evt: string]: CustomEvent<any>;
36
+ }, {}, {
37
+ setWasmUrl: (url: string) => void;
38
+ }, string>;
39
+ type Dotlottie = InstanceType<typeof Dotlottie>;
40
+ export default Dotlottie;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lottiefiles/dotlottie-svelte",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Svelte component wrapper around the dotlottie-web library to render Lottie and dotLottie animations",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "svelte": "^4.0.0"
34
34
  },
35
35
  "dependencies": {
36
- "@lottiefiles/dotlottie-web": "0.44.0"
36
+ "@lottiefiles/dotlottie-web": "0.45.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@sveltejs/adapter-auto": "^3.0.0",