@rive-app/webgl2-threads 2.47.0 → 2.48.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/webgl2-threads",
3
- "version": "2.47.0",
3
+ "version": "2.48.0",
4
4
  "description": "Rive's webgl2 based web api, with threads on cross origin isolated pages.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -58,6 +58,17 @@ export interface RiveFocusOptions {
58
58
  */
59
59
  allowFocusInterrupt: boolean;
60
60
  }
61
+ export interface RiveGamepadOptions {
62
+ /**
63
+ * When true, button and stick input only reaches the graphic while DOM focus is
64
+ * on the canvas (or its accessibility overlay). While focus is elsewhere,
65
+ * controllers still report as connected, but their input is held at rest.
66
+ * Useful when several gamepad-driven graphics share a page.
67
+ *
68
+ * @default false
69
+ */
70
+ requireFocus?: boolean;
71
+ }
61
72
  export interface LayoutParameters {
62
73
  fit?: Fit;
63
74
  alignment?: Alignment;
@@ -350,6 +361,10 @@ export interface RiveParameters {
350
361
  * Optional settings for focus behavior
351
362
  */
352
363
  focusOptions?: RiveFocusOptions;
364
+ /**
365
+ * Optional settings for gamepad input
366
+ */
367
+ gamepadOptions?: RiveGamepadOptions;
353
368
  /**
354
369
  * Allow the runtime to automatically load assets hosted in Rive's CDN.
355
370
  * enabled by default.
@@ -374,6 +389,11 @@ export interface RiveParameters {
374
389
  * will be attached to the <canvas> element
375
390
  */
376
391
  shouldDisableRiveListeners?: boolean;
392
+ /**
393
+ * Turn off sending gamepad input to Rive. Connected game controllers are not read and the
394
+ * state machine receives no gamepad events.
395
+ */
396
+ shouldDisableGamepad?: boolean;
377
397
  /**
378
398
  * For Rive Listeners, allows scrolling behavior to still occur on canvas elements
379
399
  * when a touch/drag action is performed on touch-enabled devices. Otherwise,
@@ -696,6 +716,7 @@ export declare class Rive {
696
716
  private artboard;
697
717
  private eventCleanup;
698
718
  private _keyboardInteractions;
719
+ private _gamepadInteractions;
699
720
  private file;
700
721
  private riveFile;
701
722
  private eventManager;
@@ -718,6 +739,8 @@ export declare class Rive {
718
739
  static get suppressDeprecationWarnings(): readonly DeprecationId[];
719
740
  static set suppressDeprecationWarnings(ids: readonly DeprecationId[]);
720
741
  private shouldDisableRiveListeners;
742
+ private shouldDisableGamepad;
743
+ private _gamepadOptions;
721
744
  private automaticallyHandleEvents;
722
745
  private dispatchPointerExit;
723
746
  private enableMultiTouch;
@@ -803,6 +826,9 @@ export declare class Rive {
803
826
  private wantsTextInputSession;
804
827
  private advanceAndDrainForPointer;
805
828
  private cleanupKeyboardInteractions;
829
+ private ensureGamepadInteractions;
830
+ private cleanupGamepadInteractions;
831
+ private isFocusWithinCanvas;
806
832
  /**
807
833
  * Remove Rive Listeners setup on the canvas
808
834
  */
@@ -833,6 +859,7 @@ export declare class Rive {
833
859
  /** Mirror Rive's hasFocus into the keyboard session state and, on opt-in, canvas focus. */
834
860
  private syncRiveFocus;
835
861
  private lastRenderTime;
862
+ private static batchStart;
836
863
  private frameRequestId;
837
864
  /**
838
865
  * Used be draw to track when a second of active rendering time has passed.
@@ -844,11 +871,12 @@ export declare class Rive {
844
871
  * due to state changes, view model property changes, etc.
845
872
  *
846
873
  * @param elapsedTime time to advance the state machine by
874
+ * @param frameTime the rAF timestamp; omitted by pointer drains, which skip gamepad polling.
847
875
  */
848
876
  private advanceAndReportChanges;
849
877
  /**
850
878
  * Draw rendering loop; renders animation frames at the correct time interval.
851
- * @param time the time at which to render a frame
879
+ * @param time the rAF timestamp, or null to draw now without advancing
852
880
  */
853
881
  private draw;
854
882
  /**