@rive-app/canvas 2.30.1 → 2.30.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/canvas",
3
- "version": "2.30.1",
3
+ "version": "2.30.3",
4
4
  "description": "Rive's canvas based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -112,6 +112,10 @@ export declare enum RiveEventType {
112
112
  General = 128,
113
113
  OpenUrl = 131
114
114
  }
115
+ declare class Artboard {
116
+ nativeArtboard: rc.Artboard;
117
+ constructor(artboard: rc.Artboard);
118
+ }
115
119
  /**
116
120
  * Supported event types triggered in Rive
117
121
  */
@@ -340,6 +344,7 @@ export declare class RiveFile {
340
344
  removeAllRiveEventListeners(type?: EventType): void;
341
345
  getInstance(): rc.File;
342
346
  destroyIfUnused(): void;
347
+ getArtboard(name: string): Artboard | null;
343
348
  }
344
349
  export declare class Rive {
345
350
  private readonly canvas;
@@ -725,6 +730,7 @@ export declare class Rive {
725
730
  viewModelByName(name: string): ViewModel | null;
726
731
  enums(): DataEnum[];
727
732
  defaultViewModel(): ViewModel | null;
733
+ getArtboard(name: string): Artboard | null;
728
734
  }
729
735
  export declare class ViewModel {
730
736
  private _viewModel;
@@ -813,6 +819,12 @@ export declare class ViewModelInstance {
813
819
  * @param path - path to the image property
814
820
  */
815
821
  image(path: string): ViewModelInstanceAssetImage | null;
822
+ /**
823
+ * method to access an artboard property instance belonging
824
+ * to the view model instance or to a nested view model instance
825
+ * @param path - path to the image property
826
+ */
827
+ artboard(path: string): ViewModelInstanceArtboard | null;
816
828
  /**
817
829
  * method to access a view model property instance belonging
818
830
  * to the view model instance or to a nested view model instance
@@ -904,6 +916,11 @@ export declare class ViewModelInstanceAssetImage extends ViewModelInstanceValue
904
916
  set value(image: rc.Image | null);
905
917
  internalHandleCallback(callback: Function): void;
906
918
  }
919
+ export declare class ViewModelInstanceArtboard extends ViewModelInstanceValue {
920
+ constructor(instance: rc.ViewModelInstanceArtboard, root: ViewModelInstance);
921
+ set value(artboard: Artboard | null);
922
+ internalHandleCallback(callback: Function): void;
923
+ }
907
924
  /**
908
925
  * Contents of a state machine input
909
926
  */
package/rive.js CHANGED
@@ -747,7 +747,7 @@ function Xa(a, b) {
747
747
  return Wa(c, a, b);
748
748
  }));
749
749
  }
