@rive-app/webgl2 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 +48 -28
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +1 -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
|
@@ -442,7 +442,7 @@ function Oa(a, b) {
|
|
|
442
442
|
return Na(c, a, b);
|
|
443
443
|
}));
|
|
444
444
|
}
|
|
445
|
-
var Pa, Qa, Ua = {
|
|
445
|
+
var Pa, Qa, Ua = {522327:(a, b, c, d, e) => {
|
|
446
446
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
447
447
|
return 0;
|
|
448
448
|
}
|
|
@@ -505,11 +505,11 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
|
|
|
505
505
|
}
|
|
506
506
|
window.h.Da += 1;
|
|
507
507
|
return 1;
|
|
508
|
-
},
|
|
508
|
+
}, 524505:() => {
|
|
509
509
|
"undefined" !== typeof window.h && (window.h.Va.map(function(a) {
|
|
510
510
|
document.removeEventListener(a, window.h.unlock, !0);
|
|
511
511
|
}), --window.h.Da, 0 === window.h.Da && delete window.h);
|
|
512
|
-
},
|
|
512
|
+
}, 524809:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 524913:() => {
|
|
513
513
|
try {
|
|
514
514
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
515
515
|
a.close();
|
|
@@ -517,7 +517,7 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
|
|
|
517
517
|
} catch (c) {
|
|
518
518
|
return 0;
|
|
519
519
|
}
|
|
520
|
-
},
|
|
520
|
+
}, 525084:(a, b, c, d, e, f) => {
|
|
521
521
|
if ("undefined" === typeof window.h) {
|
|
522
522
|
return -1;
|
|
523
523
|
}
|
|
@@ -563,7 +563,7 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
|
|
|
563
563
|
a == window.h.I.Ba && g.Z.connect(g.J.destination);
|
|
564
564
|
g.mb = f;
|
|
565
565
|
return window.h.oc(g);
|
|
566
|
-
},
|
|
566
|
+
}, 527961:a => window.h.va(a).J.sampleRate, 528034:a => {
|
|
567
567
|
a = window.h.va(a);
|
|
568
568
|
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
|
|
569
569
|
}, a.Z.disconnect(), a.Z = void 0);
|
|
@@ -571,13 +571,13 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
|
|
|
571
571
|
a.J.close();
|
|
572
572
|
a.J = void 0;
|
|
573
573
|
a.mb = void 0;
|
|
574
|
-
},
|
|
574
|
+
}, 528434:a => {
|
|
575
575
|
window.h.yb(a);
|
|
576
|
-
},
|
|
576
|
+
}, 528484:a => {
|
|
577
577
|
a = window.h.va(a);
|
|
578
578
|
a.J.resume();
|
|
579
579
|
a.state = window.h.ja.ub;
|
|
580
|
-
},
|
|
580
|
+
}, 528623:a => {
|
|
581
581
|
a = window.h.va(a);
|
|
582
582
|
a.J.suspend();
|
|
583
583
|
a.state = window.h.ja.stopped;
|
|
@@ -3501,8 +3501,8 @@ k.dynCall_viijii = (a, b, c, d, e, f, g) => (k.dynCall_viijii = C.dynCall_viijii
|
|
|
3501
3501
|
k.dynCall_iiiiij = (a, b, c, d, e, f, g) => (k.dynCall_iiiiij = C.dynCall_iiiiij)(a, b, c, d, e, f, g);
|
|
3502
3502
|
k.dynCall_iiiiijj = (a, b, c, d, e, f, g, l, p) => (k.dynCall_iiiiijj = C.dynCall_iiiiijj)(a, b, c, d, e, f, g, l, p);
|
|
3503
3503
|
k.dynCall_iiiiiijj = (a, b, c, d, e, f, g, l, p, m) => (k.dynCall_iiiiiijj = C.dynCall_iiiiiijj)(a, b, c, d, e, f, g, l, p, m);
|
|
3504
|
-
k.___start_em_js =
|
|
3505
|
-
k.___stop_em_js =
|
|
3504
|
+
k.___start_em_js = 519572;
|
|
3505
|
+
k.___stop_em_js = 522327;
|
|
3506
3506
|
var Zd;
|
|
3507
3507
|
Ha = function $d() {
|
|
3508
3508
|
Zd || ae();
|
|
@@ -3562,7 +3562,7 @@ ae();
|
|
|
3562
3562
|
/* 2 */
|
|
3563
3563
|
/***/ ((module) => {
|
|
3564
3564
|
|
|
3565
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.
|
|
3565
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.28.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}}');
|
|
3566
3566
|
|
|
3567
3567
|
/***/ }),
|
|
3568
3568
|
/* 3 */
|
|
@@ -5559,11 +5559,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
5559
5559
|
});
|
|
5560
5560
|
}
|
|
5561
5561
|
else {
|
|
5562
|
-
this.
|
|
5563
|
-
type: EventType.LoadError,
|
|
5564
|
-
data: null,
|
|
5565
|
-
});
|
|
5566
|
-
throw new Error(RiveFile.fileLoadErrorMessage);
|
|
5562
|
+
this.fireLoadError(RiveFile.fileLoadErrorMessage);
|
|
5567
5563
|
}
|
|
5568
5564
|
return [2 /*return*/];
|
|
5569
5565
|
}
|
|
@@ -5572,29 +5568,45 @@ var RiveFile = /** @class */ (function () {
|
|
|
5572
5568
|
};
|
|
5573
5569
|
RiveFile.prototype.init = function () {
|
|
5574
5570
|
return __awaiter(this, void 0, void 0, function () {
|
|
5575
|
-
var _a;
|
|
5571
|
+
var _a, error_1;
|
|
5576
5572
|
return __generator(this, function (_b) {
|
|
5577
5573
|
switch (_b.label) {
|
|
5578
5574
|
case 0:
|
|
5579
5575
|
// If no source file url specified, it's a bust
|
|
5580
5576
|
if (!this.src && !this.buffer) {
|
|
5581
|
-
|
|
5577
|
+
this.fireLoadError(RiveFile.missingErrorMessage);
|
|
5578
|
+
return [2 /*return*/];
|
|
5582
5579
|
}
|
|
5580
|
+
_b.label = 1;
|
|
5581
|
+
case 1:
|
|
5582
|
+
_b.trys.push([1, 4, , 5]);
|
|
5583
5583
|
_a = this;
|
|
5584
5584
|
return [4 /*yield*/, RuntimeLoader.awaitInstance()];
|
|
5585
|
-
case
|
|
5585
|
+
case 2:
|
|
5586
5586
|
_a.runtime = _b.sent();
|
|
5587
5587
|
if (this.destroyed) {
|
|
5588
5588
|
return [2 /*return*/];
|
|
5589
5589
|
}
|
|
5590
5590
|
return [4 /*yield*/, this.initData()];
|
|
5591
|
-
case
|
|
5591
|
+
case 3:
|
|
5592
5592
|
_b.sent();
|
|
5593
|
-
return [
|
|
5593
|
+
return [3 /*break*/, 5];
|
|
5594
|
+
case 4:
|
|
5595
|
+
error_1 = _b.sent();
|
|
5596
|
+
this.fireLoadError(error_1 instanceof Error ? error_1.message : RiveFile.fileLoadErrorMessage);
|
|
5597
|
+
return [3 /*break*/, 5];
|
|
5598
|
+
case 5: return [2 /*return*/];
|
|
5594
5599
|
}
|
|
5595
5600
|
});
|
|
5596
5601
|
});
|
|
5597
5602
|
};
|
|
5603
|
+
RiveFile.prototype.fireLoadError = function (message) {
|
|
5604
|
+
this.eventManager.fire({
|
|
5605
|
+
type: EventType.LoadError,
|
|
5606
|
+
data: message,
|
|
5607
|
+
});
|
|
5608
|
+
throw new Error(message);
|
|
5609
|
+
};
|
|
5598
5610
|
/**
|
|
5599
5611
|
* Subscribe to Rive-generated events
|
|
5600
5612
|
* @param type the type of event to subscribe to
|
|
@@ -5925,7 +5937,7 @@ var Rive = /** @class */ (function () {
|
|
|
5925
5937
|
// Returns true for successful initialization.
|
|
5926
5938
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
5927
5939
|
return __awaiter(this, void 0, void 0, function () {
|
|
5928
|
-
var
|
|
5940
|
+
var error_2, msg;
|
|
5929
5941
|
var _a;
|
|
5930
5942
|
return __generator(this, function (_b) {
|
|
5931
5943
|
switch (_b.label) {
|
|
@@ -5967,8 +5979,8 @@ var Rive = /** @class */ (function () {
|
|
|
5967
5979
|
this.drawFrame();
|
|
5968
5980
|
return [2 /*return*/, true];
|
|
5969
5981
|
case 3:
|
|
5970
|
-
|
|
5971
|
-
msg = resolveErrorMessage(
|
|
5982
|
+
error_2 = _b.sent();
|
|
5983
|
+
msg = resolveErrorMessage(error_2);
|
|
5972
5984
|
console.warn(msg);
|
|
5973
5985
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
5974
5986
|
return [2 /*return*/, Promise.reject(msg)];
|
|
@@ -7216,9 +7228,12 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
7216
7228
|
this._children.forEach(function (child) { return child.handleCallbacks(); });
|
|
7217
7229
|
};
|
|
7218
7230
|
ViewModelInstance.prototype.addParent = function (parent) {
|
|
7219
|
-
this._parents.
|
|
7220
|
-
|
|
7221
|
-
|
|
7231
|
+
if (!this._parents.includes(parent)) {
|
|
7232
|
+
this._parents.push(parent);
|
|
7233
|
+
if (this._propertiesWithCallbacks.length > 0 ||
|
|
7234
|
+
this._children.length > 0) {
|
|
7235
|
+
parent.addToViewModelCallbacks(this);
|
|
7236
|
+
}
|
|
7222
7237
|
}
|
|
7223
7238
|
};
|
|
7224
7239
|
ViewModelInstance.prototype.removeParent = function (parent) {
|
|
@@ -7745,11 +7760,13 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
7745
7760
|
ViewModelInstanceList.prototype.addInstance = function (instance) {
|
|
7746
7761
|
if (instance.runtimeInstance != null) {
|
|
7747
7762
|
this._viewModelInstanceValue.addInstance(instance.runtimeInstance);
|
|
7763
|
+
instance.addParent(this._parentViewModel);
|
|
7748
7764
|
}
|
|
7749
7765
|
};
|
|
7750
7766
|
ViewModelInstanceList.prototype.removeInstance = function (instance) {
|
|
7751
7767
|
if (instance.runtimeInstance != null) {
|
|
7752
7768
|
this._viewModelInstanceValue.removeInstance(instance.runtimeInstance);
|
|
7769
|
+
instance.removeParent(this._parentViewModel);
|
|
7753
7770
|
}
|
|
7754
7771
|
};
|
|
7755
7772
|
ViewModelInstanceList.prototype.removeInstanceAt = function (index) {
|
|
@@ -7758,11 +7775,14 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
7758
7775
|
ViewModelInstanceList.prototype.instanceAt = function (index) {
|
|
7759
7776
|
var runtimeInstance = this._viewModelInstanceValue.instanceAt(index);
|
|
7760
7777
|
if (runtimeInstance != null) {
|
|
7761
|
-
var viewModelInstance = new ViewModelInstance(runtimeInstance,
|
|
7778
|
+
var viewModelInstance = new ViewModelInstance(runtimeInstance, this._parentViewModel);
|
|
7762
7779
|
return viewModelInstance;
|
|
7763
7780
|
}
|
|
7764
7781
|
return null;
|
|
7765
7782
|
};
|
|
7783
|
+
ViewModelInstanceList.prototype.swap = function (a, b) {
|
|
7784
|
+
this._viewModelInstanceValue.swap(a, b);
|
|
7785
|
+
};
|
|
7766
7786
|
ViewModelInstanceList.prototype.internalHandleCallback = function (callback) {
|
|
7767
7787
|
callback();
|
|
7768
7788
|
};
|