@aarsteinmedia/dotlottie-player 6.0.4 → 6.1.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/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ 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
+ ## [6.1.0] - 13-10-2025
11
+
12
+ ### Changed
13
+
14
+ - Added attributes:
15
+ - `delay` – Delay playback on playOnVisible, in miliseconds
16
+ - `mouseout` – Action on mouseout
17
+ - `once` – Whether, if playOnVisible is true, to play once or anytime animation is in view
18
+ - `playOnClick` – Whether to toggle play on click
19
+ - `playOnVisible` – Play when visible
20
+
21
+ ## [6.0.5] - 12-09-2025
22
+
23
+ ### Changed
24
+
25
+ - Fixed unwanted behavior with animateOnScroll.
26
+
10
27
  ## [6.0.3] - 13-08-2025
11
28
 
12
29
  ### Changed
package/README.md CHANGED
@@ -306,12 +306,19 @@ export default defineNuxtPlugin(({ vueApp }) => {
306
306
  | `background` | Background color | `string` | `undefined` |
307
307
  | `controls` | Show controls | `boolean` | `false` |
308
308
  | `count` | Number of times to loop animation | `number` | `undefined` |
309
+ | `delay` | Delay playback on playOnVisible, in miliseconds | `number` | `0` |
310
+ | `description` | Description for screen readers | `string` | `undefined` |
309
311
  | `direction` | Direction of animation | `1` \| `-1` | `1` |
310
312
  | `dontFreezeOnBlur` | Whether to freeze playback on window blur. This is default behavior, but can be disabled | `boolean` | `1` |
311
313
  | `hover` | Whether to play on mouse hover | `boolean` | `false` |
314
+ | `intermission` | Pause between loop intrations, in miliseconds | `number` | `0` |
312
315
  | `loop` | Whether to loop animation | `boolean` | `false` |
313
316
  | `mode` | Play mode | `normal` \| `bounce` | `normal` |
317
+ | `mouseout` | Action on mouseout | `void` \| `stop` \| `pause` \| `reverse` | `stop` |
314
318
  | `objectfit` | Resizing of animation in container | `contain` \| `cover` \| `fill` \| `none` | `contain` |
319
+ | `once` | Whether, if playOnVisible is true, to play once or anytime animation is in view | `boolean` | `false` |
320
+ | `playOnClick` | Whether to toggle play on click | `boolean` | `false` |
321
+ | `playOnVisible` | Play when visible | `boolean` | `false` |
315
322
  | `renderer` | Renderer to use | `svg` \| `canvas` \| `html` | `svg` |
316
323
  | `speed` | Animation speed | `number` | `1` |
317
324
  | `src` _(required)_ | URL to LottieJSON or dotLottie | `string` | `undefined` |
@@ -0,0 +1,277 @@
1
+ import { RendererType, PreserveAspectRatio, PlayMode } from '@aarsteinmedia/lottie-web/utils';
2
+ export { PlayMode, PlayerEvents } from '@aarsteinmedia/lottie-web/utils';
3
+ import * as _aarsteinmedia_lottie_web_canvas from '@aarsteinmedia/lottie-web/canvas';
4
+ import * as _aarsteinmedia_lottie_web from '@aarsteinmedia/lottie-web';
5
+ import { Vector2, AnimationConfiguration, AnimationData, AnimationDirection, AddAnimationParams, Result, ConvertParams, AnimationItem, LottieManifest, AnimationSettings } from '@aarsteinmedia/lottie-web';
6
+ import { addAnimation, convert } from '@aarsteinmedia/lottie-web/dotlottie';
7
+ import * as _aarsteinmedia_lottie_web_light from '@aarsteinmedia/lottie-web/light';
8
+ import * as _aarsteinmedia_lottie_web_svg from '@aarsteinmedia/lottie-web/svg';
9
+
10
+ declare class DotLottiePlayer extends DotLottiePlayerBase {
11
+ addAnimation: typeof addAnimation;
12
+ convert: typeof convert;
13
+ loadAnimation: typeof _aarsteinmedia_lottie_web.loadAnimation;
14
+ protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, rendererType }: {
15
+ container?: HTMLElement;
16
+ rendererType: RendererType;
17
+ initialSegment?: Vector2;
18
+ hasAutoplay: boolean;
19
+ hasLoop: boolean;
20
+ preserveAspectRatio: PreserveAspectRatio;
21
+ }): AnimationConfiguration<RendererType>;
22
+ }
23
+
24
+ declare class DotLottiePlayerLight extends DotLottiePlayerBase {
25
+ loadAnimation: typeof _aarsteinmedia_lottie_web_light.loadAnimation;
26
+ get renderer(): RendererType;
27
+ constructor();
28
+ protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, }: {
29
+ container?: HTMLElement;
30
+ rendererType: RendererType;
31
+ initialSegment?: Vector2;
32
+ hasAutoplay: boolean;
33
+ hasLoop: boolean;
34
+ preserveAspectRatio: PreserveAspectRatio;
35
+ }): AnimationConfiguration<RendererType.SVG>;
36
+ }
37
+
38
+ declare enum PlayerState {
39
+ Completed = "completed",
40
+ Destroyed = "destroyed",
41
+ Error = "error",
42
+ Frozen = "frozen",
43
+ Loading = "loading",
44
+ Paused = "paused",
45
+ Playing = "playing",
46
+ Stopped = "stopped"
47
+ }
48
+ declare const tagName = "dotlottie-player";
49
+
50
+ declare class DotLottiePlayerSVG extends DotLottiePlayerBase {
51
+ loadAnimation: typeof _aarsteinmedia_lottie_web_svg.loadAnimation;
52
+ get renderer(): RendererType;
53
+ constructor();
54
+ protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, }: {
55
+ container?: HTMLElement;
56
+ rendererType: RendererType;
57
+ initialSegment?: Vector2;
58
+ hasAutoplay: boolean;
59
+ hasLoop: boolean;
60
+ preserveAspectRatio: PreserveAspectRatio;
61
+ }): AnimationConfiguration<RendererType.SVG>;
62
+ }
63
+
64
+ type AnimateOnScroll = boolean | '' | null;
65
+ type Autoplay = boolean | '' | 'autoplay' | null;
66
+ type Controls = boolean | '' | 'controls' | null;
67
+ type Loop = boolean | '' | 'loop' | null;
68
+ type Subframe = boolean | '' | null;
69
+ declare global {
70
+ interface HTMLElementTagNameMap {
71
+ [tagName]: DotLottiePlayer | DotLottiePlayerLight;
72
+ }
73
+ function dotLottiePlayer(): DotLottiePlayer | DotLottiePlayerLight | DotLottiePlayerSVG | DotLottiePlayerCanvas;
74
+ }
75
+ type JSXLottiePlayer = Omit<Partial<DotLottiePlayer | DotLottiePlayerLight>, 'style'> & {
76
+ class?: string;
77
+ ref?: React.RefObject<unknown>;
78
+ style?: React.CSSProperties;
79
+ src: string;
80
+ };
81
+ declare module 'react' {
82
+ namespace JSX {
83
+ interface IntrinsicElements {
84
+ [tagName]: JSXLottiePlayer;
85
+ }
86
+ }
87
+ }
88
+ declare module 'react/jsx-runtime' {
89
+ namespace JSX {
90
+ interface IntrinsicElements {
91
+ [tagName]: JSXLottiePlayer;
92
+ }
93
+ }
94
+ }
95
+ declare module 'react/jsx-dev-runtime' {
96
+ namespace JSX {
97
+ interface IntrinsicElements {
98
+ [tagName]: JSXLottiePlayer;
99
+ }
100
+ }
101
+ }
102
+
103
+ declare abstract class PropertyCallbackElement extends HTMLElement {
104
+ constructor();
105
+ connectedCallback(): void;
106
+ propertyChangedCallback(_name: string, _oldValue: unknown, _value: unknown): void;
107
+ }
108
+
109
+ declare function renderControls(this: DotLottiePlayerBase): void;
110
+
111
+ declare function renderPlayer(this: DotLottiePlayerBase): Promise<void>;
112
+
113
+ declare abstract class DotLottiePlayerBase extends PropertyCallbackElement {
114
+ static get observedAttributes(): readonly ["animateOnScroll", "autoplay", "controls", "direction", "hover", "loop", "mode", "playOnClick", "playOnVisible", "speed", "src", "subframe"];
115
+ static get observedProperties(): string[];
116
+ static get styles(): () => Promise<CSSStyleSheet>;
117
+ isLight: boolean;
118
+ playerState: PlayerState;
119
+ shadow: ShadowRoot | undefined;
120
+ source?: string;
121
+ template?: HTMLTemplateElement;
122
+ set animateOnScroll(value: AnimateOnScroll);
123
+ get animateOnScroll(): AnimateOnScroll;
124
+ get animations(): AnimationData[];
125
+ set autoplay(value: Autoplay);
126
+ get autoplay(): Autoplay;
127
+ set background(value: string);
128
+ get background(): string;
129
+ set controls(value: Controls);
130
+ get controls(): Controls;
131
+ set count(value: number);
132
+ get count(): number;
133
+ get currentAnimation(): number;
134
+ set delay(value: number);
135
+ get delay(): number;
136
+ set description(value: string | null);
137
+ get description(): string | null;
138
+ set direction(value: AnimationDirection);
139
+ get direction(): AnimationDirection;
140
+ set dontFreezeOnBlur(value: boolean);
141
+ get dontFreezeOnBlur(): boolean;
142
+ set hover(value: boolean);
143
+ get hover(): boolean;
144
+ set intermission(value: number);
145
+ get intermission(): number;
146
+ get isDotLottie(): boolean;
147
+ set loop(value: Loop);
148
+ get loop(): Loop;
149
+ set mode(value: PlayMode);
150
+ get mode(): PlayMode;
151
+ set mouseout(value: 'void' | 'stop' | 'pause' | 'reverse');
152
+ get mouseout(): "void" | "stop" | "pause" | "reverse";
153
+ set objectfit(value: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down');
154
+ get objectfit(): "contain" | "cover" | "fill" | "none" | "scale-down";
155
+ set once(value: boolean);
156
+ get once(): boolean;
157
+ set playOnClick(value: boolean);
158
+ get playOnClick(): boolean;
159
+ set playOnVisible(value: boolean);
160
+ get playOnVisible(): boolean;
161
+ set preserveAspectRatio(value: PreserveAspectRatio | null);
162
+ get preserveAspectRatio(): PreserveAspectRatio | null;
163
+ set renderer(value: RendererType);
164
+ get renderer(): RendererType;
165
+ set simple(value: boolean);
166
+ get simple(): boolean;
167
+ set speed(value: number);
168
+ get speed(): number;
169
+ set src(value: string | null);
170
+ get src(): string | null;
171
+ set subframe(value: Subframe);
172
+ get subframe(): Subframe;
173
+ protected _container: HTMLElement | null;
174
+ protected _errorMessage: string;
175
+ protected _identifier: string;
176
+ protected _isSettingsOpen: boolean;
177
+ protected _playerState: {
178
+ prev: PlayerState;
179
+ count: number;
180
+ loaded: boolean;
181
+ visible: boolean;
182
+ scrollY: number;
183
+ scrollTimeout: NodeJS.Timeout | null;
184
+ };
185
+ protected _render: typeof renderPlayer;
186
+ protected _renderControls: typeof renderControls;
187
+ protected _seeker: number;
188
+ private _animations;
189
+ private _currentAnimation;
190
+ private _intersectionObserver?;
191
+ private _isBounce;
192
+ private _isDotLottie;
193
+ private _lottieInstance;
194
+ private _manifest?;
195
+ private _multiAnimationSettings;
196
+ private _segment?;
197
+ constructor();
198
+ addAnimation(_params: AddAnimationParams): Promise<Result>;
199
+ attributeChangedCallback(name: typeof DotLottiePlayerBase.observedAttributes[number], _oldValue: unknown, value: string): Promise<void>;
200
+ connectedCallback(): void;
201
+ convert(_params: ConvertParams): Promise<Result>;
202
+ destroy(): void;
203
+ disconnectedCallback(): void;
204
+ getLottie(): AnimationItem | null;
205
+ getManifest(): LottieManifest | undefined;
206
+ getMultiAnimationSettings(): AnimationSettings[];
207
+ getSegment(): Vector2 | undefined;
208
+ load(src: string | null): Promise<void>;
209
+ loadAnimation(_config: AnimationConfiguration): AnimationItem;
210
+ next(): void;
211
+ pause(): void;
212
+ play(): void;
213
+ prev(): void;
214
+ propertyChangedCallback(name: string, _oldValue: unknown, value: unknown): void;
215
+ reload(): Promise<void>;
216
+ seek(value: number | string): void;
217
+ setCount(value: number): void;
218
+ setDirection(value: AnimationDirection): void;
219
+ setLoop(value: boolean): void;
220
+ setMultiAnimationSettings(settings: AnimationSettings[]): void;
221
+ setSegment(segment: Vector2): void;
222
+ setSpeed(value?: number): void;
223
+ setSubframe(value: boolean): void;
224
+ snapshot(shouldDownload?: boolean, name?: string): string | null;
225
+ stop(): void;
226
+ toggleBoomerang(): void;
227
+ toggleLoop(): void;
228
+ togglePlay(): void;
229
+ protected _freeze(): void;
230
+ protected _handleBlur(): void;
231
+ protected _handleClick(): void;
232
+ protected _handleSeekChange({ target }: Event): void;
233
+ protected _handleSettingsClick({ target }: Event): void;
234
+ protected setOptions(_options: {
235
+ container?: HTMLElement;
236
+ rendererType: RendererType;
237
+ initialSegment?: Vector2;
238
+ hasAutoplay: boolean;
239
+ hasLoop: boolean;
240
+ preserveAspectRatio: PreserveAspectRatio;
241
+ }): AnimationConfiguration<RendererType.SVG | RendererType.Canvas | RendererType.HTML>;
242
+ private _addEventListeners;
243
+ private _addIntersectionObserver;
244
+ private _complete;
245
+ private _dataFailed;
246
+ private _dataReady;
247
+ private _DOMLoaded;
248
+ private _enterFrame;
249
+ private _getOptions;
250
+ private _handleScroll;
251
+ private _handleWindowBlur;
252
+ private _intersectionObserverFallback;
253
+ private _loopComplete;
254
+ private _mouseEnter;
255
+ private _mouseLeave;
256
+ private _onVisibilityChange;
257
+ private _removeEventListeners;
258
+ private _switchInstance;
259
+ private _toggleEventListeners;
260
+ private _toggleSettings;
261
+ }
262
+
263
+ declare class DotLottiePlayerCanvas extends DotLottiePlayerBase {
264
+ loadAnimation: typeof _aarsteinmedia_lottie_web_canvas.loadAnimation;
265
+ get renderer(): RendererType;
266
+ constructor();
267
+ protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, }: {
268
+ container?: HTMLElement;
269
+ rendererType: RendererType;
270
+ initialSegment?: Vector2;
271
+ hasAutoplay: boolean;
272
+ hasLoop: boolean;
273
+ preserveAspectRatio: PreserveAspectRatio;
274
+ }): AnimationConfiguration<RendererType.Canvas>;
275
+ }
276
+
277
+ export { PlayerState, DotLottiePlayerCanvas as default, tagName };