UNPKG

@aarsteinmedia/dotlottie-player

Version:

Web Component for playing Lottie animations in your web app.

186 lines (179 loc) 7.15 kB
import { HTMLBooleanAttribute, AnimationData, AnimationDirection, AddAnimationParams, Result, ConvertParams, AnimationItem, LottieManifest, AnimationSettings, Vector2, AnimationConfiguration } from '@aarsteinmedia/lottie-web'; import { PlayMode, PreserveAspectRatio, RendererType } from '@aarsteinmedia/lottie-web/utils'; declare abstract class PropertyCallbackElement extends HTMLElement { constructor(); connectedCallback(): void; propertyChangedCallback(_name: string, _oldValue: unknown, _value: unknown): void; } declare function renderControls(this: DotLottiePlayerBase): void; declare function renderPlayer(this: DotLottiePlayerBase): Promise<void>; declare enum MouseOut { Pause = "pause", Reverse = "reverse", Stop = "stop", Void = "void" } declare enum PlayerState { Completed = "completed", Destroyed = "destroyed", Error = "error", Frozen = "frozen", Loading = "loading", Paused = "paused", Playing = "playing", Stopped = "stopped" } declare const tagName = "dotlottie-player"; declare abstract class DotLottiePlayerBase extends PropertyCallbackElement { static get observedAttributes(): readonly ["animateOnScroll", "autoplay", "controls", "direction", "hover", "loop", "mode", "playOnClick", "playOnVisible", "selector", "speed", "src", "subframe"]; static get observedProperties(): readonly ["playerState", "_isSettingsOpen", "_seeker", "_currentAnimation", "_animations"]; static get styles(): () => Promise<CSSStyleSheet>; isLight: boolean; playerState: PlayerState; shadow: ShadowRoot | undefined; source?: string; template?: HTMLTemplateElement; set animateOnScroll(value: HTMLBooleanAttribute); get animateOnScroll(): HTMLBooleanAttribute; get animations(): AnimationData[]; set autoplay(value: HTMLBooleanAttribute); get autoplay(): HTMLBooleanAttribute; set background(value: string); get background(): string; set controls(value: HTMLBooleanAttribute); get controls(): HTMLBooleanAttribute; set count(value: number); get count(): number; get currentAnimation(): number; set delay(value: number); get delay(): number; set description(value: string | null); get description(): string | null; set direction(value: AnimationDirection); get direction(): AnimationDirection; set dontFreezeOnBlur(value: HTMLBooleanAttribute); get dontFreezeOnBlur(): HTMLBooleanAttribute; set hover(value: HTMLBooleanAttribute); get hover(): HTMLBooleanAttribute; set intermission(value: number); get intermission(): number; get isDotLottie(): boolean; set loop(value: HTMLBooleanAttribute); get loop(): HTMLBooleanAttribute; set mode(value: PlayMode); get mode(): PlayMode; set mouseout(value: MouseOut); get mouseout(): MouseOut; set objectfit(value: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'); get objectfit(): "contain" | "cover" | "fill" | "none" | "scale-down"; set once(value: HTMLBooleanAttribute); get once(): HTMLBooleanAttribute; set playOnClick(value: HTMLBooleanAttribute); get playOnClick(): HTMLBooleanAttribute; set playOnVisible(value: HTMLBooleanAttribute); get playOnVisible(): HTMLBooleanAttribute; set preserveAspectRatio(value: PreserveAspectRatio | null); get preserveAspectRatio(): PreserveAspectRatio | null; set renderer(value: RendererType); get renderer(): RendererType; set selector(value: string | null); get selector(): string | null; set simple(value: HTMLBooleanAttribute); get simple(): HTMLBooleanAttribute; set speed(value: number); get speed(): number; set src(value: string | null); get src(): string | null; set subframe(value: HTMLBooleanAttribute); get subframe(): HTMLBooleanAttribute; protected _container: HTMLElement | null; protected _DOMRect: DOMRect | null; protected _errorMessage: string; protected _identifier: string; protected _isSettingsOpen: boolean; protected _playerState: { prev: PlayerState; count: number; loaded: boolean; visible: boolean; scrollY: number; scrollTimeout: NodeJS.Timeout | null; }; protected _render: typeof renderPlayer; protected _renderControls: typeof renderControls; protected _seeker: number; private _animations; private _currentAnimation; private _intersectionObserver?; private _isBounce; private _isDotLottie; private _lottieInstance; private _manifest?; private _multiAnimationSettings; private _segment?; constructor(); addAnimation(_params: AddAnimationParams): Promise<Result>; attributeChangedCallback(name: typeof DotLottiePlayerBase.observedAttributes[number], _oldValue: unknown, value: string): Promise<void>; connectedCallback(): void; convert(_params: ConvertParams): Promise<Result>; destroy(): void; disconnectedCallback(): void; getLottie(): AnimationItem | null; getManifest(): LottieManifest | undefined; getMultiAnimationSettings(): AnimationSettings[]; getSegment(): Vector2 | undefined; load(src: string | null): Promise<void>; loadAnimation(_config: AnimationConfiguration): AnimationItem; next(): void; pause(): void; play(): void; prev(): void; propertyChangedCallback(name: string, _oldValue: unknown, value: unknown): void; reload(): Promise<void>; seek(value: number | string): void; setCount(value: number): void; setDirection(value: AnimationDirection): void; setLoop(value: boolean): void; setMultiAnimationSettings(settings: AnimationSettings[]): void; setSegment(segment: Vector2): void; setSpeed(value?: number): void; setSubframe(value: boolean): void; snapshot(shouldDownload?: boolean, name?: string): string | null; stop(): void; toggleBoomerang(): void; toggleLoop(): void; togglePlay(): void; protected _freeze(): void; protected _handleBlur(): void; protected _handleClick(): void; protected _handleSeekChange({ target }: Event): void; protected _handleSettingsClick({ target }: Event): void; protected setOptions(_options: { container?: undefined | HTMLElement; rendererType: RendererType; initialSegment?: undefined | Vector2; hasAutoplay: boolean; hasLoop: boolean; preserveAspectRatio: PreserveAspectRatio; }): AnimationConfiguration; private _addEventListeners; private _addIntersectionObserver; private _complete; private _dataFailed; private _dataReady; private _DOMLoaded; private _enterFrame; private _getOptions; private _handleScroll; private _handleWindowBlur; private _intersectionObserverFallback; private _loopComplete; private _mouseEnter; private _mouseLeave; private _onVisibilityChange; private _removeEventListeners; private _switchInstance; private _toggleEventListeners; private _toggleSettings; } export { DotLottiePlayerBase as D, MouseOut as M, PlayerState as P, tagName as t };