@rive-app/webgl2 2.23.1 → 2.23.3

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.23.1",
3
+ "version": "2.23.3",
4
4
  "description": "Rive's webgl2 based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -73,6 +73,7 @@ export declare class RuntimeLoader {
73
73
  static getInstance(callback: RuntimeCallback): void;
74
74
  static awaitInstance(): Promise<rc.RiveCanvas>;
75
75
  static setWasmUrl(url: string): void;
76
+ static getWasmUrl(): string;
76
77
  }
77
78
  export declare enum StateMachineInputType {
78
79
  Number = 56,
@@ -662,26 +663,26 @@ export declare class Rive {
662
663
  /**
663
664
  * The width of the artboard.
664
665
  *
665
- * This will return undefined if the artboard is not loaded yet and a custom
666
+ * This will return 0 if the artboard is not loaded yet and a custom
666
667
  * width has not been set.
667
668
  *
668
669
  * Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}
669
670
  * with a {@link Layout.fit} of {@link Fit.Layout}, as the artboard width is
670
671
  * automatically set.
671
672
  */
672
- get artboardWidth(): number | undefined;
673
+ get artboardWidth(): number;
673
674
  set artboardWidth(value: number);
674
675
  /**
675
676
  * The height of the artboard.
676
677
  *
677
- * This will return undefined if the artboard is not loaded yet and a custom
678
+ * This will return 0 if the artboard is not loaded yet and a custom
678
679
  * height has not been set.
679
680
  *
680
681
  * Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}
681
682
  * with a {@link Layout.fit} of {@link Fit.Layout}, as the artboard height is
682
683
  * automatically set.
683
684
  */
684
- get artboardHeight(): number | undefined;
685
+ get artboardHeight(): number;
685
686
  set artboardHeight(value: number);
686
687
  /**
687
688
  * Reset the artboard size to its original values.
package/rive.js CHANGED
@@ -423,7 +423,7 @@ function Oa(a, b) {
423
423
  return Na(c, a, b);
424
424
  }));
425
425
  }
426
- var Pa, Qa, Ua = {488133:(a, b, c, d, e) => {
426
+ var Pa, Qa, Ua = {488613:(a, b, c, d, e) => {
427
427
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
428
428
  return 0;
429
429
  }
@@ -486,9 +486,9 @@ var Pa, Qa, Ua = {488133:(a, b, c, d, e) => {
486
486
  }
487
487
  window.h.Da += 1;
488
488
  return 1;
489
- }, 490311:() => {
489
+ }, 490791:() => {
490
490
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
491
- }, 490475:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 490579:() => {
491
+ }, 490955:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 491059:() => {
492
492
  try {
493
493
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
494
494
  a.close();
@@ -496,7 +496,7 @@ var Pa, Qa, Ua = {488133:(a, b, c, d, e) => {
496
496
  } catch (c) {
497
497
  return 0;
498
498
  }
499
- }, 490750:(a, b, c, d, e, f) => {
499
+ }, 491230:(a, b, c, d, e, f) => {
500
500
  if ("undefined" === typeof window.h) {
501
501
  return -1;
502
502
  }
@@ -542,7 +542,7 @@ var Pa, Qa, Ua = {488133:(a, b, c, d, e) => {
542
542
  a == window.h.I.Ba && g.Y.connect(g.J.destination);
543
543
  g.jb = f;
544
544
  return window.h.lc(g);
545
- }, 493627:a => window.h.va(a).J.sampleRate, 493700:a => {
545
+ }, 494107:a => window.h.va(a).J.sampleRate, 494180:a => {
546
546
  a = window.h.va(a);
547
547
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
548
548
  }, a.Y.disconnect(), a.Y = void 0);
@@ -550,13 +550,13 @@ var Pa, Qa, Ua = {488133:(a, b, c, d, e) => {
550
550
  a.J.close();
551
551
  a.J = void 0;
552
552
  a.jb = void 0;
553
- }, 494100:a => {
553
+ }, 494580:a => {
554
554
  window.h.wb(a);
555
- }, 494150:a => {
555
+ }, 494630:a => {
556
556
  a = window.h.va(a);
557
557
  a.J.resume();
558
558
  a.state = window.h.ha.rb;
559
- }, 494289:a => {
559
+ }, 494769:a => {
560
560
  a = window.h.va(a);
561
561
  a.J.suspend();
562
562
  a.state = window.h.ha.stopped;
@@ -3467,8 +3467,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = z.dynCall_viijii
3467
3467
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = z.dynCall_iiiiij)(a, b, c, d, e, f, g);
3468
3468
  n.dynCall_iiiiijj = (a, b, c, d, e, f, g, m, p) => (n.dynCall_iiiiijj = z.dynCall_iiiiijj)(a, b, c, d, e, f, g, m, p);
3469
3469
  n.dynCall_iiiiiijj = (a, b, c, d, e, f, g, m, p, l) => (n.dynCall_iiiiiijj = z.dynCall_iiiiiijj)(a, b, c, d, e, f, g, m, p, l);
3470
- n.___start_em_js = 485508;
3471
- n.___stop_em_js = 488133;
3470
+ n.___start_em_js = 485988;
3471
+ n.___stop_em_js = 488613;
3472
3472
  var Xd;
3473
3473
  Ha = function Yd() {
3474
3474
  Xd || Zd();
@@ -3528,7 +3528,7 @@ Zd();
3528
3528
  /* 2 */
3529
3529
  /***/ ((module) => {
3530
3530
 
3531
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.23.1","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"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3531
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.23.3","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"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3532
3532
 
3533
3533
  /***/ }),
3534
3534
  /* 3 */
@@ -4193,20 +4193,44 @@ var RuntimeLoader = /** @class */ (function () {
4193
4193
  (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
4194
4194
  }
4195
4195
  })
4196
- .catch(function () {
4196
+ .catch(function (error) {
4197
+ // Capture specific error details
4198
+ var errorDetails = {
4199
+ message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error",
4200
+ type: (error === null || error === void 0 ? void 0 : error.name) || "Error",
4201
+ // Some browsers may provide additional WebAssembly-specific details
4202
+ wasmError: error instanceof WebAssembly.CompileError ||
4203
+ error instanceof WebAssembly.RuntimeError,
4204
+ originalError: error,
4205
+ };
4206
+ // Log detailed error for debugging
4207
+ console.debug("Rive WASM load error details:", errorDetails);
4197
4208
  // In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.
4198
4209
  // This `rive_fallback.wasm` is compiled to support older architecture.
4199
4210
  // TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.
4200
4211
  var backupJsdelivrUrl = "https://cdn.jsdelivr.net/npm/".concat(package_json__WEBPACK_IMPORTED_MODULE_1__.name, "@").concat(package_json__WEBPACK_IMPORTED_MODULE_1__.version, "/rive_fallback.wasm");
4201
4212
  if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {
4202
- console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, ", trying jsdelivr as a backup"));
4213
+ console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup"));
4203
4214
  RuntimeLoader.setWasmUrl(backupJsdelivrUrl);
4204
4215
  RuntimeLoader.loadRuntime();
4205
4216
  }
4206
4217
  else {
4207
- console.error("Could not load Rive WASM file from unpkg or jsdelivr, network connection may be down, or \
4208
- you may need to call set a new WASM source via RuntimeLoader.setWasmUrl() and call \
4209
- RuntimeLoader.loadRuntime() again");
4218
+ var errorMessage = [
4219
+ "Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."),
4220
+ "Possible reasons:",
4221
+ "- Network connection is down",
4222
+ "- WebAssembly is not supported in this environment",
4223
+ "- The WASM file is corrupted or incompatible",
4224
+ "\nError details:",
4225
+ "- Type: ".concat(errorDetails.type),
4226
+ "- Message: ".concat(errorDetails.message),
4227
+ "- WebAssembly-specific error: ".concat(errorDetails.wasmError),
4228
+ "\nTo resolve, you may need to:",
4229
+ "1. Check your network connection",
4230
+ "2. Set a new WASM source via RuntimeLoader.setWasmUrl()",
4231
+ "3. Call RuntimeLoader.loadRuntime() again",
4232
+ ].join("\n");
4233
+ console.error(errorMessage);
4210
4234
  }
4211
4235
  });
4212
4236
  };
@@ -4234,6 +4258,10 @@ var RuntimeLoader = /** @class */ (function () {
4234
4258
  RuntimeLoader.setWasmUrl = function (url) {
4235
4259
  RuntimeLoader.wasmURL = url;
4236
4260
  };
4261
+ // Gets the current wasm url
4262
+ RuntimeLoader.getWasmUrl = function () {
4263
+ return RuntimeLoader.wasmURL;
4264
+ };
4237
4265
  // Flag to indicate that loading has started/completed
4238
4266
  RuntimeLoader.isLoading = false;
4239
4267
  // List of callbacks for the runtime that come in while loading
@@ -6440,7 +6468,7 @@ var Rive = /** @class */ (function () {
6440
6468
  /**
6441
6469
  * The width of the artboard.
6442
6470
  *
6443
- * This will return undefined if the artboard is not loaded yet and a custom
6471
+ * This will return 0 if the artboard is not loaded yet and a custom
6444
6472
  * width has not been set.
6445
6473
  *
6446
6474
  * Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}
@@ -6448,10 +6476,11 @@ var Rive = /** @class */ (function () {
6448
6476
  * automatically set.
6449
6477
  */
6450
6478
  get: function () {
6479
+ var _a;
6451
6480
  if (this.artboard) {
6452
6481
  return this.artboard.width;
6453
6482
  }
6454
- return this._artboardWidth;
6483
+ return (_a = this._artboardWidth) !== null && _a !== void 0 ? _a : 0;
6455
6484
  },
6456
6485
  set: function (value) {
6457
6486
  this._artboardWidth = value;
@@ -6466,7 +6495,7 @@ var Rive = /** @class */ (function () {
6466
6495
  /**
6467
6496
  * The height of the artboard.
6468
6497
  *
6469
- * This will return undefined if the artboard is not loaded yet and a custom
6498
+ * This will return 0 if the artboard is not loaded yet and a custom
6470
6499
  * height has not been set.
6471
6500
  *
6472
6501
  * Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}
@@ -6474,10 +6503,11 @@ var Rive = /** @class */ (function () {
6474
6503
  * automatically set.
6475
6504
  */
6476
6505
  get: function () {
6506
+ var _a;
6477
6507
  if (this.artboard) {
6478
6508
  return this.artboard.height;
6479
6509
  }
6480
- return this._artboardHeight;
6510
+ return (_a = this._artboardHeight) !== null && _a !== void 0 ? _a : 0;
6481
6511
  },
6482
6512
  set: function (value) {
6483
6513
  this._artboardHeight = value;