@shijiu/jsview-vue 0.0.1-beta.0 → 0.9.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/.gitmodules +6 -0
- package/README.md +15 -0
- package/{docs → doc}/IMPORT_CHANGE_LOG.txt +0 -0
- package/doc/about-project-postinstall.md +0 -0
- package/{docs → doc}/git_commit.md +0 -0
- package/{docs → doc}/test_version_up.txt +0 -0
- package/dom/bin/jsview-browser-debug-dom.min.js +1 -0
- package/dom/bin/jsview-dom.min.js +1 -0
- package/dom/bin/jsview-forge-define.min.js +1 -0
- package/dom/bin/package.json +11 -0
- package/dom/jsv-browser-debug-dom.js +2 -2
- package/dom/jsv-dom.js +2 -2
- package/dom/jsv-forge-define.js +2 -2
- package/{load → loader}/header_script_loader.js +0 -0
- package/{load → loader}/jsview-main.js +0 -0
- package/{load → loader}/jsview.config.default.js +0 -0
- package/{load → loader}/jsview.default.config.js +0 -0
- package/{load → loader}/loader.js +0 -0
- package/{load → loader}/loader_webkit.js +0 -0
- package/package.json +5 -3
- package/{patch → patches}/node_modules/@babel/preset-env/lib/available-plugins.js +0 -0
- package/{patch → patches}/node_modules/@vue/cli-plugin-typescript/index.js +1 -1
- package/{patch → patches}/node_modules/@vue/cli-service/lib/commands/serve.js +0 -0
- package/{patch → patches}/node_modules/@vue/cli-service/lib/config/app.js +0 -0
- package/{patch → patches}/node_modules/@vue/cli-service/lib/config/assets.js +0 -0
- package/{patch → patches}/node_modules/@vue/cli-service/lib/config/base.js +2 -2
- package/{patch → patches}/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -0
- package/{patch → patches}/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +0 -0
- package/{patch → patches}/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -0
- package/{patch → patches}/node_modules/postcss-js/objectifier.js +0 -0
- package/{patch → patches}/node_modules/vue-loader/dist/resolveScript.js +0 -0
- package/scripts/common.js +92 -0
- package/scripts/install-local-packages.js +1 -49
- package/scripts/post-build.js +15 -20
- package/scripts/post-install.js +40 -89
- package/scripts/pre-pack.js +37 -0
- package/scripts/update-version.js +32 -0
- package/shijiu-jsview-vue-0.9.246.tgz +0 -0
- package/utils/JsViewEngineWidget/bin/index.js +1 -0
- package/utils/JsViewEngineWidget/bin/jsview-vue-widget.min.js +1 -0
- package/utils/JsViewEngineWidget/bin/package.json +11 -0
- package/utils/JsViewEngineWidget/index.js +2 -2
- package/utils/JsViewVueTools/index.d.ts +13 -0
- package/vetur.config.js +5 -0
- package/dom/bin/jsview-dom-1.0.313.tgz +0 -0
- package/patch/package-lock.json +0 -30051
- package/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.1.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
void 0===window.Forge&&(window.Forge={});var e=window.Forge;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,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.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!==document.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=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,e)}e=window.JsView.Dom.__MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let o=i,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let l=a>1?o.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>1?l.substring(a):"",this.origin=a>0?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 s{static SetBackgroundColor(t,i,n){const r=s.TextureManager.GetColorTexture(i);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.TextureSetting(r,o);t.ResetTexture(a)}static SetBackgroundImage(i,n,r,o,a,l){if("string"==typeof n&&(n=new t(n)),n instanceof t==!1)throw Error("Bad Argument.",n);let h;if(h=n.href.endsWith("gif")||n.href.endsWith("webp")?s.TextureManager.GetGifImage(n.href,!1,null):s.TextureManager.GetImage2(n.href,!1,a,l||e.ColorSpace.RGBA_8888),h){let t;r&&(t=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const s=new e.ExternalTextureSetting(h,t);if(i.ResetTexture(s),o){let e=h.RegisterLoadImageCallback(null,(function(){o({width:h.Width,height:h.Height})}));i.RegisterDetachCallback((()=>{h.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(i,n,r,o){if("string"==typeof n&&(n=new t(n)),n instanceof t==!1)throw Error("Bad Argument.",n);if("string"==typeof r&&(r=new t(r)),r instanceof t==!1)throw Error("Bad Argument(MaskURL).",r);const a=s.TextureManager.GetImage2(n.href,!1,null,o||e.ColorSpace.RGBA_8888);if(a){const t=s.TextureManager.GetImage2(r.href,!1,null,e.ColorSpace.RGBA_8888),n=new e.ExternalTextureSetting(a,new e.ViewTextureMask(t));i.ResetTexture(n)}}static SetVideoTexture(t,i,n){const r=s.TextureManager.GetColorTexture(i);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.TextureSetting(r,o);t.ResetTexture(a)}static GetTextWidth(t){return t.str||(t.str=""),t.font||(t.font=e.TextUtils._sDefaultFont),t.size||(t.size=e.TextUtils._sDefaultFontSize),"italic"!==t.italic&&(t.italic=""),"bold"!==t.bold&&(t.bold=""),window.PlatformUtils.GetTextWidth(t)}static RequestSwap(){e.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let i={size:t,refNum:0};s.TextureInfo.Cache[e.Source]=i}static RefImgTexSize(e,t){let i=s.TextureInfo.Cache[e.Source];i?(i.refNum>0?i.refNum++:i.refNum=1,t(i.size)):e.RegisterLoadImageCallback(null,(function(){const i={width:e.Width,height:e.Height};t(i);let n=s.TextureInfo.Cache[e.Source];if(n)n.refNum>0?n.refNum++:n.refNum=1;else{let t={size:i,refNum:1};s.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=s.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&s.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of s.TextureInfo.Unused){let t=s.TextureInfo.Cache[e];t.refNum<-2?(delete s.TextureInfo.Cache[e],s.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:s.TextureInfo.Unused.delete(e)}}}s.TextureInfo={Cache:{},Unused:new Set},s.TextureManager=null,s.RootView=null,s.RootActivity=null,s.HaltKeyEvent=!1;class i{constructor(e){this.target=null,this.timeStamp=Date.now(),this.type=e}initEvent(e,t,s){this.type=e}}class n extends i{constructor(e){super(e),this.keyCode=-1,this.key=-1,this.repeat=0}static JsvGetKeyFromCode(e){return new Map([[n.KeyCode.Enter,n.Key.Enter],[n.KeyCode.ArrowUp,n.Key.ArrowUp],[n.KeyCode.ArrowDown,n.Key.ArrowDown],[n.KeyCode.ArrowLeft,n.Key.ArrowLeft],[n.KeyCode.ArrowRight,n.Key.ArrowRight]])[e]}}n.Type={KEYDOWN:"keydown",KEYUP:"keyup"},n.Key={Enter:"Enter",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},n.KeyCode={Enter:13,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39};let r={cnt:0};class o{constructor(e){this.type=e,this.cachedValues=null,this.onSyncCallback=null}setOnSyncCallback(e){this.onSyncCallback=e,this.syncLastCaches(!0)}setCacheProperty(e,t){this.cachedValues||(this.cachedValues={}),this.cachedValues[e]=t,this.syncLastCaches(!1),s.RequestSwap()}syncLastCaches(e){let t=o.LastModified[this.type];if((e||t!==this)&&(o.LastModified[this.type]=this,t&&t.cachedValues&&"function"==typeof t.onSyncCallback)){let e=t.cachedValues;t.cachedValues=null,t.onSyncCallback(e)}}static SyncAllCachedProperty(){for(let e of Object.values(o.LastModified))e.syncLastCaches(!0);r.cnt=(r.cnt+1)%65535}}o.LastModified={};class a{constructor(t){this.activity=new e.ReactActivity("JsViewForgeActivity",t,this.OnKeyDown.bind(this),this.OnKeyUp.bind(this)),this._Init()}_Init(){console.log("JsViewForgeActivity.OnCreate()."),s.TextureManager=this.activity.GetTextureManager(),s.RootView=new e.LayoutView,s.RootActivity=this.activity,document.jsvUpdateRootElement(s.RootView);let t=null;e.DesignMap&&(t=e.DesignMap());let i=t?t.width:1280,n=Math.floor(9*i/16);this.activity.SetContentView(s.RootView,{x:0,y:0,width:i,height:n}),e.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{o.SyncAllCachedProperty(),s.ClearUnusedTexSize()})),window.JsView.Dom.Render()}OnKeyDown(e){if(s.HaltKeyEvent){let t=new n(n.Type.KEYDOWN);return t.keyCode=e.keyCode,t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}OnKeyUp(e){if(s.HaltKeyEvent){let t=new n(n.Type.KEYUP);return t.keyCode=e.keyCode,t.key=n.JsvGetKeyFromCode(t.keyCode),t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}}class l{constructor(t){this._ActivityManager=t;let s=new a(t);t.RegisterActivity(s.activity),t.StartActivity(new e.Intent("JsViewForgeActivity"))}}window.JsView&&(window.JsView.Dom={DesignMap:null,Render:null,Extension:s,UrlRef:t},window.JsView.React=window.JsView.Dom);class h{static SetLevel(e){switch(h.E=h.W=h.I=h.D=function(){},e){case h.Level.Verbose:h.V=console.debug.bind(console);case h.Level.Debug:h.D=console.debug.bind(console);case h.Level.Info:h.I=console.info.bind(console)}}static Throw(...e){throw console.error(...e),[...e]}}h.E=console.error.bind(console),h.W=console.warn.bind(console),h.I=console.info.bind(console),h.D=function(){},h.V=function(){},h.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class u{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[],this.jsvEventListener=void 0,this.jsvChildChangedCallback=void 0}jsvGetTagName(){return"Unknown"}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){let t=this.childNodes.indexOf(e);t<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(t,1),e.parentNode=void 0,this.jsvChildChangedCallback?.()}insertBefore(e,t){let s=this.childNodes.length;void 0===t?h.Throw("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."):null!==t&&(s=this.childNodes.indexOf(t)),s<0&&h.Throw("Failed to call Node.insertBefore(), before node not found. beforeNode=",t),this.childNodes.splice(s,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&&h.Throw("Failed to call Node.previousSibling(), this node not found. this=",this),e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&&h.Throw("Failed to call Node.nextSibling(), this node not found. this=",this),e[t+1]}addEventListener(e,t,s){this.jsvEventListener||(this.jsvEventListener={});let i=this.jsvEventListener[e];i||(i=new Set,this.jsvEventListener[e]=i),i.add(t)}removeEventListener(e,t,s){if(!this.jsvEventListener)return;let i=this.jsvEventListener[e];i&&(i.delete(t),i.size<=0&&this.jsvEventListener.hasOwnProperty(e)&&delete this.jsvEventListener[e],0===Object.values(this.jsvEventListener).length&&(this.jsvEventListener=void 0))}dispatchEvent(e){if(!this.jsvEventListener)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListener[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)s(e)}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}}u.ELEMENT_NODE=1,u.TEXT_NODE=3,u.COMMENT_NODE=8,u.DOCUMENT_NODE=9,u.NOLAYOUT_NODE=10;class c extends i{}c.Type={FOCUS:"focus",BLUR:"blur"};class d extends i{stopPropagation(){}}class v{static ConvertInt(e){return e?"number"==typeof e?Math.floor(e):"string"==typeof e?parseInt(e):e:e}static ConvertFloat(e){if(!e)return e;if("string"!=typeof e)return e;return parseFloat(e)}static ConvertPx(e){if(!e)return e;if("string"!=typeof e)return e;if("0"===e)return 0;if(e.endsWith("px")){return parseInt(e)}return e}static ConvertRect(e){let t=v.SplitString(e," "),s={top:t.length>0?parseInt(t[0]):0,right:t.length>1?parseInt(t[1]):null,bottom:t.length>2?parseInt(t[2]):null,left:t.length>3?parseInt(t[3]):null};return s.right=s.right||0===s.right?s.right:s.top,s.bottom=s.bottom||0===s.bottom?s.bottom:s.top,s.left=s.left||0===s.left?s.left:s.right,s}static ConvertCorner(e){let t=v.SplitString(e," "),s={topLeft:t.length>0?parseInt(t[0]):0,topRight:t.length>1?parseInt(t[1]):null,bottomRight:t.length>2?parseInt(t[2]):null,bottomLeft:t.length>3?parseInt(t[3]):null};return s.topRight=s.topRight||0===s.topRight?s.topRight:s.topLeft,s.bottomRight=s.bottomRight||0===s.bottomRight?s.bottomRight:s.topLeft,s.bottomLeft=s.bottomLeft||0===s.bottomLeft?s.bottomLeft:s.bottomRight,s}static ConvertSize(e){let t=v.SplitString(e," "),s={width:t.length>0?parseInt(t[0]):0,height:t.length>1?parseInt(t[1]):null};return s.height=s.height||0===s.height?s.height:s.width,s}static ConvertAnimation(e){if(null===e||0===e.length)return null;let t=e.indexOf("cubic-bezier"),s=[];if(t>=0){let i=e.indexOf(")"),n=e.substring(t,i+1),r=v.SplitString(e,n);for(let e of r){let t=v.SplitString(e," ");s=s.concat(t)}s.push(n)}else s=v.SplitString(e," ");let i=null,n=0,r=1,o=e.includes("alternate");for(let e=2;e<s.length;e++){if("infinite"===s[e]){r=-1;continue}let t=v.ConvertTimeMs(s[e]);!1===isNaN(t)?n=t:(t=parseFloat(s[e]),!1===isNaN(t)?r=t:i=s[e])}let a=s.length>1?v.ConvertTimeMs(s[1]):0;return{name:s.length>0?s[0]:"",duration:a,timingFunction:v.ConvertEasing(i,a),delay:n,iterationCount:r,direction:o,originStr:e}}static ConvertTransition(e){if(null==e||0==e.length)return null;let t={},s=new Array,i=e.split(",");for(let e=0;e<i.length;e++)if(i[e].indexOf("(")>=0){let t=e;for(;t<i.length&&i[t].indexOf(")")<0;)t++;let n="";for(let s=e;s<=t;s++)s!=e&&(n+=","),n+=i[s];e=t,s=s.concat(n)}else s=s.concat(i[e]);for(let e of s){let s=v.ConvertAnimation(e);if(t[s.name]=s,"all"==s.name){let e=new Array("opacity","left","top","width","height","transform");for(let i of e)t[i]=s}}return t}static ConvertTimeMs(e){e||(e="");let t=NaN;return(e=e.trim()).endsWith("ms")?t=1:e.endsWith("s")&&(t=1e3),t*=parseFloat(e),t}static ConvertEasing(t,s){let i=e.Easing.Circular.InOut;if(!t)return i;if(t.includes("ease"))i=t.includes("-in-out")?e.Easing.Circular.InOut:t.includes("-out")?e.Easing.Circular.Out:t.includes("-in")?e.Easing.Circular.In:e.Easing.Circular.InOut;else if(t.includes("linear"))i=null;else if(t.includes("cubic-bezier")){let n=v.ConvertBezier(t);i=new e.BezierEasing(n.x1,n.y1,n.x2,n.y2,s)}else if(t.includes("steps")){let s=v.ConvertSteps(t);i=new e.StepsEasing(s.steps,s.type)}return i}static ConvertBezier(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let s=v.SplitString(e,",");return{x1:s.length>0?parseFloat(s[0]):0,y1:s.length>1?parseFloat(s[1]):0,x2:s.length>2?parseFloat(s[2]):0,y2:s.length>3?parseFloat(s[3]):0}}static ConvertSteps(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let s=v.SplitString(e,",");return{steps:s.length>0?parseInt(s[0]):1,type:s.length>1?s[1].includes("start")?0:1:0}}static ConvertOverflow(e,t){return e&&!e.includes("visible")?t.HIDDEN:t.VISIBLE}static ConvertObjectFit(e,t){return"symbol"==typeof e?e:(e||(e=""),e.includes("fill")?t.FILL:e.includes("contain")?t.CONTAIN:e.includes("cover")?t.COVER:e.includes("none")?t.NONE:e.includes("scale-down")?t.SCALEDOWN:t.CONTAIN)}static SplitString(e,t){e||(e="");let s=e.trim().split(t);if(" "!==t)return s;let i=[];for(let e of s)e&&i.push(e);return i}}class g{constructor(e){if(this.top=null,this.right=null,this.bottom=null,this.left=null,!e||!1===e.startsWith("inset"))return void console.error("Inset.Parse() InvalidArgs: value=",e);let t=e.indexOf("(")+1,s=e.substring(t),i=v.ConvertRect(s);this.top=i.top,this.right=i.right,this.bottom=i.bottom,this.left=i.left}}class p{constructor(e){if(this.source=null,this.slice=null,this.repeat=null,this.outset=null,this.width=null,!e)return void console.error("BorderImage.constructor() InvalidArgs: value=",e);let s=e.indexOf(")")+1,i=e.substring(0,s),n=e.substring(s);this.source=new t(i),this.slice=v.ConvertRect(n)}}class w{constructor(){this.refStyleObject=new Map,this.value=void 0}static AppendRefStyle(e,t,s){let i=w.jsvGetStyleVar(e);i.refStyleObject.has(t)||i.refStyleObject.set(t,[]),i.refStyleObject.get(t).push(s)}static RemoveRefStyle(e){for(const t of w.VariableMap.values())for(const s of t.refStyleObject.keys())s==e&&t.refStyleObject.delete(e)}static UpdateValue(e,t){let s=w.jsvGetStyleVar(e);s.value=t;for(const[e,t]of s.refStyleObject)for(const s of t)e.jsvSetClassProperty(s)}static GetValue(e){return w.jsvGetStyleVar(e).value}static jsvGetStyleVar(e){e.startsWith("--")&&(e=`var(${e})`),w.VariableMap.has(e)||w.VariableMap.set(e,new w);return w.VariableMap.get(e)}}w.VariableMap=new Map;class y{constructor(){this.jsvStore={},this.jsvLazySyncCache=new o("style"),this.jsvLockedProps={},this.jsvNamedClassArray=null,this.jsvCustomStyles={},this.jsvLazyPrevClassNames=null,this.jsvLazyClassNames=null,this.jsvLazyClassAttributes=null}setProperty(e,t){"function"==typeof document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat(e,t),this.jsvLockedProps[e]=!0,t=y.JsvConvertPropValue(e,t),this.jsvUpdateProperty(e,t)}getPropertyValue(e){if(void 0!==this.jsvStore[e])return this.jsvStore[e];let t=this.jsvGetClassPropValue(this.jsvLazyClassNames,this.jsvLazyClassAttributes,e);return t=y.JsvConvertPropValue(e,t),t}jsvDestory(){w.RemoveRefStyle(this)}jsvUpdateProperty(e,t){let s=this.jsvSetPropertySilently(e,t);s&&this.jsvLazySyncCache.setCacheProperty(s,!0)}jsvSetPropertySilently(e,t){if(e.startsWith("--"))return void w.UpdateValue(e,t);if("string"==typeof t&&t.startsWith("var(--"))return void w.AppendRefStyle(t,this,e);if("animation"===e){if(this.jsvStore[e]?.originStr===t?.originStr)return null}else if(this.jsvStore[e]===t)return null;return this.jsvStore[e]=t,y.JsvGetStyleType(e)}jsvApplyClasses(t){if(t.indexOf("JsvStyle_")<0){this.jsvLazyPrevClassNames=this.jsvLazyClassNames,this.jsvLazyClassNames=t.split(" ");const e=y.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(e,!0)}else if(t){let s=t.split(" "),i={};this.jsvNamedClassArray=new Array(s.length);let n=0;for(let t of s){let s=null;if(e.ReactUtils.StyleClassMap.hasOwnProperty(t)){s=e.ReactUtils.StyleClassMap[t];let n=s.getAttach();if(null==n){let e=s.getStyles();n={altStyles:{},hasTextMajorStyle:0,textPackAttr:null};for(let t in e)n.altStyles[t]=y.JsvConvertPropValue(t,e[t]);s.updateAttach(n)}"text"===s.classType()&&(n.hasTextMajorStyle=2,null===n.textPackAttr&&(n.textPackAttr={textLineAlign:s.getLineAlign(),textVerticalAlign:s.getVerticalAlign()}),this.jsvCustomStyles.textLineAlign=n.textPackAttr.textLineAlign,this.jsvCustomStyles.textVerticalAlign=n.textPackAttr.textVerticalAlign),Object.assign(i,n.altStyles)}else console.error("Error: className not found");this.jsvNamedClassArray[n]=s,n++}for(let e in i)this.jsvLockedProps[e]||this.jsvUpdateProperty(e,i[e])}}jsvAppendClassAttribute(e){this.jsvLazyClassAttributes||(this.jsvLazyClassAttributes=new Set),this.jsvLazyClassAttributes.add(e);const t=y.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvSetClassProperty(e){let t=y.JsvGetStyleType(e);t&&this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvGetClassPropValue(e,t,s){if(!e)return;const i=(e,t,s,i)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(s&&(r+="["+s+"]"),!e.hasOwnProperty(r))continue;const o=e[r];if(!o.hasOwnProperty(i))continue;let a=o[i];return"string"==typeof a&&a.startsWith("var(--")&&(a=w.GetValue(a)),a}},n=window.JsvCode.Dom.StyleSheets;for(const r of t??[]){const t=i(n,e,r,s);if(t)return t}return i(n,e,null,s)}jsvGetClassDeclarations(e,t){if(!e)return;const s=(e,t,s)=>{let i={};for(let n=0;n<t.length;n++){let r=t[n];if(s&&(r+="["+s+"]"),!e.hasOwnProperty(r))continue;const o=e[r];Object.assign(i,o)}return i},i=window.JsvCode.Dom.StyleSheets;let n=s(i,e,null);for(const r of t??[]){const t=s(i,e,r);Object.assign(n,t)}return n}jsvUpdateChangedClasses(){h.D("jsvGetChangedClassTypes() classNames="+this.jsvLazyClassNames);let e={};if(this.jsvLazyPrevClassNames){w.RemoveRefStyle(this);const t=this.jsvGetClassDeclarations(this.jsvLazyPrevClassNames,this.jsvLazyClassAttributes);for(const s of Object.keys(t)){e[y.JsvGetStyleType(s)]=!0}this.jsvLazyPrevClassNames=null}if(this.jsvLazyClassNames){const t=this.jsvGetClassDeclarations(this.jsvLazyClassNames,this.jsvLazyClassAttributes);for(const[s,i]of Object.entries(t)){e[y.JsvGetStyleType(s)]=!0,"string"==typeof i&&i.startsWith("var(--")&&w.AppendRefStyle(i,this,s)}}return e}jsvSetChangedListener(e){this.jsvLazySyncCache.setOnSyncCallback((t=>{if(t.hasOwnProperty(y.TYPE.CLASS_NAME)){const e=this.jsvUpdateChangedClasses();Object.assign(t,e),t[y.TYPE.CLASS_NAME]=void 0}e(t)}))}static JsvContainsTextMajor(e){for(let t of y.TextClassMajorStyles)if(e.hasOwnProperty(t))return!0;return!1}static JsvGetStyleType(e){switch(e){case y.PROP.LEFT:case y.PROP.RIGHT:case y.PROP.TOP:case y.PROP.BOTTOM:case y.PROP.ZINDEX:return y.TYPE.LAYOUT_POS;case y.PROP.TRANSFORM:case y.PROP.TRANSFORMORIGIN:return y.TYPE.TRANSFORM;case y.PROP.WIDTH:case y.PROP.HEIGHT:case y.PROP.VISIBILITY:case y.PROP.DISPLAY:case y.PROP.CLIPPATH:case y.PROP.OVERFLOW:case y.PROP.OBJECTFIT:case y.PROP.PERSPECTIVE:case y.PROP.PERSPECTIVEORIGIN:case y.PROP.BACKFACEVISIBILITY:case y.PROP.TRANSFORMSTYLE:case y.PROP.JSVVIDEOROTATION:return y.TYPE.LAYOUT_SIZE;case y.PROP.BACKGROUNDCOLOR:case y.PROP.BACKGROUNDIMAGE:case y.PROP.BORDERRADIUS:return y.TYPE.BACKGROUND;case y.PROP.COLOR:case y.PROP.LINEHEIGHT:case y.PROP.WHITESPACE:case y.PROP.FONTFAMILY:case y.PROP.FONTSIZE:case y.PROP.FONTSTYLE:case y.PROP.FONTWEIGHT:case y.PROP.TEXTALIGN:case y.PROP.TEXTSHADOW:case y.PROP.TEXTOVERFLOW:case y.PROP.WEBKITTEXTSTROKE:return y.TYPE.FOREGROUND;case y.PROP.BORDERIMAGE:case y.PROP.BORDERIMAGEWIDTH:case y.PROP.BORDERIMAGEOUTSET:return y.TYPE.BORDER;case y.PROP.ANIMATION:return y.TYPE.ANIMATION;case y.PROP.TRANSITION:return y.TYPE.TRANSITION;case y.PROP.OPACITY:break;default:return console.warn("Unknown style type for: "+e),null}}static JsvConvertPropValue(e,t){if(void 0===t)return t;if(e.startsWith("--")||t?.startsWith?.("var(--"))return t;switch(e){case y.PROP.TOP:case y.PROP.BOTTOM:case y.PROP.LEFT:case y.PROP.RIGHT:case y.PROP.WIDTH:case y.PROP.HEIGHT:case y.PROP.JSVVIDEOROTATION:return v.ConvertInt(t);case y.PROP.VISIBILITY:case y.PROP.DISPLAY:return t.toUpperCase();case y.PROP.OVERFLOW:return v.ConvertOverflow(t,y.Overflow);case y.PROP.OBJECTFIT:return v.ConvertObjectFit(t,y.ObjectFit);case y.PROP.TRANSFORM:case y.PROP.TRANSFORMORIGIN:return t;case y.PROP.CLIPPATH:return new g(t);case y.PROP.BORDERIMAGE:return new p(t);case y.PROP.BORDERIMAGEWIDTH:case y.PROP.BORDERIMAGEOUTSET:return v.ConvertRect(t);case y.PROP.BORDERRADIUS:return v.ConvertCorner(t);case y.PROP.ANIMATION:return v.ConvertAnimation(t);case y.PROP.TRANSITION:return v.ConvertTransition(t);case y.PROP.OPACITY:return v.ConvertFloat(t);default:return v.ConvertPx(t)}}}y.Overflow={HIDDEN:Symbol("hidden"),VISIBLE:Symbol("visible")},y.ObjectFit={FILL:Symbol("fill"),CONTAIN:Symbol("contain"),COVER:Symbol("cover"),NONE:Symbol("none"),SCALEDOWN:Symbol("scale-down")},y.TextClassMajorStyles=new Set(["textOverflow","wordWrap","textShadow","color","fontFamily","fontStyle","fontWeight","textAlign","WebkitTextStroke"]),y.TYPE={LAYOUT_POS:"layout-position",LAYOUT_SIZE:"layout-size",FOREGROUND:"foreground",BACKGROUND:"background",BORDER:"border",ANIMATION:"animation",TRANSFORM:"transform",TRANSITION:"transition",CLASS_NAME:"class-name"},y.PROP={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",WIDTH:"width",HEIGHT:"height",VISIBILITY:"visibility",DISPLAY:"display",BACKFACEVISIBILITY:"backfaceVisibility",CLIPPATH:"clipPath",OVERFLOW:"overflow",OBJECTFIT:"objectFit",TRANSFORM:"transform",TRANSFORMORIGIN:"transformOrigin",PERSPECTIVE:"perspective",PERSPECTIVEORIGIN:"perspectiveOrigin",ZINDEX:"zIndex",TRANSFORMSTYLE:"transformStyle",BACKGROUNDCOLOR:"backgroundColor",BACKGROUNDIMAGE:"backgroundImage",BORDERRADIUS:"borderRadius",COLOR:"color",LINEHEIGHT:"lineHeight",WHITESPACE:"whiteSpace",FONTFAMILY:"fontFamily",FONTSIZE:"fontSize",FONTSTYLE:"fontStyle",FONTWEIGHT:"fontWeight",TEXTALIGN:"textAlign",TEXTSHADOW:"textShadow",TEXTOVERFLOW:"textOverflow",WEBKITTEXTSTROKE:"WebkitTextStroke",BORDERIMAGE:"borderImage",BORDERIMAGEWIDTH:"borderImageWidth",BORDERIMAGEOUTSET:"borderImageOutset",ANIMATION:"animation",TRANSITION:"transition",OPACITY:"opacity",JSVVIDEOROTATION:"JsvVideoRotation"};for(let e in y.PROP){let t=y.PROP[e];Object.defineProperty(y.prototype,t,{set:function(e){this.setProperty(t,e)},get:function(){return this.getPropertyValue(t)}})}let f=null;class m{static getHandlers(e){const t=m.reactEventHandlers(e);return t||(e._vei?e._vei:{})}static reactEventHandlers(e){return null==f&&m._getReactToken(e),e["__reactEventHandlers$"+f]}static _getReactToken(e){for(let t in e)if(t.indexOf("__reactEventHandlers")>=0||t.indexOf("__reactInternalInstance")>=0){let e=t.indexOf("$");f=t.substring(e+1);break}}}class j extends u{constructor(t){super(u.ELEMENT_NODE),this.parentElement=null,this.tagName=this.jsvGetTagName(),this.tagName===j.TAG.STYLE?(this.style=null,this.jsvMainView=null,this.jsvMaskView=null):(this.style=new y,this.jsvMainView=new e.LayoutView,this.jsvMaskView=null),this.jsvAnimation=null,this.jsvStore={transition:null,transitionTmp:null,textContent:null,textStylePack:null,clientWidth:NaN,clientHeight:NaN,textureWidth:NaN,textureHeight:NaN,scopedData:[]},this.jsvLazySyncCache=new o("element"),this.instantSwapCallback=null,this.eventHandlers=null}appendChild(e){super.appendChild(e),this.jsvInsertChild(e,null)}removeChild(e){if(e.childNodes)for(const t of e.childNodes)e.removeChild(t);e.style?.jsvDestory(),super.removeChild(e),e.parentElement=null,e instanceof j&&this.jsvMainView.RemoveView(e.jsvMaskView)}insertBefore(e,t){super.insertBefore(e,t),this.jsvInsertChild(e,t)}get childElementCount(){return this.childNodes.length}get firstElementChild(){return this.childNodes.length>0?this.childNodes[0]:null}get lastElementChild(){const e=this.childNodes.length;return e>0?this.childNodes[e-1]:null}set className(e){this.setAttribute("class",e)}setAttribute(e,t){e&&(this[e],this[e]=t,e.startsWith("data-v-")?(this.jsvStore.scopedData.push(e),this.style.jsvAppendClassAttribute(e)):"class"===e?this.style.jsvApplyClasses(t):e.startsWith(j.ATTRIBUTE.JSVPREFIX)&&(e=e.replace(/-/g,"_"),this.jsvLazySyncCache.setCacheProperty(e,t)))}removeAttribute(e){this[e]=void 0,e.startsWith(j.ATTRIBUTE.JSVPREFIX)&&this.jsvLazySyncCache.setCacheProperty(e,void 0)}getAttribute(e){return this[e]}hasAttribute(e){return console.log("Element.hasAttribute() name="+e),!!this[e]}get clientWidth(){return isNaN(this.jsvStore.clientWidth)?this.style.width:this.jsvStore.clientWidth}get clientHeight(){return isNaN(this.jsvStore.clientHeight)?this.style.height:this.jsvStore.clientHeight}focus(){console.log("Element.focus()"),document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new c(c.Type.BLUR);t.target=e,document.dispatchEvent(t)}let t=new c(c.Type.FOCUS);document.dispatchEvent(t)}jsvInsertChild(e,t){if(e.parentElement=this,e.nodeType===u.ELEMENT_NODE&&e.tagName!==j.TAG.STYLE){if(!1===document.jsvIsReady)return void console.warn("Element.appendChild() Failed to append child to Forge. jsvIsReady="+document.jsvIsReady);e.jsvOnLoadForgeView(),e.style.jsvSetChangedListener(e.jsvOnStyleChanged.bind(e)),t=this.jsvBackwardFindForgeView(t);let s=e.jsvMaskView.GetLayoutParams();this.jsvMainView.InsertView(e.jsvMaskView,t?t.jsvMaskView:null,s)}else e.nodeType===u.TEXT_NODE&&(this.textContent=e.textContent)}jsvOnLoadForgeView(){if(this.style.clipPath||this.style.overflow||this.style.objectFit){if(this.jsvMaskView)throw Error("Jsview: jsvMaskView is conflicting.");this.jsvMaskView=new e.ClipView}else this.jsvMaskView||(this.jsvMaskView=this.jsvMainView);this.jsvMaskView!==this.jsvMainView&&this.jsvMaskView.AddView(this.jsvMainView);let t=this.jsvCallbackOnUnloadForgeView();t&&this.jsvMainView.RegisterDetachCallback(t),this.jsvLazySyncCache.setOnSyncCallback((e=>{this.jsvSetElementProp(e)}))}jsvSetElementProp(e){this.jsvMainView&&this.jsvMainView.SetElementProp(e,s.RootActivity)}jsvCallbackOnUnloadForgeView(){return null}jsvOnStyleChanged(e){let t=!!e[y.TYPE.LAYOUT_SIZE],s=!1;e[y.TYPE.LAYOUT_POS]&&(t||(this.jsvFlushViewLayout(),s=!0)),e[y.TYPE.LAYOUT_SIZE]&&(this.jsvFlushViewLayout(),s=!0),e[y.TYPE.TRANSFORM]&&!s&&(this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.jsvFlushViewTransition(),s=!0),e[y.TYPE.BACKGROUND]&&this.jsvFlushViewBackground(),e[y.TYPE.ANIMATION]&&this.jsvFlushViewAnimation(),e[y.TYPE.TRANSITION]&&!s&&this.jsvFlushViewTransition(),this.jsvFlushEventHandlers()}jsvFlushEventHandlers(){null===this.eventHandlers&&(this.eventHandlers=m.getHandlers(this),this.eventHandlers&&this.eventHandlers.onClick&&this.jsvMainView&&this.jsvMainView.EnableDivTouch(this,null))}jsvApplyObjectFit(e){return null}jsvFlushViewLayout(){if((this.style.clipPath||this.style.overflow||this.style.objectFit)&&!this.jsvMaskView)return void console.error("Element.jsvFlushViewLayout() InvalidOpt: clippath=",this.style.clipPath);const t={x:isNaN(this.style.left)?0:this.style.left,y:isNaN(this.style.top)?0:this.style.top,width:isNaN(this.style.width)?0:this.style.width,height:isNaN(this.style.height)?0:this.style.height};let s=null;if(this.style.objectFit&&(s=this.jsvApplyObjectFit(t),this.style.objectFit===y.ObjectFit.FILL&&(s=null)),this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.style.perspective&&this.style.perspective>0){let e=this.style.perspectiveOrigin?this.style.perspectiveOrigin:null;this.jsvMainView.SetPerspective(this.style.perspective,e)}if(this.style.backfaceVisibility&&this.jsvMainView.SetBackfaceVisibility("visible"==this.style.backfaceVisibility),this.style.transformStyle&&this.jsvMainView.SetTransformStyle(this.style.transformStyle),this.jsvMaskView.ResetLayoutParams({x:t.x,y:t.y,width:this.clientWidth,height:this.clientHeight}),this.jsvMaskView!==this.jsvMainView){const e={x:0,y:0,width:this.jsvMaskView.LayoutParams.Width,height:this.jsvMaskView.LayoutParams.Height};this.jsvMainView.ResetLayoutParams(e)}this.jsvMaskView.SetVisibility(this.style.visibility);let i=null;null!==s&&window.JsView?i={x:s.x,y:s.y,width:s.width,height:s.height}:this.style.clipPath?i={x:this.style.clipPath.left,y:this.style.clipPath.top,width:this.jsvMaskView.LayoutParams.Width-this.style.clipPath.left-this.style.clipPath.right,height:this.jsvMaskView.LayoutParams.Height-this.style.clipPath.top-this.style.clipPath.bottom}:this.style.overflow===y.Overflow.HIDDEN&&null===this.jsvStore.textContent&&(i={x:0,y:0,width:this.style.width,height:this.style.height}),i?this.jsvMaskView.SetClipRect(i.x,i.y,i.width,i.height,!0):this.jsvMaskView instanceof e.ClipView&&this.jsvMaskView.SetClipRect(0,0,0,0,!1),void 0!==this.style.zIndex&&null!==this.style.zIndex&&this.jsvMaskView.SetZIndex(this.style.zIndex),this.jsvFlushViewTransition()}jsvFlushViewBackground(){this.style.backgroundColor&&(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,s.SetBackgroundColor(this.jsvMainView,this.style.backgroundColor,this.style.borderRadius)),this.style.backgroundImage&&(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,s.SetBackgroundImage(this.jsvMainView,this.style.backgroundImage,this.style.borderRadius))}jsvFlushViewAnimation(){if(this.jsvAnimation&&this.jsvAnimation.Cancel(),!this.style.animation)return;let t=document.jsvGetKeyFrames(this.style.animation.name,this.jsvStore.scopedData);this.jsvAnimation=new e.CssKeyframeAnimation(t,this.style.animation.duration,this.style.animation.timingFunction,this.style.width?this.style.width:this.clientWidth,this.style.height),this.jsvAnimation.EnableDelay(this.style.animation.delay).SetRepeat(this.style.animation.iterationCount),"forwards"===this.style.animationFillMode&&this.jsvAnimation.Enable(e.AnimationEnable.KeepTransform);var s=this;let i=new e.AnimationListener;i.OnEnd((t=>{if(s.jsvAnimation=null,t){if(s.eventHandlers&&s.eventHandlers.onAnimationEnd){let e;e=new d("animationend"),e.target=s,s.eventHandlers.onAnimationEnd(e)}null==s.instantSwapCallback&&(s.instantSwapCallback=e.sRenderBridge.InstantPerformSwap.bind(e.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation.Enable(e.AnimationEnable.ReleaseAfterEndCallback),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation)}jsvFlushViewTransition(){if(this.style.animation)return;if(null!=this.jsvStore.transitionTmp&&this.jsvStore.transitionTmp.syncTimes!=r.cnt&&-1!=this.jsvStore.transitionTmp.syncTimes){let e=this.jsvStore.transition;this.jsvStore.transition=this.jsvStore.transitionTmp,this.jsvStore.transitionTmp=e,null!=this.jsvStore.transitionTmp&&(this.jsvStore.transitionTmp.syncTimes=-1)}if(this.style.transition){if(this.jsvStore.transition){if(!this._JsvBuildTransition())return}}else this.jsvAnimation&&(this.jsvAnimation.Cancel(),this.jsvAnimation=null);let e=this.jsvStore.transitionTmp;e||(e={left:0,top:0,width:0,height:0,opacity:1,transform:null,syncTimes:-1}),e.left=this.style.left,e.top=this.style.top,e.width=this.style.width,e.height=this.style.height,e.opacity=this.style.opacity,e.transform=this.style.transform,e.syncTimes=r.cnt,this.jsvStore.transitionTmp=e}_JsvBuildTransition(){let t=[];for(let e in this.style.transition){let s=this.jsvStore.transition[e],i=this.style[e];if(s===i)continue;let n=this.style.transition[e],r={name:e,dur:n.duration,tf:null,dly:n.delay,from:s||"",to:i};"transform"===e&&(r.origin=this.style.transformOrigin?this.style.transformOrigin:"center center"),n.timingFunction&&(r.tf=n.timingFunction.Package()),t.push(r)}if(t.length<=0)return!1;var s=this;let i=new e.AnimationListener;return i.OnEnd((t=>{if(s.jsvAnimation=null,t){if(s.eventHandlers&&s.eventHandlers.onTransitionEnd){let e=new d("transitionend");e.target=s,s.eventHandlers.onTransitionEnd(e)}null==s.instantSwapCallback&&(s.instantSwapCallback=e.sRenderBridge.InstantPerformSwap.bind(e.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation=new e.CssTransitionAnimation(t),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation),!0}jsvBackwardFindForgeView(e){let t=e;for(;t&&!(t instanceof j);)t=t.nextSibling;return t}static applyObjectFitCommon(e,t,s){if(s&&!isNaN(e.jsvStore.textureWidth)&&!isNaN(e.jsvStore.textureHeight)){const i=e.style.objectFit,n=s.ApplyObjectFit(t.width,t.height,e.jsvStore.textureWidth,e.jsvStore.textureHeight,i,y.ObjectFit);return 0!==t.width&&0!==t.height||0===t.width&&0===t.height||(e.jsvStore.clientWidth=Math.max(t.width,n.width),e.jsvStore.clientHeight=Math.max(t.height,n.height)),n}return null}}j.TAG={DIV:"DIV",IMAGE:"IMAGE",LINK:"LINK",STYLE:"STYLE",AUDIO:"AUDIO",VIDEO:"VIDEO",ANCHOR:"A",SVG:"SVG",FDIV:"FDIV",AUDIOTRACK:"AUDIOTRACK"},j.ATTRIBUTE={SRC:"src",JSVPREFIX:"jsv"};class T extends j{constructor(){super(),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return j.TAG.ANCHOR}}class O extends j{constructor(e){super(),this.jsvMediaView=null,this.jsvMedia=null,this.onVisibilityChange=this.onVisibilityChange.bind(this),this.stopByOnHide=!1,this.playBackground=!1,e&&(this.srcValue=e)}addEventListener(e,t,s){e=e.replace(/-/g,""),super.addEventListener(e,t,s),this.jsvAddMediaListener(e)}jsvOnLoaded(){}set src(e){if(e&&"about:null"!==e&&"about:blank"!==e){e=new t(e).href}this.jsvMedia||this.jsvInit(),e!==this.jsvMedia.src&&(this.jsvMedia.src=e,this.srcValue=e)}jsvOnLoadForgeView(){console.log("MediaElement jsvOnLoadForgeView"),super.jsvOnLoadForgeView(),this.jsvMedia||this.jsvInit(),this.registerOnVisibilityChange()}jsvInit(){let e=this.jsvEventListener;if(e)for(var t in e.keys)this.jsvAddMediaListener(t)}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){console.log("MediaElement jsvOnUnloadForgeView"),this.unregisterOnVisibilityChange(),this.jsvMediaView&&(this.jsvMediaView=null),this.jsvRelease()}jsvRelease(){this.jsvMedia&&(this.jsvMedia.pause(),this.jsvMedia.unload&&this.jsvMedia.unload(),this.jsvMedia.releaseResource&&(this.jsvMedia.releaseResource(),this.jsvMedia.onPlatformDestroy())),this.jsvEventListener=void 0}jsvAddMediaListener(e){}onJsViewHide(){this.jsvMedia&&(this.jsvMedia.paused||(this.stopByOnHide=!0),this.jsvMedia.unload())}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}onVisibilityChange(e){this.playBackground||("show"===e.status?this.onJsViewShow():"hide"===e.status&&this.onJsViewHide())}registerOnVisibilityChange(){window.JsView&&window.JsView.onVisibilityChange(this.onVisibilityChange)}unregisterOnVisibilityChange(){window.JsView&&window.JsView.removeEventCallback(this.onVisibilityChange)}setAttribute(e,t){"jsv_play_background"!==e?super.setAttribute(e,t):this.playBackground="true"===t}}O.HOOKS={Audio:Audio,Video:window._ExtVideo,OffscreenVideo:window._ExtOVP},O.PROP={SetOnly:["autoplay","loop","timeupdateless"],GetOnly:["duration","paused"],SetAndGet:["currentTime","muted","playbackRate","preload","volume"],Function:["load","pause","play","unload"]};for(let e in O.PROP){let t=O.PROP[e];for(let s of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.jsvMedia||this.jsvInit(),this.jsvMedia[s]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]}),"Function"===e&&(t=function(...e){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]?this.jsvMedia[s](...e):null}),t instanceof Function?O.prototype[s]=t:Object.defineProperty(O.prototype,s,t)}}class S extends O{constructor(e){super(e),this.jsvOverrideMedia=!1,console.log("AudioElement.constructor()",this)}jsvGetTagName(){return j.TAG.AUDIO}jsvInit(){this.jsvOverrideMedia||(this.jsvMedia=new O.HOOKS.Audio),super.jsvInit(),this.jsvOnLoaded()}jsvOnLoaded(){this.jsvMediaView=new e.LayoutView,this.jsvMainView.AddView(this.jsvMediaView)}jsvAddMediaListener(e){this.jsvMedia||this.jsvInit(),this.jsvMedia.addEventListener(e,(()=>{let t=new i(e);t.target=this,this.dispatchEvent(t)}))}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}setAttribute(e,t){super.setAttribute(e,t)}}class E{constructor(){this._PersistMap=new Map,this._PersistMax=300,this._PersistIdx=0,this._PersistTrackList=new Array(this._PersistMax),this._TempMap=new Map,this._TempMax=50,this._TempIdx=0,this._TempTrackList=new Array(this._TempMax)}getPersistPack(e){return this._PersistMap.get(e)}putPersistPack(e,t){E._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,e,t),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(e){return this._TempMap.get(e)}putTempPack(e,t){E._putPack(this._TempMap,this._TempTrackList,this._TempIdx,e,t),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(e,t,s,i,n){let r=t[s];r&&(e.delete(r),t[s]=i),e.set(i,n)}}let C=new E;class R extends j{constructor(){super(),this.jsvContentView=null,this.jsvRefedImgTex=null,this.jsvTextLatexEnable=!1,this.jsvEmoji=!1,this.jsvTextAlignMinWidth=NaN}jsvGetTagName(){return j.TAG.DIV}get textContent(){return this.jsvStore.textContent}set textContent(t){this.jsvStore.textContent=t,this.jsvStore.clientWidth=NaN,this.jsvContentView||(this.jsvContentView=new e.LayoutView,this.jsvMainView.AddView(this.jsvContentView)),this.parentElement&&this.jsvFlushViewForeground()}get clientWidth(){const e=this.style.width;if(e||0===e)return e;if(this.jsvStore.textContent){if(!isNaN(this.jsvStore.clientWidth))return this.jsvStore.clientWidth;const e={str:this.jsvStore.textContent,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};return this.jsvStore.clientWidth=s.GetTextWidth(e),this.jsvStore.clientWidth}return super.clientWidth}jsvOnLoadForgeView(){this.style.borderImage&&(this.jsvMaskView=new e.NinePatchView),super.jsvOnLoadForgeView()}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){s.UnrefImgTexSize(this.jsvRefedImgTex),this.jsvRefedImgTex=null}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e),this.jsvStore.textStylePack=null;let t=!!e[y.TYPE.FOREGROUND];e[y.TYPE.LAYOUT_SIZE]&&(t||this.jsvFlushViewForeground()),e[y.TYPE.FOREGROUND]&&this.jsvFlushViewForeground(),e[y.TYPE.BORDER]&&this.jsvFlushViewBorder()}jsvFlushViewForeground(){if(this.jsvContentView&&(this.jsvContentView.ClearViews(),this.jsvStore.textContent)){let e=void 0===this.style.height||0==this.style.height,t=e?(e,t)=>{this.jsvStore.clientHeight=e.height}:null,s=this.jsvBuildTextView(t);e&&s.EnableAutoHeight(),this.jsvContentView.AddView(s)}}jsvBuildTextView(t){let i=this.jsvStore.textStylePack;if(null===i&&(i=this._jsvGetClassNameCache()),null===i){this.style.jsvCustomStyles.textLineAlign||(this.style.jsvCustomStyles.textLineAlign=this.style.lineHeight?"middle":"top"),this.style.jsvCustomStyles.textVerticalAlign||(this.style.jsvCustomStyles.textVerticalAlign="top");let t=R._jsvStyleToPackData(this.style),s=JSON.stringify(t),n=C.getTempPack(s);n||(n=e.sTextStyleCache.StyleToPack(t),C.putTempPack(s,n)),i=n}this.jsvStore.textStylePack=i;let n=this.style.lineHeight?parseInt(this.style.lineHeight):this.style.fontSize?1.3*this.style.fontSize:14,r=this.style.width;return void 0===r&&(r=this.clientWidth),this.jsvTextAlignMinWidth&&r<this.jsvTextAlignMinWidth&&(r=this.jsvTextAlignMinWidth),e.sTextUtils.BuildTextView(s.TextureManager,this.jsvStore.textContent,i,t,{width:r,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji)}_jsvGetClassNameCache(){if(null===this.style.jsvNamedClassArray)return null;if(y.JsvContainsTextMajor(this.style.jsvLockedProps))return null;let t="";for(let e of this.style.jsvNamedClassArray){let s=e.getAttach();0===s.hasTextMajorStyle&&(y.JsvContainsTextMajor(e.getStyles())?s.hasTextMajorStyle=2:s.hasTextMajorStyle=1),2===s.hasTextMajorStyle&&(t+=e.getName())}if(t.length>0){let s=C.getPersistPack(t);if(!s){let i=R._jsvStyleToPackData(this.style);s=e.sTextStyleCache.StyleToPack(i),C.putPersistPack(t,s)}return s}return null}static _jsvStyleToPackData(e){let t={textColor:e.color,font:e.fontFamily,italic:"italic"===e.fontStyle,bold:"bold"===e.fontWeight,hAlign:e.textAlign?e.textAlign:"left",vAlign:e.jsvCustomStyles.textLineAlign?e.jsvCustomStyles.textLineAlign:"middle",vAreaAlign:e.jsvCustomStyles.textVerticalAlign?e.jsvCustomStyles.textVerticalAlign:"top",textOverflow:e.textOverflow?e.textOverflow:"clip",wordWrap:"break-word"===e.wordWrap?"break_word":"normal"};"nowrap"===e.whiteSpace&&(t.wordWrap="none");let s=e.textShadow?e.textShadow.split(" "):void 0;s&&(t.shadow={shadowOffsetX:parseInt(s[0]),shadowOffsetY:parseInt(s[1]),shadowBlur:parseFloat(s[2]),shadowColor:s[3]});let i=e.WebkitTextStroke?e.WebkitTextStroke.split(" "):void 0;return i&&(t.stroke={strokeWidth:parseInt(i[0]),strokeColor:i[1]}),t}jsvFlushViewBorder(){if(this.jsvMaskView)if(this.style.clipPath)console.error("BorderImage is conflicting with ClipPath.");else if(this.style.borderImage){if(!(this.jsvMaskView instanceof e.NinePatchView))return void console.error("Error: style.borderImage NOT support dynamic adding");let t=v.ConvertPx(this.getAttribute("jsv-borderimage-width")),i=v.ConvertPx(this.getAttribute("jsv-borderimage-height"));if(s.UnrefImgTexSize(this.jsvRefedImgTex),!this.jsvRefedImgTex||this.jsvRefedImgTex.Source!==this.style.borderImage.source.href){let n=t&&i?{width:t,height:i}:null;if(!this.style.borderImage.source.href)return void this.jsvMaskView.ResetTexture(null);this.jsvRefedImgTex=s.TextureManager.GetImage2(this.style.borderImage.source.href,!1,n,e.ColorSpace.RGBA_8888)}t&&i&&(console.log("Custom cache image size with: "+t+"/"+i),s.SetImgTexSize(this.jsvRefedImgTex,{width:t,height:i}));const n=new e.ExternalTextureSetting(this.jsvRefedImgTex);this.jsvMaskView.ResetTexture(n),this.jsvMaskView.WaitTextureToResize(!0),s.RefImgTexSize(this.jsvRefedImgTex,function(e){if(!this.jsvMaskView)return void console.log("Found border view gone");let t=this.style.borderImageOutset?this.style.borderImageOutset:v.ConvertRect();this.jsvMaskView.SetPadding({start:t.left,width:e.width-t.left-t.right},{start:t.top,width:e.height-t.top-t.bottom});let s=this.style.borderImage.slice;this.jsvMaskView.SetRepeat([{start:s.left,width:e.width-s.left-s.right}],[{start:s.top,width:e.height-s.top-s.bottom}]),this.jsvMaskView.WaitTextureToResize(!1)}.bind(this))}}setAttribute(e,t){this.jsvTakeTextAttribute(e,t)||super.setAttribute(e,t)}jsvTakeTextAttribute(e,t){return"jsv_text_vertical_align"===e?(this.style.jsvCustomStyles.textVerticalAlign=t,!0):"jsv_text_latex_enable"===e?(this.jsvTextLatexEnable="true"===t,!0):"jsv_text_align_minwidth"===e?(this.jsvTextAlignMinWidth=parseInt(t),!0):"jsv_text_emoji"===e&&(this.jsvEmoji="true"===t,!0)}}class P{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new b(!1,t))}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){return this.RouterDelegate.ref.focusBeforeMount(e,t)}printFocusList(){for(let e in this.RouterDelegate.ref._ChildMap)console.log(`branchName[${e}] ${e===this.RouterDelegate.ref._FocusNodeName?"focused":""}`,this.RouterDelegate.ref._ChildMap[e])}printGlobalLastFocus(){console.log("FocusNode:"),console.log(A.sLastFocus)}}class b{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNodeName=null,this.NameSpace=t}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,s;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let s=0,i=this;for(;s<e.length-1;){let n=!1;for(let t in i._ChildMap){let r=i._ChildMap[t].RouterDelegate.ref;if(r!=i&&r.NameSpace==e[s]){i=r,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){e.indexOf(".")>=0?console.error("ERROR: FDiv name can not contains '.'"):this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t?console.error(`ERROR: FDiv router branch name duplicated:[${e}]`):(this._ChildMap[e]=t,this._FocusNodeName==e&&t.Focus())}remove(e,t){let s=this._ChildMap[e];s&&s==t&&delete this._ChildMap[e]}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let s=this._ChildMap[e];delete this._ChildMap[e],this.add(t,s),this._FocusNodeName==e&&(this._FocusNodeName=t)}focusBeforeMount(e,t){if(e.indexOf(".")>=0)return console.error("ERROR: not support name with namespace"),!1;let s=this._ChildMap[e];return this._FocusNodeName=e,!!s&&(s.Focus(!t),!0)}focus(e,t){let s=this.focusBeforeMount(e,t);return s||console.log("No found branch:"+e),s}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class A extends e.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState()}getHub(){return this.InterfaceHub||(this.InterfaceHub=new P(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(e){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=e.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(e){this.RouterDelegate=e,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=e)}routerAdd(e,t){t.RouterDelegate.ref||t._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new b(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}printFocusList(){this.RouterDelegate.ref?this.RouterDelegate.ref.printFocusList():console.error("Error: no router")}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}setOnKeyDown(e){this._OnKeyDown=e}setOnKeyUp(e){this._OnKeyUp=e}setOnFocus(e){this._OnFocus=e}setOnBlur(e){this._OnBlur=e}setDispatchKeyUp(e){this._DispatchKeyUp=e}setDispatchKeyDown(e){this._DispatchKeyDown=e}setDispatchKeyProxy(e,t){this._DKeyDownProxy=e,this._DKeyUpProxy=t}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return A.sLastFocus=this,this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),I()),e instanceof A)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,s)=>{e.routerAdd(s,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return A.sFocusMemos.push({obj:this,bcf:e}),void console.log("page base tree not build, cache focus");super.Focus(e)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){this._OnBlur&&this._OnBlur()}onUnMount(){let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}getName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),"__AppRoot__"==t[0])break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return"__AppRoot__"==t[0]?t[0]="":console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}printFocusNodeList(){this.getHub().printFocusList()}printGlobalLastFocus(){this.getHub().printGlobalLastFocus()}}A.sFocusMemos=[],A.sLastFocus=null,A.sRootPageNode=null;let I=()=>{let e=A.sFocusMemos.length;if(e>0){let t=A.sFocusMemos;A.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},M=1;class V extends j{constructor(){super(),this.FocusNodeRef=new A(""+M++),this.HubRef=void 0}jsvGetTagName(){return j.TAG.FDIV}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new P(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}jsvGetHub(){return this.HubRef}}class N{constructor(){this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){console.log("LinkElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){let e=!1,s=null;if(null!=this.href){var i=new t(this.href);console.log("Ignore to load link from url="+i.href),e=!0}else console.warn("Failed to load link, href is not exists."),s="NoSrc";this.jsvOnLoadResult(e,s)}jsvOnLoadResult(e,t){if(console.log("jsvOnLoadResult isSuccess:"+e+", errCode:"+t),e){if(this.onload){let e=new i("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class x{constructor(){this.src=null,this.onerror=null,this.onload=null,this.charset=null,this.timeout=120}setAttribute(e,t){console.log("ScriptElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new t(this.src);console.log("load script with url="+e.href);var s=this;window.JsView.runJsWithUrl(e.href,!1,((e,t)=>{s.jsvOnLoadResult(e,t)}))}}jsvOnLoadResult(e,t){if(console.log("onLoadResult "+e+" "+t),e){if(this.onload){let e=new i("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class L extends j{constructor(){super(),console.log("Document header construct")}appendChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headAppendChild(e):super.appendChild(e),(e instanceof N||e instanceof x)&&e.jsvLoadResource()}removeChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headRemoveChild(e):super.removeChild(e)}}class D extends i{constructor(e){super("load")}}class _ extends j{constructor(t){super(t),this.jsvImageView=new e.LayoutView(null,"img"),this.jsvMainView.AddView(this.jsvImageView),this._ImageInLoading=!1,this.jsvColorSpace=e.ColorSpace.RGBA_8888,this.jsvScaleDownTex=null,this._HasUserOnLoad=!1,this._OnLoadSeq=1}jsvGetTagName(){return j.TAG.IMAGE}setAttribute(e,t){this.jsvTakeTextureAttribute(e,t)?console.assert(!this._ImageInLoading,`set ${e} after src`):(super.setAttribute(e,t),e===j.ATTRIBUTE.SRC&&(this._ImageInLoading=!0,this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,this.jsvDrawImage()))}jsvSetElementProp(e){this.jsvImageView.SetElementProp(e,s.RootActivity)}jsvCallbackOnUnloadForgeView(){return()=>{if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this)}}}jsvFlushEventHandlers(){if(super.jsvFlushEventHandlers(),this.eventHandlers.onLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&(this._HasUserOnLoad=!0,e.EnableBackgroundLoad(this))}else if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this),this._HasUserOnLoad=!1}}jsvTakeTextureAttribute(e,t){return"jsv_img_color_space"==e||"jsvImgColorSpace"==e||"jsv-img-color-space"==e?(this.jsvColorSpace=t,!0):("jsv_img_scaledown_tex"==e||"jsvImgScaledownTex"==e||"jsv-img-scaledown-tex"==e)&&(""!==t&&void 0!==t||(t="true"),this.jsvScaleDownTex=t,!0)}jsvFlushViewLayout(){this._ImageInLoading?(this.jsvImageView.WaitTextureToResize(!0),this.jsvImageView.ResetLayoutParams({x:0,y:0,width:this.style.width,height:this.style.height})):this.jsvImageView.WaitTextureToResize(!1),super.jsvFlushViewLayout()}jsvFlushViewBackground(){this.jsvDrawImage();this.getAttribute(j.ATTRIBUTE.SRC)}jsvOnLoaded(e){if(console.log("ImageElement.jsvOnLoaded() imageSize="+JSON.stringify(e)),this._ImageInLoading=!1,this.jsvStore.textureWidth=e.width,this.jsvStore.textureHeight=e.height,this.style.jsvLazySyncCache.setCacheProperty(y.TYPE.LAYOUT_SIZE,!0),this._HasUserOnLoad){let e=new D;e.target=this,document.dispatchEvent(e)}}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",y.ObjectFit.FILL),super.jsvOnLoadForgeView()}jsvApplyObjectFit(e){return j.applyObjectFitCommon(this,e,this.jsvImageView)}jsvDrawImage(){if(!this.src)return;let e=null;"true"===this.jsvScaleDownTex&&(this.style&&this.style.width?e={width:this.style.width,height:0}:console.error("set jsvScaleDownTex while style.width is not set")),this._OnLoadSeq++;let t=this._OnLoadSeq;s.SetBackgroundImage(this.jsvImageView,this.src,this.style.borderRadius,(e=>{t===this._OnLoadSeq&&this.jsvOnLoaded(e)}),e,this.jsvColorSpace)}}class F extends j{constructor(t){super(),this.jsvMainView=new e.JsvElementView(t)}get textContent(){return this.jsvMainView.textContent}set textContent(e){this.jsvMainView.textContent=e}setAttribute(e,t){super.setAttribute(e,t),this.jsvMainView.setAttribute(e,t)}removeAttribute(e){super.removeAttribute(e),this.jsvMainView.removeAttribute(e)}getAttribute(e){return this.jsvMainView.getAttribute(e)}hasAttribute(e){return this.jsvMainView.hasAttribute(e)}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e)}}class k{constructor(e){let t=e.indexOf(k.KeyFramesFlag)+k.KeyFramesFlag.length,s=e.indexOf("{"),i=e.substring(t,s);this.name=i.trim(),this.cssText=e}}k.KeyFramesFlag="@keyframes";class U{constructor(e){this.jsvCssRules=null,this.jsvTextContent=e}get cssRules(){if(this.jsvCssRules)return this.jsvCssRules;this.jsvCssRules=new Array;if(this.jsvTextContent.indexOf(k.KeyFramesFlag)<0)return this.jsvCssRules;var e=this.jsvTextContent.split(k.KeyFramesFlag);for(let t in e)0!=t&&this.insertRule(k.KeyFramesFlag+e[t]);return this.jsvCssRules}insertRule(e,t){if(void 0===t&&(t=this.jsvCssRules.length),e.indexOf(k.KeyFramesFlag)<0)throw Error("StyleSheet.insertRule() Rule is not supported except keyframes.");let s=new k(e);this.jsvCssRules.splice(t,0,s)}deleteRule(e){this.jsvCssRules.splice(e,1)}}class G extends j{constructor(e){super(e),this.textContent=null}jsvGetTagName(){return j.TAG.STYLE}appendChild(e){super.appendChild(e);let t=new U(e.textContent);document.jsvAppendStyleSheet(t)}removeChild(e){throw super.removeChild(e),Error("Failed to removeChild, unimplement!.")}}class H extends j{}class B extends O{constructor(e){super(e),console.log("VideoElement.constructor()",this),this._EventCache=[],this._UseTexture=!1,this._StartTime=0}jsvGetTagName(){return j.TAG.VIDEO}setAttribute(e,t){("jsv-media-usetexture"!==e||"true"!==t&&!0!==t&&""!==t)&&("jsv_media_usetexture"!==e||"true"!==t)?super.setAttribute(e,t):this._UseTexture=!0}removeAttribute(e){if("jsv-media-usetexture"===e||"jsv_media_usetexture"===e)return this._UseTexture=!1,void console.log("removeAttribute jsv_media_usetexture");super.removeAttribute(e)}jsvFlushViewLayout(){super.jsvFlushViewLayout();let e=this.style.JsvVideoRotation;isNaN(e)&&(e=0),this.style.objectFit!=y.ObjectFit.CONTAIN&&this.style.objectFit!=y.ObjectFit.FILL&&(console.error("Video rotation is not valid on objectFit="+this.objectFit),e=0),this.jsvMedia&&this.jsvMedia.setRotation(e,this.style.width,this.style.height,this.style.objectFit==y.ObjectFit.FILL)}jsvAddMediaListener(e){this.jsvMedia?this.jsvMedia.addEventListener(e,(()=>{let t=new i(e);t.target=this,this.dispatchEvent(t)})):this._EventCache.push(e)}jsvFlushVideoView(){this.jsvMediaView&&(this.jsvStore.textureWidth=this.jsvMedia.videoWidth,this.jsvStore.textureHeight=this.jsvMedia.videoHeight,this.style.jsvLazySyncCache.setCacheProperty(y.TYPE.LAYOUT_SIZE,!0))}jsvApplyObjectFit(e){return j.applyObjectFitCommon(this,e,this.jsvMediaView)}jsvInit(){console.log("VideoElement jsvInit"),this._UseTexture?this.jsvMedia=new O.HOOKS.OffscreenVideo:this.jsvMedia=new O.HOOKS.Video,this._EventCache.length>0&&(this._EventCache.map((e=>{this.jsvAddMediaListener(e)})),this._EventCache=[]),this.addEventListener("load",this.jsvOnLoaded.bind(this)),super.jsvInit()}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}jsvOnLoaded(){if(!this.jsvMediaView){let t;if(this._UseTexture){this.jsvMediaView=new e.LayoutView;let i,n=s.TextureManager.GetOffScreenMediaTexture(this.jsvMedia),r=this.style.borderRadius;r&&(i=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight)),t=new e.TextureSetting(n,i)}else{this.jsvMediaView=new e.VideoView(this.jsvMedia);let i=s.TextureManager.GetColorTexture("rgba(0,0,0,0)");t=new e.TextureSetting(i,null,null,!1)}this.jsvMainView.AddView(this.jsvMediaView),this.jsvMediaView.ResetTexture(t)}this.jsvFlushVideoView()}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",y.ObjectFit.CONTAIN),super.jsvOnLoadForgeView()}onJsViewHide(){this._StartTime=this.jsvMedia.currentTime,super.onJsViewHide(),this.jsvMedia.setState("autoPlay",!1,"boolean")}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.jsvMedia.startTime=Math.max(this._StartTime-1,0),this._StartTime=0,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}}B.PROP={SetOnly:[],GetOnly:["videoHeight","videoWidth"],SetAndGet:["height","poster","width"]};for(let e in B.PROP){let t=B.PROP[e];for(let s of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.media[s]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.media[s]}),B.prototype[s]=t}}B.EVENTS=["oncanplay","oncanplaythrough","ondurationchange","onended","onerror","onload","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onseeking","onseeked","onstalled","ontimeupdate"];class K extends u{constructor(e){super(u.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class W extends u{constructor(e){super(u.COMMENT_NODE),this.textContent=e}}let J={};class z{constructor(e,t,s){this._Element=s,J.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),J[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;if(this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView){let e=window.JsView.ForgeExt;t.attachToActivity(e.RootActivity,e.RootView)}else window.addEventListener("keydown",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())}))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),I()}}class Y extends S{constructor(e){super(e),console.log("AudioElement.constructor()",this)}jsvGetTagName(){return j.TAG.AUDIOTRACK}jsvInit(){this.jsvMedia=new O.HOOKS.Audio("AudioTrack"),this.jsvOverrideMedia=!0,super.jsvInit()}}class X extends u{constructor(){console.log("Document.constructor()"),super(u.DOCUMENT_NODE),this.location=window.location,this.rootElement=new R,this.rootElement.ownerDocument=this,this.rootElement.id="root",this.activeElement=this.rootElement,this.head=new L,this.cookie="",this.styleSheets=new Array,this.jsvIsReady=!1}createElement(e){switch(e){case X.FDIV_ELEMENT:return new V;case X.DIV_ELEMENT:return new R;case X.IMG_ELEMENT:case X.FIMG_ELEMENT:return new _;case X.STYLE_ELEMENT:return new G;case X.AUDIO_ELEMENT:return new S;case X.AUDIOTRACK_ELEMENT:return new Y;case X.VIDEO_ELEMENT:return new B;case X.LINK_ELEMENT:return window.JsView?new N:window.originDocument.createElement(X.LINK_ELEMENT);case X.SCRIPT_ELEMENT:return window.JsView?new x:window.originDocument.createElement(X.SCRIPT_ELEMENT);case X.ANCHOR_ELEMENT:return new T;case X.SVG_ELEMENT:return new SVGElement;default:return 0!==e.indexOf("jsv")||window.JsView?(console.warn("Document.createElement() unknown name="+e),new H(e)):new F(e)}}createTextNode(e){return new K(e)}createEvent(e){return new i(e)}createComment(e){return new W(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw Error("Document.getElementById() id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if("head"===e.toLowerCase())return window.JsView?[this.head]:window.originDocument.getElementsByTagName(e);if("link"===e.toLowerCase()||"script"===e.toLowerCase()||"style"===e.toLowerCase())return[];throw Error("Document.getElementsByTagName() name="+e+" is UNIMPLEMENTED.")}querySelector(e){if("root"===e||"#app"===e)return this.rootElement;if("head"===e)return this.head;if("base"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw Error("Document.querySelector() selectors="+e+" is UNIMPLEMENTED.")}jsvAppendStyleSheet(e){document.styleSheets.push(e)}jsvGetKeyFrames(e,t){if(window.JsvCode.Dom.StyleSheets){const s=window.JsvCode.Dom.StyleSheets;for(const i of t){const t=s[`${e}-${i.replace("data-v-","")}`];if(t)return t}const i=s[e];if(i)return i}for(let t of this.styleSheets)for(let s of t.cssRules)if(s.name==e)return s.cssText;let s="@keyframes ",i=s+e;for(let e of this.styleSheets){let t=e.jsvTextContent,n=t.indexOf(i);if(n<0)continue;let r=t.indexOf("-keyframes",n+1),o=t.indexOf(s,n+1);o<0&&(o=t.length),r>0&&r<o&&(o=r);let a=t.substring(n,o);return e.insertRule(a,0),a}return null}jsvUpdateRootElement(e){console.log("Document.jsvUpdateRootElement() this.jsvIsReady = true"),this.rootElement.jsvMainView=e,this.jsvIsReady=!0}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new z(e,t,s)}jsvGetFDivRoot(e){return function(e){return J[e]}(e)}}X.ANCHOR_ELEMENT="a",X.AUDIO_ELEMENT="audio",X.DIV_ELEMENT="div",X.IMG_ELEMENT="img",X.LINK_ELEMENT="link",X.SCRIPT_ELEMENT="script",X.STYLE_ELEMENT="style",X.SVG_ELEMENT="svg",X.VIDEO_ELEMENT="video",X.FIMG_ELEMENT="fimg",X.FDIV_ELEMENT="fdiv",X.AUDIOTRACK_ELEMENT="audiotrack";class $ extends j{jsvGetTagName(){return j.TAG.LINK}}if(window.JsvCode={Dom:{StyleSheets:{}}},window.Audio=S,window.Video=B,window.MutationObserver=class{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof u))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const e of Object.keys(t))"childList"==e||console.warn("JsView: only childList config is supported! ignore "+e);t.childList&&e.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}},window.JsView){console.log("Declare Dom Proxy."),global.SVGElement=$,global.Element=j;let e=new t(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.addEventListener=function(e,t){},window.document=new X,window.history={},window.navigator={userAgent:"jsview-runtime"},window.HTMLIFrameElement=function(){}}h.I("Using JsView Runtime");export{X as Document,s as ForgeExtension,L as HeadElement,l as JsViewForgeApp,o as JsvLazySyncCache,h as Log,r as gSyncTimesCounter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o={};window.JsView&&(window.JsView.Dom&&window.JsView.Dom.Extension||(window.JsView.Dom.Extension=o),o=window.JsView.Dom.Extension);var w=o;void 0===window.Forge&&(window.Forge={});var i=window.Forge;export{i as Forge,w as ForgeExtension};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jsview-dom",
|
|
3
|
+
"version": "1.0.313",
|
|
4
|
+
"description": "JsView DOM wrapper library used to get jsview support",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "Donglin.lu <donglin.lu@qcast.cn>",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"gifuct-js": "2.1.1"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./browser-root-style.css"
|
|
2
2
|
|
|
3
3
|
// Release entry
|
|
4
|
-
export * from "
|
|
4
|
+
export * from "./bin/jsview-browser-debug-dom.min"
|
|
5
5
|
|
|
6
6
|
// Debug entry
|
|
7
7
|
// TODO: 进行编译(yarn build)时,需要关闭掉此require
|
|
8
|
-
// export * from "
|
|
8
|
+
// export * from "../deps/jsview-dom/src/dom-browser-hook"
|
package/dom/jsv-dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Release entry
|
|
2
|
-
export * from "
|
|
2
|
+
export * from "./bin/jsview-dom.min"
|
|
3
3
|
|
|
4
4
|
// Debug entry
|
|
5
5
|
// TODO: 进行编译(yarn build)时,需要关闭掉此require
|
|
6
|
-
// export * from "
|
|
6
|
+
// export * from "../deps/jsview-dom/src/dom-wrapper"
|
package/dom/jsv-forge-define.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Release entry
|
|
2
|
-
export * from "
|
|
2
|
+
export * from "./bin/jsview-forge-define.min"
|
|
3
3
|
|
|
4
4
|
// Debug entry
|
|
5
5
|
// TODO: 进行编译(yarn build)时,需要关闭掉此require
|
|
6
|
-
// export * from "
|
|
6
|
+
// export * from "../deps/jsview-dom/src/forge"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shijiu/jsview-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.00",
|
|
4
4
|
"bin": {
|
|
5
5
|
"jsview-post-build": "./scripts/post-build.js",
|
|
6
6
|
"jsview-post-install": "./scripts/post-install.js",
|
|
7
7
|
"jsview-install-local-packages": "./scripts/install-local-packages.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
+
"deploy": "node ./scripts/update-version.js && npm publish --access=public --registry https://registry.npmjs.com",
|
|
11
|
+
"prepack": "node ./scripts/update-version.js && node ./scripts/pre-pack.js"
|
|
10
12
|
},
|
|
11
13
|
"repository": "system/jsview-vue",
|
|
12
14
|
"bugs": "http://gitlab.qcast.cn/system/jsview-vue/issues",
|
|
13
15
|
"keywords": [
|
|
14
16
|
"jsview",
|
|
15
|
-
"
|
|
17
|
+
"vue3",
|
|
16
18
|
"jsview-vue",
|
|
17
19
|
"jsview-dom",
|
|
18
20
|
"jsview-utils",
|
|
@@ -24,4 +26,4 @@
|
|
|
24
26
|
"engines": {
|
|
25
27
|
"node": ">=14.0.0"
|
|
26
28
|
}
|
|
27
|
-
}
|
|
29
|
+
}
|
|
File without changes
|
|
@@ -13,7 +13,7 @@ module.exports = (api, projectOptions) => {
|
|
|
13
13
|
if (!projectOptions.pages) {
|
|
14
14
|
config.entry('main.jsv') // QCode Modified
|
|
15
15
|
.clear()
|
|
16
|
-
.add('./jsview/
|
|
16
|
+
.add('./node_modules/@shijiu/jsview-vue/loader/jsview-main.js') // QCode Modified
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
config.resolve
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,7 +25,7 @@ module.exports = (api, options) => {
|
|
|
25
25
|
.context(api.service.context)
|
|
26
26
|
// QCode Modified >>>>>
|
|
27
27
|
.entry('main.jsv')
|
|
28
|
-
.add('
|
|
28
|
+
.add(api.resolve('node_modules/@shijiu/jsview-vue/loader/jsview-main.js'))
|
|
29
29
|
// QCode Modified <<<<<
|
|
30
30
|
.end()
|
|
31
31
|
.output
|
|
@@ -44,7 +44,7 @@ module.exports = (api, options) => {
|
|
|
44
44
|
.end()
|
|
45
45
|
.alias
|
|
46
46
|
.set('@', api.resolve('src'))
|
|
47
|
-
.set('jsview', api.resolve('jsview')) // QCode Added
|
|
47
|
+
.set('jsview', api.resolve('node_modules/@shijiu/jsview-vue')) // QCode Added
|
|
48
48
|
|
|
49
49
|
webpackConfig.resolveLoader
|
|
50
50
|
.modules
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
function updateVersion(projectDir, ignoreChanges)
|
|
8
|
+
{
|
|
9
|
+
let cmdLine = 'cd ' + projectDir + ' && git rev-list --count HEAD';
|
|
10
|
+
let patchVersion = execSync(cmdLine, { stderr: "inherit" });
|
|
11
|
+
patchVersion = parseInt(patchVersion);
|
|
12
|
+
|
|
13
|
+
pkgPkgFile = path.resolve(projectDir, 'package.json');
|
|
14
|
+
if (!fs.existsSync(pkgPkgFile)) {
|
|
15
|
+
console.error('Error: Failed to install jsview patches, "' + path.relative(projectDir, pkgPkgFile) + '" is not exists.');
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
pkgPkgObj = require(pkgPkgFile);
|
|
19
|
+
if (pkgPkgObj.version.endsWith("." + patchVersion)) {
|
|
20
|
+
console.info('\nFound version: ' + pkgPkgObj.version);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!ignoreChanges) {
|
|
25
|
+
let cmdLine = 'cd ' + projectDir + ' && git status --porcelain';
|
|
26
|
+
let gitChanges = execSync(cmdLine, { stderr: "inherit" });
|
|
27
|
+
if (gitChanges) {
|
|
28
|
+
return gitChanges;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 替换PatchVersion为git 提交数。
|
|
33
|
+
pkgPkgObj.version = pkgPkgObj.version.replace(/\.[0-9]*$/, '.' + patchVersion);
|
|
34
|
+
|
|
35
|
+
fs.writeFileSync(pkgPkgFile, JSON.stringify(pkgPkgObj, null, 2));
|
|
36
|
+
console.info('\nUpdated version to ' + pkgPkgObj.version);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function cpSync(workDir, src, dest) {
|
|
40
|
+
const exists = fs.existsSync(src);
|
|
41
|
+
const stats = exists && fs.statSync(src);
|
|
42
|
+
const isDirectory = exists && stats.isDirectory();
|
|
43
|
+
if (isDirectory) {
|
|
44
|
+
if (fs.existsSync(dest) == false) {
|
|
45
|
+
fs.mkdirSync(dest);
|
|
46
|
+
}
|
|
47
|
+
fs.readdirSync(src).forEach(function(childItemName) {
|
|
48
|
+
cpSync(
|
|
49
|
+
workDir,
|
|
50
|
+
path.join(src, childItemName),
|
|
51
|
+
path.join(dest, childItemName)
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
console.info(
|
|
56
|
+
" " + path.relative(workDir, src) + " -> " + path.relative(workDir, dest)
|
|
57
|
+
);
|
|
58
|
+
fs.copyFileSync(src, dest);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function rmSync(path) {
|
|
63
|
+
if (!!fs.rmSync) {
|
|
64
|
+
fs.rmSync(path, { recursive: true, force: true });
|
|
65
|
+
} else {
|
|
66
|
+
deleteFolderRecursive(path)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function deleteFolderRecursive(path) {
|
|
71
|
+
var files = [];
|
|
72
|
+
if (fs.existsSync(path)) {
|
|
73
|
+
files = fs.readdirSync(path);
|
|
74
|
+
files.forEach(function(file, index) {
|
|
75
|
+
var curPath = path + "/" + file;
|
|
76
|
+
if (fs.lstatSync(curPath).isDirectory()) {
|
|
77
|
+
// recurse
|
|
78
|
+
deleteFolderRecursive(curPath);
|
|
79
|
+
} else {
|
|
80
|
+
// delete file
|
|
81
|
+
fs.unlinkSync(curPath);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
fs.rmdirSync(path);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = {
|
|
89
|
+
updateVersion,
|
|
90
|
+
cpSync,
|
|
91
|
+
rmSync
|
|
92
|
+
}
|
|
@@ -3,55 +3,7 @@
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const { execSync } = require('child_process');
|
|
6
|
-
|
|
7
|
-
function cpSync(workDir, src, dest) {
|
|
8
|
-
const exists = fs.existsSync(src);
|
|
9
|
-
const stats = exists && fs.statSync(src);
|
|
10
|
-
const isDirectory = exists && stats.isDirectory();
|
|
11
|
-
if (isDirectory) {
|
|
12
|
-
if (fs.existsSync(dest) == false) {
|
|
13
|
-
fs.mkdirSync(dest);
|
|
14
|
-
}
|
|
15
|
-
fs.readdirSync(src).forEach(function(childItemName) {
|
|
16
|
-
cpSync(
|
|
17
|
-
workDir,
|
|
18
|
-
path.join(src, childItemName),
|
|
19
|
-
path.join(dest, childItemName)
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
console.info(
|
|
24
|
-
" " + path.relative(workDir, src) + " -> " + path.relative(workDir, dest)
|
|
25
|
-
);
|
|
26
|
-
fs.copyFileSync(src, dest);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function rmSync(path) {
|
|
31
|
-
if (!!fs.rmSync) {
|
|
32
|
-
fs.rmSync(path, { recursive: true, force: true });
|
|
33
|
-
} else {
|
|
34
|
-
deleteFolderRecursive(path)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function deleteFolderRecursive(path) {
|
|
39
|
-
var files = [];
|
|
40
|
-
if (fs.existsSync(path)) {
|
|
41
|
-
files = fs.readdirSync(path);
|
|
42
|
-
files.forEach(function(file, index) {
|
|
43
|
-
var curPath = path + "/" + file;
|
|
44
|
-
if (fs.lstatSync(curPath).isDirectory()) {
|
|
45
|
-
// recurse
|
|
46
|
-
deleteFolderRecursive(curPath);
|
|
47
|
-
} else {
|
|
48
|
-
// delete file
|
|
49
|
-
fs.unlinkSync(curPath);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
fs.rmdirSync(path);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
6
|
+
const { cpSync, rmSync } = require('./common');
|
|
55
7
|
|
|
56
8
|
function installPackages(options) {
|
|
57
9
|
// react/vue3共同的dom
|
package/scripts/post-build.js
CHANGED
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
const crypto = require('crypto');
|
|
4
4
|
const fs = require('fs');
|
|
5
|
-
const md5 = require('md5.js');
|
|
6
5
|
const path = require('path');
|
|
7
6
|
|
|
8
7
|
// main.js处理AppData信息
|
|
9
8
|
function prepareMainAppData(options, fileMd5)
|
|
10
9
|
{
|
|
11
|
-
|
|
12
10
|
// 加载私钥文件
|
|
13
|
-
const
|
|
14
|
-
const privateKeyFile = path.resolve(options.rootDir, privateKeyPath);
|
|
11
|
+
const privateKeyFile = path.resolve(options.appConfigDir, 'app_sign_private_key.crt');
|
|
15
12
|
if (!fs.existsSync(privateKeyFile)) {
|
|
16
|
-
console.error('Failed to open private key file from ' +
|
|
13
|
+
console.error('Failed to open private key file from ' + privateKeyFile);
|
|
17
14
|
process.exit(1);
|
|
18
15
|
}
|
|
19
16
|
const privateKeyText = fs.readFileSync(privateKeyFile);
|
|
@@ -23,10 +20,9 @@ function prepareMainAppData(options, fileMd5)
|
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
// 加载公钥文件
|
|
26
|
-
const
|
|
27
|
-
const publicKeyFile = path.resolve(options.rootDir, publicKeyPath);
|
|
23
|
+
const publicKeyFile = path.resolve(options.appConfigDir, 'app_sign_public_key.pem');
|
|
28
24
|
if (!fs.existsSync(publicKeyFile)) {
|
|
29
|
-
console.error('Failed to open public key file from ' +
|
|
25
|
+
console.error('Failed to open public key file from ' + publicKeyFile);
|
|
30
26
|
process.exit(1);
|
|
31
27
|
}
|
|
32
28
|
const publicKeyText = fs.readFileSync(publicKeyFile);
|
|
@@ -66,10 +62,9 @@ function prepareMainAppData(options, fileMd5)
|
|
|
66
62
|
}
|
|
67
63
|
|
|
68
64
|
// 获取AppData信息
|
|
69
|
-
const
|
|
70
|
-
const appConfigFile = path.resolve(options.rootDir, appConfigPath);
|
|
65
|
+
const appConfigFile = path.resolve(options.appConfigDir, 'app_config.json');
|
|
71
66
|
if (!fs.existsSync(appConfigFile)) {
|
|
72
|
-
console.error('Failed to open app config file from ' +
|
|
67
|
+
console.error('Failed to open app config file from ' + appConfigFile);
|
|
73
68
|
process.exit(1);
|
|
74
69
|
}
|
|
75
70
|
const appConfigText = fs.readFileSync(appConfigFile);
|
|
@@ -94,10 +89,10 @@ function signApp(options)
|
|
|
94
89
|
}
|
|
95
90
|
|
|
96
91
|
const jsFile = path.resolve(jsDir, file);
|
|
97
|
-
console.log('Updating ' + path.relative(options.
|
|
92
|
+
console.log('Updating ' + path.relative(options.projectDir, jsFile));
|
|
98
93
|
|
|
99
94
|
var jsvAppContents = fs.readFileSync(jsFile);
|
|
100
|
-
const jsvAppMd5 =
|
|
95
|
+
const jsvAppMd5 = crypto.createHash('md5').update(jsvAppContents).digest('hex');
|
|
101
96
|
let appDataInfo = '';
|
|
102
97
|
if (jsFile.indexOf('main.jsv.') > 0) {
|
|
103
98
|
// 对main文件加入应用头信息
|
|
@@ -114,13 +109,13 @@ function signApp(options)
|
|
|
114
109
|
}
|
|
115
110
|
|
|
116
111
|
function main() {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
const options = {};
|
|
113
|
+
options.projectDir = process.cwd();
|
|
114
|
+
options.modulesDir = path.resolve(options.projectDir, "node_modules");
|
|
115
|
+
options.jsviewDir = path.resolve(options.modulesDir, "@shijiu/jsview-vue");
|
|
116
|
+
options.patchesDir = path.resolve(options.jsviewDir, "patches");
|
|
117
|
+
options.distDir = path.resolve(options.projectDir, "dist");
|
|
118
|
+
options.appConfigDir = path.resolve(options.projectDir, "src/appConfig");
|
|
124
119
|
|
|
125
120
|
console.info('Signing JsView App...');
|
|
126
121
|
console.info();
|