@rive-app/webgl2 2.20.2 → 2.21.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl2",
3
- "version": "2.20.2",
3
+ "version": "2.21.0",
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
@@ -516,6 +516,44 @@ export declare class Rive {
516
516
  * @param path the path the input is located at an artboard level
517
517
  */
518
518
  fireStateAtPath(inputName: string, path: string): void;
519
+ private retrieveTextAtPath;
520
+ /**
521
+ * Retrieves the text value for a specified text run at a given path
522
+ * @param textName The name of the text run
523
+ * @param path The path to the text run within the artboard
524
+ * @returns The text value of the text run, or undefined if not found
525
+ *
526
+ * @example
527
+ * // Get the text value for a text run named "title" at one nested artboard deep
528
+ * const titleText = riveInstance.getTextRunValueAtPath("title", "artboard1");
529
+ *
530
+ * @example
531
+ * // Get the text value for a text run named "subtitle" within a nested group two artboards deep
532
+ * const subtitleText = riveInstance.getTextRunValueAtPath("subtitle", "group/nestedGroup");
533
+ *
534
+ * @remarks
535
+ * If the text run cannot be found at the specified path, a warning will be logged to the console.
536
+ */
537
+ getTextRunValueAtPath(textName: string, path: string): string | undefined;
538
+ /**
539
+ * Sets the text value for a specified text run at a given path
540
+ * @param textName The name of the text run
541
+ * @param value The new text value to set
542
+ * @param path The path to the text run within the artboard
543
+ * @returns void
544
+ *
545
+ * @example
546
+ * // Set the text value for a text run named "title" at one nested artboard deep
547
+ * riveInstance.setTextRunValueAtPath("title", "New Title", "artboard1");
548
+ *
549
+ * @example
550
+ * // Set the text value for a text run named "subtitle" within a nested group two artboards deep
551
+ * riveInstance.setTextRunValueAtPath("subtitle", "New Subtitle", "group/nestedGroup");
552
+ *
553
+ * @remarks
554
+ * If the text run cannot be found at the specified path, a warning will be logged to the console.
555
+ */
556
+ setTextRunValueAtPath(textName: string, value: string, path: string): void;
519
557
  get playingStateMachineNames(): string[];
520
558
  get playingAnimationNames(): string[];
521
559
  get pausedAnimationNames(): string[];
package/rive.js CHANGED
@@ -415,7 +415,7 @@ function Na(a, b) {
415
415
  return Ma(c, a, b);
416
416
  }));
417
417
  }
