@shijiu/jsview 2.2.201 → 2.2.426-test.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/dom/bin/DroidSansFallback.ttf +0 -0
- package/dom/bin/NotoColorEmoji.ttf +0 -0
- package/dom/bin/jsview-dom-browser-engine-core.min.js +2 -0
- package/dom/bin/jsview-dom-browser-engine-modules.min.js +2 -0
- package/dom/bin/jsview-dom-browser-forge.1385.f80e.wasm +0 -0
- package/dom/bin/jsview-dom-browser-forge.min.js +1 -0
- package/dom/bin/jsview-dom-browser-forge.worker.min.js +1 -0
- package/dom/bin/jsview-dom-browser.min.js +1 -1
- package/dom/bin/jsview-dom-native.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -22
- package/dom/bin/jsview-engine-js-native.min.js +2 -0
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/index.mjs +38 -14
- package/dom/target_core_revision.mjs +10 -5
- package/loader/jsv-core-api/jsview-core-api-glue.js +74 -0
- package/loader/jsv-core-api/wasm/backgroundtask.js +66 -0
- package/loader/jsv-core-api/wasm/core-api.js +206 -0
- package/loader/jsview-config.js +22 -0
- package/loader/jsview-loader.js +74 -85
- package/loader/jsview-main.mjs +8 -14
- package/loader/jsview.config.default.js +2 -2
- package/package.json +1 -1
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +67 -6
- package/shijiu-jsview-0.0.0.tgz +0 -0
- package/tools/https-server-config/cert.pem +61 -0
- package/tools/https-server-config/key.pem +27 -0
- package/tools/https-server-config/serve.config.json +16 -0
- package/tools/jsview-common.mjs +87 -3
- package/tools/jsview-post-build.mjs +248 -70
- package/tools/jsview-post-install.mjs +7 -4
- package/tools/jsview-retrieve-sourcemap.mjs +64 -49
- package/tools/jsview-run-tool.mjs +53 -3
- package/tools/jsview-vue-devtools.mjs +2 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* eslint-disable */ let t={sRenderBridge:null,sActivityManager:null,DesignMap:null};window.Forge=t;let s=function(t){},e=function(t){},i=function(t){},n=function(t){throw new Error(t)};class r{constructor(){this.i=[],this.h=[],this.l=[],this.o={}}RequestAlterId(t,s){this.o[t]=s}AddToQueue(t,s){this.i.push(s),this.h.push(t)}HasUpdate(){return this.i.length>0}ReadSyncList(){if(this.l.length>0){for(let t of this.l)t();this.l=[]}let t=this.i;return this.RenewSyncList(),t}AddStartSyncCallback(t){this.l.push(t)}RenewSyncList(){if(this.h)for(let t of this.h)t.RenewSyncInfo(this,null);this.i=[],this.h=[]}ProcAlterIds(t,s){for(let e=0;e<t.length;e++)if(this.o.hasOwnProperty(t[e])){let i=this.o[t[e]];i.OnAlterId(s[e]),i.RenewSyncInfo(this,null)}else console.error(`Error: ProcAlterIds not found proxyId=${t[e]}`);this.o={}}}class h{constructor(t,s=null,e=null){this.u=t,this.PrefSyncInfo=null,this.p=null,this.S=!1,this.v=s,this.SuffSyncInfo=null,this.N=null,this.I=!1,this.InitPackage(e),this.RenewSyncInfo(this.u,null),this.RenewSyncInfo(this.v,null)}AddStartSyncCallback(t){this.u.AddStartSyncCallback(t)}CallToNative(s,e,i=!1){let n={fn:s,a:e};return i?(this.N.push(n),this.I||(this.v.AddToQueue(this,this.SuffSyncInfo),this.I=!0)):(this.p.push(n),this.S||(this.u.AddToQueue(this,this.PrefSyncInfo),this.S=!0)),t.sRenderBridge.RequestSwap(),n}RequestAlterId(t,s=!1){s?this.v.RequestAlterId(t,this):this.u.RequestAlterId(t,this)}SuffCallToNative(t,s){return{fn:t,a:s}}AlterCallParams(t,s){t&&(t.a=s)}RenewSyncInfo(t,s){s||(s={}),this.S=!1,this.I=!1,t&&t==this.u&&(this.p=[],this.PrefSyncInfo={tl:this.p,...s}),t&&t==this.v&&(this.N=[],this.SuffSyncInfo={tl:this.N,...s})}InitPackage(t){}OnAlterId(t){}}let l=new r,a=new r;class o extends h{constructor(t){super(l,a,{id:t}),this.C=null,this.R=t}InitPackage(t){this.R=t.id}RenewSyncInfo(t,s){super.RenewSyncInfo(t,{tt:1,id:this.R})}NeedAlterId(t,s){this.C=t,super.RequestAlterId(this.R,s)}OnAlterId(t){this.R=t,this.C.TexId=t,this.C=null}}let u=new class extends h{constructor(){super(l,a)}RenewSyncInfo(t,s){super.RenewSyncInfo(t,{tt:0})}};let c=new class{constructor(){this.A=[1]}AddData(t){return this.A.push(t),this.A.length-1}TakeArray(){const t=this.A;return this.A=[1],t}PickArray(){return this.A}GetSize(){return this.A.length}ResetForNextSwap(){this.A=[1]}};let d=1;class f{constructor(t,s,e=!1){this.O=s,this.TexId=t,this.P=!1,this.k=0,this.D=0,this.G=null,this.F={},this._=e}GetTextureId(){return this.TexId}RequestSyncerAlterId(){this.O.NeedAlterId(this,this._)}RegisterLoadImageCallback(t,s,e){if(null==s)return 0;if(this.P)return s({width:this.k,height:this.D},e),0;{this.B();const t=d++,i=this,n=(n,r,h)=>{s({width:n,height:r,extra:h?JSON.parse(h):null},e),delete i.F[t]};this.F[t]=n;const r=c.AddData(n);return this.O.CallToNative(1,[t,r],this._),t}}UnregisterLoadImageCallback(t){t>0&&void 0!==this.F[t]&&delete this.F[t]}DispatchCommand(s,e){this.O.CallToNative(3,[s,e],this._),t.sRenderBridge.RequestSwap()}B(){if(null==this.G){const t=this;this.G=(s,e,i)=>{t.P=!0,t.k=s,t.D=e};const s=c.AddData(this.G);this.O.CallToNative(1,[d++,s],this._)}}EnableBackgroundLoad(){this.P||(this.B(),this.O.CallToNative(4,null,this._))}DisableBackgroundLoad(){this.O.CallToNative(5,null,this._)}RequestToUnload(){this.O.CallToNative(6,null,this._)}DisableAutoRecycle(){this.O.CallToNative(7,null,this._)}}class p extends f{constructor(t,s,e=!1){super(t,s,e),this.V=null}registerOnStart(t){this.J();let s=this.V,e=++s.IdGen;if(s.StartMapCount++,s.StartMapCount>0&&0==s.GlobalStartCallbackId){s.GlobalStartCallbackId=e;const t=()=>{for(let t in s.OnStartMap)s.OnStartMap[t]?.()},i=c.AddData(t);this.O.CallToNative(10,[s.GlobalStartCallbackId,i],this._)}return s.OnStartMap[e]=t,e}unregisterOnStart(t){if(!this.V)return;let s=this.V;s.OnStartMap.hasOwnProperty(t)&&s.StartMapCount--,0==s.StartMapCount&&0!=s.GlobalStartCallbackId&&(this.O.CallToNative(11,[s.GlobalStartCallbackId],this._),s.GlobalStartCallbackId=0)}registerOnEnd(t){this.J();let s=this.V,e=++s.IdGen;if(s.EndMapCount++,s.EndMapCount>0&&0==s.GlobalEndCallbackId){s.GlobalEndCallbackId=e;const t=()=>{for(let t in s.OnEndMap)s.OnEndMap[t]?.()},i=c.AddData(t);this.O.CallToNative(12,[s.GlobalEndCallbackId,i],this._)}return s.OnEndMap[e]=t,e}unregisterOnEnd(t){if(!this.V)return;let s=this.V;s.OnEndMap.hasOwnProperty(t)&&s.EndMapCount--,0==s.EndMapCount&&0!=s.GlobalEndCallbackId&&(this.O.CallToNative(13,[s.GlobalEndCallbackId],this._),s.GlobalEndCallbackId=0)}J(){this.V||(this.V={IdGen:1,GlobalStartCallbackId:0,OnStartMap:{},StartMapCount:0,GlobalEndCallbackId:0,OnEndMap:{},EndMapCount:0})}}class y extends p{constructor(t,s){super(t,s,!0)}}let S=window.NativeGetIdGroupIntf();const v=10;class w{constructor(t){this.W=t,this.U=0,this.q=0,this.K=new Array(v),this.j=0;for(let t=0;t<v;t++)this.K[t]={start:0,end:0,expired:!0}}genId(){this.K[this.U].expired&&this.Y();let t=this.K[this.U],s=t.start;return t.start++,t.start>t.end&&(t.expired=!0,this.U=(this.U+1)%v,this.j--),s}Y(){let t=20*(v-this.j);if(t>0){let s=S.GetIdArray(this.W,t);if(s){let t=JSON.parse(s);this.X(t[0],t[1])}}}X(t,s){let e=s-t+1,i=Math.floor(e/20),n=t;for(let t=0;t<i;t++){let t=this.K[this.q];t.start=n,t.end=n+20-1,t.expired=!1,this.q=(this.q+1)%v,n=t.end+1}this.j+=i,this.j>v&&console.error(`team over size to ${this.j}`)}}let m=new class{constructor(){this.$=new w(0),this.Z=new w(1),this.et=new w(2),this.it=new w(3)}genViewId(){return this.$.genId()}genTextureId(){return this.Z.genId()}genAnimationId(){return this.et.genId()}genSensorId(){return this.it.genId()}};var N,x,g;!function(t){t.RGBA_8888="RGBA_8888",t.RGBA_4444="RGBA_4444",t.RGBA_5551="RGBA_5551",t.RGB_565="RGB_565",t.RGB_ETC1="RGB_ETC1",t.RGBA_ETC1="RGBA_ETC1"}(N||(N={})),function(t){t.L=1,t.M=0,t.Q=3,t.H=2}(x||(x={})),function(t){t.AUTO=0,t.SYNC=1,t.ASYNC=2}(g||(g={}));class I{constructor(){this.O=u}GetId(){return 0}GetColorTexture(t){let s=m.genTextureId();this.O.CallToNative(1,[t,s]);let e=new f(s,new o(s));return e.RequestSyncerAlterId(),e}GetImage(t,s,e){return this.GetImage2(t,s,null,null,e)}GetImage2(t,s,e,n=N.RGBA_8888,r="",h=!1){if(!t||0==t.length)return i("GetImage2, url is not setted!"),null;let l=m.genTextureId(),a=0,u=0;e&&(a=e.width,u=e.height),n||(n=N.RGBA_8888),r||(r="");let c=null!=h&&h;this.O.CallToNative(2,[t,a,u,n,r,c,l]);let d=new f(l,new o(l));return d.RequestSyncerAlterId(),d}GetQRCodeTexture(t,s,e,i=g.AUTO,n=x.Q,r="#ffffff",h="#000000",l=-1){let a=m.genTextureId();return this.O.CallToNative(3,[t,s,e,n,r,h,l,i,a]),new f(a,new o(a))}GetDownloadTexture(t,s,e){if(!t)return i("GetDownloadTexture, url is null!"),null;let n=m.genTextureId();return this.O.CallToNative(4,[t,s,e,n]),new f(n,new o(n))}GetDomProxyTexture(t){let s=m.genTextureId();return this.O.CallToNative(5,[t,s],!0),new y(s,new o(s))}GetCanvasTexture(t,s){let e=m.genTextureId();return this.O.CallToNative(6,[t,s,e],!1),new f(e,new o(e))}GetPluginTexture(t,s){let e=m.genTextureId();return this.O.CallToNative(7,[t,s,e],!1),new f(e,new o(e))}GetCapturedTexture(){let t=m.genTextureId();return this.O.CallToNative(8,[t],!1),new f(t,new o(t))}}let b=new class{constructor(){this.nt=1}get count(){return this.nt}update(){this.nt<Number.MAX_SAFE_INTEGER?++this.nt:this.nt=1}},C=new r,R=new r;let A=new class extends h{constructor(){super(C,R)}RenewSyncInfo(t){super.RenewSyncInfo(t,{tt:0})}};class O extends h{constructor(t){super(C,R,{id:t}),this.rt=t}InitPackage(t){this.rt=t.id}RenewSyncInfo(t){super.RenewSyncInfo(t,{tt:1,id:this.rt})}}let T=new r,P=new r;class k extends h{constructor(t){super(T,P,{id:t}),this.ht=t}InitPackage(t){this.ht=t.id}RenewSyncInfo(t){super.RenewSyncInfo(t,{tt:1,id:this.ht})}}let E=new class extends h{constructor(){super(T,P)}RenewSyncInfo(t){super.RenewSyncInfo(t,{tt:0})}},D=new r;class G extends h{constructor(t){super(null,D,{id:t}),this.lt=t}InitPackage(t){this.lt=t.id}RenewSyncInfo(t,s){super.RenewSyncInfo(t,{tt:1,id:this.lt})}}let L=new class extends h{constructor(){super(null,D)}RenewSyncInfo(t,s){super.RenewSyncInfo(t,{tt:0})}};var F=null,_=null;class M{constructor(){this.ot={width:160,height:90,x:2/160,y:2/90,perspective:2/160,scaleRatio:1,designedWidth:1280},this.SwapCurrentTime=Date.now(),this.SwapCurrentCount=0,this.ct=new Map,this.dt=this.ft.bind(this),this.yt={hdl:null},this.St=!0,this.vt=-1,this.wt=!1,this.Nt=1,this.St=!1,this.xt(),this.It=!1,this.bt=[],this.Ct=1,this.Rt.OnScreenHide&&window.JsView?.onVisibilityChange((t=>{'{"status":"hide"}'===t&&this.Rt.OnScreenHide()}))}xt(){void 0!==global.NativeSendImpactSensorSyncData&&global.NativeSendImpactSensorSyncData.bind(this.yt),void 0!==global.NativeSetStepFpsSwitch&&(F=global.NativeSetStepFpsSwitch.bind(this.yt)),void 0!==global.NativeSetGlobalConfig&&(_=global.NativeSetGlobalConfig.bind(this.yt)),this.Rt=global.NativeGetRenderIntf(),this.Rt.RegisterSwapFunc((()=>{this.RequestSwap()})),this.At=this.At.bind(this),this.Rt.RegisterPreDomSyncFunc((()=>{this.Ot()})),this.Rt.RegisterOnScreenInfo(this.Tt.bind(this))}SetStepFpsSwitch(t){this.St?F&&F(t):(console.warn("SetStepFpsSwitch(): API link status no ready!"),this.bt.push((()=>{this.SetStepFpsSwitch(t)})))}SetGlobalConfig(t){if(this.St){if(_){let s=JSON.stringify(t);console.log("SetGlobalConfig set with "+s),_(s),console.log("SetGlobalConfig set done")}}else console.warn("SetGlobalConfig(): API link status no ready!"),this.bt.push((()=>{this.SetGlobalConfig(t)}))}Pt(){if(this.bt.length>0){for(let t=0;t<this.bt.length;t++)this.bt[t]();this.bt=[]}}RequestSwap(){this.wt?this.Ct++:(this.wt=!0,this.Ct++,this.Nt++,this.kt(this.Nt))}kt(t){let s=this,e=this.Ct;Promise.resolve().then((()=>{e==s.Ct?s.InstantPerformSwap():t==this.Nt&&s.kt(t)}))}NotifyNetTypeStatus(t,s){}EnableRequestSwap(t){this.It=t,this.Rt.EnableRequestSwap(t)}InstantPerformSwap(){this.wt&&(this.wt=!1,this.Nt++,this.At(!1))}Et(t,s,e,i,n){let r=null,h=null,l=null,a=null,o=null;if(t.HasUpdate()&&(l=t.ReadSyncList()),s.HasUpdate()&&(h=s.ReadSyncList()),e.HasUpdate()&&(r=e.ReadSyncList()),i?.HasUpdate()&&(a=i.ReadSyncList()),null==r&&null==h&&null==l&&null==a||(o=this.Rt.SyncForgeJsCall(JSON.stringify({TexSync:l,AnimSync:h,ViewSync:r,SensorSync:a}),n)),o){let s;this.wt=!1,s=JSON.parse(o).TexSyncRet,s&&this.Dt(t,s)}}Ot(){this.Et(l,C,T,null,c.PickArray())}At(t){if(!this.It)return void(this.wt=!1);b.update();let s=c.GetSize();if(this.Et(l,C,T,null,c.PickArray()),this.ct.size>0&&this.ct.forEach(this.dt),this.Et(a,R,P,D,c.PickArray()),s==c.GetSize())c.ResetForNextSwap();else{let t=c.GetSize();t>50&&console.warn("Warning: temp sync store kept with large size = "+t)}t=!!t,this.wt=!1,this.SwapCurrentTime=Date.now(),this.SwapCurrentCount++,this.Rt.DoRequestSwap(t)}GetScreenInfo(){return this.ot}SetForgeRtHandler(t){this.yt.hdl=t,this.St=!0,this.Rt.SetForgeRtHandler(t),this.Pt()}InitScreenBuffer(t,s){isNaN(t)&&(t=1),isNaN(s)&&(s=1280);var e=s*t,i=e/16*9;this.ot.width=Math.floor(e),this.ot.height=Math.floor(i),this.ot.x=2/this.ot.width,this.ot.y=2/this.ot.height,this.ot.perspective=this.ot.x,this.ot.scaleRatio=t,this.ot.designedWidth=s}InitNativeScreenBuffer(){if(this.St){var t=JSON.stringify({displayScaleRatio:this.ot.scaleRatio,designedMapWidth:this.ot.designedWidth});this.Rt.InitScreenBuffer(t)}else console.info("InitNativeScreenBuffer(): API link status no ready!")}SyncBackStatus(t,s){this.Rt.SyncBackStatus(t,s)}TakeAndSyncBackStatus(){1==this.Rt.TakeAndSyncBackStatus()&&this.RequestSwap()}Tt(t,s,e,i,n){this.ot.width=t,this.ot.height=s,this.ot.x=e,this.ot.y=i,this.ot.perspective=n}HasPendingRenderBreak(){return!!this.St&&this.Rt.HasPendingRenderBreak()}FinishRenderBreak(t){this.St?this.Rt.FinishRenderBreak(t):(console.warn("FinishRenderBreak(): API link status no ready, delay"),this.bt.push((()=>{this.Rt.FinishRenderBreak(t)})))}AddWillSwapListener(t,s){this.ct.set(t,s)}AddSwappedOnceObserver(t){this.St?this.Rt.AddSwappedOnceObserver(t):(console.warn("AddSwappedOnceObserver(): API link status no ready, delay"),this.bt.push((()=>{this.Rt.AddSwappedOnceObserver(t)})))}ActiveComponent(t){this.St?this.Rt.ActiveComponent(t):(console.warn("ActiveComponent(): API link status no ready, delay"),this.bt.push((()=>{this.Rt.ActiveComponent(t)})))}ShutdownComponents(t){this.St?this.Rt.ShutdownComponents(t):(console.warn("ShutdownComponents(): API link status no ready, delay"),this.bt.push((()=>{this.Rt.ShutdownComponents(t)})))}SetPlatformMsgDisp(t){this.Gt=t}GetPlatformMsgDisp(){return this.Gt}GetTextToolsApi(){return this.Rt.TextToolApi}ft(t){t()}Dt(t,s){let e;e=s.idAlter,e&&t.ProcAlterIds(e.proxy,e.real)}}class B{constructor(){this.Lt=!1,this.Ft=0,this._t=!1,this.Mt=0,this.Bt=0,this.Vt=!1,this.Jt=!1,this.Wt=0,this.Ut=0,this.qt=void 0!==window.jRuntimeBridge?.getSystemUptimeMillis,this.qt&&(this.Vt=!0,this.Ht())}SetTranslateDelay(t){B.sKeyTranslateDelay=t}CheckKey(t){if(!t.timeStamp||this.Lt)return!1;this._t=!0;const s=Date.now(),i=t.timeStamp;!this.Vt&&i-this.Ft>3e3&&(this.Mt=s,this.Bt=i,this.Ft=i);let n=s-this.Mt;(n<0||n>5e3)&&(this.qt?this.Ht():(this.Mt=s,this.Bt=i),n=0);return n+this.Bt-i>B.CONST_MAX_PASSING_GAP&&Math.abs(this.Ut-i)<B.CONST_MIN_VALID_KEY_GAP&&!t.repeat?(!this.Jt&&this.Vt&&(this.Wt++,this.Wt>50&&e("More than 50 keys are expired...")),!0):(this.Jt||(this.Jt=!0),this.Ut=i,!1)}toggleKeyGuard(){this.Lt=!this.Lt}IsActive(){return this._t}Ht(){this.Mt=Date.now(),this.Bt=window.jRuntimeBridge.getSystemUptimeMillis()-B.sKeyTranslateDelay}}B.CONST_MAX_PASSING_GAP=20,B.CONST_MIN_VALID_KEY_GAP=180,B.sKeyTranslateDelay=5;let V,J=new B;class W{constructor(n,r,h){var l;if(this.Kt=null,this.zt=1280,this.jt=!1,this.Yt=0,l=4,console.log.bind(console),l>0&&console.error.bind(console),l>1&&(s=console.error.bind(console)),l>2&&(e=console.warn.bind(console)),l>3&&(i=console.log.bind(console)),l>4&&console.debug.bind(console),this.Xt=new I,this.Qt=new M,t.sRenderBridge=this.Qt,isNaN(h)&&(h=1280),this.zt=h,this.jt=!1,this.$t(n,r,h),this.Zt={keyProc:null,keyUpProc:null,activityStateProc:null},this.ts(this.Zt),this.ss(this.Zt),this.es=this.Qt.InstantPerformSwap.bind(this.Qt),null!=n){this.Yt=n.canvasNativeHandle;for(let t in this.Zt)n[t]=this.Zt[t]}t.sActivityManager=this,console.log("manager done")}GetTextureManager(){return this.Xt}DelayedActivateCanvas(t){if(0==this.Yt){this.Yt=t.canvasNativeHandle,this.ns(t);for(let s in this.Zt)t[s]=this.Zt[s];this.Qt.InitNativeScreenBuffer(),this.Qt.RequestSwap()}else s("Error: already activated")}GetCanvasHandler(){return this.Yt}StartActivity(t){this.Kt=t}$t(t,s,e){this.ns(t),this.Qt.InitScreenBuffer(s,e),this.Qt.InitNativeScreenBuffer()}ns(t){null!=t&&(this.Qt.SetForgeRtHandler(t.frtNativeHandle),t.renderBridge=this.Qt,this.Qt.EnableRequestSwap(!0))}rs(t){if(this.jt)return!0;var s=!0;if(this.Kt){if(J.CheckKey(t))return console.log("keyEventGuard ignore keys"),!1;J.IsActive()&&this.Qt.InstantPerformSwap(),s=!this.Kt.DispatchKeyDown(t),this.Qt.TakeAndSyncBackStatus()}return s}hs(t){if(this.jt)return!0;var s=!0;return this.Kt&&(s=!this.Kt.DispatchKeyUp(t),this.Qt.TakeAndSyncBackStatus()),s}ts(t){t.keyProc=this.rs.bind(this),t.keyUpProc=this.hs.bind(this)}ss(t){let s=this;var e=function(t){var e=t.State;switch(console.log("ActivityStateListenerChanged, state:"+e),e){case"onActivityResumed":s.Qt.EnableRequestSwap(!0),s.Qt.InstantPerformSwap();break;case"onActivityPaused":s.Qt.EnableRequestSwap(!1)}}.bind(this);t.activityStateProc=e}}class U{constructor(){this.ls=null}Init(t){let s=1280,e=1;try{if(H){let t=H();"number"==typeof t.width&&(s=t.width),"number"==typeof t.displayScale&&(e=t.displayScale)}}catch(t){console.log("Note: DesignMap failed")}this.ls=new W(t,e,s),q?q(this.ls):console.error("FATAL: no found entry")}getActivityManager(){return this.ls}}let q=null,H=null;class K{constructor(t){this.PageName=t,this.os=null,this.us=null,this.SubPages=[],this.cs=null,this.jt=!1}OnRenderFrame(){s("OnRenderFrame() MUST override")}OnKeyDown(t){return!1}OnKeyUp(t){return!1}DispatchKeyDown(t){if(this.jt)return!0;let s=!1;return this.os&&(s=this.os.DispatchKeyDown(t)),s||(s=this.OnKeyDown(t)),s}OnCustomEvent(t){return!1}BubbleCustomEvent(t){this.OnCustomEvent(t)||this.cs&&this.cs.BubbleCustomEvent(t)}DispatchKeyUp(t){if(this.jt)return!0;let s=!1;return this.os&&(s=this.os.DispatchKeyUp(t)),s||(s=this.OnKeyUp(t)),s}PrintLastFocusPage(){let t="------"+this.PageName+"\n",s=this.cs;return s&&(t+=s.PrintLastFocusPage()),t}IsFocus(){return!this.cs||this.cs.os==this}ds(){return this.IsFocus()&&!this.os}SetParent(t){null!=t?(this.cs=t,t.SubPages.push(this)):n("ERROR: parent is null")}SetParentPage(t){this.SetParent(t)}OnRemoveFromTree(){if(this.cs=null,this.SubPages&&this.SubPages.length>0){for(let t of this.SubPages)t.OnRemoveFromTree();this.SubPages=[]}}RemoveSubPage(t){t==this.os&&(this.os=null),t==this.us&&(this.us=null);for(let s=0;s<this.SubPages.length;s++)if(t==this.SubPages[s]){this.SubPages.splice(s,1);break}}ClearSubPages(){this.SubPages=[],this.os=null,this.us=null}GetParentPage(){return this.cs}Focus(t=!1){if(this.IsFocus()){if(!t)return void i("requestFocus(): Already focused name="+this.PageName);if(this.ds())return void i("requestFocus(): Already focused name="+this.PageName)}if(z)return void j.push(this);if(z=!0,this.cs){let s,e=[],i=this;for(;i.cs&&!i.IsFocus();)e.push(i),i=i.cs;s=t&&0==e.length?this.os:e[e.length-1].cs?.os;let r=[];for(;s;)r.push(s),s=s.os;for(let t=r.length-1;t>=0;t--)r[t].fs();for(let t=e.length-1;t>=0;t--)e[t].ps();if(t)this.us=null;else{let t=e[0];for(;t.us&&null==t.os;)t.us.ps(),t=t.os,t||n("ERROR: focus chain is broken")}}z=!1;let s=j.length;if(s>0){let t=j;j=[];for(let e=0;e<s;e++)t[e].Focus()}}ReturnFocusToParent(){this.cs&&(this.IsFocus()&&this.cs.Focus(!0),this.cs.os==this&&(this.cs.os=null),this.cs.us==this&&(this.cs.us=null))}ps(){this.cs?(this.cs.os=this,this.cs.us=this,this.OnFocus()):s("No dispatcher")}fs(){this.cs?this.cs.os==this?(this.cs.os=null,this.OnBlur()):e("Not focus yet, page name="+this.PageName):s("No dispacher")}GetFocusChild(){return this.os}OnFocus(){e("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){e("No overrided Page OnBlur event, page name="+this.PageName)}KeyLock(){this.jt=!0}UnKeyLock(){this.jt=!1}}let z=!1,j=[];var Y;!function(t){t.VIEW_COMMAND=0,t.TEXTURE_COMMAND=1,t.ANIM_COMMAND=2,t.SYNC_COMMAND=3,t.APIC_PLAY=0,t.APIC_STOP=1,t.GET_BOUNDING_RECT=0,t.FILTER_VIEW_WAVE=1,t.TRANSLATE_FRAME_ALT_SPEED=0,t.FREE_MOVE_RUN_CMDPACKS=1,t.EXE_DEFAULT=0,t.EXE_AFTER_RENDER=1}(Y||(Y={}));const X=(t,s)=>{let e=0,i=0,n=0;return isNaN(t)||(e|=1,i=t),isNaN(s)||(e|=2,n=s),{e:e,x:i,y:n}};var Q,$,Z;!function(t){t.ActEvent_ActFinish=1,t.ActEvent_Speed_X_Revert=2,t.ActEvent_Speed_Y_Revert=3,t.ActEvent_ActReject=4,t.ActEvent_ActDragStart=5,t.ActEvent_ActDragEnd=6,t.ActEvent_ActFlingStart=7,t.ActEvent_ActFlingProgress=8,t.ActEvent_ActFlingEnd=9,t.ActEvent_ActTouchDown=10,t.ActEvent_ActTouchRelease=11,t.ActEvent_ActFlingCancel=12,t.ActEvent_ActFlingDrop=13,t.ActEvent_MovementSync=14}(Q||(Q={})),function(t){t.GroupType_ActionAssoc=10,t.GroupType_Fling=11,t.GroupType_Invalid_Ext=65535}($||($={})),function(t){t.FLING_ON_PROGRESS_INTERVAL=200}(Z||(Z={}));const tt=(t,s)=>{t.gtype=s.g,t.once=s.m?0:1;let e=s.s;e&&(t.name=e),t.brk=s.brk?1:0};const st=51;function et(t){return t?JSON.stringify(t.Package()):null}let it=new class{constructor(){this.O=A}CreateTranslate(t,s,e,i,n,r,h){n!=1/0&&null!=n||(console.warn("translate animation duration invalid="+n),n=0),this.O.CallToNative(1,[t,s,e,i,n,et(r),h])}CreateRotate(t,s,e,i,n,r,h){n!=1/0&&null!=n||(console.warn("rotate animation duration invalid="+n),n=0),this.O.CallToNative(2,[t,s,e.x,e.y,e.z,i.x,i.y,i.z,n,et(r),h])}CreateScale(t,s,e,i,n,r,h,l,a,o,u){a!=1/0&&null!=a||(console.warn("scale animation duration invalid="+a),a=0),this.O.CallToNative(3,[t,s,e,i,n,r,h,l,a,et(o),u])}CreateTranslateFrame(t,s,e,i,n,r,h,l){this.O.CallToNative(5,[t,s,e,i,!!n,r,h,l])}CreateCssKeyframe(t,s,e,i,n,r){s!=1/0&&null!=s||(console.warn("css animation duration invalid="+s),s=0),this.O.CallToNative(6,[t,s,e,i,n,r])}CreateFreeMoveAnimation(t,s,e,i){this.O.CallToNative(7,[t,s?c.AddData(s):0,e,i?1:0])}CreateShaderAnimation(t,s,e){this.O.CallToNative(8,[t,s,e])}};class nt{constructor(){this.AnimNativeId=m.genAnimationId(),this.O=new O(this.AnimNativeId),this.ys=null,this.Ss=null}SetAnimationListener(t){this.vs(t)}AddAnimationListener(t){this.ys&&t.AddInherit(this.ys),this.vs(t)}RemoveAnimationListener(){this.ys=null}Enable(t){this.O.CallToNative(2,[t])}EnableInfinite(){return this.O.CallToNative(3,null),this}SetRepeat(t){return this.O.CallToNative(5,[t]),this}EnableDelay(t){return this.O.CallToNative(4,[t]),this}SetStartPos(t){return t>=0&&t<=1?this.O.CallToNative(6,[t]):console.warn("Warning: SetStartPos() out of range"),this}vs(t){let s=!0;if(this.ys&&(s=this.ys.ListenerEnabledFlags==t.ListenerEnabledFlags),this.ys=t,null!=this.ys&&(null==this.Ss||!s)){let t=this;this.Ss=s=>{t.ys?.InvokeFromNativeForge(s)};let s=c.AddData(this.Ss);this.O.CallToNative(1,[s,this.ys.ListenerEnabledFlags])}}}var rt,ht;!function(t){t.ReleaseAfterEndCallback=1,t.KeepTransform=2,t.AckFinalProgress=4,t.AckRepeat=8}(rt||(rt={})),function(t){t.AltSpeed=(t,s,e)=>{let i={S60:Math.floor(100*s/55)/100,T:e};t?.DispatchAnimCommand(Y.TRANSLATE_FRAME_ALT_SPEED,JSON.stringify(i))},t.RunFreeMoveCmdPacks=(t,s)=>{t?.DispatchAnimCommand(Y.FREE_MOVE_RUN_CMDPACKS,JSON.stringify(s))}}(ht||(ht={}));class lt{constructor(){this.ws="COMMON"}Type(){return this.ws}ToSyncJsonObj(t){return t||(t={}),t.typ=this.ws,t}}let at=new class{constructor(){this.Ns={},this.xs=0}add(t){let s=t.view.ViewId;return this.Ns.hasOwnProperty(s)&&(this.Ns[s]=t),s}remove(t){this.Ns[t]&&delete this.Ns[t]}get(t){return this.Ns[t]}clear(){this.Ns={},this.xs=0}};class ot{constructor(){this.SensorId=m.genViewId(),this.gs=new G(this.SensorId),this.CreateSensor()}CreateSensor(){}CreateTypedSensor(t){L.CallToNative(1,[this.SensorId,t],!0)}Recycle(){this.gs.CallToNative(1,null,!0)}}class ut{constructor(t,s,e,i){this.Texture=t,this.MaskSetting=s,void 0===i&&(i=!0),this.HasAlpha=i}ToSyncJsonObj(t=void 0){return t||(t={}),t.texId=this.Texture?this.Texture.TexId:0,t.alpha=this.HasAlpha,this.MaskSetting?t.mask=this.MaskSetting.ToSyncJsonObj():t.mask=null,t}}var ct;!function(t){var s,e,i;(s=t.ControlType||(t.ControlType={})).DoKeepInRender=1,s.RecycleKeptView=2,(e=t.SyncedType||(t.SyncedType={})).Synced=0,e.NotSynced=1,e.RequestKeepInRender=2,e.OnKeepingInRender=3,e.RecycleKeeping=4,(i=t.TextureCoordAnchor||(t.TextureCoordAnchor={})).LeftTop=1,i.CenterTop=2,i.RightTop=3,i.LeftMiddle=4,i.Center=5,i.RightMiddle=6,i.LeftBottom=7,i.CenterBottom=8,i.RightBottom=9}(ct||(ct={}));let dt=new class{constructor(){this.O=E}CreateNativeView(t,s,e){this.O.CallToNative(1,[t,s],e)}CreateJsRootView(t){this.O.CallToNative(2,[t])}CreateDomProxyView(t,s,e){this.O.CallToNative(3,[t,s,e?1:0],!0)}};class ft{constructor(t,s,e=!1){this.Visibility=void 0,this.O=new k(t),this.ViewId=t,this.TextureSetting=null,this.Is=null,this._=e,this.bs=null,this.CreateView(s)}CreateView(t=void 0){}ResetTexture(t=null){if(!this.Is){this.Is=this.O.CallToNative(1,null,this._);let t=this;this.O.AddStartSyncCallback((()=>{this.TextureSetting?t.O.AlterCallParams(t.Is,[t.TextureSetting.ToSyncJsonObj()]):t.O.AlterCallParams(t.Is,[null]),t.Is=null}))}this.TextureSetting=t}BindedPageBase(t){}SetVisibility(t){if("INHERIT"!==t&&void 0!==t||(t="VISIBLE"),this.Visibility!=t){this.Visibility=t;let s=0;switch(t){case"VISIBLE":s=1;break;case"GONE":s=2;break;case"HIDDEN":s=3;break;default:return void console.error("unknown visible type="+t)}this.O.CallToNative(2,[s],this._)}}AddView(t,s){let e={x:0,y:0,width:0,height:0};s&&(e=this.Cs(s)),this.O.CallToNative(3,[t.ViewId,s?1:0,e.x,e.y,e.width,e.height],this._)}ClearViews(){this.O.CallToNative(4,null,this._)}ResetTextureCssTransform(t,s){t=t||"",s=s||"",this.O.CallToNative(5,[t,s],this._)}SetTextureCoord(t,s,e,i,n=ct.TextureCoordAnchor.Center){this.O.CallToNative(9,[t,s,e,i,n],this._)}ResetLayoutParams(t){let s;null!=t?(s=this.Cs(t),this.O.CallToNative(6,[s.x,s.y,s.width,s.height],this._)):n("ResetLayoutParams(): new params is null")}Cs(t){return{x:isNaN(t.x)?0:t.x,y:isNaN(t.y)?0:t.y,width:isNaN(t.width)?0:t.width,height:isNaN(t.height)?0:t.height}}GetBoundingClientRect(){return new Promise(((t,s)=>{null!=this.bs&&(this.bs=null),this.bs=e=>{null!=this.bs&&(this.bs=null);const i=JSON.parse(e);0==i.status?t(i.data):s(i.error)};const e=c.AddData(this.bs);this.O.CallToNative(12,[e],this._)}))}StartAnimation(t,s,e){let i=t?t.AnimNativeId:0;this.O.CallToNative(7,[i,isNaN(e)?0:e],this._)}StopAnimation(){this.O.CallToNative(8,null,this._)}DispatchAnimCommand(t,s){this.O.CallToNative(13,[t,s],this._)}StartTextureAnimation(t){let s=t?t.AnimNativeId:0;this.O.CallToNative(10,[s],this._)}StopTextureAnimation(){this.O.CallToNative(11,null,this._)}DragEnables(t){this.O.CallToNative(14,[t],this._)}SetTapListener(t=void 0){if(null!=t){const s=c.AddData(t);this.O.CallToNative(15,[s],this._)}else this.O.CallToNative(15,[0],this._)}EnableAutoSize(){this.O.CallToNative(16,[],this._)}RegisterFlexAssigned(t=void 0){if(null!=t){const s=c.AddData(t);this.O.CallToNative(17,[s],this._)}else this.O.CallToNative(17,[0],this._)}EnableVisibleTestRect(){this.O.CallToNative(18,[],this._)}Capture2Texture(t,s=void 0){if(!t)return void console.error("Error: Capture2Texture need target texture");let e=t.GetTextureId();if(!s)return void console.error("Error: Capture2Texture need callback");const i=c.AddData(s);this.O.CallToNative(19,[e,i],this._)}}class pt extends ft{constructor(t=null){!t||t instanceof ut||n("ERROR:LayoutView need TextureSetting as parameter"),super(m.genViewId(),{DomDepends:!1}),this.Visibility="VISIBLE",t&&this.ResetTexture(t)}CreateView(t){dt.CreateNativeView(this.ViewId,0,t.DomDepends)}}function yt(t){let s=[];if(t instanceof Array)for(let e of t)e instanceof ft&&s.push(e.ViewId);return s}class St extends ot{constructor(t,s,e,i){super(),this.InitSet(t,s,e,i)}CreateSensor(){this.CreateTypedSensor(3)}InitSet(t,s,e,i){let n=0;e&&(n=c.AddData((t=>{1==t?e.OnBeginContact?.():2==t&&e.OnEndContact?.()}))),this.gs.CallToNative(20,[t.ViewId,s.ViewId,n,i?i.SensorId:0],!0)}}let vt={StartTrace:(t,s,e,i)=>new St(t,s,e,i),Callback:class{constructor(t,s){this.OnBeginContact=t,this.OnEndContact=s}UpdateImpactCallback(t){this.OnBeginContact=t}UpdateLeaveCallback(t){this.OnEndContact=t}},AutoFroze:class extends ot{constructor(t,s){super(),this.InitSet(),this.Rs(yt(t)),this.As(yt(s)),this.Os()}CreateSensor(){this.CreateTypedSensor(2)}InitSet(){this.gs.CallToNative(25,null,!0)}UpdatePreImpactList(t){this.Rs(yt(t)),this.Os()}UpdateOnImpactList(t){this.As(yt(t)),this.Os()}Rs(t){this.gs.CallToNative(26,[...t],!0)}As(t){this.gs.CallToNative(27,[...t],!0)}Os(){this.gs.CallToNative(28,null,!0)}}};var wt;!function(t){t[t.NONE=0]="NONE",t[t.TEXT=1]="TEXT",t[t.PASSWORD=2]="PASSWORD",t[t.TEXT_AREA=3]="TEXT_AREA",t[t.CONTENT_EDITABLE=4]="CONTENT_EDITABLE",t[t.SEARCH=5]="SEARCH",t[t.URL=6]="URL",t[t.EMAIL=7]="EMAIL",t[t.TELEPHONE=8]="TELEPHONE",t[t.NUMBER=9]="NUMBER"}(wt||(wt={}));var mt,Nt;!function(t){var s;(s=t.UniformType||(t.UniformType={}))[s.FLOAT=1]="FLOAT"}(mt||(mt={})),function(t){var s,e;(s=t.Type||(t.Type={}))[s.GRAY_DOWN=1]="GRAY_DOWN",s[s.WAVE=2]="WAVE",(e=t.Wave||(t.Wave={}))[e.CIRCLE_WAVE=1]="CIRCLE_WAVE",e[e.RECTANGLE_WAVE=2]="RECTANGLE_WAVE"}(Nt||(Nt={}));let xt=0;class gt{constructor(){this.sourceList=[]}addSource(t,s,e,i,n){i=i??{type:Nt.Wave.CIRCLE_WAVE},n=n??{timeDecay:3,distanceDecay:10,speed:100,frequency:8,waveNum:2};const r=++xt;let h=0,l=0,a=0;return i.type==Nt.Wave.RECTANGLE_WAVE&&(h=i.width,l=i.height,a=i.radius),this.sourceList.push(r,t,s,e,h,l,a,n.timeDecay,n.distanceDecay,n.speed,n.frequency,n.waveNum),r}getSourceList(){const t=this.sourceList;return this.sourceList=[],t}}class It extends ft{constructor(t,s){super(m.genViewId(),{DomElementId:t,UseMaskView:s},!0),this.Visibility="VISIBLE"}CreateView(t){dt.CreateDomProxyView(this.ViewId,t.DomElementId,t.UseMaskView)}RegisterOnProxyReady(t){t?.()}}function bt(t){return isNaN(t)?0:parseInt(t)}function Ct(t){return{fontFamily:t.fontFamily?t.fontFamily:kt.sDefaultFont,fontSize:bt(t.fontSize),italic:"italic"===t.fontStyle,bold:"bold"===t.fontWeight}}function Rt(){return t.sRenderBridge.GetTextToolsApi()}function At(t,s){let e=Ct(s);return Rt().GetTextWidth(t,JSON.stringify(e))}function Ot(t,s){let e=Ct(s);const i=Rt().GetOneLineTextDrawWidth(t,JSON.stringify(e)),n={totalWidth:i[0],sliceInfo:[]};for(let t=1;t<i.length;t+=3)n.sliceInfo.push({start:i[t],end:i[t+1],width:i[4]});return n}function Tt(t,s,e,i,n,r){let h;if(t>0)h=Rt().GetCursorPosition(t,s,null,null,null,1);else{let l=Ct(i),a=function(t){let s=bt(t.height),e=bt(t.lineHeight),i="string"==typeof t.wordWrap?t.wordWrap:"none";return"nowrap"==t.whiteSpace&&(i="none"),{width:bt(t.width),height:s,textAlign:"string"==typeof t.textAlign?t.textAlign:"left",lineHeight:0==e?s:e,wordWrap:i,textOverflow:"string"==typeof t.textOverflow?t.textOverflow:"clip"}}(n);h=Rt().GetCursorPosition(t,s,e,JSON.stringify(l),JSON.stringify(a),r?1:0)}return h}function Pt(t){Rt().RemoveCursorTextCache(t)}var kt;!function(t){t.sDefaultFont="黑体",t.sDefaultFontSize=30,t.sDefaultFontColor="#FFFFFF",t.sDefaultBackgroundColor="rgba(0, 0, 0, 0)",t.GetTextWidth=At,t.GetOneLineTextDrawWidth=Ot,t.GetCursorPosition=Tt,t.RemoveCursorTextCache=Pt}(kt||(kt={}));let Et=t;Et.Run=function(t){return V=new U,V.Init(t),V},Et.InitStarter=function(s,e){t.DesignMap=e,q=s,H=e},Et.NewDomProxyView=function(t,s){return new It(t,s)},Et.sFrameCount=b,Et.NativeConstant=Y,Et.PageBase=K,Et.ReactActivity=class extends K{constructor(t,s){super(t),this.Xt=s.GetTextureManager()}GetTextureManager(){return this.Xt}SetContentView(t,s){this.Ts=t,this.Ps=s}},Et.ViewTextureMask=class extends lt{constructor(t){super(),this.ws="TEXTURE",this.ImageTexture=t}ToSyncJsonObj(t){return t||(t={}),t.texId=this.ImageTexture.TexId,super.ToSyncJsonObj(t)}},Et.ViewRoundCornerMask=class extends lt{constructor(t,s,e,i){super(),this.ws="CORNER",this.ks=t,this.Es=isNaN(s)?t:s,this.Ds=isNaN(e)?t:e,this.Gs=isNaN(i)?t:i}ToSyncJsonObj(t){return t||(t={}),t.tl=this.ks,t.tr=this.Es,t.bl=this.Ds,t.br=this.Gs,super.ToSyncJsonObj(t)}},Et.sViewStore=at,Et.ViewInfo=class{constructor(t,s){this.view=t,this.layout_params=s}},Et.LayoutView=pt,Et.AutoStretchView=class extends pt{constructor(t=null){super(t)}CreateView(t){dt.CreateNativeView(this.ViewId,12,t.DomDepends)}},Et.EditControlView=class extends pt{constructor(s=null){super(s),this.Ls=null,this.Fs=this._s.bind(this),this.Ms="_JscIme_"+this.ViewId,t.sRenderBridge.GetPlatformMsgDisp().subscribe(this.Ms,this.Fs)}CreateView(t){dt.CreateNativeView(this.ViewId,5,t.DomDepends)}releaseResource(){t.sRenderBridge.GetPlatformMsgDisp().unsubscribe(this.Ms,this.Fs)}setEditorStyle(t,s,e,i){this.O.CallToNative(5005,[t,s,e,i],this._)}showIme(t,s,e,i,n){t!=wt.NONE?(void 0!==e&&null!=e||(e=s.length>0?s.length:0),e<0?e=0:e>s.length&&(e=s.length>0?s.length:0),this.O.CallToNative(5001,[t,encodeURIComponent(s),e,i,n],this._)):console.log("showIme inputType error")}hideIme(){this.O.CallToNative(5002,null,this._)}updateCursorOffset(t,s,e,i){this.O.CallToNative(5003,[t,s,e,i],this._)}addImeEventListener(t){this.Ls=t}Bs(t){this.O.CallToNative(5006,[t],this._)}_s(t){if(t){var s=JSON.parse(t);if("text"==s.type){var e=s.text;let t=s.selectStart,i=s.scrollLeft,n=s.scrollTop;this.Ls?.OnTextChanged(decodeURIComponent(e),t,i,n)}else if("vstatus"==s.type){let t=s.isVisible?1:0;this.Bs(t),this.Ls?.OnStatusChanged(t)}else if("action"==s.type){var i=s.action;this.Ls?.OnEditAction(i)}}else console.log("EditControlView","_ImeEventListener input_data error")}},Et.FilterView=class extends pt{constructor(t=null,s){super(t),this.Vs=s??Nt.Type.GRAY_DOWN,this.O.CallToNative(10002,[this.Vs,[]],this._)}CreateView(t){dt.CreateNativeView(this.ViewId,10,t.DomDepends)}FilterSwitch(t){this.O.CallToNative(10001,[t],this._)}AddWaveSourceList(t){if(this.Vs==Nt.Type.WAVE){const s={T:1,L:t.getSourceList()};this.DispatchCommand(Y.FILTER_VIEW_WAVE,JSON.stringify(s))}else console.error("FilterView error: add wave source while filter view type is GRAY_DOWN.")}AddWaveSourceSingle(t,s,e,i={type:Nt.Wave.CIRCLE_WAVE},n={timeDecay:3,distanceDecay:10,speed:100,frequency:8,waveNum:2}){if(this.Vs==Nt.Type.WAVE){const r=new gt,h=r.addSource(t,s,e,i,n);return this.AddWaveSourceList(r),h}return console.error("FilterView error: add wave source while filter view type is GRAY_DOWN."),-1}RemoveSource(t){if(this.Vs==Nt.Type.WAVE){const s={T:2,L:t instanceof Array?t:[t]};this.DispatchCommand(Y.FILTER_VIEW_WAVE,JSON.stringify(s))}else console.error("FilterView error: remove wave source while filter view type is GRAY_DOWN.")}DispatchCommand(t,s){s&&this.O.CallToNative(10003,[t,s],this._)}},Et.FragShaderView=class extends pt{constructor(t=null){super(t)}CreateView(t){dt.CreateNativeView(this.ViewId,11,t.DomDepends)}SetShaderInfo(t,s,e,i){const n={shaderStr:t,uniformParams:s,textureParams:e};let r=0;null!=i&&(r=c.AddData(i)),this.O.CallToNative(7001,[JSON.stringify(n),r],this._)}},Et.NativeSharedView=class extends pt{constructor(t){super(t),this.Js=window.JsView?window.JsView.getJsContextId():0,this.Ws=null,this.SetTrackId(this.Js+"_"+this.ViewId)}CreateView(t){dt.CreateNativeView(this.ViewId,9,t.DomDepends)}GetTrackId(){return this.Ws}SetTrackId(t){this.Ws=t,this.O.CallToNative(10101,[this.Ws],this._)}SetOverSize(t){this.O.CallToNative(10102,[isNaN(t)?0:t],this._)}},Et.NinePatchView=class extends pt{CreateView(t){dt.CreateNativeView(this.ViewId,4,t.DomDepends)}SetRepeat(t,s){this.O.CallToNative(4001,[t,s],this._)}SetPadding(t,s){this.O.CallToNative(4002,[t,s],this._)}SetImageDspSize(t,s){this.O.CallToNative(4003,[t,s],this._)}SetDesignMapWidth(t){this.O.CallToNative(4004,[t],this._)}EnableAlphaMix(t){this.O.CallToNative(4005,[t.TexId],this._)}},Et.PreloadView=class extends pt{constructor(t=null){super(t)}CreateView(t){dt.CreateNativeView(this.ViewId,7,t.DomDepends)}},Et.SprayView=class extends pt{constructor(t=null){super(t)}SetSprayInfo(t,s,e,i,n,r,h,l,a,o,u,c,d,f,p,y,S,v,w,m,N,x,g){this.O.CallToNative(6001,[t,s,e,i,n,r,h,l,a,o,u,c,d,f,!!p,!!y,!!S,v,w,m,N,x,g],this._)}CreateView(t){dt.CreateNativeView(this.ViewId,6,t.DomDepends)}},Et.TextInputType=wt,Et.FilterViewType=Nt,Et.TextureSetting=ut,Et.ExternalTextureSetting=ut,Et.TextUtils=kt,Et.VisibleSensor=class extends ot{constructor(t,s=null){super(),this.InitSet(t,s)}CreateSensor(){this.CreateTypedSensor(1)}InitSet(t,s){let e=0;s&&(e=c.AddData(((t,e,i,n)=>{s(1==t,1==e,1==i,1==n)}))),this.gs.CallToNative(11,[t.ViewId,e],!0)}ResetArea(t){"number"!=typeof t.horizon&&(console.log("horizon not set, default to 1.0"),t.horizon=1),"number"!=typeof t.vertical&&(console.log("vertical not set, default to 1.0"),t.vertical=1),this.gs.CallToNative(12,[t.horizon,t.vertical],!0)}Enable(t){this.gs.CallToNative(13,[!!t],!0)}ResetContainer(t){let s;s=t?t.ViewId:0,this.gs.CallToNative(14,[s],!0)}},Et.EnvBlockerSensor=class extends ot{constructor(t){super(),this.InitSet(t)}CreateSensor(){this.CreateTypedSensor(4)}InitSet(t){this.gs.CallToNative(30,[t.ViewId],!0)}ResetTopGID(t){this.Us(0,t)}ResetBottomGID(t){this.Us(1,t)}ResetLeftGID(t){this.Us(2,t)}ResetRightGID(t){this.Us(3,t)}Us(t,s){this.gs.CallToNative(31,[t,isNaN(s)?0:parseInt(s)],!0)}Enable(t){this.gs.CallToNative(32,[t],!0)}},Et.sImpactSensorManager=vt,Et.TextureInstantLoad=g,Et.QRCodeLevel=x,Et.ColorSpace=N,Et.TextureManager=I,Et.FreeMoveExternType=$,Et.AnimationListener=class{constructor(t,s,e){this.ListenerEnabledFlags=0,this.InvokeAnimationStart=t,this.qs=t,t&&(this.ListenerEnabledFlags|=1),this.InvokeAnimationEnd=s,this.Hs=s,s&&(this.ListenerEnabledFlags|=2),this.InvokeViewNoVisible=e,this.Ks=e,e&&(this.ListenerEnabledFlags|=4),this.InvokeAnimRepeat=null,this.zs=null,this.InvokeAnimFinal=null,this.js=null,this.Ys=null,this.Xs=[]}OnStart(t){return this.InvokeAnimationStart=this.qs=t,t?this.ListenerEnabledFlags|=1:this.ListenerEnabledFlags&=30,this}OnEnd(t){return this.InvokeAnimationEnd=this.Hs=t,t?this.ListenerEnabledFlags|=2:this.ListenerEnabledFlags&=29,this}OnRepeat(t){return this.InvokeAnimRepeat=this.zs=t,t?this.ListenerEnabledFlags|=8:this.ListenerEnabledFlags&=23,this}OnFinalProgress(t){return this.InvokeAnimFinal=this.js=t,t?this.ListenerEnabledFlags|=16:this.ListenerEnabledFlags&=15,this}AddInherit(t){if(t){if(0==this.Xs.length){var s=this;this.InvokeAnimationStart=function(){s.qs&&s.qs();for(var t=0;t<s.Xs.length;t++)s.Xs[t].InvokeAnimationStart?.()},this.InvokeAnimationEnd=function(t){s.Hs&&s.Hs(t);for(var e=0;e<s.Xs.length;e++)s.Xs[e].InvokeAnimationEnd?.(t)},this.InvokeViewNoVisible=function(){s.Ks&&s.Ks();for(var t=0;t<s.Xs.length;t++)s.Xs[t].InvokeViewNoVisible?.()},this.InvokeAnimFinal=function(t){s.js&&s.js(t);for(var e=0;e<s.Xs.length;e++)s.Xs[e].InvokeAnimFinal?.(t)},this.InvokeAnimRepeat=function(t){s.zs&&s.zs(t);for(var e=0;e<s.Xs.length;e++)s.Xs[e].InvokeAnimRepeat?.(t)},this.ListenerEnabledFlags=31}this.Xs.push(t)}}InvokeFromNativeForge(t){switch(t.type){case"end":this.InvokeAnimationEnd?.(1==t.normalEnd);break;case"novisible":this.InvokeViewNoVisible?.();break;case"final":this.InvokeAnimFinal?.(t.progress);break;case"repeat":this.InvokeAnimRepeat?.(t.timesCount)}}},Et.AnimFireCommand=ht,Et.AnimationEnable=rt,Et.TranslateAnimation=class extends nt{constructor(t,s,e,i,n,r){super(),it.CreateTranslate(t,s,e,i,n,r,this.AnimNativeId)}},Et.RotateAnimation=class extends nt{constructor(t,s,e,i,n,r){super(),it.CreateRotate(t,s,e,i,n,r,this.AnimNativeId)}},Et.ScaleAnimation=class extends nt{constructor(t,s,e,i,n,r,h,l,a=200,o=200){super(),it.CreateScale(t,s,e,i,n,r,a,o,h,l,this.AnimNativeId)}},Et.TranslateFrameAnimation=class extends nt{constructor(t,s,e,i,n,r){super();let h=Math.floor(100*e/55)/100;it.CreateTranslateFrame(t,s,h,h,i,n,r,this.AnimNativeId)}},Et.CssKeyframeAnimation=class extends nt{constructor(t,s,e,i,n){super(),it.CreateCssKeyframe(t,s,e,i,n,this.AnimNativeId)}},Et.ShaderAnimation=class extends nt{constructor(t,s){super(),it.CreateShaderAnimation(t,s,this.AnimNativeId)}},Et.FreeMoveAnimation=class extends nt{constructor(t,s,e){super(),this.Qs=t,it.CreateFreeMoveAnimation(this.AnimNativeId,t,s,e)}},Et.FreeMoveActEvtType=Q,Et.FreeMoveCmdPackBuilder=class{static InitActCmdPack(t,s,e,i){return{t:1,cmds:i,tkn:isNaN(e)?0:e,spd:isNaN(t)?0:t,acc:isNaN(s)?0:s}}static InitStateCmdPack(t){return{t:2,cmd:t}}},Et.FreeMoveConditionSet=class{static AppendSubCmd(t,s){const e="cmds";t.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):(t.hasOwnProperty(e)||(t[e]=[]),t[e]?.push(s))}static SetCmdList(t,s){s instanceof Array&&(t.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):t.cmds=s)}static SetCmdPackList(t,s){s instanceof Array&&(t.hasOwnProperty("cmds")?console.error("Error: conflict with sub-command list"):t.cmdPacks=s)}static InitCommonInfo(){return{g:0,m:!1,s:null,brk:!1}}static UpdateCommonInfo(t,s,e,i,n){t.g=s??0,t.m=e??!1,t.s=i??null,t.brk=n}static ReachPosition(t,s,e){let i=X(t,s),n={subt:1,react:1,e:i.e,xv:i.x,yv:i.y};return tt(n,e),n}static AcrossPosition(t,s,e){let i=X(t,s),n={subt:1,react:2,e:i.e,xv:i.x,yv:i.y};return tt(n,e),n}static BoxPosition(t,s,e,i,n){let r=0,h=0,l=0,a=0,o=0;isNaN(t)||(r=t,o|=1),isNaN(s)||(h=s,o|=2),isNaN(e)||(l=e,o|=4),isNaN(i)||(a=i,o|=8);let u={subt:1,react:7,de:o,lv:r,tv:h,rv:l,bv:a};return tt(u,n),u}static StartMove(t,s){return this.OnMovement(s,1,1,t)}static OnMovement(t,s,e,i){let n={subt:1,react:9,xv:s,yv:e,e:i};return tt(n,t),n}static OffsetPosition(t,s,e,i,n){let r=0,h=0,l=0,a=0,o=0;isNaN(t)||(r=t,o|=1),isNaN(s)||(h=s,o|=2),isNaN(e)||(l=e,o|=4),isNaN(i)||(a=i,o|=8);let u={subt:1,react:8,de:o,lv:r,tv:h,rv:l,bv:a};return tt(u,n),u}static WallPosition(t,s,e,i){let n,r=X(s,e);switch(t){case"left":n=4;break;case"top":n=3;break;case"right":n=5;break;case"bottom":n=6;break;default:return console.error("WallPosition undefined direction",t),null}let h={subt:1,react:n,e:r.e,xv:r.x,yv:r.y};return tt(h,i),h}static ReachSpeed(t,s,e){let i=X(t,s),n={subt:2,react:1,e:i.e,xv:i.x,yv:i.y};return tt(n,e),n}static AcrossSpeed(t,s,e){let i=X(t,s),n={subt:2,react:2,e:i.e,xv:i.x,yv:i.y};return tt(n,e),n}static TouchCount(t,s){let e={subt:5,react:2,tct:s};return tt(e,t),e}static OnNexusEvent(t,s,e){let i={subt:3,nexus:t,etyp:s};return tt(i,e),i}static OnDragStart(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActDragStart};return tt(e,t),e}static OnDragEnd(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActDragEnd};return tt(e,t),e}static OnTouchDown(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActTouchDown};return tt(e,t),e}static OnTouchRelease(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActTouchRelease};return tt(e,t),e}static OnFlingStart(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActFlingStart};return tt(e,t),e}static OnFlingProgress(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActFlingProgress};return tt(e,t),e}static OnFlingEnd(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActFlingEnd};return tt(e,t),e}static OnFlingCancel(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActFlingCancel};return tt(e,t),e}static OnFlingDrop(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_ActFlingDrop};return tt(e,t),e}static OnHitBlock(t,s){let e={subt:4,blkGid:t};return tt(e,s),e}static OnNextTick(t,s){let e={subt:5,react:1,tgap:t};return s.m=!1,tt(e,s),e}static MovementSyncNexus(t,s){let e={subt:3,nexus:s,etyp:Q.ActEvent_MovementSync};return tt(e,t),e}},Et.FreeMoveActionBuilder=class{static SetSpeed(t,s){let e=X(t,s);return{typ:2,set:{xv:e.x,yv:e.y,xye:e.e}}}static SetAccel(t,s){let e=X(t,s);return{typ:7,set:{xye:e.e,xv:e.x,yv:e.y}}}static AltSpeed(t,s,e){if(!e)return null;let i=X(t,s);return{typ:5,set:{xv:i.x,yv:i.y,xye:i.e,tim:Math.floor(e)}}}static StopMoving(){return{typ:3}}static StopMovingExact(){return{typ:9}}static BrakeToPos(t,s){let e=X(t,s);return{typ:4,set:{xv:Math.floor(e.x),yv:Math.floor(e.y),xye:e.e}}}static SetArrowSpeed(t,s,e,i){let n=X(t,s),r=X(e,i);return{typ:6,set:{xye:n.e,xv:Math.floor(n.x),yv:Math.floor(n.y),xye1:r.e,xv1:r.x,yv1:r.y}}}static TeleportTo(t,s,e){let i=X(t,s);return{typ:8,set:{xye:i.e,xv:Math.floor(i.x),yv:Math.floor(i.y),isAbs:!e}}}static AckMovementSync(t,s,e,i,n,r){return{typ:10,set:{hstart:t,hend:s,vstart:e,vend:i,xye:n,st:r}}}},Et.FreeMoveStateBuilder=class{static FireEcho(t){return{typ:52,set:{tkn:t}}}static FireNexusEvent(t,s){return isNaN(s)||0==s?null:{typ:55,set:{etyp:isNaN(t)?0:t,nexus:s}}}static NewCondition(t){return{typ:st,set:{sub:1,set:t}}}static DelActionAssocCondition(){return{typ:st,set:{sub:5}}}static RemoveAllCondtions(){return{typ:st,set:{sub:6}}}static RemoveByGroup(t){return{typ:st,set:{sub:4,gt:t}}}static ActiveCondition(t,s){return{typ:st,set:{sub:2,gt:isNaN(t)||t<=0?$.GroupType_Invalid_Ext:t,sn:s}}}static DeactiveCondition(t,s){return{typ:st,set:{sub:3,gt:isNaN(t)||t<=0?$.GroupType_Invalid_Ext:t,sn:s}}}static SetOffsetPos(t,s){let e=X(t,s);return{typ:53,set:{xv:Math.floor(e.x),yv:Math.floor(e.y),xye:e.e}}}static SetPos(t,s){let e=X(t,s);return{typ:54,set:{xv:Math.floor(e.x),yv:Math.floor(e.y),xye:e.e}}}static TouchLockSwitch(t,s,e=-1){return{typ:59,set:{il:t,dir:s,ut:e}}}static SetTouchAttractChild(t){return{typ:60,set:{cid:t?t.AnimNativeId:0}}}static SetHitWallOverflow(){return{typ:56}}static RevertWithHitBlock(){return{typ:57}}static StartMovementSync(t,s,e,i,n,r){return{typ:61,set:{hstart:s,hend:e,vstart:i,vend:n,xye:r,nexus:t}}}static StopMovementSync(){return{typ:62}}};var Dt={SetupEngineJs:async(t,s)=>{Et.InitStarter(t,s)}};export{Dt as default};
|
|
2
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* eslint-disable */ void 0===window.Forge
|
|
1
|
+
/* eslint-disable */ if(void 0===window.Forge)throw new Error("Error: EngineJs missing");var e=window.Forge;window.JsvCoreApi.setForgeJsHandle(e);class t{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=window.location.origin+e;else if(!0===e.startsWith("./")&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.MainPath||"undefined"===window.JsView.Dom.MainPathRef||window.JsView.Dom.MainPathRef!==window.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.MainPathRef=window.location.href;let e=window.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=window.location.origin+window.location.pathname.substring(0,e)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let o=this.href,s=o.indexOf("#");s>0&&(this.hash=o.substring(s),o=o.substring(0,s));let n=o.indexOf("?");n>1&&(this.search=o.substring(n),o=o.substring(0,n));let r=o,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let h=a>1?r.substring(a+3):"";a=h.indexOf("/"),this.host=a>0?h.substring(0,a):"",this.pathname=a>=1?h.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=h),this.origin=this.protocol+"//"+this.host,a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}}class i{static SetBackgroundColor(t,i,o){const s=window.JsvCode.ForgeHandles.TextureManager.GetColorTextureCached(i);let n;o&&(n=new e.ViewRoundCornerMask(o.topLeft,o.topRight,o.bottomLeft,o.bottomRight));const r=new e.ExternalTextureSetting(s,n);t.ResetTexture(r)}static SetBackgroundImage(i,o,s,n,r,a,h){let d,w={};if("string"==typeof o){const e=new t(o);if(e instanceof t==!1)throw Error("Bad Argument.",e);w.url=e.href}else"linear-gradient"==o?.type&&(w.gradient=o);if(w.gradient)if(w.gradient.colors?.length>2){const e=w.gradient.colors,t=[e[0],e[e.length-1]],i=e.slice(1,e.length-1);d=window.JsvCode.ForgeHandles.TextureManager.CreateLinearGradientTexture(t,i)}else 2==w.gradient.colors?.length?d=window.JsvCode.ForgeHandles.TextureManager.CreateMiniGradientTexture(!0,w.gradient.colors[0],w.gradient.colors[1],w.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",w.gradient.colors);else w.url&&(d=w.url.includes(".gif")||w.url.includes(".webp")?window.JsvCode.ForgeHandles.TextureManager.GetGifImage(w.url,!1,null,h):window.JsvCode.ForgeHandles.TextureManager.GetImage2(w.url,!1,r,a||e.ColorSpace.RGBA_8888));if(d){let t;s&&(t=new e.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const o=new e.ExternalTextureSetting(d,t);if(i.ResetTexture(o),n){let e=d.RegisterLoadImageCallback(null,(function(){n({width:d.Width,height:d.Height})}));i.RegisterDetachCallback((()=>{d.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(i,o,s,n){if("string"==typeof o&&(o=new t(o)),o instanceof t==!1)throw Error("Bad Argument.",o);if("string"==typeof s&&(s=new t(s)),s instanceof t==!1)throw Error("Bad Argument(MaskURL).",s);const r=window.JsvCode.ForgeHandles.TextureManager.GetImage2(o.href,!1,null,n||e.ColorSpace.RGBA_8888);if(r){const t=window.JsvCode.ForgeHandles.TextureManager.GetImage2(s.href,!1,null,e.ColorSpace.RGBA_8888),o=new e.ExternalTextureSetting(r,new e.ViewTextureMask(t));i.ResetTexture(o)}}}export{e as Forge,i as ForgeExtension};
|
|
2
2
|
|
package/dom/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ function getCodeDebugConfig() {
|
|
|
8
8
|
domBrowserPath: './code/src/dom-2.0/dom-env/browser/index.ts',
|
|
9
9
|
domNativePath: './code/src/dom-2.0/dom-env/native/index.ts',
|
|
10
10
|
engineBrowserPath: './code/src/dom-2.0/engine-js/browser/index.ts',
|
|
11
|
+
engineNativePath: './code/src/dom-2.0/engine-js/native/index.ts',
|
|
11
12
|
forgeDefinePath: './code/src/dom-2.0/engine-js/index.ts',
|
|
12
13
|
};
|
|
13
14
|
|
|
@@ -31,17 +32,6 @@ async function loadJsViewDomNative(codeDebugConfig) {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
async function loadJsViewDomBrowserDebug(codeDebugConfig) {
|
|
34
|
-
// 在PC环境下没有处理加载EngineJs, 所以在此加载一下
|
|
35
|
-
if (codeDebugConfig.enableDebug == false) {
|
|
36
|
-
await import("./bin/jsview-engine-js-browser.min.js");
|
|
37
|
-
} else {
|
|
38
|
-
// 兼容webpack写法
|
|
39
|
-
await import(
|
|
40
|
-
/* webpackExclude: /@shijiu\/jsview\/dom\/code\/node_modules\// */
|
|
41
|
-
`${codeDebugConfig.engineBrowserPath}`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
35
|
// 加载jsv-dom的调试版本
|
|
46
36
|
let domBrowser = null;
|
|
47
37
|
if (codeDebugConfig.enableDebug == false) {
|
|
@@ -87,17 +77,51 @@ async function loadJsViewDomAsync(nativeOrBrowserDebug) {
|
|
|
87
77
|
if (nativeOrBrowserDebug) {
|
|
88
78
|
jsviewDom = await loadJsViewDomNative(codeDebugConfig);
|
|
89
79
|
} else {
|
|
90
|
-
// 补充原本由native的ForgeDom生成的JsvCode扩展给内部组件使用的接口类
|
|
91
|
-
window.JsvCode = {};
|
|
92
|
-
|
|
93
80
|
jsviewDom = await loadJsViewDomBrowserDebug(codeDebugConfig);
|
|
94
81
|
}
|
|
95
82
|
|
|
96
83
|
return jsviewDom;
|
|
97
84
|
}
|
|
98
85
|
|
|
86
|
+
async function loadEngineJs(nativeOrBrowserDebug, on_render_bridge_func, design_map_query_func) {
|
|
87
|
+
const codeDebugConfig = getCodeDebugConfig();
|
|
88
|
+
let engine_js_init;
|
|
89
|
+
|
|
90
|
+
if (nativeOrBrowserDebug) {
|
|
91
|
+
// Native engineJs 加载
|
|
92
|
+
if (codeDebugConfig.enableDebug == false) {
|
|
93
|
+
engine_js_init = await import("./bin/jsview-engine-js-native.min.js");
|
|
94
|
+
} else {
|
|
95
|
+
// 兼容webpack写法
|
|
96
|
+
engine_js_init = await import(
|
|
97
|
+
/* webpackExclude: /@shijiu\/jsview\/dom\/code\/node_modules\// */
|
|
98
|
+
`${codeDebugConfig.engineNativePath}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
// Browser engineJs 加载
|
|
103
|
+
if (codeDebugConfig.enableDebug == false) {
|
|
104
|
+
engine_js_init = await import("./bin/jsview-engine-js-browser.min.js");
|
|
105
|
+
} else {
|
|
106
|
+
// 兼容webpack写法
|
|
107
|
+
engine_js_init = await import(
|
|
108
|
+
/* webpackExclude: /@shijiu\/jsview\/dom\/code\/node_modules\// */
|
|
109
|
+
`${codeDebugConfig.engineBrowserPath}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 设置主执行入口
|
|
115
|
+
await engine_js_init.default.SetupEngineJs(on_render_bridge_func, design_map_query_func);
|
|
116
|
+
|
|
117
|
+
await getForgeDefineAsync(); // 触发首次加载forge-define
|
|
118
|
+
|
|
119
|
+
window._BootEngineEmb.resolveFunc();
|
|
120
|
+
}
|
|
121
|
+
|
|
99
122
|
export {
|
|
100
123
|
getCodeDebugConfig,
|
|
101
124
|
getForgeDefineAsync,
|
|
102
125
|
loadJsViewDomAsync,
|
|
126
|
+
loadEngineJs,
|
|
103
127
|
}
|
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const TargetRevision = {
|
|
6
|
-
"CoreRevision":
|
|
7
|
-
"CoreRevisionAndBranch": "
|
|
8
|
-
"JseRevision":
|
|
6
|
+
"CoreRevision": 1021966,
|
|
7
|
+
"CoreRevisionAndBranch": "1021966",
|
|
8
|
+
"JseRevision":
|
|
9
|
+
// "1.0.972",
|
|
10
|
+
"embedded",
|
|
9
11
|
"JseUrl":
|
|
10
|
-
"http://cdn.release.qcast.cn/forge_js/master/
|
|
11
|
-
|
|
12
|
+
// "http://cdn.release.qcast.cn/forge_js/master/JsViewES6_js2c_r972.jsv.9f259bb7.js",
|
|
13
|
+
"embedded",
|
|
14
|
+
"JseName":
|
|
15
|
+
// "JsViewES6_js2c_r972.jsv.9f259bb7.js",
|
|
16
|
+
"embedded",
|
|
12
17
|
"JsidtName": "libjsidt.102.7.so",
|
|
13
18
|
};
|
|
14
19
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import WasmApiClass from "./wasm/core-api.js"
|
|
2
|
+
|
|
3
|
+
// api名字列表,用于校验平台api是否完整
|
|
4
|
+
const api_name_list = [
|
|
5
|
+
// parameters
|
|
6
|
+
"CodeRevision",
|
|
7
|
+
"CoreBranchName",
|
|
8
|
+
"ForgeNativeRevision",
|
|
9
|
+
"BackgroundTask",
|
|
10
|
+
"EngineJs",
|
|
11
|
+
"UrlBuilder",
|
|
12
|
+
"Platform",
|
|
13
|
+
|
|
14
|
+
// apis
|
|
15
|
+
"loadRenderPlugin",
|
|
16
|
+
"setLruCacheSize",
|
|
17
|
+
"getJsContextId",
|
|
18
|
+
"notifyAppName",
|
|
19
|
+
"setMiniAppPermissionInfo",
|
|
20
|
+
"getCurrentTimeMs",
|
|
21
|
+
"addEventListener",
|
|
22
|
+
"removeEventListener",
|
|
23
|
+
"removeEventCallback",
|
|
24
|
+
"takeNativeHashChange",
|
|
25
|
+
"runJsWithUrl",
|
|
26
|
+
"getVisibility",
|
|
27
|
+
"onVisibilityChange",
|
|
28
|
+
"getNetStatus",
|
|
29
|
+
"onNetStatusChange",
|
|
30
|
+
"onNetReady",
|
|
31
|
+
"onActivityStateChange",
|
|
32
|
+
"setIgnoreSizeCheckWebSites",
|
|
33
|
+
"loadFont",
|
|
34
|
+
"hasPendingUserInput",
|
|
35
|
+
"triggerManualBlocker",
|
|
36
|
+
"enableReceivingUserInput",
|
|
37
|
+
"setAutoUriEncode",
|
|
38
|
+
"showUiCover",
|
|
39
|
+
"hideUiCover",
|
|
40
|
+
"simKeyEvent",
|
|
41
|
+
"reduceFps",
|
|
42
|
+
"enableFpsDisplay",
|
|
43
|
+
"addGlobalJsExceptionAck",
|
|
44
|
+
"removeGlobalJsExceptionAck",
|
|
45
|
+
"toggleViewVisible",
|
|
46
|
+
"getScreenInfo",
|
|
47
|
+
"appendNetTraceHeaders",
|
|
48
|
+
"ensureTesterUtils",
|
|
49
|
+
"setRenderGlobalConfig", // 原 setGlobalConfig
|
|
50
|
+
"setForgeJsHandle",
|
|
51
|
+
"logD",
|
|
52
|
+
"onMainTsDone"
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
export default function loadCoreApi() {
|
|
56
|
+
let core_api_export = null;
|
|
57
|
+
|
|
58
|
+
if (window.JsView) {
|
|
59
|
+
// 由native端的systemJs直接提供apis
|
|
60
|
+
core_api_export = window.JsView;
|
|
61
|
+
} else {
|
|
62
|
+
// wasm版本的core api(PC模拟为主)
|
|
63
|
+
core_api_export = new WasmApiClass();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// check apis
|
|
67
|
+
for (let name of api_name_list) {
|
|
68
|
+
if (typeof core_api_export[name] == "undefined") {
|
|
69
|
+
console.error("window.JsvCoreApi missing api:" + name);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return core_api_export;
|
|
74
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export default class BackgroundTask {
|
|
2
|
+
constructor() {
|
|
3
|
+
this._timer_map = {};
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
postDelay(code, delay, ...args) {
|
|
7
|
+
let id = "tim_" + setTimeout(() => {
|
|
8
|
+
this._onTimeout(id, false);
|
|
9
|
+
}, delay);
|
|
10
|
+
let callback = this._getCallback(code);
|
|
11
|
+
this._timer_map[id] = () => {
|
|
12
|
+
callback(...args)
|
|
13
|
+
};
|
|
14
|
+
return id;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
setInterval(code, delay, ...args) {
|
|
18
|
+
let id = "inv_" + setTimeout(() => {
|
|
19
|
+
this._onTimeout(id, true);
|
|
20
|
+
}, delay);
|
|
21
|
+
let callback = this._getCallback(code);
|
|
22
|
+
this._timer_map[id] = () => {
|
|
23
|
+
callback(...args)
|
|
24
|
+
};
|
|
25
|
+
return id;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
clear(id) {
|
|
29
|
+
if (!id.startsWith("tim") && !id.startsWidth("inv_")) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
delete this._timer_map[id];
|
|
34
|
+
if (id.startsWidth("tim")) {
|
|
35
|
+
clearTimeout(parseInt(id.substr(4)));
|
|
36
|
+
} else {
|
|
37
|
+
clearInterval(parseInt(id.substr(4)));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_getCallback(code) {
|
|
42
|
+
var callback;
|
|
43
|
+
if (typeof code === "function") {
|
|
44
|
+
callback = code;
|
|
45
|
+
} else {
|
|
46
|
+
callback = () => {
|
|
47
|
+
window.eval(code)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return callback;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_onTimeout(id, repeat) {
|
|
54
|
+
// console.info("_onTimeout() id=" + id + " repeat=" + repeat);
|
|
55
|
+
if (this._timer_map.hasOwnProperty(id) == false) {
|
|
56
|
+
// console.log("timer " + id + " is called or cleared.");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
let callback = this._timer_map[id];
|
|
60
|
+
if (repeat == false) {
|
|
61
|
+
delete this._timer_map[id];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
callback();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import BackgroundTask from "./backgroundtask.js"
|
|
2
|
+
|
|
3
|
+
export default class WasmCoreApis {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.CodeRevision = "102XXXX"; // TODO: wasm场景后续从.wasm文件拿信息, 先试用代码中的内容
|
|
6
|
+
this.CoreBranchName = "TODO_NEED_APPLY";
|
|
7
|
+
this.ForgeNativeRevision = 0;
|
|
8
|
+
this.BackgroundTask = new BackgroundTask();
|
|
9
|
+
this.EngineJs = "embedded";
|
|
10
|
+
this.UrlBuilder = URL;
|
|
11
|
+
this.Platform = "pc-wasm"; // 平台信息,可选有 android/pc-wasm/harmony-webview
|
|
12
|
+
|
|
13
|
+
this._ForgeHandle = null;
|
|
14
|
+
this._ForgeCanvasRef = null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
loadInfoFromCore() {
|
|
18
|
+
this.ForgeNativeRevision = NativeForgeGetVerCode(); // wasm库挂在window上的api:NativeForgeGetVerCode
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
loadRenderPlugin(name, className, path) {
|
|
22
|
+
console.log("loadRenderPlugin not implemented");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
setLruCacheSize(size) {
|
|
26
|
+
// wasm场景没有 LruCache, 不需要设置
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getJsContextId() {
|
|
30
|
+
// wasm场景下为JsvContext单例,返回单一的0
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
addKeysMap(bindKeyObj) {
|
|
35
|
+
// 不需设置,仅备份用来测试内存泄露
|
|
36
|
+
this._TmpValue_addKeysMap = bindKeyObj;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
notifyAppName(app_name) {
|
|
40
|
+
// 不需设置,仅备份用来测试内存泄露
|
|
41
|
+
this._TmpValue_notifyAppName = app_name;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
setMiniAppPermissionInfo(setting) {
|
|
45
|
+
// 不需设置,仅备份用来测试内存泄露
|
|
46
|
+
this._TmpValue_setMiniAppPermissionInfo = setting;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getCurrentTimeMs() {
|
|
50
|
+
console.log("getCurrentTimeMs not implemented");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
addEventListener(event_name, callback) {
|
|
54
|
+
console.log("addEventListener not implemented");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
removeEventListener(event_name, callback) {
|
|
58
|
+
console.log("removeEventListener not implemented");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
removeEventCallback(callback) {
|
|
62
|
+
console.log("removeEventCallback not implemented");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
takeNativeHashChange(listener) {
|
|
66
|
+
this._TmpCallback_takeNativeHashChange = listener;
|
|
67
|
+
return null; // 初始值initHash为null,wasm模式下没有warmload模式
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
async runJsWithUrl(app_url, sync, callback, observer) {
|
|
72
|
+
console.log("runJsWithUrl not implemented");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
getVisibility() {
|
|
76
|
+
console.log("getVisibility not implemented");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
onVisibilityChange(callback) {
|
|
80
|
+
// wasm没有可视变化,所以不处理回调,但是讲callback保存住可以用来测试泄漏问题
|
|
81
|
+
this.addEventListener("__JsvVisibility", callback);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getNetStatus() {
|
|
85
|
+
// 固定返回值为 类型:有线 链接状态:链接
|
|
86
|
+
return '{"NetType":"ethernet","Connected":true}';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onNetStatusChange(callback) {
|
|
90
|
+
// wasm没有断网状态,所以不处理回调,但是讲callback保存住可以用来测试泄漏问题
|
|
91
|
+
this.addEventListener("__JsvNet", callback);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
onNetReady(callback) {
|
|
95
|
+
// wasm无断网状态,直接回调
|
|
96
|
+
callback?.();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onActivityStateChange(callback) {
|
|
100
|
+
// wasm没有activity状态切换,所以不处理回调,但是讲callback保存住可以用来测试泄漏问题
|
|
101
|
+
this.addEventListener("onActivityState", callback);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setIgnoreSizeCheckWebSites(webSites) {
|
|
105
|
+
// wasm场景,不需要调整此参数
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
loadFont(font_family_name, url, on_load, on_error) {
|
|
109
|
+
console.log("loadFont not implemented");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
hasPendingUserInput() {
|
|
113
|
+
// wasm无法做骨架图打断处理
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
triggerManualBlocker() {
|
|
118
|
+
// wasm无法做骨架图打断处理
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
enableReceivingUserInput() {
|
|
122
|
+
// wasm无法做骨架图打断处理,不需要做此设置
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
setAutoUriEncode(enable) {
|
|
127
|
+
console.log("setAutoUriEncode not implemented");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
showUiCover(red_int, green_int, blue_int, alpha_float) {
|
|
131
|
+
console.log("showUiCover not implemented");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
hideUiCover() {
|
|
135
|
+
console.log("hideUiCover not implemented");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
simKeyEvent(keyCode, keyAction) {
|
|
139
|
+
console.log("simKeyEvent not implemented");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
reduceFps(fps) {
|
|
143
|
+
console.log("reduceFps not implemented");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
enableFpsDisplay(enable) {
|
|
147
|
+
this._ForgeCanvasRef?.enableFpsDisplay(enable);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
addGlobalJsExceptionAck(callback) {
|
|
151
|
+
console.log("addGlobalJsExceptionAck not implemented");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
removeGlobalJsExceptionAck(callback) {
|
|
155
|
+
console.log("removeGlobalJsExceptionAck not implemented");
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
toggleViewVisible(toVisible) {
|
|
159
|
+
console.log("toggleViewVisible not implemented");
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
getScreenInfo() {
|
|
163
|
+
console.log("getScreenInfo not implemented");
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
appendNetTraceHeaders(headerMap) {
|
|
167
|
+
console.log("appendNetTraceHeaders not implemented");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
ensureTesterUtils() {
|
|
171
|
+
console.log("ensureTesterUtils not implemented");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
logD(tag, ...args) {
|
|
175
|
+
console.log(tag, args?.join());
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
setStorageDomain(newStorageDomain) {
|
|
179
|
+
// wasm不支持调整storage domain
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
enableStorageNames(...args) {
|
|
183
|
+
// wasm不需要设置,localStorage即可以通过变量名访问
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
setCookieDomain(newCookieDomain) {
|
|
187
|
+
// wasm不支持调整 cookie domain
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
setRenderGlobalConfig(json) {
|
|
191
|
+
this._ForgeHandle?.SetGlobalConfig(json);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
setForgeJsHandle(forgeHandle) {
|
|
195
|
+
this._ForgeHandle = forgeHandle;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
onMainTsDone() {
|
|
199
|
+
console.log("onMainTsDone...");
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// wasm glue 特有api
|
|
203
|
+
setForgeCanvasSingleton(forge_canvas_ref) {
|
|
204
|
+
this._ForgeCanvasRef = forge_canvas_ref;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import appConfig from "/src/appConfig/app.config.mjs";
|
|
2
|
+
import jsviewVendorConfig from "/src/appConfig/jsview.config.mjs";
|
|
3
|
+
import { PERMISSION } from "/src/appConfig/permission.js";
|
|
4
|
+
import JsViewLoader from './jsview-loader.js';
|
|
5
|
+
import loadJsvCoreApi from "./jsv-core-api/jsview-core-api-glue.js"
|
|
6
|
+
|
|
7
|
+
// 加载JsvCoreApi
|
|
8
|
+
window.JsvCoreApi = loadJsvCoreApi();
|
|
9
|
+
|
|
10
|
+
let loader = JsViewLoader;
|
|
11
|
+
// 根据JsViewConfig, 判断厂商是否设置了使用远程loader启动
|
|
12
|
+
const remoteLoader = jsviewVendorConfig.jsviewConfig.remoteLoader;
|
|
13
|
+
if (remoteLoader) {
|
|
14
|
+
loader = (await import(remoteLoader)).default;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
appConfig,
|
|
19
|
+
jsviewVendorConfig,
|
|
20
|
+
PERMISSION,
|
|
21
|
+
loader as JsViewLoader,
|
|
22
|
+
}
|