@rive-app/canvas-lite 2.51.0 → 2.52.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 +44 -1
- package/rive.js +509 -145
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +23 -2
- package/rive_fallback.wasm +0 -0
- package/utils/gamepadInteractions.d.ts +9 -2
- package/utils/registerKeyboardInteractions.d.ts +4 -1
- package/utils/registerTouchInteractions.d.ts +2 -1
package/rive.js
CHANGED
|
@@ -681,111 +681,111 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
681
681
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
682
682
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
683
683
|
/* harmony export */ });
|
|
684
|
-
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var
|
|
685
|
-
function da(){let b=null,a=null;const c=(l,
|
|
686
|
-
function(l){(0>l?
|
|
687
|
-
(
|
|
688
|
-
function ha(b){return function(){b();const a=
|
|
689
|
-
|
|
690
|
-
"function"===typeof
|
|
691
|
-
|
|
692
|
-
r=>{
|
|
693
|
-
function ma(b,a,c,d,
|
|
694
|
-
function pa(b,a,c,d,
|
|
695
|
-
|
|
696
|
-
const oa=new function(){function b(){if(!a){var
|
|
697
|
-
|
|
698
|
-
G),
|
|
699
|
-
y(
|
|
700
|
-
p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(
|
|
701
|
-
0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,
|
|
702
|
-
|
|
703
|
-
console.assert(E==8*C);E=
|
|
684
|
+
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var k=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope;
|
|
685
|
+
function da(){let b=null,a=null;const c=(l,n,f)=>{const m=l?-1:1;let q=0,z=0,r=new Map;const t=p=>{const y=r;z=q=0;r=new Map;y.forEach(C=>{try{C(p)}catch(G){console.error(G)}});this.ab();b&&b.Db(l)};return{add:p=>{q||=n(t);const y=++z;r.set(y,p);return m*y},remove:p=>{r.delete(m*p);q&&0==r.size&&(f(q),q=0)}}},d=c(!1,l=>requestAnimationFrame(l),l=>cancelAnimationFrame(l)),g=c(!0,l=>null.request(l),l=>null.cancel(l));this.requestAnimationFrame=function(l){return d.add(l)};this.cancelAnimationFrame=
|
|
686
|
+
function(l){(0>l?g:d).remove(l)};this.Bb=function(l){a&&(document.body.remove(a),a=null);l||(a=document.createElement("div"),a.style.backgroundColor="black",a.style.position="fixed",a.style.right=0,a.style.top=0,a.style.color="white",a.style.padding="4px",a.innerHTML="RIVE FPS",l=function(n){a.innerHTML="RIVE FPS "+n.toFixed(1)},document.body.appendChild(a));b=new function(){let n=[0,0],f=0;this.Db=function(m){const q=performance.now();f?(++n[m?1:0],m=q-f,1E3<m&&(l(1E3*Math.max(n[0],n[1])/m),f=0)):
|
|
687
|
+
(f=q,n=[0,0])}}};this.yb=function(){a&&(document.body.remove(a),a=null);b=null};this.ab=function(){}}function ea(b){console.assert(!0);const a=new Map;let c=-Infinity;this.push=function(d){d=d+((1<<b)-1)>>b;a.has(d)&&clearTimeout(a.get(d));a.set(d,setTimeout(function(){a.delete(d);0==a.length?c=-Infinity:d==c&&(c=Math.max(...a.keys()),console.assert(c<d))},1E3));c=Math.max(d,c);return c<<b}}
|
|
688
|
+
function ha(b){return function(){b();const a=k.riveScripting;if(a)for(const c of a.frameBoundary())console.warn(c)}}const ia=k.onRuntimeInitialized;
|
|
689
|
+
k.onRuntimeInitialized=function(){function b(){k.onAssetChange&&k.onAssetChange()}ia&&ia();k.startFileScripts=function(f){const m=k.riveScripting;return f&&m&&f.startScripts?m.prepare().then(function(){f.startScripts();return f}):Promise.resolve(f)};let a=k.decodeAudio;k.decodeAudio=function(f,m,q=null){f=a(f,q??null);m(f)};let c=k.decodeFont;k.decodeFont=function(f,m,q=null){f=c(f,q??null);m(f)};const d=k.FileAsset.prototype.decode;k.FileAsset.prototype.decode=function(f,m){f=d.call(this,f,m??null);
|
|
690
|
+
b();return f};[["ImageAsset","setRenderImage"],["FontAsset","setFont"],["AudioAsset","setAudioSource"]].forEach(function([f,m]){if(k[f]){f=k[f].prototype;var q=f[m];f[m]=function(z){q.call(this,z);b()}}});let g=k.setFallbackFontCb;k.setFallbackFontCallback="function"===typeof g?function(f){g(f)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};"function"!==typeof k.setSystemLanguages&&(k.setSystemLanguages=function(){});const l=k.FileAssetLoader;
|
|
691
|
+
k.ptrToAsset=f=>{let m=k.ptrToFileAsset(f);return m.isImage?k.ptrToImageAsset(f):m.isFont?k.ptrToFontAsset(f):m.isAudio?k.ptrToAudioAsset(f):m};k.CustomFileAssetLoader=l.extend("CustomFileAssetLoader",{__construct:function({loadContents:f}){this.__parent.__construct.call(this);this.nb=f},loadContents:function(f,m){f=k.ptrToAsset(f);return this.nb(f,m)}});k.CDNFileAssetLoader=l.extend("CDNFileAssetLoader",{__construct:function(f){this.__parent.__construct.call(this);this.ob=f??null},loadContents:function(f){let m=
|
|
692
|
+
k.ptrToAsset(f);f=m.cdnUuid;if(""===f)return!1;const q=this.ob??null;(function(z,r){var t=new XMLHttpRequest;t.responseType="arraybuffer";t.onreadystatechange=function(){4==t.readyState&&200==t.status&&r(t)};t.open("GET",z,!0);t.send(null)})(m.cdnBaseUrl+"/"+f,z=>{m.decode(new Uint8Array(z.response),q)});return!0}});k.FallbackFileAssetLoader=l.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.Za=[]},addLoader:function(f){this.Za.push(f)},loadContents:function(f,
|
|
693
|
+
m){for(let q of this.Za)if(q.loadContents(f,m))return!0;return!1}});let n=k.computeAlignment;k.computeAlignment=function(f,m,q,z,r=1){return n.call(this,f,m,q,z,r)}};function la(){}const F=new Int32Array(5);function ma(b,a,c,d,g){b(a,c,F);b=Math.max(F[0],0);const l=Math.max(F[1],0);a=Math.min(F[2],Math.ceil(d*a));c=Math.min(F[3],Math.ceil(g*c));F[4]=b!==F[0]||l!==F[1]||a!==F[2]||c!==F[3]?1:0;F[0]=b;F[1]=l;F[2]=a;F[3]=c;return a>b&&c>l}function na(){const b=oa.Mb();return 0===b?0:b}
|
|
694
|
+
function pa(b,a,c,d,g,l,n,f,m,q,z){var r=na(),t=r-1,p=t-6;if(!(0<p))return q(),la;let y=1,C=1;if(!ma(f,y,C,c,d))return q(),la;const G=F[2]-F[0],E=F[3]-F[1];if(G>t||E>t)if(y*=Math.min(1,p/G),C*=Math.min(1,p/E),!ma(f,y,C,c,d))return q(),la;c=F[0];d=F[1];t=F[2];p=F[3];f=0!==F[4];if(1>y||1>C)--c,--d,t+=1,p+=1;const H=t-c,L=p-d;b.i||(b.i=new k.DynamicRectanizer(r),b.i.reset(512,512));r=b.i.addRect(H+1,L+1);if(0>r&&(z(),r=b.i.addRect(H+1,L+1),0>r))return console.assert(!1,"draw does not fit in an empty atlas"),
|
|
695
|
+
q(),la;const R=r&65535,I=r>>16;b.m.push({pb:[y*g[0],C*g[1],y*g[2],C*g[3],y*g[4]-c+R,C*g[5]-d+I],qb:R,rb:I,Vb:H,Ya:L,$a:f,N:m,Pb:()=>{q()}});const S=c/y,Y=d/C,ca=H/y,ra=L/C,sa=b.M;return function(){const Ea=sa.canvas();Ea&&(a.save(),a.resetTransform(),a.globalCompositeOperation=l,a.globalAlpha=n,a.drawImage(Ea,R,I,H,L,S,Y,ca,ra),a.restore())}}class qa{constructor(){this.M=new ua;this.i=null;this.m=[];this.na=new ea(8);this.$=new ea(8)}}
|
|
696
|
+
const oa=new function(){function b(){if(!a){var r=document.createElement("canvas"),t={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,powerPreference:"high-performance",failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,renderViaOffscreenBackBuffer:1};let p;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(p=r.getContext("webgl",t),c=1,!p)return console.log("No WebGL support. Image mesh will not be drawn."),!1}else if(p=r.getContext("webgl2",
|
|
697
|
+
t))c=2;else if(p=r.getContext("webgl",t))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;p=new Proxy(p,{get(C,G){if(C.isContextLost()){if(m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",G),m=!0),"function"===typeof C[G])return function(){}}else return"function"===typeof C[G]?function(...E){return C[G].apply(C,E)}:C[G]},set(C,G,E){if(C.isContextLost())m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+
|
|
698
|
+
G),m=!0);else return C[G]=E,!0}});d=Math.min(p.getParameter(p.MAX_RENDERBUFFER_SIZE),p.getParameter(p.MAX_TEXTURE_SIZE));function y(C,G,E){G=p.createShader(G);p.shaderSource(G,E);p.compileShader(G);E=p.getShaderInfoLog(G);if(0<(E||"").length)throw E;p.attachShader(C,G)}r=p.createProgram();y(r,p.VERTEX_SHADER,"attribute vec2 vertex;\n attribute vec2 uv;\n uniform vec4 mat;\n uniform vec2 translate;\n varying vec2 st;\n void main() {\n st = uv;\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\n }");
|
|
699
|
+
y(r,p.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }");p.bindAttribLocation(r,0,"vertex");p.bindAttribLocation(r,1,"uv");p.linkProgram(r);t=p.getProgramInfoLog(r);if(0<(t||"").trim().length)throw t;g=p.getUniformLocation(r,"mat");l=p.getUniformLocation(r,"translate");p.useProgram(r);p.bindBuffer(p.ARRAY_BUFFER,p.createBuffer());
|
|
700
|
+
p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(r,"image"),0);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=p}return!0}let a=null,c=0,d=0,g=null,l=null,n=0,f=0,m=!1;b();this.Mb=function(){b();return d};this.xb=function(r){a&&a.deleteTexture&&a.deleteTexture(r)};this.vb=function(r){if(!b())return null;const t=a.createTexture();if(!t)return null;a.bindTexture(a.TEXTURE_2D,t);a.texImage2D(a.TEXTURE_2D,
|
|
701
|
+
0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,r);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);2==c?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_LINEAR),a.generateMipmap(a.TEXTURE_2D)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);return t};const q=new ea(10),z=new ea(10);this.Ab=function(r,t,p){if(b()&&a.canvas){if(a.canvas.width!=r||a.canvas.height!=
|
|
702
|
+
t)a.canvas.width=r,a.canvas.height=t;a.viewport(0,0,r,t);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);var y=I=>I.N.image.Ca<<1|(I.$a?1:0);p.sort((I,S)=>y(S)-y(I));var C=0,G=0;for(var E of p)C+=E.N.pa.length,G+=E.N.indices.length;E=q.push(C);n!=E&&(a.bufferData(a.ARRAY_BUFFER,8*E,a.DYNAMIC_DRAW),n=E);E=0;for(var H of p)a.bufferSubData(a.ARRAY_BUFFER,E,H.N.pa),E+=4*H.N.pa.length;console.assert(E==4*C);for(var L of p)a.bufferSubData(a.ARRAY_BUFFER,E,L.N.hb),E+=4*L.N.hb.length;
|
|
703
|
+
console.assert(E==8*C);E=z.push(G);f!=E&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,2*E,a.DYNAMIC_DRAW),f=E);H=0;for(var R of p)a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,H,R.N.indices),H+=2*R.N.indices.length;console.assert(H==2*G);R=0;L=!1;E=H=0;for(const I of p){p=I.N;p.image.Ca!=R&&(a.bindTexture(a.TEXTURE_2D,p.image.V||null),R=p.image.Ca);I.$a?(a.scissor(I.qb,t-I.rb-I.Ya,I.Vb,I.Ya),L||(a.enable(a.SCISSOR_TEST),L=!0)):L&&(a.disable(a.SCISSOR_TEST),L=!1);const S=I.pb,Y=2/r,ca=-2/t;a.uniform4f(g,S[0]*Y,S[1]*
|
|
704
704
|
ca,S[2]*Y,S[3]*ca);a.uniform2f(l,S[4]*Y-1,S[5]*ca+1);a.vertexAttribPointer(0,2,a.FLOAT,!1,0,E);a.vertexAttribPointer(1,2,a.FLOAT,!1,0,E+4*C);a.drawElements(a.TRIANGLES,p.indices.length,a.UNSIGNED_SHORT,H);E+=4*p.pa.length;H+=2*p.indices.length}console.assert(E==4*C);console.assert(H==2*G)}};this.canvas=function(){return b()&&a.canvas}};class ua{constructor(){this.La=!1}canvas(){return oa.canvas()||null}}const va=new qa;
|
|
705
|
-
function wa(b,a,c,d,
|
|
706
|
-
|
|
707
|
-
case y.saturation:return"saturation";case y.color:return"color";case y.luminosity:return"luminosity"}}function a(e){return"rgba("+((16711680&e)>>>16)+","+((65280&e)>>>8)+","+((255&e)>>>0)+","+((4278190080&e)>>>24)/255+")"}function c(e,
|
|
708
|
-
tb:
|
|
709
|
-
y=
|
|
710
|
-
|
|
711
|
-
y:
|
|
712
|
-
this.m||this.ua||(this.M(),this.ua=!0)}dispose(){}}class sa{constructor(e){this.Lb=e;this.$=this.M=0;this.m=null;this.i=e(null)}clear(){this.na(null)}Da(e,
|
|
713
|
-
this.i=null}na(e){this.i.dispose();this.$=this.M=0;this.m=e;this.i=this.Lb(e)}}var Ea=
|
|
714
|
-
this.va=!1},addPath:function(e,
|
|
715
|
-
e);e.ref&&e.ref();return e},kb:function(e){var
|
|
716
|
-
this.A=this.ca=this.I=null;this.Ba=1;this.B=0;this.S=null;this.Ra=-1},__destruct:function(){null!==this.S&&(
|
|
717
|
-
b(e);this.B++},clearGradient:function(){this.I=null;this.B++},linearGradient:function(e,
|
|
718
|
-
|
|
719
|
-
P=0,T=0;null!==this.A&&(e=this.A.jb,w=this.A.filter,B=this.A.Wb,D=this.A.Xb,
|
|
720
|
-
return this.S}});const ta=new Set,ub=Object.prototype.hasOwnProperty;var ec=
|
|
721
|
-
this.F.pop();this.G.push(this.s.restore.bind(this.s))},transform:function(e,
|
|
722
|
-
1])
|
|
723
|
-
T,0,J,T,Math.sqrt(K*K+P*P))):x.T=B.createConicGradient(0,0,0);J=x.Ka;for(let Z=0,ka=J.length;Z<ka;Z++)x.T.addColorStop(J[Z].stop,a(J[Z].color))}x=x.T}else x=a(w.color);null!==w.gradientTransform&&(B.save(),B.transform(w.gradientTransform.a,w.gradientTransform.b,w.gradientTransform.c,w.gradientTransform.d,w.gradientTransform.e,w.gradientTransform.f));switch(w.style){case H:B.strokeStyle=x;B.lineWidth=w.Ub;a:{switch(w.tb){case
|
|
724
|
-
break a}x=void 0}B.lineCap=x;a:{switch(w.join){case
|
|
725
|
-
u.Ga,B*w[0],D*w[1],B*w[2],D*w[3],B*w[4],D*w[5],
|
|
726
|
-
e.Qa;x?this.Na(
|
|
727
|
-
this.s.canvas.width,this.s.canvas.height,this.L.slice(this.L.length-6),b(e),Math.max(0,
|
|
728
|
-
flush:function(){},translate:function(e,
|
|
729
|
-
restore:function(){
|
|
730
|
-
flush:function(){
|
|
731
|
-
...J))}}return
|
|
732
|
-
B.addLoader(
|
|
733
|
-
|
|
734
|
-
if(aa||ba){try{za=(new URL(".",_scriptName)).href}catch{}ba&&(Ba=b=>{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)});Aa=async b=>{if(Ca(b))return new Promise((c,d)=>{var
|
|
735
|
-
" : "+a.url);}}var Da=console.log.bind(console),Fa=console.error.bind(console),Ha,Ia=!1,Ca=b=>b.startsWith("file://"),Ja,Ka,La,M,Ma,Na,Oa,N,Pa,Qa,Ra=!1;function Sa(){var b=Ta.buffer;
|
|
736
|
-
function Ua(b){
|
|
705
|
+
function wa(b,a,c,d,g,l){const n=new DOMMatrix;n.a=b;n.b=a;n.c=c;n.d=d;n.e=g;n.f=l;return n}const xa="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),ya=k.onRuntimeInitialized;
|
|
706
|
+
k.onRuntimeInitialized=function(){function b(e){switch(e){case y.srcOver:return"source-over";case y.additive:return"lighter";case y.screen:return"screen";case y.overlay:return"overlay";case y.darken:return"darken";case y.lighten:return"lighten";case y.colorDodge:return"color-dodge";case y.colorBurn:return"color-burn";case y.hardLight:return"hard-light";case y.softLight:return"soft-light";case y.difference:return"difference";case y.exclusion:return"exclusion";case y.multiply:return"multiply";case y.hue:return"hue";
|
|
707
|
+
case y.saturation:return"saturation";case y.color:return"color";case y.luminosity:return"luminosity"}}function a(e){return"rgba("+((16711680&e)>>>16)+","+((65280&e)>>>8)+","+((255&e)>>>0)+","+((4278190080&e)>>>24)/255+")"}function c(e,h,u,v,w){return{fb:e,gb:h,Ta:u,Ua:v,type:w,Ka:[],T:null}}function d(e,h,u,v){if(h.Y===H&&!(0<h.Z))return null;u=1===u;return{Ha:e.Ma(u?h.xa:null),gradientTransform:u?h.ca:null,Ub:u?h.Z*h.Ba:h.Z,fillRule:e.ha===L?"evenodd":"nonzero",opacity:v,style:h.Y,color:h.sa,Xa:h.I,
|
|
708
|
+
tb:h.ra,join:h.ya,sb:h.qa}}function g(e,h){return h.Y!==H||0<h.Z?{path:e.kb(e.ha),Ga:h.lb()}:null}function l(){if(0!==I.m.length){var e=na();if(0!==e){var h=Math.min(I.na.push(I.i.drawWidth()),e);e=Math.min(I.$.push(I.i.drawHeight()),e);oa.Ab(h,e,I.m)}}for(const u of ta){for(const v of u.G)v();u.G=[]}ta.clear();for(const u of I.m)u.Pb();I.m=[];I.i&&I.i.reset(512,512)}ya&&ya();var n=k.RenderPaintStyle,f=k.FillRule;const m=k.RenderPath,q=k.RenderPaint,z=k.Renderer,r=k.StrokeCap,t=k.StrokeJoin,p=k.StrokePosition,
|
|
709
|
+
y=k.BlendMode,C=k.ImageFilter,G=k.ImageWrap,E=n.fill,H=n.stroke,L=f.evenOdd,R=f.nonZero,I=va,S=I.M;let Y=1;var ca=k.RenderImage.extend("CanvasRenderImage",{__construct:function({ea:e,oa:h}={}){this.__parent.__construct.call(this);this.Ca=Y;Y=Y+1&2147483647||1;this.ea=e;this.oa=h;this.V=this.Qa=this.ia=this.wa=null},__destruct:function(){this.V&&(oa.xb(this.V),this.V=null);this.ia&&URL.revokeObjectURL(this.ia);this.__parent.__destruct.call(this)},decode:function(e){var h=this;h.oa&&h.oa(h);var u=new Image;
|
|
710
|
+
h.ia=URL.createObjectURL(new Blob([e],{type:"image/png"}));u.onload=function(){h.wa=u;h.V=oa.vb(u);h.size(u.width,u.height);h.ea&&h.ea(h);k.onAssetChange&&k.onAssetChange()};u.src=h.ia}});class ra{constructor(e){this.i=e;this.path=new Path2D;this.m=null;this.ua=!1}M(){null!==this.m&&(this.path.lineTo(this.m.x,this.m.y),this.m=null)}moveTo(e,h){this.M();let u=e,v=h;null!==this.i&&(e=this.i.transformPoint({x:e,y:h}),u=e.x,v=e.y);this.path.moveTo(u,v);this.m={x:u,y:v}}lineTo(e,h){this.m=null;null!==
|
|
711
|
+
this.i?(e=this.i.transformPoint({x:e,y:h}),this.path.lineTo(e.x,e.y)):this.path.lineTo(e,h)}wb(e,h,u,v,w,B){this.m=null;null!==this.i?(e=this.i.transformPoint({x:e,y:h}),u=this.i.transformPoint({x:u,y:v}),w=this.i.transformPoint({x:w,y:B}),this.path.bezierCurveTo(e.x,e.y,u.x,u.y,w.x,w.y)):this.path.bezierCurveTo(e,h,u,v,w,B)}close(){this.m=null;this.path.closePath()}addPath(e,h,u,v,w,B,D){this.M();const A=new ra(null);for(const x of e)x(A);A.Wa();e=wa(h,u,v,w,B,D);null!==this.i&&(e=this.i.multiply(e));
|
|
712
|
+
this.path.addPath(A.path,e)}Wa(){null===this.m||this.ua||(this.M(),this.ua=!0)}dispose(){}}class sa{constructor(e){this.Lb=e;this.$=this.M=0;this.m=null;this.i=e(null)}clear(){this.na(null)}Da(e,h){for(((null===h?null!==this.m:null===this.m||this.m.a!==h.a||this.m.b!==h.b||this.m.c!==h.c||this.m.d!==h.d||this.m.e!==h.e||this.m.f!==h.f)||this.$<e.length&&(0<this.M||this.i.ua))&&this.na(h);this.$<e.length;)e[this.$++](this.i);this.i.Wa();this.M++;return this.i.path}Ja(e){null!==this.i&&e===this.i.path&&
|
|
713
|
+
this.M--}dispose(){this.i.dispose();this.i=null}na(e){this.i.dispose();this.$=this.M=0;this.m=e;this.i=this.Lb(e)}}var Ea=m.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.W=[];this.ja=new sa(e=>new ra(e));this.ka=new sa(e=>new ra(e));this.X=new Map;this.ha=R;this.va=!1},__destruct:function(){this.ja.dispose();this.ka.dispose();for(const e of this.X.values())e.dispose();this.X.clear();this.__parent.__destruct.call(this)},rewind:function(){this.W.length=
|
|
714
|
+
0;this.ja.clear();this.ka.clear();for(const e of this.X.values())e.clear();this.va=!1},addPath:function(e,h,u,v,w,B,D){const A=e.W.slice();this.ba(x=>x.addPath(A,h,u,v,w,B,D))},fillRule:function(e){this.ha=e},moveTo:function(e,h){this.va=!0;this.ba(u=>u.moveTo(e,h))},lineTo:function(e,h){this.Pa();this.ba(u=>u.lineTo(e,h))},cubicTo:function(e,h,u,v,w,B){this.Pa();this.ba(D=>D.wb(e,h,u,v,w,B))},close:function(){this.ba(e=>e.close())},Pa:function(){this.va||this.moveTo(0,0)},ba:function(e){this.W.push(e)},
|
|
715
|
+
Ma:function(e){e=null===e?this.ja.Da(this.W,null):this.ka.Da(this.W,e);e.ref&&e.ref();return e},kb:function(e){var h=this.X.get(e);void 0===h&&(h=new sa(()=>S.Yb(e)),this.X.set(e,h));h=h.Da(this.W,null);h.ref&&h.ref();return h},za:function(e){this.ja.Ja(e);this.ka.Ja(e);for(const h of this.X.values())h.Ja(e);e.unref&&e.unref()}});const bc=c(0,0,0,0,0);var dc=q.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.Y=E;this.sa=4278190080;this.Z=1;this.ya=t.miter;
|
|
716
|
+
this.ra=r.butt;this.Aa=p.center;this.ta=0;this.qa=b(y.srcOver);this.xa=this.A=this.ca=this.I=null;this.Ba=1;this.B=0;this.S=null;this.Ra=-1},__destruct:function(){null!==this.S&&(k.unrefWebGL2Paint(this.S),this.S=null);this.__parent.__destruct.call(this)},color:function(e){this.sa=e;this.I=null;this.B++},thickness:function(e){this.Z=Math.abs(e);this.B++},join:function(e){this.ya=e;this.B++},cap:function(e){this.ra=e;this.B++},strokePosition:function(e){this.Aa=e;this.B++},feather:function(e){this.ta=
|
|
717
|
+
Math.abs(e);this.B++},style:function(e){this.Y=e;this.B++},blendMode:function(e){this.qa=b(e);this.B++},clearGradient:function(){this.I=null;this.B++},linearGradient:function(e,h,u,v){this.I=c(e,h,u,v,0);this.B++},radialGradient:function(e,h,u,v){this.I=c(e,h,u,v,1);this.B++},angularGradient:function(){this.I=c(0,0,0,0,2);this.B++},addStop:function(e,h){this.I.Ka.push({color:e,stop:h});this.I.T=null;this.B++},modulatedImage:function(e,h,u,v,w,B,D,A,x,J){const K=e.wa;K?this.A={image:K,jb:e.Qa,filter:h,
|
|
718
|
+
Wb:u,Xb:v,transform:wa(w,B,D,A,x,J)}:this.A=null},completeGradient:function(){},_setGradientTransform:function(e,h,u,v,w,B,D,A,x,J,K,P,T){1===e&&0===h&&0===u&&1===v&&0===w&&0===B?this.xa=this.ca=null:(this.ca=wa(e,h,u,v,w,B),this.xa=wa(D,A,x,J,K,P));this.Ba=T;this.B++},lb:function(){if(this.Ra!==this.B){null!==this.S&&k.unrefWebGL2Paint(this.S);const h=null!==this.I?this.I:bc;let u=null,v=null;if(null!==this.I){var e=h.Ka;u=new Uint32Array(e.length);v=new Float32Array(e.length);for(let ja=0,cc=e.length;ja<
|
|
719
|
+
cc;ja++)u[ja]=e[ja].color,v[ja]=e[ja].stop}e=null;let w=C.bilinear,B=G.clamp,D=G.clamp,A=1,x=0,J=0,K=1,P=0,T=0;null!==this.A&&(e=this.A.jb,w=this.A.filter,B=this.A.Wb,D=this.A.Xb,A=this.A.transform.a,x=this.A.transform.b,J=this.A.transform.c,K=this.A.transform.d,P=this.A.transform.e,T=this.A.transform.f);let Z=1,ka=0,Ga=0,Va=1,sb=0,tb=0;const fa=this.ca;null!==fa&&(Z=fa.a,ka=fa.b,Ga=fa.c,Va=fa.d,sb=fa.e,tb=fa.f);this.S=k.makeWebGL2Paint(this.Y,this.sa,this.Z,this.ya,this.ra,this.Aa,this.ta,u,v,h.type,
|
|
720
|
+
h.fb,h.gb,h.Ta,h.Ua,Z,ka,Ga,Va,sb,tb,e,w,B,D,A,x,J,K,P,T);this.Ra=this.B}k.refWebGL2Paint(this.S);return this.S}});const ta=new Set,ub=Object.prototype.hasOwnProperty;var ec=k.CanvasRenderer=z.extend("Renderer",{__construct:function(e){this.__parent.__construct.call(this);this.L=[1,0,0,1,0,0];this.F=[1];this.s=e.getContext("2d");this.Oa=e;this.G=[]},save:function(){this.L.push(...this.L.slice(this.L.length-6));this.F.push(this.F[this.F.length-1]);this.G.push(this.s.save.bind(this.s))},restore:function(){const e=
|
|
721
|
+
this.L.length-6;if(6>e)throw"restore() called without matching save().";this.L.splice(e);this.F.pop();this.G.push(this.s.restore.bind(this.s))},transform:function(e,h,u,v,w,B){const D=this.L,A=D.length-6;D.splice(A,6,D[A]*e+D[A+2]*h,D[A+1]*e+D[A+3]*h,D[A]*u+D[A+2]*v,D[A+1]*u+D[A+3]*v,D[A]*w+D[A+2]*B+D[A+4],D[A+1]*w+D[A+3]*B+D[A+5]);this.G.push(this.s.transform.bind(this.s,e,h,u,v,w,B))},rotate:function(e){const h=Math.sin(e);e=Math.cos(e);this.transform(e,h,-h,e,0,0)},modulateOpacity:function(e){this.F[this.F.length-
|
|
722
|
+
1]*=e},_drawPath:function(e,h){const u=Math.max(0,this.F[this.F.length-1]),v=h.A||h.Aa!==p.center&&S.La?2:0!==h.ta?S.La?2:0:null===h.I||null===h.ca?0:h.Y!==H||0<h.Ba?1:S.La?2:0;if(2===v)(null===h.A||h.A.jb)&&this.mb(e,h,u);else{var w=d(e,h,v,u);null!==w&&this.G.push(()=>{var B=this.s;const D=B.globalCompositeOperation,A=B.globalAlpha;B.globalCompositeOperation=w.sb;B.globalAlpha=w.opacity;if(null!==w.Xa){var x=w.Xa;if(null===x.T){var J=x.fb;const T=x.gb;var K=x.Ta,P=x.Ua;0==x.type?x.T=B.createLinearGradient(J,
|
|
723
|
+
T,K,P):1==x.type?(K-=J,P-=T,x.T=B.createRadialGradient(J,T,0,J,T,Math.sqrt(K*K+P*P))):x.T=B.createConicGradient(0,0,0);J=x.Ka;for(let Z=0,ka=J.length;Z<ka;Z++)x.T.addColorStop(J[Z].stop,a(J[Z].color))}x=x.T}else x=a(w.color);null!==w.gradientTransform&&(B.save(),B.transform(w.gradientTransform.a,w.gradientTransform.b,w.gradientTransform.c,w.gradientTransform.d,w.gradientTransform.e,w.gradientTransform.f));switch(w.style){case H:B.strokeStyle=x;B.lineWidth=w.Ub;a:{switch(w.tb){case r.butt:x="butt";
|
|
724
|
+
break a;case r.round:x="round";break a;case r.square:x="square";break a}x=void 0}B.lineCap=x;a:{switch(w.join){case t.miter:x="miter";break a;case t.round:x="round";break a;case t.bevel:x="bevel";break a}x=void 0}B.lineJoin=x;B.miterLimit=4;B.stroke(w.Ha);break;case E:B.fillStyle=x,B.fill(w.Ha,w.fillRule)}null!==w.gradientTransform&&B.restore();B.globalCompositeOperation=D;B.globalAlpha=A;e.za(w.Ha)})}},mb:function(e,h,u){const v=g(e,h);if(null!==v){var w=this.L.slice(this.L.length-6);h=pa(I,this.s,
|
|
725
|
+
this.s.canvas.width,this.s.canvas.height,w,h.qa,u,(B,D,A)=>k.webGL2PathPixelBounds(v.path,v.Ga,B*w[0],D*w[1],B*w[2],D*w[3],B*w[4],D*w[5],A),B=>B.drawPath(v.path,v.Ga),()=>{e.za(v.path);k.unrefWebGL2Paint(v.Ga)},l);ta.add(this);this.G.push(h)}},_drawRiveImage:function(e,h,u){var v=e.wa;if(v){var w=this.s,B=b(h),D=Math.max(0,u*this.F[this.F.length-1]);this.G.push(function(){w.globalCompositeOperation=B;w.globalAlpha=D;w.drawImage(v,0,0);w.globalAlpha=1})}},_getMatrix:function(e){const h=this.L,u=h.length-
|
|
726
|
+
6;for(let v=0;6>v;++v)e[v]=h[u+v]},_drawImageMesh:function(e,h,u,v,w,B,D,A){const x=e.Qa;x?this.Na(u,v,w,B,D,A,J=>k.drawWebGL2PendingMesh(J,h,x),()=>h.unref()):h.unref()},_drawImageMeshFromHeap:function(e,h,u,v,w,B,D,A,x,J,K,P,T){if(e.V){try{var Z=k.HEAPF32.slice(v>>2,(v>>2)+w);var ka=k.HEAPF32.slice(B>>2,(B>>2)+D);var Ga=k.HEAPU16.slice(A>>1,(A>>1)+x)}catch(Va){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}this.Na(h,u,J,K,P,T,
|
|
727
|
+
{image:e,pa:Z,hb:ka,indices:Ga},()=>{})}},Na:function(e,h,u,v,w,B,D,A){e=pa(I,this.s,this.s.canvas.width,this.s.canvas.height,this.L.slice(this.L.length-6),b(e),Math.max(0,h*this.F[this.F.length-1]),(x,J,K)=>{K[0]=Math.floor(u*x);K[1]=Math.floor(v*J);K[2]=Math.ceil(w*x);K[3]=Math.ceil(B*J)},D,A,l);ta.add(this);this.G.push(e)},_clipPath:function(e){const h=e.ha===L?"evenodd":"nonzero",u=e.Ma(null);this.G.push(()=>{this.s.clip(u,h);e.za(u)})},beginFrame:function(e=!0){ta.add(this);e&&this.G.push(this.s.clearRect.bind(this.s,
|
|
728
|
+
0,0,this.Oa.width,this.Oa.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(e,h){this.transform(1,0,0,1,e,h)}});k.makeRenderer=function(e){const h=new ec(e),u=h.s;let v=null,w=null;const B={attachSession:function(A){if(A&&v===A)return!0;if(!A||v||"function"!==typeof k.c2dDeferredClaim||"function"!==typeof k.c2dDeferredRenderer||!k.c2dDeferredClaim(A))return!1;const x=k.c2dDeferredRenderer(A);if(!x)return!1;v=A;w=x;return!0},detachSession:function(){v&&k.c2dDeferredDetach(v);
|
|
729
|
+
w=v=null},deferredActive:function(){return null!==w}},D={save:function(){k.c2dDeferredSave(v)},restore:function(){k.c2dDeferredRestore(v)},transform:function(A,x,J,K,P,T){k.c2dDeferredTransform(v,A,x,J,K,P,T)},translate:function(A,x){k.c2dDeferredTransform(v,1,0,0,1,A,x)},rotate:function(A){const x=Math.sin(A);A=Math.cos(A);k.c2dDeferredTransform(v,A,x,-x,A,0,0)},align:function(A,x,J,K,P){k.c2dDeferredAlign(v,A,x,J.minX,J.minY,J.maxX,J.maxY,K.minX,K.minY,K.maxX,K.maxY,void 0===P?1:P)},beginFrame:function(A=
|
|
730
|
+
!0){h.beginFrame(A);k.c2dDeferredBeginFrame(v)},clear:function(){h.beginFrame(!0);k.c2dDeferredBeginFrame(v)},flush:function(){k.c2dDeferredReplay(v,h)}};return new Proxy(h,{get(A,x){if(ub.call(B,x))return B[x];if("_deferredRecorder"===x)return w;if(null!==w&&ub.call(D,x))return D[x];if("function"===typeof A[x])return function(...J){return A[x].apply(A,J)};if("function"===typeof u[x]){if(-1<xa.indexOf(x))throw Error("RiveException: Method call to '"+x+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");
|
|
731
|
+
return function(...J){h.G.push(u[x].bind(u,...J))}}return A[x]},set(A,x,J){if(x in u)return h.G.push(()=>{u[x]=J}),!0}})};k.decodeImage=function(e,h){(new ca({ea:h})).decode(e)};k.renderFactory={makeRenderPaint:function(){return new dc},makeRenderPath:function(){return new Ea},makeRenderImage:function(){let e=Wa;return new ca({oa:()=>{e.total++},ea:()=>{e.loaded++;if(e.loaded===e.total){const h=e.ready;h&&(h(),e.ready=null)}}})}};let fc=k.load,Wa=null;k.load=function(e,h,u=!0,v=null,w=!1){const B=
|
|
732
|
+
new k.FallbackFileAssetLoader;void 0!==h&&B.addLoader(h);u&&(h=new k.CDNFileAssetLoader(v),B.addLoader(h));return(new Promise(function(D){let A=null;Wa={total:0,loaded:0,ready:function(){D(A)}};A=fc(e,B,v??null,!!w);const x=k.riveScripting;x&&x.prepare();0==Wa.total&&D(A)})).then(k.startFileScripts)};const gc=k.Artboard.prototype.draw;k.Artboard.prototype.draw=function(e){gc.call(this,e._deferredRecorder||e)};let hc=k.RendererWrapper.prototype.align;k.RendererWrapper.prototype.align=function(e,h,
|
|
733
|
+
u,v,w=1){hc.call(this,e,h,u,v,w)};n=new da;k.requestAnimationFrame=n.requestAnimationFrame.bind(n);k.cancelAnimationFrame=n.cancelAnimationFrame.bind(n);k.enableFPSCounter=n.Bb.bind(n);k.disableFPSCounter=n.yb;f=ha(l);n.ab=f;k.resolveAnimationFrame=f;k.cleanup=function(){I.i&&(I.i["delete"](),I.i=null)}};ba&&(_scriptName=self.location.href);var za="",Aa,Ba;
|
|
734
|
+
if(aa||ba){try{za=(new URL(".",_scriptName)).href}catch{}ba&&(Ba=b=>{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)});Aa=async b=>{if(Ca(b))return new Promise((c,d)=>{var g=new XMLHttpRequest;g.open("GET",b,!0);g.responseType="arraybuffer";g.onload=()=>{200==g.status||0==g.status&&g.response?c(g.response):d(g.status)};g.onerror=d;g.send(null)});var a=await fetch(b,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+
|
|
735
|
+
" : "+a.url);}}var Da=console.log.bind(console),Fa=console.error.bind(console),Ha,Ia=!1,Ca=b=>b.startsWith("file://"),Ja,Ka,La,M,Ma,Na,Oa,N,Pa,Qa,Ra=!1;function Sa(){var b=Ta.buffer;k.HEAP8=La=new Int8Array(b);Ma=new Int16Array(b);k.HEAPU8=M=new Uint8Array(b);k.HEAPU16=Na=new Uint16Array(b);k.HEAP32=Oa=new Int32Array(b);k.HEAPU32=N=new Uint32Array(b);k.HEAPF32=Pa=new Float32Array(b);Qa=new Float64Array(b)}
|
|
736
|
+
function Ua(b){k.onAbort?.(b);b="Aborted("+b+")";Fa(b);Ia=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");Ka?.(b);throw b;}var Xa;async function Ya(b){if(!Ha)try{var a=await Aa(b);return new Uint8Array(a)}catch{}if(b==Xa&&Ha)b=new Uint8Array(Ha);else if(Ba)b=Ba(b);else throw"both async and sync fetching of the wasm failed";return b}
|
|
737
737
|
async function Za(b,a){try{var c=await Ya(b);return await WebAssembly.instantiate(c,a)}catch(d){Fa(`failed to asynchronously prepare wasm: ${d}`),Ua(d)}}async function $a(b){var a=Xa;if(!Ha&&!Ca(a))try{var c=fetch(a,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,b)}catch(d){Fa(`wasm streaming compile failed: ${d}`),Fa("falling back to ArrayBuffer instantiation")}return Za(a,b)}
|
|
738
|
-
var ab,bb,cb=b=>{for(;0<b.length;)b.shift()(
|
|
738
|
+
var ab,bb,cb=b=>{for(;0<b.length;)b.shift()(k)},db=[],eb=[],fb=()=>{var b=k.preRun.shift();eb.push(b)},gb=(b,a)=>Object.defineProperty(a,"name",{value:b}),hb=[],ib=[0,1,,1,null,1,!0,1,!1,1],O=class extends Error{constructor(b){super(b);this.name="BindingError"}},Q=b=>{if(!b)throw new O(`Cannot use deleted val. handle = ${b}`);return ib[b]},jb=b=>{switch(b){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const a=hb.pop()||ib.length;ib[a]=b;ib[a+1]=1;return a}};
|
|
739
739
|
class kb extends Error{}
|
|
740
740
|
var U=b=>{for(var a="";;){var c=M[b++];if(!c)return a;a+=String.fromCharCode(c)}},lb={},mb=(b,a)=>{if(void 0===a)throw new O("ptr should not be undefined");for(;b.C;)a=b.fa(a),b=b.C;return a},nb={},qb=b=>{b=ob(b);var a=U(b);pb(b);return a},rb=(b,a)=>{var c=nb[b];if(void 0===c)throw b=`${a} has unknown type ${qb(b)}`,new O(b);return c},vb=()=>{},wb=!1,xb=b=>{if(!globalThis.FinalizationRegistry)return xb=a=>a,b;wb=new FinalizationRegistry(a=>{a=a.g;--a.count.value;0===a.count.value&&(a.D?a.K.P(a.D):
|
|
741
741
|
a.o.h.P(a.l))});xb=a=>{var c=a.g;c.D&&wb.register(a,{g:c},a);return a};vb=a=>{wb.unregister(a)};return xb(b)},yb={},zb=b=>{for(;b.length;){var a=b.pop();b.pop()(a)}};function Ab(b){return this.j(N[b>>2])}
|
|
742
|
-
var Bb={},Cb={},Db=class extends Error{constructor(b){super(b);this.name="InternalError"}},W=(b,a,c)=>{function d(
|
|
743
|
-
function Eb(b,a,c={}){var d=a.name;if(!b)throw new O(`type "${d}" must have a positive integer typeid pointer`);if(nb.hasOwnProperty(b)){if(c.Jb)return;throw new O(`Cannot register type '${d}' twice`);}nb[b]=a;delete Cb[b];Bb.hasOwnProperty(b)&&(a=Bb[b],delete Bb[b],a.forEach(
|
|
744
|
-
var Ib={},Jb=(b,a,c)=>{if(void 0===b[a].u){var d=b[a];b[a]=function(...
|
|
745
|
-
|
|
742
|
+
var Bb={},Cb={},Db=class extends Error{constructor(b){super(b);this.name="InternalError"}},W=(b,a,c)=>{function d(f){f=c(f);if(f.length!==b.length)throw new Db("Mismatched type converter count");for(var m=0;m<b.length;++m)V(b[m],f[m])}b.forEach(f=>Cb[f]=a);var g=Array(a.length),l=[],n=0;for(let [f,m]of a.entries())nb.hasOwnProperty(m)?g[f]=nb[m]:(l.push(m),Bb.hasOwnProperty(m)||(Bb[m]=[]),Bb[m].push(()=>{g[f]=nb[m];++n;n===l.length&&d(g)}));0===l.length&&d(g)};
|
|
743
|
+
function Eb(b,a,c={}){var d=a.name;if(!b)throw new O(`type "${d}" must have a positive integer typeid pointer`);if(nb.hasOwnProperty(b)){if(c.Jb)return;throw new O(`Cannot register type '${d}' twice`);}nb[b]=a;delete Cb[b];Bb.hasOwnProperty(b)&&(a=Bb[b],delete Bb[b],a.forEach(g=>g()))}function V(b,a,c={}){return Eb(b,a,c)}var Fb=b=>{throw new O(b.g.o.h.name+" instance already deleted");},Gb=[];function Hb(){}
|
|
744
|
+
var Ib={},Jb=(b,a,c)=>{if(void 0===b[a].u){var d=b[a];b[a]=function(...g){if(!b[a].u.hasOwnProperty(g.length))throw new O(`Function '${c}' called with an invalid number of arguments (${g.length}) - expects one of (${b[a].u})!`);return b[a].u[g.length].apply(this,g)};b[a].u=[];b[a].u[d.R]=d}},Kb=(b,a,c)=>{if(k.hasOwnProperty(b)){if(void 0===c||void 0!==k[b].u&&void 0!==k[b].u[c])throw new O(`Cannot register public name '${b}' twice`);Jb(k,b,b);if(k[b].u.hasOwnProperty(c))throw new O(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
|
|
745
|
+
k[b].u[c]=a}else k[b]=a,k[b].R=c},Lb=b=>{b=b.replace(/[^a-zA-Z0-9_]/g,"$");var a=b.charCodeAt(0);return 48<=a&&57>=a?`_${b}`:b};function Mb(b,a,c,d,g,l,n,f){this.name=b;this.constructor=a;this.O=c;this.P=d;this.C=g;this.Eb=l;this.fa=n;this.zb=f;this.bb=[]}
|
|
746
746
|
var Nb=(b,a,c)=>{for(;a!==c;){if(!a.fa)throw new O(`Expected null or instance of ${c.name}, got an instance of ${a.name}`);b=a.fa(b);a=a.C}return b},Ob=b=>{if(null===b)return"null";var a=typeof b;return"object"===a||"array"===a||"function"===a?b.toString():""+b};
|
|
747
747
|
function Pb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);return 0}if(!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);return Nb(a.g.l,a.g.o.h,this.h)}
|
|
748
748
|
function Qb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);if(this.ma){var c=this.Ia();null!==b&&b.push(this.P,c);return c}return 0}if(!a||!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.la&&a.g.o.la)throw new O(`Cannot convert argument of type ${a.g.K?a.g.K.name:a.g.o.name} to parameter type ${this.name}`);c=Nb(a.g.l,a.g.o.h,this.h);if(this.ma){if(void 0===a.g.D)throw new O("Passing raw pointer to smart pointer is illegal");
|
|
749
749
|
switch(this.Tb){case 0:if(a.g.K===this)c=a.g.D;else throw new O(`Cannot convert argument of type ${a.g.K?a.g.K.name:a.g.o.name} to parameter type ${this.name}`);break;case 1:c=a.g.D;break;case 2:if(a.g.K===this)c=a.g.D;else{var d=a.clone();c=this.Ob(c,jb(()=>d["delete"]()));null!==b&&b.push(this.P,c)}break;default:throw new O("Unsupported sharing policy");}}return c}
|
|
750
750
|
function Rb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);return 0}if(!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);if(a.g.o.la)throw new O(`Cannot convert argument of type ${a.g.o.name} to parameter type ${this.name}`);return Nb(a.g.l,a.g.o.h,this.h)}
|
|
751
751
|
var Sb=(b,a,c)=>{if(a===c)return b;if(void 0===c.C)return null;b=Sb(b,a,c.C);return null===b?null:c.zb(b)},Tb=(b,a)=>{a=mb(b,a);return lb[a]},Ub=(b,a)=>{if(!a.o||!a.l)throw new Db("makeClassHandle requires ptr and ptrType");if(!!a.K!==!!a.D)throw new Db("Both smartPtrType and smartPtr must be specified");a.count={value:1};return xb(Object.create(b,{g:{value:a,writable:!0}}))};
|
|
752
|
-
function Vb(b,a,c,d,
|
|
753
|
-
var Wb=(b,a,c)=>{if(!
|
|
754
|
-
var ic=(b,a)=>{function c(l){
|
|
755
|
-
function kc(b,a,c,d,
|
|
752
|
+
function Vb(b,a,c,d,g,l,n,f,m,q,z){this.name=b;this.h=a;this.Ea=c;this.la=d;this.ma=g;this.Nb=l;this.Tb=n;this.cb=f;this.Ia=m;this.Ob=q;this.P=z;g||void 0!==a.C?this.v=Qb:(this.v=d?Pb:Rb,this.H=null)}
|
|
753
|
+
var Wb=(b,a,c)=>{if(!k.hasOwnProperty(b))throw new Db("Replacing nonexistent public symbol");void 0!==k[b].u&&void 0!==c?k[b].u[c]=a:(k[b]=a,k[b].R=c)},Xb={},Zb=(b,a,c=[])=>{b.includes("j")?(b=b.replace(/p/g,"i"),a=(0,Xb[b])(a,...c)):a=Yb.get(a)(...c);return a},$b=(b,a)=>(...c)=>Zb(b,a,c),X=(b,a)=>{b=U(b);var c=b.includes("j")?$b(b,a):Yb.get(a);if("function"!=typeof c)throw new O(`unknown function pointer with signature ${b}: ${a}`);return c};class ac extends Error{}
|
|
754
|
+
var ic=(b,a)=>{function c(l){g[l]||nb[l]||(Cb[l]?Cb[l].forEach(c):(d.push(l),g[l]=!0))}var d=[],g={};a.forEach(c);throw new ac(`${b}: `+d.map(qb).join([", "]));};function jc(b){for(var a=1;a<b.length;++a)if(null!==b[a]&&void 0===b[a].H)return!0;return!1}
|
|
755
|
+
function kc(b,a,c,d,g){var l=a.length;if(2>l)throw new O("argTypes array size mismatch! Must at least get return value and 'this' types!");var n=null!==a[1]&&null!==c,f=jc(a),m=!a[0].Kb,q=l-2,z=Array(q),r=[],t=[];return gb(b,function(...p){t.length=0;r.length=n?2:1;r[0]=g;if(n){var y=a[1].v(t,this);r[1]=y}for(var C=0;C<q;++C)z[C]=a[C+2].v(t,p[C]),r.push(z[C]);p=d(...r);if(f)zb(t);else for(C=n?1:2;C<a.length;C++){var G=1===C?y:z[C-2];null!==a[C].H&&a[C].H(G)}y=m?a[0].j(p):void 0;return y})}
|
|
756
756
|
var lc=(b,a)=>{for(var c=[],d=0;d<b;d++)c.push(N[a+4*d>>2]);return c},mc=b=>{b=b.trim();const a=b.indexOf("(");return-1===a?b:b.slice(0,a)},nc=(b,a,c)=>{if(!(b instanceof Object))throw new O(`${c} with invalid "this": ${b}`);if(!(b instanceof a.h.constructor))throw new O(`${c} incompatible with "this" of type ${b.constructor.name}`);if(!b.g.l)throw new O(`cannot call emscripten binding method ${c} on deleted object`);return Nb(b.g.l,b.g.o.h,a.h)},oc=b=>{9<b&&0===--ib[b+1]&&(ib[b]=void 0,hb.push(b))},
|
|
757
757
|
pc={name:"emscripten::val",j:b=>{var a=Q(b);oc(b);return a},v:(b,a)=>jb(a),J:Ab,H:null},qc=(b,a,c)=>{switch(a){case 1:return c?function(d){return this.j(La[d])}:function(d){return this.j(M[d])};case 2:return c?function(d){return this.j(Ma[d>>1])}:function(d){return this.j(Na[d>>1])};case 4:return c?function(d){return this.j(Oa[d>>2])}:function(d){return this.j(N[d>>2])};default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},rc=(b,a)=>{switch(a){case 4:return function(c){return this.j(Pa[c>>
|
|
758
758
|
2])};case 8:return function(c){return this.j(Qa[c>>3])};default:throw new TypeError(`invalid float width (${a}): ${b}`);}},sc=(b,a,c)=>{switch(a){case 1:return c?d=>La[d]:d=>M[d];case 2:return c?d=>Ma[d>>1]:d=>Na[d>>1];case 4:return c?d=>Oa[d>>2]:d=>N[d>>2];default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},tc=globalThis.TextDecoder&&new TextDecoder,uc=(b,a,c,d)=>{c=a+c;if(d)return c;for(;b[a]&&!(a>=c);)++a;return a},vc=(b,a=0,c,d)=>{c=uc(b,a,c,d);if(16<c-a&&b.buffer&&tc)return tc.decode(b.subarray(a,
|
|
759
|
-
c));for(d="";a<c;){var
|
|
760
|
-
return c},yc=(b,a,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=a;c=c<2*b.length?c/2:b.length;for(var
|
|
759
|
+
c));for(d="";a<c;){var g=b[a++];if(g&128){var l=b[a++]&63;if(192==(g&224))d+=String.fromCharCode((g&31)<<6|l);else{var n=b[a++]&63;g=224==(g&240)?(g&15)<<12|l<<6|n:(g&7)<<18|l<<12|n<<6|b[a++]&63;65536>g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}return d},wc=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,xc=(b,a,c)=>{b>>=1;a=uc(Na,b,a/2,c);if(16<a-b&&wc)return wc.decode(Na.subarray(b,a));for(c="";b<a;++b)c+=String.fromCharCode(Na[b]);
|
|
760
|
+
return c},yc=(b,a,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=a;c=c<2*b.length?c/2:b.length;for(var g=0;g<c;++g)Ma[a>>1]=b.charCodeAt(g),a+=2;Ma[a>>1]=0;return a-d},zc=b=>2*b.length,Ac=(b,a,c)=>{var d="";b>>=2;for(var g=0;!(g>=a/4);g++){var l=N[b+g];if(!l&&!c)break;d+=String.fromCodePoint(l)}return d},Bc=(b,a,c)=>{c??=2147483647;if(4>c)return 0;var d=a;c=d+c-4;for(var g=0;g<b.length;++g){var l=b.codePointAt(g);65535<l&&g++;Oa[a>>2]=l;a+=4;if(a+4>c)break}Oa[a>>2]=0;return a-d},Cc=b=>{for(var a=
|
|
761
761
|
0,c=0;c<b.length;++c)65535<b.codePointAt(c)&&c++,a+=4;return a},Dc=[],Ec=b=>{var a=Dc.length;Dc.push(b);return a},Fc=(b,a)=>{for(var c=Array(b),d=0;d<b;++d)c[d]=rb(N[a+4*d>>2],`parameter ${d}`);return c},Gc={},Hc=b=>{var a=Gc[b];return void 0===a?U(b):a},Ic=[null,[],[]];
|
|
762
|
-
(()=>{let b=Hb.prototype;Object.assign(b,{isAliasOf:function(c){if(!(this instanceof Hb&&c instanceof Hb))return!1;var d=this.g.o.h,
|
|
762
|
+
(()=>{let b=Hb.prototype;Object.assign(b,{isAliasOf:function(c){if(!(this instanceof Hb&&c instanceof Hb))return!1;var d=this.g.o.h,g=this.g.l;c.g=c.g;var l=c.g.o.h;for(c=c.g.l;d.C;)g=d.fa(g),d=d.C;for(;l.C;)c=l.fa(c),l=l.C;return d===l&&g===c},clone:function(){this.g.l||Fb(this);if(this.g.aa)return this.g.count.value+=1,this;var c=xb,d=Object,g=d.create,l=Object.getPrototypeOf(this),n=this.g;c=c(g.call(d,l,{g:{value:{count:n.count,da:n.da,aa:n.aa,l:n.l,o:n.o,D:n.D,K:n.K}}}));c.g.count.value+=1;c.g.da=
|
|
763
763
|
!1;return c},["delete"](){this.g.l||Fb(this);if(this.g.da&&!this.g.aa)throw new O("Object already scheduled for deletion");vb(this);var c=this.g;--c.count.value;0===c.count.value&&(c.D?c.K.P(c.D):c.o.h.P(c.l));this.g.aa||(this.g.D=void 0,this.g.l=void 0)},isDeleted:function(){return!this.g.l},deleteLater:function(){this.g.l||Fb(this);if(this.g.da&&!this.g.aa)throw new O("Object already scheduled for deletion");Gb.push(this);this.g.da=!0;return this}});const a=Symbol.dispose;a&&(b[a]=b["delete"])})();
|
|
764
|
-
Object.assign(Vb.prototype,{Fb(b){this.cb&&(b=this.cb(b));return b},Sa(b){this.P?.(b)},J:Ab,j:function(b){function a(){return this.ma?Ub(this.h.O,{o:this.Nb,l:c,K:this,D:b}):Ub(this.h.O,{o:this,l:b})}var c=this.Fb(b);if(!c)return this.Sa(b),null;var d=Tb(this.h,c);if(void 0!==d){if(0===d.g.count.value)return d.g.l=c,d.g.D=b,d.clone();d=d.clone();this.Sa(b);return d}d=this.h.Eb(c);d=Ib[d];if(!d)return a.call(this);d=this.la?d.ub:d.pointerType;var
|
|
765
|
-
Ub(d.h.O,{o:d,l:
|
|
766
|
-
var pb,Jc,ob,Ta,Yb,Kc={_abort_js:()=>Ua(""),_embind_create_inheriting_constructor:(b,a,c)=>{b=U(b);a=rb(a,"wrapper");c=Q(c);var d=a.h,
|
|
767
|
-
|
|
768
|
-
{var a=yb[b];delete yb[b];var c=a.Ia,d=a.P,
|
|
769
|
-
|
|
770
|
-
function(...R){if(Object.getPrototypeOf(this)!==E)throw new O(`Use 'new' to construct ${
|
|
771
|
-
H.C.ga.push(H)}C=new Vb(
|
|
772
|
-
null,l,
|
|
773
|
-
a,
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
v:(
|
|
778
|
-
constructor:{value:gb(`${d.name}_${a}`,function(){})}});b.values[c]=d;b[a]=d;break;case "number":d.Fa[a]=c;break;case "string":d.ib[a]=c,d.eb[c]=a,d.Fa[a]=a}},_embind_register_float:(b,a,c)=>{a=U(a);V(b,{name:a,j:d=>d,v:(d,
|
|
779
|
-
a,c,d,
|
|
780
|
-
(d=new Uint8Array(d));var
|
|
781
|
-
|
|
782
|
-
var
|
|
783
|
-
a=`methodCaller<(${
|
|
784
|
-
c,d,
|
|
785
|
-
{var a=M.length;b>>>=0;if(2147483648<b)return!1;for(var c=1;4>=c;c*=2){var d=a*(1+.2/c);d=Math.min(d,b+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(b,d)/65536))-Ta.buffer.byteLength+65535)/65536|0;try{Ta.grow(d);Sa();var
|
|
786
|
-
0):
|
|
787
|
-
Lc=await (async function(){function b(c){c=Lc=c.exports;pb=c.free;Jc=c.malloc;ob=c.__getTypeName;Xb.vij=c.dynCall_vij;Xb.iij=c.dynCall_iij;Xb.ji=c.dynCall_ji;Xb.jiji=c.dynCall_jiji;Ta=c.memory;Yb=c.__indirect_function_table;Sa();return Lc}var a={env:Kc,wasi_snapshot_preview1:Kc};if(
|
|
788
|
-
(function(){function b(){
|
|
764
|
+
Object.assign(Vb.prototype,{Fb(b){this.cb&&(b=this.cb(b));return b},Sa(b){this.P?.(b)},J:Ab,j:function(b){function a(){return this.ma?Ub(this.h.O,{o:this.Nb,l:c,K:this,D:b}):Ub(this.h.O,{o:this,l:b})}var c=this.Fb(b);if(!c)return this.Sa(b),null;var d=Tb(this.h,c);if(void 0!==d){if(0===d.g.count.value)return d.g.l=c,d.g.D=b,d.clone();d=d.clone();this.Sa(b);return d}d=this.h.Eb(c);d=Ib[d];if(!d)return a.call(this);d=this.la?d.ub:d.pointerType;var g=Sb(c,this.h,d.h);return null===g?a.call(this):this.ma?
|
|
765
|
+
Ub(d.h.O,{o:d,l:g,K:this,D:b}):Ub(d.h.O,{o:d,l:g})}});k.print&&(Da=k.print);k.printErr&&(Fa=k.printErr);k.wasmBinary&&(Ha=k.wasmBinary);if(k.preInit)for("function"==typeof k.preInit&&(k.preInit=[k.preInit]);0<k.preInit.length;)k.preInit.shift()();
|
|
766
|
+
var pb,Jc,ob,Ta,Yb,Kc={_abort_js:()=>Ua(""),_embind_create_inheriting_constructor:(b,a,c)=>{b=U(b);a=rb(a,"wrapper");c=Q(c);var d=a.h,g=d.O,l=d.C.O,n=d.C.constructor;b=gb(b,function(...f){for(var m of d.C.bb)if(this[m]===l[m])throw new kb(`Pure virtual function ${m} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:g});this.__construct(...f)});g.__construct=function(...f){if(this===g)throw new O("Pass correct 'this' to __construct");f=n.implement(this,...f);vb(f);var m=
|
|
767
|
+
f.g;f.notifyOnDestruction();m.aa=!0;Object.defineProperties(this,{g:{value:m}});xb(this);f=m.l;f=mb(d,f);if(lb.hasOwnProperty(f))throw new O(`Tried to register registered instance: ${f}`);lb[f]=this};g.__destruct=function(){if(this===g)throw new O("Pass correct 'this' to __destruct");vb(this);var f=this.g.l;f=mb(d,f);if(lb.hasOwnProperty(f))delete lb[f];else throw new O(`Tried to unregister unregistered instance: ${f}`);};b.prototype=Object.create(g);Object.assign(b.prototype,c);return jb(b)},_embind_finalize_value_object:b=>
|
|
768
|
+
{var a=yb[b];delete yb[b];var c=a.Ia,d=a.P,g=a.Va,l=g.map(n=>n.Ib).concat(g.map(n=>n.Rb));W([b],l,n=>{var f={},m,q;for([m,q]of g.entries()){const z=n[m],r=q.Gb,t=q.Hb,p=n[m+g.length],y=q.Qb,C=q.Sb;f[q.Cb]={read:G=>z.j(r(t,G)),write:(G,E)=>{var H=[];y(C,G,p.v(H,E));zb(H)},optional:z.optional}}return[{name:a.name,j:z=>{var r={},t;for(t in f)r[t]=f[t].read(z);d(z);return r},v:(z,r)=>{for(var t in f)if(!(t in r||f[t].optional))throw new TypeError(`Missing field: "${t}"`);var p=c();for(t in f)f[t].write(p,
|
|
769
|
+
r[t]);null!==z&&z.push(d,p);return p},J:Ab,H:d}]})},_embind_register_bigint:()=>{},_embind_register_bool:(b,a,c,d)=>{a=U(a);V(b,{name:a,j:function(g){return!!g},v:function(g,l){return l?c:d},J:function(g){return this.j(M[g])},H:null})},_embind_register_class:(b,a,c,d,g,l,n,f,m,q,z,r,t)=>{z=U(z);l=X(g,l);f&&=X(n,f);q&&=X(m,q);t=X(r,t);var p=Lb(z);Kb(p,function(){ic(`Cannot construct ${z} due to unbound types`,[d])});W([b,a,c],d?[d]:[],y=>{y=y[0];if(d){var C=y.h;var G=C.O}else G=Hb.prototype;y=gb(z,
|
|
770
|
+
function(...R){if(Object.getPrototypeOf(this)!==E)throw new O(`Use 'new' to construct ${z}`);if(void 0===H.U)throw new O(`${z} has no accessible constructor`);var I=H.U[R.length];if(void 0===I)throw new O(`Tried to invoke ctor of ${z} with invalid number of parameters (${R.length}) - expected (${Object.keys(H.U).toString()}) parameters instead!`);return I.apply(this,R)});var E=Object.create(G,{constructor:{value:y}});y.prototype=E;var H=new Mb(z,y,E,t,C,l,f,q);if(H.C){var L;(L=H.C).ga??(L.ga=[]);
|
|
771
|
+
H.C.ga.push(H)}C=new Vb(z,H,!0,!1,!1);L=new Vb(z+"*",H,!1,!1,!1);G=new Vb(z+" const*",H,!1,!0,!1);Ib[b]={pointerType:L,ub:G};Wb(p,y);return[C,L,G]})},_embind_register_class_class_function:(b,a,c,d,g,l,n)=>{var f=lc(c,d);a=U(a);a=mc(a);l=X(g,l);W([],[b],m=>{function q(){ic(`Cannot call ${z} due to unbound types`,f)}m=m[0];var z=`${m.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);var r=m.h.constructor;void 0===r[a]?(q.R=c-1,r[a]=q):(Jb(r,a,z),r[a].u[c-1]=q);W([],f,t=>{t=kc(z,[t[0],null].concat(t.slice(1)),
|
|
772
|
+
null,l,n);void 0===r[a].u?(t.R=c-1,r[a]=t):r[a].u[c-1]=t;if(m.h.ga)for(const p of m.h.ga)p.constructor.hasOwnProperty(a)||(p.constructor[a]=t);return[]});return[]})},_embind_register_class_class_property:(b,a,c,d,g,l,n,f)=>{a=U(a);l=X(g,l);W([],[b],m=>{m=m[0];var q=`${m.name}.${a}`,z={get(){ic(`Cannot access ${q} due to unbound types`,[c])},enumerable:!0,configurable:!0};z.set=f?()=>{ic(`Cannot access ${q} due to unbound types`,[c])}:()=>{throw new O(`${q} is a read-only property`);};Object.defineProperty(m.h.constructor,
|
|
773
|
+
a,z);W([],[c],r=>{r=r[0];var t={get(){return r.j(l(d))},enumerable:!0};f&&(f=X(n,f),t.set=p=>{var y=[];f(d,r.v(y,p));zb(y)});Object.defineProperty(m.h.constructor,a,t);return[]});return[]})},_embind_register_class_constructor:(b,a,c,d,g,l)=>{var n=lc(a,c);g=X(d,g);W([],[b],f=>{f=f[0];var m=`constructor ${f.name}`;void 0===f.h.U&&(f.h.U=[]);if(void 0!==f.h.U[a-1])throw new O(`Cannot register multiple constructors with identical number of parameters (${a-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
|
|
774
|
+
f.h.U[a-1]=()=>{ic(`Cannot construct ${f.name} due to unbound types`,n)};W([],n,q=>{q.splice(1,0,null);f.h.U[a-1]=kc(m,q,null,g,l);return[]});return[]})},_embind_register_class_function:(b,a,c,d,g,l,n,f)=>{var m=lc(c,d);a=U(a);a=mc(a);l=X(g,l);W([],[b],q=>{function z(){ic(`Cannot call ${r} due to unbound types`,m)}q=q[0];var r=`${q.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);f&&q.h.bb.push(a);var t=q.h.O,p=t[a];void 0===p||void 0===p.u&&p.className!==q.name&&p.R===c-2?(z.R=c-2,z.className=
|
|
775
|
+
q.name,t[a]=z):(Jb(t,a,r),t[a].u[c-2]=z);W([],m,y=>{y=kc(r,y,q,l,n);void 0===t[a].u?(y.R=c-2,t[a]=y):t[a].u[c-2]=y;return[]});return[]})},_embind_register_class_property:(b,a,c,d,g,l,n,f,m,q)=>{a=U(a);g=X(d,g);W([],[b],z=>{z=z[0];var r=`${z.name}.${a}`,t={get(){ic(`Cannot access ${r} due to unbound types`,[c,n])},enumerable:!0,configurable:!0};t.set=m?()=>ic(`Cannot access ${r} due to unbound types`,[c,n]):()=>{throw new O(r+" is a read-only property");};Object.defineProperty(z.h.O,a,t);W([],m?[c,
|
|
776
|
+
n]:[c],p=>{var y=p[0],C={get(){var E=nc(this,z,r+" getter");return y.j(g(l,E))},enumerable:!0};if(m){m=X(f,m);var G=p[1];C.set=function(E){var H=nc(this,z,r+" setter"),L=[];m(q,H,G.v(L,E));zb(L)}}Object.defineProperty(z.h.O,a,C);return[]});return[]})},_embind_register_emval:b=>V(b,pc),_embind_register_enum:(b,a,c,d,g)=>{a=U(a);g=0===g?"object":1===g?"number":"string";switch(g){case "object":function n(){}n.values={};V(b,{name:a,constructor:n,valueType:g,j:function(f){return this.constructor.values[f]},
|
|
777
|
+
v:(f,m)=>m.value,J:qc(a,c,d),H:null});Kb(a,n);break;case "number":var l={};V(b,{name:a,Fa:l,valueType:g,j:f=>f,v:(f,m)=>m,J:qc(a,c,d),H:null});Kb(a,l);delete k[a].R;break;case "string":l={},V(b,{name:a,ib:{},eb:{},Fa:l,valueType:g,j:function(f){return this.eb[f]},v:function(f,m){return this.ib[m]},J:qc(a,c,d),H:null}),Kb(a,l),delete k[a].R}},_embind_register_enum_value:(b,a,c)=>{var d=rb(b,"enum");a=U(a);switch(d.valueType){case "object":b=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},
|
|
778
|
+
constructor:{value:gb(`${d.name}_${a}`,function(){})}});b.values[c]=d;b[a]=d;break;case "number":d.Fa[a]=c;break;case "string":d.ib[a]=c,d.eb[c]=a,d.Fa[a]=a}},_embind_register_float:(b,a,c)=>{a=U(a);V(b,{name:a,j:d=>d,v:(d,g)=>g,J:rc(a,c),H:null})},_embind_register_function:(b,a,c,d,g,l)=>{var n=lc(a,c);b=U(b);b=mc(b);g=X(d,g);Kb(b,function(){ic(`Cannot call ${b} due to unbound types`,n)},a-1);W([],n,f=>{Wb(b,kc(b,[f[0],null].concat(f.slice(1)),null,g,l),a-1);return[]})},_embind_register_integer:(b,
|
|
779
|
+
a,c,d,g)=>{a=U(a);let l=f=>f;if(0===d){var n=32-8*c;l=f=>f<<n>>>n;g=l(g)}V(b,{name:a,j:l,v:(f,m)=>m,J:sc(a,c,0!==d),H:null})},_embind_register_memory_view:(b,a,c)=>{function d(l){return new g(La.buffer,N[l+4>>2],N[l>>2])}var g=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][a];c=U(c);V(b,{name:c,j:d,J:d},{Jb:!0})},_embind_register_std_string:(b,a)=>{a=U(a);V(b,{name:a,j(c){var d=(d=c+4)?vc(M,d,N[c>>2],!0):"";pb(c);return d},v(c,d){d instanceof ArrayBuffer&&
|
|
780
|
+
(d=new Uint8Array(d));var g,l="string"==typeof d;if(!(l||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new O("Cannot pass non-string to std::string");var n;if(l)for(g=n=0;g<d.length;++g){var f=d.charCodeAt(g);127>=f?n++:2047>=f?n+=2:55296<=f&&57343>=f?(n+=4,++g):n+=3}else n=d.length;g=n;n=Jc(4+g+1);f=n+4;N[n>>2]=g;if(l){if(l=f,f=g+1,g=M,0<f){f=l+f-1;for(var m=0;m<d.length;++m){var q=d.codePointAt(m);if(127>=q){if(l>=f)break;g[l++]=q}else if(2047>=q){if(l+1>=f)break;g[l++]=192|q>>6;g[l++]=128|
|
|
781
|
+
q&63}else if(65535>=q){if(l+2>=f)break;g[l++]=224|q>>12;g[l++]=128|q>>6&63;g[l++]=128|q&63}else{if(l+3>=f)break;g[l++]=240|q>>18;g[l++]=128|q>>12&63;g[l++]=128|q>>6&63;g[l++]=128|q&63;m++}}g[l]=0}}else M.set(d,f);null!==c&&c.push(pb,n);return n},J:Ab,H(c){pb(c)}})},_embind_register_std_wstring:(b,a,c)=>{c=U(c);if(2===a){var d=xc;var g=yc;var l=zc}else d=Ac,g=Bc,l=Cc;V(b,{name:c,j:n=>{var f=d(n+4,N[n>>2]*a,!0);pb(n);return f},v:(n,f)=>{if("string"!=typeof f)throw new O(`Cannot pass non-string to C++ string type ${c}`);
|
|
782
|
+
var m=l(f),q=Jc(4+m+a);N[q>>2]=m/a;g(f,q+4,m+a);null!==n&&n.push(pb,q);return q},J:Ab,H(n){pb(n)}})},_embind_register_value_object:(b,a,c,d,g,l)=>{yb[b]={name:U(a),Ia:X(c,d),P:X(g,l),Va:[]}},_embind_register_value_object_field:(b,a,c,d,g,l,n,f,m,q)=>{yb[b].Va.push({Cb:U(a),Ib:c,Gb:X(d,g),Hb:l,Rb:n,Qb:X(f,m),Sb:q})},_embind_register_void:(b,a)=>{a=U(a);V(b,{Kb:!0,name:a,j:()=>{},v:()=>{}})},_emval_create_invoker:(b,a,c)=>{var [d,...g]=Fc(b,a),l=d.v.bind(d),n=g.map(m=>m.J.bind(m));b--;var f=Array(b);
|
|
783
|
+
a=`methodCaller<(${g.map(m=>m.name)}) => ${d.name}>`;return Ec(gb(a,(m,q,z,r)=>{for(var t=0,p=0;p<b;++p)f[p]=n[p](r+t),t+=8;switch(c){case 0:var y=Q(m).apply(null,f);break;case 2:y=Reflect.construct(Q(m),f);break;case 3:y=f[0];break;case 1:y=Q(m)[Hc(q)](...f)}m=[];y=l(m,y);m.length&&(N[z>>2]=jb(m));return y}))},_emval_decref:oc,_emval_get_module_property:b=>{b=Hc(b);return jb(k[b])},_emval_get_property:(b,a)=>{b=Q(b);a=Q(a);return jb(b[a])},_emval_incref:b=>{9<b&&(ib[b+1]+=1)},_emval_invoke:(b,a,
|
|
784
|
+
c,d,g)=>Dc[b](a,c,d,g),_emval_new_array:()=>jb([]),_emval_new_cstring:b=>jb(Hc(b)),_emval_new_object:()=>jb({}),_emval_run_destructors:b=>{var a=Q(b);zb(a);oc(b)},_emval_set_property:(b,a,c)=>{b=Q(b);a=Q(a);c=Q(c);b[a]=c},clock_time_get:function(b,a,c,d){if(!(0<=b&&3>=b))return 28;b=Math.round(1E6*(0===b?Date.now():performance.now()));bb=[b>>>0,(ab=b,1<=+Math.abs(ab)?0<ab?+Math.floor(ab/4294967296)>>>0:~~+Math.ceil((ab-+(~~ab>>>0))/4294967296)>>>0:0)];Oa[d>>2]=bb[0];Oa[d+4>>2]=bb[1];return 0},emscripten_resize_heap:b=>
|
|
785
|
+
{var a=M.length;b>>>=0;if(2147483648<b)return!1;for(var c=1;4>=c;c*=2){var d=a*(1+.2/c);d=Math.min(d,b+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(b,d)/65536))-Ta.buffer.byteLength+65535)/65536|0;try{Ta.grow(d);Sa();var g=1;break a}catch(l){}g=void 0}if(g)return!0}return!1},fd_close:()=>52,fd_seek:function(){return 70},fd_write:(b,a,c,d)=>{for(var g=0,l=0;l<c;l++){var n=N[a>>2],f=N[a+4>>2];a+=8;for(var m=0;m<f;m++){var q=b,z=M[n+m],r=Ic[q];0===z||10===z?((1===q?Da:Fa)(vc(r)),r.length=
|
|
786
|
+
0):r.push(z)}g+=f}N[d>>2]=g;return 0}},Lc;
|
|
787
|
+
Lc=await (async function(){function b(c){c=Lc=c.exports;pb=c.free;Jc=c.malloc;ob=c.__getTypeName;Xb.vij=c.dynCall_vij;Xb.iij=c.dynCall_iij;Xb.ji=c.dynCall_ji;Xb.jiji=c.dynCall_jiji;Ta=c.memory;Yb=c.__indirect_function_table;Sa();return Lc}var a={env:Kc,wasi_snapshot_preview1:Kc};if(k.instantiateWasm)return new Promise(c=>{k.instantiateWasm(a,(d,g)=>{c(b(d,g))})});Xa??=k.locateFile?k.locateFile("canvas_advanced_c2d_only.wasm",za):za+"canvas_advanced_c2d_only.wasm";return b((await $a(a)).instance)}());
|
|
788
|
+
(function(){function b(){k.calledRun=!0;if(!Ia){Ra=!0;Lc.__wasm_call_ctors();Ja?.(k);k.onRuntimeInitialized?.();if(k.postRun)for("function"==typeof k.postRun&&(k.postRun=[k.postRun]);k.postRun.length;){var a=k.postRun.shift();db.push(a)}cb(db)}}if(k.preRun)for("function"==typeof k.preRun&&(k.preRun=[k.preRun]);k.preRun.length;)fb();cb(eb);k.setStatus?(k.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>k.setStatus(""),1);b()},1)):b()})();Ra?moduleRtn=k:moduleRtn=new Promise((b,a)=>{Ja=b;Ka=a});
|
|
789
789
|
;return moduleRtn}})();
|
|
790
790
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
791
791
|
|
|
@@ -801,7 +801,7 @@ Lc=await (async function(){function b(c){c=Lc=c.exports;pb=c.free;Jc=c.malloc;ob
|
|
|
801
801
|
/***/ ((module) => {
|
|
802
802
|
|
|
803
803
|
"use strict";
|
|
804
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
804
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.52.0","description":"Rive web runtime, lite version, canvas renderer. Rive is an agent-native 2D and 3D engine for games, apps, and interactive UI.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation","interactive","ui","game-engine","graphics"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
805
805
|
|
|
806
806
|
/***/ }),
|
|
807
807
|
/* 7 */
|
|
@@ -2995,9 +2995,9 @@ var PIXELS_PER_LINE = 16;
|
|
|
2995
2995
|
var SCROLL_PHASE_UPDATE = 1;
|
|
2996
2996
|
var SCROLL_PHASE_MOMENTUM = 3;
|
|
2997
2997
|
/**
|
|
2998
|
-
*
|
|
2998
|
+
* Pointer state per canvas. It outlives a single registration, because Rive
|
|
2999
2999
|
* re-registers the listeners (on play and pause) while a finger can still be
|
|
3000
|
-
* down.
|
|
3000
|
+
* down, or between a right press and its context menu event.
|
|
3001
3001
|
*/
|
|
3002
3002
|
var touchStateByCanvas = new WeakMap();
|
|
3003
3003
|
/**
|
|
@@ -3035,6 +3035,32 @@ var getTouchCoordinates = function (changedTouches, enableMultiTouch, primaryTou
|
|
|
3035
3035
|
}
|
|
3036
3036
|
return coordinates;
|
|
3037
3037
|
};
|
|
3038
|
+
/** Rive's PointerButton values, which differ from the DOM's MouseEvent.button. */
|
|
3039
|
+
var RivePointerButton = {
|
|
3040
|
+
primary: 0,
|
|
3041
|
+
secondary: 1,
|
|
3042
|
+
middle: 2,
|
|
3043
|
+
};
|
|
3044
|
+
/**
|
|
3045
|
+
* The runtime's PointerButton for each DOM MouseEvent.button (left 0,
|
|
3046
|
+
* middle 1, right 2), which numbers middle and right the other way round.
|
|
3047
|
+
*/
|
|
3048
|
+
var DOM_TO_POINTER_BUTTON = [
|
|
3049
|
+
RivePointerButton.primary, // DOM 0: left
|
|
3050
|
+
RivePointerButton.middle, // DOM 1: middle
|
|
3051
|
+
RivePointerButton.secondary, // DOM 2: right
|
|
3052
|
+
];
|
|
3053
|
+
/**
|
|
3054
|
+
* The pointer button a press or release is for, as the runtime numbers them.
|
|
3055
|
+
* Touch is always primary. Null for buttons a listener can't be bound to, such
|
|
3056
|
+
* as back and forward.
|
|
3057
|
+
*/
|
|
3058
|
+
var pointerButtonOf = function (event) {
|
|
3059
|
+
var _a;
|
|
3060
|
+
return event instanceof MouseEvent
|
|
3061
|
+
? ((_a = DOM_TO_POINTER_BUTTON[event.button]) !== null && _a !== void 0 ? _a : null)
|
|
3062
|
+
: RivePointerButton.primary;
|
|
3063
|
+
};
|
|
3038
3064
|
/**
|
|
3039
3065
|
* Returns the clientX and clientY properties from touch or mouse events. Also
|
|
3040
3066
|
* calls preventDefault() on the event if it is a touchstart or touchmove to prevent
|
|
@@ -3073,7 +3099,7 @@ var getClientCoordinates = function (event, isTouchScrollEnabled, enableMultiTou
|
|
|
3073
3099
|
*/
|
|
3074
3100
|
var registerTouchInteractions = function (_a) {
|
|
3075
3101
|
var _b;
|
|
3076
|
-
var canvas = _a.canvas, artboard = _a.artboard, _c = _a.stateMachines, stateMachines = _c === void 0 ? [] : _c, renderer = _a.renderer, rive = _a.rive, fit = _a.fit, alignment = _a.alignment, _d = _a.isTouchScrollEnabled, isTouchScrollEnabled = _d === void 0 ? false : _d, _e = _a.dispatchPointerExit, dispatchPointerExit = _e === void 0 ? true : _e, _f = _a.enableMultiTouch, enableMultiTouch = _f === void 0 ? false : _f, _g = _a.layoutScaleFactor, layoutScaleFactor = _g === void 0 ? 1.0 : _g, advanceAndDrain = _a.advanceAndDrain, summonKeyboard = _a.summonKeyboard, isTextProxyFocused = _a.isTextProxyFocused;
|
|
3102
|
+
var canvas = _a.canvas, artboard = _a.artboard, _c = _a.stateMachines, stateMachines = _c === void 0 ? [] : _c, renderer = _a.renderer, rive = _a.rive, fit = _a.fit, alignment = _a.alignment, _d = _a.isTouchScrollEnabled, isTouchScrollEnabled = _d === void 0 ? false : _d, _e = _a.dispatchPointerExit, dispatchPointerExit = _e === void 0 ? true : _e, _f = _a.enableMultiTouch, enableMultiTouch = _f === void 0 ? false : _f, _g = _a.layoutScaleFactor, layoutScaleFactor = _g === void 0 ? 1.0 : _g, advanceAndDrain = _a.advanceAndDrain, wake = _a.wake, summonKeyboard = _a.summonKeyboard, isTextProxyFocused = _a.isTextProxyFocused;
|
|
3077
3103
|
if (!canvas ||
|
|
3078
3104
|
!stateMachines.length ||
|
|
3079
3105
|
!renderer ||
|
|
@@ -3120,6 +3146,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3120
3146
|
var _touchState = (_b = touchStateByCanvas.get(canvas)) !== null && _b !== void 0 ? _b : {
|
|
3121
3147
|
touches: new Map(),
|
|
3122
3148
|
primaryTouchId: null,
|
|
3149
|
+
secondaryPressTaken: false,
|
|
3123
3150
|
};
|
|
3124
3151
|
touchStateByCanvas.set(canvas, _touchState);
|
|
3125
3152
|
var _activeTouches = _touchState.touches;
|
|
@@ -3240,6 +3267,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3240
3267
|
}
|
|
3241
3268
|
});
|
|
3242
3269
|
}
|
|
3270
|
+
var button = pointerButtonOf(event);
|
|
3243
3271
|
switch (event.type) {
|
|
3244
3272
|
/**
|
|
3245
3273
|
* There's a 2px buffer for a hitRadius when translating the pointer coordinates
|
|
@@ -3267,6 +3295,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3267
3295
|
var stateMachine = stateMachines_2[_i];
|
|
3268
3296
|
_loop_1(stateMachine);
|
|
3269
3297
|
}
|
|
3298
|
+
wake === null || wake === void 0 ? void 0 : wake();
|
|
3270
3299
|
break;
|
|
3271
3300
|
// Pointer moving/hovering on the canvas
|
|
3272
3301
|
case "touchmove":
|
|
@@ -3281,14 +3310,28 @@ var registerTouchInteractions = function (_a) {
|
|
|
3281
3310
|
var stateMachine = stateMachines_3[_c];
|
|
3282
3311
|
_loop_2(stateMachine);
|
|
3283
3312
|
}
|
|
3313
|
+
wake === null || wake === void 0 ? void 0 : wake();
|
|
3284
3314
|
break;
|
|
3285
3315
|
}
|
|
3286
3316
|
// Pointer click initiated but not released yet on the canvas
|
|
3287
3317
|
case "touchstart":
|
|
3288
3318
|
case "mousedown": {
|
|
3319
|
+
if (button === null) {
|
|
3320
|
+
break;
|
|
3321
|
+
}
|
|
3322
|
+
_touchState.secondaryPressTaken = false;
|
|
3289
3323
|
var _loop_3 = function (stateMachine) {
|
|
3290
|
-
coordinateSets.forEach(function (
|
|
3291
|
-
|
|
3324
|
+
coordinateSets.forEach(function (_a) {
|
|
3325
|
+
var transformedX = _a.transformedX, transformedY = _a.transformedY, identifier = _a.identifier;
|
|
3326
|
+
// Another button's press goes only where something listens for
|
|
3327
|
+
// it. Elsewhere it belongs to the browser, whose context menu
|
|
3328
|
+
// can keep the release, and would hold the pointer down.
|
|
3329
|
+
if (button !== RivePointerButton.primary &&
|
|
3330
|
+
!stateMachine.listensToButtonAt(transformedX, transformedY, button)) {
|
|
3331
|
+
return;
|
|
3332
|
+
}
|
|
3333
|
+
stateMachine.pointerDown(transformedX, transformedY, identifier, button);
|
|
3334
|
+
_touchState.secondaryPressTaken || (_touchState.secondaryPressTaken = button === RivePointerButton.secondary);
|
|
3292
3335
|
});
|
|
3293
3336
|
};
|
|
3294
3337
|
for (var _d = 0, stateMachines_4 = stateMachines; _d < stateMachines_4.length; _d++) {
|
|
@@ -3325,9 +3368,12 @@ var registerTouchInteractions = function (_a) {
|
|
|
3325
3368
|
break;
|
|
3326
3369
|
}
|
|
3327
3370
|
case "mouseup": {
|
|
3371
|
+
if (button === null) {
|
|
3372
|
+
break;
|
|
3373
|
+
}
|
|
3328
3374
|
var _loop_5 = function (stateMachine) {
|
|
3329
3375
|
coordinateSets.forEach(function (coordinateSet) {
|
|
3330
|
-
stateMachine.pointerUp(coordinateSet.transformedX, coordinateSet.transformedY, coordinateSet.identifier);
|
|
3376
|
+
stateMachine.pointerUp(coordinateSet.transformedX, coordinateSet.transformedY, coordinateSet.identifier, button);
|
|
3331
3377
|
});
|
|
3332
3378
|
};
|
|
3333
3379
|
for (var _f = 0, stateMachines_6 = stateMachines; _f < stateMachines_6.length; _f++) {
|
|
@@ -3403,6 +3449,26 @@ var registerTouchInteractions = function (_a) {
|
|
|
3403
3449
|
// Advance immediately so the release takes effect synchronously
|
|
3404
3450
|
advanceAndDrain(0);
|
|
3405
3451
|
};
|
|
3452
|
+
/**
|
|
3453
|
+
* Keeps the browser's context menu from opening where the content listens
|
|
3454
|
+
* to the secondary button, so a right click there goes to Rive alone.
|
|
3455
|
+
* Elsewhere the menu opens as usual.
|
|
3456
|
+
*/
|
|
3457
|
+
var contextMenuCallback = function (event) {
|
|
3458
|
+
// The press may have moved or hidden its listener before this event, so
|
|
3459
|
+
// a right press Rive took keeps the menu closed even with nothing there now.
|
|
3460
|
+
if (_touchState.secondaryPressTaken) {
|
|
3461
|
+
_touchState.secondaryPressTaken = false;
|
|
3462
|
+
event.preventDefault();
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
var point = mapToArtboard(event.currentTarget.getBoundingClientRect(), [event])[0];
|
|
3466
|
+
if (stateMachines.some(function (stateMachine) {
|
|
3467
|
+
return stateMachine.listensToButtonAt(point.x, point.y, RivePointerButton.secondary);
|
|
3468
|
+
})) {
|
|
3469
|
+
event.preventDefault();
|
|
3470
|
+
}
|
|
3471
|
+
};
|
|
3406
3472
|
/**
|
|
3407
3473
|
* Forwards wheel and trackpad scrolling to the state machines. The page keeps
|
|
3408
3474
|
* the wheel unless a scroll view actually moves, so it still scrolls when
|
|
@@ -3492,6 +3558,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3492
3558
|
});
|
|
3493
3559
|
canvas.addEventListener("touchend", callback);
|
|
3494
3560
|
canvas.addEventListener("touchcancel", touchCancelCallback);
|
|
3561
|
+
canvas.addEventListener("contextmenu", contextMenuCallback);
|
|
3495
3562
|
// Not passive, or preventDefault could not keep the page from scrolling.
|
|
3496
3563
|
canvas.addEventListener("wheel", wheelCallback, { passive: false });
|
|
3497
3564
|
return function () {
|
|
@@ -3504,6 +3571,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3504
3571
|
canvas.removeEventListener("touchstart", callback);
|
|
3505
3572
|
canvas.removeEventListener("touchend", callback);
|
|
3506
3573
|
canvas.removeEventListener("touchcancel", touchCancelCallback);
|
|
3574
|
+
canvas.removeEventListener("contextmenu", contextMenuCallback);
|
|
3507
3575
|
canvas.removeEventListener("wheel", wheelCallback);
|
|
3508
3576
|
};
|
|
3509
3577
|
};
|
|
@@ -3683,7 +3751,7 @@ var FocusSessionState;
|
|
|
3683
3751
|
*/
|
|
3684
3752
|
var KeyboardInteractions = /** @class */ (function () {
|
|
3685
3753
|
function KeyboardInteractions(_a) {
|
|
3686
|
-
var canvas = _a.canvas, stateMachine = _a.stateMachine, hasFocusNodes = _a.hasFocusNodes, getOverlayElement = _a.getOverlayElement;
|
|
3754
|
+
var canvas = _a.canvas, stateMachine = _a.stateMachine, hasFocusNodes = _a.hasFocusNodes, getOverlayElement = _a.getOverlayElement, onInput = _a.onInput;
|
|
3687
3755
|
var _this = this;
|
|
3688
3756
|
var _b, _c;
|
|
3689
3757
|
this.focusSessionState = FocusSessionState.NotFocused;
|
|
@@ -3718,6 +3786,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3718
3786
|
* gates this so a click doesn't yank Rive focus to the first node on the focus event itself.
|
|
3719
3787
|
*/
|
|
3720
3788
|
this.onCanvasFocus = function (event) {
|
|
3789
|
+
_this.onInput();
|
|
3721
3790
|
_this.syncOverlayListener();
|
|
3722
3791
|
_this.canvasHasFocus = true;
|
|
3723
3792
|
_this.focusDomainReleased = false;
|
|
@@ -3744,6 +3813,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3744
3813
|
* When we're not in either of those buckets, it's safe to call `clearFocus()` on the SMI.
|
|
3745
3814
|
*/
|
|
3746
3815
|
this.onCanvasBlur = function (event) {
|
|
3816
|
+
_this.onInput();
|
|
3747
3817
|
// Must stay before the state reset because beginTextInputSession sets the session state and
|
|
3748
3818
|
// then focuses the proxy, which synchronously blurs the canvas.
|
|
3749
3819
|
if (_this.inputProxy.owns(event.relatedTarget))
|
|
@@ -3763,6 +3833,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3763
3833
|
this.onOverlayFocusIn = function (event) {
|
|
3764
3834
|
if (!_this.isInOverlay(event.target))
|
|
3765
3835
|
return;
|
|
3836
|
+
_this.onInput();
|
|
3766
3837
|
_this.focusDomainReleased = false;
|
|
3767
3838
|
if (!_this.hasFocusNodes)
|
|
3768
3839
|
return;
|
|
@@ -3795,6 +3866,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3795
3866
|
* @returns void
|
|
3796
3867
|
*/
|
|
3797
3868
|
this.onKeyDown = function (event) {
|
|
3869
|
+
_this.onInput();
|
|
3798
3870
|
_this.syncOverlayListener();
|
|
3799
3871
|
// Keys that are part of an IME composition belong to the IME (candidate
|
|
3800
3872
|
// navigation, commit). Safari reports the first one as keyCode 229 with
|
|
@@ -3883,6 +3955,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3883
3955
|
}
|
|
3884
3956
|
};
|
|
3885
3957
|
this.onKeyUp = function (event) {
|
|
3958
|
+
_this.onInput();
|
|
3886
3959
|
if (event.isComposing || event.keyCode === 229)
|
|
3887
3960
|
return;
|
|
3888
3961
|
if (_this.claimedKeyCodes.delete(event.code))
|
|
@@ -3895,6 +3968,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3895
3968
|
_this.mainSm.keyInput(key, (0,_keyMap__WEBPACK_IMPORTED_MODULE_0__.modifiersFromEvent)(event), false, false);
|
|
3896
3969
|
};
|
|
3897
3970
|
this.canvas = canvas;
|
|
3971
|
+
this.onInput = onInput !== null && onInput !== void 0 ? onInput : (function () { });
|
|
3898
3972
|
this.mainSm = stateMachine;
|
|
3899
3973
|
this.hasFocusNodes = hasFocusNodes;
|
|
3900
3974
|
this.getOverlayElement = getOverlayElement;
|
|
@@ -3908,7 +3982,10 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3908
3982
|
this.inputProxy = new _textInputProxy__WEBPACK_IMPORTED_MODULE_2__.TextInputProxy({
|
|
3909
3983
|
container: (_c = canvas.parentElement) !== null && _c !== void 0 ? _c : document.body,
|
|
3910
3984
|
canvas: canvas,
|
|
3911
|
-
textInput: function (text) {
|
|
3985
|
+
textInput: function (text) {
|
|
3986
|
+
_this.onInput();
|
|
3987
|
+
return _this.mainSm.textInput(text);
|
|
3988
|
+
},
|
|
3912
3989
|
// Proxy keystrokes go through the same handlers as the canvas.
|
|
3913
3990
|
onKeyDown: this.onKeyDown,
|
|
3914
3991
|
onKeyUp: this.onKeyUp,
|
|
@@ -3959,6 +4036,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3959
4036
|
configurable: true
|
|
3960
4037
|
});
|
|
3961
4038
|
KeyboardInteractions.prototype.handleProxyBlur = function (relatedTarget) {
|
|
4039
|
+
this.onInput();
|
|
3962
4040
|
// Teardown already in progress (endTextInputSession blurred the proxy).
|
|
3963
4041
|
if (!this.textInputSessionActive)
|
|
3964
4042
|
return;
|
|
@@ -4766,7 +4844,8 @@ function toPadState(deviceId, pad) {
|
|
|
4766
4844
|
var GamepadSource = /** @class */ (function () {
|
|
4767
4845
|
function GamepadSource() {
|
|
4768
4846
|
var _this = this;
|
|
4769
|
-
|
|
4847
|
+
// One per subscribed instance; the window listener lives while any remain.
|
|
4848
|
+
this.connectListeners = new Set();
|
|
4770
4849
|
this.hasPads = false;
|
|
4771
4850
|
this.nextDeviceId = 1;
|
|
4772
4851
|
this.slots = {};
|
|
@@ -4774,18 +4853,21 @@ var GamepadSource = /** @class */ (function () {
|
|
|
4774
4853
|
this.cached = [];
|
|
4775
4854
|
this.onConnected = function () {
|
|
4776
4855
|
_this.hasPads = true;
|
|
4856
|
+
_this.connectListeners.forEach(function (listener) { return listener(); });
|
|
4777
4857
|
};
|
|
4778
4858
|
}
|
|
4779
|
-
GamepadSource.prototype.subscribe = function () {
|
|
4780
|
-
|
|
4859
|
+
GamepadSource.prototype.subscribe = function (onConnected) {
|
|
4860
|
+
this.connectListeners.add(onConnected);
|
|
4861
|
+
if (this.connectListeners.size > 1 || typeof window === "undefined") {
|
|
4781
4862
|
return;
|
|
4782
4863
|
}
|
|
4783
4864
|
window.addEventListener("gamepadconnected", this.onConnected);
|
|
4784
4865
|
// The event doesn't re-fire for pads exposed before we started listening.
|
|
4785
4866
|
this.hasPads = readNavigatorGamepads().some(function (pad) { return !!pad; });
|
|
4786
4867
|
};
|
|
4787
|
-
GamepadSource.prototype.unsubscribe = function () {
|
|
4788
|
-
|
|
4868
|
+
GamepadSource.prototype.unsubscribe = function (onConnected) {
|
|
4869
|
+
this.connectListeners.delete(onConnected);
|
|
4870
|
+
if (this.connectListeners.size > 0 || typeof window === "undefined") {
|
|
4789
4871
|
return;
|
|
4790
4872
|
}
|
|
4791
4873
|
window.removeEventListener("gamepadconnected", this.onConnected);
|
|
@@ -4793,6 +4875,14 @@ var GamepadSource = /** @class */ (function () {
|
|
|
4793
4875
|
this.cachedTime = NaN;
|
|
4794
4876
|
this.cached = [];
|
|
4795
4877
|
};
|
|
4878
|
+
Object.defineProperty(GamepadSource.prototype, "hasConnectedPads", {
|
|
4879
|
+
/** A pad was connected at the last read, or has connected since. */
|
|
4880
|
+
get: function () {
|
|
4881
|
+
return this.hasPads;
|
|
4882
|
+
},
|
|
4883
|
+
enumerable: false,
|
|
4884
|
+
configurable: true
|
|
4885
|
+
});
|
|
4796
4886
|
/** Current pads; cached per rAF timestamp so instances share one read. */
|
|
4797
4887
|
GamepadSource.prototype.read = function (time) {
|
|
4798
4888
|
if (!this.hasPads) {
|
|
@@ -4838,12 +4928,24 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4838
4928
|
// deviceId -> values last sent to `stateMachine`.
|
|
4839
4929
|
this.lastSentPads = new Map();
|
|
4840
4930
|
this.submitFailures = 0;
|
|
4841
|
-
gamepadSource.subscribe();
|
|
4931
|
+
gamepadSource.subscribe(params.onPadConnected);
|
|
4842
4932
|
}
|
|
4843
|
-
|
|
4933
|
+
Object.defineProperty(GamepadInteractions.prototype, "isPolling", {
|
|
4934
|
+
/** Whether pads need reading each frame: one is connected, or one still has to be disconnected. */
|
|
4935
|
+
get: function () {
|
|
4936
|
+
return (this.submitFailures < MAX_SUBMIT_FAILURES &&
|
|
4937
|
+
(gamepadSource.hasConnectedPads || this.lastSentPads.size > 0));
|
|
4938
|
+
},
|
|
4939
|
+
enumerable: false,
|
|
4940
|
+
configurable: true
|
|
4941
|
+
});
|
|
4942
|
+
/**
|
|
4943
|
+
* Poll, diff and submit one batch. Call once per frame before advancing.
|
|
4944
|
+
* @returns true when a batch was sent to the state machine
|
|
4945
|
+
*/
|
|
4844
4946
|
GamepadInteractions.prototype.handleGamepadInputs = function (time, stateMachine) {
|
|
4845
4947
|
if (!stateMachine) {
|
|
4846
|
-
return;
|
|
4948
|
+
return false;
|
|
4847
4949
|
}
|
|
4848
4950
|
if (stateMachine !== this.stateMachine) {
|
|
4849
4951
|
// A new state machine knows no devices yet; resend connected records.
|
|
@@ -4851,14 +4953,10 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4851
4953
|
this.lastSentPads.clear();
|
|
4852
4954
|
this.submitFailures = 0;
|
|
4853
4955
|
}
|
|
4854
|
-
if (this.
|
|
4855
|
-
return;
|
|
4956
|
+
if (!this.isPolling) {
|
|
4957
|
+
return false;
|
|
4856
4958
|
}
|
|
4857
4959
|
var pads = gamepadSource.read(time);
|
|
4858
|
-
// Nothing connected and nothing left to disconnect.
|
|
4859
|
-
if (pads.length === 0 && this.lastSentPads.size === 0) {
|
|
4860
|
-
return;
|
|
4861
|
-
}
|
|
4862
4960
|
if (this.params.requireFocus && !this.params.isFocusWithin()) {
|
|
4863
4961
|
// Keep devices connected but release everything they hold.
|
|
4864
4962
|
pads = pads.map(restState);
|
|
@@ -4866,11 +4964,11 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4866
4964
|
this.encoder.begin();
|
|
4867
4965
|
this.encodeDiff(pads);
|
|
4868
4966
|
if (this.encoder.isEmpty) {
|
|
4869
|
-
return;
|
|
4967
|
+
return false;
|
|
4870
4968
|
}
|
|
4871
4969
|
if (stateMachine.submitGamepadsFromBuffer(this.encoder.end())) {
|
|
4872
4970
|
this.submitFailures = 0;
|
|
4873
|
-
return;
|
|
4971
|
+
return true;
|
|
4874
4972
|
}
|
|
4875
4973
|
// The core stops at the first bad record, so resend connected records next
|
|
4876
4974
|
// frame rather than updates for devices it may never have seen.
|
|
@@ -4879,11 +4977,12 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4879
4977
|
console.error("[Rive] Gamepad input was rejected by the state machine " +
|
|
4880
4978
|
"".concat(MAX_SUBMIT_FAILURES, " times in a row; gamepad input is disabled for it."));
|
|
4881
4979
|
}
|
|
4980
|
+
return false;
|
|
4882
4981
|
};
|
|
4883
4982
|
GamepadInteractions.prototype.dispose = function () {
|
|
4884
4983
|
this.stateMachine = undefined;
|
|
4885
4984
|
this.lastSentPads.clear();
|
|
4886
|
-
gamepadSource.unsubscribe();
|
|
4985
|
+
gamepadSource.unsubscribe(this.params.onPadConnected);
|
|
4887
4986
|
};
|
|
4888
4987
|
/** Writes records that bring `lastSentPads` up to `pads`, updating it as it goes. */
|
|
4889
4988
|
GamepadInteractions.prototype.encodeDiff = function (pads) {
|
|
@@ -6000,9 +6099,10 @@ var StateMachineInputType;
|
|
|
6000
6099
|
* for how to migrate.
|
|
6001
6100
|
*/
|
|
6002
6101
|
var StateMachineInput = /** @class */ (function () {
|
|
6003
|
-
function StateMachineInput(type, runtimeInput) {
|
|
6102
|
+
function StateMachineInput(type, runtimeInput, onChange) {
|
|
6004
6103
|
this.type = type;
|
|
6005
6104
|
this.runtimeInput = runtimeInput;
|
|
6105
|
+
this.onChange = onChange;
|
|
6006
6106
|
}
|
|
6007
6107
|
Object.defineProperty(StateMachineInput.prototype, "name", {
|
|
6008
6108
|
/**
|
|
@@ -6025,7 +6125,9 @@ var StateMachineInput = /** @class */ (function () {
|
|
|
6025
6125
|
* Sets the value of the input
|
|
6026
6126
|
*/
|
|
6027
6127
|
set: function (value) {
|
|
6128
|
+
var _a;
|
|
6028
6129
|
this.runtimeInput.value = value;
|
|
6130
|
+
(_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6029
6131
|
},
|
|
6030
6132
|
enumerable: false,
|
|
6031
6133
|
configurable: true
|
|
@@ -6034,8 +6136,10 @@ var StateMachineInput = /** @class */ (function () {
|
|
|
6034
6136
|
* Fires a trigger; does nothing on Number or Boolean input types
|
|
6035
6137
|
*/
|
|
6036
6138
|
StateMachineInput.prototype.fire = function () {
|
|
6139
|
+
var _a;
|
|
6037
6140
|
if (this.type === StateMachineInputType.Trigger) {
|
|
6038
6141
|
this.runtimeInput.fire();
|
|
6142
|
+
(_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6039
6143
|
}
|
|
6040
6144
|
};
|
|
6041
6145
|
/**
|
|
@@ -6104,10 +6208,11 @@ var StateMachine = /** @class */ (function () {
|
|
|
6104
6208
|
* @param stateMachine runtime state machine object
|
|
6105
6209
|
* @param instance runtime state machine instance object
|
|
6106
6210
|
*/
|
|
6107
|
-
function StateMachine(stateMachine, runtime, playing, artboard) {
|
|
6211
|
+
function StateMachine(stateMachine, runtime, playing, artboard, onInputChange) {
|
|
6108
6212
|
this.stateMachine = stateMachine;
|
|
6109
6213
|
this.playing = playing;
|
|
6110
6214
|
this.artboard = artboard;
|
|
6215
|
+
this.onInputChange = onInputChange;
|
|
6111
6216
|
/**
|
|
6112
6217
|
* Caches the inputs from the runtime
|
|
6113
6218
|
*/
|
|
@@ -6156,9 +6261,10 @@ var StateMachine = /** @class */ (function () {
|
|
|
6156
6261
|
/**
|
|
6157
6262
|
* Advances the state machine instance by a given time and apply changes to artboard.
|
|
6158
6263
|
* @param time - the time to advance the animation by in seconds
|
|
6264
|
+
* @returns false once the state machine has nothing left to animate
|
|
6159
6265
|
*/
|
|
6160
6266
|
StateMachine.prototype.advanceAndApply = function (time) {
|
|
6161
|
-
this.instance.advanceAndApply(time);
|
|
6267
|
+
return this.instance.advanceAndApply(time);
|
|
6162
6268
|
};
|
|
6163
6269
|
/**
|
|
6164
6270
|
* Enables semantic tree tracking for this state machine instance.
|
|
@@ -6179,6 +6285,8 @@ var StateMachine = /** @class */ (function () {
|
|
|
6179
6285
|
* @param actionType - 0 = tap, 1 = increase, 2 = decrease
|
|
6180
6286
|
*/
|
|
6181
6287
|
StateMachine.prototype.fireSemanticAction = function (nodeId, actionType) {
|
|
6288
|
+
var _a;
|
|
6289
|
+
(_a = this.onInputChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6182
6290
|
this.instance.fireSemanticAction(nodeId, actionType);
|
|
6183
6291
|
};
|
|
6184
6292
|
/**
|
|
@@ -6189,6 +6297,8 @@ var StateMachine = /** @class */ (function () {
|
|
|
6189
6297
|
* @returns boolean - True if focus was set, false otherwise
|
|
6190
6298
|
*/
|
|
6191
6299
|
StateMachine.prototype.focusSemanticNode = function (nodeId) {
|
|
6300
|
+
var _a;
|
|
6301
|
+
(_a = this.onInputChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6192
6302
|
return this.instance.focusSemanticNode(nodeId);
|
|
6193
6303
|
};
|
|
6194
6304
|
/**
|
|
@@ -6225,13 +6335,13 @@ var StateMachine = /** @class */ (function () {
|
|
|
6225
6335
|
*/
|
|
6226
6336
|
StateMachine.prototype.mapRuntimeInput = function (input, runtime) {
|
|
6227
6337
|
if (input.type === runtime.SMIInput.bool) {
|
|
6228
|
-
return new StateMachineInput(StateMachineInputType.Boolean, input.asBool());
|
|
6338
|
+
return new StateMachineInput(StateMachineInputType.Boolean, input.asBool(), this.onInputChange);
|
|
6229
6339
|
}
|
|
6230
6340
|
else if (input.type === runtime.SMIInput.number) {
|
|
6231
|
-
return new StateMachineInput(StateMachineInputType.Number, input.asNumber());
|
|
6341
|
+
return new StateMachineInput(StateMachineInputType.Number, input.asNumber(), this.onInputChange);
|
|
6232
6342
|
}
|
|
6233
6343
|
else if (input.type === runtime.SMIInput.trigger) {
|
|
6234
|
-
return new StateMachineInput(StateMachineInputType.Trigger, input.asTrigger());
|
|
6344
|
+
return new StateMachineInput(StateMachineInputType.Trigger, input.asTrigger(), this.onInputChange);
|
|
6235
6345
|
}
|
|
6236
6346
|
};
|
|
6237
6347
|
/**
|
|
@@ -6261,6 +6371,8 @@ var StateMachine = /** @class */ (function () {
|
|
|
6261
6371
|
* Clear focus from the Rive focus node tree.
|
|
6262
6372
|
*/
|
|
6263
6373
|
StateMachine.prototype.clearFocus = function () {
|
|
6374
|
+
var _a;
|
|
6375
|
+
(_a = this.onInputChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6264
6376
|
this.instance.clearFocus();
|
|
6265
6377
|
};
|
|
6266
6378
|
return StateMachine;
|
|
@@ -6335,7 +6447,7 @@ var Animator = /** @class */ (function () {
|
|
|
6335
6447
|
// Try to create a new state machine instance
|
|
6336
6448
|
var sm = this.artboard.stateMachineByName(animatables[i]);
|
|
6337
6449
|
if (sm) {
|
|
6338
|
-
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard);
|
|
6450
|
+
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard, this.onInputChange);
|
|
6339
6451
|
if (semanticsActive) {
|
|
6340
6452
|
newStateMachine.enableSemantics();
|
|
6341
6453
|
}
|
|
@@ -6419,7 +6531,7 @@ var Animator = /** @class */ (function () {
|
|
|
6419
6531
|
// Try to create a new state machine instance
|
|
6420
6532
|
var sm = this.artboard.stateMachineByName(animatables[i]);
|
|
6421
6533
|
if (sm) {
|
|
6422
|
-
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard);
|
|
6534
|
+
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard, this.onInputChange);
|
|
6423
6535
|
if (semanticsActive) {
|
|
6424
6536
|
newStateMachine.enableSemantics();
|
|
6425
6537
|
}
|
|
@@ -7087,7 +7199,8 @@ var ObjectObservers = /** @class */ (function () {
|
|
|
7087
7199
|
*/
|
|
7088
7200
|
this._onObservedEntry = function (entry) {
|
|
7089
7201
|
var observed = _this._elementsMap.get(entry.target);
|
|
7090
|
-
|
|
7202
|
+
// An entry queued before remove() can still arrive after it.
|
|
7203
|
+
if (observed) {
|
|
7091
7204
|
observed.onResize(entry.target.clientWidth == 0 || entry.target.clientHeight == 0);
|
|
7092
7205
|
}
|
|
7093
7206
|
else {
|
|
@@ -7120,6 +7233,13 @@ var observers = new ObjectObservers();
|
|
|
7120
7233
|
// #endregion
|
|
7121
7234
|
// #region Rive
|
|
7122
7235
|
var nextRiveInstanceId = 0;
|
|
7236
|
+
// Instances whose requestAnimationFrame stopped because they settled.
|
|
7237
|
+
var settledInstances = new Set();
|
|
7238
|
+
// Live instances created with enableSettling.
|
|
7239
|
+
var settlingEnabledInstanceCount = 0;
|
|
7240
|
+
// Bumped by every asset change. The change has no owning instance to wake, so
|
|
7241
|
+
// draw() compares this to its frame-start value and doesn't settle if it moved.
|
|
7242
|
+
var assetGeneration = 0;
|
|
7123
7243
|
/**
|
|
7124
7244
|
* Resolves which animation/state machine names playback should start with.
|
|
7125
7245
|
* The `stateMachine` parameter takes priority; the deprecated plural
|
|
@@ -7660,6 +7780,13 @@ var Rive = /** @class */ (function () {
|
|
|
7660
7780
|
// Set by stopRendering(), cleared by startRendering(). Prevents the
|
|
7661
7781
|
// visibilitychange handler from restarting a rendering loop the caller intentionally stopped.
|
|
7662
7782
|
this._explicitlyStoppedRendering = false;
|
|
7783
|
+
this._enableSettling = false;
|
|
7784
|
+
// Bumped by every wake. draw() compares it to its frame-start value and
|
|
7785
|
+
// doesn't settle if a wake happened mid-frame (e.g. from a callback), since
|
|
7786
|
+
// that change wasn't advanced.
|
|
7787
|
+
this._wakeGeneration = 0;
|
|
7788
|
+
// Registered on bound view model instances so their writes restart this instance's loop.
|
|
7789
|
+
this._wakeFromViewModel = function () { return _this.wake(); };
|
|
7663
7790
|
this._viewModelInstance = null;
|
|
7664
7791
|
// User-provided global view model instances, keyed by their global view
|
|
7665
7792
|
// model's name. Globals not present here are still driven by the default
|
|
@@ -7772,6 +7899,10 @@ var Rive = /** @class */ (function () {
|
|
|
7772
7899
|
: this.dispatchPointerExit;
|
|
7773
7900
|
this.enableMultiTouch = !!params.enableMultiTouch;
|
|
7774
7901
|
this.drawOptimization = (_c = params.drawingOptions) !== null && _c !== void 0 ? _c : this.drawOptimization;
|
|
7902
|
+
this._enableSettling = !!params.enableSettling;
|
|
7903
|
+
if (this._enableSettling) {
|
|
7904
|
+
settlingEnabledInstanceCount++;
|
|
7905
|
+
}
|
|
7775
7906
|
this.enableRiveAssetCDN =
|
|
7776
7907
|
params.enableRiveAssetCDN === undefined
|
|
7777
7908
|
? true
|
|
@@ -7885,6 +8016,7 @@ var Rive = /** @class */ (function () {
|
|
|
7885
8016
|
* default {@link SemanticMode.Disabled}.
|
|
7886
8017
|
*/
|
|
7887
8018
|
Rive.prototype.enableSemantics = function () {
|
|
8019
|
+
this.wake();
|
|
7888
8020
|
this.semanticsMode = _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticMode.Enabled;
|
|
7889
8021
|
this.activateSemantics();
|
|
7890
8022
|
};
|
|
@@ -7981,6 +8113,7 @@ var Rive = /** @class */ (function () {
|
|
|
7981
8113
|
return;
|
|
7982
8114
|
}
|
|
7983
8115
|
_this.runtime = runtime;
|
|
8116
|
+
runtime.onAssetChange = Rive.wakeSettledInstances;
|
|
7984
8117
|
_this.removeRiveListeners();
|
|
7985
8118
|
// load() reinitializes without cleanupInstances(); drop any stale overlay
|
|
7986
8119
|
// bound to the previous file's state machines (no-op on first construct).
|
|
@@ -8000,6 +8133,7 @@ var Rive = /** @class */ (function () {
|
|
|
8000
8133
|
((_b = (_a = _this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredRequested) !== null && _b !== void 0 ? _b : true),
|
|
8001
8134
|
// Draws notice a restored context, so one has to be scheduled.
|
|
8002
8135
|
onContextRestored: function () {
|
|
8136
|
+
_this.removeFromSettledInstances();
|
|
8003
8137
|
if (!_this._explicitlyStoppedRendering) {
|
|
8004
8138
|
_this.scheduleRendering();
|
|
8005
8139
|
}
|
|
@@ -8079,6 +8213,7 @@ var Rive = /** @class */ (function () {
|
|
|
8079
8213
|
enableMultiTouch: enableMultiTouch,
|
|
8080
8214
|
layoutScaleFactor: this._layout.layoutScaleFactor,
|
|
8081
8215
|
advanceAndDrain: this.advanceAndDrainForPointer.bind(this),
|
|
8216
|
+
wake: this.wake.bind(this),
|
|
8082
8217
|
summonKeyboard: this.summonKeyboardForGesture.bind(this),
|
|
8083
8218
|
isTextProxyFocused: this.isEditingHostFocused,
|
|
8084
8219
|
});
|
|
@@ -8119,6 +8254,7 @@ var Rive = /** @class */ (function () {
|
|
|
8119
8254
|
stateMachine: smWithFocusNodes.instance,
|
|
8120
8255
|
hasFocusNodes: true,
|
|
8121
8256
|
getOverlayElement: function () { var _a, _b; return (_b = (_a = _this._accessibilityOverlay) === null || _a === void 0 ? void 0 : _a.getSemanticOverlayContainer()) !== null && _b !== void 0 ? _b : null; },
|
|
8257
|
+
onInput: function () { return _this.wake(); },
|
|
8122
8258
|
});
|
|
8123
8259
|
};
|
|
8124
8260
|
/** Runs inside touchend/mouseup so focusing the proxy raises the mobile keyboard. */
|
|
@@ -8141,6 +8277,7 @@ var Rive = /** @class */ (function () {
|
|
|
8141
8277
|
return node === undefined || node.role === _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField;
|
|
8142
8278
|
};
|
|
8143
8279
|
Rive.prototype.advanceAndDrainForPointer = function (elapsedTime, options) {
|
|
8280
|
+
this.wake();
|
|
8144
8281
|
if (!(options === null || options === void 0 ? void 0 : options.pointerDown)) {
|
|
8145
8282
|
this.advanceAndReportChanges(elapsedTime);
|
|
8146
8283
|
return;
|
|
@@ -8164,6 +8301,7 @@ var Rive = /** @class */ (function () {
|
|
|
8164
8301
|
};
|
|
8165
8302
|
// Survives play/pause/stop so the state machine only receives missed changes on resume.
|
|
8166
8303
|
Rive.prototype.ensureGamepadInteractions = function () {
|
|
8304
|
+
var _this = this;
|
|
8167
8305
|
if (this._gamepadInteractions ||
|
|
8168
8306
|
this.shouldDisableGamepad ||
|
|
8169
8307
|
this.shouldDisableRiveListeners) {
|
|
@@ -8172,6 +8310,7 @@ var Rive = /** @class */ (function () {
|
|
|
8172
8310
|
this._gamepadInteractions = new _utils__WEBPACK_IMPORTED_MODULE_3__.GamepadInteractions({
|
|
8173
8311
|
requireFocus: !!this._gamepadOptions.requireFocus,
|
|
8174
8312
|
isFocusWithin: this.isFocusWithinCanvas,
|
|
8313
|
+
onPadConnected: function () { return _this.wake(); },
|
|
8175
8314
|
});
|
|
8176
8315
|
};
|
|
8177
8316
|
Rive.prototype.cleanupGamepadInteractions = function () {
|
|
@@ -8493,6 +8632,7 @@ var Rive = /** @class */ (function () {
|
|
|
8493
8632
|
};
|
|
8494
8633
|
// Initialize for playback
|
|
8495
8634
|
Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
8635
|
+
var _this = this;
|
|
8496
8636
|
if (!this.file) {
|
|
8497
8637
|
return;
|
|
8498
8638
|
}
|
|
@@ -8506,8 +8646,11 @@ var Rive = /** @class */ (function () {
|
|
|
8506
8646
|
}
|
|
8507
8647
|
this.artboard = rootArtboard;
|
|
8508
8648
|
rootArtboard.volume = this._volume * audioManager.systemVolume;
|
|
8649
|
+
// A new artboard has to be drawn, so a settled loop restarts.
|
|
8650
|
+
this.wake();
|
|
8509
8651
|
// Initialize the animator
|
|
8510
8652
|
this.animator = new Animator(this.runtime, this.artboard, this.eventManager);
|
|
8653
|
+
this.animator.onInputChange = function () { return _this.wake(); };
|
|
8511
8654
|
// Initialize the animations; as loaded hasn't happened yet, we need to
|
|
8512
8655
|
// suppress firing the play/pause events until the load event has fired. To
|
|
8513
8656
|
// do this we tell the animator to suppress firing events, and add event
|
|
@@ -8557,6 +8700,10 @@ var Rive = /** @class */ (function () {
|
|
|
8557
8700
|
// Draws the current artboard frame
|
|
8558
8701
|
Rive.prototype.drawFrame = function () {
|
|
8559
8702
|
var _a, _b;
|
|
8703
|
+
// A settled instance resumes its loop from this frame, and a frame that
|
|
8704
|
+
// called this from a callback doesn't settle.
|
|
8705
|
+
this.removeFromSettledInstances();
|
|
8706
|
+
this._wakeGeneration++;
|
|
8560
8707
|
if ((_a = document === null || document === void 0 ? void 0 : document.timeline) === null || _a === void 0 ? void 0 : _a.currentTime) {
|
|
8561
8708
|
if (this.loaded && this.artboard && !this.frameRequestId) {
|
|
8562
8709
|
this.draw(null);
|
|
@@ -8660,6 +8807,7 @@ var Rive = /** @class */ (function () {
|
|
|
8660
8807
|
*
|
|
8661
8808
|
* @param elapsedTime time to advance the state machine by
|
|
8662
8809
|
* @param frameTime the rAF timestamp; omitted by pointer drains, which skip gamepad polling.
|
|
8810
|
+
* @returns false when only state machines are playing and none has anything left to animate
|
|
8663
8811
|
*/
|
|
8664
8812
|
Rive.prototype.advanceAndReportChanges = function (elapsedTime, frameTime) {
|
|
8665
8813
|
var _a, _b, _c, _d;
|
|
@@ -8682,10 +8830,11 @@ var Rive = /** @class */ (function () {
|
|
|
8682
8830
|
// - Advance non-paused state machines by the elapsed number of seconds
|
|
8683
8831
|
// - Advance to the first frame even when autoplay is false
|
|
8684
8832
|
var activeStateMachines = this.animator.stateMachines.filter(function (a) { return a.playing; });
|
|
8833
|
+
var needsAdvance = activeAnimations.length > 0 || activeStateMachines.length === 0;
|
|
8685
8834
|
// Gamepad input lands before this frame's advance.
|
|
8686
8835
|
// Also, frameTime is not passed for other places this function is called (i.e. after pointer events)
|
|
8687
8836
|
if (frameTime !== undefined) {
|
|
8688
|
-
(_a = this._gamepadInteractions) === null || _a === void 0 ? void 0 : _a.handleGamepadInputs(frameTime, (_b =
|
|
8837
|
+
(_a = this._gamepadInteractions) === null || _a === void 0 ? void 0 : _a.handleGamepadInputs(frameTime, (_b = this.gamepadStateMachine) === null || _b === void 0 ? void 0 : _b.instance);
|
|
8689
8838
|
}
|
|
8690
8839
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
8691
8840
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
@@ -8726,7 +8875,9 @@ var Rive = /** @class */ (function () {
|
|
|
8726
8875
|
}
|
|
8727
8876
|
if (_perfFrame >= 0)
|
|
8728
8877
|
performance.mark("rive:sm-advance:start:f".concat(_perfFrame));
|
|
8729
|
-
stateMachine.advanceAndApply(elapsedTime)
|
|
8878
|
+
if (stateMachine.advanceAndApply(elapsedTime) !== false) {
|
|
8879
|
+
needsAdvance = true;
|
|
8880
|
+
}
|
|
8730
8881
|
if (_perfFrame >= 0) {
|
|
8731
8882
|
performance.mark("rive:sm-advance:end:f".concat(_perfFrame));
|
|
8732
8883
|
performance.measure("rive:sm-advance:f".concat(_perfFrame), "rive:sm-advance:start:f".concat(_perfFrame), "rive:sm-advance:end:f".concat(_perfFrame));
|
|
@@ -8762,7 +8913,7 @@ var Rive = /** @class */ (function () {
|
|
|
8762
8913
|
return mainSm_1.focusSemanticNode(nodeId);
|
|
8763
8914
|
},
|
|
8764
8915
|
clearFocus: function () {
|
|
8765
|
-
return mainSm_1.
|
|
8916
|
+
return mainSm_1.clearFocus();
|
|
8766
8917
|
},
|
|
8767
8918
|
});
|
|
8768
8919
|
}
|
|
@@ -8812,13 +8963,14 @@ var Rive = /** @class */ (function () {
|
|
|
8812
8963
|
instance.handleCallbacks();
|
|
8813
8964
|
}
|
|
8814
8965
|
});
|
|
8966
|
+
return needsAdvance;
|
|
8815
8967
|
};
|
|
8816
8968
|
/**
|
|
8817
8969
|
* Draw rendering loop; renders animation frames at the correct time interval.
|
|
8818
8970
|
* @param time the rAF timestamp, or null to draw now without advancing
|
|
8819
8971
|
*/
|
|
8820
8972
|
Rive.prototype.draw = function (time, onSecond) {
|
|
8821
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8973
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8822
8974
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
8823
8975
|
this.frameRequestId = null;
|
|
8824
8976
|
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
@@ -8826,9 +8978,22 @@ var Rive = /** @class */ (function () {
|
|
|
8826
8978
|
if (!this.artboard) {
|
|
8827
8979
|
return;
|
|
8828
8980
|
}
|
|
8981
|
+
// While settled, a timed frame only polls gamepads; pad input or an
|
|
8982
|
+
// out-of-frame draw wakes.
|
|
8983
|
+
if (this.isInSettledInstances) {
|
|
8984
|
+
var padInput = time !== null &&
|
|
8985
|
+
!!((_a = this._gamepadInteractions) === null || _a === void 0 ? void 0 : _a.handleGamepadInputs(time, (_b = this.gamepadStateMachine) === null || _b === void 0 ? void 0 : _b.instance));
|
|
8986
|
+
if (time !== null && !padInput) {
|
|
8987
|
+
if (this.needsNextFrame) {
|
|
8988
|
+
this.scheduleRendering();
|
|
8989
|
+
}
|
|
8990
|
+
return;
|
|
8991
|
+
}
|
|
8992
|
+
this.removeFromSettledInstances();
|
|
8993
|
+
}
|
|
8829
8994
|
// The replay worker's context came back empty, so everything it held has
|
|
8830
8995
|
// to be recorded again through a fresh renderer and session.
|
|
8831
|
-
if (((
|
|
8996
|
+
if (((_d = (_c = this.renderer) === null || _c === void 0 ? void 0 : _c.contextRestored) === null || _d === void 0 ? void 0 : _d.call(_c)) === true) {
|
|
8832
8997
|
this.reloadForRestoredContext();
|
|
8833
8998
|
return;
|
|
8834
8999
|
}
|
|
@@ -8836,8 +9001,8 @@ var Rive = /** @class */ (function () {
|
|
|
8836
9001
|
// frames, or is slower than the display and this frame falls between its
|
|
8837
9002
|
// paced ones. Waiting keeps its queue bounded, and the frame that follows
|
|
8838
9003
|
// advances by the whole wait, so playback keeps time.
|
|
8839
|
-
var accepts = ((
|
|
8840
|
-
var replayMs = (
|
|
9004
|
+
var accepts = ((_f = (_e = this.renderer) === null || _e === void 0 ? void 0 : _e.acceptsFrame) === null || _f === void 0 ? void 0 : _f.call(_e)) !== false;
|
|
9005
|
+
var replayMs = (_h = (_g = this.renderer) === null || _g === void 0 ? void 0 : _g.replayMs) === null || _h === void 0 ? void 0 : _h.call(_g);
|
|
8841
9006
|
if (time !== null && replayMs !== undefined
|
|
8842
9007
|
? !this.replayPacer.shouldRecord(time, replayMs, accepts)
|
|
8843
9008
|
: !accepts) {
|
|
@@ -8872,11 +9037,24 @@ var Rive = /** @class */ (function () {
|
|
|
8872
9037
|
// Calculate the elapsed time between frames in seconds
|
|
8873
9038
|
var elapsedTime = (frameTime - this.lastRenderTime) / 1000;
|
|
8874
9039
|
this.lastRenderTime = frameTime;
|
|
8875
|
-
this.
|
|
9040
|
+
var wakeGenerationAtFrameStart = this._wakeGeneration;
|
|
9041
|
+
var assetGenerationAtFrameStart = assetGeneration;
|
|
9042
|
+
var needsAdvance = this.advanceAndReportChanges(elapsedTime, time);
|
|
8876
9043
|
var renderer = this.renderer;
|
|
8877
9044
|
// Don't draw on a 0-size canvas; redraw once it has area. The observer
|
|
8878
9045
|
// flags zero size late, so also check the surface itself.
|
|
8879
9046
|
var hasSurface = this.canvas.width > 0 && this.canvas.height > 0;
|
|
9047
|
+
// A 0-second advance always reports work, so only a timed frame can settle.
|
|
9048
|
+
// A frame that can't draw, or that saw a wake during its callbacks, keeps going.
|
|
9049
|
+
// Deferred work must be read before the renderer clears below.
|
|
9050
|
+
var settles = this._enableSettling &&
|
|
9051
|
+
time !== null &&
|
|
9052
|
+
elapsedTime > 0 &&
|
|
9053
|
+
hasSurface &&
|
|
9054
|
+
!needsAdvance &&
|
|
9055
|
+
this._wakeGeneration === wakeGenerationAtFrameStart &&
|
|
9056
|
+
assetGeneration === assetGenerationAtFrameStart &&
|
|
9057
|
+
!this._deferredWorkPending();
|
|
8880
9058
|
if (!hasSurface) {
|
|
8881
9059
|
this._needsRedraw = true;
|
|
8882
9060
|
}
|
|
@@ -8931,8 +9109,15 @@ var Rive = /** @class */ (function () {
|
|
|
8931
9109
|
// Calling requestAnimationFrame will rerun draw() at the correct rate:
|
|
8932
9110
|
// https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations
|
|
8933
9111
|
if (this.animator.isPlaying) {
|
|
8934
|
-
|
|
8935
|
-
|
|
9112
|
+
if (settles) {
|
|
9113
|
+
this.addToSettledInstances();
|
|
9114
|
+
// A wake restarts from elapsedTime 0 instead of the time spent settled.
|
|
9115
|
+
this.lastRenderTime = 0;
|
|
9116
|
+
}
|
|
9117
|
+
if (this.needsNextFrame) {
|
|
9118
|
+
// Request a new rendering frame
|
|
9119
|
+
this.scheduleRendering();
|
|
9120
|
+
}
|
|
8936
9121
|
}
|
|
8937
9122
|
else if (this.animator.isPaused) {
|
|
8938
9123
|
// Reset the end time so on playback it starts at the correct frame
|
|
@@ -8985,8 +9170,13 @@ var Rive = /** @class */ (function () {
|
|
|
8985
9170
|
* Rive class
|
|
8986
9171
|
*/
|
|
8987
9172
|
Rive.prototype.cleanup = function () {
|
|
8988
|
-
var
|
|
9173
|
+
var _this = this;
|
|
9174
|
+
var _a, _b, _c, _d;
|
|
9175
|
+
if (this._enableSettling && !this.destroyed) {
|
|
9176
|
+
settlingEnabledInstanceCount--;
|
|
9177
|
+
}
|
|
8989
9178
|
this.destroyed = true;
|
|
9179
|
+
this.removeFromSettledInstances();
|
|
8990
9180
|
// Stop the renderer if it hasn't already been stopped.
|
|
8991
9181
|
this.stopRendering();
|
|
8992
9182
|
// Make the GL context backing this renderer current before any WASM teardown
|
|
@@ -9019,9 +9209,11 @@ var Rive = /** @class */ (function () {
|
|
|
9019
9209
|
document.removeEventListener('visibilitychange', this._pageVisibilityHandler);
|
|
9020
9210
|
this._pageVisibilityHandler = null;
|
|
9021
9211
|
}
|
|
9022
|
-
(
|
|
9212
|
+
this.releaseViewModelInstance(this._viewModelInstance);
|
|
9023
9213
|
this._viewModelInstance = null;
|
|
9024
|
-
this._globalViewModelInstances.forEach(function (instance) {
|
|
9214
|
+
this._globalViewModelInstances.forEach(function (instance) {
|
|
9215
|
+
return _this.releaseViewModelInstance(instance);
|
|
9216
|
+
});
|
|
9025
9217
|
this._globalViewModelInstances.clear();
|
|
9026
9218
|
this._dataEnums = null;
|
|
9027
9219
|
};
|
|
@@ -9151,6 +9343,7 @@ var Rive = /** @class */ (function () {
|
|
|
9151
9343
|
* @param textRunValue - String value to set on the text run node
|
|
9152
9344
|
*/
|
|
9153
9345
|
Rive.prototype.setTextRunValue = function (textRunName, textRunValue) {
|
|
9346
|
+
this.wake();
|
|
9154
9347
|
warnOnce(DeprecationKeys.textRuns, textRunsDeprecationWarning);
|
|
9155
9348
|
var textRun = this.retrieveTextRun(textRunName);
|
|
9156
9349
|
if (textRun) {
|
|
@@ -9224,6 +9417,7 @@ var Rive = /** @class */ (function () {
|
|
|
9224
9417
|
}
|
|
9225
9418
|
this.cleanupKeyboardInteractions();
|
|
9226
9419
|
this.animator.pause(names);
|
|
9420
|
+
this.removeFromSettledInstancesIfNotPlaying();
|
|
9227
9421
|
this.warnIfLinearAnimationNames(names, "pause");
|
|
9228
9422
|
};
|
|
9229
9423
|
/**
|
|
@@ -9279,6 +9473,7 @@ var Rive = /** @class */ (function () {
|
|
|
9279
9473
|
}
|
|
9280
9474
|
this.cleanupKeyboardInteractions();
|
|
9281
9475
|
this.cleanupSemantics();
|
|
9476
|
+
this.removeFromSettledInstancesIfNotPlaying();
|
|
9282
9477
|
};
|
|
9283
9478
|
/**
|
|
9284
9479
|
* Resets the animation
|
|
@@ -9330,6 +9525,7 @@ var Rive = /** @class */ (function () {
|
|
|
9330
9525
|
},
|
|
9331
9526
|
// Sets a new layout
|
|
9332
9527
|
set: function (layout) {
|
|
9528
|
+
this.wake();
|
|
9333
9529
|
this._layout = layout;
|
|
9334
9530
|
this.reportDisplayScale();
|
|
9335
9531
|
// Fit/alignment/bounds feed the overlay transform.
|
|
@@ -9350,6 +9546,7 @@ var Rive = /** @class */ (function () {
|
|
|
9350
9546
|
* when the canvas is resized
|
|
9351
9547
|
*/
|
|
9352
9548
|
Rive.prototype.resizeToCanvas = function () {
|
|
9549
|
+
this.wake();
|
|
9353
9550
|
this._layout = this.layout.copyWith({
|
|
9354
9551
|
minX: 0,
|
|
9355
9552
|
minY: 0,
|
|
@@ -9512,6 +9709,7 @@ var Rive = /** @class */ (function () {
|
|
|
9512
9709
|
* @param path the path the input is located at an artboard level
|
|
9513
9710
|
*/
|
|
9514
9711
|
Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {
|
|
9712
|
+
this.wake();
|
|
9515
9713
|
warnOnce(DeprecationKeys.stateMachineInputs, stateMachineInputsDeprecationWarning);
|
|
9516
9714
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
9517
9715
|
if (!input)
|
|
@@ -9534,6 +9732,7 @@ var Rive = /** @class */ (function () {
|
|
|
9534
9732
|
* @param path the path the input is located at an artboard level
|
|
9535
9733
|
*/
|
|
9536
9734
|
Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {
|
|
9735
|
+
this.wake();
|
|
9537
9736
|
warnOnce(DeprecationKeys.stateMachineInputs, stateMachineInputsDeprecationWarning);
|
|
9538
9737
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
9539
9738
|
if (!input)
|
|
@@ -9555,6 +9754,7 @@ var Rive = /** @class */ (function () {
|
|
|
9555
9754
|
* @param path the path the input is located at an artboard level
|
|
9556
9755
|
*/
|
|
9557
9756
|
Rive.prototype.fireStateAtPath = function (inputName, path) {
|
|
9757
|
+
this.wake();
|
|
9558
9758
|
warnOnce(DeprecationKeys.stateMachineInputs, stateMachineInputsDeprecationWarning);
|
|
9559
9759
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
9560
9760
|
if (!input)
|
|
@@ -9640,6 +9840,7 @@ var Rive = /** @class */ (function () {
|
|
|
9640
9840
|
* for how to migrate.
|
|
9641
9841
|
*/
|
|
9642
9842
|
Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
|
|
9843
|
+
this.wake();
|
|
9643
9844
|
warnOnce(DeprecationKeys.textRuns, textRunsDeprecationWarning);
|
|
9644
9845
|
var run = this.retrieveTextAtPath(textName, path);
|
|
9645
9846
|
if (!run) {
|
|
@@ -9843,6 +10044,69 @@ var Rive = /** @class */ (function () {
|
|
|
9843
10044
|
this._explicitlyStoppedRendering = false;
|
|
9844
10045
|
this.drawFrame();
|
|
9845
10046
|
};
|
|
10047
|
+
Object.defineProperty(Rive.prototype, "isSettled", {
|
|
10048
|
+
/**
|
|
10049
|
+
* True while `enableSettling` has stopped the render loop because every
|
|
10050
|
+
* playing state machine has nothing left to animate. Not set by `pause()`
|
|
10051
|
+
* or `stopRendering()`.
|
|
10052
|
+
*/
|
|
10053
|
+
get: function () {
|
|
10054
|
+
var _a;
|
|
10055
|
+
return this.isInSettledInstances && !!((_a = this.animator) === null || _a === void 0 ? void 0 : _a.isPlaying);
|
|
10056
|
+
},
|
|
10057
|
+
enumerable: false,
|
|
10058
|
+
configurable: true
|
|
10059
|
+
});
|
|
10060
|
+
Object.defineProperty(Rive.prototype, "isInSettledInstances", {
|
|
10061
|
+
get: function () {
|
|
10062
|
+
return settledInstances.has(this);
|
|
10063
|
+
},
|
|
10064
|
+
enumerable: false,
|
|
10065
|
+
configurable: true
|
|
10066
|
+
});
|
|
10067
|
+
Rive.prototype.addToSettledInstances = function () {
|
|
10068
|
+
settledInstances.add(this);
|
|
10069
|
+
};
|
|
10070
|
+
Rive.prototype.removeFromSettledInstances = function () {
|
|
10071
|
+
settledInstances.delete(this);
|
|
10072
|
+
};
|
|
10073
|
+
// A paused or stopped loop isn't settled: wakes leave it alone until play()
|
|
10074
|
+
// starts rendering again, as they do when settling is off.
|
|
10075
|
+
Rive.prototype.removeFromSettledInstancesIfNotPlaying = function () {
|
|
10076
|
+
var _a;
|
|
10077
|
+
if (!((_a = this.animator) === null || _a === void 0 ? void 0 : _a.isPlaying)) {
|
|
10078
|
+
this.removeFromSettledInstances();
|
|
10079
|
+
}
|
|
10080
|
+
};
|
|
10081
|
+
Object.defineProperty(Rive.prototype, "needsNextFrame", {
|
|
10082
|
+
/** Whether the loop needs another frame: always, unless settled with no gamepad to poll. */
|
|
10083
|
+
get: function () {
|
|
10084
|
+
var _a, _b;
|
|
10085
|
+
return (!this.isInSettledInstances ||
|
|
10086
|
+
(!!((_a = this.animator) === null || _a === void 0 ? void 0 : _a.isPlaying) && !!((_b = this._gamepadInteractions) === null || _b === void 0 ? void 0 : _b.isPolling)));
|
|
10087
|
+
},
|
|
10088
|
+
enumerable: false,
|
|
10089
|
+
configurable: true
|
|
10090
|
+
});
|
|
10091
|
+
Object.defineProperty(Rive.prototype, "gamepadStateMachine", {
|
|
10092
|
+
/** The state machine that receives gamepad input. */
|
|
10093
|
+
get: function () {
|
|
10094
|
+
return this.animator.stateMachines.find(function (sm) { return sm.playing; });
|
|
10095
|
+
},
|
|
10096
|
+
enumerable: false,
|
|
10097
|
+
configurable: true
|
|
10098
|
+
});
|
|
10099
|
+
/** Records a change, and restarts the loop if it stopped because it settled. */
|
|
10100
|
+
Rive.prototype.wake = function () {
|
|
10101
|
+
this._wakeGeneration++;
|
|
10102
|
+
if (!this.isInSettledInstances) {
|
|
10103
|
+
return;
|
|
10104
|
+
}
|
|
10105
|
+
this.removeFromSettledInstances();
|
|
10106
|
+
if (!this._explicitlyStoppedRendering) {
|
|
10107
|
+
this.scheduleRendering();
|
|
10108
|
+
}
|
|
10109
|
+
};
|
|
9846
10110
|
Rive.prototype.scheduleRendering = function () {
|
|
9847
10111
|
var _a, _b;
|
|
9848
10112
|
if (this.loaded && this.artboard && !this.frameRequestId) {
|
|
@@ -9875,7 +10139,9 @@ var Rive = /** @class */ (function () {
|
|
|
9875
10139
|
// Reset so the first resumed frame starts with elapsedTime === 0.
|
|
9876
10140
|
this.lastRenderTime = 0;
|
|
9877
10141
|
}
|
|
9878
|
-
else if (((_b = this.animator) === null || _b === void 0 ? void 0 : _b.isPlaying) &&
|
|
10142
|
+
else if (((_b = this.animator) === null || _b === void 0 ? void 0 : _b.isPlaying) &&
|
|
10143
|
+
!this._explicitlyStoppedRendering &&
|
|
10144
|
+
this.needsNextFrame) {
|
|
9879
10145
|
this.scheduleRendering();
|
|
9880
10146
|
}
|
|
9881
10147
|
};
|
|
@@ -9975,6 +10241,7 @@ var Rive = /** @class */ (function () {
|
|
|
9975
10241
|
return (_a = this._artboardWidth) !== null && _a !== void 0 ? _a : 0;
|
|
9976
10242
|
},
|
|
9977
10243
|
set: function (value) {
|
|
10244
|
+
this.wake();
|
|
9978
10245
|
this._artboardWidth = value;
|
|
9979
10246
|
if (this.artboard) {
|
|
9980
10247
|
this.artboard.width = value;
|
|
@@ -10002,6 +10269,7 @@ var Rive = /** @class */ (function () {
|
|
|
10002
10269
|
return (_a = this._artboardHeight) !== null && _a !== void 0 ? _a : 0;
|
|
10003
10270
|
},
|
|
10004
10271
|
set: function (value) {
|
|
10272
|
+
this.wake();
|
|
10005
10273
|
this._artboardHeight = value;
|
|
10006
10274
|
if (this.artboard) {
|
|
10007
10275
|
this.artboard.height = value;
|
|
@@ -10014,6 +10282,7 @@ var Rive = /** @class */ (function () {
|
|
|
10014
10282
|
* Reset the artboard size to its original values.
|
|
10015
10283
|
*/
|
|
10016
10284
|
Rive.prototype.resetArtboardSize = function () {
|
|
10285
|
+
this.wake();
|
|
10017
10286
|
if (this.artboard) {
|
|
10018
10287
|
this.artboard.resetArtboardSize();
|
|
10019
10288
|
this._artboardWidth = this.artboard.width;
|
|
@@ -10036,6 +10305,7 @@ var Rive = /** @class */ (function () {
|
|
|
10036
10305
|
return this._devicePixelRatioUsed;
|
|
10037
10306
|
},
|
|
10038
10307
|
set: function (value) {
|
|
10308
|
+
this.wake();
|
|
10039
10309
|
if (value !== this._devicePixelRatioUsed) {
|
|
10040
10310
|
this._overlayTransformDirty = true;
|
|
10041
10311
|
}
|
|
@@ -10096,6 +10366,7 @@ var Rive = /** @class */ (function () {
|
|
|
10096
10366
|
* `setViewModelInstance(vmi)` followed by `bind()`.
|
|
10097
10367
|
*/
|
|
10098
10368
|
Rive.prototype.bindViewModelInstance = function (viewModelInstance) {
|
|
10369
|
+
this.wake();
|
|
10099
10370
|
if (!viewModelInstance) {
|
|
10100
10371
|
return;
|
|
10101
10372
|
}
|
|
@@ -10108,7 +10379,7 @@ var Rive = /** @class */ (function () {
|
|
|
10108
10379
|
* to batch multiple changes into a single rebind.
|
|
10109
10380
|
*/
|
|
10110
10381
|
Rive.prototype.setViewModelInstance = function (viewModelInstance) {
|
|
10111
|
-
|
|
10382
|
+
this.wake();
|
|
10112
10383
|
var runtimeInstance = viewModelInstance === null || viewModelInstance === void 0 ? void 0 : viewModelInstance.runtimeInstance;
|
|
10113
10384
|
if (!this.artboard ||
|
|
10114
10385
|
this.destroyed ||
|
|
@@ -10116,8 +10387,7 @@ var Rive = /** @class */ (function () {
|
|
|
10116
10387
|
!runtimeInstance) {
|
|
10117
10388
|
return;
|
|
10118
10389
|
}
|
|
10119
|
-
viewModelInstance.
|
|
10120
|
-
(_a = this._viewModelInstance) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
10390
|
+
this.holdViewModelInstance(viewModelInstance, this._viewModelInstance);
|
|
10121
10391
|
this._viewModelInstance = viewModelInstance;
|
|
10122
10392
|
if (this.animator.stateMachines.length > 0) {
|
|
10123
10393
|
this.animator.stateMachines.forEach(function (stateMachine) {
|
|
@@ -10128,12 +10398,25 @@ var Rive = /** @class */ (function () {
|
|
|
10128
10398
|
this.artboard.setViewModelInstance(runtimeInstance);
|
|
10129
10399
|
}
|
|
10130
10400
|
};
|
|
10401
|
+
/** Takes a reference to `next` in place of `previous`; with settling on, writes to `next` wake this instance. */
|
|
10402
|
+
Rive.prototype.holdViewModelInstance = function (next, previous) {
|
|
10403
|
+
next.internalIncrementReferenceCount();
|
|
10404
|
+
this.releaseViewModelInstance(previous);
|
|
10405
|
+
if (this._enableSettling) {
|
|
10406
|
+
next.internalAddWakeCallback(this._wakeFromViewModel);
|
|
10407
|
+
}
|
|
10408
|
+
};
|
|
10409
|
+
Rive.prototype.releaseViewModelInstance = function (instance) {
|
|
10410
|
+
instance === null || instance === void 0 ? void 0 : instance.internalRemoveWakeCallback(this._wakeFromViewModel);
|
|
10411
|
+
instance === null || instance === void 0 ? void 0 : instance.cleanup();
|
|
10412
|
+
};
|
|
10131
10413
|
/**
|
|
10132
10414
|
* Applies any pending `set*` view model instance changes by rebinding the
|
|
10133
10415
|
* data binds once.
|
|
10134
10416
|
* Implicitly creates and binds any view models that have not been set.
|
|
10135
10417
|
*/
|
|
10136
10418
|
Rive.prototype.bind = function () {
|
|
10419
|
+
this.wake();
|
|
10137
10420
|
if (!this.artboard || this.destroyed) {
|
|
10138
10421
|
return;
|
|
10139
10422
|
}
|
|
@@ -10164,7 +10447,7 @@ var Rive = /** @class */ (function () {
|
|
|
10164
10447
|
* global view model in the file)
|
|
10165
10448
|
*/
|
|
10166
10449
|
Rive.prototype.setGlobalViewModelInstance = function (name, viewModelInstance) {
|
|
10167
|
-
|
|
10450
|
+
this.wake();
|
|
10168
10451
|
var runtimeInstance = viewModelInstance === null || viewModelInstance === void 0 ? void 0 : viewModelInstance.runtimeInstance;
|
|
10169
10452
|
if (!this.artboard || this.destroyed || !runtimeInstance) {
|
|
10170
10453
|
return false;
|
|
@@ -10181,8 +10464,7 @@ var Rive = /** @class */ (function () {
|
|
|
10181
10464
|
bound = this.artboard.setGlobalViewModelInstance(name, runtimeInstance);
|
|
10182
10465
|
}
|
|
10183
10466
|
if (bound) {
|
|
10184
|
-
viewModelInstance.
|
|
10185
|
-
(_a = this._globalViewModelInstances.get(name)) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
10467
|
+
this.holdViewModelInstance(viewModelInstance, this._globalViewModelInstances.get(name));
|
|
10186
10468
|
this._globalViewModelInstances.set(name, viewModelInstance);
|
|
10187
10469
|
}
|
|
10188
10470
|
return bound;
|
|
@@ -10213,7 +10495,7 @@ var Rive = /** @class */ (function () {
|
|
|
10213
10495
|
}
|
|
10214
10496
|
var viewModelInstance = new ViewModelInstance(runtimeInstance, null);
|
|
10215
10497
|
(0,_utils__WEBPACK_IMPORTED_MODULE_3__.createFinalization)(viewModelInstance, runtimeInstance);
|
|
10216
|
-
|
|
10498
|
+
this.holdViewModelInstance(viewModelInstance, undefined);
|
|
10217
10499
|
this._globalViewModelInstances.set(name, viewModelInstance);
|
|
10218
10500
|
return viewModelInstance;
|
|
10219
10501
|
};
|
|
@@ -10287,6 +10569,13 @@ var Rive = /** @class */ (function () {
|
|
|
10287
10569
|
Rive.missingErrorMessage = "Rive source file or data buffer required";
|
|
10288
10570
|
// Error message for removed rive file
|
|
10289
10571
|
Rive.cleanupErrorMessage = "Attempt to use file after calling cleanup.";
|
|
10572
|
+
// Asset changes have no owning instance, so they wake every settled one;
|
|
10573
|
+
// a frame running now sees assetGeneration move.
|
|
10574
|
+
Rive.wakeSettledInstances = function () {
|
|
10575
|
+
assetGeneration++;
|
|
10576
|
+
// Waking removes the instance from the set.
|
|
10577
|
+
Array.from(settledInstances).forEach(function (rive) { return rive.wake(); });
|
|
10578
|
+
};
|
|
10290
10579
|
// performance.now() at the current rAF batch's start; first frames seed from it.
|
|
10291
10580
|
Rive.batchStart = { time: -1, now: 0 };
|
|
10292
10581
|
return Rive;
|
|
@@ -10420,6 +10709,9 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
10420
10709
|
this._viewModelInstances = new Map();
|
|
10421
10710
|
this._propertiesWithCallbacks = [];
|
|
10422
10711
|
this._referenceCount = 0;
|
|
10712
|
+
// One per Rive instance this is bound to as its main or a global instance,
|
|
10713
|
+
// with how many of that instance's slots hold this.
|
|
10714
|
+
this._wakeCallbacks = null;
|
|
10423
10715
|
this.selfUnref = false;
|
|
10424
10716
|
this._runtimeInstance = runtimeInstance;
|
|
10425
10717
|
if (parent !== null) {
|
|
@@ -10451,6 +10743,53 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
10451
10743
|
}
|
|
10452
10744
|
this._children.forEach(function (child) { return child.handleCallbacks(); });
|
|
10453
10745
|
};
|
|
10746
|
+
/*
|
|
10747
|
+
* method for internal use, it shouldn't be called externally
|
|
10748
|
+
*/
|
|
10749
|
+
ViewModelInstance.prototype.internalAddWakeCallback = function (callback) {
|
|
10750
|
+
var _a;
|
|
10751
|
+
if (!this._wakeCallbacks) {
|
|
10752
|
+
this._wakeCallbacks = new Map();
|
|
10753
|
+
}
|
|
10754
|
+
this._wakeCallbacks.set(callback, ((_a = this._wakeCallbacks.get(callback)) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
10755
|
+
};
|
|
10756
|
+
/*
|
|
10757
|
+
* method for internal use, it shouldn't be called externally
|
|
10758
|
+
*/
|
|
10759
|
+
ViewModelInstance.prototype.internalRemoveWakeCallback = function (callback) {
|
|
10760
|
+
var _a;
|
|
10761
|
+
var count = (_a = this._wakeCallbacks) === null || _a === void 0 ? void 0 : _a.get(callback);
|
|
10762
|
+
if (count === undefined) {
|
|
10763
|
+
return;
|
|
10764
|
+
}
|
|
10765
|
+
if (count > 1) {
|
|
10766
|
+
this._wakeCallbacks.set(callback, count - 1);
|
|
10767
|
+
}
|
|
10768
|
+
else {
|
|
10769
|
+
this._wakeCallbacks.delete(callback);
|
|
10770
|
+
}
|
|
10771
|
+
};
|
|
10772
|
+
/*
|
|
10773
|
+
* method for internal use, it shouldn't be called externally.
|
|
10774
|
+
* Wakes every Rive instance this is bound to, directly or through any parent.
|
|
10775
|
+
*/
|
|
10776
|
+
ViewModelInstance.prototype.internalWake = function () {
|
|
10777
|
+
// Only an instance with settling on has anything to wake, including one
|
|
10778
|
+
// mid-frame that hasn't settled yet.
|
|
10779
|
+
if (settlingEnabledInstanceCount > 0) {
|
|
10780
|
+
this.wakeOwners(new Set());
|
|
10781
|
+
}
|
|
10782
|
+
};
|
|
10783
|
+
ViewModelInstance.prototype.wakeOwners = function (visited) {
|
|
10784
|
+
var _a;
|
|
10785
|
+
if (visited.has(this)) {
|
|
10786
|
+
return;
|
|
10787
|
+
}
|
|
10788
|
+
visited.add(this);
|
|
10789
|
+
(_a = this._wakeCallbacks) === null || _a === void 0 ? void 0 : _a.forEach(function (_count, callback) { return callback(); });
|
|
10790
|
+
// Walks the parent chain and wakes all Rive instance owners of that instance
|
|
10791
|
+
this._parents.forEach(function (parent) { return parent.wakeOwners(visited); });
|
|
10792
|
+
};
|
|
10454
10793
|
ViewModelInstance.prototype.addParent = function (parent) {
|
|
10455
10794
|
if (!this._parents.includes(parent)) {
|
|
10456
10795
|
this._parents.push(parent);
|
|
@@ -10770,6 +11109,7 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
10770
11109
|
*/
|
|
10771
11110
|
ViewModelInstance.prototype.replaceViewModel = function (path, value) {
|
|
10772
11111
|
var _a;
|
|
11112
|
+
this.internalWake();
|
|
10773
11113
|
var pathSegments = path.split("/");
|
|
10774
11114
|
var viewModelInstance = pathSegments.length > 1
|
|
10775
11115
|
? this.viewModelFromPathSegments(pathSegments.slice(0, pathSegments.length - 1), 0)
|
|
@@ -10875,6 +11215,10 @@ var ViewModelInstanceValue = /** @class */ (function () {
|
|
|
10875
11215
|
}
|
|
10876
11216
|
};
|
|
10877
11217
|
ViewModelInstanceValue.prototype.internalHandleCallback = function (callback) { };
|
|
11218
|
+
/** Wakes every Rive instance the owning view model instance is bound to. */
|
|
11219
|
+
ViewModelInstanceValue.prototype.wakeOwners = function () {
|
|
11220
|
+
this._parentViewModel.internalWake();
|
|
11221
|
+
};
|
|
10878
11222
|
ViewModelInstanceValue.prototype.handleCallbacks = function () {
|
|
10879
11223
|
var _this = this;
|
|
10880
11224
|
if (this._viewModelInstanceValue.hasChanged) {
|
|
@@ -10909,6 +11253,7 @@ var ViewModelInstanceString = /** @class */ (function (_super) {
|
|
|
10909
11253
|
return this._viewModelInstanceValue.value;
|
|
10910
11254
|
},
|
|
10911
11255
|
set: function (val) {
|
|
11256
|
+
this.wakeOwners();
|
|
10912
11257
|
this._viewModelInstanceValue.value = val;
|
|
10913
11258
|
},
|
|
10914
11259
|
enumerable: false,
|
|
@@ -10930,6 +11275,7 @@ var ViewModelInstanceNumber = /** @class */ (function (_super) {
|
|
|
10930
11275
|
return this._viewModelInstanceValue.value;
|
|
10931
11276
|
},
|
|
10932
11277
|
set: function (val) {
|
|
11278
|
+
this.wakeOwners();
|
|
10933
11279
|
this._viewModelInstanceValue.value = val;
|
|
10934
11280
|
},
|
|
10935
11281
|
enumerable: false,
|
|
@@ -10951,6 +11297,7 @@ var ViewModelInstanceBoolean = /** @class */ (function (_super) {
|
|
|
10951
11297
|
return this._viewModelInstanceValue.value;
|
|
10952
11298
|
},
|
|
10953
11299
|
set: function (val) {
|
|
11300
|
+
this.wakeOwners();
|
|
10954
11301
|
this._viewModelInstanceValue.value = val;
|
|
10955
11302
|
},
|
|
10956
11303
|
enumerable: false,
|
|
@@ -10968,6 +11315,7 @@ var ViewModelInstanceTrigger = /** @class */ (function (_super) {
|
|
|
10968
11315
|
return _super.call(this, instance, parent) || this;
|
|
10969
11316
|
}
|
|
10970
11317
|
ViewModelInstanceTrigger.prototype.trigger = function () {
|
|
11318
|
+
this.wakeOwners();
|
|
10971
11319
|
return this._viewModelInstanceValue.trigger();
|
|
10972
11320
|
};
|
|
10973
11321
|
ViewModelInstanceTrigger.prototype.internalHandleCallback = function (callback) {
|
|
@@ -10986,6 +11334,7 @@ var ViewModelInstanceEnum = /** @class */ (function (_super) {
|
|
|
10986
11334
|
return this._viewModelInstanceValue.value;
|
|
10987
11335
|
},
|
|
10988
11336
|
set: function (val) {
|
|
11337
|
+
this.wakeOwners();
|
|
10989
11338
|
this._viewModelInstanceValue.value = val;
|
|
10990
11339
|
},
|
|
10991
11340
|
enumerable: false,
|
|
@@ -10997,6 +11346,7 @@ var ViewModelInstanceEnum = /** @class */ (function (_super) {
|
|
|
10997
11346
|
.valueIndex;
|
|
10998
11347
|
},
|
|
10999
11348
|
set: function (val) {
|
|
11349
|
+
this.wakeOwners();
|
|
11000
11350
|
this._viewModelInstanceValue.valueIndex = val;
|
|
11001
11351
|
},
|
|
11002
11352
|
enumerable: false,
|
|
@@ -11028,12 +11378,14 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
11028
11378
|
configurable: true
|
|
11029
11379
|
});
|
|
11030
11380
|
ViewModelInstanceList.prototype.addInstance = function (instance) {
|
|
11381
|
+
this.wakeOwners();
|
|
11031
11382
|
if (instance.runtimeInstance != null) {
|
|
11032
11383
|
this._viewModelInstanceValue.addInstance(instance.runtimeInstance);
|
|
11033
11384
|
instance.addParent(this._parentViewModel);
|
|
11034
11385
|
}
|
|
11035
11386
|
};
|
|
11036
11387
|
ViewModelInstanceList.prototype.addInstanceAt = function (instance, index) {
|
|
11388
|
+
this.wakeOwners();
|
|
11037
11389
|
if (instance.runtimeInstance != null) {
|
|
11038
11390
|
if (this._viewModelInstanceValue.addInstanceAt(instance.runtimeInstance, index)) {
|
|
11039
11391
|
instance.addParent(this._parentViewModel);
|
|
@@ -11043,12 +11395,14 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
11043
11395
|
return false;
|
|
11044
11396
|
};
|
|
11045
11397
|
ViewModelInstanceList.prototype.removeInstance = function (instance) {
|
|
11398
|
+
this.wakeOwners();
|
|
11046
11399
|
if (instance.runtimeInstance != null) {
|
|
11047
11400
|
this._viewModelInstanceValue.removeInstance(instance.runtimeInstance);
|
|
11048
11401
|
instance.removeParent(this._parentViewModel);
|
|
11049
11402
|
}
|
|
11050
11403
|
};
|
|
11051
11404
|
ViewModelInstanceList.prototype.removeInstanceAt = function (index) {
|
|
11405
|
+
this.wakeOwners();
|
|
11052
11406
|
this._viewModelInstanceValue.removeInstanceAt(index);
|
|
11053
11407
|
};
|
|
11054
11408
|
ViewModelInstanceList.prototype.instanceAt = function (index) {
|
|
@@ -11061,6 +11415,7 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
11061
11415
|
return null;
|
|
11062
11416
|
};
|
|
11063
11417
|
ViewModelInstanceList.prototype.swap = function (a, b) {
|
|
11418
|
+
this.wakeOwners();
|
|
11064
11419
|
this._viewModelInstanceValue.swap(a, b);
|
|
11065
11420
|
};
|
|
11066
11421
|
ViewModelInstanceList.prototype.internalHandleCallback = function (callback) {
|
|
@@ -11079,26 +11434,32 @@ var ViewModelInstanceColor = /** @class */ (function (_super) {
|
|
|
11079
11434
|
return this._viewModelInstanceValue.value;
|
|
11080
11435
|
},
|
|
11081
11436
|
set: function (val) {
|
|
11437
|
+
this.wakeOwners();
|
|
11082
11438
|
this._viewModelInstanceValue.value = val;
|
|
11083
11439
|
},
|
|
11084
11440
|
enumerable: false,
|
|
11085
11441
|
configurable: true
|
|
11086
11442
|
});
|
|
11087
11443
|
ViewModelInstanceColor.prototype.rgb = function (r, g, b) {
|
|
11444
|
+
this.wakeOwners();
|
|
11088
11445
|
this._viewModelInstanceValue.rgb(r, g, b);
|
|
11089
11446
|
};
|
|
11090
11447
|
ViewModelInstanceColor.prototype.rgba = function (r, g, b, a) {
|
|
11448
|
+
this.wakeOwners();
|
|
11091
11449
|
this._viewModelInstanceValue.argb(a, r, g, b);
|
|
11092
11450
|
};
|
|
11093
11451
|
ViewModelInstanceColor.prototype.argb = function (a, r, g, b) {
|
|
11452
|
+
this.wakeOwners();
|
|
11094
11453
|
this._viewModelInstanceValue.argb(a, r, g, b);
|
|
11095
11454
|
};
|
|
11096
11455
|
// Value 0 to 255
|
|
11097
11456
|
ViewModelInstanceColor.prototype.alpha = function (a) {
|
|
11457
|
+
this.wakeOwners();
|
|
11098
11458
|
this._viewModelInstanceValue.alpha(a);
|
|
11099
11459
|
};
|
|
11100
11460
|
// Value 0 to 1
|
|
11101
11461
|
ViewModelInstanceColor.prototype.opacity = function (o) {
|
|
11462
|
+
this.wakeOwners();
|
|
11102
11463
|
this._viewModelInstanceValue.alpha(Math.round(Math.max(0, Math.min(1, o)) * 255));
|
|
11103
11464
|
};
|
|
11104
11465
|
ViewModelInstanceColor.prototype.internalHandleCallback = function (callback) {
|
|
@@ -11115,6 +11476,7 @@ var ViewModelInstanceAssetImage = /** @class */ (function (_super) {
|
|
|
11115
11476
|
Object.defineProperty(ViewModelInstanceAssetImage.prototype, "value", {
|
|
11116
11477
|
set: function (image) {
|
|
11117
11478
|
var _a;
|
|
11479
|
+
this.wakeOwners();
|
|
11118
11480
|
this._viewModelInstanceValue.value((_a = image === null || image === void 0 ? void 0 : image.nativeImage) !== null && _a !== void 0 ? _a : null);
|
|
11119
11481
|
},
|
|
11120
11482
|
enumerable: false,
|
|
@@ -11134,6 +11496,7 @@ var ViewModelInstanceAssetFont = /** @class */ (function (_super) {
|
|
|
11134
11496
|
Object.defineProperty(ViewModelInstanceAssetFont.prototype, "value", {
|
|
11135
11497
|
set: function (font) {
|
|
11136
11498
|
var _a;
|
|
11499
|
+
this.wakeOwners();
|
|
11137
11500
|
this._viewModelInstanceValue.value((_a = font === null || font === void 0 ? void 0 : font.nativeFont) !== null && _a !== void 0 ? _a : null);
|
|
11138
11501
|
},
|
|
11139
11502
|
enumerable: false,
|
|
@@ -11153,6 +11516,7 @@ var ViewModelInstanceArtboard = /** @class */ (function (_super) {
|
|
|
11153
11516
|
Object.defineProperty(ViewModelInstanceArtboard.prototype, "value", {
|
|
11154
11517
|
set: function (artboard) {
|
|
11155
11518
|
var _a, _b;
|
|
11519
|
+
this.wakeOwners();
|
|
11156
11520
|
var bindableArtboard;
|
|
11157
11521
|
if (artboard.isBindableArtboard) {
|
|
11158
11522
|
bindableArtboard = artboard;
|