@rive-app/webgl 2.27.5 → 2.28.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 +1 -1
- package/rive.d.ts +2 -0
- package/rive.js +46 -26
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +1 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -317,6 +317,7 @@ export declare class RiveFile {
|
|
|
317
317
|
constructor(params: RiveFileParameters);
|
|
318
318
|
private initData;
|
|
319
319
|
init(): Promise<void>;
|
|
320
|
+
private fireLoadError;
|
|
320
321
|
/**
|
|
321
322
|
* Subscribe to Rive-generated events
|
|
322
323
|
* @param type the type of event to subscribe to
|
|
@@ -882,6 +883,7 @@ export declare class ViewModelInstanceList extends ViewModelInstanceValue {
|
|
|
882
883
|
removeInstance(instance: ViewModelInstance): void;
|
|
883
884
|
removeInstanceAt(index: number): void;
|
|
884
885
|
instanceAt(index: number): ViewModelInstance | null;
|
|
886
|
+
swap(a: number, b: number): void;
|
|
885
887
|
internalHandleCallback(callback: Function): void;
|
|
886
888
|
}
|
|
887
889
|
export declare class ViewModelInstanceColor extends ViewModelInstanceValue {
|
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 = {711180:(a, b, c, d, e) => {
|
|
412
412
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
413
413
|
return 0;
|
|
414
414
|
}
|
|
@@ -471,11 +471,11 @@ var Ra, Sa, Wa = {708524:(a, b, c, d, e) => {
|
|
|
471
471
|
}
|
|
472
472
|
window.h.Ea += 1;
|
|
473
473
|
return 1;
|
|
474
|
-
},
|
|
474
|
+
}, 713358:() => {
|
|
475
475
|
"undefined" !== typeof window.h && (window.h.Ta.map(function(a) {
|
|
476
476
|
document.removeEventListener(a, window.h.unlock, !0);
|
|
477
477
|
}), --window.h.Ea, 0 === window.h.Ea && delete window.h);
|
|
478
|
-
},
|
|
478
|
+
}, 713662:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 713766:() => {
|
|
479
479
|
try {
|
|
480
480
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
481
481
|
a.close();
|
|
@@ -483,7 +483,7 @@ var Ra, Sa, Wa = {708524:(a, b, c, d, e) => {
|
|
|
483
483
|
} catch (c) {
|
|
484
484
|
return 0;
|
|
485
485
|
}
|
|
486
|
-
},
|
|
486
|
+
}, 713937:(a, b, c, d, e, f) => {
|
|
487
487
|
if ("undefined" === typeof window.h) {
|
|
488
488
|
return -1;
|
|
489
489
|
}
|
|
@@ -529,7 +529,7 @@ var Ra, Sa, Wa = {708524:(a, b, c, d, e) => {
|
|
|
529
529
|
a == window.h.H.Ca && g.X.connect(g.I.destination);
|
|
530
530
|
g.mb = f;
|
|
531
531
|
return window.h.nc(g);
|
|
532
|
-
},
|
|
532
|
+
}, 716814:a => window.h.ta(a).I.sampleRate, 716887:a => {
|
|
533
533
|
a = window.h.ta(a);
|
|
534
534
|
void 0 !== a.X && (a.X.onaudioprocess = function() {
|
|
535
535
|
}, a.X.disconnect(), a.X = void 0);
|
|
@@ -537,13 +537,13 @@ var Ra, Sa, Wa = {708524:(a, b, c, d, e) => {
|
|
|
537
537
|
a.I.close();
|
|
538
538
|
a.I = void 0;
|
|
539
539
|
a.mb = void 0;
|
|
540
|
-
},
|
|
540
|
+
}, 717287:a => {
|
|
541
541
|
window.h.xb(a);
|
|
542
|
-
},
|
|
542
|
+
}, 717337:a => {
|
|
543
543
|
a = window.h.ta(a);
|
|
544
544
|
a.I.resume();
|
|
545
545
|
a.state = window.h.ha.tb;
|
|
546
|
-
},
|
|
546
|
+
}, 717476:a => {
|
|
547
547
|
a = window.h.ta(a);
|
|
548
548
|
a.I.suspend();
|
|
549
549
|
a.state = window.h.ha.stopped;
|
|
@@ -4065,7 +4065,7 @@ Je();
|
|
|
4065
4065
|
/* 2 */
|
|
4066
4066
|
/***/ ((module) => {
|
|
4067
4067
|
|
|
4068
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl","version":"2.
|
|
4068
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl","version":"2.28.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}}');
|
|
4069
4069
|
|
|
4070
4070
|
/***/ }),
|
|
4071
4071
|
/* 3 */
|
|
@@ -6062,11 +6062,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
6062
6062
|
});
|
|
6063
6063
|
}
|
|
6064
6064
|
else {
|
|
6065
|
-
this.
|
|
6066
|
-
type: EventType.LoadError,
|
|
6067
|
-
data: null,
|
|
6068
|
-
});
|
|
6069
|
-
throw new Error(RiveFile.fileLoadErrorMessage);
|
|
6065
|
+
this.fireLoadError(RiveFile.fileLoadErrorMessage);
|
|
6070
6066
|
}
|
|
6071
6067
|
return [2 /*return*/];
|
|
6072
6068
|
}
|
|
@@ -6075,29 +6071,45 @@ var RiveFile = /** @class */ (function () {
|
|
|
6075
6071
|
};
|
|
6076
6072
|
RiveFile.prototype.init = function () {
|
|
6077
6073
|
return __awaiter(this, void 0, void 0, function () {
|
|
6078
|
-
var _a;
|
|
6074
|
+
var _a, error_1;
|
|
6079
6075
|
return __generator(this, function (_b) {
|
|
6080
6076
|
switch (_b.label) {
|
|
6081
6077
|
case 0:
|
|
6082
6078
|
// If no source file url specified, it's a bust
|
|
6083
6079
|
if (!this.src && !this.buffer) {
|
|
6084
|
-
|
|
6080
|
+
this.fireLoadError(RiveFile.missingErrorMessage);
|
|
6081
|
+
return [2 /*return*/];
|
|
6085
6082
|
}
|
|
6083
|
+
_b.label = 1;
|
|
6084
|
+
case 1:
|
|
6085
|
+
_b.trys.push([1, 4, , 5]);
|
|
6086
6086
|
_a = this;
|
|
6087
6087
|
return [4 /*yield*/, RuntimeLoader.awaitInstance()];
|
|
6088
|
-
case
|
|
6088
|
+
case 2:
|
|
6089
6089
|
_a.runtime = _b.sent();
|
|
6090
6090
|
if (this.destroyed) {
|
|
6091
6091
|
return [2 /*return*/];
|
|
6092
6092
|
}
|
|
6093
6093
|
return [4 /*yield*/, this.initData()];
|
|
6094
|
-
case
|
|
6094
|
+
case 3:
|
|
6095
6095
|
_b.sent();
|
|
6096
|
-
return [
|
|
6096
|
+
return [3 /*break*/, 5];
|
|
6097
|
+
case 4:
|
|
6098
|
+
error_1 = _b.sent();
|
|
6099
|
+
this.fireLoadError(error_1 instanceof Error ? error_1.message : RiveFile.fileLoadErrorMessage);
|
|
6100
|
+
return [3 /*break*/, 5];
|
|
6101
|
+
case 5: return [2 /*return*/];
|
|
6097
6102
|
}
|
|
6098
6103
|
});
|
|
6099
6104
|
});
|
|
6100
6105
|
};
|
|
6106
|
+
RiveFile.prototype.fireLoadError = function (message) {
|
|
6107
|
+
this.eventManager.fire({
|
|
6108
|
+
type: EventType.LoadError,
|
|
6109
|
+
data: message,
|
|
6110
|
+
});
|
|
6111
|
+
throw new Error(message);
|
|
6112
|
+
};
|
|
6101
6113
|
/**
|
|
6102
6114
|
* Subscribe to Rive-generated events
|
|
6103
6115
|
* @param type the type of event to subscribe to
|
|
@@ -6428,7 +6440,7 @@ var Rive = /** @class */ (function () {
|
|
|
6428
6440
|
// Returns true for successful initialization.
|
|
6429
6441
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
6430
6442
|
return __awaiter(this, void 0, void 0, function () {
|
|
6431
|
-
var
|
|
6443
|
+
var error_2, msg;
|
|
6432
6444
|
var _a;
|
|
6433
6445
|
return __generator(this, function (_b) {
|
|
6434
6446
|
switch (_b.label) {
|
|
@@ -6470,8 +6482,8 @@ var Rive = /** @class */ (function () {
|
|
|
6470
6482
|
this.drawFrame();
|
|
6471
6483
|
return [2 /*return*/, true];
|
|
6472
6484
|
case 3:
|
|
6473
|
-
|
|
6474
|
-
msg = resolveErrorMessage(
|
|
6485
|
+
error_2 = _b.sent();
|
|
6486
|
+
msg = resolveErrorMessage(error_2);
|
|
6475
6487
|
console.warn(msg);
|
|
6476
6488
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
6477
6489
|
return [2 /*return*/, Promise.reject(msg)];
|
|
@@ -7719,9 +7731,12 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
7719
7731
|
this._children.forEach(function (child) { return child.handleCallbacks(); });
|
|
7720
7732
|
};
|
|
7721
7733
|
ViewModelInstance.prototype.addParent = function (parent) {
|
|
7722
|
-
this._parents.
|
|
7723
|
-
|
|
7724
|
-
|
|
7734
|
+
if (!this._parents.includes(parent)) {
|
|
7735
|
+
this._parents.push(parent);
|
|
7736
|
+
if (this._propertiesWithCallbacks.length > 0 ||
|
|
7737
|
+
this._children.length > 0) {
|
|
7738
|
+
parent.addToViewModelCallbacks(this);
|
|
7739
|
+
}
|
|
7725
7740
|
}
|
|
7726
7741
|
};
|
|
7727
7742
|
ViewModelInstance.prototype.removeParent = function (parent) {
|
|
@@ -8248,11 +8263,13 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
8248
8263
|
ViewModelInstanceList.prototype.addInstance = function (instance) {
|
|
8249
8264
|
if (instance.runtimeInstance != null) {
|
|
8250
8265
|
this._viewModelInstanceValue.addInstance(instance.runtimeInstance);
|
|
8266
|
+
instance.addParent(this._parentViewModel);
|
|
8251
8267
|
}
|
|
8252
8268
|
};
|
|
8253
8269
|
ViewModelInstanceList.prototype.removeInstance = function (instance) {
|
|
8254
8270
|
if (instance.runtimeInstance != null) {
|
|
8255
8271
|
this._viewModelInstanceValue.removeInstance(instance.runtimeInstance);
|
|
8272
|
+
instance.removeParent(this._parentViewModel);
|
|
8256
8273
|
}
|
|
8257
8274
|
};
|
|
8258
8275
|
ViewModelInstanceList.prototype.removeInstanceAt = function (index) {
|
|
@@ -8261,11 +8278,14 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
8261
8278
|
ViewModelInstanceList.prototype.instanceAt = function (index) {
|
|
8262
8279
|
var runtimeInstance = this._viewModelInstanceValue.instanceAt(index);
|
|
8263
8280
|
if (runtimeInstance != null) {
|
|
8264
|
-
var viewModelInstance = new ViewModelInstance(runtimeInstance,
|
|
8281
|
+
var viewModelInstance = new ViewModelInstance(runtimeInstance, this._parentViewModel);
|
|
8265
8282
|
return viewModelInstance;
|
|
8266
8283
|
}
|
|
8267
8284
|
return null;
|
|
8268
8285
|
};
|
|
8286
|
+
ViewModelInstanceList.prototype.swap = function (a, b) {
|
|
8287
|
+
this._viewModelInstanceValue.swap(a, b);
|
|
8288
|
+
};
|
|
8269
8289
|
ViewModelInstanceList.prototype.internalHandleCallback = function (callback) {
|
|
8270
8290
|
callback();
|
|
8271
8291
|
};
|