@rive-app/webgl2 2.33.2 → 2.34.0
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 +4 -0
- package/rive.js +36 -16
- 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
|
@@ -128,7 +128,9 @@ declare class Artboard extends BaseArtboard {
|
|
|
128
128
|
declare class BindableArtboard extends BaseArtboard implements rc.FinalizableTarget {
|
|
129
129
|
selfUnref: boolean;
|
|
130
130
|
nativeArtboard: rc.BindableArtboard;
|
|
131
|
+
nativeViewModel: rc.ViewModelInstance | null;
|
|
131
132
|
constructor(artboard: rc.BindableArtboard);
|
|
133
|
+
set viewModel(value: ViewModelInstance);
|
|
132
134
|
destroy(): void;
|
|
133
135
|
}
|
|
134
136
|
/**
|
|
@@ -386,6 +388,7 @@ export declare class RiveFile implements rc.FinalizableTarget {
|
|
|
386
388
|
getBindableArtboard(name: string): BindableArtboard | null;
|
|
387
389
|
getDefaultBindableArtboard(): BindableArtboard | null;
|
|
388
390
|
internalBindableArtboardFromArtboard(artboard: rc.Artboard): BindableArtboard | null;
|
|
391
|
+
viewModelByName(name: string): ViewModel | null;
|
|
389
392
|
}
|
|
390
393
|
export declare class Rive {
|
|
391
394
|
private readonly canvas;
|
|
@@ -425,6 +428,7 @@ export declare class Rive {
|
|
|
425
428
|
private _artboardHeight;
|
|
426
429
|
private _devicePixelRatioUsed;
|
|
427
430
|
private _hasZeroSize;
|
|
431
|
+
private _needsRedraw;
|
|
428
432
|
private _audioEventListener;
|
|
429
433
|
private _boundDraw;
|
|
430
434
|
private _viewModelInstance;
|
package/rive.js
CHANGED
|
@@ -427,7 +427,7 @@ function Na(a, b) {
|
|
|
427
427
|
return Ma(c, a, b);
|
|
428
428
|
}));
|
|
429
429
|
}
|
|
430
|
-
var Oa, Pa, Ta = {
|
|
430
|
+
var Oa, Pa, Ta = {570833:(a, b, c, d, e) => {
|
|
431
431
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
432
432
|
return 0;
|
|
433
433
|
}
|
|
@@ -490,11 +490,11 @@ var Oa, Pa, Ta = {569969:(a, b, c, d, e) => {
|
|
|
490
490
|
}
|
|
491
491
|
window.h.Ea += 1;
|
|
492
492
|
return 1;
|
|
493
|
-
},
|
|
493
|
+
}, 573011:() => {
|
|
494
494
|
"undefined" !== typeof window.h && (window.h.Xa.map(function(a) {
|
|
495
495
|
document.removeEventListener(a, window.h.unlock, !0);
|
|
496
496
|
}), --window.h.Ea, 0 === window.h.Ea && delete window.h);
|
|
497
|
-
},
|
|
497
|
+
}, 573315:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 573419:() => {
|
|
498
498
|
try {
|
|
499
499
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
500
500
|
a.close();
|
|
@@ -502,7 +502,7 @@ var Oa, Pa, Ta = {569969:(a, b, c, d, e) => {
|
|
|
502
502
|
} catch (c) {
|
|
503
503
|
return 0;
|
|
504
504
|
}
|
|
505
|
-
},
|
|
505
|
+
}, 573590:(a, b, c, d, e, f) => {
|
|
506
506
|
if ("undefined" === typeof window.h) {
|
|
507
507
|
return -1;
|
|
508
508
|
}
|
|
@@ -548,7 +548,7 @@ var Oa, Pa, Ta = {569969:(a, b, c, d, e) => {
|
|
|
548
548
|
a == window.h.I.Ca && g.Y.connect(g.K.destination);
|
|
549
549
|
g.nb = f;
|
|
550
550
|
return window.h.lc(g);
|
|
551
|
-
},
|
|
551
|
+
}, 576467:a => window.h.ta(a).K.sampleRate, 576540:a => {
|
|
552
552
|
a = window.h.ta(a);
|
|
553
553
|
void 0 !== a.Y && (a.Y.onaudioprocess = function() {
|
|
554
554
|
}, a.Y.disconnect(), a.Y = void 0);
|
|
@@ -556,13 +556,13 @@ var Oa, Pa, Ta = {569969:(a, b, c, d, e) => {
|
|
|
556
556
|
a.K.close();
|
|
557
557
|
a.K = void 0;
|
|
558
558
|
a.nb = void 0;
|
|
559
|
-
},
|
|
559
|
+
}, 576940:a => {
|
|
560
560
|
window.h.yb(a);
|
|
561
|
-
},
|
|
561
|
+
}, 576990:a => {
|
|
562
562
|
a = window.h.ta(a);
|
|
563
563
|
a.K.resume();
|
|
564
564
|
a.state = window.h.ia.ub;
|
|
565
|
-
},
|
|
565
|
+
}, 577129:a => {
|
|
566
566
|
a = window.h.ta(a);
|
|
567
567
|
a.K.suspend();
|
|
568
568
|
a.state = window.h.ia.stopped;
|
|
@@ -3546,7 +3546,7 @@ moduleRtn = ca;
|
|
|
3546
3546
|
/* 2 */
|
|
3547
3547
|
/***/ ((module) => {
|
|
3548
3548
|
|
|
3549
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.
|
|
3549
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.34.0","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}}');
|
|
3550
3550
|
|
|
3551
3551
|
/***/ }),
|
|
3552
3552
|
/* 3 */
|
|
@@ -4789,9 +4789,18 @@ var BindableArtboard = /** @class */ (function (_super) {
|
|
|
4789
4789
|
_this.nativeArtboard = artboard;
|
|
4790
4790
|
return _this;
|
|
4791
4791
|
}
|
|
4792
|
+
Object.defineProperty(BindableArtboard.prototype, "viewModel", {
|
|
4793
|
+
set: function (value) {
|
|
4794
|
+
this.nativeViewModel = value.nativeInstance;
|
|
4795
|
+
},
|
|
4796
|
+
enumerable: false,
|
|
4797
|
+
configurable: true
|
|
4798
|
+
});
|
|
4792
4799
|
BindableArtboard.prototype.destroy = function () {
|
|
4800
|
+
var _a;
|
|
4793
4801
|
if (this.selfUnref) {
|
|
4794
4802
|
this.nativeArtboard.unref();
|
|
4803
|
+
(_a = this.nativeViewModel) === null || _a === void 0 ? void 0 : _a.unref();
|
|
4795
4804
|
}
|
|
4796
4805
|
};
|
|
4797
4806
|
return BindableArtboard;
|
|
@@ -5827,6 +5836,13 @@ var RiveFile = /** @class */ (function () {
|
|
|
5827
5836
|
var nativeBindableArtboard = this.file.internalBindableArtboardFromArtboard(artboard);
|
|
5828
5837
|
return this.createBindableArtboard(nativeBindableArtboard);
|
|
5829
5838
|
};
|
|
5839
|
+
RiveFile.prototype.viewModelByName = function (name) {
|
|
5840
|
+
var viewModel = this.file.viewModelByName(name);
|
|
5841
|
+
if (viewModel !== null) {
|
|
5842
|
+
return new ViewModel(viewModel);
|
|
5843
|
+
}
|
|
5844
|
+
return null;
|
|
5845
|
+
};
|
|
5830
5846
|
// Error message for missing source or buffer
|
|
5831
5847
|
RiveFile.missingErrorMessage = "Rive source file or data buffer required";
|
|
5832
5848
|
// Error message for file load error
|
|
@@ -5873,6 +5889,8 @@ var Rive = /** @class */ (function () {
|
|
|
5873
5889
|
this._devicePixelRatioUsed = 1;
|
|
5874
5890
|
// Whether the canvas element's size is 0
|
|
5875
5891
|
this._hasZeroSize = false;
|
|
5892
|
+
// Whether a draw operation needs to be forced
|
|
5893
|
+
this._needsRedraw = false;
|
|
5876
5894
|
// Audio event listener
|
|
5877
5895
|
this._audioEventListener = null;
|
|
5878
5896
|
// draw method bound to the class
|
|
@@ -6335,7 +6353,7 @@ var Rive = /** @class */ (function () {
|
|
|
6335
6353
|
if (!this._hasZeroSize) {
|
|
6336
6354
|
// If there was no dirt on this frame, do not clear and draw
|
|
6337
6355
|
if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
|
|
6338
|
-
this.artboard.didChange()) {
|
|
6356
|
+
this.artboard.didChange() || this._needsRedraw) {
|
|
6339
6357
|
// Canvas must be wiped to prevent artifacts
|
|
6340
6358
|
renderer.clear();
|
|
6341
6359
|
renderer.save();
|
|
@@ -6344,6 +6362,7 @@ var Rive = /** @class */ (function () {
|
|
|
6344
6362
|
this.artboard.draw(renderer);
|
|
6345
6363
|
renderer.restore();
|
|
6346
6364
|
renderer.flush();
|
|
6365
|
+
this._needsRedraw = false;
|
|
6347
6366
|
}
|
|
6348
6367
|
}
|
|
6349
6368
|
// Check for any animations that looped
|
|
@@ -6668,6 +6687,7 @@ var Rive = /** @class */ (function () {
|
|
|
6668
6687
|
this.devicePixelRatioUsed = dpr;
|
|
6669
6688
|
this.canvas.width = dpr * width;
|
|
6670
6689
|
this.canvas.height = dpr * height;
|
|
6690
|
+
this._needsRedraw = true;
|
|
6671
6691
|
this.resizeToCanvas();
|
|
6672
6692
|
this.drawFrame();
|
|
6673
6693
|
if (this.layout.fit === Fit.Layout) {
|
|
@@ -7266,11 +7286,8 @@ var Rive = /** @class */ (function () {
|
|
|
7266
7286
|
return null;
|
|
7267
7287
|
};
|
|
7268
7288
|
Rive.prototype.viewModelByName = function (name) {
|
|
7269
|
-
var
|
|
7270
|
-
|
|
7271
|
-
return new ViewModel(viewModel);
|
|
7272
|
-
}
|
|
7273
|
-
return null;
|
|
7289
|
+
var _a;
|
|
7290
|
+
return (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.viewModelByName(name);
|
|
7274
7291
|
};
|
|
7275
7292
|
Rive.prototype.enums = function () {
|
|
7276
7293
|
if (this._dataEnums === null) {
|
|
@@ -8113,7 +8130,7 @@ var ViewModelInstanceArtboard = /** @class */ (function (_super) {
|
|
|
8113
8130
|
}
|
|
8114
8131
|
Object.defineProperty(ViewModelInstanceArtboard.prototype, "value", {
|
|
8115
8132
|
set: function (artboard) {
|
|
8116
|
-
var _a;
|
|
8133
|
+
var _a, _b;
|
|
8117
8134
|
var bindableArtboard;
|
|
8118
8135
|
if (artboard.isBindableArtboard) {
|
|
8119
8136
|
bindableArtboard = artboard;
|
|
@@ -8122,6 +8139,9 @@ var ViewModelInstanceArtboard = /** @class */ (function (_super) {
|
|
|
8122
8139
|
bindableArtboard = artboard.file.internalBindableArtboardFromArtboard(artboard.nativeArtboard);
|
|
8123
8140
|
}
|
|
8124
8141
|
this._viewModelInstanceValue.value((_a = bindableArtboard === null || bindableArtboard === void 0 ? void 0 : bindableArtboard.nativeArtboard) !== null && _a !== void 0 ? _a : null);
|
|
8142
|
+
if (bindableArtboard === null || bindableArtboard === void 0 ? void 0 : bindableArtboard.nativeViewModel) {
|
|
8143
|
+
this._viewModelInstanceValue.viewModelInstance((_b = bindableArtboard === null || bindableArtboard === void 0 ? void 0 : bindableArtboard.nativeViewModel) !== null && _b !== void 0 ? _b : null);
|
|
8144
|
+
}
|
|
8125
8145
|
},
|
|
8126
8146
|
enumerable: false,
|
|
8127
8147
|
configurable: true
|