@rive-app/canvas 2.27.2 → 2.27.4

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/canvas",
3
- "version": "2.27.2",
3
+ "version": "2.27.4",
4
4
  "description": "Rive's canvas based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as rc from "./rive_advanced.mjs";
2
- export type { FileAsset, AudioAsset, FontAsset, ImageAsset, } from "./rive_advanced.mjs";
2
+ import { ImageWrapper, AssetLoadCallbackWrapper } from "./utils";
3
+ export type { FileAssetWrapper as FileAsset, ImageAssetWrapper as ImageAsset, AudioAssetWrapper as AudioAsset, FontAssetWrapper as FontAsset, AssetLoadCallbackWrapper as AssetLoadCallback, } from "./utils";
3
4
  /**
4
5
  * Generic type for a parameterless void callback
5
6
  */
6
7
  export type VoidCallback = () => void;
7
- export type AssetLoadCallback = (asset: rc.FileAsset, bytes: Uint8Array) => Boolean;
8
8
  interface SetupRiveListenersOptions {
9
9
  isTouchScrollEnabled?: boolean;
10
10
  }
@@ -245,7 +245,7 @@ export interface RiveParameters {
245
245
  onLoop?: EventCallback;
246
246
  onStateChange?: EventCallback;
247
247
  onAdvance?: EventCallback;
248
- assetLoader?: AssetLoadCallback;
248
+ assetLoader?: AssetLoadCallbackWrapper;
249
249
  /**
250
250
  * @deprecated Use `onLoad()` instead
251
251
  */
@@ -297,7 +297,7 @@ export interface RiveResetParameters {
297
297
  export interface RiveFileParameters {
298
298
  src?: string;
299
299
  buffer?: ArrayBuffer;
300
- assetLoader?: AssetLoadCallback;
300
+ assetLoader?: AssetLoadCallbackWrapper;
301
301
  enableRiveAssetCDN?: boolean;
302
302
  onLoad?: EventCallback;
303
303
  onLoadError?: EventCallback;
@@ -805,6 +805,12 @@ export declare class ViewModelInstance {
805
805
  * @param path - path to the list property
806
806
  */
807
807
  list(path: string): ViewModelInstanceList | null;
808
+ /**
809
+ * method to access a view model property instance belonging
810
+ * to the view model instance or to a nested view model instance
811
+ * @param path - path to the image property
812
+ */
813
+ image(path: string): ViewModelInstanceAssetImage | null;
808
814
  /**
809
815
  * method to access a view model property instance belonging
810
816
  * to the view model instance or to a nested view model instance
@@ -889,6 +895,11 @@ export declare class ViewModelInstanceColor extends ViewModelInstanceValue {
889
895
  opacity(o: number): void;
890
896
  internalHandleCallback(callback: Function): void;
891
897
  }
898
+ export declare class ViewModelInstanceAssetImage extends ViewModelInstanceValue {
899
+ constructor(instance: rc.ViewModelInstanceAssetImage, root: ViewModelInstance);
900
+ set value(image: ImageWrapper);
901
+ internalHandleCallback(callback: Function): void;
902
+ }
892
903
  /**
893
904
  * Contents of a state machine input
894
905
  */
@@ -935,7 +946,7 @@ export declare const decodeAudio: (bytes: Uint8Array) => Promise<rc.Audio>;
935
946
  * Be sure to call `.unref()` on the image once it is no longer needed. This
936
947
  * allows the engine to clean it up when it is not used by any more animations.
937
948
  */
938
- export declare const decodeImage: (bytes: Uint8Array) => Promise<rc.Image>;
949
+ export declare const decodeImage: (bytes: Uint8Array) => Promise<ImageWrapper>;
939
950
  /**
940
951
  * Decodes bytes into a font.
941
952
  *