@rive-app/canvas 2.50.0 → 2.52.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 +1 -1
- package/rive.d.ts +68 -1
- package/rive.js +1002 -461
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +41 -9
- package/rive_fallback.wasm +0 -0
- package/runtimeLoader.d.ts +4 -6
- package/utils/gamepadInteractions.d.ts +9 -2
- package/utils/registerKeyboardInteractions.d.ts +4 -1
- package/utils/registerTouchInteractions.d.ts +2 -1
- package/utils/riveFont.d.ts +10 -1
- package/utils/wheelMomentum.d.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rive-app/canvas",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.52.0",
|
|
4
4
|
"description": "Rive web runtime with the canvas renderer. 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
|
@@ -119,7 +119,8 @@ export declare enum StateMachineInputType {
|
|
|
119
119
|
export declare class StateMachineInput {
|
|
120
120
|
readonly type: StateMachineInputType;
|
|
121
121
|
private runtimeInput;
|
|
122
|
-
|
|
122
|
+
private onChange?;
|
|
123
|
+
constructor(type: StateMachineInputType, runtimeInput: rc.SMIInput, onChange?: () => void);
|
|
123
124
|
/**
|
|
124
125
|
* Returns the name of the input
|
|
125
126
|
*/
|
|
@@ -370,6 +371,13 @@ export interface RiveParameters {
|
|
|
370
371
|
* enabled by default.
|
|
371
372
|
*/
|
|
372
373
|
enableRiveAssetCDN?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Decode parts of the file the first time they're used instead of at import.
|
|
376
|
+
* Only applies when this instance loads its own file (`src`/`buffer`), where it
|
|
377
|
+
* is forwarded to that file as {@link RiveFileParameters.deferDecoding}. With a
|
|
378
|
+
* supplied `riveFile` the file's own flag wins. False by default.
|
|
379
|
+
*/
|
|
380
|
+
deferDecoding?: boolean;
|
|
373
381
|
/**
|
|
374
382
|
* @experimental This API is early and may encounter breaking behavior change without a major version bump
|
|
375
383
|
*
|
|
@@ -432,6 +440,17 @@ export interface RiveParameters {
|
|
|
432
440
|
* Enum with drawing options for optimizations
|
|
433
441
|
*/
|
|
434
442
|
drawingOptions?: DrawOptimizationOptions;
|
|
443
|
+
/**
|
|
444
|
+
* Stop the render loop once every playing state machine has nothing left to
|
|
445
|
+
* animate, and restart it when something changes: pointer, keyboard, focus
|
|
446
|
+
* or gamepad input, state machine inputs, view model values, text runs,
|
|
447
|
+
* assets, layout or size. While stopped, `isSettled` is true and nothing is
|
|
448
|
+
* advanced or drawn. Changes the runtime can't see (for example writing
|
|
449
|
+
* `canvas.width` directly) need a `drawFrame()` call. Linear animations
|
|
450
|
+
* without a state machine never settle. Defaults to false, but will be enabled
|
|
451
|
+
* by default in the next major version.
|
|
452
|
+
*/
|
|
453
|
+
enableSettling?: boolean;
|
|
435
454
|
/**
|
|
436
455
|
* @experimental This API is early and may encounter breaking behavior change without a major version bump
|
|
437
456
|
*
|
|
@@ -580,6 +599,21 @@ export interface RiveFileParameters {
|
|
|
580
599
|
buffer?: ArrayBuffer;
|
|
581
600
|
assetLoader?: AssetLoadCallback;
|
|
582
601
|
enableRiveAssetCDN?: boolean;
|
|
602
|
+
/**
|
|
603
|
+
* Decode parts of the file the first time they're used instead of at import,
|
|
604
|
+
* keeping a copy of their bytes until then. Speeds up loading files with many
|
|
605
|
+
* artboards, animations or view model instances when only some of them are used:
|
|
606
|
+
*
|
|
607
|
+
* - Animations decode the first time they're played.
|
|
608
|
+
* - Artboards decode the first time they're instanced. The default artboard
|
|
609
|
+
* (the first) still decodes at import.
|
|
610
|
+
* - View model instances decode the first time they're handed out. Their names
|
|
611
|
+
* and counts are read without decoding.
|
|
612
|
+
*
|
|
613
|
+
* Listing a file's {@link Rive.contents} decodes every artboard. Fixed at import.
|
|
614
|
+
* False by default.
|
|
615
|
+
*/
|
|
616
|
+
deferDecoding?: boolean;
|
|
583
617
|
onLoad?: EventCallback;
|
|
584
618
|
onLoadError?: EventCallback;
|
|
585
619
|
/**
|
|
@@ -610,6 +644,7 @@ export declare class RiveFile implements rc.FinalizableTarget {
|
|
|
610
644
|
private file;
|
|
611
645
|
private assetLoader;
|
|
612
646
|
private enableRiveAssetCDN;
|
|
647
|
+
private deferDecoding;
|
|
613
648
|
private enablePerfMarks;
|
|
614
649
|
private eventManager;
|
|
615
650
|
private referenceCount;
|
|
@@ -760,6 +795,7 @@ export declare class Rive {
|
|
|
760
795
|
private dispatchPointerExit;
|
|
761
796
|
private enableMultiTouch;
|
|
762
797
|
private enableRiveAssetCDN;
|
|
798
|
+
private deferDecoding;
|
|
763
799
|
private semanticsMode;
|
|
764
800
|
private semanticsOptions;
|
|
765
801
|
/** True when this instance may drain semantics and render the overlay. */
|
|
@@ -776,6 +812,10 @@ export declare class Rive {
|
|
|
776
812
|
private _boundDraw;
|
|
777
813
|
private _pageVisibilityHandler;
|
|
778
814
|
private _explicitlyStoppedRendering;
|
|
815
|
+
private _enableSettling;
|
|
816
|
+
private _wakeGeneration;
|
|
817
|
+
private readonly _wakeFromViewModel;
|
|
818
|
+
private static wakeSettledInstances;
|
|
779
819
|
private _viewModelInstance;
|
|
780
820
|
private _globalViewModelInstances;
|
|
781
821
|
private _dataEnums;
|
|
@@ -895,6 +935,7 @@ export declare class Rive {
|
|
|
895
935
|
*
|
|
896
936
|
* @param elapsedTime time to advance the state machine by
|
|
897
937
|
* @param frameTime the rAF timestamp; omitted by pointer drains, which skip gamepad polling.
|
|
938
|
+
* @returns false when only state machines are playing and none has anything left to animate
|
|
898
939
|
*/
|
|
899
940
|
private advanceAndReportChanges;
|
|
900
941
|
/**
|
|
@@ -1249,6 +1290,22 @@ export declare class Rive {
|
|
|
1249
1290
|
* renderer is already active, then this will have zero effect.
|
|
1250
1291
|
*/
|
|
1251
1292
|
startRendering(): void;
|
|
1293
|
+
/**
|
|
1294
|
+
* True while `enableSettling` has stopped the render loop because every
|
|
1295
|
+
* playing state machine has nothing left to animate. Not set by `pause()`
|
|
1296
|
+
* or `stopRendering()`.
|
|
1297
|
+
*/
|
|
1298
|
+
get isSettled(): boolean;
|
|
1299
|
+
private get isInSettledInstances();
|
|
1300
|
+
private addToSettledInstances;
|
|
1301
|
+
private removeFromSettledInstances;
|
|
1302
|
+
private removeFromSettledInstancesIfNotPlaying;
|
|
1303
|
+
/** Whether the loop needs another frame: always, unless settled with no gamepad to poll. */
|
|
1304
|
+
private get needsNextFrame();
|
|
1305
|
+
/** The state machine that receives gamepad input. */
|
|
1306
|
+
private get gamepadStateMachine();
|
|
1307
|
+
/** Records a change, and restarts the loop if it stopped because it settled. */
|
|
1308
|
+
private wake;
|
|
1252
1309
|
private scheduleRendering;
|
|
1253
1310
|
/**
|
|
1254
1311
|
* Called when document.visibilitychange fires (tab change, window minimize, etc.).
|
|
@@ -1332,6 +1389,9 @@ export declare class Rive {
|
|
|
1332
1389
|
* to batch multiple changes into a single rebind.
|
|
1333
1390
|
*/
|
|
1334
1391
|
setViewModelInstance(viewModelInstance: ViewModelInstance | null): void;
|
|
1392
|
+
/** Takes a reference to `next` in place of `previous`; with settling on, writes to `next` wake this instance. */
|
|
1393
|
+
private holdViewModelInstance;
|
|
1394
|
+
private releaseViewModelInstance;
|
|
1335
1395
|
/**
|
|
1336
1396
|
* Applies any pending `set*` view model instance changes by rebinding the
|
|
1337
1397
|
* data binds once.
|
|
@@ -1422,11 +1482,16 @@ export declare class ViewModelInstance {
|
|
|
1422
1482
|
private _viewModelInstances;
|
|
1423
1483
|
private _propertiesWithCallbacks;
|
|
1424
1484
|
private _referenceCount;
|
|
1485
|
+
private _wakeCallbacks;
|
|
1425
1486
|
selfUnref: boolean;
|
|
1426
1487
|
constructor(runtimeInstance: rc.ViewModelInstance, parent: ViewModelInstance | null);
|
|
1427
1488
|
get runtimeInstance(): rc.ViewModelInstance | null;
|
|
1428
1489
|
get nativeInstance(): rc.ViewModelInstance | null;
|
|
1429
1490
|
handleCallbacks(): void;
|
|
1491
|
+
internalAddWakeCallback(callback: () => void): void;
|
|
1492
|
+
internalRemoveWakeCallback(callback: () => void): void;
|
|
1493
|
+
internalWake(): void;
|
|
1494
|
+
private wakeOwners;
|
|
1430
1495
|
addParent(parent: ViewModelInstance): void;
|
|
1431
1496
|
removeParent(parent: ViewModelInstance): void;
|
|
1432
1497
|
addToPropertyCallbacks(property: ViewModelInstanceValue): void;
|
|
@@ -1529,6 +1594,8 @@ export declare class ViewModelInstanceValue {
|
|
|
1529
1594
|
on(callback: EventCallback): void;
|
|
1530
1595
|
off(callback?: EventCallback): void;
|
|
1531
1596
|
internalHandleCallback(callback: Function): void;
|
|
1597
|
+
/** Wakes every Rive instance the owning view model instance is bound to. */
|
|
1598
|
+
protected wakeOwners(): void;
|
|
1532
1599
|
handleCallbacks(): void;
|
|
1533
1600
|
clearChanges(): void;
|
|
1534
1601
|
clearCallbacks(): void;
|