750
- var Ya, Za, cb = {458140:(a, b, c, d, e) => {
750
+ var Ya, Za, cb = {459004:(a, b, c, d, e) => {
751
751
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
752
752
  return 0;
753
753
  }
@@ -810,11 +810,11 @@ var Ya, Za, cb = {458140:(a, b, c, d, e) => {
810
810
  }
811
811
  window.h.Aa += 1;
812
812
  return 1;
813
- }, 460318:() => {
813
+ }, 461182:() => {
814
814
  "undefined" !== typeof window.h && (window.h.Ta.map(function(a) {
815
815
  document.removeEventListener(a, window.h.unlock, !0);
816
816
  }), --window.h.Aa, 0 === window.h.Aa && delete window.h);
817
- }, 460622:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 460726:() => {
817
+ }, 461486:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 461590:() => {
818
818
  try {
819
819
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
820
820
  a.close();
@@ -822,7 +822,7 @@ var Ya, Za, cb = {458140:(a, b, c, d, e) => {
822
822
  } catch (c) {
823
823
  return 0;
824
824
  }
825
- }, 460897:(a, b, c, d, e, f) => {
825
+ }, 461761:(a, b, c, d, e, f) => {
826
826
  if ("undefined" === typeof window.h) {
827
827
  return -1;
828
828
  }
@@ -868,7 +868,7 @@ var Ya, Za, cb = {458140:(a, b, c, d, e) => {
868
868
  a == window.h.I.ya && g.Z.connect(g.J.destination);
869
869
  g.qb = f;
870
870
  return window.h.yc(g);
871
- }, 463774:a => window.h.ra(a).J.sampleRate, 463847:a => {
871
+ }, 464638:a => window.h.ra(a).J.sampleRate, 464711:a => {
872
872
  a = window.h.ra(a);
873
873
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
874
874
  }, a.Z.disconnect(), a.Z = void 0);
@@ -876,13 +876,13 @@ var Ya, Za, cb = {458140:(a, b, c, d, e) => {
876
876
  a.J.close();
877
877
  a.J = void 0;
878
878
  a.qb = void 0;
879
- }, 464247:a => {
879
+ }, 465111:a => {
880
880
  window.h.Cb(a);
881
- }, 464297:a => {
881
+ }, 465161:a => {
882
882
  a = window.h.ra(a);
883
883
  a.J.resume();
884
884
  a.state = window.h.ga.yb;
885
- }, 464436:a => {
885
+ }, 465300:a => {
886
886
  a = window.h.ra(a);
887
887
  a.J.suspend();
888
888
  a.state = window.h.ga.stopped;
@@ -3370,7 +3370,7 @@ $d();
3370
3370
  /* 2 */
3371
3371
  /***/ ((module) => {
3372
3372
 
3373
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.30.1","description":"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}}');
3373
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.30.3","description":"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}}');
3374
3374
 
3375
3375
  /***/ }),
3376
3376
  /* 3 */
@@ -4107,6 +4107,7 @@ __webpack_require__.r(__webpack_exports__);
4107
4107
  /* harmony export */ Testing: () => (/* binding */ Testing),
4108
4108
  /* harmony export */ ViewModel: () => (/* binding */ ViewModel),
4109
4109
  /* harmony export */ ViewModelInstance: () => (/* binding */ ViewModelInstance),
4110
+ /* harmony export */ ViewModelInstanceArtboard: () => (/* binding */ ViewModelInstanceArtboard),
4110
4111
  /* harmony export */ ViewModelInstanceAssetImage: () => (/* binding */ ViewModelInstanceAssetImage),
4111
4112
  /* harmony export */ ViewModelInstanceBoolean: () => (/* binding */ ViewModelInstanceBoolean),
4112
4113
  /* harmony export */ ViewModelInstanceColor: () => (/* binding */ ViewModelInstanceColor),
@@ -4489,6 +4490,12 @@ var RiveEventType;
4489
4490
  RiveEventType[RiveEventType["General"] = 128] = "General";
4490
4491
  RiveEventType[RiveEventType["OpenUrl"] = 131] = "OpenUrl";
4491
4492
  })(RiveEventType || (RiveEventType = {}));
4493
+ var Artboard = /** @class */ (function () {
4494
+ function Artboard(artboard) {
4495
+ this.nativeArtboard = artboard;
4496
+ }
4497
+ return Artboard;
4498
+ }());
4492
4499
  var StateMachine = /** @class */ (function () {
4493
4500
  /**
4494
4501
  * @constructor
@@ -5467,6 +5474,13 @@ var RiveFile = /** @class */ (function () {
5467
5474
  this.cleanup();
5468
5475
  }
5469
5476
  };
5477
+ RiveFile.prototype.getArtboard = function (name) {
5478
+ var nativeArtboard = this.file.artboardByName(name);
5479
+ if (nativeArtboard != null) {
5480
+ return new Artboard(nativeArtboard);
5481
+ }
5482
+ return null;
5483
+ };
5470
5484
  // Error message for missing source or buffer
5471
5485
  RiveFile.missingErrorMessage = "Rive source file or data buffer required";
5472
5486
  // Error message for file load error
@@ -6911,6 +6925,10 @@ var Rive = /** @class */ (function () {
6911
6925
  }
6912
6926
  return null;
6913
6927
  };
6928
+ Rive.prototype.getArtboard = function (name) {
6929
+ var _a, _b;
6930
+ return (_b = (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.getArtboard(name)) !== null && _b !== void 0 ? _b : null;
6931
+ };
6914
6932
  // Error message for missing source or buffer
6915
6933
  Rive.missingErrorMessage = "Rive source file or data buffer required";
6916
6934
  // Error message for removed rive file
@@ -7012,6 +7030,7 @@ var PropertyType;
7012
7030
  PropertyType["Enum"] = "enum";
7013
7031
  PropertyType["List"] = "list";
7014
7032
  PropertyType["Image"] = "image";
7033
+ PropertyType["Artboard"] = "artboard";
7015
7034
  })(PropertyType || (PropertyType = {}));
7016
7035
  var ViewModelInstance = /** @class */ (function () {
7017
7036
  function ViewModelInstance(runtimeInstance, parent) {
@@ -7138,7 +7157,7 @@ var ViewModelInstance = /** @class */ (function () {
7138
7157
  return null;
7139
7158
  };
7140
7159
  ViewModelInstance.prototype.propertyFromPathSegments = function (pathSegments, index, type) {
7141
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
7160
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
7142
7161
  if (index < pathSegments.length - 1) {
7143
7162
  var viewModelInstance = this.internalViewModelInstance(pathSegments[index]);
7144
7163
  if (viewModelInstance !== null) {
@@ -7198,6 +7217,12 @@ var ViewModelInstance = /** @class */ (function () {
7198
7217
  return new ViewModelInstanceAssetImage(instance, this);
7199
7218
  }
7200
7219
  break;
7220
+ case PropertyType.Artboard:
7221
+ instance = (_t = (_s = this._runtimeInstance) === null || _s === void 0 ? void 0 : _s.artboard(pathSegments[index])) !== null && _t !== void 0 ? _t : null;
7222
+ if (instance !== null) {
7223
+ return new ViewModelInstanceArtboard(instance, this);
7224
+ }
7225
+ break;
7201
7226
  }
7202
7227
  return null;
7203
7228
  };
@@ -7287,6 +7312,15 @@ var ViewModelInstance = /** @class */ (function () {
7287
7312
  var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Image);
7288
7313
  return viewmodelInstanceValue;
7289
7314
  };
7315
+ /**
7316
+ * method to access an artboard property instance belonging
7317
+ * to the view model instance or to a nested view model instance
7318
+ * @param path - path to the image property
7319
+ */
7320
+ ViewModelInstance.prototype.artboard = function (path) {
7321
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Artboard);
7322
+ return viewmodelInstanceValue;
7323
+ };
7290
7324
  /**
7291
7325
  * method to access a view model property instance belonging
7292
7326
  * to the view model instance or to a nested view model instance
@@ -7671,6 +7705,24 @@ var ViewModelInstanceAssetImage = /** @class */ (function (_super) {
7671
7705
  return ViewModelInstanceAssetImage;
7672
7706
  }(ViewModelInstanceValue));
7673
7707
 
7708
+ var ViewModelInstanceArtboard = /** @class */ (function (_super) {
7709
+ __extends(ViewModelInstanceArtboard, _super);
7710
+ function ViewModelInstanceArtboard(instance, root) {
7711
+ return _super.call(this, instance, root) || this;
7712
+ }
7713
+ Object.defineProperty(ViewModelInstanceArtboard.prototype, "value", {
7714
+ set: function (artboard) {
7715
+ this._viewModelInstanceValue.value(artboard.nativeArtboard);
7716
+ },
7717
+ enumerable: false,
7718
+ configurable: true
7719
+ });
7720
+ ViewModelInstanceArtboard.prototype.internalHandleCallback = function (callback) {
7721
+ callback();
7722
+ };
7723
+ return ViewModelInstanceArtboard;
7724
+ }(ViewModelInstanceValue));
7725
+
7674
7726
  // Loads Rive data from a URI via fetch.
7675
7727
  var loadRiveFile = function (src) { return __awaiter(void 0, void 0, void 0, function () {
7676
7728
  var req, res, buffer;