@rive-app/canvas-lite 2.20.2 → 2.21.1
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 +1 -1
- package/rive.d.ts +38 -0
- package/rive.js +73 -1
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +6 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
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
|
@@ -2261,7 +2261,7 @@ Pc();
|
|
|
2261
2261
|
/* 2 */
|
|
2262
2262
|
/***/ ((module) => {
|
|
2263
2263
|
|
|
2264
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
2264
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.21.1","description":"A lite version of 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}}');
|
|
2265
2265
|
|
|
2266
2266
|
/***/ }),
|
|
2267
2267
|
/* 3 */
|
|
@@ -4803,6 +4803,78 @@ var Rive = /** @class */ (function () {
|
|
|
4803
4803
|
console.warn("Input with name: '".concat(inputName, "', at path:'").concat(path, "' is not a trigger"));
|
|
4804
4804
|
}
|
|
4805
4805
|
};
|
|
4806
|
+
// Returns the TextValueRun object for the provided name at the given path
|
|
4807
|
+
Rive.prototype.retrieveTextAtPath = function (name, path) {
|
|
4808
|
+
if (!name) {
|
|
4809
|
+
console.warn("No text name provided for path '".concat(path, "'"));
|
|
4810
|
+
return;
|
|
4811
|
+
}
|
|
4812
|
+
if (!path) {
|
|
4813
|
+
console.warn("No path provided for text '".concat(name, "'"));
|
|
4814
|
+
return;
|
|
4815
|
+
}
|
|
4816
|
+
if (!this.artboard) {
|
|
4817
|
+
console.warn("Tried to access text: '".concat(name, "', at path: '").concat(path, "', but the Artboard is null"));
|
|
4818
|
+
return;
|
|
4819
|
+
}
|
|
4820
|
+
var text = this.artboard.textByPath(name, path);
|
|
4821
|
+
if (!text) {
|
|
4822
|
+
console.warn("Could not access text with name: '".concat(name, "', at path:'").concat(path, "'"));
|
|
4823
|
+
return;
|
|
4824
|
+
}
|
|
4825
|
+
return text;
|
|
4826
|
+
};
|
|
4827
|
+
/**
|
|
4828
|
+
* Retrieves the text value for a specified text run at a given path
|
|
4829
|
+
* @param textName The name of the text run
|
|
4830
|
+
* @param path The path to the text run within the artboard
|
|
4831
|
+
* @returns The text value of the text run, or undefined if not found
|
|
4832
|
+
*
|
|
4833
|
+
* @example
|
|
4834
|
+
* // Get the text value for a text run named "title" at one nested artboard deep
|
|
4835
|
+
* const titleText = riveInstance.getTextRunValueAtPath("title", "artboard1");
|
|
4836
|
+
*
|
|
4837
|
+
* @example
|
|
4838
|
+
* // Get the text value for a text run named "subtitle" within a nested group two artboards deep
|
|
4839
|
+
* const subtitleText = riveInstance.getTextRunValueAtPath("subtitle", "group/nestedGroup");
|
|
4840
|
+
*
|
|
4841
|
+
* @remarks
|
|
4842
|
+
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
4843
|
+
*/
|
|
4844
|
+
Rive.prototype.getTextRunValueAtPath = function (textName, path) {
|
|
4845
|
+
var run = this.retrieveTextAtPath(textName, path);
|
|
4846
|
+
if (!run) {
|
|
4847
|
+
console.warn("Could not get text with name: '".concat(textName, "', at path:'").concat(path, "'"));
|
|
4848
|
+
return;
|
|
4849
|
+
}
|
|
4850
|
+
return run.text;
|
|
4851
|
+
};
|
|
4852
|
+
/**
|
|
4853
|
+
* Sets the text value for a specified text run at a given path
|
|
4854
|
+
* @param textName The name of the text run
|
|
4855
|
+
* @param value The new text value to set
|
|
4856
|
+
* @param path The path to the text run within the artboard
|
|
4857
|
+
* @returns void
|
|
4858
|
+
*
|
|
4859
|
+
* @example
|
|
4860
|
+
* // Set the text value for a text run named "title" at one nested artboard deep
|
|
4861
|
+
* riveInstance.setTextRunValueAtPath("title", "New Title", "artboard1");
|
|
4862
|
+
*
|
|
4863
|
+
* @example
|
|
4864
|
+
* // Set the text value for a text run named "subtitle" within a nested group two artboards deep
|
|
4865
|
+
* riveInstance.setTextRunValueAtPath("subtitle", "New Subtitle", "group/nestedGroup");
|
|
4866
|
+
*
|
|
4867
|
+
* @remarks
|
|
4868
|
+
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
4869
|
+
*/
|
|
4870
|
+
Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
|
|
4871
|
+
var run = this.retrieveTextAtPath(textName, path);
|
|
4872
|
+
if (!run) {
|
|
4873
|
+
console.warn("Could not set text with name: '".concat(textName, "', at path:'").concat(path, "'"));
|
|
4874
|
+
return;
|
|
4875
|
+
}
|
|
4876
|
+
run.text = value;
|
|
4877
|
+
};
|
|
4806
4878
|
Object.defineProperty(Rive.prototype, "playingStateMachineNames", {
|
|
4807
4879
|
// Returns a list of playing machine names
|
|
4808
4880
|
get: function () {
|