@rive-app/canvas-single 2.40.1 → 2.41.1
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 +206 -5
- package/rive.js +323 -33
- package/rive.js.map +1 -1
- package/rive_advanced.mjs.d.ts +27 -12
- package/semantics/index.d.ts +1 -1
- package/semantics/types.d.ts +15 -2
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -87,6 +87,12 @@ export declare class Layout {
|
|
|
87
87
|
runtimeAlignment(rive: rc.RiveCanvas): rc.Alignment;
|
|
88
88
|
}
|
|
89
89
|
export { RuntimeLoader, type RuntimeCallback };
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated State machine inputs are deprecated and will be removed in a
|
|
92
|
+
* future major version: please use data binding properties instead. See
|
|
93
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
94
|
+
* for how to migrate.
|
|
95
|
+
*/
|
|
90
96
|
export declare enum StateMachineInputType {
|
|
91
97
|
Number = 56,
|
|
92
98
|
Trigger = 58,
|
|
@@ -94,6 +100,10 @@ export declare enum StateMachineInputType {
|
|
|
94
100
|
}
|
|
95
101
|
/**
|
|
96
102
|
* An input for a state machine
|
|
103
|
+
* @deprecated State machine inputs are deprecated and will be removed in a
|
|
104
|
+
* future major version: please use data binding properties instead. See
|
|
105
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
106
|
+
* for how to migrate.
|
|
97
107
|
*/
|
|
98
108
|
export declare class StateMachineInput {
|
|
99
109
|
readonly type: StateMachineInputType;
|
|
@@ -120,6 +130,11 @@ export declare class StateMachineInput {
|
|
|
120
130
|
*/
|
|
121
131
|
delete(): void;
|
|
122
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated Rive Events are deprecated and will be removed in a future major
|
|
135
|
+
* version: please use data binding instead. See
|
|
136
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
137
|
+
*/
|
|
123
138
|
export declare enum RiveEventType {
|
|
124
139
|
General = 128,
|
|
125
140
|
OpenUrl = 131
|
|
@@ -150,13 +165,37 @@ export declare enum EventType {
|
|
|
150
165
|
Play = "play",
|
|
151
166
|
Pause = "pause",
|
|
152
167
|
Stop = "stop",
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated Loop events are deprecated and will be removed in a future
|
|
170
|
+
* major version: they are only reported for linear animation playback, which
|
|
171
|
+
* is deprecated. Use a state machine to control playback and data binding to
|
|
172
|
+
* react to changes instead. See
|
|
173
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
|
|
174
|
+
* to migrate.
|
|
175
|
+
*/
|
|
153
176
|
Loop = "loop",
|
|
154
177
|
Draw = "draw",
|
|
155
178
|
Advance = "advance",
|
|
179
|
+
/**
|
|
180
|
+
* @deprecated State change events are deprecated and will be removed in a
|
|
181
|
+
* future major version. Use data binding (view model property observers) or
|
|
182
|
+
* state machine actions to react to changes from your graphic instead. See
|
|
183
|
+
* {@link https://rive.app/docs/editor/state-machine/states#actions} for more details.
|
|
184
|
+
*/
|
|
156
185
|
StateChange = "statechange",
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Rive Events are deprecated and will be removed in a future
|
|
188
|
+
* major version: please use data binding instead. See
|
|
189
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
190
|
+
*/
|
|
157
191
|
RiveEvent = "riveevent",
|
|
158
192
|
AudioStatusChange = "audiostatuschange"
|
|
159
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* @deprecated Rive Events are deprecated and will be removed in a future major
|
|
196
|
+
* version: please use data binding instead. See
|
|
197
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
198
|
+
*/
|
|
160
199
|
export type RiveEventPayload = rc.RiveEvent | rc.OpenUrlEvent;
|
|
161
200
|
export interface Event {
|
|
162
201
|
type: EventType;
|
|
@@ -164,6 +203,10 @@ export interface Event {
|
|
|
164
203
|
}
|
|
165
204
|
/**
|
|
166
205
|
* Looping types: one-shot, loop, and ping-pong
|
|
206
|
+
* @deprecated Loop events are deprecated and will be removed in a future major
|
|
207
|
+
* version: they are only reported for linear animation playback, which is
|
|
208
|
+
* deprecated. Use a state machine to control playback and data binding to
|
|
209
|
+
* react to changes instead.
|
|
167
210
|
*/
|
|
168
211
|
export declare enum LoopType {
|
|
169
212
|
OneShot = "oneshot",// has value 0 in runtime
|
|
@@ -172,6 +215,10 @@ export declare enum LoopType {
|
|
|
172
215
|
}
|
|
173
216
|
/**
|
|
174
217
|
* Loop events are returned through onloop callbacks
|
|
218
|
+
* @deprecated Loop events are deprecated and will be removed in a future major
|
|
219
|
+
* version: they are only reported for linear animation playback, which is
|
|
220
|
+
* deprecated. Use a state machine to control playback and data binding to
|
|
221
|
+
* react to changes instead.
|
|
175
222
|
*/
|
|
176
223
|
export interface LoopEvent {
|
|
177
224
|
animation: string;
|
|
@@ -224,11 +271,40 @@ declare class TaskQueueManager {
|
|
|
224
271
|
}
|
|
225
272
|
export interface RiveParameters {
|
|
226
273
|
canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
274
|
+
/**
|
|
275
|
+
* URI of the `.riv` file to load. Will be fetched by the runtime. Can be used instead of
|
|
276
|
+
* `buffer` or `riveFile`.
|
|
277
|
+
*/
|
|
227
278
|
src?: string;
|
|
279
|
+
/**
|
|
280
|
+
* ArrayBuffer of .riv file contents. Can be used instead of `src` or `riveFile` if you
|
|
281
|
+
* fetch the file contents yourself.
|
|
282
|
+
*/
|
|
228
283
|
buffer?: ArrayBuffer;
|
|
284
|
+
/**
|
|
285
|
+
* RiveFile instance if created separately. Useful if you reuse a Rive file across multiple instances.
|
|
286
|
+
* Can be used instead of `src` or `buffer`.
|
|
287
|
+
*/
|
|
229
288
|
riveFile?: RiveFile;
|
|
289
|
+
/**
|
|
290
|
+
* Name of the artboard to display.
|
|
291
|
+
*/
|
|
230
292
|
artboard?: string;
|
|
293
|
+
/**
|
|
294
|
+
* Name of the state machine to play.
|
|
295
|
+
*/
|
|
296
|
+
stateMachine?: string;
|
|
297
|
+
/**
|
|
298
|
+
* @deprecated Use the `stateMachine` parameter to play a state machine
|
|
299
|
+
* instead. Support for starting playback with named animations will be
|
|
300
|
+
* removed in a future major version.
|
|
301
|
+
*/
|
|
231
302
|
animations?: string | string[];
|
|
303
|
+
/**
|
|
304
|
+
* @deprecated Use `stateMachine` with a single state machine name instead.
|
|
305
|
+
* Support for playing multiple state machines at once will be removed in a
|
|
306
|
+
* future major version.
|
|
307
|
+
*/
|
|
232
308
|
stateMachines?: string | string[];
|
|
233
309
|
layout?: Layout;
|
|
234
310
|
autoplay?: boolean;
|
|
@@ -281,6 +357,10 @@ export interface RiveParameters {
|
|
|
281
357
|
* This flag is false by default to prevent any unwanted behaviors from taking place.
|
|
282
358
|
* This means any special Rive Event will have to be handled manually by subscribing to
|
|
283
359
|
* EventType.RiveEvent
|
|
360
|
+
*
|
|
361
|
+
* @deprecated Rive Events are deprecated and will be removed in a future
|
|
362
|
+
* major version: please use data binding instead. See
|
|
363
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
284
364
|
*/
|
|
285
365
|
automaticallyHandleEvents?: boolean;
|
|
286
366
|
/**
|
|
@@ -311,7 +391,22 @@ export interface RiveParameters {
|
|
|
311
391
|
onPlay?: EventCallback;
|
|
312
392
|
onPause?: EventCallback;
|
|
313
393
|
onStop?: EventCallback;
|
|
394
|
+
/**
|
|
395
|
+
* @deprecated Loop events are deprecated and will be removed in a future
|
|
396
|
+
* major version: they are only reported for linear animation playback, which
|
|
397
|
+
* is deprecated. Use a state machine to control playback and data binding to
|
|
398
|
+
* react to changes instead. See
|
|
399
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
|
|
400
|
+
* to migrate.
|
|
401
|
+
*/
|
|
314
402
|
onLoop?: EventCallback;
|
|
403
|
+
/**
|
|
404
|
+
* @deprecated State change events are deprecated and will be removed in a
|
|
405
|
+
* future major version: use use data binding (view model property observers) or
|
|
406
|
+
* state machine actions to react to changes from your graphic instead. See
|
|
407
|
+
* {@link https://rive.app/docs/editor/state-machine/states#actions} for how
|
|
408
|
+
* to migrate.
|
|
409
|
+
*/
|
|
315
410
|
onStateChange?: EventCallback;
|
|
316
411
|
onAdvance?: EventCallback;
|
|
317
412
|
assetLoader?: AssetLoadCallback;
|
|
@@ -351,7 +446,21 @@ export interface RiveLoadParameters {
|
|
|
351
446
|
autoplay?: boolean;
|
|
352
447
|
autoBind?: boolean;
|
|
353
448
|
artboard?: string;
|
|
449
|
+
/**
|
|
450
|
+
* Name of the state machine to play.
|
|
451
|
+
*/
|
|
452
|
+
stateMachine?: string;
|
|
453
|
+
/**
|
|
454
|
+
* @deprecated Use the `stateMachine` parameter to play a state machine
|
|
455
|
+
* instead. Support for starting playback with named animations will be
|
|
456
|
+
* removed in a future major version.
|
|
457
|
+
*/
|
|
354
458
|
animations?: string | string[];
|
|
459
|
+
/**
|
|
460
|
+
* @deprecated Use `stateMachine` with a single state machine name instead.
|
|
461
|
+
* Support for playing multiple state machines at once will be removed in a
|
|
462
|
+
* future major version.
|
|
463
|
+
*/
|
|
355
464
|
stateMachines?: string | string[];
|
|
356
465
|
useOffscreenRenderer?: boolean;
|
|
357
466
|
shouldDisableRiveListeners?: boolean;
|
|
@@ -361,7 +470,21 @@ export interface RiveLoadParameters {
|
|
|
361
470
|
}
|
|
362
471
|
export interface RiveResetParameters {
|
|
363
472
|
artboard?: string;
|
|
473
|
+
/**
|
|
474
|
+
* Name of the state machine to play.
|
|
475
|
+
*/
|
|
476
|
+
stateMachine?: string;
|
|
477
|
+
/**
|
|
478
|
+
* @deprecated Use the `stateMachine` parameter to play a state machine
|
|
479
|
+
* instead. Support for starting playback with named animations will be
|
|
480
|
+
* removed in a future major version.
|
|
481
|
+
*/
|
|
364
482
|
animations?: string | string[];
|
|
483
|
+
/**
|
|
484
|
+
* @deprecated Use `stateMachine` with a single state machine name instead.
|
|
485
|
+
* Support for playing multiple state machines at once will be removed in a
|
|
486
|
+
* future major version.
|
|
487
|
+
*/
|
|
365
488
|
stateMachines?: string | string[];
|
|
366
489
|
autoplay?: boolean;
|
|
367
490
|
autoBind?: boolean;
|
|
@@ -624,6 +747,9 @@ export declare class Rive {
|
|
|
624
747
|
* Returns a string from a given text run node name, or undefined if the text run
|
|
625
748
|
* cannot be queried.
|
|
626
749
|
*
|
|
750
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
751
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
752
|
+
* for how to migrate.
|
|
627
753
|
* @param textRunName - Name of the text run node associated with a text object
|
|
628
754
|
* @returns - String value of the text run node or undefined
|
|
629
755
|
*/
|
|
@@ -631,19 +757,61 @@ export declare class Rive {
|
|
|
631
757
|
/**
|
|
632
758
|
* Sets a text value for a given text run node name if possible
|
|
633
759
|
*
|
|
760
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
761
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
762
|
+
* for how to migrate.
|
|
634
763
|
* @param textRunName - Name of the text run node associated with a text object
|
|
635
764
|
* @param textRunValue - String value to set on the text run node
|
|
636
765
|
*/
|
|
637
766
|
setTextRunValue(textRunName: string, textRunValue: string): void;
|
|
767
|
+
/**
|
|
768
|
+
* Warns when playback-control names match linear animations in the
|
|
769
|
+
* Animator's instanced context; state machine playback remain supported.
|
|
770
|
+
*
|
|
771
|
+
* Remove for v3 release
|
|
772
|
+
*/
|
|
773
|
+
private warnIfLinearAnimationNames;
|
|
774
|
+
/**
|
|
775
|
+
* Plays specified animations or state machines; if none specified, it
|
|
776
|
+
* unpauses everything.
|
|
777
|
+
* @param animationNames Animation or state machine name(s) to play.
|
|
778
|
+
*
|
|
779
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
780
|
+
* state machine instead) and passing an array of names (this parameter
|
|
781
|
+
* becomes a single string in the next major version).
|
|
782
|
+
*/
|
|
638
783
|
play(animationNames?: string | string[], autoplay?: true): void;
|
|
784
|
+
/**
|
|
785
|
+
* Pauses specified animations or state machines; if none specified, pauses
|
|
786
|
+
* all.
|
|
787
|
+
* @param animationNames Animation or state machine name(s) to pause.
|
|
788
|
+
*
|
|
789
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
790
|
+
* state machine instead) and passing an array of names (this parameter
|
|
791
|
+
* becomes a single string in the next major version).
|
|
792
|
+
*/
|
|
639
793
|
pause(animationNames?: string | string[]): void;
|
|
794
|
+
/**
|
|
795
|
+
* Scrubs specified animations to the given time; if none specified, scrubs
|
|
796
|
+
* all of them.
|
|
797
|
+
* @deprecated `scrub()` will be removed in a future major version: use a
|
|
798
|
+
* state machine to control playback instead
|
|
799
|
+
*/
|
|
640
800
|
scrub(animationNames?: string | string[], value?: number): void;
|
|
801
|
+
/**
|
|
802
|
+
* Stops specified animations or state machines; if none specified, stops
|
|
803
|
+
* them all.
|
|
804
|
+
* @param animationNames Animation or state machine name(s) to stop.
|
|
805
|
+
*
|
|
806
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
807
|
+
* state machine instead) and passing an array of names (this parameter
|
|
808
|
+
* becomes a single string in the next major version).
|
|
809
|
+
*/
|
|
641
810
|
stop(animationNames?: string | string[] | undefined): void;
|
|
642
811
|
/**
|
|
643
812
|
* Resets the animation
|
|
644
813
|
* @param artboard the name of the artboard, or default if none given
|
|
645
|
-
* @param
|
|
646
|
-
* @param stateMachines the names of state machines for playback
|
|
814
|
+
* @param stateMachine the name of the state machine for playback
|
|
647
815
|
* @param autoplay whether to autoplay when reset, defaults to false
|
|
648
816
|
*
|
|
649
817
|
*/
|
|
@@ -697,14 +865,24 @@ export declare class Rive {
|
|
|
697
865
|
get stateMachineNames(): string[];
|
|
698
866
|
/**
|
|
699
867
|
* Returns the inputs for the specified instanced state machine, or an empty
|
|
700
|
-
* list if the name is invalid or the state machine is not instanced
|
|
868
|
+
* list if the name is invalid or the state machine is not instanced. Returns
|
|
869
|
+
* undefined if the file is not loaded yet.
|
|
870
|
+
*
|
|
871
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
872
|
+
* properties instead. See
|
|
873
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
874
|
+
* for how to migrate.
|
|
701
875
|
* @param name the state machine name
|
|
702
|
-
* @returns the inputs for the named state machine
|
|
876
|
+
* @returns the inputs for the named state machine or undefined
|
|
703
877
|
*/
|
|
704
|
-
stateMachineInputs(name: string): StateMachineInput[];
|
|
878
|
+
stateMachineInputs(name: string): StateMachineInput[] | undefined;
|
|
705
879
|
private retrieveInputAtPath;
|
|
706
880
|
/**
|
|
707
881
|
* Set the boolean input with the provided name at the given path with value
|
|
882
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
883
|
+
* properties instead. See
|
|
884
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
885
|
+
* for how to migrate.
|
|
708
886
|
* @param input the state machine input name
|
|
709
887
|
* @param value the value to set the input to
|
|
710
888
|
* @param path the path the input is located at an artboard level
|
|
@@ -712,6 +890,10 @@ export declare class Rive {
|
|
|
712
890
|
setBooleanStateAtPath(inputName: string, value: boolean, path: string): void;
|
|
713
891
|
/**
|
|
714
892
|
* Set the number input with the provided name at the given path with value
|
|
893
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
894
|
+
* properties instead. See
|
|
895
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
896
|
+
* for how to migrate.
|
|
715
897
|
* @param input the state machine input name
|
|
716
898
|
* @param value the value to set the input to
|
|
717
899
|
* @param path the path the input is located at an artboard level
|
|
@@ -719,6 +901,10 @@ export declare class Rive {
|
|
|
719
901
|
setNumberStateAtPath(inputName: string, value: number, path: string): void;
|
|
720
902
|
/**
|
|
721
903
|
* Fire the trigger with the provided name at the given path
|
|
904
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
905
|
+
* properties instead. See
|
|
906
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
907
|
+
* for how to migrate.
|
|
722
908
|
* @param input the state machine input name
|
|
723
909
|
* @param path the path the input is located at an artboard level
|
|
724
910
|
*/
|
|
@@ -740,6 +926,10 @@ export declare class Rive {
|
|
|
740
926
|
*
|
|
741
927
|
* @remarks
|
|
742
928
|
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
929
|
+
*
|
|
930
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
931
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
932
|
+
* for how to migrate.
|
|
743
933
|
*/
|
|
744
934
|
getTextRunValueAtPath(textName: string, path: string): string | undefined;
|
|
745
935
|
/**
|
|
@@ -759,6 +949,10 @@ export declare class Rive {
|
|
|
759
949
|
*
|
|
760
950
|
* @remarks
|
|
761
951
|
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
952
|
+
*
|
|
953
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
954
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
955
|
+
* for how to migrate.
|
|
762
956
|
*/
|
|
763
957
|
setTextRunValueAtPath(textName: string, value: string, path: string): void;
|
|
764
958
|
get playingStateMachineNames(): string[];
|
|
@@ -788,6 +982,13 @@ export declare class Rive {
|
|
|
788
982
|
get bounds(): Bounds;
|
|
789
983
|
/**
|
|
790
984
|
* Subscribe to Rive-generated events
|
|
985
|
+
*
|
|
986
|
+
* Note: subscribing to {@link EventType.RiveEvent},
|
|
987
|
+
* {@link EventType.StateChange}, or {@link EventType.Loop} is deprecated;
|
|
988
|
+
* use data binding instead. See
|
|
989
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} (Rive Events) and
|
|
990
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
|
|
991
|
+
* to migrate Rive graphics to a data binding workflow instead.
|
|
791
992
|
* @param type the type of event to subscribe to
|
|
792
993
|
* @param callback callback to fire when the event occurs
|
|
793
994
|
*/
|