This commit is contained in:
rizrmd 2024-05-22 10:58:12 +07:00
parent 665d143718
commit a651e053c6
5 changed files with 11 additions and 7 deletions

View File

@ -78,7 +78,7 @@ export const _ = {
"content-encoding": "gzip",
},
});
} catch (e) { }
} catch (e) {}
}
return new Response("{}", {
headers: { "content-type": "application/json" },
@ -120,7 +120,7 @@ export const _ = {
await new Promise<void>((resolve) => {
const ival = setInterval(async () => {
file = Bun.file(build_path);
const exists = await file.exists()
const exists = await file.exists();
if (exists) {
clearInterval(ival);
resolve();

View File

@ -132,7 +132,7 @@ ${d}
}
`:"inset-0 overflow-auto",css`
contain: content;
`),children:(0,on.jsx)(Ay,{api_url:I.site.api_url,entry:Object.values(I.page.root.childs).filter(c=>c).map(c=>c.id),meta:I.page.meta,mode:I.mode,page_id:I.page.id,site_id:I.site.id,db:I.site.db,api:I.site.api,comp_load:async c=>{let d=I.comp;if(d.list[c])return d.list[c];try{let f=await(await fetch(I.url`_prasi/comp`,{method:"POST",body:JSON.stringify({ids:[c]})})).json();for(let[p,g]of Object.entries(f))delete d.pending[p],d.list[p]=g,await Ls(`comp-${p}`,g)}catch{}return d.list[c]},layout:I.layout.id&&I.layout.root&&I.layout.meta?{id:I.layout.id,meta:I.layout.meta,entry:Object.values(I.layout.root.childs).filter(c=>c).map(c=>c.id)}:void 0,script:{init_local_effect:I.init_local_effect},on_preload:async({urls:c,opt:d})=>{let f=[],p={};if(I.cache.urls)for(let g of c)I.cache.urls.has(g)||(f.push(g),I.cache.urls.add(g));if(f.length>0){let g=await zy(f);if(d?.on_load&&d.on_load(g,AC),Array.isArray(g))for(let _ of g){let w={id:_.id,url:_.url,root:_.root,meta:{}};await li(_.root.childs),Ca(w.meta,_.root),I.page.cache[w.id]=w}}}})})})})},AC=(e,t)=>{for(let n of e)for(let r of n.root.childs)Fd(r,t)},Fd=(e,t)=>{if(t(e),e.type!=="text"){if(e.type==="item"&&e.component?.props)for(let n of Object.values(e.component.props))n.content&&Fd(n.content,t);for(let n of e.childs)Fd(n,t)}};var E1=P(G());(async()=>{Ly();let e=document.getElementById("root");if(e){let t=(0,S1.createRoot)(e);await G0(!1),B0(),se.navigateOverride=n=>(n&&n.startsWith("/")&&Ud()&&location.pathname.startsWith("/prod")&&!n.startsWith("/prod")&&(n=`/prod/${location.pathname.split("/")[2]}${n}`),n),t.render((0,E1.jsx)(k1,{})),document.body.classList.contains("opacity-0")&&document.body.classList.remove("opacity-0")}})();
`),children:(0,on.jsx)(Ay,{api_url:I.site.api_url,entry:Object.values(I.page.root.childs).filter(c=>c).map(c=>c.id),meta:I.page.meta,mode:I.mode,page_id:I.page.id,site_id:I.site.id,db:I.site.db,api:I.site.api,comp_load:async c=>{let d=I.comp;if(d.list[c])return d.list[c];try{let f=await(await fetch(I.url`_prasi/comp`,{method:"POST",body:JSON.stringify({ids:[c]})})).json();for(let[p,g]of Object.entries(f))delete d.pending[p],d.list[p]=g,await Ls(`comp-${p}`,g)}catch{}return d.list[c]},layout:I.layout.id&&I.layout.root&&I.layout.meta?{id:I.layout.id,meta:I.layout.meta,entry:Object.values(I.layout.root.childs).filter(c=>c).map(c=>c.id)}:void 0,script:{init_local_effect:I.init_local_effect},on_preload:async({urls:c,opt:d})=>{let f=[],p={};if(I.cache.urls)for(let g of c)I.cache.urls.has(g)||(f.push(g),I.cache.urls.add(g));if(f.length>0){let g=await zy(f);if(d?.on_load&&d.on_load(g,AC),Array.isArray(g))for(let _ of g){let w={id:_.id,url:_.url,root:_.root,meta:{}};await li(_.root.childs),Ca(w.meta,_.root),I.page.cache[w.id]=w}}}})})})})},AC=(e,t)=>{for(let n of e)for(let r of n.root.childs)Fd(r,t)},Fd=(e,t)=>{if(t(e),e.type!=="text"){if(e.type==="item"&&e.component?.props)for(let n of Object.values(e.component.props))n.content&&Fd(n.content,t);for(let n of e.childs)Fd(n,t)}};var E1=P(G());(async()=>{Ly();let e=document.getElementById("root");if(e){await G0(!1);let t={root:(0,S1.createRoot)(e)};B0(),se.navigateOverride=n=>(n&&n.startsWith("/")&&Ud()&&location.pathname.startsWith("/prod")&&!n.startsWith("/prod")&&(n=`/prod/${location.pathname.split("/")[2]}${n}`),n),t.root.render((0,E1.jsx)(k1,{})),document.body.classList.contains("opacity-0")&&document.body.classList.remove("opacity-0")}})();
/*! Bundled license information:
react/cjs/react.production.min.js:

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,19 @@
import { createRoot } from "react-dom/client";
import { Root as ReactRoot, createRoot } from "react-dom/client";
import { defineReact, defineWindow } from "web-utils";
import { Root, isPreview } from "./root";
import { initBaseConfig } from "./base/base";
import { w } from "./w";
import { sworkerRegister } from "../../sworker-boot";
(async () => {
initBaseConfig();
const div = document.getElementById("root");
if (div) {
const root = createRoot(div);
await defineWindow(false);
let react = {
root: createRoot(div),
};
defineReact();
w.navigateOverride = (_href: string) => {
@ -27,7 +31,7 @@ import { w } from "./w";
return _href;
};
root.render(<Root />);
react.root.render(<Root />);
if (document.body.classList.contains("opacity-0")) {
document.body.classList.remove("opacity-0");
}