@rive-app/webgl 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 +1 -1
- package/rive.d.ts +5 -4
- package/rive.js +48 -18
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
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
|
|
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
|
|
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
|
|
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
|
|
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
|
@@ -408,7 +408,7 @@ function Qa(a, b) {
|
|
|
408
408
|
return Pa(c, a, b);
|
|
409
409
|
}));
|
|
410
410
|
}
|
|
411
|
-
var Ra, Sa, Wa = {
|
|
411
|
+
var Ra, Sa, Wa = {696588:(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 = {696428:(a, b, c, d, e) => {
|
|
|
471
471
|
}
|
|
472
472
|
window.h.Ea += 1;
|
|
473
473
|
return 1;
|
|
474
|
-
},
|
|
474
|
+
}, 698766:() => {
|
|
475
475
|
"undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
|
|
476
|
-
},
|
|
476
|
+
}, 698930:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 699034:() => {
|
|
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 = {696428:(a, b, c, d, e) => {
|
|
|
481
481
|
} catch (c) {
|
|
482
482
|
return 0;
|
|
483
483
|
}
|
|
484
|
-
},
|
|
484
|
+
}, 699205:(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 = {696428:(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
|
-
},
|
|
530
|
+
}, 702082:a => window.h.ta(a).I.sampleRate, 702155: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 = {696428:(a, b, c, d, e) => {
|
|
|
535
535
|
a.I.close();
|
|
536
536
|
a.I = void 0;
|
|
537
537
|
a.lb = void 0;
|
|
538
|
-
},
|
|
538
|
+
}, 702555:a => {
|
|
539
539
|
window.h.xb(a);
|
|
540
|
-
},
|
|
540
|
+
}, 702605:a => {
|
|
541
541
|
a = window.h.ta(a);
|
|
542
542
|
a.I.resume();
|
|
543
543
|
a.state = window.h.ha.sb;
|
|
544
|
-
},
|
|
544
|
+
}, 702744: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.
|
|
4064
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.23.3","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 */
|
|
@@ -4726,20 +4726,44 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
4726
4726
|
(_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
|
|
4727
4727
|
}
|
|
4728
4728
|
})
|
|
4729
|
-
.catch(function () {
|
|
4729
|
+
.catch(function (error) {
|
|
4730
|
+
// Capture specific error details
|
|
4731
|
+
var errorDetails = {
|
|
4732
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error",
|
|
4733
|
+
type: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
4734
|
+
// Some browsers may provide additional WebAssembly-specific details
|
|
4735
|
+
wasmError: error instanceof WebAssembly.CompileError ||
|
|
4736
|
+
error instanceof WebAssembly.RuntimeError,
|
|
4737
|
+
originalError: error,
|
|
4738
|
+
};
|
|
4739
|
+
// Log detailed error for debugging
|
|
4740
|
+
console.debug("Rive WASM load error details:", errorDetails);
|
|
4730
4741
|
// In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.
|
|
4731
4742
|
// This `rive_fallback.wasm` is compiled to support older architecture.
|
|
4732
4743
|
// TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.
|
|
4733
4744
|
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");
|
|
4734
4745
|
if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {
|
|
4735
|
-
console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, ", trying jsdelivr as a backup"));
|
|
4746
|
+
console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup"));
|
|
4736
4747
|
RuntimeLoader.setWasmUrl(backupJsdelivrUrl);
|
|
4737
4748
|
RuntimeLoader.loadRuntime();
|
|
4738
4749
|
}
|
|
4739
4750
|
else {
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4751
|
+
var errorMessage = [
|
|
4752
|
+
"Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."),
|
|
4753
|
+
"Possible reasons:",
|
|
4754
|
+
"- Network connection is down",
|
|
4755
|
+
"- WebAssembly is not supported in this environment",
|
|
4756
|
+
"- The WASM file is corrupted or incompatible",
|
|
4757
|
+
"\nError details:",
|
|
4758
|
+
"- Type: ".concat(errorDetails.type),
|
|
4759
|
+
"- Message: ".concat(errorDetails.message),
|
|
4760
|
+
"- WebAssembly-specific error: ".concat(errorDetails.wasmError),
|
|
4761
|
+
"\nTo resolve, you may need to:",
|
|
4762
|
+
"1. Check your network connection",
|
|
4763
|
+
"2. Set a new WASM source via RuntimeLoader.setWasmUrl()",
|
|
4764
|
+
"3. Call RuntimeLoader.loadRuntime() again",
|
|
4765
|
+
].join("\n");
|
|
4766
|
+
console.error(errorMessage);
|
|
4743
4767
|
}
|
|
4744
4768
|
});
|
|
4745
4769
|
};
|
|
@@ -4767,6 +4791,10 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
4767
4791
|
RuntimeLoader.setWasmUrl = function (url) {
|
|
4768
4792
|
RuntimeLoader.wasmURL = url;
|
|
4769
4793
|
};
|
|
4794
|
+
// Gets the current wasm url
|
|
4795
|
+
RuntimeLoader.getWasmUrl = function () {
|
|
4796
|
+
return RuntimeLoader.wasmURL;
|
|
4797
|
+
};
|
|
4770
4798
|
// Flag to indicate that loading has started/completed
|
|
4771
4799
|
RuntimeLoader.isLoading = false;
|
|
4772
4800
|
// List of callbacks for the runtime that come in while loading
|
|
@@ -6973,7 +7001,7 @@ var Rive = /** @class */ (function () {
|
|
|
6973
7001
|
/**
|
|
6974
7002
|
* The width of the artboard.
|
|
6975
7003
|
*
|
|
6976
|
-
* This will return
|
|
7004
|
+
* This will return 0 if the artboard is not loaded yet and a custom
|
|
6977
7005
|
* width has not been set.
|
|
6978
7006
|
*
|
|
6979
7007
|
* Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}
|
|
@@ -6981,10 +7009,11 @@ var Rive = /** @class */ (function () {
|
|
|
6981
7009
|
* automatically set.
|
|
6982
7010
|
*/
|
|
6983
7011
|
get: function () {
|
|
7012
|
+
var _a;
|
|
6984
7013
|
if (this.artboard) {
|
|
6985
7014
|
return this.artboard.width;
|
|
6986
7015
|
}
|
|
6987
|
-
return this._artboardWidth;
|
|
7016
|
+
return (_a = this._artboardWidth) !== null && _a !== void 0 ? _a : 0;
|
|
6988
7017
|
},
|
|
6989
7018
|
set: function (value) {
|
|
6990
7019
|
this._artboardWidth = value;
|
|
@@ -6999,7 +7028,7 @@ var Rive = /** @class */ (function () {
|
|
|
6999
7028
|
/**
|
|
7000
7029
|
* The height of the artboard.
|
|
7001
7030
|
*
|
|
7002
|
-
* This will return
|
|
7031
|
+
* This will return 0 if the artboard is not loaded yet and a custom
|
|
7003
7032
|
* height has not been set.
|
|
7004
7033
|
*
|
|
7005
7034
|
* Do not set this value manually when using {@link resizeDrawingSurfaceToCanvas}
|
|
@@ -7007,10 +7036,11 @@ var Rive = /** @class */ (function () {
|
|
|
7007
7036
|
* automatically set.
|
|
7008
7037
|
*/
|
|
7009
7038
|
get: function () {
|
|
7039
|
+
var _a;
|
|
7010
7040
|
if (this.artboard) {
|
|
7011
7041
|
return this.artboard.height;
|
|
7012
7042
|
}
|
|
7013
|
-
return this._artboardHeight;
|
|
7043
|
+
return (_a = this._artboardHeight) !== null && _a !== void 0 ? _a : 0;
|
|
7014
7044
|
},
|
|
7015
7045
|
set: function (value) {
|
|
7016
7046
|
this._artboardHeight = value;
|