@rive-app/canvas
Advanced tools
Comparing version 2.4.4 to 2.5.0
{ | ||
"name": "@rive-app/canvas", | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"description": "Rive's canvas based web api.", | ||
@@ -5,0 +5,0 @@ "main": "rive.js", |
@@ -19,2 +19,3 @@ interface RiveOptions { | ||
StateMachineInstance: typeof StateMachineInstance; | ||
CustomFileAssetLoader: typeof CustomFileAssetLoader; | ||
Mat2D: typeof Mat2D; | ||
@@ -32,2 +33,4 @@ Vec2D: typeof Vec2D; | ||
StrokeJoin: typeof StrokeJoin; | ||
decodeImage: Function; | ||
decodeFont: Function; | ||
@@ -38,5 +41,11 @@ /** | ||
* @param buffer - Array buffer of a Rive file | ||
* @param assetLoader - FileAssetLoader used to optionally customize loading of font and image assets | ||
* @param enableRiveAssetCDN - boolean flag to allow loading assets from the Rive CDN, enabled by default. | ||
* @returns A Promise for a Rive File class | ||
*/ | ||
load(buffer: Uint8Array): Promise<File>; | ||
load( | ||
buffer: Uint8Array, | ||
assetLoader?: FileAssetLoader, | ||
enableRiveAssetCDN?: boolean, | ||
): Promise<File>; | ||
@@ -55,3 +64,3 @@ /** | ||
canvas: HTMLCanvasElement | OffscreenCanvas, | ||
useOffscreenRenderer?: boolean | ||
useOffscreenRenderer?: boolean, | ||
): WrappedRenderer; | ||
@@ -72,3 +81,3 @@ | ||
frame: AABB, | ||
content: AABB | ||
content: AABB, | ||
): Mat2D; | ||
@@ -166,3 +175,3 @@ mapXY(matrix: Mat2D, canvasPoints: Vec2D): Vec2D; | ||
x: number, | ||
y: number | ||
y: number, | ||
): void; | ||
@@ -210,19 +219,20 @@ close(): void; | ||
constructor( | ||
ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | ||
ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, | ||
); | ||
} | ||
type OmittedCanvasRenderingContext2DMethods = "createConicGradient" | | ||
"createImageData" | | ||
"createLinearGradient" | | ||
"createPattern" | | ||
"createRadialGradient" | | ||
"getContextAttributes" | | ||
"getImageData" | | ||
"getLineDash" | | ||
"getTransform" | | ||
"isContextLost" | | ||
"isPointInPath" | | ||
"isPointInStroke" | | ||
"measureText"; | ||
type OmittedCanvasRenderingContext2DMethods = | ||
| "createConicGradient" | ||
| "createImageData" | ||
| "createLinearGradient" | ||
| "createPattern" | ||
| "createRadialGradient" | ||
| "getContextAttributes" | ||
| "getImageData" | ||
| "getLineDash" | ||
| "getTransform" | ||
| "isContextLost" | ||
| "isPointInPath" | ||
| "isPointInStroke" | ||
| "measureText"; | ||
@@ -234,7 +244,8 @@ /** | ||
* Canvas2D context directly. | ||
* | ||
* | ||
* Note: Currently, any calls to the Canvas2D context that you expect to return a value (i.e. `isPointInStroke()`) | ||
* will return undefined | ||
*/ | ||
export type CanvasRendererProxy = CanvasRenderer & Omit<CanvasRenderingContext2D, OmittedCanvasRenderingContext2DMethods>; | ||
export type CanvasRendererProxy = CanvasRenderer & | ||
Omit<CanvasRenderingContext2D, OmittedCanvasRenderingContext2DMethods>; | ||
@@ -249,3 +260,3 @@ /** | ||
ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, | ||
path: RenderPath | ||
path: RenderPath, | ||
): void; | ||
@@ -852,1 +863,17 @@ } | ||
} | ||
export declare class FileAsset { | ||
name: string; | ||
fileExtension: string; | ||
isImage: boolean; | ||
isFont: boolean; | ||
cdnUuid: boolean; | ||
} | ||
export declare class FileAssetLoader { | ||
} | ||
export declare class CustomFileAssetLoader extends FileAssetLoader { | ||
constructor({loadContents}: {loadContents:Function}); | ||
loadContents(asset: FileAsset, bytes:any): boolean; | ||
} |
@@ -6,2 +6,3 @@ import * as rc from "./rive_advanced.mjs"; | ||
export type VoidCallback = () => void; | ||
export type AssetLoadCallback = (asset: rc.FileAsset, bytes: Uint8Array) => Boolean; | ||
/** | ||
@@ -194,2 +195,7 @@ * Type for artboard bounds | ||
/** | ||
* Allow the runtime to automatically load assets hosted in Rive's CDN. | ||
* enabled by default. | ||
*/ | ||
enableRiveAssetCDN?: boolean; | ||
/** | ||
* Turn off Rive Listeners. This means state machines that have Listeners | ||
@@ -220,2 +226,3 @@ * will not be invoked, and also, no event listeners pertaining to Listeners | ||
onAdvance?: EventCallback; | ||
assetLoader?: AssetLoadCallback; | ||
/** | ||
@@ -288,5 +295,7 @@ * @deprecated Use `onLoad()` instead | ||
private animator; | ||
private assetLoader; | ||
private static readonly missingErrorMessage; | ||
private shouldDisableRiveListeners; | ||
private automaticallyHandleEvents; | ||
private enableRiveAssetCDN; | ||
durations: number[]; | ||
@@ -531,2 +540,4 @@ frameTimes: number[]; | ||
}; | ||
export declare const decodeImage: (bytes: Uint8Array) => Promise<any>; | ||
export declare const decodeFont: (bytes: Uint8Array) => Promise<any>; | ||
export {}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1134200
3792