@rive-app/canvas 2.49.2 → 2.49.4

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
  # Rive
3
3
  High-level Rive API using CanvasRenderingContext2D. Please see https://github.com/rive-app/rive-wasm for a list of all the available web runtimes and their details.
4
4
 
5
+ [Rive](https://rive.app) is an agent-native 2D and 3D engine for games, apps, and interactive UI. Use it as your whole engine, or add it to the products you already have. Build with your coding agent through the [Rive CLI](https://rive.app/agents), or draw, rig, and animate by hand with the professional design and animation tools in the [Rive Editor](https://rive.app/editor). Both work on the same files. Open-source runtimes, no royalties or runtime fees. Rive files (`.riv`) play natively on web, mobile, desktop, game engines, consoles, smart TVs, and cars.
6
+
5
7
  ## Canvas
6
8
  ```
7
9
  npm install @rive-app/canvas
@@ -13,3 +15,13 @@ An easy-to-use high-level Rive API using a backing [CanvasRenderingContext2D](ht
13
15
  - Requests the Web Assembly (WASM) backing dependency for you
14
16
 
15
17
  [Getting Started](https://github.com/rive-app/rive-wasm#getting-started)
18
+
19
+ ## Build with your agent
20
+
21
+ Paste this into Claude Code, Codex, Cursor, or any agent that runs commands on your computer:
22
+
23
+ ```text
24
+ Install the Rive CLI from rive.app/cli. Build an interactive hero for my website as a Rive file and add it to the page with the Rive web runtime.
25
+ ```
26
+
27
+ Your agent installs the [Rive CLI](https://rive.app/agents), writes the scene, and opens a preview window that rebuilds every time it saves. Keep giving it notes, or open the same file in the [Rive Editor](https://editor.rive.app/) and shape it by hand. Trying it needs no account. Writing the `.riv` that ships on your site needs a free Rive account. Free exports play a short Rive splash screen; [paid plans](https://rive.app/pricing) export without it. See [Getting started with the Rive CLI](https://rive.app/docs/cli/getting-started).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rive-app/canvas",
3
- "version": "2.49.2",
4
- "description": "Rive's canvas based web api.",
3
+ "version": "2.49.4",
4
+ "description": "Rive web runtime with the canvas renderer. Rive is an agent-native 2D and 3D engine for games, apps, and interactive UI.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
7
7
  "repository": {
@@ -10,7 +10,11 @@
10
10
  },
11
11
  "keywords": [
12
12
  "rive",
13
- "animation"
13
+ "animation",
14
+ "interactive",
15
+ "ui",
16
+ "game-engine",
17
+ "graphics"
14
18
  ],
15
19
  "author": "Rive",
16
20
  "contributors": [
package/rive.d.ts CHANGED
@@ -837,7 +837,7 @@ export declare class Rive {
837
837
  private ensureKeyboardInteractions;
838
838
  /** Runs inside touchend/mouseup so focusing the proxy raises the mobile keyboard. */
839
839
  private summonKeyboardForGesture;
840
- /** expectsKeyboardInput, and (with semantics on) the focused node is a textField. */
840
+ /** expectsTextInput (not key listeners alone), and with semantics on a textField. */
841
841
  private wantsTextInputSession;
842
842
  private advanceAndDrainForPointer;
843
843
  private cleanupKeyboardInteractions;
package/rive.js CHANGED
@@ -822,14 +822,14 @@ we[d]?.K.canvas&&(we[d].K.canvas.Pc=void 0);we[d]=null},De,Fe,Ge={},Ie=()=>{if(!
822
822
  !1;return m},["delete"](){this.m.v||jd(this);if(this.m.za&&!this.m.ta)throw new Gc("Object already scheduled for deletion");Sc(this);var m=this.m;--m.count.value;0===m.count.value&&(m.J?m.T.Z(m.J):m.B.o.Z(m.v));this.m.ta||(this.m.J=void 0,this.m.v=void 0)},isDeleted:function(){return!this.m.v},deleteLater:function(){this.m.v||jd(this);if(this.m.za&&!this.m.ta)throw new Gc("Object already scheduled for deletion");kd.push(this);this.m.za=!0;return this}});const g=Symbol.dispose;g&&(d[g]=d["delete"])})();
823
823
  Object.assign(zd.prototype,{Ad(d){this.xc&&(d=this.xc(d));return d},dc(d){this.Z?.(d)},S:Xc,u:function(d){function g(){return this.Ya?yd(this.o.X,{B:this.Vd,v:m,T:this,J:d}):yd(this.o.X,{B:this,v:d})}var m=this.Ad(d);if(!m)return this.dc(d),null;var r=xd(this.o,m);if(void 0!==r){if(0===r.m.count.value)return r.m.v=m,r.m.J=d,r.clone();r=r.clone();this.dc(d);return r}r=this.o.zd(m);r=md[r];if(!r)return g.call(this);r=this.Xa?r.md:r.pointerType;var A=wd(m,this.o,r.o);return null===A?g.call(this):this.Ya?
824
824
  yd(r.o.X,{B:r,v:A,T:this,J:d}):yd(r.o.X,{B:r,v:A})}});for(let d=0;32>d;++d)Ke.push(Array(d));G.print&&(Jb=G.print);G.printErr&&(Kb=G.printErr);G.wasmBinary&&(Lb=G.wasmBinary);G.thisProgram&&(zb=G.thisProgram);if(G.preInit)for("function"==typeof G.preInit&&(G.preInit=[G.preInit]);0<G.preInit.length;)G.preInit.shift()();
825
- var We={344519:(d,g,m,r,A)=>{if("undefined"===typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if("undefined"===typeof window.miniaudio){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=d;window.miniaudio.device_type.capture=g;window.miniaudio.device_type.duplex=m;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=r;window.miniaudio.device_state.started=A;let C=window.miniaudio;C.devices=
825
+ var We={344647:(d,g,m,r,A)=>{if("undefined"===typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if("undefined"===typeof window.miniaudio){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=d;window.miniaudio.device_type.capture=g;window.miniaudio.device_type.duplex=m;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=r;window.miniaudio.device_state.started=A;let C=window.miniaudio;C.devices=
826
826
  [];C.track_device=function(D){for(var F=0;F<C.devices.length;++F)if(null==C.devices[F])return C.devices[F]=D,F;C.devices.push(D);return C.devices.length-1};C.untrack_device_by_index=function(D){for(C.devices[D]=null;0<C.devices.length;)if(null==C.devices[C.devices.length-1])C.devices.pop();else break};C.untrack_device=function(D){for(var F=0;F<C.devices.length;++F)if(C.devices[F]==D)return C.untrack_device_by_index(F)};C.get_device_by_index=function(D){return C.devices[D]};C.unlock_event_types=["touchend",
827
- "click"];C.unlock=function(){for(var D=0;D<C.devices.length;++D){var F=C.devices[D];null!=F&&null!=F.U&&F.state===C.device_state.started&&F.U.resume().then(()=>{Te(F.sc)},N=>{console.error("Failed to resume audiocontext",N)})}C.unlock_event_types.map(function(N){document.removeEventListener(N,C.unlock,!0)})};C.unlock_event_types.map(function(D){document.addEventListener(D,C.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},346697:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(d){document.removeEventListener(d,
828
- window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},347001:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,347105:()=>{try{var d=new (window.AudioContext||window.webkitAudioContext),g=d.sampleRate;d.close();return g}catch(m){return 0}},347276:(d,g,m,r,A,C)=>{if("undefined"===typeof window.miniaudio)return-1;var D={},F={};d==window.miniaudio.device_type.playback&&0!=m&&(F.sampleRate=m);D.U=
827
+ "click"];C.unlock=function(){for(var D=0;D<C.devices.length;++D){var F=C.devices[D];null!=F&&null!=F.U&&F.state===C.device_state.started&&F.U.resume().then(()=>{Te(F.sc)},N=>{console.error("Failed to resume audiocontext",N)})}C.unlock_event_types.map(function(N){document.removeEventListener(N,C.unlock,!0)})};C.unlock_event_types.map(function(D){document.addEventListener(D,C.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},346825:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(d){document.removeEventListener(d,
828
+ window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},347129:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,347233:()=>{try{var d=new (window.AudioContext||window.webkitAudioContext),g=d.sampleRate;d.close();return g}catch(m){return 0}},347404:(d,g,m,r,A,C)=>{if("undefined"===typeof window.miniaudio)return-1;var D={},F={};d==window.miniaudio.device_type.playback&&0!=m&&(F.sampleRate=m);D.U=
829
829
  new (window.AudioContext||window.webkitAudioContext)(F);D.U.suspend();D.state=window.miniaudio.device_state.stopped;m=0;d!=window.miniaudio.device_type.playback&&(m=g);D.ca=D.U.createScriptProcessor(r,m,g);D.ca.onaudioprocess=function(N){if(null==D.Ca||0==D.Ca.length||D.Ca.buffer!==Vb.buffer)D.Ca=new Float32Array(Vb.buffer,Number(A),r*g);if(d==window.miniaudio.device_type.capture||d==window.miniaudio.device_type.duplex){for(var R=0;R<g;R+=1)for(var Z=N.inputBuffer.getChannelData(R),Y=D.Ca,aa=0;aa<
830
830
  r;aa+=1)Y[aa*g+R]=Z[aa];Ue(C,r,A)}if(d==window.miniaudio.device_type.playback||d==window.miniaudio.device_type.duplex)for(Ve(C,r,A),R=0;R<N.outputBuffer.numberOfChannels;++R)for(Z=N.outputBuffer.getChannelData(R),Y=D.Ca,aa=0;aa<r;aa+=1)Z[aa]=Y[aa*g+R];else for(R=0;R<N.outputBuffer.numberOfChannels;++R)N.outputBuffer.getChannelData(R).fill(0)};d!=window.miniaudio.device_type.capture&&d!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(N){D.hb=
831
- D.U.createMediaStreamSource(N);D.hb.connect(D.ca);D.ca.connect(D.U.destination)}).catch(function(N){console.log("Failed to get user media: "+N)});d==window.miniaudio.device_type.playback&&D.ca.connect(D.U.destination);D.sc=C;return window.miniaudio.track_device(D)},350220:d=>window.miniaudio.get_device_by_index(d).U.sampleRate,350293:d=>{d=window.miniaudio.get_device_by_index(d);void 0!==d.ca&&(d.ca.onaudioprocess=function(){},d.ca.disconnect(),d.ca=void 0);void 0!==d.hb&&(d.hb.disconnect(),d.hb=
832
- void 0);d.U.close();d.U=void 0;d.sc=void 0},350693:d=>{window.miniaudio.untrack_device_by_index(d)},350743:d=>{d=window.miniaudio.get_device_by_index(d);d.U.resume();d.state=window.miniaudio.device_state.started},350882:d=>{d=window.miniaudio.get_device_by_index(d);d.U.suspend();d.state=window.miniaudio.device_state.stopped}},Pc,Ne,Oc,Xe,Ye,Ze,$e,af,bf,cf,df,ef,ff,gf,Te,Ue,Ve,hf,jf,qc,Re,sc,ec,Cd,lf={__syscall_fcntl64:function(){return 0},__syscall_ioctl:function(){return 0},__syscall_openat:function(){},
831
+ D.U.createMediaStreamSource(N);D.hb.connect(D.ca);D.ca.connect(D.U.destination)}).catch(function(N){console.log("Failed to get user media: "+N)});d==window.miniaudio.device_type.playback&&D.ca.connect(D.U.destination);D.sc=C;return window.miniaudio.track_device(D)},350348:d=>window.miniaudio.get_device_by_index(d).U.sampleRate,350421:d=>{d=window.miniaudio.get_device_by_index(d);void 0!==d.ca&&(d.ca.onaudioprocess=function(){},d.ca.disconnect(),d.ca=void 0);void 0!==d.hb&&(d.hb.disconnect(),d.hb=
832
+ void 0);d.U.close();d.U=void 0;d.sc=void 0},350821:d=>{window.miniaudio.untrack_device_by_index(d)},350871:d=>{d=window.miniaudio.get_device_by_index(d);d.U.resume();d.state=window.miniaudio.device_state.started},351010:d=>{d=window.miniaudio.get_device_by_index(d);d.U.suspend();d.state=window.miniaudio.device_state.stopped}},Pc,Ne,Oc,Xe,Ye,Ze,$e,af,bf,cf,df,ef,ff,gf,Te,Ue,Ve,hf,jf,qc,Re,sc,ec,Cd,lf={__syscall_fcntl64:function(){return 0},__syscall_ioctl:function(){return 0},__syscall_openat:function(){},
833
833
  _abort_js:()=>fc(""),_embind_create_inheriting_constructor:(d,g,m)=>{d=Kc(d);g=Rc(g,"wrapper");m=Hc(m);var r=g.o,A=r.X,C=r.I.X,D=r.I.constructor;d=Dc(d,function(...F){for(var N of r.I.uc)if(this[N]===C[N])throw new Jc(`Pure virtual function ${N} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:A});this.__construct(...F)});A.__construct=function(...F){if(this===A)throw new Gc("Pass correct 'this' to __construct");F=D.implement(this,...F);Sc(F);var N=F.m;F.notifyOnDestruction();
834
834
  N.ta=!0;Object.defineProperties(this,{m:{value:N}});Uc(this);F=N.v;F=Mc(r,F);if(Lc.hasOwnProperty(F))throw new Gc(`Tried to register registered instance: ${F}`);Lc[F]=this};A.__destruct=function(){if(this===A)throw new Gc("Pass correct 'this' to __destruct");Sc(this);var F=this.m.v;F=Mc(r,F);if(Lc.hasOwnProperty(F))delete Lc[F];else throw new Gc(`Tried to unregister unregistered instance: ${F}`);};d.prototype=Object.create(A);Object.assign(d.prototype,m);return Ic(d)},_embind_finalize_value_object:d=>
