@lottiefiles/dotlottie-vue 0.9.7 → 0.10.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/dist/dotlottie.js CHANGED
@@ -22,7 +22,9 @@ var DotLottieVue = defineComponent({
22
22
  playOnHover: { type: Boolean, required: false },
23
23
  themeData: { type: String, required: false },
24
24
  themeId: { type: String, required: false },
25
- layout: { type: Object, required: false }
25
+ layout: { type: Object, required: false },
26
+ stateMachineId: { type: String, required: false },
27
+ stateMachineConfig: { type: Object, required: false }
26
28
  },
27
29
  setup(props, { attrs, expose }) {
28
30
  const canvas = ref(void 0);
@@ -39,6 +41,8 @@ var DotLottieVue = defineComponent({
39
41
  segment,
40
42
  speed,
41
43
  src,
44
+ stateMachineConfig,
45
+ stateMachineId,
42
46
  themeId,
43
47
  useFrameInterpolation
44
48
  } = toRefs(props);
@@ -67,6 +71,8 @@ var DotLottieVue = defineComponent({
67
71
  segment: segment?.value,
68
72
  speed: speed?.value,
69
73
  src: src?.value,
74
+ stateMachineConfig: stateMachineConfig?.value,
75
+ stateMachineId: stateMachineId?.value,
70
76
  themeId: themeId?.value,
71
77
  useFrameInterpolation: useFrameInterpolation?.value,
72
78
  ...config
@@ -215,6 +221,30 @@ var DotLottieVue = defineComponent({
215
221
  }
216
222
  }
217
223
  );
224
+ watch(
225
+ () => stateMachineId?.value,
226
+ (newVal) => {
227
+ if (dotLottie && dotLottie.isLoaded) {
228
+ if (typeof newVal === "string" && newVal) {
229
+ const smLoaded = dotLottie.stateMachineLoad(newVal);
230
+ if (smLoaded) {
231
+ dotLottie.stateMachineStart();
232
+ }
233
+ } else {
234
+ dotLottie.stateMachineStop();
235
+ }
236
+ }
237
+ }
238
+ );
239
+ watch(
240
+ () => stateMachineConfig?.value,
241
+ (newVal) => {
242
+ if (dotLottie) {
243
+ dotLottie.stateMachineSetConfig(newVal ?? null);
244
+ }
245
+ },
246
+ { deep: true }
247
+ );
218
248
  onMounted(() => {
219
249
  if (!canvas.value)
220
250
  return;
package/dist/index.js CHANGED
@@ -22,7 +22,9 @@ var DotLottieVue = defineComponent({
22
22
  playOnHover: { type: Boolean, required: false },
23
23
  themeData: { type: String, required: false },
24
24
  themeId: { type: String, required: false },
25
- layout: { type: Object, required: false }
25
+ layout: { type: Object, required: false },
26
+ stateMachineId: { type: String, required: false },
27
+ stateMachineConfig: { type: Object, required: false }
26
28
  },
27
29
  setup(props, { attrs, expose }) {
28
30
  const canvas = ref(void 0);
@@ -39,6 +41,8 @@ var DotLottieVue = defineComponent({
39
41
  segment,
40
42
  speed,
41
43
  src,
44
+ stateMachineConfig,
45
+ stateMachineId,
42
46
  themeId,
43
47
  useFrameInterpolation
44
48
  } = toRefs(props);
@@ -67,6 +71,8 @@ var DotLottieVue = defineComponent({
67
71
  segment: segment?.value,
68
72
  speed: speed?.value,
69
73
  src: src?.value,
74
+ stateMachineConfig: stateMachineConfig?.value,
75
+ stateMachineId: stateMachineId?.value,
70
76
  themeId: themeId?.value,
71
77
  useFrameInterpolation: useFrameInterpolation?.value,
72
78
  ...config
@@ -215,6 +221,30 @@ var DotLottieVue = defineComponent({
215
221
  }
216
222
  }
217
223
  );
224
+ watch(
225
+ () => stateMachineId?.value,
226
+ (newVal) => {
227
+ if (dotLottie && dotLottie.isLoaded) {
228
+ if (typeof newVal === "string" && newVal) {
229
+ const smLoaded = dotLottie.stateMachineLoad(newVal);
230
+ if (smLoaded) {
231
+ dotLottie.stateMachineStart();
232
+ }
233
+ } else {
234
+ dotLottie.stateMachineStop();
235
+ }
236
+ }
237
+ }
238
+ );
239
+ watch(
240
+ () => stateMachineConfig?.value,
241
+ (newVal) => {
242
+ if (dotLottie) {
243
+ dotLottie.stateMachineSetConfig(newVal ?? null);
244
+ }
245
+ },
246
+ { deep: true }
247
+ );
218
248
  onMounted(() => {
219
249
  if (!canvas.value)
220
250
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lottiefiles/dotlottie-vue",
3
- "version": "0.9.7",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Vue wrapper around the dotlottie-web library",
6
6
  "repository": {