@pixodesk/svg-animator-vue 1.0.34 → 1.0.39

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/index.d.cts CHANGED
@@ -1,25 +1,12 @@
1
1
  import * as vue from 'vue';
2
2
  import { PropType, VNode } from 'vue';
3
- import { PxAnimatedSvgDocument, FillMode, StartOn, OutAction } from '@pixodesk/svg-animator-web';
3
+ import { PxAnimatedSvgDocument, PxTimelinePatch, PxDiagnostic, PxDiagnosticKind, PxAnimatorHandle, PxStartOn, PxOutAction } from '@pixodesk/svg-animator-web';
4
4
 
5
- interface VueAnimatorApi {
6
- /** Returns true if the animation is currently running. */
7
- isPlaying(): boolean;
8
- /** Starts or resumes the animation. */
9
- play(): void;
10
- /** Pauses the animation at its current state. */
11
- pause(): void;
12
- /** Stops the animation and resets it to its initial state. */
13
- cancel(): void;
14
- /** Jumps to the end of the animation and holds the final state. */
15
- finish(): void;
16
- /** Changes the speed of the animation. 1 is normal, 2 is double, -1 is reverse. */
17
- setPlaybackRate(rate: number): void;
18
- /** Returns the current playback time in milliseconds. */
19
- getCurrentTime(): number | null;
20
- /** Jumps to a specific time (in milliseconds) in the animation. */
21
- setCurrentTime(time: number): void;
22
- }
5
+ /**
6
+ * The imperative handle the template ref exposes — core's `PxAnimatorHandle` under this
7
+ * package's name (review §9). One definition for React, Vue and React Native.
8
+ */
9
+ type VueAnimatorApi = PxAnimatorHandle;
23
10
  /**
24
11
  * Vue component for rendering and controlling Pixodesk SVG animations.
25
12
  *
@@ -52,36 +39,25 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
52
39
  type: PropType<PxAnimatedSvgDocument>;
53
40
  required: true;
54
41
  };
55
- mode: {
56
- type: PropType<"waapi" | "frames" | "auto">;
57
- };
58
- delay: {
59
- type: NumberConstructor;
60
- };
61
- fill: {
62
- type: PropType<FillMode>;
42
+ timeline: {
43
+ type: PropType<PxTimelinePatch | string>;
63
44
  };
64
- iterations: {
65
- type: PropType<number | "infinite">;
45
+ resetTimeline: {
46
+ type: BooleanConstructor;
47
+ default: undefined;
66
48
  };
67
49
  duration: {
68
50
  type: NumberConstructor;
69
51
  };
70
- direction: {
71
- type: PropType<PlaybackDirection>;
72
- };
73
- frameRate: {
52
+ delay: {
74
53
  type: NumberConstructor;
75
54
  };
55
+ iterations: {
56
+ type: PropType<number | "infinite">;
57
+ };
76
58
  startOn: {
77
59
  type: PropType<"load" | "mouseOver" | "click" | "scrollIntoView" | "programmatic">;
78
60
  };
79
- outAction: {
80
- type: PropType<"continue" | "pause" | "reset" | "reverse">;
81
- };
82
- scrollIntoViewThreshold: {
83
- type: NumberConstructor;
84
- };
85
61
  autoplay: {
86
62
  type: BooleanConstructor;
87
63
  default: undefined;
@@ -100,43 +76,42 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
100
76
  time: {
101
77
  type: NumberConstructor;
102
78
  };
79
+ onWarn: {
80
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
81
+ };
82
+ onError: {
83
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
84
+ };
85
+ silent: {
86
+ type: PropType<boolean | ReadonlyArray<PxDiagnosticKind>>;
87
+ default: undefined;
88
+ };
103
89
  }>, () => VNode<vue.RendererNode, vue.RendererElement, {
104
90
  [key: string]: any;
105
- }> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("play" | "pause" | "stop" | "cancel" | "finish" | "remove")[], "play" | "pause" | "stop" | "cancel" | "finish" | "remove", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
91
+ }> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("finish" | "play" | "pause" | "cancel" | "stop" | "remove")[], "finish" | "play" | "pause" | "cancel" | "stop" | "remove", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
106
92
  doc: {
107
93
  type: PropType<PxAnimatedSvgDocument>;
108
94
  required: true;
109
95
  };
110
- mode: {
111
- type: PropType<"waapi" | "frames" | "auto">;
96
+ timeline: {
97
+ type: PropType<PxTimelinePatch | string>;
112
98
  };
113
- delay: {
114
- type: NumberConstructor;
115
- };
116
- fill: {
117
- type: PropType<FillMode>;
118
- };
119
- iterations: {
120
- type: PropType<number | "infinite">;
99
+ resetTimeline: {
100
+ type: BooleanConstructor;
101
+ default: undefined;
121
102
  };
122
103
  duration: {
123
104
  type: NumberConstructor;
124
105
  };
125
- direction: {
126
- type: PropType<PlaybackDirection>;
127
- };
128
- frameRate: {
106
+ delay: {
129
107
  type: NumberConstructor;
130
108
  };
109
+ iterations: {
110
+ type: PropType<number | "infinite">;
111
+ };
131
112
  startOn: {
132
113
  type: PropType<"load" | "mouseOver" | "click" | "scrollIntoView" | "programmatic">;
133
114
  };
134
- outAction: {
135
- type: PropType<"continue" | "pause" | "reset" | "reverse">;
136
- };
137
- scrollIntoViewThreshold: {
138
- type: NumberConstructor;
139
- };
140
115
  autoplay: {
141
116
  type: BooleanConstructor;
142
117
  default: undefined;
@@ -155,17 +130,29 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
155
130
  time: {
156
131
  type: NumberConstructor;
157
132
  };
133
+ onWarn: {
134
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
135
+ };
136
+ onError: {
137
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
138
+ };
139
+ silent: {
140
+ type: PropType<boolean | ReadonlyArray<PxDiagnosticKind>>;
141
+ default: undefined;
142
+ };
158
143
  }>> & Readonly<{
144
+ onFinish?: ((...args: any[]) => any) | undefined;
159
145
  onPlay?: ((...args: any[]) => any) | undefined;
160
146
  onPause?: ((...args: any[]) => any) | undefined;
161
- onStop?: ((...args: any[]) => any) | undefined;
162
147
  onCancel?: ((...args: any[]) => any) | undefined;
163
- onFinish?: ((...args: any[]) => any) | undefined;
148
+ onStop?: ((...args: any[]) => any) | undefined;
164
149
  onRemove?: ((...args: any[]) => any) | undefined;
165
150
  }>, {
166
- autoplay: boolean;
167
151
  play: boolean;
168
152
  pause: boolean;
153
+ autoplay: boolean;
154
+ resetTimeline: boolean;
155
+ silent: boolean | readonly PxDiagnosticKind[];
169
156
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
170
157
 
171
158
  /**
@@ -197,34 +184,53 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
197
184
  * - `'mouseOver'` — plays on hover
198
185
  * - `'click'` — plays on click, toggles on second click
199
186
  * - `'scrollIntoView'` — plays when the element enters the viewport
187
+ * - `'programmatic'` — **not supported here.** This wrapper exposes no `play()`, so there is
188
+ * nothing to wait for and the animation never starts. The prop keeps the
189
+ * shared `PxStartOn` type (one enum per wire key), so the value type-checks
190
+ * — it simply has no effect. Use `PixodeskSvgAnimator` (the JSON player)
191
+ * when you need to start an animation from code.
200
192
  * @prop outAction - What happens when the trigger ends (hover/scroll out, second click):
201
193
  * - `'continue'` — keeps playing (default)
202
194
  * - `'pause'` — pauses at the current frame
203
195
  * - `'reset'` — resets to the beginning
196
+ * - `'reverse'` — **acts as `'continue'` here.** A CSS class toggle cannot run keyframes
197
+ * backwards. Accepted so the prop keeps the shared `PxOutAction` type.
198
+ * @prop scrollIntoViewThreshold - For `'scrollIntoView'`: how much of the element must be
199
+ * visible (0–1) before it starts, and below which the out action applies. Defaults to the
200
+ * wire default (`0`, any pixel) — the same as the JSON player, not a private `0.1`.
204
201
  */
