@dotlottie/react-player
Advanced tools
Comparing version 0.0.1-beta.5 to 0.0.1-beta.6
@@ -0,2 +1,249 @@ | ||
import React, { MutableRefObject } from 'react'; | ||
export { } | ||
type AnimationDirection$1 = 1 | -1; | ||
type BaseRendererConfig = { | ||
imagePreserveAspectRatio?: string; | ||
className?: string; | ||
}; | ||
type SVGRendererConfig = BaseRendererConfig & { | ||
title?: string; | ||
description?: string; | ||
preserveAspectRatio?: string; | ||
progressiveLoad?: boolean; | ||
hideOnTransparent?: boolean; | ||
viewBoxOnly?: boolean; | ||
viewBoxSize?: string; | ||
focusable?: boolean; | ||
filterSize?: FilterSizeConfig; | ||
}; | ||
type CanvasRendererConfig = BaseRendererConfig & { | ||
clearCanvas?: boolean; | ||
context?: CanvasRenderingContext2D; | ||
progressiveLoad?: boolean; | ||
preserveAspectRatio?: string; | ||
}; | ||
type HTMLRendererConfig = BaseRendererConfig & { | ||
hideOnTransparent?: boolean; | ||
}; | ||
type FilterSizeConfig = { | ||
width: string; | ||
height: string; | ||
x: string; | ||
y: string; | ||
}; | ||
/** | ||
* Copyright 2023 Design Barn Inc. | ||
*/ | ||
declare enum PlayerEvents { | ||
Complete = "complete", | ||
DataFail = "data_fail", | ||
DataReady = "data_ready", | ||
Error = "error", | ||
Frame = "frame", | ||
Freeze = "freeze", | ||
LoopComplete = "loopComplete", | ||
Pause = "pause", | ||
Play = "play", | ||
Ready = "ready", | ||
Stop = "stop" | ||
} | ||
declare enum PlayerState { | ||
Error = "error", | ||
Fetching = "fetching", | ||
Frozen = "frozen", | ||
Initial = "initial", | ||
Loading = "loading", | ||
Paused = "paused", | ||
Playing = "playing", | ||
Ready = "ready", | ||
Stopped = "stopped" | ||
} | ||
declare enum PlayMode { | ||
Bounce = "bounce", | ||
Normal = "normal" | ||
} | ||
interface ManifestAnimation { | ||
autoplay?: boolean; | ||
direction?: AnimationDirection$1; | ||
hover?: boolean; | ||
id: string; | ||
intermission?: number; | ||
loop?: boolean | number; | ||
playMode?: PlayMode; | ||
speed?: number; | ||
themeColor?: string; | ||
} | ||
type PlaybackOptions = Omit<ManifestAnimation, 'id'>; | ||
interface Manifest { | ||
activeAnimationId?: string; | ||
animations: ManifestAnimation[]; | ||
author?: string; | ||
custom?: Record<string, unknown>; | ||
description?: string; | ||
generator?: string; | ||
keywords?: string; | ||
revision?: number; | ||
version?: string; | ||
} | ||
type RendererSettings = SVGRendererConfig & CanvasRendererConfig & HTMLRendererConfig; | ||
declare global { | ||
interface Window { | ||
dotLottiePlayer: Record<string, Record<string, unknown>>; | ||
} | ||
} | ||
type AnimationDirection = 1 | -1; | ||
type AnimationSegment = [number, number]; | ||
type AnimationEventName = 'drawnFrame' | 'enterFrame' | 'loopComplete' | 'complete' | 'segmentStart' | 'destroy' | 'config_ready' | 'data_ready' | 'DOMLoaded' | 'error' | 'data_failed' | 'loaded_images'; | ||
type AnimationEventCallback<T = any> = (args: T) => void; | ||
/** Specifies the data for each event type. */ | ||
interface AnimationEvents { | ||
DOMLoaded: undefined; | ||
complete: BMCompleteEvent; | ||
config_ready: undefined; | ||
data_failed: undefined; | ||
data_ready: undefined; | ||
destroy: BMDestroyEvent; | ||
drawnFrame: BMEnterFrameEvent; | ||
enterFrame: BMEnterFrameEvent; | ||
error: undefined; | ||
loaded_images: undefined; | ||
loopComplete: BMCompleteLoopEvent; | ||
segmentStart: BMSegmentStartEvent; | ||
} | ||
interface BMCompleteEvent { | ||
direction: number; | ||
type: "complete"; | ||
} | ||
interface BMCompleteLoopEvent { | ||
currentLoop: number; | ||
direction: number; | ||
totalLoops: number; | ||
type: "loopComplete"; | ||
} | ||
interface BMDestroyEvent { | ||
type: "destroy"; | ||
} | ||
interface BMEnterFrameEvent { | ||
/** The current time in frames. */ | ||
currentTime: number; | ||
direction: number; | ||
/** The total number of frames. */ | ||
totalTime: number; | ||
type: "enterFrame"; | ||
} | ||
interface BMSegmentStartEvent { | ||
firstFrame: number; | ||
totalFrames: number; | ||
type: "segmentStart"; | ||
} | ||
type AnimationItem = { | ||
name: string; | ||
isLoaded: boolean; | ||
currentFrame: number; | ||
currentRawFrame: number; | ||
firstFrame: number; | ||
totalFrames: number; | ||
frameRate: number; | ||
frameMult: number; | ||
playSpeed: number; | ||
playDirection: number; | ||
playCount: number; | ||
isPaused: boolean; | ||
autoplay: boolean; | ||
loop: boolean | number; | ||
renderer: any; | ||
animationID: string; | ||
assetsPath: string; | ||
timeCompleted: number; | ||
segmentPos: number; | ||
isSubframeEnabled: boolean; | ||
segments: AnimationSegment | AnimationSegment[]; | ||
play(name?: string): void; | ||
stop(name?: string): void; | ||
togglePause(name?: string): void; | ||
destroy(name?: string): void; | ||
pause(name?: string): void; | ||
goToAndStop(value: number | string, isFrame?: boolean, name?: string): void; | ||
goToAndPlay(value: number | string, isFrame?: boolean, name?: string): void; | ||
includeLayers(data: any): void; | ||
setSegment(init: number, end: number): void; | ||
resetSegments(forceFlag: boolean): void; | ||
hide(): void; | ||
show(): void; | ||
resize(): void; | ||
setSpeed(speed: number): void; | ||
setDirection(direction: AnimationDirection): void; | ||
setLoop(isLooping: boolean): void; | ||
playSegments(segments: AnimationSegment | AnimationSegment[], forceFlag?: boolean): void; | ||
setSubframe(useSubFrames: boolean): void; | ||
getDuration(inFrames?: boolean): number; | ||
triggerEvent<T extends AnimationEventName>(name: T, args: AnimationEvents[T]): void; | ||
addEventListener<T extends AnimationEventName>(name: T, callback: AnimationEventCallback<AnimationEvents[T]>): () => void; | ||
removeEventListener<T extends AnimationEventName>(name: T, callback?: AnimationEventCallback<AnimationEvents[T]>): void; | ||
} | ||
/** | ||
* Copyright 2023 Design Barn Inc. | ||
*/ | ||
interface DotLottieRefProps { | ||
getLottie: () => AnimationItem | undefined; | ||
getManifest: () => Manifest | undefined; | ||
next: (options?: PlaybackOptions) => void; | ||
play: (indexOrId?: string | number, options?: PlaybackOptions) => void; | ||
previous: (options?: PlaybackOptions) => void; | ||
reset: () => void; | ||
} | ||
/** | ||
* Copyright 2023 Design Barn Inc. | ||
*/ | ||
interface DotLottiePlayerProps extends React.HTMLAttributes<HTMLDivElement> { | ||
activeAnimationId?: string; | ||
autoplay?: boolean; | ||
background?: string; | ||
className?: string; | ||
direction?: 1 | -1; | ||
hover?: boolean; | ||
intermission?: number; | ||
loop?: number | boolean; | ||
lottieRef?: MutableRefObject<DotLottieRefProps | undefined>; | ||
onEvent?: <T extends PlayerEvents>(name: T, params?: unknown) => void; | ||
playMode?: PlayMode; | ||
renderer?: 'svg' | 'canvas' | 'html'; | ||
rendererSettings?: RendererSettings; | ||
speed?: number; | ||
src: Record<string, unknown> | string; | ||
testId?: string; | ||
} | ||
declare const DotLottiePlayer: React.FC<DotLottiePlayerProps>; | ||
/** | ||
* Copyright 2023 Design Barn Inc. | ||
*/ | ||
declare const AVAILABLE_BUTTONS: readonly ["play", "stop", "loop"]; | ||
interface ControlsProps extends React.HTMLAttributes<HTMLDivElement> { | ||
buttons?: Array<typeof AVAILABLE_BUTTONS[number]>; | ||
show?: boolean; | ||
} | ||
declare const Controls: React.FC<ControlsProps>; | ||
export { Controls, DotLottiePlayer, DotLottiePlayerProps, DotLottieRefProps, Manifest, ManifestAnimation, PlayMode, PlayerEvents, PlayerState }; |
{ | ||
"name": "@dotlottie/react-player", | ||
"version": "0.0.1-beta.5", | ||
"version": "0.0.1-beta.6", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "dotlottie animation player react component.", |
@@ -183,3 +183,3 @@ # DotLottiePlayer React Component | ||
You can document the changes in detail and format them properly using Markdown by opening the ".md" file that the "yarn changeset" command created in the ".changeset" folder. Open the file, and it should look something like this: | ||
You can document the changes in detail and format them properly using Markdown by opening the ".md" file that the "pnpm changeset" command created in the ".changeset" folder. Open the file, and it should look something like this: | ||
@@ -186,0 +186,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
457609
1734
7
18