@rive-app/canvas 2.40.0 → 2.41.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 +1 -1
- package/rive.d.ts +206 -5
- package/rive.js +348 -73
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
- package/utils/registerKeyboardInteractions.d.ts +46 -21
package/rive.js
CHANGED
|
@@ -444,14 +444,14 @@ c.va.count.value+=1;c.va.mb=!1;return c},["delete"](){this.va.Ba||zc(this);if(th
|
|
|
444
444
|
const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
|
|
445
445
|
Object.assign(Pc.prototype,{Qc(a){this.pc&&(a=this.pc(a));return a},ac(a){this.Va?.(a)},Ma:tc,Aa:function(a){function b(){return this.vb?Oc(this.wa.Sa,{Da:this.gd,Ba:c,Pa:this,Ja:a}):Oc(this.wa.Sa,{Da:this,Ba:a})}var c=this.Qc(a);if(!c)return this.ac(a),null;var d=Nc(this.wa,c);if(void 0!==d){if(0===d.va.count.value)return d.va.Ba=c,d.va.Ja=a,d.clone();d=d.clone();this.ac(a);return d}d=this.wa.Pc(c);d=Cc[d];if(!d)return b.call(this);d=this.ub?d.Gc:d.pointerType;var e=Mc(c,this.wa,d.wa);return null===
|
|
446
446
|
e?b.call(this):this.vb?Oc(d.wa.Sa,{Da:d,Ba:e,Pa:this,Ja:a}):Oc(d.wa.Sa,{Da:d,Ba:e})}});k.noExitRuntime&&(Xa=k.noExitRuntime);k.print&&(ta=k.print);k.printErr&&(wa=k.printErr);k.wasmBinary&&(xa=k.wasmBinary);k.thisProgram&&(la=k.thisProgram);if(k.preInit)for("function"==typeof k.preInit&&(k.preInit=[k.preInit]);0<k.preInit.length;)k.preInit.shift()();
|
|
447
|
-
var Gd={
|
|
447
|
+
var Gd={237247:(a,b,c,d,e)=>{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=a;window.miniaudio.device_type.capture=b;window.miniaudio.device_type.duplex=c;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=d;window.miniaudio.device_state.started=e;let f=window.miniaudio;f.devices=
|
|
448
448
|
[];f.track_device=function(g){for(var h=0;h<f.devices.length;++h)if(null==f.devices[h])return f.devices[h]=g,h;f.devices.push(g);return f.devices.length-1};f.untrack_device_by_index=function(g){for(f.devices[g]=null;0<f.devices.length;)if(null==f.devices[f.devices.length-1])f.devices.pop();else break};f.untrack_device=function(g){for(var h=0;h<f.devices.length;++h)if(f.devices[h]==g)return f.untrack_device_by_index(h)};f.get_device_by_index=function(g){return f.devices[g]};f.unlock_event_types=["touchend",
|
|
449
|
-
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.Qa&&h.state===f.device_state.started&&h.Qa.resume().then(()=>{Dd(h.nc)},m=>{console.error("Failed to resume audiocontext",m)})}f.unlock_event_types.map(function(m){document.removeEventListener(m,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},
|
|
450
|
-
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},
|
|
449
|
+
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.Qa&&h.state===f.device_state.started&&h.Qa.resume().then(()=>{Dd(h.nc)},m=>{console.error("Failed to resume audiocontext",m)})}f.unlock_event_types.map(function(m){document.removeEventListener(m,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},239425:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
|
|
450
|
+
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},239729:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,239833:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},240004:(a,b,c,d,e,f)=>{if("undefined"===typeof window.miniaudio)return-1;var g={},h={};a==window.miniaudio.device_type.playback&&0!=c&&(h.sampleRate=c);g.Qa=
|
|
451
451
|
new (window.AudioContext||window.webkitAudioContext)(h);g.Qa.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.fb=g.Qa.createScriptProcessor(d,c,b);g.fb.onaudioprocess=function(m){if(null==g.tb||0==g.tb.length)g.tb=new Float32Array(Ga.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var l=0;l<b;l+=1)for(var u=m.inputBuffer.getChannelData(l),y=g.tb,t=0;t<d;t+=1)y[t*b+l]=u[t];Ed(f,d,e)}if(a==
|
|
452
452
|
window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(Fd(f,d,e),l=0;l<m.outputBuffer.numberOfChannels;++l)for(u=m.outputBuffer.getChannelData(l),y=g.tb,t=0;t<d;t+=1)u[t]=y[t*b+l];else for(l=0;l<m.outputBuffer.numberOfChannels;++l)m.outputBuffer.getChannelData(l).fill(0)};a!=window.miniaudio.device_type.capture&&a!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(m){g.Cb=g.Qa.createMediaStreamSource(m);g.Cb.connect(g.fb);
|
|
453
|
-
g.fb.connect(g.Qa.destination)}).catch(function(m){console.log("Failed to get user media: "+m)});a==window.miniaudio.device_type.playback&&g.fb.connect(g.Qa.destination);g.nc=f;return window.miniaudio.track_device(g)},
|
|
454
|
-
{window.miniaudio.untrack_device_by_index(a)},
|
|
453
|
+
g.fb.connect(g.Qa.destination)}).catch(function(m){console.log("Failed to get user media: "+m)});a==window.miniaudio.device_type.playback&&g.fb.connect(g.Qa.destination);g.nc=f;return window.miniaudio.track_device(g)},242881:a=>window.miniaudio.get_device_by_index(a).Qa.sampleRate,242954:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.fb&&(a.fb.onaudioprocess=function(){},a.fb.disconnect(),a.fb=void 0);void 0!==a.Cb&&(a.Cb.disconnect(),a.Cb=void 0);a.Qa.close();a.Qa=void 0;a.nc=void 0},243354:a=>
|
|
454
|
+
{window.miniaudio.untrack_device_by_index(a)},243404:a=>{a=window.miniaudio.get_device_by_index(a);a.Qa.resume();a.state=window.miniaudio.device_state.started},243543:a=>{a=window.miniaudio.get_device_by_index(a);a.Qa.suspend();a.state=window.miniaudio.device_state.stopped}},lc,Hd,kc,Dd,Ed,Fd,Id,Jd,Kd,Ld,Ma,Rc,Nd={s:function(a,b,c){Ya=c;try{var d=Lb(a);switch(b){case 0:var e=Za();if(0>e)break;for(;Ab[e];)e++;return Nb(d,e).cb;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=Za(),d.flags|=
|
|
455
455
|
e,0;case 12:return e=Za(),Ca[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof bc||"ErrnoError"!==f.name)throw f;return-f.bb}},L:function(a,b,c){Ya=c;try{var d=Lb(a);switch(b){case 21509:return d.Ca?0:-59;case 21505:if(!d.Ca)return-59;if(d.Ca.ab.Wc){a=[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var e=Za();B[e>>2]=25856;B[e+4>>2]=5;B[e+8>>2]=191;B[e+12>>2]=35387;for(var f=0;32>f;f++)v[e+f+17]=a[f]||0}return 0;case 21510:case 21511:case 21512:return d.Ca?
|
|
456
456
|
0:-59;case 21506:case 21507:case 21508:if(!d.Ca)return-59;if(d.Ca.ab.Xc)for(e=Za(),a=[],f=0;32>f;f++)a.push(v[e+f+17]);return 0;case 21519:if(!d.Ca)return-59;e=Za();return B[e>>2]=0;case 21520:return d.Ca?-28:-59;case 21537:case 21531:e=Za();if(!d.xa.Vc)throw new M(59);return d.xa.Vc(d,b,e);case 21523:if(!d.Ca)return-59;d.Ca.ab.Yc&&(f=[24,80],e=Za(),Ca[e>>1]=f[0],Ca[e+2>>1]=f[1]);return 0;case 21524:return d.Ca?0:-59;case 21515:return d.Ca?0:-59;default:return-28}}catch(g){if("undefined"==typeof bc||
|
|
457
457
|
"ErrnoError"!==g.name)throw g;return-g.bb}},M:function(a,b,c,d){Ya=d;try{b=b?ib(A,b):"";var e=b;if("/"===e.charAt(0))b=e;else{var f=-100===a?"/":Lb(a).path;if(0==e.length)throw new M(44);b=f+"/"+e}var g=d?Za():0;return Zb(b,c,g).cb}catch(h){if("undefined"==typeof bc||"ErrnoError"!==h.name)throw h;return-h.bb}},P:()=>Na(""),o:(a,b,c)=>{a=T(a);b=nc(b,"wrapper");c=Q(c);var d=b.wa,e=d.Sa,f=d.Ia.Sa,g=d.Ia.constructor;a=cc(a,function(...h){for(var m of d.Ia.oc)if(this[m]===f[m])throw new gc(`Pure virtual function ${m} must be implemented in JavaScript`);
|
|
@@ -471,16 +471,16 @@ $c(a);e=Y(d,e);Ec(a,function(){Tc(`Cannot call ${a} due to unbound types`,g)},b-
|
|
|
471
471
|
U(a,{name:c,Aa:d,Ma:d},{Uc:!0})},U:(a,b)=>{b=T(b);U(a,{name:b,Aa(c){var d=(d=c+4)?ib(A,d,J[c>>2],!0):"";lc(c);return d},Ea(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new P("Cannot pass non-string to std::string");var f=e?kb(d):d.length;var g=Hd(4+f+1),h=g+4;J[g>>2]=f;e?lb(d,A,h,f+1):A.set(d,h);null!==c&&c.push(lc,g);return g},Ma:tc,La(c){lc(c)}})},p:(a,b,c)=>{c=T(c);if(2===b){var d=gd;var e=hd;var f=jd}else d=
|
|
472
472
|
kd,e=ld,f=md;U(a,{name:c,Aa:g=>{var h=d(g+4,J[g>>2]*b,!0);lc(g);return h},Ea:(g,h)=>{if("string"!=typeof h)throw new P(`Cannot pass non-string to C++ string type ${c}`);var m=f(h),l=Hd(4+m+b);J[l>>2]=m/b;e(h,l+4,m+b);null!==g&&g.push(lc,l);return l},Ma:tc,La(g){lc(g)}})},aa:(a,b,c,d,e,f)=>{rc[a]={name:T(b),Qb:Y(c,d),Va:Y(e,f),dc:[]}},$:(a,b,c,d,e,f,g,h,m,l)=>{rc[a].dc.push({Nc:T(b),Tc:c,Rc:Y(d,e),Sc:f,kd:g,jd:Y(h,m),ld:l})},W:(a,b)=>{b=T(b);U(a,{$c:!0,name:b,Aa:()=>{},Ea:()=>{}})},A:()=>{Xa=!1;nd=
|
|
473
473
|
0},y:()=>{throw Infinity;},f:(a,b,c)=>{var [d,...e]=qd(a,b),f=d.Ea.bind(d),g=e.map(m=>m.Ma.bind(m));a--;var h=Array(a);b=`methodCaller<(${e.map(m=>m.name)}) => ${d.name}>`;return pd(cc(b,(m,l,u,y)=>{for(var t=0,w=0;w<a;++w)h[w]=g[w](y+t),t+=8;switch(c){case 0:var x=Q(m).apply(null,h);break;case 2:x=Reflect.construct(Q(m),h);break;case 3:x=h[0];break;case 1:x=Q(m)[sd(l)](...h)}m=[];x=f(m,x);m.length&&(J[u>>2]=fc(m));return x}))},ca:bd,X:a=>{a=sd(a);return fc(k[a])},Y:(a,b)=>{a=Q(a);b=Q(b);return fc(a[b])},
|
|
474
|
-
v:a=>{9<a&&(ec[a+1]+=1)},e:(a,b,c,d,e)=>od[a](b,c,d,e),Z:()=>fc([]),ba:a=>fc(sd(a)),da:()=>fc({}),w:a=>{var b=Q(a);sc(b);bd(a)},g:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},
|
|
475
|
-
0,1,0,0,0,0))/864E5|0},
|
|
476
|
-
0,1)).getTimezoneOffset();B[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},B:(a,b)=>{vd[a]&&(clearTimeout(vd[a].id),delete vd[a]);if(!b)return 0;var c=setTimeout(()=>{delete vd[a];yd(()=>Id(a,performance.now()))},b);vd[a]={id:c,Kd:b};return 0},
|
|
477
|
-
"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(lb(a,A,c,17),lb(b,A,d,17)):(lb(a,A,d,17),lb(b,A,c,17))},O:function(a,b,c){if(!(0<=a&&3>=a))return 28;Ia[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},j:(a,b,c)=>{zd.length=0;for(var d;d=A[b++];){var e=105!=d;e&=112!=d;c+=e&&c%8?4:0;zd.push(112==d?J[c>>2]:106==d?Ia[c>>3]:105==d?B[c>>2]:Ha[c>>3]);c+=e?8:4}return Gd[a](...zd)},N:()=>Date.now(),Q:()=>performance.now(),
|
|
478
|
-
for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-Ma.buffer.byteLength+65535)/65536|0;try{Ma.grow(d);La();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},
|
|
474
|
+
v:a=>{9<a&&(ec[a+1]+=1)},e:(a,b,c,d,e)=>od[a](b,c,d,e),Z:()=>fc([]),ba:a=>fc(sd(a)),da:()=>fc({}),w:a=>{var b=Q(a);sc(b);bd(a)},g:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},D:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);B[b>>2]=a.getUTCSeconds();B[b+4>>2]=a.getUTCMinutes();B[b+8>>2]=a.getUTCHours();B[b+12>>2]=a.getUTCDate();B[b+16>>2]=a.getUTCMonth();B[b+20>>2]=a.getUTCFullYear()-1900;B[b+24>>2]=a.getUTCDay();B[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),
|
|
475
|
+
0,1,0,0,0,0))/864E5|0},E:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);B[b>>2]=a.getSeconds();B[b+4>>2]=a.getMinutes();B[b+8>>2]=a.getHours();B[b+12>>2]=a.getDate();B[b+16>>2]=a.getMonth();B[b+20>>2]=a.getFullYear()-1900;B[b+24>>2]=a.getDay();var c=a.getFullYear();B[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?ud:td)[a.getMonth()]+a.getDate()-1|0;B[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),
|
|
476
|
+
0,1)).getTimezoneOffset();B[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},B:(a,b)=>{vd[a]&&(clearTimeout(vd[a].id),delete vd[a]);if(!b)return 0;var c=setTimeout(()=>{delete vd[a];yd(()=>Id(a,performance.now()))},b);vd[a]={id:c,Kd:b};return 0},F:(a,b,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();J[a>>2]=60*Math.max(f,e);B[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,
|
|
477
|
+
"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(lb(a,A,c,17),lb(b,A,d,17)):(lb(a,A,d,17),lb(b,A,c,17))},O:function(a,b,c){if(!(0<=a&&3>=a))return 28;Ia[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},j:(a,b,c)=>{zd.length=0;for(var d;d=A[b++];){var e=105!=d;e&=112!=d;c+=e&&c%8?4:0;zd.push(112==d?J[c>>2]:106==d?Ia[c>>3]:105==d?B[c>>2]:Ha[c>>3]);c+=e?8:4}return Gd[a](...zd)},N:()=>Date.now(),Q:()=>performance.now(),C:a=>{var b=A.length;a>>>=0;if(2147483648<a)return!1;
|
|
478
|
+
for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-Ma.buffer.byteLength+65535)/65536|0;try{Ma.grow(d);La();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},H:(a,b)=>{var c=0,d=0,e;for(e of Cd()){var f=b+c;J[a+d>>2]=f;c+=lb(e,A,f,Infinity)+1;d+=4}return 0},I:(a,b)=>{var c=Cd();J[a>>2]=c.length;a=0;for(var d of c)a+=kb(d)+1;J[b>>2]=a;return 0},r:function(a){try{var b=Lb(a);if(null===b.cb)throw new M(8);b.Mb&&(b.Mb=
|
|
479
479
|
null);try{b.xa.close&&b.xa.close(b)}catch(c){throw c;}finally{Ab[b.cb]=null}b.cb=null;return 0}catch(c){if("undefined"==typeof bc||"ErrnoError"!==c.name)throw c;return c.bb}},K:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],m=J[a+4>>2];a+=8;var l=e,u=h,y=m,t=f,w=v;if(0>y||0>t)throw new M(28);if(null===l.cb)throw new M(8);if(1===(l.flags&2097155))throw new M(8);if(16384===(l.node.mode&61440))throw new M(31);if(!l.xa.read)throw new M(28);var x="undefined"!=typeof t;
|
|
480
|
-
if(!x)t=l.position;else if(!l.seekable)throw new M(70);var p=l.xa.read(l,w,u,y,t);x||(l.position+=p);var H=p;if(0>H){var F=-1;break a}b+=H;if(H<m)break;"undefined"!=typeof f&&(f+=H)}F=b}J[d>>2]=F;return 0}catch(q){if("undefined"==typeof bc||"ErrnoError"!==q.name)throw q;return q.bb}},
|
|
480
|
+
if(!x)t=l.position;else if(!l.seekable)throw new M(70);var p=l.xa.read(l,w,u,y,t);x||(l.position+=p);var H=p;if(0>H){var F=-1;break a}b+=H;if(H<m)break;"undefined"!=typeof f&&(f+=H)}F=b}J[d>>2]=F;return 0}catch(q){if("undefined"==typeof bc||"ErrnoError"!==q.name)throw q;return q.bb}},G:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=Lb(a);$b(e,b,c);Ia[d>>3]=BigInt(e.position);e.Mb&&0===b&&0===c&&(e.Mb=null);return 0}catch(f){if("undefined"==
|
|
481
481
|
typeof bc||"ErrnoError"!==f.name)throw f;return f.bb}},J:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],m=J[a+4>>2];a+=8;var l=e,u=h,y=m,t=f,w=v;if(0>y||0>t)throw new M(28);if(null===l.cb)throw new M(8);if(0===(l.flags&2097155))throw new M(8);if(16384===(l.node.mode&61440))throw new M(31);if(!l.xa.write)throw new M(28);l.seekable&&l.flags&1024&&$b(l,0,2);var x="undefined"!=typeof t;if(!x)t=l.position;else if(!l.seekable)throw new M(70);var p=l.xa.write(l,w,u,y,t,void 0);
|
|
482
|
-
x||(l.position+=p);var H=p;if(0>H){var F=-1;break a}b+=H;if(H<m)break;"undefined"!=typeof f&&(f+=H)}F=b}J[d>>2]=F;return 0}catch(q){if("undefined"==typeof bc||"ErrnoError"!==q.name)throw q;return q.bb}},x:Md,R:function(){return-1<navigator.platform.indexOf("Win")},z:xd,S:function(a,b,c){b=
|
|
483
|
-
d.height);var f=e.data.length,g=k.Cc(f);k.pd.set(e.data,g);k.rd(a,d.width,d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=k.Gd(d)+1,f=k.Cc(e);k.Jd(d,f,e);k.sd(a,f);k.qd(f)})}};function Md(a,b,c){var d=Ld();try{Rc.get(a)(b,c)}catch(e){Kd(d);if(e!==e+0)throw e;Jd(1,0)}}var Od;
|
|
482
|
+
x||(l.position+=p);var H=p;if(0>H){var F=-1;break a}b+=H;if(H<m)break;"undefined"!=typeof f&&(f+=H)}F=b}J[d>>2]=F;return 0}catch(q){if("undefined"==typeof bc||"ErrnoError"!==q.name)throw q;return q.bb}},x:Md,R:function(){return-1<navigator.platform.indexOf("Win")},z:xd,S:function(a,b,c){b=new Uint8Array(Ma.buffer,b,c);c=new Uint8Array(c);c.set(b);createImageBitmap(new Blob([c])).then(function(d){var e=(new OffscreenCanvas(d.width,d.height)).getContext("2d");e.drawImage(d,0,0);e=e.getImageData(0,0,
|
|
483
|
+
d.width,d.height);var f=e.data.length,g=k.Cc(f);k.pd.set(e.data,g);k.rd(a,d.width,d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=k.Gd(d)+1,f=k.Cc(e);k.Jd(d,f,e);k.sd(a,f);k.qd(f)})}};function Md(a,b,c){var d=Ld();try{Rc.get(a)(b,c)}catch(e){Kd(d);if(e!==e+0)throw e;Jd(1,0)}}var Od;
|
|
484
484
|
Od=await (async function(){function a(c){c=Od=c.exports;lc=c.ga;Hd=c.ha;kc=c.ia;k._wasm_image_decode_complete=c.ja;k._wasm_image_decode_error=c.ka;Dd=k._ma_device__on_notification_unlocked=c.la;k._ma_malloc_emscripten=c.ma;k._ma_free_emscripten=c.na;Ed=k._ma_device_process_pcm_frames_capture__webaudio=c.oa;Fd=k._ma_device_process_pcm_frames_playback__webaudio=c.pa;Id=c.ra;Jd=c.sa;Kd=c.ta;Ld=c.ua;Ma=c.ea;Rc=c.qa;La();return Od}var b={a:Nd};if(k.instantiateWasm)return new Promise(c=>{k.instantiateWasm(b,
|
|
485
485
|
(d,e)=>{c(a(d,e))})});Oa??=k.locateFile?k.locateFile("canvas_advanced.wasm",ma):ma+"canvas_advanced.wasm";return a((await Ra(b)).instance)}());
|
|
486
486
|
(function(){function a(){k.calledRun=!0;if(!ya){Ka=!0;if(!k.noFSInit&&!Cb){var b,c;Cb=!0;b??=k.stdin;c??=k.stdout;d??=k.stderr;b?ac("stdin",b):Yb("/dev/tty","/dev/stdin");c?ac("stdout",null,c):Yb("/dev/tty","/dev/stdout");d?ac("stderr",null,d):Yb("/dev/tty1","/dev/stderr");Zb("/dev/stdin",0);Zb("/dev/stdout",1);Zb("/dev/stderr",1)}Od.fa();Db=!1;Aa?.(k);k.onRuntimeInitialized?.();if(k.postRun)for("function"==typeof k.postRun&&(k.postRun=[k.postRun]);k.postRun.length;){var d=k.postRun.shift();Ua.push(d)}Ta(Ua)}}
|
|
@@ -493,7 +493,7 @@ if(k.preRun)for("function"==typeof k.preRun&&(k.preRun=[k.preRun]);k.preRun.leng
|
|
|
493
493
|
/* 5 */
|
|
494
494
|
/***/ ((module) => {
|
|
495
495
|
|
|
496
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.
|
|
496
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.41.0","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}}');
|
|
497
497
|
|
|
498
498
|
/***/ }),
|
|
499
499
|
/* 6 */
|
|
@@ -2649,21 +2649,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2649
2649
|
/* harmony export */ KeyboardInteractions: () => (/* binding */ KeyboardInteractions)
|
|
2650
2650
|
/* harmony export */ });
|
|
2651
2651
|
/**
|
|
2652
|
-
* Tracks the relationship between
|
|
2653
|
-
* current focus session.
|
|
2652
|
+
* Tracks the relationship between DOM focus inside this Rive focus domain (canvas or semantic overlay)
|
|
2653
|
+
* and Rive's internal focus for the current focus session.
|
|
2654
2654
|
*
|
|
2655
|
-
* NotFocused —
|
|
2656
|
-
*
|
|
2657
|
-
*
|
|
2658
|
-
* EntryPending —
|
|
2659
|
-
* the focus tree.
|
|
2660
|
-
*
|
|
2661
|
-
* RiveFocused — a Rive node
|
|
2662
|
-
*
|
|
2655
|
+
* NotFocused — DOM focus left the domain, Rive released focus internally, or Tab walked
|
|
2656
|
+
* off the end of the tree. Keyboard input isn't ours, so Tab is ignored and
|
|
2657
|
+
* reaches the next page element.
|
|
2658
|
+
* EntryPending — DOM focus is inside the domain but Rive holds no node yet, so the next Tab
|
|
2659
|
+
* enters the focus tree. Set by pointer focus on the canvas, by assistive technology (AT) focus landing
|
|
2660
|
+
* in the overlay, and by keyboard focus whose entry attempt found no eligible node.
|
|
2661
|
+
* RiveFocused — a Rive node holds focus. Tab/Shift+Tab route to the Rive focus manager and stay
|
|
2662
|
+
* inside the domain until either Rive reports focus ended (pollFocusState) or
|
|
2663
|
+
* focusNext()/focusPrevious() returns false at the edge of the tree.
|
|
2663
2664
|
*
|
|
2664
|
-
*
|
|
2665
|
-
*
|
|
2666
|
-
* where focusNext()/focusPrevious() return false but respects tabindex).
|
|
2665
|
+
* Keyboard focus on the canvas enters the tree immediately: onCanvasFocus infers direction from
|
|
2666
|
+
* where focus came from and goes straight to RiveFocused when a node accepts.
|
|
2667
2667
|
*/
|
|
2668
2668
|
var FocusSessionState;
|
|
2669
2669
|
(function (FocusSessionState) {
|
|
@@ -2672,7 +2672,9 @@ var FocusSessionState;
|
|
|
2672
2672
|
FocusSessionState["RiveFocused"] = "riveFocused";
|
|
2673
2673
|
})(FocusSessionState || (FocusSessionState = {}));
|
|
2674
2674
|
/**
|
|
2675
|
-
* Manages keyboard and DOM focus interactions for
|
|
2675
|
+
* Manages keyboard and DOM focus interactions for Rive's focus domain (<canvas> or semantic overlay).
|
|
2676
|
+
* Because keyboard events can apply on either part of the domain, we need to track what events we should
|
|
2677
|
+
* handle/intercept, and when to release focus back to the page outside of the domain.
|
|
2676
2678
|
*
|
|
2677
2679
|
* Tracks the canvas focus session state (focusSessionState) and routes
|
|
2678
2680
|
* Tab/Shift+Tab to the Rive state machine's focus manager. Exposes shared
|
|
@@ -2718,17 +2720,45 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
2718
2720
|
_this.focusSessionState = FocusSessionState.RiveFocused;
|
|
2719
2721
|
}
|
|
2720
2722
|
};
|
|
2721
|
-
|
|
2723
|
+
/**
|
|
2724
|
+
* Marks internal state that the canvas has lost DOM focus. Do not actually clear
|
|
2725
|
+
* Rive focus though if:
|
|
2726
|
+
* 1. DOM focus is still within Rive domain (i.e., semantic overlay)
|
|
2727
|
+
* 2. Document just lost focus (i.e. tab switching)
|
|
2728
|
+
*
|
|
2729
|
+
* When we're not in either of those buckets, it's safe to call `clearFocus()` on the SMI.
|
|
2730
|
+
*/
|
|
2731
|
+
this.onCanvasBlur = function (event) {
|
|
2722
2732
|
_this.focusSessionState = FocusSessionState.NotFocused;
|
|
2723
2733
|
_this.canvasHasFocus = false;
|
|
2734
|
+
var movedWithinFocusDomain = _this.isInFocusDomain(event.relatedTarget);
|
|
2735
|
+
var documentLostFocus = event.relatedTarget === null && !document.hasFocus();
|
|
2736
|
+
if (movedWithinFocusDomain || documentLostFocus)
|
|
2737
|
+
return;
|
|
2738
|
+
_this.mainSm.clearFocus();
|
|
2724
2739
|
};
|
|
2740
|
+
/**
|
|
2741
|
+
* Assistive technology (AT) focus landing inside the overlay is DOM focus inside the Rive focus domain, so open a
|
|
2742
|
+
* session even when no Rive node holds focus yet. shouldRiveHandleKeyEvent treats NotFocused
|
|
2743
|
+
* as authoritative, so without this the overlay's Tab keydowns reach onKeyDown and get dropped
|
|
2744
|
+
* at that gate — the browser would move focus out of Rive instead of to the next focus node.
|
|
2745
|
+
*/
|
|
2725
2746
|
this.onOverlayFocusIn = function (event) {
|
|
2726
|
-
if (_this.isInOverlay(event.target))
|
|
2727
|
-
|
|
2728
|
-
|
|
2747
|
+
if (!_this.isInOverlay(event.target))
|
|
2748
|
+
return;
|
|
2749
|
+
_this.focusDomainReleased = false;
|
|
2750
|
+
if (!_this.hasFocusNodes)
|
|
2751
|
+
return;
|
|
2752
|
+
if (_this.focusSessionState !== FocusSessionState.NotFocused)
|
|
2753
|
+
return;
|
|
2754
|
+
_this.focusSessionState = _this.mainSm.focusState().hasFocus
|
|
2755
|
+
? FocusSessionState.RiveFocused
|
|
2756
|
+
: FocusSessionState.EntryPending;
|
|
2729
2757
|
};
|
|
2730
|
-
|
|
2758
|
+
/** Overlay listeners attach lazily, so the first focusin only ever lands here. */
|
|
2759
|
+
this.onFocusDomainHostFocusIn = function (event) {
|
|
2731
2760
|
_this.syncOverlayListener();
|
|
2761
|
+
_this.onOverlayFocusIn(event);
|
|
2732
2762
|
};
|
|
2733
2763
|
this.onKeyDown = function (event) {
|
|
2734
2764
|
_this.syncOverlayListener();
|
|
@@ -2741,7 +2771,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
2741
2771
|
var forward = !event.shiftKey;
|
|
2742
2772
|
var focusMoved = forward ? _this.mainSm.focusNext() : _this.mainSm.focusPrevious();
|
|
2743
2773
|
if (focusMoved) {
|
|
2744
|
-
// A Rive node accepted focus — keep trapping Tab inside
|
|
2774
|
+
// A Rive node accepted focus — keep trapping Tab inside Rive.
|
|
2745
2775
|
_this.focusSessionState = FocusSessionState.RiveFocused;
|
|
2746
2776
|
event.preventDefault();
|
|
2747
2777
|
}
|
|
@@ -2777,27 +2807,34 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
2777
2807
|
/**
|
|
2778
2808
|
* Called by pollFocusState on the Rive instance when it observes hasFocus=true. Rive acquired
|
|
2779
2809
|
* focus internally (e.g. via a listener action or state transition) without a DOM focus event,
|
|
2780
|
-
* so mark the session RiveFocused.
|
|
2810
|
+
* so mark the session RiveFocused. This cannot resurrect a session that a DOM blur ended,
|
|
2811
|
+
* because onCanvasBlur clears Rive's focus alongside it.
|
|
2781
2812
|
*/
|
|
2782
2813
|
KeyboardInteractions.prototype.notifyRiveFocused = function () {
|
|
2783
2814
|
this.focusSessionState = FocusSessionState.RiveFocused;
|
|
2784
2815
|
};
|
|
2785
2816
|
/**
|
|
2786
|
-
*
|
|
2787
|
-
*
|
|
2788
|
-
*
|
|
2789
|
-
*
|
|
2817
|
+
* Determine if Rive should handle keyboard input. If session state is `NotFocused` - no.
|
|
2818
|
+
* DOM focus stays parked on the canvas after Rive releases focus internally, and that Tab
|
|
2819
|
+
* has to reach the page rather than re-enter the tree.
|
|
2820
|
+
*
|
|
2821
|
+
* Otherwise, the event still has to belong to Rive:
|
|
2822
|
+
* 1. If the current DOM focus is in Rive domain (canvas or semantic overlay)
|
|
2823
|
+
* 2. If the target for the key input is for the semantic overlay, or the canvas
|
|
2790
2824
|
*/
|
|
2791
2825
|
KeyboardInteractions.prototype.shouldRiveHandleKeyEvent = function (event) {
|
|
2826
|
+
if (this.focusSessionState === FocusSessionState.NotFocused)
|
|
2827
|
+
return false;
|
|
2792
2828
|
var inFocusDomain = this.isInFocusDomain(document.activeElement) ||
|
|
2793
2829
|
this.isInOverlay(event.target);
|
|
2794
|
-
if (inFocusDomain)
|
|
2795
|
-
return true;
|
|
2796
|
-
var sessionActive = this.focusSessionState !== FocusSessionState.NotFocused;
|
|
2797
2830
|
var eventOnCanvas = event.target === this.canvas;
|
|
2798
|
-
return
|
|
2831
|
+
return inFocusDomain || this.canvasHasFocus || eventOnCanvas;
|
|
2799
2832
|
};
|
|
2800
|
-
/**
|
|
2833
|
+
/**
|
|
2834
|
+
* The Rive focus domain: the DOM that counts as "inside" Rive for focus purposes — today the
|
|
2835
|
+
* canvas itself OR the accessibility overlay subtree. Anything added later belongs here, so
|
|
2836
|
+
* session bookkeeping and keydown routing pick it up for free.
|
|
2837
|
+
*/
|
|
2801
2838
|
KeyboardInteractions.prototype.isInFocusDomain = function (target) {
|
|
2802
2839
|
if (target === this.canvas)
|
|
2803
2840
|
return true;
|
|
@@ -3581,6 +3618,12 @@ var Layout = /** @class */ (function () {
|
|
|
3581
3618
|
|
|
3582
3619
|
// #endregion
|
|
3583
3620
|
// #region state machines
|
|
3621
|
+
/**
|
|
3622
|
+
* @deprecated State machine inputs are deprecated and will be removed in a
|
|
3623
|
+
* future major version: please use data binding properties instead. See
|
|
3624
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
3625
|
+
* for how to migrate.
|
|
3626
|
+
*/
|
|
3584
3627
|
var StateMachineInputType;
|
|
3585
3628
|
(function (StateMachineInputType) {
|
|
3586
3629
|
StateMachineInputType[StateMachineInputType["Number"] = 56] = "Number";
|
|
@@ -3589,6 +3632,10 @@ var StateMachineInputType;
|
|
|
3589
3632
|
})(StateMachineInputType || (StateMachineInputType = {}));
|
|
3590
3633
|
/**
|
|
3591
3634
|
* An input for a state machine
|
|
3635
|
+
* @deprecated State machine inputs are deprecated and will be removed in a
|
|
3636
|
+
* future major version: please use data binding properties instead. See
|
|
3637
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
3638
|
+
* for how to migrate.
|
|
3592
3639
|
*/
|
|
3593
3640
|
var StateMachineInput = /** @class */ (function () {
|
|
3594
3641
|
function StateMachineInput(type, runtimeInput) {
|
|
@@ -3638,6 +3685,11 @@ var StateMachineInput = /** @class */ (function () {
|
|
|
3638
3685
|
return StateMachineInput;
|
|
3639
3686
|
}());
|
|
3640
3687
|
|
|
3688
|
+
/**
|
|
3689
|
+
* @deprecated Rive Events are deprecated and will be removed in a future major
|
|
3690
|
+
* version: please use data binding instead. See
|
|
3691
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
3692
|
+
*/
|
|
3641
3693
|
var RiveEventType;
|
|
3642
3694
|
(function (RiveEventType) {
|
|
3643
3695
|
RiveEventType[RiveEventType["General"] = 128] = "General";
|
|
@@ -4180,6 +4232,12 @@ var Animator = /** @class */ (function () {
|
|
|
4180
4232
|
var instancedName;
|
|
4181
4233
|
if (this.animations.length === 0 && this.stateMachines.length === 0) {
|
|
4182
4234
|
if (this.artboard.animationCount() > 0) {
|
|
4235
|
+
// Warn only when the v3 default would actually change what plays
|
|
4236
|
+
if (this.artboard.stateMachineCount() > 0) {
|
|
4237
|
+
warnOnce("No `stateMachine` was specified, so the artboard's first linear animation is playing by default. " +
|
|
4238
|
+
"In the next major version, the artboard's state machine will be played by default instead when one exists. " +
|
|
4239
|
+
"Pass the `stateMachine` parameter to adopt that behavior now.");
|
|
4240
|
+
}
|
|
4183
4241
|
// Add the first animation
|
|
4184
4242
|
this.add([(instancedName = this.artboard.animationByIndex(0).name)], playing, fireEvent);
|
|
4185
4243
|
}
|
|
@@ -4258,15 +4316,84 @@ var EventType;
|
|
|
4258
4316
|
EventType["Play"] = "play";
|
|
4259
4317
|
EventType["Pause"] = "pause";
|
|
4260
4318
|
EventType["Stop"] = "stop";
|
|
4319
|
+
/**
|
|
4320
|
+
* @deprecated Loop events are deprecated and will be removed in a future
|
|
4321
|
+
* major version: they are only reported for linear animation playback, which
|
|
4322
|
+
* is deprecated. Use a state machine to control playback and data binding to
|
|
4323
|
+
* react to changes instead. See
|
|
4324
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
|
|
4325
|
+
* to migrate.
|
|
4326
|
+
*/
|
|
4261
4327
|
EventType["Loop"] = "loop";
|
|
4262
4328
|
EventType["Draw"] = "draw";
|
|
4263
4329
|
EventType["Advance"] = "advance";
|
|
4330
|
+
/**
|
|
4331
|
+
* @deprecated State change events are deprecated and will be removed in a
|
|
4332
|
+
* future major version. Use data binding (view model property observers) or
|
|
4333
|
+
* state machine actions to react to changes from your graphic instead. See
|
|
4334
|
+
* {@link https://rive.app/docs/editor/state-machine/states#actions} for more details.
|
|
4335
|
+
*/
|
|
4264
4336
|
EventType["StateChange"] = "statechange";
|
|
4337
|
+
/**
|
|
4338
|
+
* @deprecated Rive Events are deprecated and will be removed in a future
|
|
4339
|
+
* major version: please use data binding instead. See
|
|
4340
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
4341
|
+
*/
|
|
4265
4342
|
EventType["RiveEvent"] = "riveevent";
|
|
4266
4343
|
EventType["AudioStatusChange"] = "audiostatuschange";
|
|
4267
4344
|
})(EventType || (EventType = {}));
|
|
4345
|
+
var riveEventsDeprecationWarning = "Rive Events are deprecated and will be removed in a future major version: " +
|
|
4346
|
+
"please use data binding instead. See " +
|
|
4347
|
+
"https://rive.app/docs/runtimes/web/rive-events for how to migrate.";
|
|
4348
|
+
var stateMachineInputsDeprecationWarning = "State machine inputs are deprecated and will be removed in a future major version: " +
|
|
4349
|
+
"please use data binding properties instead. See " +
|
|
4350
|
+
"https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs for how to migrate.";
|
|
4351
|
+
var textRunsDeprecationWarning = "Text run APIs are deprecated and will be removed in a future major version: " +
|
|
4352
|
+
"please use data binding instead. See " +
|
|
4353
|
+
"https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime for how to migrate.";
|
|
4354
|
+
var loopEventsDeprecationWarning = "Loop events are deprecated and will be removed in a future major version: " +
|
|
4355
|
+
"they are only reported for linear animation playback, which is deprecated. " +
|
|
4356
|
+
"Use a state machine to control playback and data binding to react to changes instead. See " +
|
|
4357
|
+
"https://rive.app/docs/editor/data-binding/migration-guide for how to migrate.";
|
|
4358
|
+
var stateChangeEventsDeprecationWarning = "State change events are deprecated and will be removed in a future major version: " +
|
|
4359
|
+
"use data binding (view model property observers) or state machine actions to react to " +
|
|
4360
|
+
"changes from your graphic instead. See " +
|
|
4361
|
+
"https://rive.app/docs/editor/state-machine/states#actions for how to migrate.";
|
|
4362
|
+
// Deprecation warnings already emitted; each is logged at most once per page
|
|
4363
|
+
// session to avoid flooding the console when many instances are created.
|
|
4364
|
+
var emittedWarnings = new Set();
|
|
4365
|
+
var warnOnce = function (message) {
|
|
4366
|
+
if (!emittedWarnings.has(message)) {
|
|
4367
|
+
emittedWarnings.add(message);
|
|
4368
|
+
console.warn("[Rive] ".concat(message));
|
|
4369
|
+
}
|
|
4370
|
+
};
|
|
4371
|
+
/**
|
|
4372
|
+
* Warns that a playback-control method received an array of names; the next
|
|
4373
|
+
* major version restricts these parameters to a single string, since playing
|
|
4374
|
+
* multiple animations or state machines at once will not be supported.
|
|
4375
|
+
*/
|
|
4376
|
+
var warnIfNamesArray = function (names, methodName) {
|
|
4377
|
+
if (Array.isArray(names)) {
|
|
4378
|
+
warnOnce("Passing an array of names to `".concat(methodName, "()` is deprecated: in the next major version this parameter will be a single string, and playing multiple animations or state machines at once will not be supported."));
|
|
4379
|
+
}
|
|
4380
|
+
};
|
|
4381
|
+
/**
|
|
4382
|
+
* Warns that a playback-control method received linear animation names;
|
|
4383
|
+
* name-based control remains supported for state machines only, so
|
|
4384
|
+
* user-specified linear animation names are going away in a future major
|
|
4385
|
+
* version.
|
|
4386
|
+
*/
|
|
4387
|
+
var warnDeprecatedAnimationNames = function (methodName) {
|
|
4388
|
+
warnOnce("Passing linear animation names to `".concat(methodName, "()` is deprecated and will be removed in a future major version: ") +
|
|
4389
|
+
"Pass a single state machine name to control playback instead.");
|
|
4390
|
+
};
|
|
4268
4391
|
/**
|
|
4269
4392
|
* Looping types: one-shot, loop, and ping-pong
|
|
4393
|
+
* @deprecated Loop events are deprecated and will be removed in a future major
|
|
4394
|
+
* version: they are only reported for linear animation playback, which is
|
|
4395
|
+
* deprecated. Use a state machine to control playback and data binding to
|
|
4396
|
+
* react to changes instead.
|
|
4270
4397
|
*/
|
|
4271
4398
|
var LoopType;
|
|
4272
4399
|
(function (LoopType) {
|
|
@@ -4580,6 +4707,31 @@ var observers = new ObjectObservers();
|
|
|
4580
4707
|
// #endregion
|
|
4581
4708
|
// #region Rive
|
|
4582
4709
|
var nextRiveInstanceId = 0;
|
|
4710
|
+
/**
|
|
4711
|
+
* Resolves which animation/state machine names playback should start with.
|
|
4712
|
+
* The `stateMachine` parameter takes priority; the deprecated plural
|
|
4713
|
+
* `animations`/`stateMachines` parameters apply only when it
|
|
4714
|
+
* is not provided.
|
|
4715
|
+
*/
|
|
4716
|
+
var resolveStartingPlayback = function (_a) {
|
|
4717
|
+
var stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines;
|
|
4718
|
+
if (animations !== undefined) {
|
|
4719
|
+
warnOnce("The `animations` parameter is deprecated and will be removed in a future major version: please use the `stateMachine` parameter to play a state machine instead.");
|
|
4720
|
+
}
|
|
4721
|
+
if (stateMachines !== undefined) {
|
|
4722
|
+
warnOnce("The `stateMachines` parameter is deprecated: please use `stateMachine` with a single state machine name instead.");
|
|
4723
|
+
}
|
|
4724
|
+
if (stateMachine) {
|
|
4725
|
+
return {
|
|
4726
|
+
startingAnimationNames: [],
|
|
4727
|
+
startingStateMachineNames: [stateMachine],
|
|
4728
|
+
};
|
|
4729
|
+
}
|
|
4730
|
+
return {
|
|
4731
|
+
startingAnimationNames: mapToStringArray(animations),
|
|
4732
|
+
startingStateMachineNames: mapToStringArray(stateMachines),
|
|
4733
|
+
};
|
|
4734
|
+
};
|
|
4583
4735
|
var RiveFile = /** @class */ (function () {
|
|
4584
4736
|
function RiveFile(params) {
|
|
4585
4737
|
// Allow the runtime to automatically load assets hosted in Rive's runtime.
|
|
@@ -5001,6 +5153,10 @@ var Rive = /** @class */ (function () {
|
|
|
5001
5153
|
this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
|
|
5002
5154
|
this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
|
|
5003
5155
|
this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
|
|
5156
|
+
if (params.automaticallyHandleEvents) {
|
|
5157
|
+
warnOnce("The `automaticallyHandleEvents` parameter is deprecated. " +
|
|
5158
|
+
riveEventsDeprecationWarning);
|
|
5159
|
+
}
|
|
5004
5160
|
this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
|
|
5005
5161
|
this.dispatchPointerExit =
|
|
5006
5162
|
params.dispatchPointerExit === false
|
|
@@ -5065,6 +5221,7 @@ var Rive = /** @class */ (function () {
|
|
|
5065
5221
|
riveFile: this.riveFile,
|
|
5066
5222
|
autoplay: params.autoplay,
|
|
5067
5223
|
autoBind: params.autoBind,
|
|
5224
|
+
stateMachine: params.stateMachine,
|
|
5068
5225
|
animations: params.animations,
|
|
5069
5226
|
stateMachines: params.stateMachines,
|
|
5070
5227
|
artboard: params.artboard,
|
|
@@ -5131,7 +5288,7 @@ var Rive = /** @class */ (function () {
|
|
|
5131
5288
|
// Initializes the Rive object either from constructor or load()
|
|
5132
5289
|
Rive.prototype.init = function (_a) {
|
|
5133
5290
|
var _this = this;
|
|
5134
|
-
var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c, _d = _a.autoBind, autoBind = _d === void 0 ? false : _d, tabIndex = _a.tabIndex, semanticsMode = _a.semanticsMode, semanticsOptions = _a.semanticsOptions;
|
|
5291
|
+
var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c, _d = _a.autoBind, autoBind = _d === void 0 ? false : _d, tabIndex = _a.tabIndex, semanticsMode = _a.semanticsMode, semanticsOptions = _a.semanticsOptions;
|
|
5135
5292
|
if (this.destroyed) {
|
|
5136
5293
|
return;
|
|
5137
5294
|
}
|
|
@@ -5145,10 +5302,12 @@ var Rive = /** @class */ (function () {
|
|
|
5145
5302
|
if (!this.src && !this.buffer && !this.riveFile) {
|
|
5146
5303
|
throw new RiveError(Rive.missingErrorMessage);
|
|
5147
5304
|
}
|
|
5148
|
-
//
|
|
5149
|
-
var
|
|
5150
|
-
|
|
5151
|
-
|
|
5305
|
+
// Names of the animations and state machines that should be initialized
|
|
5306
|
+
var _e = resolveStartingPlayback({
|
|
5307
|
+
stateMachine: stateMachine,
|
|
5308
|
+
animations: animations,
|
|
5309
|
+
stateMachines: stateMachines,
|
|
5310
|
+
}), startingAnimationNames = _e.startingAnimationNames, startingStateMachineNames = _e.startingStateMachineNames;
|
|
5152
5311
|
// Ensure loaded is marked as false if loading new file
|
|
5153
5312
|
this.loaded = false;
|
|
5154
5313
|
this.readyForPlaying = false;
|
|
@@ -5504,8 +5663,9 @@ var Rive = /** @class */ (function () {
|
|
|
5504
5663
|
// Rive has an active focus node. Mark the session RiveFocused so Tab stays
|
|
5505
5664
|
// trapped and a later internal release (hasFocus true → false) is detected.
|
|
5506
5665
|
this._keyboardInteractions.notifyRiveFocused();
|
|
5507
|
-
// Only steal DOM focus on the false→true transition.
|
|
5508
|
-
//
|
|
5666
|
+
// Only steal DOM focus on the false→true transition. Rive can hold focus across
|
|
5667
|
+
// frames while DOM focus sits elsewhere — a window switch preserves runtime focus
|
|
5668
|
+
// by design — and that must not re-focus the canvas again.
|
|
5509
5669
|
if (!this._prevHasFocus) {
|
|
5510
5670
|
// Steal DOM focus to the canvas only when focus isn't already held
|
|
5511
5671
|
// somewhere inside this instance's focus scope. When the accessibility
|
|
@@ -5526,8 +5686,9 @@ var Rive = /** @class */ (function () {
|
|
|
5526
5686
|
this._prevHasFocus = false;
|
|
5527
5687
|
// hasFocus is false — only act when Rive previously held focus and released it internally
|
|
5528
5688
|
// (state change clears focus). Release the DOM Tab trap so the next Tab moves to the next
|
|
5529
|
-
// page element.
|
|
5530
|
-
//
|
|
5689
|
+
// page element. A DOM blur reaches here too now that onCanvasBlur clears Rive focus, but it
|
|
5690
|
+
// has already set NotFocused, so this is a no-op. EntryPending and NotFocused are likewise
|
|
5691
|
+
// intentional no-ops — EntryPending must stay put (a click awaiting its first Tab).
|
|
5531
5692
|
if (this._keyboardInteractions.focusSessionState === _utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.RiveFocused) {
|
|
5532
5693
|
this._keyboardInteractions.setFocusSessionState(_utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.NotFocused);
|
|
5533
5694
|
}
|
|
@@ -5863,6 +6024,7 @@ var Rive = /** @class */ (function () {
|
|
|
5863
6024
|
* might happen.
|
|
5864
6025
|
*/
|
|
5865
6026
|
Rive.prototype.cleanupInstances = function () {
|
|
6027
|
+
var _a;
|
|
5866
6028
|
if (this.eventCleanup !== null) {
|
|
5867
6029
|
this.eventCleanup();
|
|
5868
6030
|
}
|
|
@@ -5870,8 +6032,9 @@ var Rive = /** @class */ (function () {
|
|
|
5870
6032
|
// Tear down semantics before deleting state machines — the overlay's action
|
|
5871
6033
|
// closures point at instances that stop() is about to free.
|
|
5872
6034
|
this.cleanupSemantics();
|
|
5873
|
-
// Delete all animation and state machine instances
|
|
5874
|
-
|
|
6035
|
+
// Delete all animation and state machine instances synchronously via the
|
|
6036
|
+
// animator
|
|
6037
|
+
(_a = this.animator) === null || _a === void 0 ? void 0 : _a.stop();
|
|
5875
6038
|
if (this.artboard) {
|
|
5876
6039
|
this.artboard.delete();
|
|
5877
6040
|
this.artboard = null;
|
|
@@ -5904,29 +6067,58 @@ var Rive = /** @class */ (function () {
|
|
|
5904
6067
|
* Returns a string from a given text run node name, or undefined if the text run
|
|
5905
6068
|
* cannot be queried.
|
|
5906
6069
|
*
|
|
6070
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6071
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6072
|
+
* for how to migrate.
|
|
5907
6073
|
* @param textRunName - Name of the text run node associated with a text object
|
|
5908
6074
|
* @returns - String value of the text run node or undefined
|
|
5909
6075
|
*/
|
|
5910
6076
|
Rive.prototype.getTextRunValue = function (textRunName) {
|
|
6077
|
+
warnOnce(textRunsDeprecationWarning);
|
|
5911
6078
|
var textRun = this.retrieveTextRun(textRunName);
|
|
5912
6079
|
return textRun ? textRun.text : undefined;
|
|
5913
6080
|
};
|
|
5914
6081
|
/**
|
|
5915
6082
|
* Sets a text value for a given text run node name if possible
|
|
5916
6083
|
*
|
|
6084
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6085
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6086
|
+
* for how to migrate.
|
|
5917
6087
|
* @param textRunName - Name of the text run node associated with a text object
|
|
5918
6088
|
* @param textRunValue - String value to set on the text run node
|
|
5919
6089
|
*/
|
|
5920
6090
|
Rive.prototype.setTextRunValue = function (textRunName, textRunValue) {
|
|
6091
|
+
warnOnce(textRunsDeprecationWarning);
|
|
5921
6092
|
var textRun = this.retrieveTextRun(textRunName);
|
|
5922
6093
|
if (textRun) {
|
|
5923
6094
|
textRun.text = textRunValue;
|
|
5924
6095
|
}
|
|
5925
6096
|
};
|
|
5926
|
-
|
|
6097
|
+
/**
|
|
6098
|
+
* Warns when playback-control names match linear animations in the
|
|
6099
|
+
* Animator's instanced context; state machine playback remain supported.
|
|
6100
|
+
*
|
|
6101
|
+
* Remove for v3 release
|
|
6102
|
+
*/
|
|
6103
|
+
Rive.prototype.warnIfLinearAnimationNames = function (names, methodName) {
|
|
6104
|
+
if (this.animator &&
|
|
6105
|
+
this.animator.animations.some(function (a) { return names.includes(a.name); })) {
|
|
6106
|
+
warnDeprecatedAnimationNames(methodName);
|
|
6107
|
+
}
|
|
6108
|
+
};
|
|
6109
|
+
/**
|
|
6110
|
+
* Plays specified animations or state machines; if none specified, it
|
|
6111
|
+
* unpauses everything.
|
|
6112
|
+
* @param animationNames Animation or state machine name(s) to play.
|
|
6113
|
+
*
|
|
6114
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
6115
|
+
* state machine instead) and passing an array of names (this parameter
|
|
6116
|
+
* becomes a single string in the next major version).
|
|
6117
|
+
*/
|
|
5927
6118
|
Rive.prototype.play = function (animationNames, autoplay) {
|
|
5928
6119
|
var _this = this;
|
|
5929
|
-
animationNames
|
|
6120
|
+
warnIfNamesArray(animationNames, "play");
|
|
6121
|
+
var names = mapToStringArray(animationNames);
|
|
5930
6122
|
// If the file's not loaded, queue up the play
|
|
5931
6123
|
if (!this.readyForPlaying) {
|
|
5932
6124
|
this.taskQueue.add({
|
|
@@ -5934,7 +6126,8 @@ var Rive = /** @class */ (function () {
|
|
|
5934
6126
|
});
|
|
5935
6127
|
return;
|
|
5936
6128
|
}
|
|
5937
|
-
this.animator.play(
|
|
6129
|
+
this.animator.play(names);
|
|
6130
|
+
this.warnIfLinearAnimationNames(names, "play");
|
|
5938
6131
|
this.syncSemanticsOnStateMachines();
|
|
5939
6132
|
if (this.eventCleanup) {
|
|
5940
6133
|
this.eventCleanup();
|
|
@@ -5943,10 +6136,19 @@ var Rive = /** @class */ (function () {
|
|
|
5943
6136
|
this.setupRiveListeners();
|
|
5944
6137
|
this.startRendering();
|
|
5945
6138
|
};
|
|
5946
|
-
|
|
6139
|
+
/**
|
|
6140
|
+
* Pauses specified animations or state machines; if none specified, pauses
|
|
6141
|
+
* all.
|
|
6142
|
+
* @param animationNames Animation or state machine name(s) to pause.
|
|
6143
|
+
*
|
|
6144
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
6145
|
+
* state machine instead) and passing an array of names (this parameter
|
|
6146
|
+
* becomes a single string in the next major version).
|
|
6147
|
+
*/
|
|
5947
6148
|
Rive.prototype.pause = function (animationNames) {
|
|
5948
6149
|
var _this = this;
|
|
5949
|
-
animationNames
|
|
6150
|
+
warnIfNamesArray(animationNames, "pause");
|
|
6151
|
+
var names = mapToStringArray(animationNames);
|
|
5950
6152
|
// If the file's not loaded, early out, nothing to pause
|
|
5951
6153
|
if (!this.readyForPlaying) {
|
|
5952
6154
|
this.taskQueue.add({
|
|
@@ -5958,11 +6160,20 @@ var Rive = /** @class */ (function () {
|
|
|
5958
6160
|
this.eventCleanup();
|
|
5959
6161
|
}
|
|
5960
6162
|
this.cleanupKeyboardInteractions();
|
|
5961
|
-
this.animator.pause(
|
|
6163
|
+
this.animator.pause(names);
|
|
6164
|
+
this.warnIfLinearAnimationNames(names, "pause");
|
|
5962
6165
|
};
|
|
6166
|
+
/**
|
|
6167
|
+
* Scrubs specified animations to the given time; if none specified, scrubs
|
|
6168
|
+
* all of them.
|
|
6169
|
+
* @deprecated `scrub()` will be removed in a future major version: use a
|
|
6170
|
+
* state machine to control playback instead
|
|
6171
|
+
*/
|
|
5963
6172
|
Rive.prototype.scrub = function (animationNames, value) {
|
|
5964
6173
|
var _this = this;
|
|
5965
|
-
|
|
6174
|
+
warnOnce("`scrub()` is deprecated and will be removed in a future major version: " +
|
|
6175
|
+
"use a state machine to control playback instead.");
|
|
6176
|
+
var names = mapToStringArray(animationNames);
|
|
5966
6177
|
// If the file's not loaded, early out, nothing to pause
|
|
5967
6178
|
if (!this.readyForPlaying) {
|
|
5968
6179
|
this.taskQueue.add({
|
|
@@ -5972,13 +6183,22 @@ var Rive = /** @class */ (function () {
|
|
|
5972
6183
|
}
|
|
5973
6184
|
// Scrub the animation time; we draw a single frame here so that if
|
|
5974
6185
|
// nothing's currently playing, the scrubbed animation is still rendered/
|
|
5975
|
-
this.animator.scrub(
|
|
6186
|
+
this.animator.scrub(names, value || 0);
|
|
5976
6187
|
this.drawFrame();
|
|
5977
6188
|
};
|
|
5978
|
-
|
|
6189
|
+
/**
|
|
6190
|
+
* Stops specified animations or state machines; if none specified, stops
|
|
6191
|
+
* them all.
|
|
6192
|
+
* @param animationNames Animation or state machine name(s) to stop.
|
|
6193
|
+
*
|
|
6194
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
6195
|
+
* state machine instead) and passing an array of names (this parameter
|
|
6196
|
+
* becomes a single string in the next major version).
|
|
6197
|
+
*/
|
|
5979
6198
|
Rive.prototype.stop = function (animationNames) {
|
|
5980
6199
|
var _this = this;
|
|
5981
|
-
animationNames
|
|
6200
|
+
warnIfNamesArray(animationNames, "stop");
|
|
6201
|
+
var names = mapToStringArray(animationNames);
|
|
5982
6202
|
// If the file's not loaded, early out, nothing to pause
|
|
5983
6203
|
if (!this.readyForPlaying) {
|
|
5984
6204
|
this.taskQueue.add({
|
|
@@ -5986,9 +6206,10 @@ var Rive = /** @class */ (function () {
|
|
|
5986
6206
|
});
|
|
5987
6207
|
return;
|
|
5988
6208
|
}
|
|
6209
|
+
this.warnIfLinearAnimationNames(names, "stop");
|
|
5989
6210
|
// If there is no artboard, this.animator will be undefined
|
|
5990
6211
|
if (this.animator) {
|
|
5991
|
-
this.animator.stop(
|
|
6212
|
+
this.animator.stop(names);
|
|
5992
6213
|
}
|
|
5993
6214
|
if (this.eventCleanup) {
|
|
5994
6215
|
this.eventCleanup();
|
|
@@ -5999,8 +6220,7 @@ var Rive = /** @class */ (function () {
|
|
|
5999
6220
|
/**
|
|
6000
6221
|
* Resets the animation
|
|
6001
6222
|
* @param artboard the name of the artboard, or default if none given
|
|
6002
|
-
* @param
|
|
6003
|
-
* @param stateMachines the names of state machines for playback
|
|
6223
|
+
* @param stateMachine the name of the state machine for playback
|
|
6004
6224
|
* @param autoplay whether to autoplay when reset, defaults to false
|
|
6005
6225
|
*
|
|
6006
6226
|
*/
|
|
@@ -6008,15 +6228,22 @@ var Rive = /** @class */ (function () {
|
|
|
6008
6228
|
var _a, _b;
|
|
6009
6229
|
// Get the current artboard, animations, state machines, and playback states
|
|
6010
6230
|
var artBoardName = params === null || params === void 0 ? void 0 : params.artboard;
|
|
6011
|
-
var
|
|
6012
|
-
|
|
6231
|
+
var _c = resolveStartingPlayback({
|
|
6232
|
+
stateMachine: params === null || params === void 0 ? void 0 : params.stateMachine,
|
|
6233
|
+
animations: params === null || params === void 0 ? void 0 : params.animations,
|
|
6234
|
+
stateMachines: params === null || params === void 0 ? void 0 : params.stateMachines,
|
|
6235
|
+
}), animationNames = _c.startingAnimationNames, stateMachineNames = _c.startingStateMachineNames;
|
|
6013
6236
|
var autoplay = (_a = params === null || params === void 0 ? void 0 : params.autoplay) !== null && _a !== void 0 ? _a : false;
|
|
6014
6237
|
var autoBind = (_b = params === null || params === void 0 ? void 0 : params.autoBind) !== null && _b !== void 0 ? _b : false;
|
|
6015
6238
|
// Stop everything and clean up
|
|
6016
6239
|
this.cleanupInstances();
|
|
6017
6240
|
// Reinitialize an artboard instance with the state
|
|
6018
6241
|
this.initArtboard(artBoardName, animationNames, stateMachineNames, autoplay, autoBind);
|
|
6019
|
-
|
|
6242
|
+
// Only drain the task queue once playback commands can execute; tasks
|
|
6243
|
+
// queued before then re-add themselves in a loop.
|
|
6244
|
+
if (this.readyForPlaying) {
|
|
6245
|
+
this.taskQueue.process();
|
|
6246
|
+
}
|
|
6020
6247
|
};
|
|
6021
6248
|
// Loads a new Rive file, keeping listeners in place
|
|
6022
6249
|
Rive.prototype.load = function (params) {
|
|
@@ -6171,11 +6398,18 @@ var Rive = /** @class */ (function () {
|
|
|
6171
6398
|
});
|
|
6172
6399
|
/**
|
|
6173
6400
|
* Returns the inputs for the specified instanced state machine, or an empty
|
|
6174
|
-
* list if the name is invalid or the state machine is not instanced
|
|
6401
|
+
* list if the name is invalid or the state machine is not instanced. Returns
|
|
6402
|
+
* undefined if the file is not loaded yet.
|
|
6403
|
+
*
|
|
6404
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6405
|
+
* properties instead. See
|
|
6406
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6407
|
+
* for how to migrate.
|
|
6175
6408
|
* @param name the state machine name
|
|
6176
|
-
* @returns the inputs for the named state machine
|
|
6409
|
+
* @returns the inputs for the named state machine or undefined
|
|
6177
6410
|
*/
|
|
6178
6411
|
Rive.prototype.stateMachineInputs = function (name) {
|
|
6412
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6179
6413
|
// If the file's not loaded, early out, nothing to pause
|
|
6180
6414
|
if (!this.loaded) {
|
|
6181
6415
|
return;
|
|
@@ -6202,11 +6436,16 @@ var Rive = /** @class */ (function () {
|
|
|
6202
6436
|
};
|
|
6203
6437
|
/**
|
|
6204
6438
|
* Set the boolean input with the provided name at the given path with value
|
|
6439
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6440
|
+
* properties instead. See
|
|
6441
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6442
|
+
* for how to migrate.
|
|
6205
6443
|
* @param input the state machine input name
|
|
6206
6444
|
* @param value the value to set the input to
|
|
6207
6445
|
* @param path the path the input is located at an artboard level
|
|
6208
6446
|
*/
|
|
6209
6447
|
Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {
|
|
6448
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6210
6449
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
6211
6450
|
if (!input)
|
|
6212
6451
|
return;
|
|
@@ -6219,11 +6458,16 @@ var Rive = /** @class */ (function () {
|
|
|
6219
6458
|
};
|
|
6220
6459
|
/**
|
|
6221
6460
|
* Set the number input with the provided name at the given path with value
|
|
6461
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6462
|
+
* properties instead. See
|
|
6463
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6464
|
+
* for how to migrate.
|
|
6222
6465
|
* @param input the state machine input name
|
|
6223
6466
|
* @param value the value to set the input to
|
|
6224
6467
|
* @param path the path the input is located at an artboard level
|
|
6225
6468
|
*/
|
|
6226
6469
|
Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {
|
|
6470
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6227
6471
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
6228
6472
|
if (!input)
|
|
6229
6473
|
return;
|
|
@@ -6236,10 +6480,15 @@ var Rive = /** @class */ (function () {
|
|
|
6236
6480
|
};
|
|
6237
6481
|
/**
|
|
6238
6482
|
* Fire the trigger with the provided name at the given path
|
|
6483
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6484
|
+
* properties instead. See
|
|
6485
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6486
|
+
* for how to migrate.
|
|
6239
6487
|
* @param input the state machine input name
|
|
6240
6488
|
* @param path the path the input is located at an artboard level
|
|
6241
6489
|
*/
|
|
6242
6490
|
Rive.prototype.fireStateAtPath = function (inputName, path) {
|
|
6491
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6243
6492
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
6244
6493
|
if (!input)
|
|
6245
6494
|
return;
|
|
@@ -6287,8 +6536,13 @@ var Rive = /** @class */ (function () {
|
|
|
6287
6536
|
*
|
|
6288
6537
|
* @remarks
|
|
6289
6538
|
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
6539
|
+
*
|
|
6540
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6541
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6542
|
+
* for how to migrate.
|
|
6290
6543
|
*/
|
|
6291
6544
|
Rive.prototype.getTextRunValueAtPath = function (textName, path) {
|
|
6545
|
+
warnOnce(textRunsDeprecationWarning);
|
|
6292
6546
|
var run = this.retrieveTextAtPath(textName, path);
|
|
6293
6547
|
if (!run) {
|
|
6294
6548
|
console.warn("Could not get text with name: '".concat(textName, "', at path:'").concat(path, "'"));
|
|
@@ -6313,8 +6567,13 @@ var Rive = /** @class */ (function () {
|
|
|
6313
6567
|
*
|
|
6314
6568
|
* @remarks
|
|
6315
6569
|
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
6570
|
+
*
|
|
6571
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6572
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6573
|
+
* for how to migrate.
|
|
6316
6574
|
*/
|
|
6317
6575
|
Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
|
|
6576
|
+
warnOnce(textRunsDeprecationWarning);
|
|
6318
6577
|
var run = this.retrieveTextAtPath(textName, path);
|
|
6319
6578
|
if (!run) {
|
|
6320
6579
|
console.warn("Could not set text with name: '".concat(textName, "', at path:'").concat(path, "'"));
|
|
@@ -6423,10 +6682,26 @@ var Rive = /** @class */ (function () {
|
|
|
6423
6682
|
});
|
|
6424
6683
|
/**
|
|
6425
6684
|
* Subscribe to Rive-generated events
|
|
6685
|
+
*
|
|
6686
|
+
* Note: subscribing to {@link EventType.RiveEvent},
|
|
6687
|
+
* {@link EventType.StateChange}, or {@link EventType.Loop} is deprecated;
|
|
6688
|
+
* use data binding instead. See
|
|
6689
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} (Rive Events) and
|
|
6690
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
|
|
6691
|
+
* to migrate Rive graphics to a data binding workflow instead.
|
|
6426
6692
|
* @param type the type of event to subscribe to
|
|
6427
6693
|
* @param callback callback to fire when the event occurs
|
|
6428
6694
|
*/
|
|
6429
6695
|
Rive.prototype.on = function (type, callback) {
|
|
6696
|
+
if (type === EventType.RiveEvent) {
|
|
6697
|
+
warnOnce(riveEventsDeprecationWarning);
|
|
6698
|
+
}
|
|
6699
|
+
else if (type === EventType.StateChange) {
|
|
6700
|
+
warnOnce(stateChangeEventsDeprecationWarning);
|
|
6701
|
+
}
|
|
6702
|
+
else if (type === EventType.Loop) {
|
|
6703
|
+
warnOnce(loopEventsDeprecationWarning);
|
|
6704
|
+
}
|
|
6430
6705
|
this.eventManager.add({
|
|
6431
6706
|
type: type,
|
|
6432
6707
|
callback: callback,
|