@rive-app/canvas 2.51.0 → 2.53.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 +44 -1
- package/rive.js +813 -441
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +23 -2
- package/rive_fallback.wasm +0 -0
- package/utils/gamepadInteractions.d.ts +9 -2
- package/utils/registerKeyboardInteractions.d.ts +4 -1
- package/utils/registerTouchInteractions.d.ts +2 -1
package/rive.wasm
CHANGED
|
Binary file
|
package/rive_advanced.mjs.d.ts
CHANGED
|
@@ -187,6 +187,11 @@ export interface RiveCanvas {
|
|
|
187
187
|
* @param requestID - ID of the requestAnimationFrame request to cancel
|
|
188
188
|
*/
|
|
189
189
|
cancelAnimationFrame(requestID: number): void;
|
|
190
|
+
/**
|
|
191
|
+
* Called by the runtime whenever an asset's contents change after load (an
|
|
192
|
+
* image finished decoding, or an image, font or audio source was swapped).
|
|
193
|
+
*/
|
|
194
|
+
onAssetChange?: () => void;
|
|
190
195
|
/**
|
|
191
196
|
* A Rive-specific function to "flush" queued up draw calls from using the renderer.
|
|
192
197
|
* It also ends the frame for scripts, which collect their memory then.
|
|
@@ -1136,8 +1141,11 @@ export declare class StateMachineInstance {
|
|
|
1136
1141
|
*
|
|
1137
1142
|
* @param x - X coordinate
|
|
1138
1143
|
* @param y - Y coordinate
|
|
1144
|
+
* @param id - Pointer id
|
|
1145
|
+
* @param button - Pointer button, as numbered by PointerButton: 0 primary
|
|
1146
|
+
* (default), 1 secondary, 2 middle
|
|
1139
1147
|
*/
|
|
1140
|
-
pointerDown(x: number, y: number, id: number): void;
|
|
1148
|
+
pointerDown(x: number, y: number, id: number, button?: number): void;
|
|
1141
1149
|
/**
|
|
1142
1150
|
* Notifies the state machine that the pointer has moved to the given coordinate in
|
|
1143
1151
|
* Artboard space. Internally, Rive may advance a state machine if the listener coordinate is of
|
|
@@ -1153,8 +1161,11 @@ export declare class StateMachineInstance {
|
|
|
1153
1161
|
* interest at a given moment.
|
|
1154
1162
|
* @param x - X coordinate
|
|
1155
1163
|
* @param y - Y coordinate
|
|
1164
|
+
* @param id - Pointer id
|
|
1165
|
+
* @param button - Pointer button, as numbered by PointerButton: 0 primary
|
|
1166
|
+
* (default), 1 secondary, 2 middle
|
|
1156
1167
|
*/
|
|
1157
|
-
pointerUp(x: number, y: number, id: number): void;
|
|
1168
|
+
pointerUp(x: number, y: number, id: number, button?: number): void;
|
|
1158
1169
|
/**
|
|
1159
1170
|
* Notifies the state machine that the pointer has exited the detectable area of the canvas surface
|
|
1160
1171
|
*
|
|
@@ -1217,6 +1228,16 @@ export declare class StateMachineInstance {
|
|
|
1217
1228
|
* @param y - Y coordinate
|
|
1218
1229
|
*/
|
|
1219
1230
|
hasScrollTargetAt(x: number, y: number): boolean;
|
|
1231
|
+
/**
|
|
1232
|
+
* Returns true if a listener under the given Artboard coordinate responds to presses of
|
|
1233
|
+
* button, looking through nested artboards.
|
|
1234
|
+
*
|
|
1235
|
+
* @param x - X coordinate
|
|
1236
|
+
* @param y - Y coordinate
|
|
1237
|
+
* @param button - Pointer button, as numbered by PointerButton: 0 primary, 1 secondary,
|
|
1238
|
+
* 2 middle
|
|
1239
|
+
*/
|
|
1240
|
+
listensToButtonAt(x: number, y: number, button: number): boolean;
|
|
1220
1241
|
/**
|
|
1221
1242
|
* Returns true while a scroll gesture is latched to a scroll view in this state machine or a
|
|
1222
1243
|
* nested one.
|
package/rive_fallback.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,8 @@ export interface GamepadInteractionsParams {
|
|
|
3
3
|
/** Hold button/axis input at rest unless DOM focus is within the canvas/overlay. Pads still connect. */
|
|
4
4
|
requireFocus: boolean;
|
|
5
5
|
isFocusWithin: () => boolean;
|
|
6
|
+
/** Called when a pad connects, so an instance that stopped its loop can start polling again. */
|
|
7
|
+
onPadConnected: () => void;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* Per-Rive-instance gamepad bridge driving a single state machine. Tracks what that state
|
|
@@ -16,8 +18,13 @@ export declare class GamepadInteractions {
|
|
|
16
18
|
private lastSentPads;
|
|
17
19
|
private submitFailures;
|
|
18
20
|
constructor(params: GamepadInteractionsParams);
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
+
/** Whether pads need reading each frame: one is connected, or one still has to be disconnected. */
|
|
22
|
+
get isPolling(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Poll, diff and submit one batch. Call once per frame before advancing.
|
|
25
|
+
* @returns true when a batch was sent to the state machine
|
|
26
|
+
*/
|
|
27
|
+
handleGamepadInputs(time: number, stateMachine: rc.StateMachineInstance | undefined): boolean;
|
|
21
28
|
dispose(): void;
|
|
22
29
|
/** Writes records that bring `lastSentPads` up to `pads`, updating it as it goes. */
|
|
23
30
|
private encodeDiff;
|
|
@@ -16,6 +16,8 @@ export interface KeyboardInteractionsParams {
|
|
|
16
16
|
* after keyboard listeners are registered.
|
|
17
17
|
*/
|
|
18
18
|
getOverlayElement?: () => HTMLElement | null;
|
|
19
|
+
/** Called before keyboard, text or focus input reaches the state machine. */
|
|
20
|
+
onInput?: () => void;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Tracks the relationship between DOM focus inside this Rive focus domain (canvas or semantic overlay)
|
|
@@ -57,6 +59,7 @@ export declare class KeyboardInteractions {
|
|
|
57
59
|
private hasFocusNodes;
|
|
58
60
|
/** Cached callback that returns the accessibility overlay element once created. */
|
|
59
61
|
private getOverlayElement?;
|
|
62
|
+
private onInput;
|
|
60
63
|
/** Whether the canvas currently has browser DOM focus. */
|
|
61
64
|
private canvasHasFocus;
|
|
62
65
|
/** After Tab exits the last Rive node, ignore keydowns until focus re-enters the focus domain. */
|
|
@@ -69,7 +72,7 @@ export declare class KeyboardInteractions {
|
|
|
69
72
|
private claimedKeyCodes;
|
|
70
73
|
private readonly inputProxy;
|
|
71
74
|
private textInputSessionActive;
|
|
72
|
-
constructor({ canvas, stateMachine, hasFocusNodes, getOverlayElement, }: KeyboardInteractionsParams);
|
|
75
|
+
constructor({ canvas, stateMachine, hasFocusNodes, getOverlayElement, onInput, }: KeyboardInteractionsParams);
|
|
73
76
|
isTextInputSessionActive(): boolean;
|
|
74
77
|
/** Session active and the proxy holds DOM focus. */
|
|
75
78
|
isEditingHostFocused(): boolean;
|
|
@@ -14,6 +14,7 @@ export interface TouchInteractionsParams {
|
|
|
14
14
|
advanceAndDrain: (elapsedTime: number, options?: {
|
|
15
15
|
pointerDown?: boolean;
|
|
16
16
|
}) => void;
|
|
17
|
+
wake?: () => void;
|
|
17
18
|
summonKeyboard?: () => void;
|
|
18
19
|
isTextProxyFocused?: () => boolean;
|
|
19
20
|
}
|
|
@@ -22,4 +23,4 @@ export interface TouchInteractionsParams {
|
|
|
22
23
|
* coordinates to the state machine pointer move/up/down/scroll functions based on cursor
|
|
23
24
|
* interaction
|
|
24
25
|
*/
|
|
25
|
-
export declare const registerTouchInteractions: ({ canvas, artboard, stateMachines, renderer, rive, fit, alignment, isTouchScrollEnabled, dispatchPointerExit, enableMultiTouch, layoutScaleFactor, advanceAndDrain, summonKeyboard, isTextProxyFocused, }: TouchInteractionsParams) => () => void;
|
|
26
|
+
export declare const registerTouchInteractions: ({ canvas, artboard, stateMachines, renderer, rive, fit, alignment, isTouchScrollEnabled, dispatchPointerExit, enableMultiTouch, layoutScaleFactor, advanceAndDrain, wake, summonKeyboard, isTextProxyFocused, }: TouchInteractionsParams) => () => void;
|