@aarsteinmedia/dotlottie-player 5.0.0 → 5.0.2
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 +13 -0
- package/custom-elements.json +242 -2327
- package/dist/index.d.ts +137 -198
- package/dist/index.js +1329 -1218
- package/dist/unpkg.js +2 -0
- package/package.json +40 -45
- package/dist/unpkg/index.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,127 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AnimationDirection, RendererType, AnimationSegment } from 'lottie-web';
|
|
1
|
+
import { AnimationSettings, AnimationDirection, LottieManifest, AnimationData, AnimationItem, Vector2 } from '@aarsteinmedia/lottie-web';
|
|
3
2
|
|
|
4
|
-
declare function renderPlayer(this: DotLottiePlayer): void;
|
|
5
|
-
|
|
6
|
-
declare function renderControls(this: DotLottiePlayer): void;
|
|
7
|
-
|
|
8
|
-
declare enum PlayerState {
|
|
9
|
-
Completed = "completed",
|
|
10
|
-
Destroyed = "destroyed",
|
|
11
|
-
Error = "error",
|
|
12
|
-
Frozen = "frozen",
|
|
13
|
-
Loading = "loading",
|
|
14
|
-
Paused = "paused",
|
|
15
|
-
Playing = "playing",
|
|
16
|
-
Stopped = "stopped"
|
|
17
|
-
}
|
|
18
|
-
declare enum PlayMode {
|
|
19
|
-
Bounce = "bounce",
|
|
20
|
-
Normal = "normal"
|
|
21
|
-
}
|
|
22
|
-
declare enum PlayerEvents {
|
|
23
|
-
Complete = "complete",
|
|
24
|
-
Destroyed = "destroyed",
|
|
25
|
-
Error = "error",
|
|
26
|
-
Frame = "frame",
|
|
27
|
-
Freeze = "freeze",
|
|
28
|
-
Load = "load",
|
|
29
|
-
Loop = "loop",
|
|
30
|
-
Next = "next",
|
|
31
|
-
Pause = "pause",
|
|
32
|
-
Play = "play",
|
|
33
|
-
Previous = "previous",
|
|
34
|
-
Ready = "ready",
|
|
35
|
-
Rendered = "rendered",
|
|
36
|
-
Stop = "stop"
|
|
37
|
-
}
|
|
38
|
-
declare enum PreserveAspectRatio {
|
|
39
|
-
Contain = "xMidYMid meet",
|
|
40
|
-
Cover = "xMidYMid slice",
|
|
41
|
-
None = "xMinYMin slice",
|
|
42
|
-
Initial = "none"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type BoolInt = 0 | 1;
|
|
46
|
-
interface Shape {
|
|
47
|
-
a: ShapeData;
|
|
48
|
-
o: ShapeData;
|
|
49
|
-
p: ShapeData;
|
|
50
|
-
r: ShapeData;
|
|
51
|
-
s: ShapeData;
|
|
52
|
-
}
|
|
53
|
-
interface ShapeData {
|
|
54
|
-
a: BoolInt;
|
|
55
|
-
k: number | number[];
|
|
56
|
-
ix: number;
|
|
57
|
-
}
|
|
58
|
-
interface Layer {
|
|
59
|
-
ao: BoolInt;
|
|
60
|
-
bm: number;
|
|
61
|
-
completed: boolean;
|
|
62
|
-
ddd: BoolInt;
|
|
63
|
-
ip: number;
|
|
64
|
-
ks: object;
|
|
65
|
-
nm: string;
|
|
66
|
-
op: number;
|
|
67
|
-
shapes: Shape[];
|
|
68
|
-
sr: number;
|
|
69
|
-
st: number;
|
|
70
|
-
td: number;
|
|
71
|
-
ty: number;
|
|
72
|
-
}
|
|
73
|
-
interface LottieAsset {
|
|
74
|
-
e?: BoolInt;
|
|
75
|
-
layers?: Layer[];
|
|
76
|
-
h?: number;
|
|
77
|
-
id?: string;
|
|
78
|
-
nm?: string;
|
|
79
|
-
p?: string;
|
|
80
|
-
u?: string;
|
|
81
|
-
xt?: number;
|
|
82
|
-
w?: number;
|
|
83
|
-
}
|
|
84
|
-
interface LottieJSON {
|
|
85
|
-
assets?: LottieAsset[];
|
|
86
|
-
ddd: BoolInt;
|
|
87
|
-
fr: number;
|
|
88
|
-
h: number;
|
|
89
|
-
ip: number;
|
|
90
|
-
layers: Layer[];
|
|
91
|
-
markers: unknown[];
|
|
92
|
-
meta: {
|
|
93
|
-
a: string;
|
|
94
|
-
d: string;
|
|
95
|
-
g: string;
|
|
96
|
-
k: string;
|
|
97
|
-
tc: string;
|
|
98
|
-
};
|
|
99
|
-
nm: string;
|
|
100
|
-
op: number;
|
|
101
|
-
v: string;
|
|
102
|
-
w: number;
|
|
103
|
-
}
|
|
104
|
-
interface AnimationSettings {
|
|
105
|
-
autoplay?: Autoplay;
|
|
106
|
-
loop?: Loop;
|
|
107
|
-
direction?: AnimationDirection;
|
|
108
|
-
mode?: PlayMode;
|
|
109
|
-
speed?: number;
|
|
110
|
-
}
|
|
111
3
|
interface Animation extends AnimationSettings {
|
|
112
4
|
id: string;
|
|
113
5
|
}
|
|
114
6
|
interface AnimationAttributes extends Animation {
|
|
115
7
|
url: string;
|
|
116
8
|
}
|
|
117
|
-
interface LottieManifest {
|
|
118
|
-
animations: Animation[];
|
|
119
|
-
author?: string;
|
|
120
|
-
description?: string;
|
|
121
|
-
generator?: string;
|
|
122
|
-
keywords?: string;
|
|
123
|
-
version?: string;
|
|
124
|
-
}
|
|
125
9
|
type AnimateOnScroll = boolean | '' | null;
|
|
126
10
|
type Autoplay = boolean | '' | 'autoplay' | null;
|
|
127
11
|
type Controls = boolean | '' | 'controls' | null;
|
|
@@ -129,7 +13,7 @@ type Loop = boolean | '' | 'loop' | null;
|
|
|
129
13
|
type Subframe = boolean | '' | null;
|
|
130
14
|
declare global {
|
|
131
15
|
interface HTMLElementTagNameMap {
|
|
132
|
-
|
|
16
|
+
[tagName]: DotLottiePlayer;
|
|
133
17
|
}
|
|
134
18
|
function dotLottiePlayer(): DotLottiePlayer;
|
|
135
19
|
}
|
|
@@ -142,42 +26,92 @@ type JSXLottiePlayer = Omit<Partial<DotLottiePlayer>, 'style'> & {
|
|
|
142
26
|
declare module 'react' {
|
|
143
27
|
namespace JSX {
|
|
144
28
|
interface IntrinsicElements {
|
|
145
|
-
|
|
29
|
+
[tagName]: JSXLottiePlayer;
|
|
146
30
|
}
|
|
147
31
|
}
|
|
148
32
|
}
|
|
149
33
|
declare module 'react/jsx-runtime' {
|
|
150
34
|
namespace JSX {
|
|
151
35
|
interface IntrinsicElements {
|
|
152
|
-
|
|
36
|
+
[tagName]: JSXLottiePlayer;
|
|
153
37
|
}
|
|
154
38
|
}
|
|
155
39
|
}
|
|
156
40
|
declare module 'react/jsx-dev-runtime' {
|
|
157
41
|
namespace JSX {
|
|
158
42
|
interface IntrinsicElements {
|
|
159
|
-
|
|
43
|
+
[tagName]: JSXLottiePlayer;
|
|
160
44
|
}
|
|
161
45
|
}
|
|
162
46
|
}
|
|
163
47
|
|
|
164
|
-
declare class
|
|
48
|
+
declare abstract class PropertyCallbackElement extends HTMLElement {
|
|
165
49
|
constructor();
|
|
166
|
-
connectedCallback(): void
|
|
50
|
+
connectedCallback(): Promise<void>;
|
|
51
|
+
propertyChangedCallback(_name: string, _oldValue: unknown, _value: unknown): void;
|
|
167
52
|
}
|
|
168
53
|
|
|
169
|
-
declare
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
54
|
+
declare enum ObjectFit {
|
|
55
|
+
Contain = "contain",
|
|
56
|
+
Cover = "cover",
|
|
57
|
+
Fill = "fill",
|
|
58
|
+
None = "none",
|
|
59
|
+
ScaleDown = "scale-down"
|
|
60
|
+
}
|
|
61
|
+
declare enum PlayerState {
|
|
62
|
+
Completed = "completed",
|
|
63
|
+
Destroyed = "destroyed",
|
|
64
|
+
Error = "error",
|
|
65
|
+
Frozen = "frozen",
|
|
66
|
+
Loading = "loading",
|
|
67
|
+
Paused = "paused",
|
|
68
|
+
Playing = "playing",
|
|
69
|
+
Stopped = "stopped"
|
|
70
|
+
}
|
|
71
|
+
declare enum PlayMode {
|
|
72
|
+
Bounce = "bounce",
|
|
73
|
+
Normal = "normal"
|
|
74
|
+
}
|
|
75
|
+
declare enum PlayerEvents {
|
|
76
|
+
Complete = "complete",
|
|
77
|
+
Destroyed = "destroyed",
|
|
78
|
+
Error = "error",
|
|
79
|
+
Frame = "frame",
|
|
80
|
+
Freeze = "freeze",
|
|
81
|
+
Load = "load",
|
|
82
|
+
Loop = "loop",
|
|
83
|
+
Next = "next",
|
|
84
|
+
Pause = "pause",
|
|
85
|
+
Play = "play",
|
|
86
|
+
Previous = "previous",
|
|
87
|
+
Ready = "ready",
|
|
88
|
+
Rendered = "rendered",
|
|
89
|
+
Stop = "stop"
|
|
90
|
+
}
|
|
91
|
+
declare enum PreserveAspectRatio {
|
|
92
|
+
Contain = "xMidYMid meet",
|
|
93
|
+
Cover = "xMidYMid slice",
|
|
94
|
+
Initial = "none",
|
|
95
|
+
None = "xMinYMin slice"
|
|
96
|
+
}
|
|
97
|
+
declare enum RendererType {
|
|
98
|
+
Canvas = "canvas",
|
|
99
|
+
HTML = "html",
|
|
100
|
+
SVG = "svg"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare function renderControls(this: DotLottiePlayer): void;
|
|
104
|
+
|
|
105
|
+
declare function renderPlayer(this: DotLottiePlayer): Promise<void>;
|
|
106
|
+
|
|
107
|
+
declare class DotLottiePlayer extends PropertyCallbackElement {
|
|
177
108
|
static get observedAttributes(): string[];
|
|
178
|
-
attributeChangedCallback(name: string, _oldValue: unknown, value: string): Promise<void>;
|
|
179
109
|
static get observedProperties(): string[];
|
|
180
|
-
|
|
110
|
+
static get styles(): () => Promise<CSSStyleSheet>;
|
|
111
|
+
playerState: PlayerState;
|
|
112
|
+
shadow: ShadowRoot | undefined;
|
|
113
|
+
source?: string;
|
|
114
|
+
template: HTMLTemplateElement;
|
|
181
115
|
set animateOnScroll(value: AnimateOnScroll);
|
|
182
116
|
get animateOnScroll(): AnimateOnScroll;
|
|
183
117
|
set autoplay(value: Autoplay);
|
|
@@ -200,8 +134,8 @@ declare class DotLottiePlayer extends EnhancedElement {
|
|
|
200
134
|
get loop(): Loop;
|
|
201
135
|
set mode(value: PlayMode);
|
|
202
136
|
get mode(): PlayMode;
|
|
203
|
-
set objectfit(value:
|
|
204
|
-
get objectfit():
|
|
137
|
+
set objectfit(value: ObjectFit);
|
|
138
|
+
get objectfit(): ObjectFit;
|
|
205
139
|
set preserveAspectRatio(value: PreserveAspectRatio | null);
|
|
206
140
|
get preserveAspectRatio(): PreserveAspectRatio | null;
|
|
207
141
|
set renderer(value: RendererType);
|
|
@@ -214,25 +148,10 @@ declare class DotLottiePlayer extends EnhancedElement {
|
|
|
214
148
|
get src(): string | null;
|
|
215
149
|
set subframe(value: Subframe);
|
|
216
150
|
get subframe(): Subframe;
|
|
217
|
-
|
|
218
|
-
getMultiAnimationSettings(): AnimationSettings[];
|
|
219
|
-
setMultiAnimationSettings(settings: AnimationSettings[]): void;
|
|
220
|
-
private _segment?;
|
|
221
|
-
setSegment(segment: AnimationSegment): void;
|
|
222
|
-
getSegment(): Lottie.AnimationSegment | undefined;
|
|
223
|
-
protected _container: Element | null;
|
|
224
|
-
playerState?: PlayerState;
|
|
225
|
-
protected _isSettingsOpen: boolean;
|
|
226
|
-
protected _seeker: number;
|
|
227
|
-
private _currentAnimation;
|
|
228
|
-
private _animations;
|
|
229
|
-
private _intersectionObserver?;
|
|
230
|
-
private _lottieInstance;
|
|
231
|
-
protected _identifier: string;
|
|
151
|
+
protected _container: HTMLElement | null;
|
|
232
152
|
protected _errorMessage: string;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
private _manifest;
|
|
153
|
+
protected _identifier: string;
|
|
154
|
+
protected _isSettingsOpen: boolean;
|
|
236
155
|
protected _playerState: {
|
|
237
156
|
prev: PlayerState;
|
|
238
157
|
count: number;
|
|
@@ -241,63 +160,83 @@ declare class DotLottiePlayer extends EnhancedElement {
|
|
|
241
160
|
scrollY: number;
|
|
242
161
|
scrollTimeout: NodeJS.Timeout | null;
|
|
243
162
|
};
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
private
|
|
249
|
-
private
|
|
250
|
-
private
|
|
251
|
-
private
|
|
252
|
-
private
|
|
253
|
-
private
|
|
254
|
-
private
|
|
255
|
-
private
|
|
256
|
-
|
|
257
|
-
private _handleWindowBlur;
|
|
258
|
-
private _mouseEnter;
|
|
259
|
-
private _mouseLeave;
|
|
260
|
-
private _onVisibilityChange;
|
|
261
|
-
private _handleScroll;
|
|
262
|
-
protected _handleSeekChange({ target }: Event): void;
|
|
263
|
-
private _isLottie;
|
|
163
|
+
protected _render: typeof renderPlayer;
|
|
164
|
+
protected _renderControls: typeof renderControls;
|
|
165
|
+
protected _seeker: number;
|
|
166
|
+
private _animations;
|
|
167
|
+
private _currentAnimation;
|
|
168
|
+
private _intersectionObserver?;
|
|
169
|
+
private _isBounce;
|
|
170
|
+
private _isDotLottie;
|
|
171
|
+
private _lottieInstance;
|
|
172
|
+
private _manifest?;
|
|
173
|
+
private _multiAnimationSettings;
|
|
174
|
+
private _segment?;
|
|
175
|
+
constructor();
|
|
264
176
|
addAnimation(configs: AnimationAttributes[], fileName?: string, shouldDownload?: boolean): Promise<{
|
|
265
|
-
result?:
|
|
177
|
+
result?: null | ArrayBuffer;
|
|
266
178
|
success: boolean;
|
|
267
179
|
error?: string;
|
|
268
180
|
}>;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
181
|
+
attributeChangedCallback(name: string, _oldValue: unknown, value: string): Promise<void>;
|
|
182
|
+
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>;
|
|
273
191
|
destroy(): void;
|
|
192
|
+
disconnectedCallback(): void;
|
|
193
|
+
getLottie(): AnimationItem | null;
|
|
194
|
+
getManifest(): LottieManifest | undefined;
|
|
195
|
+
getMultiAnimationSettings(): AnimationSettings[];
|
|
196
|
+
getSegment(): Vector2 | undefined;
|
|
197
|
+
load(src: string | null): Promise<void>;
|
|
198
|
+
next(): void;
|
|
199
|
+
pause(): void;
|
|
200
|
+
play(): void;
|
|
201
|
+
prev(): void;
|
|
202
|
+
propertyChangedCallback(name: string, _oldValue: unknown, value: unknown): void;
|
|
203
|
+
reload(): Promise<void>;
|
|
274
204
|
seek(value: number | string): void;
|
|
275
|
-
snapshot(shouldDownload?: boolean, name?: string): string | null;
|
|
276
|
-
setSubframe(value: boolean): void;
|
|
277
205
|
setCount(value: number): void;
|
|
278
|
-
protected _freeze(): void;
|
|
279
|
-
reload(): Promise<void>;
|
|
280
|
-
setSpeed(value?: number): void;
|
|
281
206
|
setDirection(value: AnimationDirection): void;
|
|
282
207
|
setLoop(value: boolean): void;
|
|
283
|
-
|
|
284
|
-
|
|
208
|
+
setMultiAnimationSettings(settings: AnimationSettings[]): void;
|
|
209
|
+
setSegment(segment: Vector2): void;
|
|
210
|
+
setSpeed(value?: number): void;
|
|
211
|
+
setSubframe(value: boolean): void;
|
|
212
|
+
snapshot(shouldDownload?: boolean, name?: string): string | null;
|
|
213
|
+
stop(): void;
|
|
285
214
|
toggleBoomerang(): void;
|
|
286
|
-
|
|
287
|
-
|
|
215
|
+
toggleLoop(): void;
|
|
216
|
+
togglePlay(): void;
|
|
217
|
+
protected _freeze(): void;
|
|
288
218
|
protected _handleBlur(): void;
|
|
219
|
+
protected _handleSeekChange({ target }: Event): void;
|
|
220
|
+
protected _handleSettingsClick: ({ target }: Event) => void;
|
|
221
|
+
private _addEventListeners;
|
|
222
|
+
private _addIntersectionObserver;
|
|
223
|
+
private _complete;
|
|
224
|
+
private _dataFailed;
|
|
225
|
+
private _dataReady;
|
|
226
|
+
private _DOMLoaded;
|
|
227
|
+
private _enterFrame;
|
|
228
|
+
private _getOptions;
|
|
229
|
+
private _handleScroll;
|
|
230
|
+
private _handleWindowBlur;
|
|
231
|
+
private _isLottie;
|
|
232
|
+
private _loopComplete;
|
|
233
|
+
private _mouseEnter;
|
|
234
|
+
private _mouseLeave;
|
|
235
|
+
private _onVisibilityChange;
|
|
236
|
+
private _removeEventListeners;
|
|
289
237
|
private _switchInstance;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
convert({ animations, fileName, manifest, shouldDownload, src, typeCheck, }: {
|
|
293
|
-
typeCheck?: boolean;
|
|
294
|
-
manifest?: LottieManifest;
|
|
295
|
-
animations?: LottieJSON[];
|
|
296
|
-
src?: string;
|
|
297
|
-
fileName?: string;
|
|
298
|
-
shouldDownload?: boolean;
|
|
299
|
-
}): Promise<string | void | ArrayBuffer>;
|
|
300
|
-
static get styles(): CSSStyleSheet;
|
|
238
|
+
private _toggleEventListeners;
|
|
239
|
+
private _toggleSettings;
|
|
301
240
|
}
|
|
302
241
|
|
|
303
242
|
declare const tagName = "dotlottie-player";
|