@rive-app/canvas-lite 2.50.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 +68 -1
- package/rive.js +702 -172
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +41 -9
- package/rive_fallback.wasm +0 -0
- package/runtimeLoader.d.ts +4 -6
- package/utils/gamepadInteractions.d.ts +9 -2
- package/utils/registerKeyboardInteractions.d.ts +4 -1
- package/utils/registerTouchInteractions.d.ts +2 -1
- package/utils/riveFont.d.ts +10 -1
- package/utils/wheelMomentum.d.ts +15 -0
package/rive.js
CHANGED
|
@@ -170,6 +170,15 @@ var __assign = (undefined && undefined.__assign) || function () {
|
|
|
170
170
|
};
|
|
171
171
|
return __assign.apply(this, arguments);
|
|
172
172
|
};
|
|
173
|
+
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
174
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
175
|
+
if (ar || !(i in from)) {
|
|
176
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
177
|
+
ar[i] = from[i];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
181
|
+
};
|
|
173
182
|
|
|
174
183
|
|
|
175
184
|
|
|
@@ -198,7 +207,6 @@ function threadsRefusal() {
|
|
|
198
207
|
}
|
|
199
208
|
return null;
|
|
200
209
|
}
|
|
201
|
-
var defaultScriptFetchRequestsPerMinute = 60;
|
|
202
210
|
// The runtime's ceiling for maxResponseBytes.
|
|
203
211
|
var maxScriptFetchResponseBytes = 64 * 1024 * 1024;
|
|
204
212
|
// A non-negative integer that fits in a uint32, else the fallback.
|
|
@@ -261,6 +269,22 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
261
269
|
}
|
|
262
270
|
RuntimeLoader.callBackQueue = [];
|
|
263
271
|
};
|
|
272
|
+
RuntimeLoader.setSystemLanguages = function (languages) {
|
|
273
|
+
RuntimeLoader.systemLanguages = languages;
|
|
274
|
+
RuntimeLoader.applySystemLanguages();
|
|
275
|
+
};
|
|
276
|
+
RuntimeLoader.applySystemLanguages = function () {
|
|
277
|
+
var _a, _b;
|
|
278
|
+
var rive = RuntimeLoader.runtime;
|
|
279
|
+
if (!rive) {
|
|
280
|
+
// Applied once it loads.
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
var languages = (_a = RuntimeLoader.systemLanguages) !== null && _a !== void 0 ? _a : (typeof navigator !== "undefined" && navigator.languages
|
|
284
|
+
? navigator.languages
|
|
285
|
+
: []);
|
|
286
|
+
(_b = rive.setSystemLanguages) === null || _b === void 0 ? void 0 : _b.call(rive, __spreadArray([], languages, true));
|
|
287
|
+
};
|
|
264
288
|
RuntimeLoader.loaded = function (rive) {
|
|
265
289
|
var _a, _b;
|
|
266
290
|
if (RuntimeLoader.enablePerfMarks) {
|
|
@@ -269,6 +293,17 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
269
293
|
}
|
|
270
294
|
RuntimeLoader.runtime = rive;
|
|
271
295
|
RuntimeLoader.applyParallelParts();
|
|
296
|
+
RuntimeLoader.applySystemLanguages();
|
|
297
|
+
if (!RuntimeLoader.listeningForLanguageChange &&
|
|
298
|
+
typeof window !== "undefined" &&
|
|
299
|
+
typeof window.addEventListener === "function") {
|
|
300
|
+
RuntimeLoader.listeningForLanguageChange = true;
|
|
301
|
+
window.addEventListener("languagechange", function () {
|
|
302
|
+
if (RuntimeLoader.systemLanguages === null) {
|
|
303
|
+
RuntimeLoader.applySystemLanguages();
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
272
307
|
RuntimeLoader.errorCallbackQueue = [];
|
|
273
308
|
// Before any callback can import a file, so its images reach the worker.
|
|
274
309
|
if (RuntimeLoader.replayWorker) {
|
|
@@ -577,7 +612,6 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
577
612
|
runtime.configureScriptFetch(options && {
|
|
578
613
|
proxyUrl: options.proxyUrl || null,
|
|
579
614
|
allowedHosts: (_a = options.allowedHosts) !== null && _a !== void 0 ? _a : null,
|
|
580
|
-
maxRequestsPerMinute: uint32Option(options.maxRequestsPerMinute, defaultScriptFetchRequestsPerMinute),
|
|
581
615
|
// 0 keeps the runtime's default.
|
|
582
616
|
maxResponseBytes: uint32Option(options.maxResponseBytes, 0),
|
|
583
617
|
});
|
|
@@ -628,6 +662,11 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
628
662
|
* WASM initialization.
|
|
629
663
|
*/
|
|
630
664
|
RuntimeLoader.enablePerfMarks = false;
|
|
665
|
+
// The languages text without one of its own shapes and falls back with,
|
|
666
|
+
// most preferred first. Null follows navigator.languages, including when
|
|
667
|
+
// the browser's change. See RiveFont.setSystemLanguages.
|
|
668
|
+
RuntimeLoader.systemLanguages = null;
|
|
669
|
+
RuntimeLoader.listeningForLanguageChange = false;
|
|
631
670
|
return RuntimeLoader;
|
|
632
671
|
}());
|
|
633
672
|
|
|
@@ -642,110 +681,111 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
642
681
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
643
682
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
644
683
|
/* harmony export */ });
|
|
645
|
-
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var
|
|
646
|
-
function da(){
|
|
647
|
-
"fixed",
|
|
648
|
-
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}}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
r(),la;
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
p.
|
|
661
|
-
0
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
case
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
k.
|
|
671
|
-
|
|
672
|
-
this.
|
|
673
|
-
this.
|
|
674
|
-
this.
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
b(
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
h.
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
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
|
+
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,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}
|
|
697
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)}
|
|
698
|
-
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}};
|
|
699
739
|
class kb extends Error{}
|
|
700
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):
|
|
701
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])}
|
|
702
|
-
var Bb={},Cb={},Db=class extends Error{constructor(b){super(b);this.name="InternalError"}},W=(b,a,c)=>{function d(
|
|
703
|
-
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(
|
|
704
|
-
var Ib={},Jb=(b,a,c)=>{if(void 0===b[a].u){var d=b[a];b[a]=function(...
|
|
705
|
-
|
|
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=[]}
|
|
706
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};
|
|
707
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)}
|
|
708
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");
|
|
709
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}
|
|
710
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)}
|
|
711
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}}))};
|
|
712
|
-
function Vb(b,a,c,d,
|
|
713
|
-
var Wb=(b,a,c)=>{if(!
|
|
714
|
-
var ic=(b,a)=>{function c(
|
|
715
|
-
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})}
|
|
716
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))},
|
|
717
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>>
|
|
718
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,
|
|
719
|
-
c));for(d="";a<c;){var
|
|
720
|
-
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=
|
|
721
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,[],[]];
|
|
722
|
-
(()=>{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=
|
|
723
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"])})();
|
|
724
|
-
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
|
|
725
|
-
Ub(d.h.O,{o:d,l:
|
|
726
|
-
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,
|
|
727
|
-
|
|
728
|
-
{var a=yb[b];delete yb[b];var c=a.Ia,d=a.P,
|
|
729
|
-
|
|
730
|
-
function(...R){if(Object.getPrototypeOf(this)!==E)throw new O(`Use 'new' to construct ${
|
|
731
|
-
H.C.ga.push(H)}C=new Vb(
|
|
732
|
-
null,
|
|
733
|
-
a,
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
v:(
|
|
738
|
-
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,
|
|
739
|
-
a,c,d,
|
|
740
|
-
(d=new Uint8Array(d));var
|
|
741
|
-
|
|
742
|
-
var
|
|
743
|
-
a=`methodCaller<(${
|
|
744
|
-
c,d,
|
|
745
|
-
{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
|
|
746
|
-
0):
|
|
747
|
-
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(
|
|
748
|
-
(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});
|
|
749
789
|
;return moduleRtn}})();
|
|
750
790
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
751
791
|
|
|
@@ -761,7 +801,7 @@ Lc=await (async function(){function b(c){c=Lc=c.exports;pb=c.free;Jc=c.malloc;ob
|
|
|
761
801
|
/***/ ((module) => {
|
|
762
802
|
|
|
763
803
|
"use strict";
|
|
764
|
-
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}}');
|
|
765
805
|
|
|
766
806
|
/***/ }),
|
|
767
807
|
/* 7 */
|
|
@@ -2921,12 +2961,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2921
2961
|
/* harmony export */ sanitizeUrl: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_3__.sanitizeUrl)
|
|
2922
2962
|
/* harmony export */ });
|
|
2923
2963
|
/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
|
|
2924
|
-
/* harmony import */ var _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
2925
|
-
/* harmony import */ var _gamepadInteractions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
2926
|
-
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
2927
|
-
/* harmony import */ var _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
2928
|
-
/* harmony import */ var _riveFont__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
2929
|
-
/* harmony import */ var _replayPacer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
2964
|
+
/* harmony import */ var _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
|
2965
|
+
/* harmony import */ var _gamepadInteractions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19);
|
|
2966
|
+
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21);
|
|
2967
|
+
/* harmony import */ var _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22);
|
|
2968
|
+
/* harmony import */ var _riveFont__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(23);
|
|
2969
|
+
/* harmony import */ var _replayPacer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(24);
|
|
2930
2970
|
|
|
2931
2971
|
|
|
2932
2972
|
|
|
@@ -2945,16 +2985,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2945
2985
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2946
2986
|
/* harmony export */ registerTouchInteractions: () => (/* binding */ registerTouchInteractions)
|
|
2947
2987
|
/* harmony export */ });
|
|
2988
|
+
/* harmony import */ var _wheelMomentum__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
|
2948
2989
|
var _this = undefined;
|
|
2990
|
+
|
|
2949
2991
|
// A detented wheel reports lines; the runtime wants pixels.
|
|
2950
2992
|
var PIXELS_PER_LINE = 16;
|
|
2951
|
-
// ScrollPhase.update. The DOM reports no gesture
|
|
2952
|
-
//
|
|
2993
|
+
// ScrollPhase.update and ScrollPhase.momentum. The DOM reports no gesture
|
|
2994
|
+
// phase, so the runtime closes the gesture once it goes quiet.
|
|
2953
2995
|
var SCROLL_PHASE_UPDATE = 1;
|
|
2996
|
+
var SCROLL_PHASE_MOMENTUM = 3;
|
|
2954
2997
|
/**
|
|
2955
|
-
*
|
|
2998
|
+
* Pointer state per canvas. It outlives a single registration, because Rive
|
|
2956
2999
|
* re-registers the listeners (on play and pause) while a finger can still be
|
|
2957
|
-
* down.
|
|
3000
|
+
* down, or between a right press and its context menu event.
|
|
2958
3001
|
*/
|
|
2959
3002
|
var touchStateByCanvas = new WeakMap();
|
|
2960
3003
|
/**
|
|
@@ -2992,6 +3035,32 @@ var getTouchCoordinates = function (changedTouches, enableMultiTouch, primaryTou
|
|
|
2992
3035
|
}
|
|
2993
3036
|
return coordinates;
|
|
2994
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
|
+
};
|
|
2995
3064
|
/**
|
|
2996
3065
|
* Returns the clientX and clientY properties from touch or mouse events. Also
|
|
2997
3066
|
* calls preventDefault() on the event if it is a touchstart or touchmove to prevent
|
|
@@ -3030,7 +3099,7 @@ var getClientCoordinates = function (event, isTouchScrollEnabled, enableMultiTou
|
|
|
3030
3099
|
*/
|
|
3031
3100
|
var registerTouchInteractions = function (_a) {
|
|
3032
3101
|
var _b;
|
|
3033
|
-
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;
|
|
3034
3103
|
if (!canvas ||
|
|
3035
3104
|
!stateMachines.length ||
|
|
3036
3105
|
!renderer ||
|
|
@@ -3077,6 +3146,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3077
3146
|
var _touchState = (_b = touchStateByCanvas.get(canvas)) !== null && _b !== void 0 ? _b : {
|
|
3078
3147
|
touches: new Map(),
|
|
3079
3148
|
primaryTouchId: null,
|
|
3149
|
+
secondaryPressTaken: false,
|
|
3080
3150
|
};
|
|
3081
3151
|
touchStateByCanvas.set(canvas, _touchState);
|
|
3082
3152
|
var _activeTouches = _touchState.touches;
|
|
@@ -3197,6 +3267,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3197
3267
|
}
|
|
3198
3268
|
});
|
|
3199
3269
|
}
|
|
3270
|
+
var button = pointerButtonOf(event);
|
|
3200
3271
|
switch (event.type) {
|
|
3201
3272
|
/**
|
|
3202
3273
|
* There's a 2px buffer for a hitRadius when translating the pointer coordinates
|
|
@@ -3224,6 +3295,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3224
3295
|
var stateMachine = stateMachines_2[_i];
|
|
3225
3296
|
_loop_1(stateMachine);
|
|
3226
3297
|
}
|
|
3298
|
+
wake === null || wake === void 0 ? void 0 : wake();
|
|
3227
3299
|
break;
|
|
3228
3300
|
// Pointer moving/hovering on the canvas
|
|
3229
3301
|
case "touchmove":
|
|
@@ -3238,14 +3310,28 @@ var registerTouchInteractions = function (_a) {
|
|
|
3238
3310
|
var stateMachine = stateMachines_3[_c];
|
|
3239
3311
|
_loop_2(stateMachine);
|
|
3240
3312
|
}
|
|
3313
|
+
wake === null || wake === void 0 ? void 0 : wake();
|
|
3241
3314
|
break;
|
|
3242
3315
|
}
|
|
3243
3316
|
// Pointer click initiated but not released yet on the canvas
|
|
3244
3317
|
case "touchstart":
|
|
3245
3318
|
case "mousedown": {
|
|
3319
|
+
if (button === null) {
|
|
3320
|
+
break;
|
|
3321
|
+
}
|
|
3322
|
+
_touchState.secondaryPressTaken = false;
|
|
3246
3323
|
var _loop_3 = function (stateMachine) {
|
|
3247
|
-
coordinateSets.forEach(function (
|
|
3248
|
-
|
|
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);
|
|
3249
3335
|
});
|
|
3250
3336
|
};
|
|
3251
3337
|
for (var _d = 0, stateMachines_4 = stateMachines; _d < stateMachines_4.length; _d++) {
|
|
@@ -3282,9 +3368,12 @@ var registerTouchInteractions = function (_a) {
|
|
|
3282
3368
|
break;
|
|
3283
3369
|
}
|
|
3284
3370
|
case "mouseup": {
|
|
3371
|
+
if (button === null) {
|
|
3372
|
+
break;
|
|
3373
|
+
}
|
|
3285
3374
|
var _loop_5 = function (stateMachine) {
|
|
3286
3375
|
coordinateSets.forEach(function (coordinateSet) {
|
|
3287
|
-
stateMachine.pointerUp(coordinateSet.transformedX, coordinateSet.transformedY, coordinateSet.identifier);
|
|
3376
|
+
stateMachine.pointerUp(coordinateSet.transformedX, coordinateSet.transformedY, coordinateSet.identifier, button);
|
|
3288
3377
|
});
|
|
3289
3378
|
};
|
|
3290
3379
|
for (var _f = 0, stateMachines_6 = stateMachines; _f < stateMachines_6.length; _f++) {
|
|
@@ -3360,16 +3449,38 @@ var registerTouchInteractions = function (_a) {
|
|
|
3360
3449
|
// Advance immediately so the release takes effect synchronously
|
|
3361
3450
|
advanceAndDrain(0);
|
|
3362
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
|
+
};
|
|
3363
3472
|
/**
|
|
3364
3473
|
* Forwards wheel and trackpad scrolling to the state machines. The page keeps
|
|
3365
3474
|
* the wheel unless a scroll view actually moves, so it still scrolls when
|
|
3366
3475
|
* Rive has nothing to scroll or a view sits at its edge.
|
|
3367
3476
|
*/
|
|
3477
|
+
var wheelMomentum = new _wheelMomentum__WEBPACK_IMPORTED_MODULE_0__.WheelMomentumDetector();
|
|
3368
3478
|
var wheelCallback = function (event) {
|
|
3369
3479
|
// Pinch zoom arrives as a ctrl+wheel and belongs to the page. A wheel that
|
|
3370
3480
|
// can't be cancelled is part of a sequence the page is already scrolling;
|
|
3371
3481
|
// taking it too would move both.
|
|
3372
3482
|
if (event.ctrlKey || !event.cancelable) {
|
|
3483
|
+
wheelMomentum.reset();
|
|
3373
3484
|
return;
|
|
3374
3485
|
}
|
|
3375
3486
|
// Read before the deltas: Firefox reports pixels once a delta has been
|
|
@@ -3412,11 +3523,19 @@ var registerTouchInteractions = function (_a) {
|
|
|
3412
3523
|
// counts as precise either way, as it does in the browser's own scrolling.
|
|
3413
3524
|
var precise = deltaMode === WheelEvent.DOM_DELTA_PIXEL;
|
|
3414
3525
|
var timeStamp = event.timeStamp / 1000;
|
|
3526
|
+
// Momentum bounces at the end of a scroll view; the fingers stretch it.
|
|
3527
|
+
var phase = SCROLL_PHASE_UPDATE;
|
|
3528
|
+
if (!precise) {
|
|
3529
|
+
wheelMomentum.reset();
|
|
3530
|
+
}
|
|
3531
|
+
else if (wheelMomentum.isMomentum(event, deltaX, deltaY)) {
|
|
3532
|
+
phase = SCROLL_PHASE_MOMENTUM;
|
|
3533
|
+
}
|
|
3415
3534
|
// A latched state machine owns the rest of its gesture, even past its edge.
|
|
3416
3535
|
var latched = stateMachines.filter(function (sm) { return sm.hasScrollLatch(); });
|
|
3417
3536
|
var ordered = latched.concat(stateMachines.filter(function (sm) { return latched.indexOf(sm) === -1; }));
|
|
3418
3537
|
var consumed = ordered.some(function (stateMachine) {
|
|
3419
|
-
return stateMachine.pointerScroll(position.x, position.y, moved.x - position.x, moved.y - position.y,
|
|
3538
|
+
return stateMachine.pointerScroll(position.x, position.y, moved.x - position.x, moved.y - position.y, phase, precise, timeStamp, 0) !== 0;
|
|
3420
3539
|
});
|
|
3421
3540
|
if (!consumed) {
|
|
3422
3541
|
return;
|
|
@@ -3439,6 +3558,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3439
3558
|
});
|
|
3440
3559
|
canvas.addEventListener("touchend", callback);
|
|
3441
3560
|
canvas.addEventListener("touchcancel", touchCancelCallback);
|
|
3561
|
+
canvas.addEventListener("contextmenu", contextMenuCallback);
|
|
3442
3562
|
// Not passive, or preventDefault could not keep the page from scrolling.
|
|
3443
3563
|
canvas.addEventListener("wheel", wheelCallback, { passive: false });
|
|
3444
3564
|
return function () {
|
|
@@ -3451,6 +3571,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3451
3571
|
canvas.removeEventListener("touchstart", callback);
|
|
3452
3572
|
canvas.removeEventListener("touchend", callback);
|
|
3453
3573
|
canvas.removeEventListener("touchcancel", touchCancelCallback);
|
|
3574
|
+
canvas.removeEventListener("contextmenu", contextMenuCallback);
|
|
3454
3575
|
canvas.removeEventListener("wheel", wheelCallback);
|
|
3455
3576
|
};
|
|
3456
3577
|
};
|
|
@@ -3460,15 +3581,106 @@ var registerTouchInteractions = function (_a) {
|
|
|
3460
3581
|
/* 15 */
|
|
3461
3582
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3462
3583
|
|
|
3584
|
+
"use strict";
|
|
3585
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3586
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3587
|
+
/* harmony export */ WheelMomentumDetector: () => (/* binding */ WheelMomentumDetector)
|
|
3588
|
+
/* harmony export */ });
|
|
3589
|
+
// The runtime closes a scroll gesture after this long without events.
|
|
3590
|
+
var GESTURE_GAP_MS = 100;
|
|
3591
|
+
// Falls, and how far below the peak, before a stream counts as momentum.
|
|
3592
|
+
var FALLING_EVENTS = 3;
|
|
3593
|
+
var FALL_FROM_PEAK = 0.15;
|
|
3594
|
+
// Rises in a row that mean fingers. One alone is two merged events.
|
|
3595
|
+
var RISING_EVENTS = 2;
|
|
3596
|
+
// Pixel deltas arrive rounded.
|
|
3597
|
+
var JITTER = 1;
|
|
3598
|
+
// Assumed slowest share momentum loses a second; a delta held longer is fingers.
|
|
3599
|
+
var SLOWEST_DECAY = 0.6;
|
|
3600
|
+
var HOLD_MARGIN = 1.5;
|
|
3601
|
+
var SHORTEST_HOLD_MS = 50;
|
|
3602
|
+
/** Tells the platform's momentum from the fingers in pixel wheel events. */
|
|
3603
|
+
var WheelMomentumDetector = /** @class */ (function () {
|
|
3604
|
+
function WheelMomentumDetector() {
|
|
3605
|
+
this.lastTime = -Infinity;
|
|
3606
|
+
this.lastX = 0;
|
|
3607
|
+
this.lastY = 0;
|
|
3608
|
+
// The lowest delta since the last rise, and the peak it fell from.
|
|
3609
|
+
this.base = 0;
|
|
3610
|
+
this.peak = 0;
|
|
3611
|
+
this.falls = 0;
|
|
3612
|
+
this.rises = 0;
|
|
3613
|
+
this.heldSince = 0;
|
|
3614
|
+
this.momentum = false;
|
|
3615
|
+
}
|
|
3616
|
+
WheelMomentumDetector.prototype.reset = function () {
|
|
3617
|
+
this.lastTime = -Infinity;
|
|
3618
|
+
this.momentum = false;
|
|
3619
|
+
};
|
|
3620
|
+
WheelMomentumDetector.prototype.isMomentum = function (event, deltaX, deltaY) {
|
|
3621
|
+
// Browsers with WheelEvent.momentum know; the rest leave it to the deltas.
|
|
3622
|
+
if ("momentum" in event) {
|
|
3623
|
+
return event.momentum === true;
|
|
3624
|
+
}
|
|
3625
|
+
// Each axis rounds on its own, so the larger one is the size.
|
|
3626
|
+
var size = Math.max(Math.abs(deltaX), Math.abs(deltaY));
|
|
3627
|
+
var time = event.timeStamp;
|
|
3628
|
+
var newGesture = time - this.lastTime > GESTURE_GAP_MS ||
|
|
3629
|
+
deltaX * this.lastX + deltaY * this.lastY < 0;
|
|
3630
|
+
this.lastTime = time;
|
|
3631
|
+
this.lastX = deltaX;
|
|
3632
|
+
this.lastY = deltaY;
|
|
3633
|
+
if (newGesture) {
|
|
3634
|
+
this.restart(size, time);
|
|
3635
|
+
return false;
|
|
3636
|
+
}
|
|
3637
|
+
if (size > this.base + JITTER) {
|
|
3638
|
+
if (++this.rises >= RISING_EVENTS) {
|
|
3639
|
+
this.restart(size, time);
|
|
3640
|
+
}
|
|
3641
|
+
return this.momentum;
|
|
3642
|
+
}
|
|
3643
|
+
this.rises = 0;
|
|
3644
|
+
var longestHold = (HOLD_MARGIN * 1000) / (SLOWEST_DECAY * size);
|
|
3645
|
+
if (size < this.base) {
|
|
3646
|
+
this.falls++;
|
|
3647
|
+
this.base = size;
|
|
3648
|
+
this.heldSince = time;
|
|
3649
|
+
}
|
|
3650
|
+
else if (time - this.heldSince >
|
|
3651
|
+
Math.max(SHORTEST_HOLD_MS, longestHold)) {
|
|
3652
|
+
this.restart(size, time);
|
|
3653
|
+
}
|
|
3654
|
+
if (this.falls >= FALLING_EVENTS &&
|
|
3655
|
+
size <= this.peak - Math.max(2 * JITTER, FALL_FROM_PEAK * this.peak)) {
|
|
3656
|
+
this.momentum = true;
|
|
3657
|
+
}
|
|
3658
|
+
return this.momentum;
|
|
3659
|
+
};
|
|
3660
|
+
WheelMomentumDetector.prototype.restart = function (size, time) {
|
|
3661
|
+
this.base = this.peak = size;
|
|
3662
|
+
this.falls = this.rises = 0;
|
|
3663
|
+
this.heldSince = time;
|
|
3664
|
+
this.momentum = false;
|
|
3665
|
+
};
|
|
3666
|
+
return WheelMomentumDetector;
|
|
3667
|
+
}());
|
|
3668
|
+
|
|
3669
|
+
|
|
3670
|
+
|
|
3671
|
+
/***/ }),
|
|
3672
|
+
/* 16 */
|
|
3673
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3674
|
+
|
|
3463
3675
|
"use strict";
|
|
3464
3676
|
__webpack_require__.r(__webpack_exports__);
|
|
3465
3677
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3466
3678
|
/* harmony export */ FocusSessionState: () => (/* binding */ FocusSessionState),
|
|
3467
3679
|
/* harmony export */ KeyboardInteractions: () => (/* binding */ KeyboardInteractions)
|
|
3468
3680
|
/* harmony export */ });
|
|
3469
|
-
/* harmony import */ var _keyMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
3681
|
+
/* harmony import */ var _keyMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17);
|
|
3470
3682
|
/* harmony import */ var _semantics_claimedKeyEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
|
|
3471
|
-
/* harmony import */ var _textInputProxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
3683
|
+
/* harmony import */ var _textInputProxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
|
|
3472
3684
|
|
|
3473
3685
|
|
|
3474
3686
|
|
|
@@ -3539,7 +3751,7 @@ var FocusSessionState;
|
|
|
3539
3751
|
*/
|
|
3540
3752
|
var KeyboardInteractions = /** @class */ (function () {
|
|
3541
3753
|
function KeyboardInteractions(_a) {
|
|
3542
|
-
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;
|
|
3543
3755
|
var _this = this;
|
|
3544
3756
|
var _b, _c;
|
|
3545
3757
|
this.focusSessionState = FocusSessionState.NotFocused;
|
|
@@ -3574,6 +3786,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3574
3786
|
* gates this so a click doesn't yank Rive focus to the first node on the focus event itself.
|
|
3575
3787
|
*/
|
|
3576
3788
|
this.onCanvasFocus = function (event) {
|
|
3789
|
+
_this.onInput();
|
|
3577
3790
|
_this.syncOverlayListener();
|
|
3578
3791
|
_this.canvasHasFocus = true;
|
|
3579
3792
|
_this.focusDomainReleased = false;
|
|
@@ -3600,6 +3813,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3600
3813
|
* When we're not in either of those buckets, it's safe to call `clearFocus()` on the SMI.
|
|
3601
3814
|
*/
|
|
3602
3815
|
this.onCanvasBlur = function (event) {
|
|
3816
|
+
_this.onInput();
|
|
3603
3817
|
// Must stay before the state reset because beginTextInputSession sets the session state and
|
|
3604
3818
|
// then focuses the proxy, which synchronously blurs the canvas.
|
|
3605
3819
|
if (_this.inputProxy.owns(event.relatedTarget))
|
|
@@ -3619,6 +3833,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3619
3833
|
this.onOverlayFocusIn = function (event) {
|
|
3620
3834
|
if (!_this.isInOverlay(event.target))
|
|
3621
3835
|
return;
|
|
3836
|
+
_this.onInput();
|
|
3622
3837
|
_this.focusDomainReleased = false;
|
|
3623
3838
|
if (!_this.hasFocusNodes)
|
|
3624
3839
|
return;
|
|
@@ -3651,6 +3866,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3651
3866
|
* @returns void
|
|
3652
3867
|
*/
|
|
3653
3868
|
this.onKeyDown = function (event) {
|
|
3869
|
+
_this.onInput();
|
|
3654
3870
|
_this.syncOverlayListener();
|
|
3655
3871
|
// Keys that are part of an IME composition belong to the IME (candidate
|
|
3656
3872
|
// navigation, commit). Safari reports the first one as keyCode 229 with
|
|
@@ -3739,6 +3955,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3739
3955
|
}
|
|
3740
3956
|
};
|
|
3741
3957
|
this.onKeyUp = function (event) {
|
|
3958
|
+
_this.onInput();
|
|
3742
3959
|
if (event.isComposing || event.keyCode === 229)
|
|
3743
3960
|
return;
|
|
3744
3961
|
if (_this.claimedKeyCodes.delete(event.code))
|
|
@@ -3751,6 +3968,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3751
3968
|
_this.mainSm.keyInput(key, (0,_keyMap__WEBPACK_IMPORTED_MODULE_0__.modifiersFromEvent)(event), false, false);
|
|
3752
3969
|
};
|
|
3753
3970
|
this.canvas = canvas;
|
|
3971
|
+
this.onInput = onInput !== null && onInput !== void 0 ? onInput : (function () { });
|
|
3754
3972
|
this.mainSm = stateMachine;
|
|
3755
3973
|
this.hasFocusNodes = hasFocusNodes;
|
|
3756
3974
|
this.getOverlayElement = getOverlayElement;
|
|
@@ -3764,7 +3982,10 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3764
3982
|
this.inputProxy = new _textInputProxy__WEBPACK_IMPORTED_MODULE_2__.TextInputProxy({
|
|
3765
3983
|
container: (_c = canvas.parentElement) !== null && _c !== void 0 ? _c : document.body,
|
|
3766
3984
|
canvas: canvas,
|
|
3767
|
-
textInput: function (text) {
|
|
3985
|
+
textInput: function (text) {
|
|
3986
|
+
_this.onInput();
|
|
3987
|
+
return _this.mainSm.textInput(text);
|
|
3988
|
+
},
|
|
3768
3989
|
// Proxy keystrokes go through the same handlers as the canvas.
|
|
3769
3990
|
onKeyDown: this.onKeyDown,
|
|
3770
3991
|
onKeyUp: this.onKeyUp,
|
|
@@ -3815,6 +4036,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3815
4036
|
configurable: true
|
|
3816
4037
|
});
|
|
3817
4038
|
KeyboardInteractions.prototype.handleProxyBlur = function (relatedTarget) {
|
|
4039
|
+
this.onInput();
|
|
3818
4040
|
// Teardown already in progress (endTextInputSession blurred the proxy).
|
|
3819
4041
|
if (!this.textInputSessionActive)
|
|
3820
4042
|
return;
|
|
@@ -3958,7 +4180,7 @@ var KeyboardInteractions = /** @class */ (function () {
|
|
|
3958
4180
|
|
|
3959
4181
|
|
|
3960
4182
|
/***/ }),
|
|
3961
|
-
/*
|
|
4183
|
+
/* 17 */
|
|
3962
4184
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3963
4185
|
|
|
3964
4186
|
"use strict";
|
|
@@ -4322,7 +4544,7 @@ function modifiersFromEvent(event) {
|
|
|
4322
4544
|
|
|
4323
4545
|
|
|
4324
4546
|
/***/ }),
|
|
4325
|
-
/*
|
|
4547
|
+
/* 18 */
|
|
4326
4548
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4327
4549
|
|
|
4328
4550
|
"use strict";
|
|
@@ -4545,7 +4767,7 @@ function clamp(v, min, max) {
|
|
|
4545
4767
|
|
|
4546
4768
|
|
|
4547
4769
|
/***/ }),
|
|
4548
|
-
/*
|
|
4770
|
+
/* 19 */
|
|
4549
4771
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4550
4772
|
|
|
4551
4773
|
"use strict";
|
|
@@ -4553,7 +4775,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4553
4775
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4554
4776
|
/* harmony export */ GamepadInteractions: () => (/* binding */ GamepadInteractions)
|
|
4555
4777
|
/* harmony export */ });
|
|
4556
|
-
/* harmony import */ var _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
4778
|
+
/* harmony import */ var _gamepadBatchEncoder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
|
|
4557
4779
|
|
|
4558
4780
|
// Standard mapping: 17 buttons, 4 stick axes, plus triggers mirrored onto axes 4/5.
|
|
4559
4781
|
var STANDARD_BUTTON_COUNT = 17;
|
|
@@ -4622,7 +4844,8 @@ function toPadState(deviceId, pad) {
|
|
|
4622
4844
|
var GamepadSource = /** @class */ (function () {
|
|
4623
4845
|
function GamepadSource() {
|
|
4624
4846
|
var _this = this;
|
|
4625
|
-
|
|
4847
|
+
// One per subscribed instance; the window listener lives while any remain.
|
|
4848
|
+
this.connectListeners = new Set();
|
|
4626
4849
|
this.hasPads = false;
|
|
4627
4850
|
this.nextDeviceId = 1;
|
|
4628
4851
|
this.slots = {};
|
|
@@ -4630,18 +4853,21 @@ var GamepadSource = /** @class */ (function () {
|
|
|
4630
4853
|
this.cached = [];
|
|
4631
4854
|
this.onConnected = function () {
|
|
4632
4855
|
_this.hasPads = true;
|
|
4856
|
+
_this.connectListeners.forEach(function (listener) { return listener(); });
|
|
4633
4857
|
};
|
|
4634
4858
|
}
|
|
4635
|
-
GamepadSource.prototype.subscribe = function () {
|
|
4636
|
-
|
|
4859
|
+
GamepadSource.prototype.subscribe = function (onConnected) {
|
|
4860
|
+
this.connectListeners.add(onConnected);
|
|
4861
|
+
if (this.connectListeners.size > 1 || typeof window === "undefined") {
|
|
4637
4862
|
return;
|
|
4638
4863
|
}
|
|
4639
4864
|
window.addEventListener("gamepadconnected", this.onConnected);
|
|
4640
4865
|
// The event doesn't re-fire for pads exposed before we started listening.
|
|
4641
4866
|
this.hasPads = readNavigatorGamepads().some(function (pad) { return !!pad; });
|
|
4642
4867
|
};
|
|
4643
|
-
GamepadSource.prototype.unsubscribe = function () {
|
|
4644
|
-
|
|
4868
|
+
GamepadSource.prototype.unsubscribe = function (onConnected) {
|
|
4869
|
+
this.connectListeners.delete(onConnected);
|
|
4870
|
+
if (this.connectListeners.size > 0 || typeof window === "undefined") {
|
|
4645
4871
|
return;
|
|
4646
4872
|
}
|
|
4647
4873
|
window.removeEventListener("gamepadconnected", this.onConnected);
|
|
@@ -4649,6 +4875,14 @@ var GamepadSource = /** @class */ (function () {
|
|
|
4649
4875
|
this.cachedTime = NaN;
|
|
4650
4876
|
this.cached = [];
|
|
4651
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
|
+
});
|
|
4652
4886
|
/** Current pads; cached per rAF timestamp so instances share one read. */
|
|
4653
4887
|
GamepadSource.prototype.read = function (time) {
|
|
4654
4888
|
if (!this.hasPads) {
|
|
@@ -4694,12 +4928,24 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4694
4928
|
// deviceId -> values last sent to `stateMachine`.
|
|
4695
4929
|
this.lastSentPads = new Map();
|
|
4696
4930
|
this.submitFailures = 0;
|
|
4697
|
-
gamepadSource.subscribe();
|
|
4931
|
+
gamepadSource.subscribe(params.onPadConnected);
|
|
4698
4932
|
}
|
|
4699
|
-
|
|
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
|
+
*/
|
|
4700
4946
|
GamepadInteractions.prototype.handleGamepadInputs = function (time, stateMachine) {
|
|
4701
4947
|
if (!stateMachine) {
|
|
4702
|
-
return;
|
|
4948
|
+
return false;
|
|
4703
4949
|
}
|
|
4704
4950
|
if (stateMachine !== this.stateMachine) {
|
|
4705
4951
|
// A new state machine knows no devices yet; resend connected records.
|
|
@@ -4707,14 +4953,10 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4707
4953
|
this.lastSentPads.clear();
|
|
4708
4954
|
this.submitFailures = 0;
|
|
4709
4955
|
}
|
|
4710
|
-
if (this.
|
|
4711
|
-
return;
|
|
4956
|
+
if (!this.isPolling) {
|
|
4957
|
+
return false;
|
|
4712
4958
|
}
|
|
4713
4959
|
var pads = gamepadSource.read(time);
|
|
4714
|
-
// Nothing connected and nothing left to disconnect.
|
|
4715
|
-
if (pads.length === 0 && this.lastSentPads.size === 0) {
|
|
4716
|
-
return;
|
|
4717
|
-
}
|
|
4718
4960
|
if (this.params.requireFocus && !this.params.isFocusWithin()) {
|
|
4719
4961
|
// Keep devices connected but release everything they hold.
|
|
4720
4962
|
pads = pads.map(restState);
|
|
@@ -4722,11 +4964,11 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4722
4964
|
this.encoder.begin();
|
|
4723
4965
|
this.encodeDiff(pads);
|
|
4724
4966
|
if (this.encoder.isEmpty) {
|
|
4725
|
-
return;
|
|
4967
|
+
return false;
|
|
4726
4968
|
}
|
|
4727
4969
|
if (stateMachine.submitGamepadsFromBuffer(this.encoder.end())) {
|
|
4728
4970
|
this.submitFailures = 0;
|
|
4729
|
-
return;
|
|
4971
|
+
return true;
|
|
4730
4972
|
}
|
|
4731
4973
|
// The core stops at the first bad record, so resend connected records next
|
|
4732
4974
|
// frame rather than updates for devices it may never have seen.
|
|
@@ -4735,11 +4977,12 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4735
4977
|
console.error("[Rive] Gamepad input was rejected by the state machine " +
|
|
4736
4978
|
"".concat(MAX_SUBMIT_FAILURES, " times in a row; gamepad input is disabled for it."));
|
|
4737
4979
|
}
|
|
4980
|
+
return false;
|
|
4738
4981
|
};
|
|
4739
4982
|
GamepadInteractions.prototype.dispose = function () {
|
|
4740
4983
|
this.stateMachine = undefined;
|
|
4741
4984
|
this.lastSentPads.clear();
|
|
4742
|
-
gamepadSource.unsubscribe();
|
|
4985
|
+
gamepadSource.unsubscribe(this.params.onPadConnected);
|
|
4743
4986
|
};
|
|
4744
4987
|
/** Writes records that bring `lastSentPads` up to `pads`, updating it as it goes. */
|
|
4745
4988
|
GamepadInteractions.prototype.encodeDiff = function (pads) {
|
|
@@ -4780,7 +5023,7 @@ var GamepadInteractions = /** @class */ (function () {
|
|
|
4780
5023
|
|
|
4781
5024
|
|
|
4782
5025
|
/***/ }),
|
|
4783
|
-
/*
|
|
5026
|
+
/* 20 */
|
|
4784
5027
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4785
5028
|
|
|
4786
5029
|
"use strict";
|
|
@@ -4934,7 +5177,7 @@ var GamepadBatchEncoder = /** @class */ (function () {
|
|
|
4934
5177
|
|
|
4935
5178
|
|
|
4936
5179
|
/***/ }),
|
|
4937
|
-
/*
|
|
5180
|
+
/* 21 */
|
|
4938
5181
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4939
5182
|
|
|
4940
5183
|
"use strict";
|
|
@@ -4988,7 +5231,7 @@ function sanitizeUrl(url) {
|
|
|
4988
5231
|
|
|
4989
5232
|
|
|
4990
5233
|
/***/ }),
|
|
4991
|
-
/*
|
|
5234
|
+
/* 22 */
|
|
4992
5235
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4993
5236
|
|
|
4994
5237
|
"use strict";
|
|
@@ -5289,7 +5532,7 @@ var createFinalization = function (target, finalizable) {
|
|
|
5289
5532
|
|
|
5290
5533
|
|
|
5291
5534
|
/***/ }),
|
|
5292
|
-
/*
|
|
5535
|
+
/* 23 */
|
|
5293
5536
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5294
5537
|
|
|
5295
5538
|
"use strict";
|
|
@@ -5313,6 +5556,17 @@ var RiveFont = /** @class */ (function () {
|
|
|
5313
5556
|
RiveFont._fallbackFontCallback = fontCallback !== null && fontCallback !== void 0 ? fontCallback : null;
|
|
5314
5557
|
RiveFont._wireFallbackProc();
|
|
5315
5558
|
};
|
|
5559
|
+
/**
|
|
5560
|
+
* Set the preferred languages (BCP 47 tags, most preferred first) that text
|
|
5561
|
+
* without a `language` of its own shapes and falls back with, like
|
|
5562
|
+
* `navigator.languages` is for a page. Pass nothing to follow
|
|
5563
|
+
* `navigator.languages`, which is also what happens until this is called,
|
|
5564
|
+
* including when the browser's languages change.
|
|
5565
|
+
* @param languages The languages to use, or nothing for the browser's.
|
|
5566
|
+
*/
|
|
5567
|
+
RiveFont.setSystemLanguages = function (languages) {
|
|
5568
|
+
_runtimeLoader__WEBPACK_IMPORTED_MODULE_0__.RuntimeLoader.setSystemLanguages(languages !== null && languages !== void 0 ? languages : null);
|
|
5569
|
+
};
|
|
5316
5570
|
// Get the pointer value to the Embind Font object from FontWrapper
|
|
5317
5571
|
RiveFont._fontToPtr = function (fontWrapper) {
|
|
5318
5572
|
var _a;
|
|
@@ -5338,8 +5592,8 @@ var RiveFont = /** @class */ (function () {
|
|
|
5338
5592
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_0__.RuntimeLoader.getInstance(function (rive) {
|
|
5339
5593
|
var cb = RiveFont._fallbackFontCallback;
|
|
5340
5594
|
if (cb) {
|
|
5341
|
-
rive.setFallbackFontCallback((function (missingGlyph, fallbackFontIndex, weight) {
|
|
5342
|
-
var fontsReturned = cb(missingGlyph, weight);
|
|
5595
|
+
rive.setFallbackFontCallback((function (missingGlyph, fallbackFontIndex, weight, languages) {
|
|
5596
|
+
var fontsReturned = cb(missingGlyph, weight, languages !== null && languages !== void 0 ? languages : []);
|
|
5343
5597
|
if (fontsReturned) {
|
|
5344
5598
|
if (Array.isArray(fontsReturned)) {
|
|
5345
5599
|
return RiveFont._getFallbackPtr(fontsReturned, fallbackFontIndex);
|
|
@@ -5363,7 +5617,7 @@ var RiveFont = /** @class */ (function () {
|
|
|
5363
5617
|
|
|
5364
5618
|
|
|
5365
5619
|
/***/ }),
|
|
5366
|
-
/*
|
|
5620
|
+
/* 24 */
|
|
5367
5621
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5368
5622
|
|
|
5369
5623
|
"use strict";
|
|
@@ -5459,7 +5713,9 @@ var ReplayPacer = /** @class */ (function () {
|
|
|
5459
5713
|
this.probeAfter = this.probing
|
|
5460
5714
|
? Math.min(this.probeAfter * 2, kMaxProbeAfterMs)
|
|
5461
5715
|
: kProbeAfterMs;
|
|
5462
|
-
|
|
5716
|
+
// At most doubling, since settling at the cadence one bad replay time
|
|
5717
|
+
// asks for can hold recording back for seconds.
|
|
5718
|
+
this.setDivisor(time, Math.min(Math.max(divisor + 1, Math.ceil(ratio)), divisor * 2));
|
|
5463
5719
|
}
|
|
5464
5720
|
else if (ratio < (divisor - 1) * 0.9) {
|
|
5465
5721
|
// Paced frames no longer overlap, so their replay time is a ceiling
|
|
@@ -5843,9 +6099,10 @@ var StateMachineInputType;
|
|
|
5843
6099
|
* for how to migrate.
|
|
5844
6100
|
*/
|
|
5845
6101
|
var StateMachineInput = /** @class */ (function () {
|
|
5846
|
-
function StateMachineInput(type, runtimeInput) {
|
|
6102
|
+
function StateMachineInput(type, runtimeInput, onChange) {
|
|
5847
6103
|
this.type = type;
|
|
5848
6104
|
this.runtimeInput = runtimeInput;
|
|
6105
|
+
this.onChange = onChange;
|
|
5849
6106
|
}
|
|
5850
6107
|
Object.defineProperty(StateMachineInput.prototype, "name", {
|
|
5851
6108
|
/**
|
|
@@ -5868,7 +6125,9 @@ var StateMachineInput = /** @class */ (function () {
|
|
|
5868
6125
|
* Sets the value of the input
|
|
5869
6126
|
*/
|
|
5870
6127
|
set: function (value) {
|
|
6128
|
+
var _a;
|
|
5871
6129
|
this.runtimeInput.value = value;
|
|
6130
|
+
(_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
5872
6131
|
},
|
|
5873
6132
|
enumerable: false,
|
|
5874
6133
|
configurable: true
|
|
@@ -5877,8 +6136,10 @@ var StateMachineInput = /** @class */ (function () {
|
|
|
5877
6136
|
* Fires a trigger; does nothing on Number or Boolean input types
|
|
5878
6137
|
*/
|
|
5879
6138
|
StateMachineInput.prototype.fire = function () {
|
|
6139
|
+
var _a;
|
|
5880
6140
|
if (this.type === StateMachineInputType.Trigger) {
|
|
5881
6141
|
this.runtimeInput.fire();
|
|
6142
|
+
(_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
5882
6143
|
}
|
|
5883
6144
|
};
|
|
5884
6145
|
/**
|
|
@@ -5947,10 +6208,11 @@ var StateMachine = /** @class */ (function () {
|
|
|
5947
6208
|
* @param stateMachine runtime state machine object
|
|
5948
6209
|
* @param instance runtime state machine instance object
|
|
5949
6210
|
*/
|
|
5950
|
-
function StateMachine(stateMachine, runtime, playing, artboard) {
|
|
6211
|
+
function StateMachine(stateMachine, runtime, playing, artboard, onInputChange) {
|
|
5951
6212
|
this.stateMachine = stateMachine;
|
|
5952
6213
|
this.playing = playing;
|
|
5953
6214
|
this.artboard = artboard;
|
|
6215
|
+
this.onInputChange = onInputChange;
|
|
5954
6216
|
/**
|
|
5955
6217
|
* Caches the inputs from the runtime
|
|
5956
6218
|
*/
|
|
@@ -5999,9 +6261,10 @@ var StateMachine = /** @class */ (function () {
|
|
|
5999
6261
|
/**
|
|
6000
6262
|
* Advances the state machine instance by a given time and apply changes to artboard.
|
|
6001
6263
|
* @param time - the time to advance the animation by in seconds
|
|
6264
|
+
* @returns false once the state machine has nothing left to animate
|
|
6002
6265
|
*/
|
|
6003
6266
|
StateMachine.prototype.advanceAndApply = function (time) {
|
|
6004
|
-
this.instance.advanceAndApply(time);
|
|
6267
|
+
return this.instance.advanceAndApply(time);
|
|
6005
6268
|
};
|
|
6006
6269
|
/**
|
|
6007
6270
|
* Enables semantic tree tracking for this state machine instance.
|
|
@@ -6022,6 +6285,8 @@ var StateMachine = /** @class */ (function () {
|
|
|
6022
6285
|
* @param actionType - 0 = tap, 1 = increase, 2 = decrease
|
|
6023
6286
|
*/
|
|
6024
6287
|
StateMachine.prototype.fireSemanticAction = function (nodeId, actionType) {
|
|
6288
|
+
var _a;
|
|
6289
|
+
(_a = this.onInputChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6025
6290
|
this.instance.fireSemanticAction(nodeId, actionType);
|
|
6026
6291
|
};
|
|
6027
6292
|
/**
|
|
@@ -6032,6 +6297,8 @@ var StateMachine = /** @class */ (function () {
|
|
|
6032
6297
|
* @returns boolean - True if focus was set, false otherwise
|
|
6033
6298
|
*/
|
|
6034
6299
|
StateMachine.prototype.focusSemanticNode = function (nodeId) {
|
|
6300
|
+
var _a;
|
|
6301
|
+
(_a = this.onInputChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6035
6302
|
return this.instance.focusSemanticNode(nodeId);
|
|
6036
6303
|
};
|
|
6037
6304
|
/**
|
|
@@ -6068,13 +6335,13 @@ var StateMachine = /** @class */ (function () {
|
|
|
6068
6335
|
*/
|
|
6069
6336
|
StateMachine.prototype.mapRuntimeInput = function (input, runtime) {
|
|
6070
6337
|
if (input.type === runtime.SMIInput.bool) {
|
|
6071
|
-
return new StateMachineInput(StateMachineInputType.Boolean, input.asBool());
|
|
6338
|
+
return new StateMachineInput(StateMachineInputType.Boolean, input.asBool(), this.onInputChange);
|
|
6072
6339
|
}
|
|
6073
6340
|
else if (input.type === runtime.SMIInput.number) {
|
|
6074
|
-
return new StateMachineInput(StateMachineInputType.Number, input.asNumber());
|
|
6341
|
+
return new StateMachineInput(StateMachineInputType.Number, input.asNumber(), this.onInputChange);
|
|
6075
6342
|
}
|
|
6076
6343
|
else if (input.type === runtime.SMIInput.trigger) {
|
|
6077
|
-
return new StateMachineInput(StateMachineInputType.Trigger, input.asTrigger());
|
|
6344
|
+
return new StateMachineInput(StateMachineInputType.Trigger, input.asTrigger(), this.onInputChange);
|
|
6078
6345
|
}
|
|
6079
6346
|
};
|
|
6080
6347
|
/**
|
|
@@ -6104,6 +6371,8 @@ var StateMachine = /** @class */ (function () {
|
|
|
6104
6371
|
* Clear focus from the Rive focus node tree.
|
|
6105
6372
|
*/
|
|
6106
6373
|
StateMachine.prototype.clearFocus = function () {
|
|
6374
|
+
var _a;
|
|
6375
|
+
(_a = this.onInputChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6107
6376
|
this.instance.clearFocus();
|
|
6108
6377
|
};
|
|
6109
6378
|
return StateMachine;
|
|
@@ -6178,7 +6447,7 @@ var Animator = /** @class */ (function () {
|
|
|
6178
6447
|
// Try to create a new state machine instance
|
|
6179
6448
|
var sm = this.artboard.stateMachineByName(animatables[i]);
|
|
6180
6449
|
if (sm) {
|
|
6181
|
-
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard);
|
|
6450
|
+
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard, this.onInputChange);
|
|
6182
6451
|
if (semanticsActive) {
|
|
6183
6452
|
newStateMachine.enableSemantics();
|
|
6184
6453
|
}
|
|
@@ -6262,7 +6531,7 @@ var Animator = /** @class */ (function () {
|
|
|
6262
6531
|
// Try to create a new state machine instance
|
|
6263
6532
|
var sm = this.artboard.stateMachineByName(animatables[i]);
|
|
6264
6533
|
if (sm) {
|
|
6265
|
-
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard);
|
|
6534
|
+
var newStateMachine = new StateMachine(sm, this.runtime, playing, this.artboard, this.onInputChange);
|
|
6266
6535
|
if (semanticsActive) {
|
|
6267
6536
|
newStateMachine.enableSemantics();
|
|
6268
6537
|
}
|
|
@@ -6930,7 +7199,8 @@ var ObjectObservers = /** @class */ (function () {
|
|
|
6930
7199
|
*/
|
|
6931
7200
|
this._onObservedEntry = function (entry) {
|
|
6932
7201
|
var observed = _this._elementsMap.get(entry.target);
|
|
6933
|
-
|
|
7202
|
+
// An entry queued before remove() can still arrive after it.
|
|
7203
|
+
if (observed) {
|
|
6934
7204
|
observed.onResize(entry.target.clientWidth == 0 || entry.target.clientHeight == 0);
|
|
6935
7205
|
}
|
|
6936
7206
|
else {
|
|
@@ -6963,6 +7233,13 @@ var observers = new ObjectObservers();
|
|
|
6963
7233
|
// #endregion
|
|
6964
7234
|
// #region Rive
|
|
6965
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;
|
|
6966
7243
|
/**
|
|
6967
7244
|
* Resolves which animation/state machine names playback should start with.
|
|
6968
7245
|
* The `stateMachine` parameter takes priority; the deprecated plural
|
|
@@ -6992,6 +7269,8 @@ var RiveFile = /** @class */ (function () {
|
|
|
6992
7269
|
function RiveFile(params) {
|
|
6993
7270
|
// Allow the runtime to automatically load assets hosted in Rive's runtime.
|
|
6994
7271
|
this.enableRiveAssetCDN = true;
|
|
7272
|
+
// Decode parts of the file on first use instead of at import.
|
|
7273
|
+
this.deferDecoding = false;
|
|
6995
7274
|
// When true, emits performance.mark/measure entries during RiveFile load.
|
|
6996
7275
|
this.enablePerfMarks = false;
|
|
6997
7276
|
this.referenceCount = 0;
|
|
@@ -7021,6 +7300,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
7021
7300
|
typeof params.enableRiveAssetCDN == "boolean"
|
|
7022
7301
|
? params.enableRiveAssetCDN
|
|
7023
7302
|
: true;
|
|
7303
|
+
this.deferDecoding = !!params.deferDecoding;
|
|
7024
7304
|
this.enablePerfMarks = !!params.enablePerfMarks;
|
|
7025
7305
|
if (this.enablePerfMarks)
|
|
7026
7306
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.enablePerfMarks = true;
|
|
@@ -7094,7 +7374,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
7094
7374
|
case 5:
|
|
7095
7375
|
_c.trys.push([5, 7, , 8]);
|
|
7096
7376
|
_b = this;
|
|
7097
|
-
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN, this.session)];
|
|
7377
|
+
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN, this.session, this.deferDecoding)];
|
|
7098
7378
|
case 6:
|
|
7099
7379
|
_b.file = _c.sent();
|
|
7100
7380
|
return [3 /*break*/, 8];
|
|
@@ -7329,6 +7609,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
7329
7609
|
buffer: this.buffer,
|
|
7330
7610
|
assetLoader: this.assetLoader,
|
|
7331
7611
|
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
7612
|
+
deferDecoding: this.deferDecoding,
|
|
7332
7613
|
enablePerfMarks: this.enablePerfMarks,
|
|
7333
7614
|
enableGPUCanvas: deferred,
|
|
7334
7615
|
});
|
|
@@ -7464,6 +7745,8 @@ var Rive = /** @class */ (function () {
|
|
|
7464
7745
|
this.enableMultiTouch = false;
|
|
7465
7746
|
// Allow the runtime to automatically load assets hosted in Rive's runtime.
|
|
7466
7747
|
this.enableRiveAssetCDN = true;
|
|
7748
|
+
// Forwarded to the file this instance imports itself.
|
|
7749
|
+
this.deferDecoding = false;
|
|
7467
7750
|
this.semanticsMode = _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticMode.Disabled;
|
|
7468
7751
|
this.semanticsOptions = {
|
|
7469
7752
|
riveCanvasLabel: "Rive animation",
|
|
@@ -7497,6 +7780,13 @@ var Rive = /** @class */ (function () {
|
|
|
7497
7780
|
// Set by stopRendering(), cleared by startRendering(). Prevents the
|
|
7498
7781
|
// visibilitychange handler from restarting a rendering loop the caller intentionally stopped.
|
|
7499
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(); };
|
|
7500
7790
|
this._viewModelInstance = null;
|
|
7501
7791
|
// User-provided global view model instances, keyed by their global view
|
|
7502
7792
|
// model's name. Globals not present here are still driven by the default
|
|
@@ -7609,10 +7899,15 @@ var Rive = /** @class */ (function () {
|
|
|
7609
7899
|
: this.dispatchPointerExit;
|
|
7610
7900
|
this.enableMultiTouch = !!params.enableMultiTouch;
|
|
7611
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
|
+
}
|
|
7612
7906
|
this.enableRiveAssetCDN =
|
|
7613
7907
|
params.enableRiveAssetCDN === undefined
|
|
7614
7908
|
? true
|
|
7615
7909
|
: params.enableRiveAssetCDN;
|
|
7910
|
+
this.deferDecoding = !!params.deferDecoding;
|
|
7616
7911
|
this.enablePerfMarks = !!params.enablePerfMarks;
|
|
7617
7912
|
if (this.enablePerfMarks)
|
|
7618
7913
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.enablePerfMarks = true;
|
|
@@ -7721,6 +8016,7 @@ var Rive = /** @class */ (function () {
|
|
|
7721
8016
|
* default {@link SemanticMode.Disabled}.
|
|
7722
8017
|
*/
|
|
7723
8018
|
Rive.prototype.enableSemantics = function () {
|
|
8019
|
+
this.wake();
|
|
7724
8020
|
this.semanticsMode = _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticMode.Enabled;
|
|
7725
8021
|
this.activateSemantics();
|
|
7726
8022
|
};
|
|
@@ -7817,6 +8113,7 @@ var Rive = /** @class */ (function () {
|
|
|
7817
8113
|
return;
|
|
7818
8114
|
}
|
|
7819
8115
|
_this.runtime = runtime;
|
|
8116
|
+
runtime.onAssetChange = Rive.wakeSettledInstances;
|
|
7820
8117
|
_this.removeRiveListeners();
|
|
7821
8118
|
// load() reinitializes without cleanupInstances(); drop any stale overlay
|
|
7822
8119
|
// bound to the previous file's state machines (no-op on first construct).
|
|
@@ -7836,6 +8133,7 @@ var Rive = /** @class */ (function () {
|
|
|
7836
8133
|
((_b = (_a = _this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredRequested) !== null && _b !== void 0 ? _b : true),
|
|
7837
8134
|
// Draws notice a restored context, so one has to be scheduled.
|
|
7838
8135
|
onContextRestored: function () {
|
|
8136
|
+
_this.removeFromSettledInstances();
|
|
7839
8137
|
if (!_this._explicitlyStoppedRendering) {
|
|
7840
8138
|
_this.scheduleRendering();
|
|
7841
8139
|
}
|
|
@@ -7915,6 +8213,7 @@ var Rive = /** @class */ (function () {
|
|
|
7915
8213
|
enableMultiTouch: enableMultiTouch,
|
|
7916
8214
|
layoutScaleFactor: this._layout.layoutScaleFactor,
|
|
7917
8215
|
advanceAndDrain: this.advanceAndDrainForPointer.bind(this),
|
|
8216
|
+
wake: this.wake.bind(this),
|
|
7918
8217
|
summonKeyboard: this.summonKeyboardForGesture.bind(this),
|
|
7919
8218
|
isTextProxyFocused: this.isEditingHostFocused,
|
|
7920
8219
|
});
|
|
@@ -7955,6 +8254,7 @@ var Rive = /** @class */ (function () {
|
|
|
7955
8254
|
stateMachine: smWithFocusNodes.instance,
|
|
7956
8255
|
hasFocusNodes: true,
|
|
7957
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(); },
|
|
7958
8258
|
});
|
|
7959
8259
|
};
|
|
7960
8260
|
/** Runs inside touchend/mouseup so focusing the proxy raises the mobile keyboard. */
|
|
@@ -7977,6 +8277,7 @@ var Rive = /** @class */ (function () {
|
|
|
7977
8277
|
return node === undefined || node.role === _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField;
|
|
7978
8278
|
};
|
|
7979
8279
|
Rive.prototype.advanceAndDrainForPointer = function (elapsedTime, options) {
|
|
8280
|
+
this.wake();
|
|
7980
8281
|
if (!(options === null || options === void 0 ? void 0 : options.pointerDown)) {
|
|
7981
8282
|
this.advanceAndReportChanges(elapsedTime);
|
|
7982
8283
|
return;
|
|
@@ -8000,6 +8301,7 @@ var Rive = /** @class */ (function () {
|
|
|
8000
8301
|
};
|
|
8001
8302
|
// Survives play/pause/stop so the state machine only receives missed changes on resume.
|
|
8002
8303
|
Rive.prototype.ensureGamepadInteractions = function () {
|
|
8304
|
+
var _this = this;
|
|
8003
8305
|
if (this._gamepadInteractions ||
|
|
8004
8306
|
this.shouldDisableGamepad ||
|
|
8005
8307
|
this.shouldDisableRiveListeners) {
|
|
@@ -8008,6 +8310,7 @@ var Rive = /** @class */ (function () {
|
|
|
8008
8310
|
this._gamepadInteractions = new _utils__WEBPACK_IMPORTED_MODULE_3__.GamepadInteractions({
|
|
8009
8311
|
requireFocus: !!this._gamepadOptions.requireFocus,
|
|
8010
8312
|
isFocusWithin: this.isFocusWithinCanvas,
|
|
8313
|
+
onPadConnected: function () { return _this.wake(); },
|
|
8011
8314
|
});
|
|
8012
8315
|
};
|
|
8013
8316
|
Rive.prototype.cleanupGamepadInteractions = function () {
|
|
@@ -8072,6 +8375,7 @@ var Rive = /** @class */ (function () {
|
|
|
8072
8375
|
src: this.src,
|
|
8073
8376
|
buffer: this.buffer,
|
|
8074
8377
|
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
8378
|
+
deferDecoding: this.deferDecoding,
|
|
8075
8379
|
assetLoader: this.assetLoader,
|
|
8076
8380
|
enablePerfMarks: this.enablePerfMarks,
|
|
8077
8381
|
// The instance owns this file, so its flag is the file's flag.
|
|
@@ -8328,6 +8632,7 @@ var Rive = /** @class */ (function () {
|
|
|
8328
8632
|
};
|
|
8329
8633
|
// Initialize for playback
|
|
8330
8634
|
Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
8635
|
+
var _this = this;
|
|
8331
8636
|
if (!this.file) {
|
|
8332
8637
|
return;
|
|
8333
8638
|
}
|
|
@@ -8341,8 +8646,11 @@ var Rive = /** @class */ (function () {
|
|
|
8341
8646
|
}
|
|
8342
8647
|
this.artboard = rootArtboard;
|
|
8343
8648
|
rootArtboard.volume = this._volume * audioManager.systemVolume;
|
|
8649
|
+
// A new artboard has to be drawn, so a settled loop restarts.
|
|
8650
|
+
this.wake();
|
|
8344
8651
|
// Initialize the animator
|
|
8345
8652
|
this.animator = new Animator(this.runtime, this.artboard, this.eventManager);
|
|
8653
|
+
this.animator.onInputChange = function () { return _this.wake(); };
|
|
8346
8654
|
// Initialize the animations; as loaded hasn't happened yet, we need to
|
|
8347
8655
|
// suppress firing the play/pause events until the load event has fired. To
|
|
8348
8656
|
// do this we tell the animator to suppress firing events, and add event
|
|
@@ -8392,6 +8700,10 @@ var Rive = /** @class */ (function () {
|
|
|
8392
8700
|
// Draws the current artboard frame
|
|
8393
8701
|
Rive.prototype.drawFrame = function () {
|
|
8394
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++;
|
|
8395
8707
|
if ((_a = document === null || document === void 0 ? void 0 : document.timeline) === null || _a === void 0 ? void 0 : _a.currentTime) {
|
|
8396
8708
|
if (this.loaded && this.artboard && !this.frameRequestId) {
|
|
8397
8709
|
this.draw(null);
|
|
@@ -8495,6 +8807,7 @@ var Rive = /** @class */ (function () {
|
|
|
8495
8807
|
*
|
|
8496
8808
|
* @param elapsedTime time to advance the state machine by
|
|
8497
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
|
|
8498
8811
|
*/
|
|
8499
8812
|
Rive.prototype.advanceAndReportChanges = function (elapsedTime, frameTime) {
|
|
8500
8813
|
var _a, _b, _c, _d;
|
|
@@ -8517,10 +8830,11 @@ var Rive = /** @class */ (function () {
|
|
|
8517
8830
|
// - Advance non-paused state machines by the elapsed number of seconds
|
|
8518
8831
|
// - Advance to the first frame even when autoplay is false
|
|
8519
8832
|
var activeStateMachines = this.animator.stateMachines.filter(function (a) { return a.playing; });
|
|
8833
|
+
var needsAdvance = activeAnimations.length > 0 || activeStateMachines.length === 0;
|
|
8520
8834
|
// Gamepad input lands before this frame's advance.
|
|
8521
8835
|
// Also, frameTime is not passed for other places this function is called (i.e. after pointer events)
|
|
8522
8836
|
if (frameTime !== undefined) {
|
|
8523
|
-
(_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);
|
|
8524
8838
|
}
|
|
8525
8839
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
8526
8840
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
@@ -8561,7 +8875,9 @@ var Rive = /** @class */ (function () {
|
|
|
8561
8875
|
}
|
|
8562
8876
|
if (_perfFrame >= 0)
|
|
8563
8877
|
performance.mark("rive:sm-advance:start:f".concat(_perfFrame));
|
|
8564
|
-
stateMachine.advanceAndApply(elapsedTime)
|
|
8878
|
+
if (stateMachine.advanceAndApply(elapsedTime) !== false) {
|
|
8879
|
+
needsAdvance = true;
|
|
8880
|
+
}
|
|
8565
8881
|
if (_perfFrame >= 0) {
|
|
8566
8882
|
performance.mark("rive:sm-advance:end:f".concat(_perfFrame));
|
|
8567
8883
|
performance.measure("rive:sm-advance:f".concat(_perfFrame), "rive:sm-advance:start:f".concat(_perfFrame), "rive:sm-advance:end:f".concat(_perfFrame));
|
|
@@ -8597,7 +8913,7 @@ var Rive = /** @class */ (function () {
|
|
|
8597
8913
|
return mainSm_1.focusSemanticNode(nodeId);
|
|
8598
8914
|
},
|
|
8599
8915
|
clearFocus: function () {
|
|
8600
|
-
return mainSm_1.
|
|
8916
|
+
return mainSm_1.clearFocus();
|
|
8601
8917
|
},
|
|
8602
8918
|
});
|
|
8603
8919
|
}
|
|
@@ -8647,13 +8963,14 @@ var Rive = /** @class */ (function () {
|
|
|
8647
8963
|
instance.handleCallbacks();
|
|
8648
8964
|
}
|
|
8649
8965
|
});
|
|
8966
|
+
return needsAdvance;
|
|
8650
8967
|
};
|
|
8651
8968
|
/**
|
|
8652
8969
|
* Draw rendering loop; renders animation frames at the correct time interval.
|
|
8653
8970
|
* @param time the rAF timestamp, or null to draw now without advancing
|
|
8654
8971
|
*/
|
|
8655
8972
|
Rive.prototype.draw = function (time, onSecond) {
|
|
8656
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8973
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8657
8974
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
8658
8975
|
this.frameRequestId = null;
|
|
8659
8976
|
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
@@ -8661,9 +8978,22 @@ var Rive = /** @class */ (function () {
|
|
|
8661
8978
|
if (!this.artboard) {
|
|
8662
8979
|
return;
|
|
8663
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
|
+
}
|
|
8664
8994
|
// The replay worker's context came back empty, so everything it held has
|
|
8665
8995
|
// to be recorded again through a fresh renderer and session.
|
|
8666
|
-
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) {
|
|
8667
8997
|
this.reloadForRestoredContext();
|
|
8668
8998
|
return;
|
|
8669
8999
|
}
|
|
@@ -8671,8 +9001,8 @@ var Rive = /** @class */ (function () {
|
|
|
8671
9001
|
// frames, or is slower than the display and this frame falls between its
|
|
8672
9002
|
// paced ones. Waiting keeps its queue bounded, and the frame that follows
|
|
8673
9003
|
// advances by the whole wait, so playback keeps time.
|
|
8674
|
-
var accepts = ((
|
|
8675
|
-
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);
|
|
8676
9006
|
if (time !== null && replayMs !== undefined
|
|
8677
9007
|
? !this.replayPacer.shouldRecord(time, replayMs, accepts)
|
|
8678
9008
|
: !accepts) {
|
|
@@ -8707,11 +9037,24 @@ var Rive = /** @class */ (function () {
|
|
|
8707
9037
|
// Calculate the elapsed time between frames in seconds
|
|
8708
9038
|
var elapsedTime = (frameTime - this.lastRenderTime) / 1000;
|
|
8709
9039
|
this.lastRenderTime = frameTime;
|
|
8710
|
-
this.
|
|
9040
|
+
var wakeGenerationAtFrameStart = this._wakeGeneration;
|
|
9041
|
+
var assetGenerationAtFrameStart = assetGeneration;
|
|
9042
|
+
var needsAdvance = this.advanceAndReportChanges(elapsedTime, time);
|
|
8711
9043
|
var renderer = this.renderer;
|
|
8712
9044
|
// Don't draw on a 0-size canvas; redraw once it has area. The observer
|
|
8713
9045
|
// flags zero size late, so also check the surface itself.
|
|
8714
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();
|
|
8715
9058
|
if (!hasSurface) {
|
|
8716
9059
|
this._needsRedraw = true;
|
|
8717
9060
|
}
|
|
@@ -8766,8 +9109,15 @@ var Rive = /** @class */ (function () {
|
|
|
8766
9109
|
// Calling requestAnimationFrame will rerun draw() at the correct rate:
|
|
8767
9110
|
// https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations
|
|
8768
9111
|
if (this.animator.isPlaying) {
|
|
8769
|
-
|
|
8770
|
-
|
|
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
|
+
}
|
|
8771
9121
|
}
|
|
8772
9122
|
else if (this.animator.isPaused) {
|
|
8773
9123
|
// Reset the end time so on playback it starts at the correct frame
|
|
@@ -8820,8 +9170,13 @@ var Rive = /** @class */ (function () {
|
|
|
8820
9170
|
* Rive class
|
|
8821
9171
|
*/
|
|
8822
9172
|
Rive.prototype.cleanup = function () {
|
|
8823
|
-
var
|
|
9173
|
+
var _this = this;
|
|
9174
|
+
var _a, _b, _c, _d;
|
|
9175
|
+
if (this._enableSettling && !this.destroyed) {
|
|
9176
|
+
settlingEnabledInstanceCount--;
|
|
9177
|
+
}
|
|
8824
9178
|
this.destroyed = true;
|
|
9179
|
+
this.removeFromSettledInstances();
|
|
8825
9180
|
// Stop the renderer if it hasn't already been stopped.
|
|
8826
9181
|
this.stopRendering();
|
|
8827
9182
|
// Make the GL context backing this renderer current before any WASM teardown
|
|
@@ -8854,9 +9209,11 @@ var Rive = /** @class */ (function () {
|
|
|
8854
9209
|
document.removeEventListener('visibilitychange', this._pageVisibilityHandler);
|
|
8855
9210
|
this._pageVisibilityHandler = null;
|
|
8856
9211
|
}
|
|
8857
|
-
(
|
|
9212
|
+
this.releaseViewModelInstance(this._viewModelInstance);
|
|
8858
9213
|
this._viewModelInstance = null;
|
|
8859
|
-
this._globalViewModelInstances.forEach(function (instance) {
|
|
9214
|
+
this._globalViewModelInstances.forEach(function (instance) {
|
|
9215
|
+
return _this.releaseViewModelInstance(instance);
|
|
9216
|
+
});
|
|
8860
9217
|
this._globalViewModelInstances.clear();
|
|
8861
9218
|
this._dataEnums = null;
|
|
8862
9219
|
};
|
|
@@ -8986,6 +9343,7 @@ var Rive = /** @class */ (function () {
|
|
|
8986
9343
|
* @param textRunValue - String value to set on the text run node
|
|
8987
9344
|
*/
|
|
8988
9345
|
Rive.prototype.setTextRunValue = function (textRunName, textRunValue) {
|
|
9346
|
+
this.wake();
|
|
8989
9347
|
warnOnce(DeprecationKeys.textRuns, textRunsDeprecationWarning);
|
|
8990
9348
|
var textRun = this.retrieveTextRun(textRunName);
|
|
8991
9349
|
if (textRun) {
|
|
@@ -9059,6 +9417,7 @@ var Rive = /** @class */ (function () {
|
|
|
9059
9417
|
}
|
|
9060
9418
|
this.cleanupKeyboardInteractions();
|
|
9061
9419
|
this.animator.pause(names);
|
|
9420
|
+
this.removeFromSettledInstancesIfNotPlaying();
|
|
9062
9421
|
this.warnIfLinearAnimationNames(names, "pause");
|
|
9063
9422
|
};
|
|
9064
9423
|
/**
|
|
@@ -9114,6 +9473,7 @@ var Rive = /** @class */ (function () {
|
|
|
9114
9473
|
}
|
|
9115
9474
|
this.cleanupKeyboardInteractions();
|
|
9116
9475
|
this.cleanupSemantics();
|
|
9476
|
+
this.removeFromSettledInstancesIfNotPlaying();
|
|
9117
9477
|
};
|
|
9118
9478
|
/**
|
|
9119
9479
|
* Resets the animation
|
|
@@ -9165,6 +9525,7 @@ var Rive = /** @class */ (function () {
|
|
|
9165
9525
|
},
|
|
9166
9526
|
// Sets a new layout
|
|
9167
9527
|
set: function (layout) {
|
|
9528
|
+
this.wake();
|
|
9168
9529
|
this._layout = layout;
|
|
9169
9530
|
this.reportDisplayScale();
|
|
9170
9531
|
// Fit/alignment/bounds feed the overlay transform.
|
|
@@ -9185,6 +9546,7 @@ var Rive = /** @class */ (function () {
|
|
|
9185
9546
|
* when the canvas is resized
|
|
9186
9547
|
*/
|
|
9187
9548
|
Rive.prototype.resizeToCanvas = function () {
|
|
9549
|
+
this.wake();
|
|
9188
9550
|
this._layout = this.layout.copyWith({
|
|
9189
9551
|
minX: 0,
|
|
9190
9552
|
minY: 0,
|
|
@@ -9347,6 +9709,7 @@ var Rive = /** @class */ (function () {
|
|
|
9347
9709
|
* @param path the path the input is located at an artboard level
|
|
9348
9710
|
*/
|
|
9349
9711
|
Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {
|
|
9712
|
+
this.wake();
|
|
9350
9713
|
warnOnce(DeprecationKeys.stateMachineInputs, stateMachineInputsDeprecationWarning);
|
|
9351
9714
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
9352
9715
|
if (!input)
|
|
@@ -9369,6 +9732,7 @@ var Rive = /** @class */ (function () {
|
|
|
9369
9732
|
* @param path the path the input is located at an artboard level
|
|
9370
9733
|
*/
|
|
9371
9734
|
Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {
|
|
9735
|
+
this.wake();
|
|
9372
9736
|
warnOnce(DeprecationKeys.stateMachineInputs, stateMachineInputsDeprecationWarning);
|
|
9373
9737
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
9374
9738
|
if (!input)
|
|
@@ -9390,6 +9754,7 @@ var Rive = /** @class */ (function () {
|
|
|
9390
9754
|
* @param path the path the input is located at an artboard level
|
|
9391
9755
|
*/
|
|
9392
9756
|
Rive.prototype.fireStateAtPath = function (inputName, path) {
|
|
9757
|
+
this.wake();
|
|
9393
9758
|
warnOnce(DeprecationKeys.stateMachineInputs, stateMachineInputsDeprecationWarning);
|
|
9394
9759
|
var input = this.retrieveInputAtPath(inputName, path);
|
|
9395
9760
|
if (!input)
|
|
@@ -9475,6 +9840,7 @@ var Rive = /** @class */ (function () {
|
|
|
9475
9840
|
* for how to migrate.
|
|
9476
9841
|
*/
|
|
9477
9842
|
Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
|
|
9843
|
+
this.wake();
|
|
9478
9844
|
warnOnce(DeprecationKeys.textRuns, textRunsDeprecationWarning);
|
|
9479
9845
|
var run = this.retrieveTextAtPath(textName, path);
|
|
9480
9846
|
if (!run) {
|
|
@@ -9678,10 +10044,74 @@ var Rive = /** @class */ (function () {
|
|
|
9678
10044
|
this._explicitlyStoppedRendering = false;
|
|
9679
10045
|
this.drawFrame();
|
|
9680
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
|
+
};
|
|
9681
10110
|
Rive.prototype.scheduleRendering = function () {
|
|
10111
|
+
var _a, _b;
|
|
9682
10112
|
if (this.loaded && this.artboard && !this.frameRequestId) {
|
|
9683
10113
|
if (this.runtime.requestAnimationFrame) {
|
|
9684
|
-
this.frameRequestId = this.runtime.requestAnimationFrame(this._boundDraw);
|
|
10114
|
+
this.frameRequestId = this.runtime.requestAnimationFrame(this._boundDraw, ((_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.replaysOnWorker) === null || _b === void 0 ? void 0 : _b.call(_a)) === true);
|
|
9685
10115
|
}
|
|
9686
10116
|
else {
|
|
9687
10117
|
this.frameRequestId = requestAnimationFrame(this._boundDraw);
|
|
@@ -9709,7 +10139,9 @@ var Rive = /** @class */ (function () {
|
|
|
9709
10139
|
// Reset so the first resumed frame starts with elapsedTime === 0.
|
|
9710
10140
|
this.lastRenderTime = 0;
|
|
9711
10141
|
}
|
|
9712
|
-
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) {
|
|
9713
10145
|
this.scheduleRendering();
|
|
9714
10146
|
}
|
|
9715
10147
|
};
|
|
@@ -9809,6 +10241,7 @@ var Rive = /** @class */ (function () {
|
|
|
9809
10241
|
return (_a = this._artboardWidth) !== null && _a !== void 0 ? _a : 0;
|
|
9810
10242
|
},
|
|
9811
10243
|
set: function (value) {
|
|
10244
|
+
this.wake();
|
|
9812
10245
|
this._artboardWidth = value;
|
|
9813
10246
|
if (this.artboard) {
|
|
9814
10247
|
this.artboard.width = value;
|
|
@@ -9836,6 +10269,7 @@ var Rive = /** @class */ (function () {
|
|
|
9836
10269
|
return (_a = this._artboardHeight) !== null && _a !== void 0 ? _a : 0;
|
|
9837
10270
|
},
|
|
9838
10271
|
set: function (value) {
|
|
10272
|
+
this.wake();
|
|
9839
10273
|
this._artboardHeight = value;
|
|
9840
10274
|
if (this.artboard) {
|
|
9841
10275
|
this.artboard.height = value;
|
|
@@ -9848,6 +10282,7 @@ var Rive = /** @class */ (function () {
|
|
|
9848
10282
|
* Reset the artboard size to its original values.
|
|
9849
10283
|
*/
|
|
9850
10284
|
Rive.prototype.resetArtboardSize = function () {
|
|
10285
|
+
this.wake();
|
|
9851
10286
|
if (this.artboard) {
|
|
9852
10287
|
this.artboard.resetArtboardSize();
|
|
9853
10288
|
this._artboardWidth = this.artboard.width;
|
|
@@ -9870,6 +10305,7 @@ var Rive = /** @class */ (function () {
|
|
|
9870
10305
|
return this._devicePixelRatioUsed;
|
|
9871
10306
|
},
|
|
9872
10307
|
set: function (value) {
|
|
10308
|
+
this.wake();
|
|
9873
10309
|
if (value !== this._devicePixelRatioUsed) {
|
|
9874
10310
|
this._overlayTransformDirty = true;
|
|
9875
10311
|
}
|
|
@@ -9930,6 +10366,7 @@ var Rive = /** @class */ (function () {
|
|
|
9930
10366
|
* `setViewModelInstance(vmi)` followed by `bind()`.
|
|
9931
10367
|
*/
|
|
9932
10368
|
Rive.prototype.bindViewModelInstance = function (viewModelInstance) {
|
|
10369
|
+
this.wake();
|
|
9933
10370
|
if (!viewModelInstance) {
|
|
9934
10371
|
return;
|
|
9935
10372
|
}
|
|
@@ -9942,7 +10379,7 @@ var Rive = /** @class */ (function () {
|
|
|
9942
10379
|
* to batch multiple changes into a single rebind.
|
|
9943
10380
|
*/
|
|
9944
10381
|
Rive.prototype.setViewModelInstance = function (viewModelInstance) {
|
|
9945
|
-
|
|
10382
|
+
this.wake();
|
|
9946
10383
|
var runtimeInstance = viewModelInstance === null || viewModelInstance === void 0 ? void 0 : viewModelInstance.runtimeInstance;
|
|
9947
10384
|
if (!this.artboard ||
|
|
9948
10385
|
this.destroyed ||
|
|
@@ -9950,8 +10387,7 @@ var Rive = /** @class */ (function () {
|
|
|
9950
10387
|
!runtimeInstance) {
|
|
9951
10388
|
return;
|
|
9952
10389
|
}
|
|
9953
|
-
viewModelInstance.
|
|
9954
|
-
(_a = this._viewModelInstance) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
10390
|
+
this.holdViewModelInstance(viewModelInstance, this._viewModelInstance);
|
|
9955
10391
|
this._viewModelInstance = viewModelInstance;
|
|
9956
10392
|
if (this.animator.stateMachines.length > 0) {
|
|
9957
10393
|
this.animator.stateMachines.forEach(function (stateMachine) {
|
|
@@ -9962,12 +10398,25 @@ var Rive = /** @class */ (function () {
|
|
|
9962
10398
|
this.artboard.setViewModelInstance(runtimeInstance);
|
|
9963
10399
|
}
|
|
9964
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
|
+
};
|
|
9965
10413
|
/**
|
|
9966
10414
|
* Applies any pending `set*` view model instance changes by rebinding the
|
|
9967
10415
|
* data binds once.
|
|
9968
10416
|
* Implicitly creates and binds any view models that have not been set.
|
|
9969
10417
|
*/
|
|
9970
10418
|
Rive.prototype.bind = function () {
|
|
10419
|
+
this.wake();
|
|
9971
10420
|
if (!this.artboard || this.destroyed) {
|
|
9972
10421
|
return;
|
|
9973
10422
|
}
|
|
@@ -9998,7 +10447,7 @@ var Rive = /** @class */ (function () {
|
|
|
9998
10447
|
* global view model in the file)
|
|
9999
10448
|
*/
|
|
10000
10449
|
Rive.prototype.setGlobalViewModelInstance = function (name, viewModelInstance) {
|
|
10001
|
-
|
|
10450
|
+
this.wake();
|
|
10002
10451
|
var runtimeInstance = viewModelInstance === null || viewModelInstance === void 0 ? void 0 : viewModelInstance.runtimeInstance;
|
|
10003
10452
|
if (!this.artboard || this.destroyed || !runtimeInstance) {
|
|
10004
10453
|
return false;
|
|
@@ -10015,8 +10464,7 @@ var Rive = /** @class */ (function () {
|
|
|
10015
10464
|
bound = this.artboard.setGlobalViewModelInstance(name, runtimeInstance);
|
|
10016
10465
|
}
|
|
10017
10466
|
if (bound) {
|
|
10018
|
-
viewModelInstance.
|
|
10019
|
-
(_a = this._globalViewModelInstances.get(name)) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
10467
|
+
this.holdViewModelInstance(viewModelInstance, this._globalViewModelInstances.get(name));
|
|
10020
10468
|
this._globalViewModelInstances.set(name, viewModelInstance);
|
|
10021
10469
|
}
|
|
10022
10470
|
return bound;
|
|
@@ -10047,7 +10495,7 @@ var Rive = /** @class */ (function () {
|
|
|
10047
10495
|
}
|
|
10048
10496
|
var viewModelInstance = new ViewModelInstance(runtimeInstance, null);
|
|
10049
10497
|
(0,_utils__WEBPACK_IMPORTED_MODULE_3__.createFinalization)(viewModelInstance, runtimeInstance);
|
|
10050
|
-
|
|
10498
|
+
this.holdViewModelInstance(viewModelInstance, undefined);
|
|
10051
10499
|
this._globalViewModelInstances.set(name, viewModelInstance);
|
|
10052
10500
|
return viewModelInstance;
|
|
10053
10501
|
};
|
|
@@ -10121,6 +10569,13 @@ var Rive = /** @class */ (function () {
|
|
|
10121
10569
|
Rive.missingErrorMessage = "Rive source file or data buffer required";
|
|
10122
10570
|
// Error message for removed rive file
|
|
10123
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
|
+
};
|
|
10124
10579
|
// performance.now() at the current rAF batch's start; first frames seed from it.
|
|
10125
10580
|
Rive.batchStart = { time: -1, now: 0 };
|
|
10126
10581
|
return Rive;
|
|
@@ -10254,6 +10709,9 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
10254
10709
|
this._viewModelInstances = new Map();
|
|
10255
10710
|
this._propertiesWithCallbacks = [];
|
|
10256
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;
|
|
10257
10715
|
this.selfUnref = false;
|
|
10258
10716
|
this._runtimeInstance = runtimeInstance;
|
|
10259
10717
|
if (parent !== null) {
|
|
@@ -10285,6 +10743,53 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
10285
10743
|
}
|
|
10286
10744
|
this._children.forEach(function (child) { return child.handleCallbacks(); });
|
|
10287
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
|
+
};
|
|
10288
10793
|
ViewModelInstance.prototype.addParent = function (parent) {
|
|
10289
10794
|
if (!this._parents.includes(parent)) {
|
|
10290
10795
|
this._parents.push(parent);
|
|
@@ -10604,6 +11109,7 @@ var ViewModelInstance = /** @class */ (function () {
|
|
|
10604
11109
|
*/
|
|
10605
11110
|
ViewModelInstance.prototype.replaceViewModel = function (path, value) {
|
|
10606
11111
|
var _a;
|
|
11112
|
+
this.internalWake();
|
|
10607
11113
|
var pathSegments = path.split("/");
|
|
10608
11114
|
var viewModelInstance = pathSegments.length > 1
|
|
10609
11115
|
? this.viewModelFromPathSegments(pathSegments.slice(0, pathSegments.length - 1), 0)
|
|
@@ -10709,6 +11215,10 @@ var ViewModelInstanceValue = /** @class */ (function () {
|
|
|
10709
11215
|
}
|
|
10710
11216
|
};
|
|
10711
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
|
+
};
|
|
10712
11222
|
ViewModelInstanceValue.prototype.handleCallbacks = function () {
|
|
10713
11223
|
var _this = this;
|
|
10714
11224
|
if (this._viewModelInstanceValue.hasChanged) {
|
|
@@ -10743,6 +11253,7 @@ var ViewModelInstanceString = /** @class */ (function (_super) {
|
|
|
10743
11253
|
return this._viewModelInstanceValue.value;
|
|
10744
11254
|
},
|
|
10745
11255
|
set: function (val) {
|
|
11256
|
+
this.wakeOwners();
|
|
10746
11257
|
this._viewModelInstanceValue.value = val;
|
|
10747
11258
|
},
|
|
10748
11259
|
enumerable: false,
|
|
@@ -10764,6 +11275,7 @@ var ViewModelInstanceNumber = /** @class */ (function (_super) {
|
|
|
10764
11275
|
return this._viewModelInstanceValue.value;
|
|
10765
11276
|
},
|
|
10766
11277
|
set: function (val) {
|
|
11278
|
+
this.wakeOwners();
|
|
10767
11279
|
this._viewModelInstanceValue.value = val;
|
|
10768
11280
|
},
|
|
10769
11281
|
enumerable: false,
|
|
@@ -10785,6 +11297,7 @@ var ViewModelInstanceBoolean = /** @class */ (function (_super) {
|
|
|
10785
11297
|
return this._viewModelInstanceValue.value;
|
|
10786
11298
|
},
|
|
10787
11299
|
set: function (val) {
|
|
11300
|
+
this.wakeOwners();
|
|
10788
11301
|
this._viewModelInstanceValue.value = val;
|
|
10789
11302
|
},
|
|
10790
11303
|
enumerable: false,
|
|
@@ -10802,6 +11315,7 @@ var ViewModelInstanceTrigger = /** @class */ (function (_super) {
|
|
|
10802
11315
|
return _super.call(this, instance, parent) || this;
|
|
10803
11316
|
}
|
|
10804
11317
|
ViewModelInstanceTrigger.prototype.trigger = function () {
|
|
11318
|
+
this.wakeOwners();
|
|
10805
11319
|
return this._viewModelInstanceValue.trigger();
|
|
10806
11320
|
};
|
|
10807
11321
|
ViewModelInstanceTrigger.prototype.internalHandleCallback = function (callback) {
|
|
@@ -10820,6 +11334,7 @@ var ViewModelInstanceEnum = /** @class */ (function (_super) {
|
|
|
10820
11334
|
return this._viewModelInstanceValue.value;
|
|
10821
11335
|
},
|
|
10822
11336
|
set: function (val) {
|
|
11337
|
+
this.wakeOwners();
|
|
10823
11338
|
this._viewModelInstanceValue.value = val;
|
|
10824
11339
|
},
|
|
10825
11340
|
enumerable: false,
|
|
@@ -10831,6 +11346,7 @@ var ViewModelInstanceEnum = /** @class */ (function (_super) {
|
|
|
10831
11346
|
.valueIndex;
|
|
10832
11347
|
},
|
|
10833
11348
|
set: function (val) {
|
|
11349
|
+
this.wakeOwners();
|
|
10834
11350
|
this._viewModelInstanceValue.valueIndex = val;
|
|
10835
11351
|
},
|
|
10836
11352
|
enumerable: false,
|
|
@@ -10862,12 +11378,14 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
10862
11378
|
configurable: true
|
|
10863
11379
|
});
|
|
10864
11380
|
ViewModelInstanceList.prototype.addInstance = function (instance) {
|
|
11381
|
+
this.wakeOwners();
|
|
10865
11382
|
if (instance.runtimeInstance != null) {
|
|
10866
11383
|
this._viewModelInstanceValue.addInstance(instance.runtimeInstance);
|
|
10867
11384
|
instance.addParent(this._parentViewModel);
|
|
10868
11385
|
}
|
|
10869
11386
|
};
|
|
10870
11387
|
ViewModelInstanceList.prototype.addInstanceAt = function (instance, index) {
|
|
11388
|
+
this.wakeOwners();
|
|
10871
11389
|
if (instance.runtimeInstance != null) {
|
|
10872
11390
|
if (this._viewModelInstanceValue.addInstanceAt(instance.runtimeInstance, index)) {
|
|
10873
11391
|
instance.addParent(this._parentViewModel);
|
|
@@ -10877,12 +11395,14 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
10877
11395
|
return false;
|
|
10878
11396
|
};
|
|
10879
11397
|
ViewModelInstanceList.prototype.removeInstance = function (instance) {
|
|
11398
|
+
this.wakeOwners();
|
|
10880
11399
|
if (instance.runtimeInstance != null) {
|
|
10881
11400
|
this._viewModelInstanceValue.removeInstance(instance.runtimeInstance);
|
|
10882
11401
|
instance.removeParent(this._parentViewModel);
|
|
10883
11402
|
}
|
|
10884
11403
|
};
|
|
10885
11404
|
ViewModelInstanceList.prototype.removeInstanceAt = function (index) {
|
|
11405
|
+
this.wakeOwners();
|
|
10886
11406
|
this._viewModelInstanceValue.removeInstanceAt(index);
|
|
10887
11407
|
};
|
|
10888
11408
|
ViewModelInstanceList.prototype.instanceAt = function (index) {
|
|
@@ -10895,6 +11415,7 @@ var ViewModelInstanceList = /** @class */ (function (_super) {
|
|
|
10895
11415
|
return null;
|
|
10896
11416
|
};
|
|
10897
11417
|
ViewModelInstanceList.prototype.swap = function (a, b) {
|
|
11418
|
+
this.wakeOwners();
|
|
10898
11419
|
this._viewModelInstanceValue.swap(a, b);
|
|
10899
11420
|
};
|
|
10900
11421
|
ViewModelInstanceList.prototype.internalHandleCallback = function (callback) {
|
|
@@ -10913,26 +11434,32 @@ var ViewModelInstanceColor = /** @class */ (function (_super) {
|
|
|
10913
11434
|
return this._viewModelInstanceValue.value;
|
|
10914
11435
|
},
|
|
10915
11436
|
set: function (val) {
|
|
11437
|
+
this.wakeOwners();
|
|
10916
11438
|
this._viewModelInstanceValue.value = val;
|
|
10917
11439
|
},
|
|
10918
11440
|
enumerable: false,
|
|
10919
11441
|
configurable: true
|
|
10920
11442
|
});
|
|
10921
11443
|
ViewModelInstanceColor.prototype.rgb = function (r, g, b) {
|
|
11444
|
+
this.wakeOwners();
|
|
10922
11445
|
this._viewModelInstanceValue.rgb(r, g, b);
|
|
10923
11446
|
};
|
|
10924
11447
|
ViewModelInstanceColor.prototype.rgba = function (r, g, b, a) {
|
|
11448
|
+
this.wakeOwners();
|
|
10925
11449
|
this._viewModelInstanceValue.argb(a, r, g, b);
|
|
10926
11450
|
};
|
|
10927
11451
|
ViewModelInstanceColor.prototype.argb = function (a, r, g, b) {
|
|
11452
|
+
this.wakeOwners();
|
|
10928
11453
|
this._viewModelInstanceValue.argb(a, r, g, b);
|
|
10929
11454
|
};
|
|
10930
11455
|
// Value 0 to 255
|
|
10931
11456
|
ViewModelInstanceColor.prototype.alpha = function (a) {
|
|
11457
|
+
this.wakeOwners();
|
|
10932
11458
|
this._viewModelInstanceValue.alpha(a);
|
|
10933
11459
|
};
|
|
10934
11460
|
// Value 0 to 1
|
|
10935
11461
|
ViewModelInstanceColor.prototype.opacity = function (o) {
|
|
11462
|
+
this.wakeOwners();
|
|
10936
11463
|
this._viewModelInstanceValue.alpha(Math.round(Math.max(0, Math.min(1, o)) * 255));
|
|
10937
11464
|
};
|
|
10938
11465
|
ViewModelInstanceColor.prototype.internalHandleCallback = function (callback) {
|
|
@@ -10949,6 +11476,7 @@ var ViewModelInstanceAssetImage = /** @class */ (function (_super) {
|
|
|
10949
11476
|
Object.defineProperty(ViewModelInstanceAssetImage.prototype, "value", {
|
|
10950
11477
|
set: function (image) {
|
|
10951
11478
|
var _a;
|
|
11479
|
+
this.wakeOwners();
|
|
10952
11480
|
this._viewModelInstanceValue.value((_a = image === null || image === void 0 ? void 0 : image.nativeImage) !== null && _a !== void 0 ? _a : null);
|
|
10953
11481
|
},
|
|
10954
11482
|
enumerable: false,
|
|
@@ -10968,6 +11496,7 @@ var ViewModelInstanceAssetFont = /** @class */ (function (_super) {
|
|
|
10968
11496
|
Object.defineProperty(ViewModelInstanceAssetFont.prototype, "value", {
|
|
10969
11497
|
set: function (font) {
|
|
10970
11498
|
var _a;
|
|
11499
|
+
this.wakeOwners();
|
|
10971
11500
|
this._viewModelInstanceValue.value((_a = font === null || font === void 0 ? void 0 : font.nativeFont) !== null && _a !== void 0 ? _a : null);
|
|
10972
11501
|
},
|
|
10973
11502
|
enumerable: false,
|
|
@@ -10987,6 +11516,7 @@ var ViewModelInstanceArtboard = /** @class */ (function (_super) {
|
|
|
10987
11516
|
Object.defineProperty(ViewModelInstanceArtboard.prototype, "value", {
|
|
10988
11517
|
set: function (artboard) {
|
|
10989
11518
|
var _a, _b;
|
|
11519
|
+
this.wakeOwners();
|
|
10990
11520
|
var bindableArtboard;
|
|
10991
11521
|
if (artboard.isBindableArtboard) {
|
|
10992
11522
|
bindableArtboard = artboard;
|