@rive-app/canvas-advanced-single 2.37.7 → 2.38.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/canvas-advanced-single",
3
- "version": "2.37.7",
3
+ "version": "2.38.0",
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",
@@ -755,6 +755,18 @@ export interface RiveEventCustomProperties {
755
755
  [key: string]: number | boolean | string;
756
756
  }
757
757
 
758
+ /**
759
+ * Snapshot of the focus state returned by StateMachineInstance.focusState().
760
+ * Poll this each frame after advanceAndApply() to detect focus changes and
761
+ * determine whether a virtual keyboard should be shown or hidden.
762
+ */
763
+ export interface FocusState {
764
+ /** True if any element currently holds focus in this state machine's active focus manager. */
765
+ hasFocus: boolean;
766
+ /** True if the focused element accepts keyboard input (e.g. a TextInput node). */
767
+ expectsKeyboardInput: boolean;
768
+ }
769
+
758
770
  export declare class LinearAnimation {
759
771
  /**
760
772
  * The animation's loop type
@@ -877,6 +889,35 @@ export declare class StateMachineInstance {
877
889
  */
878
890
  pointerExit(x: number, y: number, id: number): void;
879
891
 
892
+ /**
893
+ * Returns true if this state machine has any focus nodes registered in its focus tree.
894
+ * Since the focus tree is unified across nested artboards, this covers the full scene.
895
+ * Use this to gate whether tab/focus traversal DOM listeners should be attached.
896
+ */
897
+ hasFocusNodes(): boolean;
898
+
899
+ /**
900
+ * Move focus to the next focusable node in the focus tree via the state machine's focus manager.
901
+ */
902
+ focusNext(): boolean;
903
+
904
+ /**
905
+ * Move focus to the previous focusable node in the focus tree via the state machine's focus manager.
906
+ */
907
+ focusPrevious(): boolean;
908
+
909
+ /**
910
+ * Clear focus from the Rive focus tree.
911
+ */
912
+ clearFocus(): void;
913
+
914
+ /**
915
+ * Returns metadata about current focus state:
916
+ * 1. Whether any node in the focus tree is currently focused
917
+ * 2. Whether the currently focused node expects keyboard input (i.e. keyboard/text input listener)
918
+ */
919
+ focusState(): FocusState;
920
+
880
921
  /**
881
922
  * Deletes the underlying instance created via the WASM. It's important to clean up this instance
882
923
  * when no longer in use