@lottiefiles/lottie-player 1.7.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,263 @@
1
- /**
2
- * Copyright 2022 Design Barn Inc.
3
- */
4
- import { LottiePlayer } from "./lottie-player";
5
- /**
6
- * TGSPlayer web component class
7
- *
8
- * @export
9
- * @class TGSPlayer
10
- * @extends {LottiePlayer}
11
- */
12
- export declare class TGSPlayer extends LottiePlayer {
13
- /**
14
- * Strict format checks for TGS.
15
- */
16
- strict: boolean;
17
- /**
18
- * Configure and initialize lottie-web player instance.
19
- */
20
- load(src: string | object): Promise<void>;
21
- /**
22
- * Returns the styles for the component.
23
- */
24
- static get styles(): import("lit").CSSResult;
25
- protected formatCheck(data: any): string[];
26
- private checkLayer;
27
- private checkItems;
28
- }
29
- //# sourceMappingURL=tgs-player.d.ts.map
1
+ import { LitElement, CSSResult } from 'lit';
2
+ import { TemplateResult } from 'lit/html.js';
3
+ import { AnimationItem } from 'lottie-web';
4
+
5
+ /**
6
+ * Copyright 2023 Design Barn Inc.
7
+ */
8
+
9
+ declare enum PlayerState {
10
+ Destroyed = "destroyed",
11
+ Error = "error",
12
+ Frozen = "frozen",
13
+ Loading = "loading",
14
+ Ready = "ready",
15
+ Paused = "paused",
16
+ Playing = "playing",
17
+ Stopped = "stopped"
18
+ }
19
+ declare enum PlayMode {
20
+ Bounce = "bounce",
21
+ Normal = "normal"
22
+ }
23
+ interface Versions {
24
+ lottiePlayerVersion: string;
25
+ lottieWebVersion: string;
26
+ }
27
+ interface InternalPlayerState {
28
+ background: string;
29
+ currentState: PlayerState;
30
+ frame: number;
31
+ seeker: number;
32
+ autoplay: boolean;
33
+ direction: number;
34
+ hover: boolean;
35
+ intermission: number;
36
+ loop: boolean;
37
+ count?: number;
38
+ playMode: PlayMode;
39
+ speed: number;
40
+ }
41
+ /**
42
+ * LottiePlayer web component class
43
+ *
44
+ */
45
+ declare class LottiePlayer extends LitElement {
46
+ /**
47
+ * Autoplay animation on load.
48
+ */
49
+ autoplay: boolean;
50
+ /**
51
+ * Background color.
52
+ */
53
+ background?: string;
54
+ /**
55
+ * Show controls.
56
+ */
57
+ controls: boolean;
58
+ /**
59
+ * Number of times to loop animation.
60
+ */
61
+ count?: number;
62
+ /**
63
+ * Player state.
64
+ */
65
+ currentState: PlayerState;
66
+ /**
67
+ * Animation description for screen readers.
68
+ */
69
+ description: string;
70
+ /**
71
+ * Direction of animation.
72
+ */
73
+ direction: number;
74
+ /**
75
+ * Disable checking if the Lottie is valid before loading
76
+ */
77
+ disableCheck?: boolean;
78
+ /**
79
+ * Disable using shadow dom as the root
80
+ */
81
+ disableShadowDOM: boolean;
82
+ /**
83
+ * Whether to play on mouse hover
84
+ */
85
+ hover: boolean;
86
+ /**
87
+ * Intermission
88
+ */
89
+ intermission: number;
90
+ /**
91
+ * Whether to loop animation.
92
+ */
93
+ loop: boolean;
94
+ /**
95
+ * Play mode.
96
+ */
97
+ mode: PlayMode;
98
+ /**
99
+ * Aspect ratio to pass to lottie-web.
100
+ */
101
+ preserveAspectRatio: string;
102
+ /**
103
+ * Renderer to use.
104
+ */
105
+ renderer: 'svg' | 'canvas';
106
+ /**
107
+ * seeker
108
+ */
109
+ seeker: number;
110
+ /**
111
+ * Animation speed.
112
+ */
113
+ speed: number;
114
+ /**
115
+ * Bodymovin JSON data or URL to JSON.
116
+ */
117
+ src?: string;
118
+ /**
119
+ * Viewbox size for renderer settings
120
+ */
121
+ viewBoxSize?: string;
122
+ /**
123
+ * Enable web workers
124
+ */
125
+ webworkers?: boolean;
126
+ /**
127
+ * Animation container.
128
+ */
129
+ protected container: HTMLElement;
130
+ private _counter;
131
+ private _io;
132
+ private _lottie?;
133
+ /**
134
+ * Destroy animation and lottie-player element.
135
+ */
136
+ destroy(): void;
137
+ /**
138
+ * Cleanup on component destroy.
139
+ */
140
+ disconnectedCallback(): void;
141
+ /**
142
+ * Returns the lottie-web instance used in the component.
143
+ */
144
+ getLottie(): any;
145
+ /**
146
+ * Returns the lottie-web version and this player's version
147
+ */
148
+ getVersions(): Versions;
149
+ /**
150
+ * Configure and initialize lottie-web player instance.
151
+ */
152
+ load(src: string | AnimationItem): Promise<void>;
153
+ /**
154
+ * Pause animation play.
155
+ */
156
+ pause(): void;
157
+ /**
158
+ * Start playing animation.
159
+ */
160
+ play(): void;
161
+ getState(): InternalPlayerState;
162
+ render(): TemplateResult | void;
163
+ /**
164
+ * Resize animation.
165
+ */
166
+ resize(): void;
167
+ /**
168
+ * Seek to a given frame.
169
+ */
170
+ seek(value: number | string): void;
171
+ /**
172
+ * Animation play direction.
173
+ *
174
+ * @param value - Direction values.
175
+ */
176
+ setDirection(value: 1 | -1): void;
177
+ /**
178
+ * Sets the looping of the animation.
179
+ *
180
+ * @param value - Whether to enable looping. Boolean true enables looping.
181
+ */
182
+ setLooping(value: boolean): void;
183
+ /**
184
+ * Sets animation play speed.
185
+ *
186
+ * @param value - Playback speed.
187
+ */
188
+ setSpeed(value?: number): void;
189
+ /**
190
+ * Snapshot the current frame as SVG.
191
+ *
192
+ * If 'download' argument is boolean true, then a download is triggered in browser.
193
+ */
194
+ snapshot(download?: boolean): string;
195
+ /**
196
+ * Stops animation play.
197
+ */
198
+ stop(): void;
199
+ /**
200
+ * Toggles animation looping.
201
+ */
202
+ toggleLooping(): void;
203
+ /**
204
+ * Toggle playing state.
205
+ */
206
+ togglePlay(): void;
207
+ /**
208
+ * Returns the styles for the component.
209
+ */
210
+ static get styles(): CSSResult;
211
+ protected createRenderRoot(): Element | ShadowRoot;
212
+ /**
213
+ * Initialize everything on component first render.
214
+ */
215
+ protected firstUpdated(): Promise<void>;
216
+ protected renderControls(): TemplateResult;
217
+ private _attachEventListeners;
218
+ /**
219
+ * Freeze animation play.
220
+ * This internal state pauses animation and is used to differentiate between
221
+ * user requested pauses and component instigated pauses.
222
+ */
223
+ private _freeze;
224
+ /**
225
+ * Handles click and drag actions on the progress track.
226
+ */
227
+ private _handleSeekChange;
228
+ /**
229
+ * Handle visibility change events.
230
+ */
231
+ private _onVisibilityChange;
232
+ }
233
+
234
+ /**
235
+ * Copyright 2023 Design Barn Inc.
236
+ */
237
+
238
+ /**
239
+ * TGSPlayer web component class
240
+ *
241
+ * @export
242
+ * @class TGSPlayer
243
+ * @extends {LottiePlayer}
244
+ */
245
+ declare class TGSPlayer extends LottiePlayer {
246
+ /**
247
+ * Strict format checks for TGS.
248
+ */
249
+ strict: boolean;
250
+ /**
251
+ * Configure and initialize lottie-web player instance.
252
+ */
253
+ load(src: string | AnimationItem): Promise<void>;
254
+ /**
255
+ * Returns the styles for the component.
256
+ */
257
+ static get styles(): CSSResult;
258
+ protected formatCheck(data: any): string[];
259
+ private checkLayer;
260
+ private checkItems;
261
+ }
262
+
263
+ export { TGSPlayer };