@rive-app/canvas-advanced-single 2.43.1 → 2.44.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/canvas-advanced-single",
3
- "version": "2.43.1",
3
+ "version": "2.44.1",
4
4
  "description": "Rive's lightweight low-level canvas based web api all in one js file.",
5
5
  "main": "canvas_advanced_single.mjs",
6
6
  "homepage": "https://rive.app",
@@ -286,6 +286,14 @@ export declare class RenderPaintWrapper {
286
286
  radialGradient(sx: number, sy: number, ex: number, ey: number): void;
287
287
  addStop(color: number, stop: number): void;
288
288
  completeGradient(): void;
289
+ gradientTransform(
290
+ xx: number,
291
+ xy: number,
292
+ yx: number,
293
+ yy: number,
294
+ tx: number,
295
+ ty: number,
296
+ ): void;
289
297
  }
290
298
 
291
299
  /**
@@ -460,6 +468,11 @@ export declare class File {
460
468
  * @returns Number of view models in the Rive file
461
469
  */
462
470
  viewModelCount(): number;
471
+ /**
472
+ * Reports device pixels per layout point to scripts in this file
473
+ * @param scale - Device pixels per layout point
474
+ */
475
+ displayScale(scale: number): void;
463
476
  /**
464
477
  * Returns a view model by the index in which it is located in the file
465
478
  * @returns ViewModel
@@ -1018,6 +1031,70 @@ export declare class StateMachineInstance {
1018
1031
  * @param y - Y coordinate
1019
1032
  */
1020
1033
  pointerExit(x: number, y: number, id: number): void;
1034
+ /**
1035
+ * Notifies the state machine of indirect scroll input (a mouse wheel, or a trackpad gesture the
1036
+ * platform already classified as a scroll) at the given coordinate in Artboard space. Direct
1037
+ * touch scrolling stays on the pointer path.
1038
+ *
1039
+ * A gesture latches to the scroll view that takes its first event and stays there, even past
1040
+ * that view's edge, until the gesture ends. A gesture with no end phase (a wheel) ends once the
1041
+ * state machine advances 0.1s without another scroll event.
1042
+ *
1043
+ * @param x - X coordinate
1044
+ * @param y - Y coordinate
1045
+ * @param dx - Horizontal distance the content moves, in Artboard pixels. Revealing content to
1046
+ * the right is negative, so a DOM wheel delta must be negated.
1047
+ * @param dy - Vertical distance the content moves, in Artboard pixels. Revealing content below
1048
+ * is negative.
1049
+ * @param phase - Where the event sits within its gesture: 0 begin, 1 update, 2 end,
1050
+ * 3 momentum, 4 inertiaCancel. A phaseless wheel only ever sends 1 (update).
1051
+ * @param precise - True for a pixel-precise source such as a trackpad, false for a detented
1052
+ * wheel.
1053
+ * @param timeStamp - Event time in seconds.
1054
+ * @param id - Pointer id
1055
+ * @returns 0 when nothing took the event, 1 when a scroll view did, 2 when an opaque scroll
1056
+ * view did.
1057
+ */
1058
+ pointerScroll(
1059
+ x: number,
1060
+ y: number,
1061
+ dx: number,
1062
+ dy: number,
1063
+ phase: number,
1064
+ precise: boolean,
1065
+ timeStamp: number,
1066
+ id: number,
1067
+ ): number;
1068
+ /**
1069
+ * Returns true if anything under the given Artboard coordinate would move for this scroll
1070
+ * event, without applying it. Always true while a gesture is latched.
1071
+ * See {@link pointerScroll} for the parameters.
1072
+ */
1073
+ wantsScroll(
1074
+ x: number,
1075
+ y: number,
1076
+ dx: number,
1077
+ dy: number,
1078
+ phase: number,
1079
+ precise: boolean,
1080
+ ): boolean;
1081
+ /**
1082
+ * Returns true if a wheel-enabled scroll view sits under the given Artboard coordinate, even
1083
+ * one that cannot move right now.
1084
+ *
1085
+ * @param x - X coordinate
1086
+ * @param y - Y coordinate
1087
+ */
1088
+ hasScrollTargetAt(x: number, y: number): boolean;
1089
+ /**
1090
+ * Returns true while a scroll gesture is latched to a scroll view in this state machine or a
1091
+ * nested one.
1092
+ */
1093
+ hasScrollLatch(): boolean;
1094
+ /**
1095
+ * Ends any scroll gesture in flight, latch included.
1096
+ */
1097
+ cancelScroll(): void;
1021
1098
 
1022
1099
  /**
1023
1100
  * Returns true if this state machine has any focus nodes registered in its focus tree.
@@ -1049,13 +1126,13 @@ export declare class StateMachineInstance {
1049
1126
  focusRight(): boolean;
1050
1127
 
1051
1128
  /**
1052
- * Move focus to the nearest focusable node to the up of the current focus, by on-screen position.
1129
+ * Move focus to the nearest focusable node above the current focus, by on-screen position.
1053
1130
  * @returns false if nothing is focused or no node lies in that direction
1054
1131
  */
1055
1132
  focusUp(): boolean;
1056
1133
 
1057
1134
  /**
1058
- * Move focus to the nearest focusable node to the down of the current focus, by on-screen position.
1135
+ * Move focus to the nearest focusable node below the current focus, by on-screen position.
1059
1136
  * @returns false if nothing is focused or no node lies in that direction
1060
1137
  */
1061
1138
  focusDown(): boolean;
@@ -1075,7 +1152,7 @@ export declare class StateMachineInstance {
1075
1152
  /**
1076
1153
  * Forward a key press/release to the focus tree via the state machine's focus manager.
1077
1154
  * The event bubbles from the primary focus node up its ancestors until a handler consumes it.
1078
- * Standalone modifier keys must never be sent; fold held modifiers into the `modifiers` bitmask.
1155
+ * Modifier keys are sent as keys too; held modifiers also go in the `modifiers` bitmask.
1079
1156
  * @param key - GLFW-style key code (see js/src/utils/keyMap.ts)
1080
1157
  * @param modifiers - KeyModifiers bitmask (shift=1, ctrl=2, alt=4, meta=8)
1081
1158
  * @param isPressed - true for keydown, false for keyup
@@ -1094,6 +1171,13 @@ export declare class StateMachineInstance {
1094
1171
  */
1095
1172
  textInput(text: string): boolean;
1096
1173
 
1174
+ /**
1175
+ * The selected text of the focused element, or an empty string when nothing with a
1176
+ * selection is focused. Used to fill the clipboard on copy/cut. An obscured field
1177
+ * (i.e. a password) reports empty string.
1178
+ */
1179
+ selectedText(): string;
1180
+
1097
1181
  /**
1098
1182
  * Deletes the underlying instance created via the WASM. It's important to clean up this instance
1099
1183
  * when no longer in use