@rive-app/canvas-lite 2.29.4 → 2.30.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 +1 -0
- package/rive.js +22 -14
- 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
package/rive.js
CHANGED
|
@@ -2272,7 +2272,7 @@ Qc();
|
|
|
2272
2272
|
/* 2 */
|
|
2273
2273
|
/***/ ((module) => {
|
|
2274
2274
|
|
|
2275
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
2275
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.30.1","description":"A lite version of Rive\'s canvas 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.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
2276
2276
|
|
|
2277
2277
|
/***/ }),
|
|
2278
2278
|
/* 3 */
|
|
@@ -2914,18 +2914,18 @@ var FontAssetWrapper = /** @class */ (function (_super) {
|
|
|
2914
2914
|
};
|
|
2915
2915
|
return FontAssetWrapper;
|
|
2916
2916
|
}(FileAssetWrapper));
|
|
2917
|
-
var FakeFinalizationRegistry = /** @class */ (function (
|
|
2918
|
-
|
|
2919
|
-
function FakeFinalizationRegistry(fn) {
|
|
2920
|
-
return _super.call(this, fn) || this;
|
|
2917
|
+
var FakeFinalizationRegistry = /** @class */ (function () {
|
|
2918
|
+
function FakeFinalizationRegistry(_) {
|
|
2921
2919
|
}
|
|
2922
2920
|
FakeFinalizationRegistry.prototype.register = function (object) {
|
|
2923
2921
|
object.selfUnref = true;
|
|
2924
2922
|
};
|
|
2925
2923
|
FakeFinalizationRegistry.prototype.unregister = function (_) { };
|
|
2926
2924
|
return FakeFinalizationRegistry;
|
|
2927
|
-
}(
|
|
2928
|
-
var MyFinalizationRegistry = FinalizationRegistry
|
|
2925
|
+
}());
|
|
2926
|
+
var MyFinalizationRegistry = typeof FinalizationRegistry !== "undefined"
|
|
2927
|
+
? FinalizationRegistry
|
|
2928
|
+
: FakeFinalizationRegistry;
|
|
2929
2929
|
var finalizationRegistry = new MyFinalizationRegistry(function (ob) {
|
|
2930
2930
|
ob.unref();
|
|
2931
2931
|
});
|
|
@@ -4364,6 +4364,11 @@ var RiveFile = /** @class */ (function () {
|
|
|
4364
4364
|
return this.file;
|
|
4365
4365
|
}
|
|
4366
4366
|
};
|
|
4367
|
+
RiveFile.prototype.destroyIfUnused = function () {
|
|
4368
|
+
if (this.referenceCount <= 0) {
|
|
4369
|
+
this.cleanup();
|
|
4370
|
+
}
|
|
4371
|
+
};
|
|
4367
4372
|
// Error message for missing source or buffer
|
|
4368
4373
|
RiveFile.missingErrorMessage = "Rive source file or data buffer required";
|
|
4369
4374
|
// Error message for file load error
|
|
@@ -4647,28 +4652,31 @@ var Rive = /** @class */ (function () {
|
|
|
4647
4652
|
// Returns true for successful initialization.
|
|
4648
4653
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
4649
4654
|
return __awaiter(this, void 0, void 0, function () {
|
|
4650
|
-
var error_2, msg;
|
|
4655
|
+
var riveFile, error_2, msg;
|
|
4651
4656
|
var _a;
|
|
4652
4657
|
return __generator(this, function (_b) {
|
|
4653
4658
|
switch (_b.label) {
|
|
4654
4659
|
case 0:
|
|
4655
4660
|
_b.trys.push([0, 3, , 4]);
|
|
4656
4661
|
if (!(this.riveFile == null)) return [3 /*break*/, 2];
|
|
4657
|
-
|
|
4662
|
+
riveFile = new RiveFile({
|
|
4658
4663
|
src: this.src,
|
|
4659
4664
|
buffer: this.buffer,
|
|
4660
4665
|
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
4661
4666
|
assetLoader: this.assetLoader,
|
|
4662
4667
|
});
|
|
4663
|
-
|
|
4668
|
+
this.riveFile = riveFile;
|
|
4669
|
+
return [4 /*yield*/, riveFile.init()];
|
|
4664
4670
|
case 1:
|
|
4665
4671
|
_b.sent();
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4672
|
+
if (this.destroyed) {
|
|
4673
|
+
// In the very unlikely scenario where the rive file created by this Rive is shared by
|
|
4674
|
+
// another rive file, we only want to destroy it if this file is the only owner.
|
|
4675
|
+
riveFile.destroyIfUnused();
|
|
4670
4676
|
return [2 /*return*/, false];
|
|
4671
4677
|
}
|
|
4678
|
+
_b.label = 2;
|
|
4679
|
+
case 2:
|
|
4672
4680
|
this.file = this.riveFile.getInstance();
|
|
4673
4681
|
// Initialize and draw frame
|
|
4674
4682
|
this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay, autoBind);
|