@rive-app/webgl2 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/webgl2",
3
- "version": "2.30.1",
3
+ "version": "2.30.3",
4
4
  "description": "Rive's webgl2 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
@@ -442,7 +442,7 @@ function Oa(a, b) {
442
442
  return Na(c, a, b);
443
443
  }));
444
444
  }
445
- var Pa, Qa, Ua = {524823:(a, b, c, d, e) => {
445
+ var Pa, Qa, Ua = {526983:(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 = {524823:(a, b, c, d, e) => {
505
505
  }
506
506
  window.h.Da += 1;
507
507
  return 1;
508
- }, 527001:() => {
508
+ }, 529161:() => {
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
- }, 527305:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 527409:() => {
512
+ }, 529465:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 529569:() => {
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 = {524823:(a, b, c, d, e) => {
517
517
  } catch (c) {
518
518
  return 0;
519
519
  }
520
- }, 527580:(a, b, c, d, e, f) => {
520
+ }, 529740:(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 = {524823:(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
- }, 530457:a => window.h.va(a).J.sampleRate, 530530:a => {
566
+ }, 532617:a => window.h.va(a).J.sampleRate, 532690: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 = {524823:(a, b, c, d, e) => {
571
571
  a.J.close();
572
572
  a.J = void 0;
573
573
  a.mb = void 0;
574
- }, 530930:a => {
574
+ }, 533090:a => {
575
575
  window.h.yb(a);
576
- }, 530980:a => {
576
+ }, 533140:a => {
577
577
  a = window.h.va(a);
578
578
  a.J.resume();
579
579
  a.state = window.h.ja.ub;
580
- }, 531119:a => {
580
+ }, 533279: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 = 522068;
3505
- k.___stop_em_js = 524823;
3504
+ k.___start_em_js = 524228;
3505
+ k.___stop_em_js = 526983;
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.30.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}}');
3565
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.30.3","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 */
@@ -4299,6 +4299,7 @@ __webpack_require__.r(__webpack_exports__);
4299
4299
  /* harmony export */ Testing: () => (/* binding */ Testing),
4300
4300
  /* harmony export */ ViewModel: () => (/* binding */ ViewModel),
4301
4301
  /* harmony export */ ViewModelInstance: () => (/* binding */ ViewModelInstance),
4302
+ /* harmony export */ ViewModelInstanceArtboard: () => (/* binding */ ViewModelInstanceArtboard),
4302
4303
  /* harmony export */ ViewModelInstanceAssetImage: () => (/* binding */ ViewModelInstanceAssetImage),
4303
4304
  /* harmony export */ ViewModelInstanceBoolean: () => (/* binding */ ViewModelInstanceBoolean),
4304
4305
  /* harmony export */ ViewModelInstanceColor: () => (/* binding */ ViewModelInstanceColor),
@@ -4681,6 +4682,12 @@ var RiveEventType;
4681
4682
  RiveEventType[RiveEventType["General"] = 128] = "General";
4682
4683
  RiveEventType[RiveEventType["OpenUrl"] = 131] = "OpenUrl";
4683
4684
  })(RiveEventType || (RiveEventType = {}));
4685
+ var Artboard = /** @class */ (function () {
4686
+ function Artboard(artboard) {
4687
+ this.nativeArtboard = artboard;
4688
+ }
4689
+ return Artboard;
4690
+ }());
4684
4691
  var StateMachine = /** @class */ (function () {
4685
4692
  /**
4686
4693
  * @constructor
@@ -5659,6 +5666,13 @@ var RiveFile = /** @class */ (function () {
5659
5666
  this.cleanup();
5660
5667
  }
5661
5668
  };
5669
+ RiveFile.prototype.getArtboard = function (name) {
5670
+ var nativeArtboard = this.file.artboardByName(name);
5671
+ if (nativeArtboard != null) {
5672
+ return new Artboard(nativeArtboard);
5673
+ }
5674
+ return null;
5675
+ };
5662
5676
  // Error message for missing source or buffer
5663
5677
  RiveFile.missingErrorMessage = "Rive source file or data buffer required";
5664
5678
  // Error message for file load error
@@ -7103,6 +7117,10 @@ var Rive = /** @class */ (function () {
7103
7117
  }
7104
7118
  return null;
7105
7119
  };
7120
+ Rive.prototype.getArtboard = function (name) {
7121
+ var _a, _b;
7122
+ return (_b = (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.getArtboard(name)) !== null && _b !== void 0 ? _b : null;
7123
+ };
7106
7124
  // Error message for missing source or buffer
7107
7125
  Rive.missingErrorMessage = "Rive source file or data buffer required";
7108
7126
  // Error message for removed rive file
@@ -7204,6 +7222,7 @@ var PropertyType;
7204
7222
  PropertyType["Enum"] = "enum";
7205
7223
  PropertyType["List"] = "list";
7206
7224
  PropertyType["Image"] = "image";
7225
+ PropertyType["Artboard"] = "artboard";
7207
7226
  })(PropertyType || (PropertyType = {}));
7208
7227
  var ViewModelInstance = /** @class */ (function () {
7209
7228
  function ViewModelInstance(runtimeInstance, parent) {
@@ -7330,7 +7349,7 @@ var ViewModelInstance = /** @class */ (function () {
7330
7349
  return null;
7331
7350
  };
7332
7351
  ViewModelInstance.prototype.propertyFromPathSegments = function (pathSegments, index, type) {
7333
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
7352
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
7334
7353
  if (index < pathSegments.length - 1) {
7335
7354
  var viewModelInstance = this.internalViewModelInstance(pathSegments[index]);
7336
7355
  if (viewModelInstance !== null) {
@@ -7390,6 +7409,12 @@ var ViewModelInstance = /** @class */ (function () {
7390
7409
  return new ViewModelInstanceAssetImage(instance, this);
7391
7410
  }
7392
7411
  break;
7412
+ case PropertyType.Artboard:
7413
+ instance = (_t = (_s = this._runtimeInstance) === null || _s === void 0 ? void 0 : _s.artboard(pathSegments[index])) !== null && _t !== void 0 ? _t : null;
7414
+ if (instance !== null) {
7415
+ return new ViewModelInstanceArtboard(instance, this);
7416
+ }
7417
+ break;
7393
7418
  }
7394
7419
  return null;
7395
7420
  };
@@ -7479,6 +7504,15 @@ var ViewModelInstance = /** @class */ (function () {
7479
7504
  var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Image);
7480
7505
  return viewmodelInstanceValue;
7481
7506
  };
7507
+ /**
7508
+ * method to access an artboard property instance belonging
7509
+ * to the view model instance or to a nested view model instance
7510
+ * @param path - path to the image property
7511
+ */
7512
+ ViewModelInstance.prototype.artboard = function (path) {
7513
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Artboard);
7514
+ return viewmodelInstanceValue;
7515
+ };
7482
7516
  /**
7483
7517
  * method to access a view model property instance belonging
7484
7518
  * to the view model instance or to a nested view model instance
@@ -7863,6 +7897,24 @@ var ViewModelInstanceAssetImage = /** @class */ (function (_super) {
7863
7897
  return ViewModelInstanceAssetImage;
7864
7898
  }(ViewModelInstanceValue));
7865
7899
 
7900
+ var ViewModelInstanceArtboard = /** @class */ (function (_super) {
7901
+ __extends(ViewModelInstanceArtboard, _super);
7902
+ function ViewModelInstanceArtboard(instance, root) {
7903
+ return _super.call(this, instance, root) || this;
7904
+ }
7905
+ Object.defineProperty(ViewModelInstanceArtboard.prototype, "value", {
7906
+ set: function (artboard) {
7907
+ this._viewModelInstanceValue.value(artboard.nativeArtboard);
7908
+ },
7909
+ enumerable: false,
7910
+ configurable: true
7911
+ });
7912
+ ViewModelInstanceArtboard.prototype.internalHandleCallback = function (callback) {
7913
+ callback();
7914
+ };
7915
+ return ViewModelInstanceArtboard;
7916
+ }(ViewModelInstanceValue));
7917
+
7866
7918
  // Loads Rive data from a URI via fetch.
7867
7919
  var loadRiveFile = function (src) { return __awaiter(void 0, void 0, void 0, function () {
7868
7920
  var req, res, buffer;