835
835
  {var g=Vc[d];delete Vc[d];var m=g.Jb,r=g.Z,A=g.ic,C=A.map(D=>D.Dd).concat(A.map(D=>D.Zk));bd([d],C,D=>{var F={},N,R;for([N,R]of A.entries()){const Z=D[N],Y=R.Bd,aa=R.Cd,pa=D[N+A.length],ha=R.Yk,va=R.$k;F[R.wd]={read:Da=>Z.u(Y(aa,Da)),write:(Da,La)=>{var ya=[];ha(va,Da,pa.F(ya,La));Wc(ya)},optional:Z.optional}}return[{name:g.name,u:Z=>{var Y={},aa;for(aa in F)Y[aa]=F[aa].read(Z);r(Z);return Y},F:(Z,Y)=>{for(var aa in F)if(!(aa in Y||F[aa].optional))throw new TypeError(`Missing field: "${aa}"`);var pa=
@@ -900,7 +900,7 @@ m.dynCall_iiiji;Bd.iiji=m.dynCall_iiji;Bd.jii=m.dynCall_jii;Bd.vijj=m.dynCall_vi
900
900
  /***/ ((module) => {
901
901
 
902
902
  "use strict";
903
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.49.2","description":"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","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
903
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.49.4","description":"Rive web runtime with the canvas renderer. Rive is an agent-native 2D and 3D engine for games, apps, and interactive UI.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation","interactive","ui","game-engine","graphics"],"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","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
904
904
 
905
905
  /***/ }),
906
906
  /* 7 */
@@ -6234,7 +6234,7 @@ var StateMachine = /** @class */ (function () {
6234
6234
  };
6235
6235
  /**
6236
6236
  * Get metadata about the state of focus if applicable for this state machine.
6237
- * @returns FocusState - { hasFocus: boolean, expectsKeyboardInput: boolean }
6237
+ * @returns FocusState - { hasFocus: boolean, expectsKeyboardInput: boolean, expectsTextInput: boolean }
6238
6238
  */
6239
6239
  StateMachine.prototype.focusState = function () {
6240
6240
  return this.instance.focusState();
@@ -8103,14 +8103,14 @@ var Rive = /** @class */ (function () {
8103
8103
  var activeSm = this.focusStateMachine;
8104
8104
  if (!activeSm)
8105
8105
  return;
8106
- if (this.wantsTextInputSession(activeSm.focusState().expectsKeyboardInput)) {
8106
+ if (this.wantsTextInputSession(activeSm.focusState().expectsTextInput)) {
8107
8107
  this._keyboardInteractions.summonForPointer();
8108
8108
  }
8109
8109
  };
8110
- /** expectsKeyboardInput, and (with semantics on) the focused node is a textField. */
8111
- Rive.prototype.wantsTextInputSession = function (expectsKeyboardInput) {
8110
+ /** expectsTextInput (not key listeners alone), and with semantics on a textField. */
8111
+ Rive.prototype.wantsTextInputSession = function (expectsTextInput) {
8112
8112
  var _a;
8113
- if (!expectsKeyboardInput)
8113
+ if (!expectsTextInput)
8114
8114
  return false;
8115
8115
  var node = (_a = this._semanticTree) === null || _a === void 0 ? void 0 : _a.focusedNode();
8116
8116
  return node === undefined || node.role === _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField;
@@ -8572,8 +8572,8 @@ var Rive = /** @class */ (function () {
8572
8572
  this._prevWantsTextInputSession = false;
8573
8573
  return;
8574
8574
  }
8575
- var _a = activeSm.focusState(), hasFocus = _a.hasFocus, expectsKeyboardInput = _a.expectsKeyboardInput;
8576
- this.syncTextInputSession(ki, this.wantsTextInputSession(expectsKeyboardInput));
8575
+ var _a = activeSm.focusState(), hasFocus = _a.hasFocus, expectsTextInput = _a.expectsTextInput;
8576
+ this.syncTextInputSession(ki, this.wantsTextInputSession(expectsTextInput));
8577
8577
  this.syncRiveFocus(ki, this.canvas, hasFocus);
8578
8578
  };
8579
8579
  /** Begin/end the text session on wantsSession edges; decorate the proxy while it has DOM focus. */