418
- var Oa, Pa, Ta = {482388:(a, b, c, d, e) => {
418
+ var Oa, Pa, Ta = {482484:(a, b, c, d, e) => {
419
419
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
420
420
  return 0;
421
421
  }
@@ -478,9 +478,9 @@ var Oa, Pa, Ta = {482388:(a, b, c, d, e) => {
478
478
  }
479
479
  window.h.Da += 1;
480
480
  return 1;
481
- }, 484566:() => {
481
+ }, 484662:() => {
482
482
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
483
- }, 484730:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 484834:() => {
483
+ }, 484826:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 484930:() => {
484
484
  try {
485
485
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
486
486
  a.close();
@@ -488,7 +488,7 @@ var Oa, Pa, Ta = {482388:(a, b, c, d, e) => {
488
488
  } catch (c) {
489
489
  return 0;
490
490
  }
491
- }, 485005:(a, b, c, d, e, f) => {
491
+ }, 485101:(a, b, c, d, e, f) => {
492
492
  if ("undefined" === typeof window.h) {
493
493
  return -1;
494
494
  }
@@ -534,7 +534,7 @@ var Oa, Pa, Ta = {482388:(a, b, c, d, e) => {
534
534
  a == window.h.I.Ba && g.Y.connect(g.J.destination);
535
535
  g.jb = f;
536
536
  return window.h.lc(g);
537
- }, 487882:a => window.h.va(a).J.sampleRate, 487955:a => {
537
+ }, 487978:a => window.h.va(a).J.sampleRate, 488051:a => {
538
538
  a = window.h.va(a);
539
539
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
540
540
  }, a.Y.disconnect(), a.Y = void 0);
@@ -542,13 +542,13 @@ var Oa, Pa, Ta = {482388:(a, b, c, d, e) => {
542
542
  a.J.close();
543
543
  a.J = void 0;
544
544
  a.jb = void 0;
545
- }, 488355:a => {
545
+ }, 488451:a => {
546
546
  window.h.wb(a);
547
- }, 488405:a => {
547
+ }, 488501:a => {
548
548
  a = window.h.va(a);
549
549
  a.J.resume();
550
550
  a.state = window.h.ha.rb;
551
- }, 488544:a => {
551
+ }, 488640:a => {
552
552
  a = window.h.va(a);
553
553
  a.J.suspend();
554
554
  a.state = window.h.ha.stopped;
@@ -3459,8 +3459,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = B.dynCall_viijii
3459
3459
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = B.dynCall_iiiiij)(a, b, c, d, e, f, g);
3460
3460
  n.dynCall_iiiiijj = (a, b, c, d, e, f, g, m, p) => (n.dynCall_iiiiijj = B.dynCall_iiiiijj)(a, b, c, d, e, f, g, m, p);
3461
3461
  n.dynCall_iiiiiijj = (a, b, c, d, e, f, g, m, p, l) => (n.dynCall_iiiiiijj = B.dynCall_iiiiiijj)(a, b, c, d, e, f, g, m, p, l);
3462
- n.___start_em_js = 479764;
3463
- n.___stop_em_js = 482388;
3462
+ n.___start_em_js = 479860;
3463
+ n.___stop_em_js = 482484;
3464
3464
  var Wd;
3465
3465
  Ga = function Xd() {
3466
3466
  Wd || Yd();
@@ -3520,7 +3520,7 @@ Yd();
3520
3520
  /* 2 */
3521
3521
  /***/ ((module) => {
3522
3522
 
3523
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.20.2","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}}');
3523
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.21.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}}');
3524
3524
 
3525
3525
  /***/ }),
3526
3526
  /* 3 */
@@ -6062,6 +6062,78 @@ var Rive = /** @class */ (function () {
6062
6062
  console.warn("Input with name: '".concat(inputName, "', at path:'").concat(path, "' is not a trigger"));
6063
6063
  }
6064
6064
  };
6065
+ // Returns the TextValueRun object for the provided name at the given path
6066
+ Rive.prototype.retrieveTextAtPath = function (name, path) {
6067
+ if (!name) {
6068
+ console.warn("No text name provided for path '".concat(path, "'"));
6069
+ return;
6070
+ }
6071
+ if (!path) {
6072
+ console.warn("No path provided for text '".concat(name, "'"));
6073
+ return;
6074
+ }
6075
+ if (!this.artboard) {
6076
+ console.warn("Tried to access text: '".concat(name, "', at path: '").concat(path, "', but the Artboard is null"));
6077
+ return;
6078
+ }
6079
+ var text = this.artboard.textByPath(name, path);
6080
+ if (!text) {
6081
+ console.warn("Could not access text with name: '".concat(name, "', at path:'").concat(path, "'"));
6082
+ return;
6083
+ }
6084
+ return text;
6085
+ };
6086
+ /**
6087
+ * Retrieves the text value for a specified text run at a given path
6088
+ * @param textName The name of the text run
6089
+ * @param path The path to the text run within the artboard
6090
+ * @returns The text value of the text run, or undefined if not found
6091
+ *
6092
+ * @example
6093
+ * // Get the text value for a text run named "title" at one nested artboard deep
6094
+ * const titleText = riveInstance.getTextRunValueAtPath("title", "artboard1");
6095
+ *
6096
+ * @example
6097
+ * // Get the text value for a text run named "subtitle" within a nested group two artboards deep
6098
+ * const subtitleText = riveInstance.getTextRunValueAtPath("subtitle", "group/nestedGroup");
6099
+ *
6100
+ * @remarks
6101
+ * If the text run cannot be found at the specified path, a warning will be logged to the console.
6102
+ */
6103
+ Rive.prototype.getTextRunValueAtPath = function (textName, path) {
6104
+ var run = this.retrieveTextAtPath(textName, path);
6105
+ if (!run) {
6106
+ console.warn("Could not get text with name: '".concat(textName, "', at path:'").concat(path, "'"));
6107
+ return;
6108
+ }
6109
+ return run.text;
6110
+ };
6111
+ /**
6112
+ * Sets the text value for a specified text run at a given path
6113
+ * @param textName The name of the text run
6114
+ * @param value The new text value to set
6115
+ * @param path The path to the text run within the artboard
6116
+ * @returns void
6117
+ *
6118
+ * @example
6119
+ * // Set the text value for a text run named "title" at one nested artboard deep
6120
+ * riveInstance.setTextRunValueAtPath("title", "New Title", "artboard1");
6121
+ *
6122
+ * @example
6123
+ * // Set the text value for a text run named "subtitle" within a nested group two artboards deep
6124
+ * riveInstance.setTextRunValueAtPath("subtitle", "New Subtitle", "group/nestedGroup");
6125
+ *
6126
+ * @remarks
6127
+ * If the text run cannot be found at the specified path, a warning will be logged to the console.
6128
+ */
6129
+ Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
6130
+ var run = this.retrieveTextAtPath(textName, path);
6131
+ if (!run) {
6132
+ console.warn("Could not set text with name: '".concat(textName, "', at path:'").concat(path, "'"));
6133
+ return;
6134
+ }
6135
+ run.text = value;
6136
+ };
6065
6137
  Object.defineProperty(Rive.prototype, "playingStateMachineNames", {
6066
6138
  // Returns a list of playing machine names
6067
6139
  get: function () {