@rive-app/webgl-single 2.35.4 → 2.37.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl-single",
3
- "version": "2.35.4",
3
+ "version": "2.37.0",
4
4
  "description": "Rive's webgl based web api with bundled wasm.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import * as rc from "./rive_advanced.mjs";
2
+ import { RuntimeLoader, type RuntimeCallback } from "./runtimeLoader";
3
+ import { ImageWrapper, AudioWrapper, FontWrapper, RiveFont as RiveFontClassUtil } from "./utils";
2
4
  export type AssetLoadCallback = (asset: rc.FileAsset, bytes: Uint8Array) => Boolean;
5
+ export { RiveFontClassUtil as RiveFont };
3
6
  export type { FileAsset, AudioAsset, FontAsset, ImageAsset, } from "./rive_advanced.mjs";
4
7
  /**
5
8
  * Generic type for a parameterless void callback
@@ -65,20 +68,7 @@ export declare class Layout {
65
68
  runtimeFit(rive: rc.RiveCanvas): rc.Fit;
66
69
  runtimeAlignment(rive: rc.RiveCanvas): rc.Alignment;
67
70
  }
68
- export type RuntimeCallback = (rive: rc.RiveCanvas) => void;
69
- export declare class RuntimeLoader {
70
- private static runtime;
71
- private static isLoading;
72
- private static callBackQueue;
73
- private static rive;
74
- private static wasmURL;
75
- private constructor();
76
- private static loadRuntime;
77
- static getInstance(callback: RuntimeCallback): void;
78
- static awaitInstance(): Promise<rc.RiveCanvas>;
79
- static setWasmUrl(url: string): void;
80
- static getWasmUrl(): string;
81
- }
71
+ export { RuntimeLoader, type RuntimeCallback };
82
72
  export declare enum StateMachineInputType {
83
73
  Number = 56,
84
74
  Trigger = 58,
@@ -270,6 +260,13 @@ export interface RiveParameters {
270
260
  * Enum with drawing options for optimizations
271
261
  */
272
262
  drawingOptions?: DrawOptimizationOptions;
263
+ /**
264
+ * Emit performance.mark / performance.measure entries for load lifecycle
265
+ * events and the first 3 render frames. Useful for profiling Rive's
266
+ * contribution to load and render time in browser devtools.
267
+ * False by default.
268
+ */
269
+ enablePerfMarks?: boolean;
273
270
  onLoad?: EventCallback;
274
271
  onLoadError?: EventCallback;
275
272
  onPlay?: EventCallback;
@@ -334,6 +331,11 @@ export interface RiveFileParameters {
334
331
  enableRiveAssetCDN?: boolean;
335
332
  onLoad?: EventCallback;
336
333
  onLoadError?: EventCallback;
334
+ /**
335
+ * Emit performance.mark / performance.measure entries for load lifecycle
336
+ * events. False by default.
337
+ */
338
+ enablePerfMarks?: boolean;
337
339
  }
338
340
  export declare class RiveFile implements rc.FinalizableTarget {
339
341
  private static readonly missingErrorMessage;
@@ -344,6 +346,7 @@ export declare class RiveFile implements rc.FinalizableTarget {
344
346
  private file;
345
347
  private assetLoader;
346
348
  private enableRiveAssetCDN;
349
+ private enablePerfMarks;
347
350
  private eventManager;
348
351
  private referenceCount;
349
352
  private destroyed;
@@ -353,6 +356,8 @@ export declare class RiveFile implements rc.FinalizableTarget {
353
356
  private releaseFile;
354
357
  private releaseBindableArtboards;
355
358
  private initData;
359
+ private loadRiveFileBytes;
360
+ private loadRuntime;
356
361
  init(): Promise<void>;
357
362
  private fireLoadError;
358
363
  /**
@@ -436,6 +441,7 @@ export declare class Rive {
436
441
  private _viewModelInstance;
437
442
  private _dataEnums;
438
443
  private drawOptimization;
444
+ private enablePerfMarks;
439
445
  durations: number[];
440
446
  frameTimes: number[];
441
447
  frameCount: number;
@@ -918,6 +924,10 @@ export declare class ViewModelInstance {
918
924
  incrementReferenceCount(): void;
919
925
  decrementReferenceCount(): void;
920
926
  get properties(): rc.ViewModelProperty[];
927
+ /**
928
+ * Get the name of the ViewModel definition this instance was created from.
929
+ */
930
+ get viewModelName(): string;
921
931
  internalIncrementReferenceCount(): void;
922
932
  cleanup(): void;
923
933
  }
@@ -1037,18 +1047,18 @@ export declare const Testing: {
1037
1047
  * Be sure to call `.unref()` on the audio once it is no longer needed. This
1038
1048
  * allows the engine to clean it up when it is not used by any more animations.
1039
1049
  */
1040
- export declare const decodeAudio: (bytes: Uint8Array) => Promise<rc.Audio>;
1050
+ export declare const decodeAudio: (bytes: Uint8Array) => Promise<AudioWrapper>;
1041
1051
  /**
1042
1052
  * Decodes bytes into an image.
1043
1053
  *
1044
1054
  * Be sure to call `.unref()` on the image once it is no longer needed. This
1045
1055
  * allows the engine to clean it up when it is not used by any more animations.
1046
1056
  */
1047
- export declare const decodeImage: (bytes: Uint8Array) => Promise<rc.Image>;
1057
+ export declare const decodeImage: (bytes: Uint8Array) => Promise<ImageWrapper>;
1048
1058
  /**
1049
1059
  * Decodes bytes into a font.
1050
1060
  *
1051
1061
  * Be sure to call `.unref()` on the font once it is no longer needed. This
1052
1062
  * allows the engine to clean it up when it is not used by any more animations.
1053
1063
  */
1054
- export declare const decodeFont: (bytes: Uint8Array) => Promise<rc.Font>;
1064
+ export declare const decodeFont: (bytes: Uint8Array) => Promise<FontWrapper>;