205
202
  declare const PixodeskSvgCssAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
206
203
  startOn: {
207
- type: PropType<StartOn>;
204
+ type: PropType<PxStartOn>;
208
205
  default: string;
209
206
  };
210
207
  outAction: {
211
- type: PropType<OutAction>;
208
+ type: PropType<PxOutAction>;
212
209
  default: string;
213
210
  };
211
+ scrollIntoViewThreshold: {
212
+ type: NumberConstructor;
213
+ default: 0;
214
+ };
214
215
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
215
216
  [key: string]: any;
216
217
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
217
218
  startOn: {
218
- type: PropType<StartOn>;
219
+ type: PropType<PxStartOn>;
219
220
  default: string;
220
221
  };
221
222
  outAction: {
222
- type: PropType<OutAction>;
223
+ type: PropType<PxOutAction>;
223
224
  default: string;
224
225
  };
226
+ scrollIntoViewThreshold: {
227
+ type: NumberConstructor;
228
+ default: 0;
229
+ };
225
230
  }>> & Readonly<{}>, {
226
- startOn: StartOn;
227
- outAction: OutAction;
231
+ startOn: PxStartOn;
232
+ outAction: PxOutAction;
233
+ scrollIntoViewThreshold: number;
228
234
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
229
235
 
230
236
  export { PixodeskSvgAnimator, PixodeskSvgCssAnimator, type VueAnimatorApi };
package/dist/index.d.ts CHANGED
@@ -1,25 +1,12 @@
1
1
  import * as vue from 'vue';
2
2
  import { PropType, VNode } from 'vue';
3
- import { PxAnimatedSvgDocument, FillMode, StartOn, OutAction } from '@pixodesk/svg-animator-web';
3
+ import { PxAnimatedSvgDocument, PxTimelinePatch, PxDiagnostic, PxDiagnosticKind, PxAnimatorHandle, PxStartOn, PxOutAction } from '@pixodesk/svg-animator-web';
4
4
 
5
- interface VueAnimatorApi {
6
- /** Returns true if the animation is currently running. */
7
- isPlaying(): boolean;
8
- /** Starts or resumes the animation. */
9
- play(): void;
10
- /** Pauses the animation at its current state. */
11
- pause(): void;
12
- /** Stops the animation and resets it to its initial state. */
13
- cancel(): void;
14
- /** Jumps to the end of the animation and holds the final state. */
15
- finish(): void;
16
- /** Changes the speed of the animation. 1 is normal, 2 is double, -1 is reverse. */
17
- setPlaybackRate(rate: number): void;
18
- /** Returns the current playback time in milliseconds. */
19
- getCurrentTime(): number | null;
20
- /** Jumps to a specific time (in milliseconds) in the animation. */
21
- setCurrentTime(time: number): void;
22
- }
5
+ /**
6
+ * The imperative handle the template ref exposes — core's `PxAnimatorHandle` under this
7
+ * package's name (review §9). One definition for React, Vue and React Native.
8
+ */
9
+ type VueAnimatorApi = PxAnimatorHandle;
23
10
  /**
24
11
  * Vue component for rendering and controlling Pixodesk SVG animations.
25
12
  *
@@ -52,36 +39,25 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
52
39
  type: PropType<PxAnimatedSvgDocument>;
53
40
  required: true;
54
41
  };
55
- mode: {
56
- type: PropType<"waapi" | "frames" | "auto">;
57
- };
58
- delay: {
59
- type: NumberConstructor;
60
- };
61
- fill: {
62
- type: PropType<FillMode>;
42
+ timeline: {
43
+ type: PropType<PxTimelinePatch | string>;
63
44
  };
64
- iterations: {
65
- type: PropType<number | "infinite">;
45
+ resetTimeline: {
46
+ type: BooleanConstructor;
47
+ default: undefined;
66
48
  };
67
49
  duration: {
68
50
  type: NumberConstructor;
69
51
  };
70
- direction: {
71
- type: PropType<PlaybackDirection>;
72
- };
73
- frameRate: {
52
+ delay: {
74
53
  type: NumberConstructor;
75
54
  };
55
+ iterations: {
56
+ type: PropType<number | "infinite">;
57
+ };
76
58
  startOn: {
77
59
  type: PropType<"load" | "mouseOver" | "click" | "scrollIntoView" | "programmatic">;
78
60
  };
79
- outAction: {
80
- type: PropType<"continue" | "pause" | "reset" | "reverse">;
81
- };
82
- scrollIntoViewThreshold: {
83
- type: NumberConstructor;
84
- };
85
61
  autoplay: {
86
62
  type: BooleanConstructor;
87
63
  default: undefined;
@@ -100,43 +76,42 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
100
76
  time: {
101
77
  type: NumberConstructor;
102
78
  };
79
+ onWarn: {
80
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
81
+ };
82
+ onError: {
83
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
84
+ };
85
+ silent: {
86
+ type: PropType<boolean | ReadonlyArray<PxDiagnosticKind>>;
87
+ default: undefined;
88
+ };
103
89
  }>, () => VNode<vue.RendererNode, vue.RendererElement, {
104
90
  [key: string]: any;
105
- }> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("play" | "pause" | "stop" | "cancel" | "finish" | "remove")[], "play" | "pause" | "stop" | "cancel" | "finish" | "remove", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
91
+ }> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("finish" | "play" | "pause" | "cancel" | "stop" | "remove")[], "finish" | "play" | "pause" | "cancel" | "stop" | "remove", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
106
92
  doc: {
107
93
  type: PropType<PxAnimatedSvgDocument>;
108
94
  required: true;
109
95
  };
110
- mode: {
111
- type: PropType<"waapi" | "frames" | "auto">;
96
+ timeline: {
97
+ type: PropType<PxTimelinePatch | string>;
112
98
  };
113
- delay: {
114
- type: NumberConstructor;
115
- };
116
- fill: {
117
- type: PropType<FillMode>;
118
- };
119
- iterations: {
120
- type: PropType<number | "infinite">;
99
+ resetTimeline: {
100
+ type: BooleanConstructor;
101
+ default: undefined;
121
102
  };
122
103
  duration: {
123
104
  type: NumberConstructor;
124
105
  };
125
- direction: {
126
- type: PropType<PlaybackDirection>;
127
- };
128
- frameRate: {
106
+ delay: {
129
107
  type: NumberConstructor;
130
108
  };
109
+ iterations: {
110
+ type: PropType<number | "infinite">;
111
+ };
131
112
  startOn: {
132
113
  type: PropType<"load" | "mouseOver" | "click" | "scrollIntoView" | "programmatic">;
133
114
  };
134
- outAction: {
135
- type: PropType<"continue" | "pause" | "reset" | "reverse">;
136
- };
137
- scrollIntoViewThreshold: {
138
- type: NumberConstructor;
139
- };
140
115
  autoplay: {
141
116
  type: BooleanConstructor;
142
117
  default: undefined;
@@ -155,17 +130,29 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
155
130
  time: {
156
131
  type: NumberConstructor;
157
132
  };
133
+ onWarn: {
134
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
135
+ };
136
+ onError: {
137
+ type: PropType<(diagnostic: PxDiagnostic) => void>;
138
+ };
139
+ silent: {
140
+ type: PropType<boolean | ReadonlyArray<PxDiagnosticKind>>;
141
+ default: undefined;
142
+ };
158
143
  }>> & Readonly<{
144
+ onFinish?: ((...args: any[]) => any) | undefined;
159
145
  onPlay?: ((...args: any[]) => any) | undefined;
160
146
  onPause?: ((...args: any[]) => any) | undefined;
161
- onStop?: ((...args: any[]) => any) | undefined;
162
147
  onCancel?: ((...args: any[]) => any) | undefined;
163
- onFinish?: ((...args: any[]) => any) | undefined;
148
+ onStop?: ((...args: any[]) => any) | undefined;
164
149
  onRemove?: ((...args: any[]) => any) | undefined;
165
150
  }>, {
166
- autoplay: boolean;
167
151
  play: boolean;
168
152
  pause: boolean;
153
+ autoplay: boolean;
154
+ resetTimeline: boolean;
155
+ silent: boolean | readonly PxDiagnosticKind[];
169
156
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
170
157
 
171
158
  /**
@@ -197,34 +184,53 @@ declare const PixodeskSvgAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
197
184
  * - `'mouseOver'` — plays on hover
198
185
  * - `'click'` — plays on click, toggles on second click
199
186
  * - `'scrollIntoView'` — plays when the element enters the viewport
187
+ * - `'programmatic'` — **not supported here.** This wrapper exposes no `play()`, so there is
188
+ * nothing to wait for and the animation never starts. The prop keeps the
189
+ * shared `PxStartOn` type (one enum per wire key), so the value type-checks
190
+ * — it simply has no effect. Use `PixodeskSvgAnimator` (the JSON player)
191
+ * when you need to start an animation from code.
200
192
  * @prop outAction - What happens when the trigger ends (hover/scroll out, second click):
201
193
  * - `'continue'` — keeps playing (default)
202
194
  * - `'pause'` — pauses at the current frame
203
195
  * - `'reset'` — resets to the beginning
196
+ * - `'reverse'` — **acts as `'continue'` here.** A CSS class toggle cannot run keyframes
197
+ * backwards. Accepted so the prop keeps the shared `PxOutAction` type.
198
+ * @prop scrollIntoViewThreshold - For `'scrollIntoView'`: how much of the element must be
199
+ * visible (0–1) before it starts, and below which the out action applies. Defaults to the
200
+ * wire default (`0`, any pixel) — the same as the JSON player, not a private `0.1`.
204
201
  */
205
202
  declare const PixodeskSvgCssAnimator: vue.DefineComponent<vue.ExtractPropTypes<{
206
203
  startOn: {
207
- type: PropType<StartOn>;
204
+ type: PropType<PxStartOn>;
208
205
  default: string;
209
206
  };
210
207
  outAction: {
211
- type: PropType<OutAction>;
208
+ type: PropType<PxOutAction>;
212
209
  default: string;
213
210
  };
211
+ scrollIntoViewThreshold: {
212
+ type: NumberConstructor;
213
+ default: 0;
214
+ };
214
215
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
215
216
  [key: string]: any;
216
217
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
217
218
  startOn: {
218
- type: PropType<StartOn>;
219
+ type: PropType<PxStartOn>;
219
220
  default: string;
220
221
  };
221
222
  outAction: {
222
- type: PropType<OutAction>;
223
+ type: PropType<PxOutAction>;
223
224
  default: string;
224
225
  };
226
+ scrollIntoViewThreshold: {
227
+ type: NumberConstructor;
228
+ default: 0;
229
+ };
225
230
  }>> & Readonly<{}>, {
226
- startOn: StartOn;
227
- outAction: OutAction;
231
+ startOn: PxStartOn;
232
+ outAction: PxOutAction;
233
+ scrollIntoViewThreshold: number;
228
234
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
229
235
 
230
236
  export { PixodeskSvgAnimator, PixodeskSvgCssAnimator, type VueAnimatorApi };