@rive-app/webgl 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/webgl",
3
- "version": "2.20.2",
3
+ "version": "2.21.0",
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
@@ -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
@@ -400,7 +400,7 @@ function Qa(a, b) {
400
400
  return Pa(c, a, b);
401
401
  }));
402
402
  }
403
- var Ra, Sa, Wa = {692140:(a, b, c, d, e) => {
403
+ var Ra, Sa, Wa = {692220:(a, b, c, d, e) => {
404
404
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
405
405
  return 0;
406
406
  }
@@ -463,9 +463,9 @@ var Ra, Sa, Wa = {692140:(a, b, c, d, e) => {
463
463
  }
464
464
  window.h.Ea += 1;
465
465
  return 1;
466
- }, 694318:() => {
466
+ }, 694398:() => {
467
467
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
468
- }, 694482:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 694586:() => {
468
+ }, 694562:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 694666:() => {
469
469
  try {
470
470
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
471
471
  a.close();
@@ -473,7 +473,7 @@ var Ra, Sa, Wa = {692140:(a, b, c, d, e) => {
473
473
  } catch (c) {
474
474
  return 0;
475
475
  }
476
- }, 694757:(a, b, c, d, e, f) => {
476
+ }, 694837:(a, b, c, d, e, f) => {
477
477
  if ("undefined" === typeof window.h) {
478
478
  return -1;
479
479
  }
@@ -519,7 +519,7 @@ var Ra, Sa, Wa = {692140:(a, b, c, d, e) => {
519
519
  a == window.h.H.Ca && g.X.connect(g.I.destination);
520
520
  g.lb = f;
521
521
  return window.h.nc(g);
522
- }, 697634:a => window.h.ta(a).I.sampleRate, 697707:a => {
522
+ }, 697714:a => window.h.ta(a).I.sampleRate, 697787:a => {
523
523
  a = window.h.ta(a);
524
524
  void 0 !== a.X && (a.X.onaudioprocess = function() {
525
525
  }, a.X.disconnect(), a.X = void 0);
@@ -527,13 +527,13 @@ var Ra, Sa, Wa = {692140:(a, b, c, d, e) => {
527
527
  a.I.close();
528
528
  a.I = void 0;
529
529
  a.lb = void 0;
530
- }, 698107:a => {
530
+ }, 698187:a => {
531
531
  window.h.xb(a);
532
- }, 698157:a => {
532
+ }, 698237:a => {
533
533
  a = window.h.ta(a);
534
534
  a.I.resume();
535
535
  a.state = window.h.ha.sb;
536
- }, 698296:a => {
536
+ }, 698376:a => {
537
537
  a = window.h.ta(a);
538
538
  a.I.suspend();
539
539
  a.state = window.h.ha.stopped;
@@ -4053,7 +4053,7 @@ Ie();
4053
4053
  /* 2 */
4054
4054
  /***/ ((module) => {
4055
4055
 
4056
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.20.2","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}}');
4056
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.21.0","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}}');
4057
4057
 
4058
4058
  /***/ }),
4059
4059
  /* 3 */
@@ -6595,6 +6595,78 @@ var Rive = /** @class */ (function () {
6595
6595
  console.warn("Input with name: '".concat(inputName, "', at path:'").concat(path, "' is not a trigger"));
6596
6596
  }
6597
6597
  };
6598
+ // Returns the TextValueRun object for the provided name at the given path
6599
+ Rive.prototype.retrieveTextAtPath = function (name, path) {
6600
+ if (!name) {
6601
+ console.warn("No text name provided for path '".concat(path, "'"));
6602
+ return;
6603
+ }
6604
+ if (!path) {
6605
+ console.warn("No path provided for text '".concat(name, "'"));
6606
+ return;
6607
+ }
6608
+ if (!this.artboard) {
6609
+ console.warn("Tried to access text: '".concat(name, "', at path: '").concat(path, "', but the Artboard is null"));
6610
+ return;
6611
+ }
6612
+ var text = this.artboard.textByPath(name, path);
6613
+ if (!text) {
6614
+ console.warn("Could not access text with name: '".concat(name, "', at path:'").concat(path, "'"));
6615
+ return;
6616
+ }
6617
+ return text;
6618
+ };
6619
+ /**
6620
+ * Retrieves the text value for a specified text run at a given path
6621
+ * @param textName The name of the text run
6622
+ * @param path The path to the text run within the artboard
6623
+ * @returns The text value of the text run, or undefined if not found
6624
+ *
6625
+ * @example
6626
+ * // Get the text value for a text run named "title" at one nested artboard deep
6627
+ * const titleText = riveInstance.getTextRunValueAtPath("title", "artboard1");
6628
+ *
6629
+ * @example
6630
+ * // Get the text value for a text run named "subtitle" within a nested group two artboards deep
6631
+ * const subtitleText = riveInstance.getTextRunValueAtPath("subtitle", "group/nestedGroup");
6632
+ *
6633
+ * @remarks
6634
+ * If the text run cannot be found at the specified path, a warning will be logged to the console.
6635
+ */
6636
+ Rive.prototype.getTextRunValueAtPath = function (textName, path) {
6637
+ var run = this.retrieveTextAtPath(textName, path);
6638
+ if (!run) {
6639
+ console.warn("Could not get text with name: '".concat(textName, "', at path:'").concat(path, "'"));
6640
+ return;
6641
+ }
6642
+ return run.text;
6643
+ };
6644
+ /**
6645
+ * Sets the text value for a specified text run at a given path
6646
+ * @param textName The name of the text run
6647
+ * @param value The new text value to set
6648
+ * @param path The path to the text run within the artboard
6649
+ * @returns void
6650
+ *
6651
+ * @example
6652
+ * // Set the text value for a text run named "title" at one nested artboard deep
6653
+ * riveInstance.setTextRunValueAtPath("title", "New Title", "artboard1");
6654
+ *
6655
+ * @example
6656
+ * // Set the text value for a text run named "subtitle" within a nested group two artboards deep
6657
+ * riveInstance.setTextRunValueAtPath("subtitle", "New Subtitle", "group/nestedGroup");
6658
+ *
6659
+ * @remarks
6660
+ * If the text run cannot be found at the specified path, a warning will be logged to the console.
6661
+ */
6662
+ Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
6663
+ var run = this.retrieveTextAtPath(textName, path);
6664
+ if (!run) {
6665
+ console.warn("Could not set text with name: '".concat(textName, "', at path:'").concat(path, "'"));
6666
+ return;
6667
+ }
6668
+ run.text = value;
6669
+ };
6598
6670
  Object.defineProperty(Rive.prototype, "playingStateMachineNames", {
6599
6671
  // Returns a list of playing machine names
6600
6672
  get: function () {