@rive-app/webgl 2.23.11 → 2.24.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/webgl",
3
- "version": "2.23.11",
3
+ "version": "2.24.1",
4
4
  "description": "Rive's webgl based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -103,6 +103,10 @@ export declare class StateMachineInput {
103
103
  * Fires a trigger; does nothing on Number or Boolean input types
104
104
  */
105
105
  fire(): void;
106
+ /**
107
+ * Deletes the input
108
+ */
109
+ delete(): void;
106
110
  }
107
111
  export declare enum RiveEventType {
108
112
  General = 128,
package/rive.js CHANGED
@@ -408,7 +408,7 @@ function Qa(a, b) {
408
408
  return Pa(c, a, b);
409
409
  }));
410
410
  }
411
- var Ra, Sa, Wa = {698252:(a, b, c, d, e) => {
411
+ var Ra, Sa, Wa = {699884:(a, b, c, d, e) => {
412
412
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
413
413
  return 0;
414
414
  }
@@ -471,9 +471,9 @@ var Ra, Sa, Wa = {698252:(a, b, c, d, e) => {
471
471
  }
472
472
  window.h.Ea += 1;
473
473
  return 1;
474
- }, 700430:() => {
474
+ }, 702062:() => {
475
475
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
476
- }, 700594:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 700698:() => {
476
+ }, 702226:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 702330:() => {
477
477
  try {
478
478
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
479
479
  a.close();
@@ -481,7 +481,7 @@ var Ra, Sa, Wa = {698252:(a, b, c, d, e) => {
481
481
  } catch (c) {
482
482
  return 0;
483
483
  }
484
- }, 700869:(a, b, c, d, e, f) => {
484
+ }, 702501:(a, b, c, d, e, f) => {
485
485
  if ("undefined" === typeof window.h) {
486
486
  return -1;
487
487
  }
@@ -527,7 +527,7 @@ var Ra, Sa, Wa = {698252:(a, b, c, d, e) => {
527
527
  a == window.h.H.Ca && g.X.connect(g.I.destination);
528
528
  g.lb = f;
529
529
  return window.h.nc(g);
530
- }, 703746:a => window.h.ta(a).I.sampleRate, 703819:a => {
530
+ }, 705378:a => window.h.ta(a).I.sampleRate, 705451:a => {
531
531
  a = window.h.ta(a);
532
532
  void 0 !== a.X && (a.X.onaudioprocess = function() {
533
533
  }, a.X.disconnect(), a.X = void 0);
@@ -535,13 +535,13 @@ var Ra, Sa, Wa = {698252:(a, b, c, d, e) => {
535
535
  a.I.close();
536
536
  a.I = void 0;
537
537
  a.lb = void 0;
538
- }, 704219:a => {
538
+ }, 705851:a => {
539
539
  window.h.xb(a);
540
- }, 704269:a => {
540
+ }, 705901:a => {
541
541
  a = window.h.ta(a);
542
542
  a.I.resume();
543
543
  a.state = window.h.ha.sb;
544
- }, 704408:a => {
544
+ }, 706040:a => {
545
545
  a = window.h.ta(a);
546
546
  a.I.suspend();
547
547
  a.state = window.h.ha.stopped;
@@ -4061,7 +4061,7 @@ Je();
4061
4061
  /* 2 */
4062
4062
  /***/ ((module) => {
4063
4063
 
4064
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.23.11","description":"Rive\'s webgl based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4064
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.24.1","description":"Rive\'s webgl based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4065
4065
 
4066
4066
  /***/ }),
4067
4067
  /* 3 */
@@ -4855,6 +4855,12 @@ var StateMachineInput = /** @class */ (function () {
4855
4855
  this.runtimeInput.fire();
4856
4856
  }
4857
4857
  };
4858
+ /**
4859
+ * Deletes the input
4860
+ */
4861
+ StateMachineInput.prototype.delete = function () {
4862
+ this.runtimeInput = null;
4863
+ };
4858
4864
  return StateMachineInput;
4859
4865
  }());
4860
4866
 
@@ -4956,6 +4962,10 @@ var StateMachine = /** @class */ (function () {
4956
4962
  * state machine is no more.
4957
4963
  */
4958
4964
  StateMachine.prototype.cleanup = function () {
4965
+ this.inputs.forEach(function (input) {
4966
+ input.delete();
4967
+ });
4968
+ this.inputs.length = 0;
4959
4969
  this.instance.delete();
4960
4970
  };
4961
4971
  return StateMachine;
@@ -5800,6 +5810,8 @@ var Rive = /** @class */ (function () {
5800
5810
  var _a;
5801
5811
  // Tracks if a Rive file is loaded
5802
5812
  this.loaded = false;
5813
+ // Reference of an object that handles any observers for the animation
5814
+ this._observed = null;
5803
5815
  /**
5804
5816
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
5805
5817
  * commands (e.g. contents) can be called as soon as the file is loaded.
@@ -5941,6 +5953,8 @@ var Rive = /** @class */ (function () {
5941
5953
  RuntimeLoader.awaitInstance()
5942
5954
  .then(function (runtime) {
5943
5955
  _this.runtime = runtime;
5956
+ _this.removeRiveListeners();
5957
+ _this.deleteRiveRenderer();
5944
5958
  // Get the canvas where you want to render the animation and create a renderer
5945
5959
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
5946
5960
  // Initial size adjustment based on devicePixelRatio if no width/height are
@@ -5995,6 +6009,7 @@ var Rive = /** @class */ (function () {
5995
6009
  Rive.prototype.removeRiveListeners = function () {
5996
6010
  if (this.eventCleanup) {
5997
6011
  this.eventCleanup();
6012
+ this.eventCleanup = null;
5998
6013
  }
5999
6014
  };
6000
6015
  /**
@@ -6299,9 +6314,11 @@ var Rive = /** @class */ (function () {
6299
6314
  if (this._observed !== null) {
6300
6315
  observers.remove(this._observed);
6301
6316
  }
6317
+ this.removeRiveListeners();
6302
6318
  (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
6303
6319
  this.riveFile = null;
6304
6320
  this.file = null;
6321
+ this.deleteRiveRenderer();
6305
6322
  };
6306
6323
  /**
6307
6324
  * Cleans up the Renderer object. Only call this API if you no longer