@rive-app/webgl2 2.37.6 → 2.37.7

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",
3
- "version": "2.37.6",
3
+ "version": "2.37.7",
4
4
  "description": "Rive's webgl2 based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
@@ -25,6 +25,7 @@
25
25
  "files": [
26
26
  "rive.js",
27
27
  "rive.wasm",
28
+ "rive_fallback.wasm",
28
29
  "rive.js.map",
29
30
  "rive.d.ts",
30
31
  "rive_advanced.mjs.d.ts",
package/rive.js CHANGED
@@ -617,6 +617,9 @@ l.onRuntimeInitialized = function() {
617
617
  C.width = 1;
618
618
  C.height = 1;
619
619
  d = b(C, A);
620
+ if (!d) {
621
+ return null;
622
+ }
620
623
  d.Ya = !!d.T.getExtension("WEBGL_shader_pixel_local_storage");
621
624
  d.Db = Math.min(d.T.getParameter(d.T.MAX_RENDERBUFFER_SIZE), d.T.getParameter(d.T.MAX_TEXTURE_SIZE));
622
625
  d.Ka = !d.Ya;
@@ -626,6 +629,9 @@ l.onRuntimeInitialized = function() {
626
629
  return d;
627
630
  }
628
631
  d = z(!0);
632
+ if (!d) {
633
+ throw "Unable to create WebGL context, your environment may not support WebGL. Try out @rive-app/canvas as an alternative.";
634
+ }
629
635
  d.Ka || (d = z(!1));
630
636
  }
631
637
  return u ? new a(r) : b(r, d.Ka);
@@ -763,7 +769,7 @@ function Na(a, b) {
763
769
  return Ma(c, a, b);
764
770
  }));
765
771
  }
766
- var Oa, Pa, Ta = {569592:(a, b, c, d, e) => {
772
+ var Oa, Pa, Ta = {569208:(a, b, c, d, e) => {
767
773
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
768
774
  return 0;
769
775
  }
@@ -826,11 +832,11 @@ var Oa, Pa, Ta = {569592:(a, b, c, d, e) => {
826
832
  }
827
833
  window.h.Ea += 1;
828
834
  return 1;
829
- }, 571770:() => {
835
+ }, 571386:() => {
830
836
  "undefined" !== typeof window.h && (window.h.Xa.map(function(a) {
831
837
  document.removeEventListener(a, window.h.unlock, !0);
832
838
  }), --window.h.Ea, 0 === window.h.Ea && delete window.h);
833
- }, 572074:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 572178:() => {
839
+ }, 571690:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 571794:() => {
834
840
  try {
835
841
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
836
842
  a.close();
@@ -838,7 +844,7 @@ var Oa, Pa, Ta = {569592:(a, b, c, d, e) => {
838
844
  } catch (c) {
839
845
  return 0;
840
846
  }
841
- }, 572349:(a, b, c, d, e, f) => {
847
+ }, 571965:(a, b, c, d, e, f) => {
842
848
  if ("undefined" === typeof window.h) {
843
849
  return -1;
844
850
  }
@@ -884,7 +890,7 @@ var Oa, Pa, Ta = {569592:(a, b, c, d, e) => {
884
890
  a == window.h.I.Ba && g.Y.connect(g.K.destination);
885
891
  g.nb = f;
886
892
  return window.h.mc(g);
887
- }, 575226:a => window.h.sa(a).K.sampleRate, 575299:a => {
893
+ }, 574842:a => window.h.sa(a).K.sampleRate, 574915:a => {
888
894
  a = window.h.sa(a);
889
895
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
890
896
  }, a.Y.disconnect(), a.Y = void 0);
@@ -892,13 +898,13 @@ var Oa, Pa, Ta = {569592:(a, b, c, d, e) => {
892
898
  a.K.close();
893
899
  a.K = void 0;
894
900
  a.nb = void 0;
895
- }, 575699:a => {
901
+ }, 575315:a => {
896
902
  window.h.yb(a);
897
- }, 575749:a => {
903
+ }, 575365:a => {
898
904
  a = window.h.sa(a);
899
905
  a.K.resume();
900
906
  a.state = window.h.ha.ub;
901
- }, 575888:a => {
907
+ }, 575504:a => {
902
908
  a = window.h.sa(a);
903
909
  a.K.suspend();
904
910
  a.state = window.h.ha.stopped;
@@ -3901,7 +3907,7 @@ moduleRtn = ca;
3901
3907
  /* 5 */
3902
3908
  /***/ ((module) => {
3903
3909
 
3904
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.37.6","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3910
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.37.7","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3905
3911
 
3906
3912
  /***/ }),
3907
3913
  /* 6 */
@@ -6364,7 +6370,16 @@ var Rive = /** @class */ (function () {
6364
6370
  // Get the canvas where you want to render the animation and create a renderer
6365
6371
  if (_this.enablePerfMarks)
6366
6372
  performance.mark('rive:make-renderer:start');
6367
- _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
6373
+ try {
6374
+ _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
6375
+ if (!_this.renderer) {
6376
+ throw new Error("Renderer is null, cannot render Rive on the canvas.");
6377
+ }
6378
+ }
6379
+ catch (e) {
6380
+ console.error(e);
6381
+ throw new RiveError("Unable to create the renderer, your environment may not support WebGL. Try the @rive-app/canvas runtime as an alternative.");
6382
+ }
6368
6383
  if (_this.enablePerfMarks) {
6369
6384
  performance.mark('rive:make-renderer:end');
6370
6385
  performance.measure('rive:make-renderer', 'rive:make-renderer:start', 'rive:make-renderer:end');