@rive-app/canvas-single 2.49.4 → 2.51.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/canvas-single",
3
- "version": "2.49.4",
3
+ "version": "2.51.0",
4
4
  "description": "Rive web runtime with the canvas renderer, bundled as a single JS file. Rive is an agent-native 2D and 3D engine for games, apps, and interactive UI.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as rc from "./rive_advanced.mjs";
2
- import { RuntimeLoader, type RuntimeCallback } from "./runtimeLoader";
2
+ import { RuntimeLoader, type RuntimeCallback, type ScriptFetchOptions } from "./runtimeLoader";
3
3
  import { SemanticTreeModel, AccessibilityOverlay, SemanticMode, type RiveSemanticsOptions } from "./semantics";
4
4
  import { ImageWrapper, AudioWrapper, FontWrapper, RiveFont as RiveFontClassUtil } from "./utils";
5
5
  export type AssetLoadCallback = (asset: rc.FileAsset, bytes: Uint8Array) => boolean;
@@ -97,7 +97,7 @@ export declare class Layout {
97
97
  runtimeFit(rive: rc.RiveCanvas): rc.Fit;
98
98
  runtimeAlignment(rive: rc.RiveCanvas): rc.Alignment;
99
99
  }
100
- export { RuntimeLoader, type RuntimeCallback };
100
+ export { RuntimeLoader, type RuntimeCallback, type ScriptFetchOptions };
101
101
  /**
102
102
  * @deprecated State machine inputs are deprecated and will be removed in a
103
103
  * future major version: please use data binding properties instead. See
@@ -370,6 +370,13 @@ export interface RiveParameters {
370
370
  * enabled by default.
371
371
  */
372
372
  enableRiveAssetCDN?: boolean;
373
+ /**
374
+ * Decode parts of the file the first time they're used instead of at import.
375
+ * Only applies when this instance loads its own file (`src`/`buffer`), where it
376
+ * is forwarded to that file as {@link RiveFileParameters.deferDecoding}. With a
377
+ * supplied `riveFile` the file's own flag wins. False by default.
378
+ */
379
+ deferDecoding?: boolean;
373
380
  /**
374
381
  * @experimental This API is early and may encounter breaking behavior change without a major version bump
375
382
  *
@@ -580,6 +587,21 @@ export interface RiveFileParameters {
580
587
  buffer?: ArrayBuffer;
581
588
  assetLoader?: AssetLoadCallback;
582
589
  enableRiveAssetCDN?: boolean;
590
+ /**
591
+ * Decode parts of the file the first time they're used instead of at import,
592
+ * keeping a copy of their bytes until then. Speeds up loading files with many
593
+ * artboards, animations or view model instances when only some of them are used:
594
+ *
595
+ * - Animations decode the first time they're played.
596
+ * - Artboards decode the first time they're instanced. The default artboard
597
+ * (the first) still decodes at import.
598
+ * - View model instances decode the first time they're handed out. Their names
599
+ * and counts are read without decoding.
600
+ *
601
+ * Listing a file's {@link Rive.contents} decodes every artboard. Fixed at import.
602
+ * False by default.
603
+ */
604
+ deferDecoding?: boolean;
583
605
  onLoad?: EventCallback;
584
606
  onLoadError?: EventCallback;
585
607
  /**
@@ -610,6 +632,7 @@ export declare class RiveFile implements rc.FinalizableTarget {
610
632
  private file;
611
633
  private assetLoader;
612
634
  private enableRiveAssetCDN;
635
+ private deferDecoding;
613
636
  private enablePerfMarks;
614
637
  private eventManager;
615
638
  private referenceCount;
@@ -760,6 +783,7 @@ export declare class Rive {
760
783
  private dispatchPointerExit;
761
784
  private enableMultiTouch;
762
785
  private enableRiveAssetCDN;
786
+ private deferDecoding;
763
787
  private semanticsMode;
764
788
  private semanticsOptions;
765
789
  /** True when this instance may drain semantics and render the overlay. */