@rive-app/webgl2 2.40.1 → 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 +274 -38
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
package/rive.js
CHANGED
|
@@ -431,14 +431,14 @@ c.ec.count.value+=1;c.ec.Xc=!1;return c},["delete"](){this.ec.lc||dc(this);if(th
|
|
|
431
431
|
const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
|
|
432
432
|
Object.assign(tc.prototype,{ye(a){this.Zd&&(a=this.Zd(a));return a},Md(a){this.Ec?.(a)},wc:Yb,kc:function(a){function b(){return this.kd?sc(this.fc.Bc,{nc:this.Me,lc:c,yc:this,sc:a}):sc(this.fc.Bc,{nc:this,lc:a})}var c=this.ye(a);if(!c)return this.Md(a),null;var d=rc(this.fc,c);if(void 0!==d){if(0===d.ec.count.value)return d.ec.lc=c,d.ec.sc=a,d.clone();d=d.clone();this.Md(a);return d}d=this.fc.xe(c);d=gc[d];if(!d)return b.call(this);d=this.jd?d.oe:d.pointerType;var e=qc(c,this.fc,d.fc);return null===
|
|
433
433
|
e?b.call(this):this.kd?sc(d.fc.Bc,{nc:d,lc:e,yc:this,sc:a}):sc(d.fc.Bc,{nc:d,lc:e})}});for(let a=0;32>a;++a)od.push(Array(a));l.print&&(oa=l.print);l.printErr&&(y=l.printErr);l.wasmBinary&&(pa=l.wasmBinary);l.thisProgram&&(ja=l.thisProgram);if(l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.shift()();
|
|
434
|
-
var yd={
|
|
434
|
+
var yd={325398:(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=
|
|
435
435
|
[];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",
|
|
436
|
-
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.zc&&h.state===f.device_state.started&&h.zc.resume().then(()=>{vd(h.Wd)},k=>{console.error("Failed to resume audiocontext",k)})}f.unlock_event_types.map(function(k){document.removeEventListener(k,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},
|
|
437
|
-
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},
|
|
436
|
+
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.zc&&h.state===f.device_state.started&&h.zc.resume().then(()=>{vd(h.Wd)},k=>{console.error("Failed to resume audiocontext",k)})}f.unlock_event_types.map(function(k){document.removeEventListener(k,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},327576:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
|
|
437
|
+
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},327880:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,327984:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},328155:(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.zc=
|
|
438
438
|
new (window.AudioContext||window.webkitAudioContext)(h);g.zc.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.Oc=g.zc.createScriptProcessor(d,c,b);g.Oc.onaudioprocess=function(k){if(null==g.hd||0==g.hd.length)g.hd=new Float32Array(ua.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var m=0;m<b;m+=1)for(var q=k.inputBuffer.getChannelData(m),v=g.hd,t=0;t<d;t+=1)v[t*b+m]=q[t];wd(f,d,e)}if(a==
|
|
439
439
|
window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(xd(f,d,e),m=0;m<k.outputBuffer.numberOfChannels;++m)for(q=k.outputBuffer.getChannelData(m),v=g.hd,t=0;t<d;t+=1)q[t]=v[t*b+m];else for(m=0;m<k.outputBuffer.numberOfChannels;++m)k.outputBuffer.getChannelData(m).fill(0)};a!=window.miniaudio.device_type.capture&&a!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(k){g.sd=g.zc.createMediaStreamSource(k);g.sd.connect(g.Oc);
|
|
440
|
-
g.Oc.connect(g.zc.destination)}).catch(function(k){console.log("Failed to get user media: "+k)});a==window.miniaudio.device_type.playback&&g.Oc.connect(g.zc.destination);g.Wd=f;return window.miniaudio.track_device(g)},
|
|
441
|
-
{window.miniaudio.untrack_device_by_index(a)},
|
|
440
|
+
g.Oc.connect(g.zc.destination)}).catch(function(k){console.log("Failed to get user media: "+k)});a==window.miniaudio.device_type.playback&&g.Oc.connect(g.zc.destination);g.Wd=f;return window.miniaudio.track_device(g)},331032:a=>window.miniaudio.get_device_by_index(a).zc.sampleRate,331105:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.Oc&&(a.Oc.onaudioprocess=function(){},a.Oc.disconnect(),a.Oc=void 0);void 0!==a.sd&&(a.sd.disconnect(),a.sd=void 0);a.zc.close();a.zc=void 0;a.Wd=void 0},331505:a=>
|
|
441
|
+
{window.miniaudio.untrack_device_by_index(a)},331555:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.resume();a.state=window.miniaudio.device_state.started},331694:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.suspend();a.state=window.miniaudio.device_state.stopped}},Qb,rd,Pb,vd,wd,xd,zd,Ad,Bd,Aa,vc,Dd={pa:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 0:var e=K();if(0>e)break;for(;kb[e];)e++;return xb(d,e).Mc;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=K(),d.flags|=
|
|
442
442
|
e,0;case 12:return e=K(),D[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return-f.Lc}},vb:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 21509:return d.mc?0:-59;case 21505:if(!d.mc)return-59;if(d.mc.Kc.Fe){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=K();G[e>>2]=25856;G[e+4>>2]=5;G[e+8>>2]=191;G[e+12>>2]=35387;for(var f=0;32>f;f++)A[e+f+17]=a[f]||0}return 0;case 21510:case 21511:case 21512:return d.mc?
|
|
443
443
|
0:-59;case 21506:case 21507:case 21508:if(!d.mc)return-59;if(d.mc.Kc.Ge)for(e=K(),a=[],f=0;32>f;f++)a.push(A[e+f+17]);return 0;case 21519:if(!d.mc)return-59;e=K();return G[e>>2]=0;case 21520:return d.mc?-28:-59;case 21537:case 21531:e=K();if(!d.hc.Ee)throw new M(59);return d.hc.Ee(d,b,e);case 21523:if(!d.mc)return-59;d.mc.Kc.He&&(f=[24,80],e=K(),D[e>>1]=f[0],D[e+2>>1]=f[1]);return 0;case 21524:return d.mc?0:-59;case 21515:return d.mc?0:-59;default:return-28}}catch(g){if("undefined"==typeof Gb||"ErrnoError"!==
|
|
444
444
|
g.name)throw g;return-g.Lc}},wb:function(a,b,c,d){Ka=d;try{b=b?L(B,b):"";var e=b;if("/"===e.charAt(0))b=e;else{var f=-100===a?"/":vb(a).path;if(0==e.length)throw new M(44);b=f+"/"+e}var g=d?K():0;return Db(b,c,g).Mc}catch(h){if("undefined"==typeof Gb||"ErrnoError"!==h.name)throw h;return-h.Lc}},zb:()=>Ba(""),la:(a,b,c)=>{a=R(a);b=Sb(b,"wrapper");c=Q(c);var d=b.fc,e=d.Bc,f=d.rc.Bc,g=d.rc.constructor;a=Hb(a,function(...h){for(var k of d.rc.Xd)if(this[k]===f[k])throw new Lb(`Pure virtual function ${k} must be implemented in JavaScript`);
|
|
@@ -456,18 +456,18 @@ b,r);return[]});return[]})},$a:a=>S(a,Dc),ma:(a,b,c,d,e)=>{b=R(b);e=0===e?"objec
|
|
|
456
456
|
oc:function(h,k){return this.fe[k]},wc:Ec(b,c,d),vc:null}),ic(b,f),delete l[b].Ic}},k:(a,b,c)=>{var d=Sb(a,"enum");b=R(b);switch(d.valueType){case "object":a=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},constructor:{value:Hb(`${d.name}_${b}`,function(){})}});a.values[c]=d;a[b]=d;break;case "number":d.Ed[b]=c;break;case "string":d.fe[b]=c,d.ae[c]=b,d.Ed[b]=b}},ha:(a,b,c)=>{b=R(b);S(a,{name:b,kc:d=>d,oc:(d,e)=>e,wc:Fc(b,c),vc:null})},j:(a,b,c,d,e,f)=>{var g=zc(b,c);a=R(a);
|
|
457
457
|
a=Ac(a);e=V(d,e);ic(a,function(){W(`Cannot call ${a} due to unbound types`,g)},b-1);T([],g,h=>{uc(a,yc(a,[h[0],null].concat(h.slice(1)),null,e,f),b-1);return[]})},v:(a,b,c,d,e)=>{b=R(b);let f=h=>h;if(0===d){var g=32-8*c;f=h=>h<<g>>>g;e=f(e)}S(a,{name:b,kc:f,oc:(h,k)=>k,wc:cc(b,c,0!==d),vc:null})},h:(a,b,c)=>{function d(f){return new e(A.buffer,J[f+4>>2],J[f>>2])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];c=R(c);
|
|
458
458
|
S(a,{name:c,kc:d,wc:d},{Ce:!0})},ab:(a,b)=>{b=R(b);S(a,{name:b,kc(c){var d=(d=c+4)?L(B,d,J[c>>2],!0):"";Qb(c);return d},oc(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?Ua(d):d.length;var g=rd(4+f+1),h=g+4;J[g>>2]=f;e?Va(d,B,h,f+1):B.set(d,h);null!==c&&c.push(Qb,g);return g},wc:Yb,vc(c){Qb(c)}})},S:(a,b,c)=>{c=R(c);if(2===b){var d=Hc;var e=Ic;var f=Jc}else d=
|
|
459
|
-
Kc,e=Lc,f=Mc;S(a,{name:c,kc:g=>{var h=d(g+4,J[g>>2]*b,!0);Qb(g);return h},oc:(g,h)=>{if("string"!=typeof h)throw new P(`Cannot pass non-string to C++ string type ${c}`);var k=f(h),m=rd(4+k+b);J[m>>2]=k/b;e(h,m+4,k+b);null!==g&&g.push(Qb,m);return m},wc:Yb,vc(g){Qb(g)}})},lb:(a,b,c,d,e,f)=>{Wb[a]={name:R(b),Gd:V(c,d),Ec:V(e,f),Od:[]}},kb:(a,b,c,d,e,f,g,h,k,m)=>{Wb[a].Od.push({ve:R(b),Be:c,ze:V(d,e),Ae:f,Pe:g,Oe:V(h,k),Qe:m})},db:(a,b)=>{b=R(b);S(a,{Ie:!0,name:b,kc:()=>{},oc:()=>{}})},
|
|
459
|
+
Kc,e=Lc,f=Mc;S(a,{name:c,kc:g=>{var h=d(g+4,J[g>>2]*b,!0);Qb(g);return h},oc:(g,h)=>{if("string"!=typeof h)throw new P(`Cannot pass non-string to C++ string type ${c}`);var k=f(h),m=rd(4+k+b);J[m>>2]=k/b;e(h,m+4,k+b);null!==g&&g.push(Qb,m);return m},wc:Yb,vc(g){Qb(g)}})},lb:(a,b,c,d,e,f)=>{Wb[a]={name:R(b),Gd:V(c,d),Ec:V(e,f),Od:[]}},kb:(a,b,c,d,e,f,g,h,k,m)=>{Wb[a].Od.push({ve:R(b),Be:c,ze:V(d,e),Ae:f,Pe:g,Oe:V(h,k),Qe:m})},db:(a,b)=>{b=R(b);S(a,{Ie:!0,name:b,kc:()=>{},oc:()=>{}})},mb:()=>{throw Infinity;
|
|
460
460
|
},m:(a,b,c)=>{var [d,...e]=Pc(a,b),f=d.oc.bind(d),g=e.map(k=>k.wc.bind(k));a--;var h=Array(a);b=`methodCaller<(${e.map(k=>k.name)}) => ${d.name}>`;return Oc(Hb(b,(k,m,q,v)=>{for(var t=0,C=0;C<a;++C)h[C]=g[C](v+t),t+=8;switch(c){case 0:var p=Q(k).apply(null,h);break;case 2:p=Reflect.construct(Q(k),h);break;case 3:p=h[0];break;case 1:p=Q(k)[Rc(m)](...h)}k=[];p=f(k,p);k.length&&(J[q>>2]=Kb(k));return p}))},jb:Cc,bb:(a,b)=>{a=Q(a);b=Q(b);return Kb(a[b])},ga:a=>{9<a&&(Jb[a+1]+=1)},l:(a,b,c,d,e)=>Nc[a](b,
|
|
461
|
-
c,d,e),gb:()=>Kb([]),ib:a=>Kb(Rc(a)),Ob:()=>Kb({}),Fa:a=>{var b=Q(a);Xb(b);Cc(a)},q:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},
|
|
461
|
+
c,d,e),gb:()=>Kb([]),ib:a=>Kb(Rc(a)),Ob:()=>Kb({}),Fa:a=>{var b=Q(a);Xb(b);Cc(a)},q:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},ob:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);G[b>>2]=a.getUTCSeconds();G[b+4>>2]=a.getUTCMinutes();G[b+8>>2]=a.getUTCHours();G[b+12>>2]=a.getUTCDate();G[b+16>>2]=a.getUTCMonth();G[b+20>>2]=a.getUTCFullYear()-1900;G[b+24>>2]=a.getUTCDay();G[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},pb:function(a,b){a=
|
|
462
462
|
-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);G[b>>2]=a.getSeconds();G[b+4>>2]=a.getMinutes();G[b+8>>2]=a.getHours();G[b+12>>2]=a.getDate();G[b+16>>2]=a.getMonth();G[b+20>>2]=a.getFullYear()-1900;G[b+24>>2]=a.getDay();var c=a.getFullYear();G[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?Tc:Sc)[a.getMonth()]+a.getDate()-1|0;G[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();G[b+32>>
|
|
463
|
-
2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},
|
|
463
|
+
2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},qb:(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);G[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(Va(a,B,c,17),Va(b,B,d,17)):(Va(a,B,d,17),Va(b,B,c,17))},Ia:function(a,b,c){(a=u[a].tc.qd)&&a.beginPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,
|
|
464
464
|
4*c,b))},yb:function(a,b,c){if(!(0<=a&&3>=a))return 28;wa[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},fb:function(a,b,c){var d=l.images;d||(d=new Map,l.images=d);var e=new Image;d.set(a,e);b=l.HEAP8.subarray(b,b+c);c=new Uint8Array(c);c.set(b);e.src=URL.createObjectURL(new Blob([c],{type:"image/png"}));e.onload=function(){l._setWebImage(a,e.width,e.height)}},eb:function(a){var b=l.images;b&&b.get(a)&&b.delete(a)},s:(a,b,c)=>{Uc.length=0;for(var d;d=B[b++];){var e=
|
|
465
|
-
105!=d;e&=112!=d;c+=e&&c%8?4:0;Uc.push(112==d?J[c>>2]:106==d?wa[c>>3]:105==d?G[c>>2]:va[c>>3]);c+=e?8:4}return yd[a](...Uc)},xb:()=>Date.now(),Xa:()=>performance.now(),
|
|
465
|
+
105!=d;e&=112!=d;c+=e&&c%8?4:0;Uc.push(112==d?J[c>>2]:106==d?wa[c>>3]:105==d?G[c>>2]:va[c>>3]);c+=e?8:4}return yd[a](...Uc)},xb:()=>Date.now(),Xa:()=>performance.now(),nb:a=>{var b=B.length;a>>>=0;if(2147483648<a)return!1;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))-Aa.buffer.byteLength+65535)/65536|0;try{Aa.grow(d);za();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},t:(a,b)=>{a=u[a];b=b?L(B,b):"";b.startsWith("GL_")&&
|
|
466
466
|
(b=b.slice(3));"WEBGL_draw_instanced_base_vertex_base_instance"==b&&Vc(X);"WEBGL_multi_draw_instanced_base_vertex_base_instance"==b&&Wc(X);"WEBGL_multi_draw"==b&&(X.Ke=X.getExtension("WEBGL_multi_draw"));"EXT_polygon_offset_clamp"==b&&(X.ue=X.getExtension("EXT_polygon_offset_clamp"));"EXT_clip_control"==b&&(X.te=X.getExtension("EXT_clip_control"));"WEBGL_polygon_mode"==b&&(X.Te=X.getExtension("WEBGL_polygon_mode"));return!!a.tc.getExtension(b)},f:()=>n?n.handle:0,ja:a=>ha(a)?0:-5,Ga:function(a){a=
|
|
467
|
-
u[a].tc;a.Yd=a.getExtension("WEBGL_provoking_vertex");return!!a.Yd},La:function(a){a=u[a].tc;const b=a.getExtension("WEBGL_shader_pixel_local_storage");if(b&&b.isCoherent()){if(5==b.framebufferTexturePixelLocalStorageWEBGL.length)return a.qd=b,!0;console.warn("WEBGL_shader_pixel_local_storage is advertised, but a deprecated version has been detected. Disabling.")}return!1},Ha:function(a,b,c){(a=u[a].tc.qd)&&a.endPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,4*c,b))},
|
|
468
|
-
b+c;J[a+d>>2]=f;c+=Va(e,B,f,Infinity)+1;d+=4}return 0},
|
|
467
|
+
u[a].tc;a.Yd=a.getExtension("WEBGL_provoking_vertex");return!!a.Yd},La:function(a){a=u[a].tc;const b=a.getExtension("WEBGL_shader_pixel_local_storage");if(b&&b.isCoherent()){if(5==b.framebufferTexturePixelLocalStorageWEBGL.length)return a.qd=b,!0;console.warn("WEBGL_shader_pixel_local_storage is advertised, but a deprecated version has been detected. Disabling.")}return!1},Ha:function(a,b,c){(a=u[a].tc.qd)&&a.endPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,4*c,b))},sb:(a,b)=>{var c=0,d=0,e;for(e of nd()){var f=
|
|
468
|
+
b+c;J[a+d>>2]=f;c+=Va(e,B,f,Infinity)+1;d+=4}return 0},tb:(a,b)=>{var c=nd();J[a>>2]=c.length;a=0;for(var d of c)a+=Ua(d)+1;J[b>>2]=a;return 0},na:function(a){try{var b=vb(a);if(null===b.Mc)throw new M(8);b.Cd&&(b.Cd=null);try{b.hc.close&&b.hc.close(b)}catch(c){throw c;}finally{kb[b.Mc]=null}b.Mc=null;return 0}catch(c){if("undefined"==typeof Gb||"ErrnoError"!==c.name)throw c;return c.Lc}},ub:function(a,b,c,d){try{a:{var e=vb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],k=J[a+4>>2];a+=8;var m=e,q=
|
|
469
469
|
h,v=k,t=f,C=A;if(0>v||0>t)throw new M(28);if(null===m.Mc)throw new M(8);if(1===(m.flags&2097155))throw new M(8);if(16384===(m.node.mode&61440))throw new M(31);if(!m.hc.read)throw new M(28);var p="undefined"!=typeof t;if(!p)t=m.position;else if(!m.seekable)throw new M(70);var r=m.hc.read(m,C,q,v,t);p||(m.position+=r);var w=r;if(0>w){var x=-1;break a}b+=w;if(w<k)break;"undefined"!=typeof f&&(f+=w)}x=b}J[d>>2]=x;return 0}catch(z){if("undefined"==typeof Gb||"ErrnoError"!==z.name)throw z;return z.Lc}},
|
|
470
|
-
|
|
470
|
+
rb:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=vb(a);Eb(e,b,c);wa[d>>3]=BigInt(e.position);e.Cd&&0===b&&0===c&&(e.Cd=null);return 0}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return f.Lc}},oa:function(a,b,c,d){try{a:{var e=vb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],k=J[a+4>>2];a+=8;var m=e,q=h,v=k,t=f,C=A;if(0>v||0>t)throw new M(28);if(null===m.Mc)throw new M(8);if(0===(m.flags&2097155))throw new M(8);if(16384===
|
|
471
471
|
(m.node.mode&61440))throw new M(31);if(!m.hc.write)throw new M(28);m.seekable&&m.flags&1024&&Eb(m,0,2);var p="undefined"!=typeof t;if(!p)t=m.position;else if(!m.seekable)throw new M(70);var r=m.hc.write(m,C,q,v,t,void 0);p||(m.position+=r);var w=r;if(0>w){var x=-1;break a}b+=w;if(w<k)break;"undefined"!=typeof f&&(f+=w)}x=b}J[d>>2]=x;return 0}catch(z){if("undefined"==typeof Gb||"ErrnoError"!==z.name)throw z;return z.Lc}},Ja:function(a,b,c,d,e,f){(a=u[a].tc.qd)&&a.framebufferPixelLocalClearValuefvWEBGL(b,
|
|
472
472
|
[c,d,e,f])},Ka:function(a,b,c,d,e,f){(a=u[a].tc.qd)&&a.framebufferTexturePixelLocalStorageWEBGL(b,bd[c],d,e,f)},e:a=>X.activeTexture(a),E:(a,b)=>{X.attachShader(Y[a],cd[b])},M:(a,b)=>{35051==a?X.yd=b:35052==a&&(X.ed=b);X.bindBuffer(a,Zc[b])},va:(a,b,c,d,e)=>{X.bindBufferRange(a,b,Zc[c],d,e)},i:(a,b)=>{X.bindFramebuffer(a,$c[b])},sa:(a,b)=>{X.bindRenderbuffer(a,ad[b])},Kb:(a,b)=>{X.bindSampler(a,ed[b])},d:(a,b)=>{X.bindTexture(a,bd[b])},Na:a=>{X.bindVertexArray(dd[a])},g:a=>X.blendEquation(a),L:(a,
|
|
473
473
|
b)=>X.blendFunc(a,b),Y:(a,b,c,d,e,f,g,h,k,m)=>X.blitFramebuffer(a,b,c,d,e,f,g,h,k,m),y:(a,b,c,d)=>{c&&b?X.bufferData(a,B,d,c,b):X.bufferData(a,b,d)},ya:(a,b,c,d)=>{c&&X.bufferSubData(a,b,B,d,c)},Db:a=>X.clear(a),Gb:(a,b,c)=>{X.clearBufferfv(a,b,ua,c>>2)},Fb:(a,b,c)=>{X.clearBufferuiv(a,b,J,c>>2)},Eb:(a,b,c,d)=>X.clearColor(a,b,c,d),Ua:a=>X.clearDepth(a),Ta:a=>X.clearStencil(a),fa:(a,b,c,d)=>{X.colorMask(!!a,!!b,!!c,!!d)},za:a=>{X.compileShader(cd[a])},Jb:(a,b,c,d,e,f,g,h,k)=>{X.ed||!h?X.compressedTexSubImage2D(a,
|
|
@@ -495,7 +495,7 @@ if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.leng
|
|
|
495
495
|
/* 5 */
|
|
496
496
|
/***/ ((module) => {
|
|
497
497
|
|
|
498
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.
|
|
498
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.41.0","description":"Rive\'s webgl2 based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
499
499
|
|
|
500
500
|
/***/ }),
|
|
501
501
|
/* 6 */
|
|
@@ -3620,6 +3620,12 @@ var Layout = /** @class */ (function () {
|
|
|
3620
3620
|
|
|
3621
3621
|
// #endregion
|
|
3622
3622
|
// #region state machines
|
|
3623
|
+
/**
|
|
3624
|
+
* @deprecated State machine inputs are deprecated and will be removed in a
|
|
3625
|
+
* future major version: please use data binding properties instead. See
|
|
3626
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
3627
|
+
* for how to migrate.
|
|
3628
|
+
*/
|
|
3623
3629
|
var StateMachineInputType;
|
|
3624
3630
|
(function (StateMachineInputType) {
|
|
3625
3631
|
StateMachineInputType[StateMachineInputType["Number"] = 56] = "Number";
|
|
@@ -3628,6 +3634,10 @@ var StateMachineInputType;
|
|
|
3628
3634
|
})(StateMachineInputType || (StateMachineInputType = {}));
|
|
3629
3635
|
/**
|
|
3630
3636
|
* An input for a state machine
|
|
3637
|
+
* @deprecated State machine inputs are deprecated and will be removed in a
|
|
3638
|
+
* future major version: please use data binding properties instead. See
|
|
3639
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
3640
|
+
* for how to migrate.
|
|
3631
3641
|
*/
|
|
3632
3642
|
var StateMachineInput = /** @class */ (function () {
|
|
3633
3643
|
function StateMachineInput(type, runtimeInput) {
|
|
@@ -3677,6 +3687,11 @@ var StateMachineInput = /** @class */ (function () {
|
|
|
3677
3687
|
return StateMachineInput;
|
|
3678
3688
|
}());
|
|
3679
3689
|
|
|
3690
|
+
/**
|
|
3691
|
+
* @deprecated Rive Events are deprecated and will be removed in a future major
|
|
3692
|
+
* version: please use data binding instead. See
|
|
3693
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
3694
|
+
*/
|
|
3680
3695
|
var RiveEventType;
|
|
3681
3696
|
(function (RiveEventType) {
|
|
3682
3697
|
RiveEventType[RiveEventType["General"] = 128] = "General";
|
|
@@ -4219,6 +4234,12 @@ var Animator = /** @class */ (function () {
|
|
|
4219
4234
|
var instancedName;
|
|
4220
4235
|
if (this.animations.length === 0 && this.stateMachines.length === 0) {
|
|
4221
4236
|
if (this.artboard.animationCount() > 0) {
|
|
4237
|
+
// Warn only when the v3 default would actually change what plays
|
|
4238
|
+
if (this.artboard.stateMachineCount() > 0) {
|
|
4239
|
+
warnOnce("No `stateMachine` was specified, so the artboard's first linear animation is playing by default. " +
|
|
4240
|
+
"In the next major version, the artboard's state machine will be played by default instead when one exists. " +
|
|
4241
|
+
"Pass the `stateMachine` parameter to adopt that behavior now.");
|
|
4242
|
+
}
|
|
4222
4243
|
// Add the first animation
|
|
4223
4244
|
this.add([(instancedName = this.artboard.animationByIndex(0).name)], playing, fireEvent);
|
|
4224
4245
|
}
|
|
@@ -4297,15 +4318,84 @@ var EventType;
|
|
|
4297
4318
|
EventType["Play"] = "play";
|
|
4298
4319
|
EventType["Pause"] = "pause";
|
|
4299
4320
|
EventType["Stop"] = "stop";
|
|
4321
|
+
/**
|
|
4322
|
+
* @deprecated Loop events are deprecated and will be removed in a future
|
|
4323
|
+
* major version: they are only reported for linear animation playback, which
|
|
4324
|
+
* is deprecated. Use a state machine to control playback and data binding to
|
|
4325
|
+
* react to changes instead. See
|
|
4326
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
|
|
4327
|
+
* to migrate.
|
|
4328
|
+
*/
|
|
4300
4329
|
EventType["Loop"] = "loop";
|
|
4301
4330
|
EventType["Draw"] = "draw";
|
|
4302
4331
|
EventType["Advance"] = "advance";
|
|
4332
|
+
/**
|
|
4333
|
+
* @deprecated State change events are deprecated and will be removed in a
|
|
4334
|
+
* future major version. Use data binding (view model property observers) or
|
|
4335
|
+
* state machine actions to react to changes from your graphic instead. See
|
|
4336
|
+
* {@link https://rive.app/docs/editor/state-machine/states#actions} for more details.
|
|
4337
|
+
*/
|
|
4303
4338
|
EventType["StateChange"] = "statechange";
|
|
4339
|
+
/**
|
|
4340
|
+
* @deprecated Rive Events are deprecated and will be removed in a future
|
|
4341
|
+
* major version: please use data binding instead. See
|
|
4342
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
|
|
4343
|
+
*/
|
|
4304
4344
|
EventType["RiveEvent"] = "riveevent";
|
|
4305
4345
|
EventType["AudioStatusChange"] = "audiostatuschange";
|
|
4306
4346
|
})(EventType || (EventType = {}));
|
|
4347
|
+
var riveEventsDeprecationWarning = "Rive Events are deprecated and will be removed in a future major version: " +
|
|
4348
|
+
"please use data binding instead. See " +
|
|
4349
|
+
"https://rive.app/docs/runtimes/web/rive-events for how to migrate.";
|
|
4350
|
+
var stateMachineInputsDeprecationWarning = "State machine inputs are deprecated and will be removed in a future major version: " +
|
|
4351
|
+
"please use data binding properties instead. See " +
|
|
4352
|
+
"https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs for how to migrate.";
|
|
4353
|
+
var textRunsDeprecationWarning = "Text run APIs are deprecated and will be removed in a future major version: " +
|
|
4354
|
+
"please use data binding instead. See " +
|
|
4355
|
+
"https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime for how to migrate.";
|
|
4356
|
+
var loopEventsDeprecationWarning = "Loop events are deprecated and will be removed in a future major version: " +
|
|
4357
|
+
"they are only reported for linear animation playback, which is deprecated. " +
|
|
4358
|
+
"Use a state machine to control playback and data binding to react to changes instead. See " +
|
|
4359
|
+
"https://rive.app/docs/editor/data-binding/migration-guide for how to migrate.";
|
|
4360
|
+
var stateChangeEventsDeprecationWarning = "State change events are deprecated and will be removed in a future major version: " +
|
|
4361
|
+
"use data binding (view model property observers) or state machine actions to react to " +
|
|
4362
|
+
"changes from your graphic instead. See " +
|
|
4363
|
+
"https://rive.app/docs/editor/state-machine/states#actions for how to migrate.";
|
|
4364
|
+
// Deprecation warnings already emitted; each is logged at most once per page
|
|
4365
|
+
// session to avoid flooding the console when many instances are created.
|
|
4366
|
+
var emittedWarnings = new Set();
|
|
4367
|
+
var warnOnce = function (message) {
|
|
4368
|
+
if (!emittedWarnings.has(message)) {
|
|
4369
|
+
emittedWarnings.add(message);
|
|
4370
|
+
console.warn("[Rive] ".concat(message));
|
|
4371
|
+
}
|
|
4372
|
+
};
|
|
4373
|
+
/**
|
|
4374
|
+
* Warns that a playback-control method received an array of names; the next
|
|
4375
|
+
* major version restricts these parameters to a single string, since playing
|
|
4376
|
+
* multiple animations or state machines at once will not be supported.
|
|
4377
|
+
*/
|
|
4378
|
+
var warnIfNamesArray = function (names, methodName) {
|
|
4379
|
+
if (Array.isArray(names)) {
|
|
4380
|
+
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."));
|
|
4381
|
+
}
|
|
4382
|
+
};
|
|
4383
|
+
/**
|
|
4384
|
+
* Warns that a playback-control method received linear animation names;
|
|
4385
|
+
* name-based control remains supported for state machines only, so
|
|
4386
|
+
* user-specified linear animation names are going away in a future major
|
|
4387
|
+
* version.
|
|
4388
|
+
*/
|
|
4389
|
+
var warnDeprecatedAnimationNames = function (methodName) {
|
|
4390
|
+
warnOnce("Passing linear animation names to `".concat(methodName, "()` is deprecated and will be removed in a future major version: ") +
|
|
4391
|
+
"Pass a single state machine name to control playback instead.");
|
|
4392
|
+
};
|
|
4307
4393
|
/**
|
|
4308
4394
|
* Looping types: one-shot, loop, and ping-pong
|
|
4395
|
+
* @deprecated Loop events are deprecated and will be removed in a future major
|
|
4396
|
+
* version: they are only reported for linear animation playback, which is
|
|
4397
|
+
* deprecated. Use a state machine to control playback and data binding to
|
|
4398
|
+
* react to changes instead.
|
|
4309
4399
|
*/
|
|
4310
4400
|
var LoopType;
|
|
4311
4401
|
(function (LoopType) {
|
|
@@ -4619,6 +4709,31 @@ var observers = new ObjectObservers();
|
|
|
4619
4709
|
// #endregion
|
|
4620
4710
|
// #region Rive
|
|
4621
4711
|
var nextRiveInstanceId = 0;
|
|
4712
|
+
/**
|
|
4713
|
+
* Resolves which animation/state machine names playback should start with.
|
|
4714
|
+
* The `stateMachine` parameter takes priority; the deprecated plural
|
|
4715
|
+
* `animations`/`stateMachines` parameters apply only when it
|
|
4716
|
+
* is not provided.
|
|
4717
|
+
*/
|
|
4718
|
+
var resolveStartingPlayback = function (_a) {
|
|
4719
|
+
var stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines;
|
|
4720
|
+
if (animations !== undefined) {
|
|
4721
|
+
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.");
|
|
4722
|
+
}
|
|
4723
|
+
if (stateMachines !== undefined) {
|
|
4724
|
+
warnOnce("The `stateMachines` parameter is deprecated: please use `stateMachine` with a single state machine name instead.");
|
|
4725
|
+
}
|
|
4726
|
+
if (stateMachine) {
|
|
4727
|
+
return {
|
|
4728
|
+
startingAnimationNames: [],
|
|
4729
|
+
startingStateMachineNames: [stateMachine],
|
|
4730
|
+
};
|
|
4731
|
+
}
|
|
4732
|
+
return {
|
|
4733
|
+
startingAnimationNames: mapToStringArray(animations),
|
|
4734
|
+
startingStateMachineNames: mapToStringArray(stateMachines),
|
|
4735
|
+
};
|
|
4736
|
+
};
|
|
4622
4737
|
var RiveFile = /** @class */ (function () {
|
|
4623
4738
|
function RiveFile(params) {
|
|
4624
4739
|
// Allow the runtime to automatically load assets hosted in Rive's runtime.
|
|
@@ -5040,6 +5155,10 @@ var Rive = /** @class */ (function () {
|
|
|
5040
5155
|
this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
|
|
5041
5156
|
this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
|
|
5042
5157
|
this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
|
|
5158
|
+
if (params.automaticallyHandleEvents) {
|
|
5159
|
+
warnOnce("The `automaticallyHandleEvents` parameter is deprecated. " +
|
|
5160
|
+
riveEventsDeprecationWarning);
|
|
5161
|
+
}
|
|
5043
5162
|
this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
|
|
5044
5163
|
this.dispatchPointerExit =
|
|
5045
5164
|
params.dispatchPointerExit === false
|
|
@@ -5104,6 +5223,7 @@ var Rive = /** @class */ (function () {
|
|
|
5104
5223
|
riveFile: this.riveFile,
|
|
5105
5224
|
autoplay: params.autoplay,
|
|
5106
5225
|
autoBind: params.autoBind,
|
|
5226
|
+
stateMachine: params.stateMachine,
|
|
5107
5227
|
animations: params.animations,
|
|
5108
5228
|
stateMachines: params.stateMachines,
|
|
5109
5229
|
artboard: params.artboard,
|
|
@@ -5170,7 +5290,7 @@ var Rive = /** @class */ (function () {
|
|
|
5170
5290
|
// Initializes the Rive object either from constructor or load()
|
|
5171
5291
|
Rive.prototype.init = function (_a) {
|
|
5172
5292
|
var _this = this;
|
|
5173
|
-
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;
|
|
5293
|
+
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;
|
|
5174
5294
|
if (this.destroyed) {
|
|
5175
5295
|
return;
|
|
5176
5296
|
}
|
|
@@ -5184,10 +5304,12 @@ var Rive = /** @class */ (function () {
|
|
|
5184
5304
|
if (!this.src && !this.buffer && !this.riveFile) {
|
|
5185
5305
|
throw new RiveError(Rive.missingErrorMessage);
|
|
5186
5306
|
}
|
|
5187
|
-
//
|
|
5188
|
-
var
|
|
5189
|
-
|
|
5190
|
-
|
|
5307
|
+
// Names of the animations and state machines that should be initialized
|
|
5308
|
+
var _e = resolveStartingPlayback({
|
|
5309
|
+
stateMachine: stateMachine,
|
|
5310
|
+
animations: animations,
|
|
5311
|
+
stateMachines: stateMachines,
|
|
5312
|
+
}), startingAnimationNames = _e.startingAnimationNames, startingStateMachineNames = _e.startingStateMachineNames;
|
|
5191
5313
|
// Ensure loaded is marked as false if loading new file
|
|
5192
5314
|
this.loaded = false;
|
|
5193
5315
|
this.readyForPlaying = false;
|
|
@@ -5904,6 +6026,7 @@ var Rive = /** @class */ (function () {
|
|
|
5904
6026
|
* might happen.
|
|
5905
6027
|
*/
|
|
5906
6028
|
Rive.prototype.cleanupInstances = function () {
|
|
6029
|
+
var _a;
|
|
5907
6030
|
if (this.eventCleanup !== null) {
|
|
5908
6031
|
this.eventCleanup();
|
|
5909
6032
|
}
|
|
@@ -5911,8 +6034,9 @@ var Rive = /** @class */ (function () {
|
|
|
5911
6034
|
// Tear down semantics before deleting state machines — the overlay's action
|
|
5912
6035
|
// closures point at instances that stop() is about to free.
|
|
5913
6036
|
this.cleanupSemantics();
|
|
5914
|
-
// Delete all animation and state machine instances
|
|
5915
|
-
|
|
6037
|
+
// Delete all animation and state machine instances synchronously via the
|
|
6038
|
+
// animator
|
|
6039
|
+
(_a = this.animator) === null || _a === void 0 ? void 0 : _a.stop();
|
|
5916
6040
|
if (this.artboard) {
|
|
5917
6041
|
this.artboard.delete();
|
|
5918
6042
|
this.artboard = null;
|
|
@@ -5945,29 +6069,58 @@ var Rive = /** @class */ (function () {
|
|
|
5945
6069
|
* Returns a string from a given text run node name, or undefined if the text run
|
|
5946
6070
|
* cannot be queried.
|
|
5947
6071
|
*
|
|
6072
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6073
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6074
|
+
* for how to migrate.
|
|
5948
6075
|
* @param textRunName - Name of the text run node associated with a text object
|
|
5949
6076
|
* @returns - String value of the text run node or undefined
|
|
5950
6077
|
*/
|
|
5951
6078
|
Rive.prototype.getTextRunValue = function (textRunName) {
|
|
6079
|
+
warnOnce(textRunsDeprecationWarning);
|
|
5952
6080
|
var textRun = this.retrieveTextRun(textRunName);
|
|
5953
6081
|
return textRun ? textRun.text : undefined;
|
|
5954
6082
|
};
|
|
5955
6083
|
/**
|
|
5956
6084
|
* Sets a text value for a given text run node name if possible
|
|
5957
6085
|
*
|
|
6086
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6087
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6088
|
+
* for how to migrate.
|
|
5958
6089
|
* @param textRunName - Name of the text run node associated with a text object
|
|
5959
6090
|
* @param textRunValue - String value to set on the text run node
|
|
5960
6091
|
*/
|
|
5961
6092
|
Rive.prototype.setTextRunValue = function (textRunName, textRunValue) {
|
|
6093
|
+
warnOnce(textRunsDeprecationWarning);
|
|
5962
6094
|
var textRun = this.retrieveTextRun(textRunName);
|
|
5963
6095
|
if (textRun) {
|
|
5964
6096
|
textRun.text = textRunValue;
|
|
5965
6097
|
}
|
|
5966
6098
|
};
|
|
5967
|
-
|
|
6099
|
+
/**
|
|
6100
|
+
* Warns when playback-control names match linear animations in the
|
|
6101
|
+
* Animator's instanced context; state machine playback remain supported.
|
|
6102
|
+
*
|
|
6103
|
+
* Remove for v3 release
|
|
6104
|
+
*/
|
|
6105
|
+
Rive.prototype.warnIfLinearAnimationNames = function (names, methodName) {
|
|
6106
|
+
if (this.animator &&
|
|
6107
|
+
this.animator.animations.some(function (a) { return names.includes(a.name); })) {
|
|
6108
|
+
warnDeprecatedAnimationNames(methodName);
|
|
6109
|
+
}
|
|
6110
|
+
};
|
|
6111
|
+
/**
|
|
6112
|
+
* Plays specified animations or state machines; if none specified, it
|
|
6113
|
+
* unpauses everything.
|
|
6114
|
+
* @param animationNames Animation or state machine name(s) to play.
|
|
6115
|
+
*
|
|
6116
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
6117
|
+
* state machine instead) and passing an array of names (this parameter
|
|
6118
|
+
* becomes a single string in the next major version).
|
|
6119
|
+
*/
|
|
5968
6120
|
Rive.prototype.play = function (animationNames, autoplay) {
|
|
5969
6121
|
var _this = this;
|
|
5970
|
-
animationNames
|
|
6122
|
+
warnIfNamesArray(animationNames, "play");
|
|
6123
|
+
var names = mapToStringArray(animationNames);
|
|
5971
6124
|
// If the file's not loaded, queue up the play
|
|
5972
6125
|
if (!this.readyForPlaying) {
|
|
5973
6126
|
this.taskQueue.add({
|
|
@@ -5975,7 +6128,8 @@ var Rive = /** @class */ (function () {
|
|
|
5975
6128
|
});
|
|
5976
6129
|
return;
|
|
5977
6130
|
}
|
|
5978
|
-
this.animator.play(
|
|
6131
|
+
this.animator.play(names);
|
|
6132
|
+
this.warnIfLinearAnimationNames(names, "play");
|
|
5979
6133
|
this.syncSemanticsOnStateMachines();
|
|
5980
6134
|
if (this.eventCleanup) {
|
|
5981
6135
|
this.eventCleanup();
|
|
@@ -5984,10 +6138,19 @@ var Rive = /** @class */ (function () {
|
|
|
5984
6138
|
this.setupRiveListeners();
|
|
5985
6139
|
this.startRendering();
|
|
5986
6140
|
};
|
|
5987
|
-
|
|
6141
|
+
/**
|
|
6142
|
+
* Pauses specified animations or state machines; if none specified, pauses
|
|
6143
|
+
* all.
|
|
6144
|
+
* @param animationNames Animation or state machine name(s) to pause.
|
|
6145
|
+
*
|
|
6146
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
6147
|
+
* state machine instead) and passing an array of names (this parameter
|
|
6148
|
+
* becomes a single string in the next major version).
|
|
6149
|
+
*/
|
|
5988
6150
|
Rive.prototype.pause = function (animationNames) {
|
|
5989
6151
|
var _this = this;
|
|
5990
|
-
animationNames
|
|
6152
|
+
warnIfNamesArray(animationNames, "pause");
|
|
6153
|
+
var names = mapToStringArray(animationNames);
|
|
5991
6154
|
// If the file's not loaded, early out, nothing to pause
|
|
5992
6155
|
if (!this.readyForPlaying) {
|
|
5993
6156
|
this.taskQueue.add({
|
|
@@ -5999,11 +6162,20 @@ var Rive = /** @class */ (function () {
|
|
|
5999
6162
|
this.eventCleanup();
|
|
6000
6163
|
}
|
|
6001
6164
|
this.cleanupKeyboardInteractions();
|
|
6002
|
-
this.animator.pause(
|
|
6165
|
+
this.animator.pause(names);
|
|
6166
|
+
this.warnIfLinearAnimationNames(names, "pause");
|
|
6003
6167
|
};
|
|
6168
|
+
/**
|
|
6169
|
+
* Scrubs specified animations to the given time; if none specified, scrubs
|
|
6170
|
+
* all of them.
|
|
6171
|
+
* @deprecated `scrub()` will be removed in a future major version: use a
|
|
6172
|
+
* state machine to control playback instead
|
|
6173
|
+
*/
|
|
6004
6174
|
Rive.prototype.scrub = function (animationNames, value) {
|
|
6005
6175
|
var _this = this;
|
|
6006
|
-
|
|
6176
|
+
warnOnce("`scrub()` is deprecated and will be removed in a future major version: " +
|
|
6177
|
+
"use a state machine to control playback instead.");
|
|
6178
|
+
var names = mapToStringArray(animationNames);
|
|
6007
6179
|
// If the file's not loaded, early out, nothing to pause
|
|
6008
6180
|
if (!this.readyForPlaying) {
|
|
6009
6181
|
this.taskQueue.add({
|
|
@@ -6013,13 +6185,22 @@ var Rive = /** @class */ (function () {
|
|
|
6013
6185
|
}
|
|
6014
6186
|
// Scrub the animation time; we draw a single frame here so that if
|
|
6015
6187
|
// nothing's currently playing, the scrubbed animation is still rendered/
|
|
6016
|
-
this.animator.scrub(
|
|
6188
|
+
this.animator.scrub(names, value || 0);
|
|
6017
6189
|
this.drawFrame();
|
|
6018
6190
|
};
|
|
6019
|
-
|
|
6191
|
+
/**
|
|
6192
|
+
* Stops specified animations or state machines; if none specified, stops
|
|
6193
|
+
* them all.
|
|
6194
|
+
* @param animationNames Animation or state machine name(s) to stop.
|
|
6195
|
+
*
|
|
6196
|
+
* Deprecated usage: passing linear animation names (control playback with a
|
|
6197
|
+
* state machine instead) and passing an array of names (this parameter
|
|
6198
|
+
* becomes a single string in the next major version).
|
|
6199
|
+
*/
|
|
6020
6200
|
Rive.prototype.stop = function (animationNames) {
|
|
6021
6201
|
var _this = this;
|
|
6022
|
-
animationNames
|
|
6202
|
+
warnIfNamesArray(animationNames, "stop");
|
|
6203
|
+
var names = mapToStringArray(animationNames);
|
|
6023
6204
|
// If the file's not loaded, early out, nothing to pause
|
|
6024
6205
|
if (!this.readyForPlaying) {
|
|
6025
6206
|
this.taskQueue.add({
|
|
@@ -6027,9 +6208,10 @@ var Rive = /** @class */ (function () {
|
|
|
6027
6208
|
});
|
|
6028
6209
|
return;
|
|
6029
6210
|
}
|
|
6211
|
+
this.warnIfLinearAnimationNames(names, "stop");
|
|
6030
6212
|
// If there is no artboard, this.animator will be undefined
|
|
6031
6213
|
if (this.animator) {
|
|
6032
|
-
this.animator.stop(
|
|
6214
|
+
this.animator.stop(names);
|
|
6033
6215
|
}
|
|
6034
6216
|
if (this.eventCleanup) {
|
|
6035
6217
|
this.eventCleanup();
|
|
@@ -6040,8 +6222,7 @@ var Rive = /** @class */ (function () {
|
|
|
6040
6222
|
/**
|
|
6041
6223
|
* Resets the animation
|
|
6042
6224
|
* @param artboard the name of the artboard, or default if none given
|
|
6043
|
-
* @param
|
|
6044
|
-
* @param stateMachines the names of state machines for playback
|
|
6225
|
+
* @param stateMachine the name of the state machine for playback
|
|
6045
6226
|
* @param autoplay whether to autoplay when reset, defaults to false
|
|
6046
6227
|
*
|
|
6047
6228
|
*/
|
|
@@ -6049,15 +6230,22 @@ var Rive = /** @class */ (function () {
|
|
|
6049
6230
|
var _a, _b;
|
|
6050
6231
|
// Get the current artboard, animations, state machines, and playback states
|
|
6051
6232
|
var artBoardName = params === null || params === void 0 ? void 0 : params.artboard;
|
|
6052
|
-
var
|
|
6053
|
-
|
|
6233
|
+
var _c = resolveStartingPlayback({
|
|
6234
|
+
stateMachine: params === null || params === void 0 ? void 0 : params.stateMachine,
|
|
6235
|
+
animations: params === null || params === void 0 ? void 0 : params.animations,
|
|
6236
|
+
stateMachines: params === null || params === void 0 ? void 0 : params.stateMachines,
|
|
6237
|
+
}), animationNames = _c.startingAnimationNames, stateMachineNames = _c.startingStateMachineNames;
|
|
6054
6238
|
var autoplay = (_a = params === null || params === void 0 ? void 0 : params.autoplay) !== null && _a !== void 0 ? _a : false;
|
|
6055
6239
|
var autoBind = (_b = params === null || params === void 0 ? void 0 : params.autoBind) !== null && _b !== void 0 ? _b : false;
|
|
6056
6240
|
// Stop everything and clean up
|
|
6057
6241
|
this.cleanupInstances();
|
|
6058
6242
|
// Reinitialize an artboard instance with the state
|
|
6059
6243
|
this.initArtboard(artBoardName, animationNames, stateMachineNames, autoplay, autoBind);
|
|
6060
|
-
|
|
6244
|
+
// Only drain the task queue once playback commands can execute; tasks
|
|
6245
|
+
// queued before then re-add themselves in a loop.
|
|
6246
|
+
if (this.readyForPlaying) {
|
|
6247
|
+
this.taskQueue.process();
|
|
6248
|
+
}
|
|
6061
6249
|
};
|
|
6062
6250
|
// Loads a new Rive file, keeping listeners in place
|
|
6063
6251
|
Rive.prototype.load = function (params) {
|
|
@@ -6212,11 +6400,18 @@ var Rive = /** @class */ (function () {
|
|
|
6212
6400
|
});
|
|
6213
6401
|
/**
|
|
6214
6402
|
* Returns the inputs for the specified instanced state machine, or an empty
|
|
6215
|
-
* list if the name is invalid or the state machine is not instanced
|
|
6403
|
+
* list if the name is invalid or the state machine is not instanced. Returns
|
|
6404
|
+
* undefined if the file is not loaded yet.
|
|
6405
|
+
*
|
|
6406
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6407
|
+
* properties instead. See
|
|
6408
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6409
|
+
* for how to migrate.
|
|
6216
6410
|
* @param name the state machine name
|
|
6217
|
-
* @returns the inputs for the named state machine
|
|
6411
|
+
* @returns the inputs for the named state machine or undefined
|
|
6218
6412
|
*/
|
|
6219
6413
|
Rive.prototype.stateMachineInputs = function (name) {
|
|
6414
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6220
6415
|
// If the file's not loaded, early out, nothing to pause
|
|
6221
6416
|
if (!this.loaded) {
|
|
6222
6417
|
return;
|
|
@@ -6243,11 +6438,16 @@ var Rive = /** @class */ (function () {
|
|
|
6243
6438
|
};
|
|
6244
6439
|
/**
|
|
6245
6440
|
* Set the boolean input with the provided name at the given path with value
|
|
6441
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6442
|
+
* properties instead. See
|
|
6443
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6444
|
+
* for how to migrate.
|
|
6246
6445
|
* @param input the state machine input name
|
|
6247
6446
|
* @param value the value to set the input to
|
|
6248
6447
|
* @param path the path the input is located at an artboard level
|
|
6249
6448
|
*/
|
|
6250
6449
|
Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {
|
|
6450
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6251
6451
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
6252
6452
|
if (!input)
|
|
6253
6453
|
return;
|
|
@@ -6260,11 +6460,16 @@ var Rive = /** @class */ (function () {
|
|
|
6260
6460
|
};
|
|
6261
6461
|
/**
|
|
6262
6462
|
* Set the number input with the provided name at the given path with value
|
|
6463
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6464
|
+
* properties instead. See
|
|
6465
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6466
|
+
* for how to migrate.
|
|
6263
6467
|
* @param input the state machine input name
|
|
6264
6468
|
* @param value the value to set the input to
|
|
6265
6469
|
* @param path the path the input is located at an artboard level
|
|
6266
6470
|
*/
|
|
6267
6471
|
Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {
|
|
6472
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6268
6473
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
6269
6474
|
if (!input)
|
|
6270
6475
|
return;
|
|
@@ -6277,10 +6482,15 @@ var Rive = /** @class */ (function () {
|
|
|
6277
6482
|
};
|
|
6278
6483
|
/**
|
|
6279
6484
|
* Fire the trigger with the provided name at the given path
|
|
6485
|
+
* @deprecated State machine inputs are deprecated: use data binding
|
|
6486
|
+
* properties instead. See
|
|
6487
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
|
|
6488
|
+
* for how to migrate.
|
|
6280
6489
|
* @param input the state machine input name
|
|
6281
6490
|
* @param path the path the input is located at an artboard level
|
|
6282
6491
|
*/
|
|
6283
6492
|
Rive.prototype.fireStateAtPath = function (inputName, path) {
|
|
6493
|
+
warnOnce(stateMachineInputsDeprecationWarning);
|
|
6284
6494
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
6285
6495
|
if (!input)
|
|
6286
6496
|
return;
|
|
@@ -6328,8 +6538,13 @@ var Rive = /** @class */ (function () {
|
|
|
6328
6538
|
*
|
|
6329
6539
|
* @remarks
|
|
6330
6540
|
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
6541
|
+
*
|
|
6542
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6543
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6544
|
+
* for how to migrate.
|
|
6331
6545
|
*/
|
|
6332
6546
|
Rive.prototype.getTextRunValueAtPath = function (textName, path) {
|
|
6547
|
+
warnOnce(textRunsDeprecationWarning);
|
|
6333
6548
|
var run = this.retrieveTextAtPath(textName, path);
|
|
6334
6549
|
if (!run) {
|
|
6335
6550
|
console.warn("Could not get text with name: '".concat(textName, "', at path:'").concat(path, "'"));
|
|
@@ -6354,8 +6569,13 @@ var Rive = /** @class */ (function () {
|
|
|
6354
6569
|
*
|
|
6355
6570
|
* @remarks
|
|
6356
6571
|
* If the text run cannot be found at the specified path, a warning will be logged to the console.
|
|
6572
|
+
*
|
|
6573
|
+
* @deprecated Text run APIs are deprecated: use data binding instead. See
|
|
6574
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
|
|
6575
|
+
* for how to migrate.
|
|
6357
6576
|
*/
|
|
6358
6577
|
Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
|
|
6578
|
+
warnOnce(textRunsDeprecationWarning);
|
|
6359
6579
|
var run = this.retrieveTextAtPath(textName, path);
|
|
6360
6580
|
if (!run) {
|
|
6361
6581
|
console.warn("Could not set text with name: '".concat(textName, "', at path:'").concat(path, "'"));
|
|
@@ -6464,10 +6684,26 @@ var Rive = /** @class */ (function () {
|
|
|
6464
6684
|
});
|
|
6465
6685
|
/**
|
|
6466
6686
|
* Subscribe to Rive-generated events
|
|
6687
|
+
*
|
|
6688
|
+
* Note: subscribing to {@link EventType.RiveEvent},
|
|
6689
|
+
* {@link EventType.StateChange}, or {@link EventType.Loop} is deprecated;
|
|
6690
|
+
* use data binding instead. See
|
|
6691
|
+
* {@link https://rive.app/docs/runtimes/web/rive-events} (Rive Events) and
|
|
6692
|
+
* {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
|
|
6693
|
+
* to migrate Rive graphics to a data binding workflow instead.
|
|
6467
6694
|
* @param type the type of event to subscribe to
|
|
6468
6695
|
* @param callback callback to fire when the event occurs
|
|
6469
6696
|
*/
|
|
6470
6697
|
Rive.prototype.on = function (type, callback) {
|
|
6698
|
+
if (type === EventType.RiveEvent) {
|
|
6699
|
+
warnOnce(riveEventsDeprecationWarning);
|
|
6700
|
+
}
|
|
6701
|
+
else if (type === EventType.StateChange) {
|
|
6702
|
+
warnOnce(stateChangeEventsDeprecationWarning);
|
|
6703
|
+
}
|
|
6704
|
+
else if (type === EventType.Loop) {
|
|
6705
|
+
warnOnce(loopEventsDeprecationWarning);
|
|
6706
|
+
}
|
|
6471
6707
|
this.eventManager.add({
|
|
6472
6708
|
type: type,
|
|
6473
6709
|
callback: callback,
|