@rive-app/webgl 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/webgl",
3
- "version": "2.30.1",
3
+ "version": "2.30.3",
4
4
  "description": "Rive's webgl 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
@@ -408,7 +408,7 @@ function Qa(a, b) {
408
408
  return Pa(c, a, b);
409
409
  }));
410
410
  }
411
- var Ra, Sa, Wa = {713148:(a, b, c, d, e) => {
411
+ var Ra, Sa, Wa = {714012:(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 = {713148:(a, b, c, d, e) => {
471
471
  }
472
472
  window.h.Ea += 1;
473
473
  return 1;
474
- }, 715326:() => {
474
+ }, 716190:() => {
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
- }, 715630:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 715734:() => {
478
+ }, 716494:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 716598:() => {
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 = {713148:(a, b, c, d, e) => {
483
483
  } catch (c) {
484
484
  return 0;
485
485
  }
486
- }, 715905:(a, b, c, d, e, f) => {
486
+ }, 716769:(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 = {713148:(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
- }, 718782:a => window.h.ta(a).I.sampleRate, 718855:a => {
532
+ }, 719646:a => window.h.ta(a).I.sampleRate, 719719: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 = {713148:(a, b, c, d, e) => {
537
537
  a.I.close();
538
538
  a.I = void 0;
539
539
  a.mb = void 0;
540
- }, 719255:a => {
540
+ }, 720119:a => {
541
541
  window.h.xb(a);
542
- }, 719305:a => {
542
+ }, 720169:a => {
543
543
  a = window.h.ta(a);
544
544
  a.I.resume();
545
545
  a.state = window.h.ha.tb;
546
- }, 719444:a => {
546
+ }, 720308: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.30.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}}');
4068
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl","version":"2.30.3","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 */
@@ -4802,6 +4802,7 @@ __webpack_require__.r(__webpack_exports__);
4802
4802
  /* harmony export */ Testing: () => (/* binding */ Testing),
4803
4803
  /* harmony export */ ViewModel: () => (/* binding */ ViewModel),
4804
4804
  /* harmony export */ ViewModelInstance: () => (/* binding */ ViewModelInstance),
4805
+ /* harmony export */ ViewModelInstanceArtboard: () => (/* binding */ ViewModelInstanceArtboard),
4805
4806
  /* harmony export */ ViewModelInstanceAssetImage: () => (/* binding */ ViewModelInstanceAssetImage),
4806
4807
  /* harmony export */ ViewModelInstanceBoolean: () => (/* binding */ ViewModelInstanceBoolean),
4807
4808
  /* harmony export */ ViewModelInstanceColor: () => (/* binding */ ViewModelInstanceColor),
@@ -5184,6 +5185,12 @@ var RiveEventType;
5184
5185
  RiveEventType[RiveEventType["General"] = 128] = "General";
5185
5186
  RiveEventType[RiveEventType["OpenUrl"] = 131] = "OpenUrl";
5186
5187
  })(RiveEventType || (RiveEventType = {}));
5188
+ var Artboard = /** @class */ (function () {
5189
+ function Artboard(artboard) {
5190
+ this.nativeArtboard = artboard;
5191
+ }
5192
+ return Artboard;
5193
+ }());
5187
5194
  var StateMachine = /** @class */ (function () {
5188
5195
  /**
5189
5196
  * @constructor
@@ -6162,6 +6169,13 @@ var RiveFile = /** @class */ (function () {
6162
6169
  this.cleanup();
6163
6170
  }
6164
6171
  };
6172
+ RiveFile.prototype.getArtboard = function (name) {
6173
+ var nativeArtboard = this.file.artboardByName(name);
6174
+ if (nativeArtboard != null) {
6175
+ return new Artboard(nativeArtboard);
6176
+ }
6177
+ return null;
6178
+ };
6165
6179
  // Error message for missing source or buffer
6166
6180
  RiveFile.missingErrorMessage = "Rive source file or data buffer required";
6167
6181
  // Error message for file load error
@@ -7606,6 +7620,10 @@ var Rive = /** @class */ (function () {
7606
7620
  }
7607
7621
  return null;
7608
7622
  };
7623
+ Rive.prototype.getArtboard = function (name) {
7624
+ var _a, _b;
7625
+ return (_b = (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.getArtboard(name)) !== null && _b !== void 0 ? _b : null;
7626
+ };
7609
7627
  // Error message for missing source or buffer
7610
7628
  Rive.missingErrorMessage = "Rive source file or data buffer required";
7611
7629
  // Error message for removed rive file
@@ -7707,6 +7725,7 @@ var PropertyType;
7707
7725
  PropertyType["Enum"] = "enum";
7708
7726
  PropertyType["List"] = "list";
7709
7727
  PropertyType["Image"] = "image";
7728
+ PropertyType["Artboard"] = "artboard";
7710
7729
  })(PropertyType || (PropertyType = {}));
7711
7730
  var ViewModelInstance = /** @class */ (function () {
7712
7731
  function ViewModelInstance(runtimeInstance, parent) {
@@ -7833,7 +7852,7 @@ var ViewModelInstance = /** @class */ (function () {
7833
7852
  return null;
7834
7853
  };
7835
7854
  ViewModelInstance.prototype.propertyFromPathSegments = function (pathSegments, index, type) {
7836
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
7855
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
7837
7856
  if (index < pathSegments.length - 1) {
7838
7857
  var viewModelInstance = this.internalViewModelInstance(pathSegments[index]);
7839
7858
  if (viewModelInstance !== null) {
@@ -7893,6 +7912,12 @@ var ViewModelInstance = /** @class */ (function () {
7893
7912
  return new ViewModelInstanceAssetImage(instance, this);
7894
7913
  }
7895
7914
  break;
7915
+ case PropertyType.Artboard:
7916
+ instance = (_t = (_s = this._runtimeInstance) === null || _s === void 0 ? void 0 : _s.artboard(pathSegments[index])) !== null && _t !== void 0 ? _t : null;
7917
+ if (instance !== null) {
7918
+ return new ViewModelInstanceArtboard(instance, this);
7919
+ }
7920
+ break;
7896
7921
  }
7897
7922
  return null;
7898
7923
  };
@@ -7982,6 +8007,15 @@ var ViewModelInstance = /** @class */ (function () {
7982
8007
  var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Image);
7983
8008
  return viewmodelInstanceValue;
7984
8009
  };
8010
+ /**
8011
+ * method to access an artboard property instance belonging
8012
+ * to the view model instance or to a nested view model instance
8013
+ * @param path - path to the image property
8014
+ */
8015
+ ViewModelInstance.prototype.artboard = function (path) {
8016
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Artboard);
8017
+ return viewmodelInstanceValue;
8018
+ };
7985
8019
  /**
7986
8020
  * method to access a view model property instance belonging
7987
8021
  * to the view model instance or to a nested view model instance
@@ -8366,6 +8400,24 @@ var ViewModelInstanceAssetImage = /** @class */ (function (_super) {
8366
8400
  return ViewModelInstanceAssetImage;
8367
8401
  }(ViewModelInstanceValue));
8368
8402
 
8403
+ var ViewModelInstanceArtboard = /** @class */ (function (_super) {
8404
+ __extends(ViewModelInstanceArtboard, _super);
8405
+ function ViewModelInstanceArtboard(instance, root) {
8406
+ return _super.call(this, instance, root) || this;
8407
+ }
8408
+ Object.defineProperty(ViewModelInstanceArtboard.prototype, "value", {
8409
+ set: function (artboard) {
8410
+ this._viewModelInstanceValue.value(artboard.nativeArtboard);
8411
+ },
8412
+ enumerable: false,
8413
+ configurable: true
8414
+ });
8415
+ ViewModelInstanceArtboard.prototype.internalHandleCallback = function (callback) {
8416
+ callback();
8417
+ };
8418
+ return ViewModelInstanceArtboard;
8419
+ }(ViewModelInstanceValue));
8420
+
8369
8421
  // Loads Rive data from a URI via fetch.
8370
8422
  var loadRiveFile = function (src) { return __awaiter(void 0, void 0, void 0, function () {
8371
8423
  var req, res, buffer;