@aarsteinmedia/dotlottie-player 5.3.1 → 6.0.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.
@@ -0,0 +1,234 @@
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_light from '@aarsteinmedia/lottie-web/light';
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
+
8
+ declare class DotLottiePlayer extends DotLottiePlayerBase {
9
+ addAnimation: typeof addAnimation;
10
+ convert: typeof convert;
11
+ loadAnimation: typeof _aarsteinmedia_lottie_web.loadAnimation;
12
+ protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, rendererType }: {
13
+ container?: HTMLElement;
14
+ rendererType: RendererType;
15
+ initialSegment?: Vector2;
16
+ hasAutoplay: boolean;
17
+ hasLoop: boolean;
18
+ preserveAspectRatio: PreserveAspectRatio;
19
+ }): AnimationConfiguration<RendererType>;
20
+ }
21
+
22
+ declare enum PlayerState {
23
+ Completed = "completed",
24
+ Destroyed = "destroyed",
25
+ Error = "error",
26
+ Frozen = "frozen",
27
+ Loading = "loading",
28
+ Paused = "paused",
29
+ Playing = "playing",
30
+ Stopped = "stopped"
31
+ }
32
+ declare const tagName = "dotlottie-player";
33
+
34
+ type AnimateOnScroll = boolean | '' | null;
35
+ type Autoplay = boolean | '' | 'autoplay' | null;
36
+ type Controls = boolean | '' | 'controls' | null;
37
+ type Loop = boolean | '' | 'loop' | null;
38
+ type Subframe = boolean | '' | null;
39
+ declare global {
40
+ interface HTMLElementTagNameMap {
41
+ [tagName]: DotLottiePlayer | DotLottiePlayerLight;
42
+ }
43
+ function dotLottiePlayer(): DotLottiePlayer | DotLottiePlayerLight;
44
+ }
45
+ type JSXLottiePlayer = Omit<Partial<DotLottiePlayer | DotLottiePlayerLight>, 'style'> & {
46
+ class?: string;
47
+ ref?: React.RefObject<unknown>;
48
+ style?: React.CSSProperties;
49
+ src: string;
50
+ };
51
+ declare module 'react' {
52
+ namespace JSX {
53
+ interface IntrinsicElements {
54
+ [tagName]: JSXLottiePlayer;
55
+ }
56
+ }
57
+ }
58
+ declare module 'react/jsx-runtime' {
59
+ namespace JSX {
60
+ interface IntrinsicElements {
61
+ [tagName]: JSXLottiePlayer;
62
+ }
63
+ }
64
+ }
65
+ declare module 'react/jsx-dev-runtime' {
66
+ namespace JSX {
67
+ interface IntrinsicElements {
68
+ [tagName]: JSXLottiePlayer;
69
+ }
70
+ }
71
+ }
72
+
73
+ declare abstract class PropertyCallbackElement extends HTMLElement {
74
+ constructor();
75
+ connectedCallback(): void;
76
+ propertyChangedCallback(_name: string, _oldValue: unknown, _value: unknown): void;
77
+ }
78
+
79
+ declare function renderControls(this: DotLottiePlayerBase): void;
80
+
81
+ declare function renderPlayer(this: DotLottiePlayerBase): Promise<void>;
82
+
83
+ declare abstract class DotLottiePlayerBase extends PropertyCallbackElement {
84
+ static get observedAttributes(): string[];
85
+ static get observedProperties(): string[];
86
+ static get styles(): () => Promise<CSSStyleSheet>;
87
+ isLight: boolean;
88
+ playerState: PlayerState;
89
+ shadow: ShadowRoot | undefined;
90
+ source?: string;
91
+ template?: HTMLTemplateElement;
92
+ set animateOnScroll(value: AnimateOnScroll);
93
+ get animateOnScroll(): AnimateOnScroll;
94
+ get animations(): AnimationData[];
95
+ set autoplay(value: Autoplay);
96
+ get autoplay(): Autoplay;
97
+ set background(value: string);
98
+ get background(): string;
99
+ set controls(value: Controls);
100
+ get controls(): Controls;
101
+ set count(value: number);
102
+ get count(): number;
103
+ get currentAnimation(): number;
104
+ set description(value: string | null);
105
+ get description(): string | null;
106
+ set direction(value: AnimationDirection);
107
+ get direction(): AnimationDirection;
108
+ set hover(value: boolean);
109
+ get hover(): boolean;
110
+ set intermission(value: number);
111
+ get intermission(): number;
112
+ get isDotLottie(): boolean;
113
+ set loop(value: Loop);
114
+ get loop(): Loop;
115
+ set mode(value: PlayMode);
116
+ get mode(): PlayMode;
117
+ set objectfit(value: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down');
118
+ get objectfit(): "contain" | "cover" | "fill" | "none" | "scale-down";
119
+ set preserveAspectRatio(value: PreserveAspectRatio | null);
120
+ get preserveAspectRatio(): PreserveAspectRatio | null;
121
+ set renderer(value: RendererType);
122
+ get renderer(): RendererType;
123
+ set simple(value: boolean);
124
+ get simple(): boolean;
125
+ set speed(value: number);
126
+ get speed(): number;
127
+ set src(value: string | null);
128
+ get src(): string | null;
129
+ set subframe(value: Subframe);
130
+ get subframe(): Subframe;
131
+ protected _container: HTMLElement | null;
132
+ protected _errorMessage: string;
133
+ protected _identifier: string;
134
+ protected _isSettingsOpen: boolean;
135
+ protected _playerState: {
136
+ prev: PlayerState;
137
+ count: number;
138
+ loaded: boolean;
139
+ visible: boolean;
140
+ scrollY: number;
141
+ scrollTimeout: NodeJS.Timeout | null;
142
+ };
143
+ protected _render: typeof renderPlayer;
144
+ protected _renderControls: typeof renderControls;
145
+ protected _seeker: number;
146
+ private _animations;
147
+ private _currentAnimation;
148
+ private _intersectionObserver?;
149
+ private _isBounce;
150
+ private _isDotLottie;
151
+ private _lottieInstance;
152
+ private _manifest?;
153
+ private _multiAnimationSettings;
154
+ private _segment?;
155
+ constructor();
156
+ addAnimation(_params: AddAnimationParams): Promise<Result>;
157
+ attributeChangedCallback(name: string, _oldValue: unknown, value: string): Promise<void>;
158
+ connectedCallback(): void;
159
+ convert(_params: ConvertParams): Promise<Result>;
160
+ destroy(): void;
161
+ disconnectedCallback(): void;
162
+ getLottie(): AnimationItem | null;
163
+ getManifest(): LottieManifest | undefined;
164
+ getMultiAnimationSettings(): AnimationSettings[];
165
+ getSegment(): Vector2 | undefined;
166
+ load(src: string | null): Promise<void>;
167
+ loadAnimation(_config: AnimationConfiguration): AnimationItem;
168
+ next(): void;
169
+ pause(): void;
170
+ play(): void;
171
+ prev(): void;
172
+ propertyChangedCallback(name: string, _oldValue: unknown, value: unknown): void;
173
+ reload(): Promise<void>;
174
+ seek(value: number | string): void;
175
+ setCount(value: number): void;
176
+ setDirection(value: AnimationDirection): void;
177
+ setLoop(value: boolean): void;
178
+ setMultiAnimationSettings(settings: AnimationSettings[]): void;
179
+ setSegment(segment: Vector2): void;
180
+ setSpeed(value?: number): void;
181
+ setSubframe(value: boolean): void;
182
+ snapshot(shouldDownload?: boolean, name?: string): string | null;
183
+ stop(): void;
184
+ toggleBoomerang(): void;
185
+ toggleLoop(): void;
186
+ togglePlay(): void;
187
+ protected _freeze(): void;
188
+ protected _handleBlur(): void;
189
+ protected _handleSeekChange({ target }: Event): void;
190
+ protected _handleSettingsClick({ target }: Event): void;
191
+ protected setOptions(_options: {
192
+ container?: HTMLElement;
193
+ rendererType: RendererType;
194
+ initialSegment?: Vector2;
195
+ hasAutoplay: boolean;
196
+ hasLoop: boolean;
197
+ preserveAspectRatio: PreserveAspectRatio;
198
+ }): AnimationConfiguration<RendererType.SVG | RendererType.Canvas | RendererType.HTML>;
199
+ private _addEventListeners;
200
+ private _addIntersectionObserver;
201
+ private _complete;
202
+ private _dataFailed;
203
+ private _dataReady;
204
+ private _DOMLoaded;
205
+ private _enterFrame;
206
+ private _getOptions;
207
+ private _handleScroll;
208
+ private _handleWindowBlur;
209
+ private _isLottie;
210
+ private _loopComplete;
211
+ private _mouseEnter;
212
+ private _mouseLeave;
213
+ private _onVisibilityChange;
214
+ private _removeEventListeners;
215
+ private _switchInstance;
216
+ private _toggleEventListeners;
217
+ private _toggleSettings;
218
+ }
219
+
220
+ declare class DotLottiePlayerLight extends DotLottiePlayerBase {
221
+ loadAnimation: typeof _aarsteinmedia_lottie_web_light.loadAnimation;
222
+ get renderer(): RendererType;
223
+ constructor();
224
+ protected setOptions({ container, hasAutoplay, hasLoop, initialSegment, preserveAspectRatio, }: {
225
+ container?: HTMLElement;
226
+ rendererType: RendererType;
227
+ initialSegment?: Vector2;
228
+ hasAutoplay: boolean;
229
+ hasLoop: boolean;
230
+ preserveAspectRatio: PreserveAspectRatio;
231
+ }): AnimationConfiguration<RendererType.SVG>;
232
+ }
233
+
234
+ export { PlayerState, DotLottiePlayerLight as default, tagName };