@rive-app/canvas-lite 2.42.2 → 2.43.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/rive.wasm CHANGED
Binary file
@@ -1036,6 +1036,30 @@ export declare class StateMachineInstance {
1036
1036
  */
1037
1037
  focusPrevious(): boolean;
1038
1038
 
1039
+ /**
1040
+ * Move focus to the nearest focusable node to the left of the current focus, by on-screen position.
1041
+ * @returns false if nothing is focused or no node lies in that direction
1042
+ */
1043
+ focusLeft(): boolean;
1044
+
1045
+ /**
1046
+ * Move focus to the nearest focusable node to the right of the current focus, by on-screen position.
1047
+ * @returns false if nothing is focused or no node lies in that direction
1048
+ */
1049
+ focusRight(): boolean;
1050
+
1051
+ /**
1052
+ * Move focus to the nearest focusable node to the up of the current focus, by on-screen position.
1053
+ * @returns false if nothing is focused or no node lies in that direction
1054
+ */
1055
+ focusUp(): boolean;
1056
+
1057
+ /**
1058
+ * Move focus to the nearest focusable node to the down of the current focus, by on-screen position.
1059
+ * @returns false if nothing is focused or no node lies in that direction
1060
+ */
1061
+ focusDown(): boolean;
1062
+
1039
1063
  /**
1040
1064
  * Clear focus from the Rive focus tree.
1041
1065
  */
@@ -1048,6 +1072,28 @@ export declare class StateMachineInstance {
1048
1072
  */
1049
1073
  focusState(): FocusState;
1050
1074
 
1075
+ /**
1076
+ * Forward a key press/release to the focus tree via the state machine's focus manager.
1077
+ * 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.
1079
+ * @param key - GLFW-style key code (see js/src/utils/keyMap.ts)
1080
+ * @param modifiers - KeyModifiers bitmask (shift=1, ctrl=2, alt=4, meta=8)
1081
+ * @param isPressed - true for keydown, false for keyup
1082
+ * @param isRepeat - true if this is an auto-repeat keydown
1083
+ * @returns true if a node in the focus chain consumed the event
1084
+ */
1085
+ keyInput(key: number, modifiers: number, isPressed: boolean, isRepeat: boolean): boolean;
1086
+
1087
+ /**
1088
+ * Forward committed text (a printable stroke, IME composition result, or paste) to the focus
1089
+ * tree. This is the only way characters get inserted into a focused text field; `keyInput`
1090
+ * never inserts text. For a printable stroke, hosts typically call both: `keyInput` so
1091
+ * keyboard listeners on that key fire, then `textInput` for the characters.
1092
+ * @param text - the committed text
1093
+ * @returns true if a node in the focus chain consumed the text
1094
+ */
1095
+ textInput(text: string): boolean;
1096
+
1051
1097
  /**
1052
1098
  * Deletes the underlying instance created via the WASM. It's important to clean up this instance
1053
1099
  * when no longer in use
@@ -1354,6 +1400,7 @@ export enum StrokeJoin {
1354
1400
 
1355
1401
  export enum BlendMode {
1356
1402
  srcOver = 3,
1403
+ additive = 12,
1357
1404
  screen = 14,
1358
1405
  overlay = 15,
1359
1406
  darken = 16,
Binary file
@@ -5,7 +5,8 @@ export interface KeyboardInteractionsParams {
5
5
  /**
6
6
  * Whether this canvas has focus nodes that should participate in tab traversal.
7
7
  * When true, Tab/Shift+Tab will be intercepted and routed to the Rive focus manager.
8
- * focusNext() returning false means no more traversable nodes — tab is released to the page.
8
+ * Tab is released to the page only when focusNext() returns false and Rive no longer holds
9
+ * focus; a Stop edge also returns false but keeps focus, so Tab stays trapped.
9
10
  */
10
11
  hasFocusNodes: boolean;
11
12
  /**
@@ -27,7 +28,8 @@ export interface KeyboardInteractionsParams {
27
28
  * in the overlay, and by keyboard focus whose entry attempt found no eligible node.
28
29
  * RiveFocused — a Rive node holds focus. Tab/Shift+Tab route to the Rive focus manager and stay
29
30
  * inside the domain until either Rive reports focus ended (pollFocusState) or
30
- * focusNext()/focusPrevious() returns false at the edge of the tree.
31
+ * Tab walks off the edge of the tree (focusNext()/focusPrevious() returns false and
32
+ * Rive no longer holds focus).
31
33
  *
32
34
  * Keyboard focus on the canvas enters the tree immediately: onCanvasFocus infers direction from
33
35
  * where focus came from and goes straight to RiveFocused when a node accepts.