@rive-app/webgl2-threads 2.47.1 → 2.49.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.1",
3
+ "version": "2.49.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,
@@ -423,6 +443,19 @@ export interface RiveParameters {
423
443
  * import. False by default.
424
444
  */
425
445
  enableGPUCanvas?: boolean;
446
+ /**
447
+ * @experimental This API is early and may encounter breaking behavior change without a major version bump
448
+ *
449
+ * With `enableGPUCanvas`, on `@rive-app/webgl2-threads` loaded threaded, the
450
+ * canvas moves to a worker shared by every instance on the page, which replays
451
+ * each frame while this instance records the next. Set false to keep this
452
+ * instance's rendering on the page's thread. Has no effect where the worker is
453
+ * unavailable. True by default; see also {@link RuntimeLoader.setReplayWorker}.
454
+ *
455
+ * A canvas handed to the worker stays there: its `width` and `height` still
456
+ * work, but it can no longer give out a context of its own.
457
+ */
458
+ useReplayWorker?: boolean;
426
459
  /**
427
460
  * Emit performance.mark / performance.measure entries for load lifecycle
428
461
  * events and the first 3 render frames. Useful for profiling Rive's
@@ -688,14 +721,17 @@ export declare class Rive {
688
721
  private readyForPlaying;
689
722
  private runtime;
690
723
  private deferredRenderer;
724
+ private useReplayWorker;
691
725
  private _inkbleedCapable;
692
726
  private _inkbleed;
693
727
  private static inkbleedUnsupportedWarned;
728
+ private static replayContextLostWarned;
694
729
  private static inkbleedNotCapableWarned;
695
730
  private ownsRiveFile;
696
731
  private artboard;
697
732
  private eventCleanup;
698
733
  private _keyboardInteractions;
734
+ private _gamepadInteractions;
699
735
  private file;
700
736
  private riveFile;
701
737
  private eventManager;
@@ -718,6 +754,8 @@ export declare class Rive {
718
754
  static get suppressDeprecationWarnings(): readonly DeprecationId[];
719
755
  static set suppressDeprecationWarnings(ids: readonly DeprecationId[]);
720
756
  private shouldDisableRiveListeners;
757
+ private shouldDisableGamepad;
758
+ private _gamepadOptions;
721
759
  private automaticallyHandleEvents;
722
760
  private dispatchPointerExit;
723
761
  private enableMultiTouch;
@@ -803,6 +841,9 @@ export declare class Rive {
803
841
  private wantsTextInputSession;
804
842
  private advanceAndDrainForPointer;
805
843
  private cleanupKeyboardInteractions;
844
+ private ensureGamepadInteractions;
845
+ private cleanupGamepadInteractions;
846
+ private isFocusWithinCanvas;
806
847
  /**
807
848
  * Remove Rive Listeners setup on the canvas
808
849
  */
@@ -822,6 +863,13 @@ export declare class Rive {
822
863
  * only a file this instance imported is released when that happens.
823
864
  */
824
865
  private resolveDeferredRendering;
866
+ private reloadForRestoredContext;
867
+ /**
868
+ * Re-imports `file` deferred and attaches the copy's session to `renderer`.
869
+ * The copy becomes this instance's file either way, unless the instance was
870
+ * destroyed while it imported.
871
+ */
872
+ private attachDeferredCopy;
825
873
  private initArtboard;
826
874
  drawFrame(): void;
827
875
  private _canvasSizeChanged;
@@ -833,6 +881,7 @@ export declare class Rive {
833
881
  /** Mirror Rive's hasFocus into the keyboard session state and, on opt-in, canvas focus. */
834
882
  private syncRiveFocus;
835
883
  private lastRenderTime;
884
+ private static batchStart;
836
885
  private frameRequestId;
837
886
  /**
838
887
  * Used be draw to track when a second of active rendering time has passed.
@@ -844,11 +893,12 @@ export declare class Rive {
844
893
  * due to state changes, view model property changes, etc.
845
894
  *
846
895
  * @param elapsedTime time to advance the state machine by
896
+ * @param frameTime the rAF timestamp; omitted by pointer drains, which skip gamepad polling.
847
897
  */
848
898
  private advanceAndReportChanges;
849
899
  /**
850
900
  * Draw rendering loop; renders animation frames at the correct time interval.
851
- * @param time the time at which to render a frame
901
+ * @param time the rAF timestamp, or null to draw now without advancing
852
902
  */
853
903
  private draw;
854
904
  /**