@shijiu/jsview 1.9.878 → 1.9.882

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.
@@ -1 +1 @@
1
- /* eslint-disable */ 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,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if((!0===e.startsWith("./")||!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)+"/"}let t=window.JsView.Dom.__MainPath;e=e.startsWith("./")?t+e.substring(2):t+e}if(this.href=e,!t)return;let s=this.href,n=s.indexOf("#");n>0&&(this.hash=s.substring(n),s=s.substring(0,n));let r=s.indexOf("?");r>1&&(this.search=s.substring(r),s=s.substring(0,r));let o=s,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let u=a>1?o.substring(a+3):"";if(a=u.indexOf("/"),this.host=a>0?u.substring(0,a):"",this.pathname=a>1?u.substring(a):"",this.origin=a>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let e=this.host.indexOf("]");this.hostname=this.host.substring(0,e+1),e=this.host.substring(e+1).indexOf(":"),this.port=e>1?this.host.substring(e+1):""}else{let e=this.host.indexOf(":");this.hostname=e>0?this.host.substring(0,e):this.host,this.port=e>1?this.host.substring(e+1):""}}replace(e){this.href=e}}window.JsView&&window.JsView.registerUriConverter?.((e=>new t(e,!1).href));class i{static SetBackgroundColor(t,s,n){const r=i.TextureManager.GetColorTextureCached(s);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.ExternalTextureSetting(r,o);t.ResetTexture(a)}static SetBackgroundImage(s,n,r,o,a,u,h){let l,d={};if("string"==typeof n){const e=new t(n);if(e instanceof t==!1)throw Error("Bad Argument.",e);d.url=e.href}else"linear-gradient"==n?.type&&(d.gradient=n);if(d.gradient)if(d.gradient.colors?.length>2){const e=d.gradient.colors,t=[e[0],e[e.length-1]],s=e.slice(1,e.length-1);l=i.TextureManager.CreateLinearGradientTexture(t,s)}else 2==d.gradient.colors?.length?l=i.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(l=d.url.includes(".gif")||d.url.includes(".webp")?i.TextureManager.GetGifImage(d.url,!1,null,h):i.TextureManager.GetImage2(d.url,!1,a,u||e.ColorSpace.RGBA_8888));if(l){let t;r&&(t=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const i=new e.ExternalTextureSetting(l,t);if(s.ResetTexture(i),o){let e=l.RegisterLoadImageCallback(null,(function(){o({width:l.Width,height:l.Height})}));s.RegisterDetachCallback((()=>{l.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(s,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=i.TextureManager.GetImage2(n.href,!1,null,o||e.ColorSpace.RGBA_8888);if(a){const t=i.TextureManager.GetImage2(r.href,!1,null,e.ColorSpace.RGBA_8888),n=new e.ExternalTextureSetting(a,new e.ViewTextureMask(t));s.ResetTexture(n)}}static SetVideoTexture(t,s,n){const r=i.TextureManager.GetColorTexture(s);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 s={size:t,refNum:0};i.TextureInfo.Cache[e.Source]=s}static RefImgTexSize(e,t){let s=i.TextureInfo.Cache[e.Source];s?(s.refNum>0?s.refNum++:s.refNum=1,t(s.size)):e.RegisterLoadImageCallback(null,(function(){const s={width:e.Width,height:e.Height};t(s);let n=i.TextureInfo.Cache[e.Source];if(n)n.refNum>0?n.refNum++:n.refNum=1;else{let t={size:s,refNum:1};i.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=i.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&i.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of i.TextureInfo.Unused){let t=i.TextureInfo.Cache[e];t.refNum<-2?(delete i.TextureInfo.Cache[e],i.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:i.TextureInfo.Unused.delete(e)}}static TextureInfo={Cache:{},Unused:new Set};static TextureManager=null;static RootView=null;static RootActivity=null;static HaltKeyEvent=!1}window.JsView?(window.JsView.ForgeExtension||(window.JsView.ForgeExtension=i),i=window.JsView.ForgeExtension):i={};var s=i;export{e as Forge,s as ForgeExtension};
1
+ /* eslint-disable */ 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,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if((!0===e.startsWith("./")||!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)+"/"}let t=window.JsView.Dom.__MainPath;e=e.startsWith("./")?t+e.substring(2):t+e}if(this.href=e,!t)return;let n=this.href,r=n.indexOf("#");r>0&&(this.hash=n.substring(r),n=n.substring(0,r));let s=n.indexOf("?");s>1&&(this.search=n.substring(s),n=n.substring(0,s));let o=n,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let u=a>1?o.substring(a+3):"";if(a=u.indexOf("/"),this.host=a>0?u.substring(0,a):"",this.pathname=a>1?u.substring(a):"",this.origin=a>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let e=this.host.indexOf("]");this.hostname=this.host.substring(0,e+1),e=this.host.substring(e+1).indexOf(":"),this.port=e>1?this.host.substring(e+1):""}else{let e=this.host.indexOf(":");this.hostname=e>0?this.host.substring(0,e):this.host,this.port=e>1?this.host.substring(e+1):""}}replace(e){this.href=e}}window.JsView&&window.JsView.registerUriConverter?.((e=>new t(e,!1).href));class i{static SetBackgroundColor(t,n,r){const s=i.TextureManager.GetColorTextureCached(n);let o;r&&(o=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const a=new e.ExternalTextureSetting(s,o);t.ResetTexture(a)}static SetBackgroundImage(n,r,s,o,a,u,h){let l,d={};if("string"==typeof r){const e=new t(r);if(e instanceof t==!1)throw Error("Bad Argument.",e);d.url=e.href}else"linear-gradient"==r?.type&&(d.gradient=r);if(d.gradient)if(d.gradient.colors?.length>2){const e=d.gradient.colors,t=[e[0],e[e.length-1]],n=e.slice(1,e.length-1);l=i.TextureManager.CreateLinearGradientTexture(t,n)}else 2==d.gradient.colors?.length?l=i.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(l=d.url.includes(".gif")||d.url.includes(".webp")?i.TextureManager.GetGifImage(d.url,!1,null,h):i.TextureManager.GetImage2(d.url,!1,a,u||e.ColorSpace.RGBA_8888));if(l){let t;s&&(t=new e.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const i=new e.ExternalTextureSetting(l,t);if(n.ResetTexture(i),o){let e=l.RegisterLoadImageCallback(null,(function(){o({width:l.Width,height:l.Height})}));n.RegisterDetachCallback((()=>{l.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(n,r,s,o){if("string"==typeof r&&(r=new t(r)),r instanceof t==!1)throw Error("Bad Argument.",r);if("string"==typeof s&&(s=new t(s)),s instanceof t==!1)throw Error("Bad Argument(MaskURL).",s);const a=i.TextureManager.GetImage2(r.href,!1,null,o||e.ColorSpace.RGBA_8888);if(a){const t=i.TextureManager.GetImage2(s.href,!1,null,e.ColorSpace.RGBA_8888),r=new e.ExternalTextureSetting(a,new e.ViewTextureMask(t));n.ResetTexture(r)}}static SetVideoTexture(t,n,r){const s=i.TextureManager.GetColorTexture(n);let o;r&&(o=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const a=new e.TextureSetting(s,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 n={size:t,refNum:0};i.TextureInfo.Cache[e.Source]=n}static RefImgTexSize(e,t){let n=i.TextureInfo.Cache[e.Source];n?(n.refNum>0?n.refNum++:n.refNum=1,t(n.size)):e.RegisterLoadImageCallback(null,(function(){const n={width:e.Width,height:e.Height};t(n);let r=i.TextureInfo.Cache[e.Source];if(r)r.refNum>0?r.refNum++:r.refNum=1;else{let t={size:n,refNum:1};i.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=i.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&i.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of i.TextureInfo.Unused){let t=i.TextureInfo.Cache[e];t.refNum<-2?(delete i.TextureInfo.Cache[e],i.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:i.TextureInfo.Unused.delete(e)}}}i.TextureInfo={Cache:{},Unused:new Set},i.TextureManager=null,i.RootView=null,i.RootActivity=null,i.HaltKeyEvent=!1,window.JsView&&(window.JsView.ForgeExtension||(window.JsView.ForgeExtension=i),i=window.JsView.ForgeExtension);var n=i;export{e as Forge,n as ForgeExtension};
@@ -0,0 +1,15 @@
1
+
2
+ const JsvCodeDebug = {
3
+ // true: Debug entry
4
+ // false: Release entry
5
+ // TODO: 进行编译(yarn build)时,需要设置为fasle。
6
+ enableDebug: true,
7
+ // enableDebug: false,
8
+
9
+ domBrowserPath: './code/src/dom-browser-hook',
10
+ domNativePath: './code/src/dom-wrapper',
11
+ engineBrowserPath: './code/src/engine-js/browser',
12
+ forgeDefinePath: './code/src/engine-js',
13
+ };
14
+
15
+ export default JsvCodeDebug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "1.9.878",
3
+ "version": "1.9.882",
4
4
  "bin": {
5
5
  "jsview-post-build": "./tools/jsview-post-build.js",
6
6
  "jsview-post-install": "./tools/jsview-post-install.js"