@aarsteinmedia/dotlottie-player 5.0.1 → 5.0.3
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 +7 -0
- package/custom-elements.json +237 -284
- package/dist/index.d.ts +134 -125
- package/dist/index.js +1365 -1287
- package/dist/unpkg.js +2 -0
- package/package.json +20 -23
- package/dist/unpkg/index.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,50 +1,4 @@
|
|
|
1
|
-
import { AnimationSettings, AnimationDirection,
|
|
2
|
-
|
|
3
|
-
declare function renderPlayer(this: DotLottiePlayer): void;
|
|
4
|
-
|
|
5
|
-
declare function renderControls(this: DotLottiePlayer): void;
|
|
6
|
-
|
|
7
|
-
declare enum PlayerState {
|
|
8
|
-
Completed = "completed",
|
|
9
|
-
Destroyed = "destroyed",
|
|
10
|
-
Error = "error",
|
|
11
|
-
Frozen = "frozen",
|
|
12
|
-
Loading = "loading",
|
|
13
|
-
Paused = "paused",
|
|
14
|
-
Playing = "playing",
|
|
15
|
-
Stopped = "stopped"
|
|
16
|
-
}
|
|
17
|
-
declare enum PlayMode {
|
|
18
|
-
Bounce = "bounce",
|
|
19
|
-
Normal = "normal"
|
|
20
|
-
}
|
|
21
|
-
declare enum PlayerEvents {
|
|
22
|
-
Complete = "complete",
|
|
23
|
-
Destroyed = "destroyed",
|
|
24
|
-
Error = "error",
|
|
25
|
-
Frame = "frame",
|
|
26
|
-
Freeze = "freeze",
|
|
27
|
-
Load = "load",
|
|
28
|
-
Loop = "loop",
|
|
29
|
-
Next = "next",
|
|
30
|
-
Pause = "pause",
|
|
31
|
-
Play = "play",
|
|
32
|
-
Previous = "previous",
|
|
33
|
-
Ready = "ready",
|
|
34
|
-
Rendered = "rendered",
|
|
35
|
-
Stop = "stop"
|
|
36
|
-
}
|
|
37
|
-
declare enum PreserveAspectRatio {
|
|
38
|
-
Contain = "xMidYMid meet",
|
|
39
|
-
Cover = "xMidYMid slice",
|
|
40
|
-
None = "xMinYMin slice",
|
|
41
|
-
Initial = "none"
|
|
42
|
-
}
|
|
43
|
-
declare enum RendererType {
|
|
44
|
-
SVG = "svg",
|
|
45
|
-
HTML = "html",
|
|
46
|
-
Canvas = "canvas"
|
|
47
|
-
}
|
|
1
|
+
import { AnimationSettings, AnimationDirection, LottieManifest, AnimationData, AnimationItem, Vector2 } from '@aarsteinmedia/lottie-web';
|
|
48
2
|
|
|
49
3
|
interface Animation extends AnimationSettings {
|
|
50
4
|
id: string;
|
|
@@ -59,7 +13,7 @@ type Loop = boolean | '' | 'loop' | null;
|
|
|
59
13
|
type Subframe = boolean | '' | null;
|
|
60
14
|
declare global {
|
|
61
15
|
interface HTMLElementTagNameMap {
|
|
62
|
-
|
|
16
|
+
[tagName]: DotLottiePlayer;
|
|
63
17
|
}
|
|
64
18
|
function dotLottiePlayer(): DotLottiePlayer;
|
|
65
19
|
}
|
|
@@ -72,42 +26,92 @@ type JSXLottiePlayer = Omit<Partial<DotLottiePlayer>, 'style'> & {
|
|
|
72
26
|
declare module 'react' {
|
|
73
27
|
namespace JSX {
|
|
74
28
|
interface IntrinsicElements {
|
|
75
|
-
|
|
29
|
+
[tagName]: JSXLottiePlayer;
|
|
76
30
|
}
|
|
77
31
|
}
|
|
78
32
|
}
|
|
79
33
|
declare module 'react/jsx-runtime' {
|
|
80
34
|
namespace JSX {
|
|
81
35
|
interface IntrinsicElements {
|
|
82
|
-
|
|
36
|
+
[tagName]: JSXLottiePlayer;
|
|
83
37
|
}
|
|
84
38
|
}
|
|
85
39
|
}
|
|
86
40
|
declare module 'react/jsx-dev-runtime' {
|
|
87
41
|
namespace JSX {
|
|
88
42
|
interface IntrinsicElements {
|
|
89
|
-
|
|
43
|
+
[tagName]: JSXLottiePlayer;
|
|
90
44
|
}
|
|
91
45
|
}
|
|
92
46
|
}
|
|
93
47
|
|
|
94
|
-
declare class PropertyCallbackElement extends HTMLElement {
|
|
48
|
+
declare abstract class PropertyCallbackElement extends HTMLElement {
|
|
95
49
|
constructor();
|
|
96
|
-
connectedCallback(): void
|
|
50
|
+
connectedCallback(): Promise<void>;
|
|
51
|
+
propertyChangedCallback(_name: string, _oldValue: unknown, _value: unknown): void;
|
|
97
52
|
}
|
|
98
53
|
|
|
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
|
+
|
|
99
107
|
declare class DotLottiePlayer extends PropertyCallbackElement {
|
|
100
|
-
constructor();
|
|
101
|
-
connectedCallback(): Promise<void>;
|
|
102
|
-
disconnectedCallback(): void;
|
|
103
|
-
shadow: ShadowRoot;
|
|
104
|
-
template: HTMLTemplateElement;
|
|
105
|
-
protected _renderControls: typeof renderControls;
|
|
106
|
-
protected _render: typeof renderPlayer;
|
|
107
108
|
static get observedAttributes(): string[];
|
|
108
|
-
attributeChangedCallback(name: string, _oldValue: unknown, value: string): Promise<void>;
|
|
109
109
|
static get observedProperties(): string[];
|
|
110
|
-
|
|
110
|
+
static get styles(): () => Promise<CSSStyleSheet>;
|
|
111
|
+
playerState: PlayerState;
|
|
112
|
+
shadow: ShadowRoot | undefined;
|
|
113
|
+
source?: string;
|
|
114
|
+
template: HTMLTemplateElement;
|
|
111
115
|
set animateOnScroll(value: AnimateOnScroll);
|
|
112
116
|
get animateOnScroll(): AnimateOnScroll;
|
|
113
117
|
set autoplay(value: Autoplay);
|
|
@@ -130,8 +134,8 @@ declare class DotLottiePlayer extends PropertyCallbackElement {
|
|
|
130
134
|
get loop(): Loop;
|
|
131
135
|
set mode(value: PlayMode);
|
|
132
136
|
get mode(): PlayMode;
|
|
133
|
-
set objectfit(value:
|
|
134
|
-
get objectfit():
|
|
137
|
+
set objectfit(value: ObjectFit);
|
|
138
|
+
get objectfit(): ObjectFit;
|
|
135
139
|
set preserveAspectRatio(value: PreserveAspectRatio | null);
|
|
136
140
|
get preserveAspectRatio(): PreserveAspectRatio | null;
|
|
137
141
|
set renderer(value: RendererType);
|
|
@@ -144,25 +148,10 @@ declare class DotLottiePlayer extends PropertyCallbackElement {
|
|
|
144
148
|
get src(): string | null;
|
|
145
149
|
set subframe(value: Subframe);
|
|
146
150
|
get subframe(): Subframe;
|
|
147
|
-
private _multiAnimationSettings;
|
|
148
|
-
getMultiAnimationSettings(): AnimationSettings[];
|
|
149
|
-
setMultiAnimationSettings(settings: AnimationSettings[]): void;
|
|
150
|
-
private _segment?;
|
|
151
|
-
setSegment(segment: Vector2): void;
|
|
152
|
-
getSegment(): Vector2 | undefined;
|
|
153
151
|
protected _container: HTMLElement | null;
|
|
154
|
-
playerState: PlayerState;
|
|
155
|
-
protected _isSettingsOpen: boolean;
|
|
156
|
-
protected _seeker: number;
|
|
157
|
-
private _currentAnimation;
|
|
158
|
-
private _animations;
|
|
159
|
-
private _intersectionObserver?;
|
|
160
|
-
private _lottieInstance;
|
|
161
|
-
protected _identifier: string;
|
|
162
152
|
protected _errorMessage: string;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
private _manifest?;
|
|
153
|
+
protected _identifier: string;
|
|
154
|
+
protected _isSettingsOpen: boolean;
|
|
166
155
|
protected _playerState: {
|
|
167
156
|
prev: PlayerState;
|
|
168
157
|
count: number;
|
|
@@ -171,63 +160,83 @@ declare class DotLottiePlayer extends PropertyCallbackElement {
|
|
|
171
160
|
scrollY: number;
|
|
172
161
|
scrollTimeout: NodeJS.Timeout | null;
|
|
173
162
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
private
|
|
179
|
-
private
|
|
180
|
-
private
|
|
181
|
-
private
|
|
182
|
-
private
|
|
183
|
-
private
|
|
184
|
-
private
|
|
185
|
-
private
|
|
186
|
-
|
|
187
|
-
private _handleWindowBlur;
|
|
188
|
-
private _mouseEnter;
|
|
189
|
-
private _mouseLeave;
|
|
190
|
-
private _onVisibilityChange;
|
|
191
|
-
private _handleScroll;
|
|
192
|
-
protected _handleSeekChange({ target }: Event): void;
|
|
193
|
-
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();
|
|
194
176
|
addAnimation(configs: AnimationAttributes[], fileName?: string, shouldDownload?: boolean): Promise<{
|
|
195
|
-
result?:
|
|
177
|
+
result?: null | ArrayBuffer;
|
|
196
178
|
success: boolean;
|
|
197
179
|
error?: string;
|
|
198
180
|
}>;
|
|
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>;
|
|
191
|
+
destroy(): void;
|
|
192
|
+
disconnectedCallback(): void;
|
|
199
193
|
getLottie(): AnimationItem | null;
|
|
200
|
-
|
|
194
|
+
getManifest(): LottieManifest | undefined;
|
|
195
|
+
getMultiAnimationSettings(): AnimationSettings[];
|
|
196
|
+
getSegment(): Vector2 | undefined;
|
|
197
|
+
load(src: string | null): Promise<void>;
|
|
198
|
+
next(): void;
|
|
201
199
|
pause(): void;
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
play(): void;
|
|
201
|
+
prev(): void;
|
|
202
|
+
propertyChangedCallback(name: string, _oldValue: unknown, value: unknown): void;
|
|
203
|
+
reload(): Promise<void>;
|
|
204
204
|
seek(value: number | string): void;
|
|
205
|
-
snapshot(shouldDownload?: boolean, name?: string): string | null;
|
|
206
|
-
setSubframe(value: boolean): void;
|
|
207
205
|
setCount(value: number): void;
|
|
208
|
-
protected _freeze(): void;
|
|
209
|
-
reload(): Promise<void>;
|
|
210
|
-
setSpeed(value?: number): void;
|
|
211
206
|
setDirection(value: AnimationDirection): void;
|
|
212
207
|
setLoop(value: boolean): void;
|
|
213
|
-
|
|
214
|
-
|
|
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;
|
|
215
214
|
toggleBoomerang(): void;
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
toggleLoop(): void;
|
|
216
|
+
togglePlay(): void;
|
|
217
|
+
protected _freeze(): void;
|
|
218
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;
|
|
219
237
|
private _switchInstance;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
convert({ animations, fileName, manifest, shouldDownload, src, typeCheck, }: {
|
|
223
|
-
typeCheck?: boolean;
|
|
224
|
-
manifest?: LottieManifest;
|
|
225
|
-
animations?: AnimationData[];
|
|
226
|
-
src?: string;
|
|
227
|
-
fileName?: string;
|
|
228
|
-
shouldDownload?: boolean;
|
|
229
|
-
}): Promise<string | void | ArrayBuffer>;
|
|
230
|
-
static get styles(): CSSStyleSheet;
|
|
238
|
+
private _toggleEventListeners;
|
|
239
|
+
private _toggleSettings;
|
|
231
240
|
}
|
|
232
241
|
|
|
233
242
|
declare const tagName = "dotlottie-player";
|