@carats/csr 0.0.5 → 0.0.6

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/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare global {
6
6
  }
7
7
  }
8
8
  declare function BuildCarats(config: CaratsRenderContext): {
9
- clientRender: (url: string) => Promise<void>;
9
+ clientRender: () => Promise<void>;
10
10
  };
11
11
 
12
12
  export { BuildCarats as default };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{renderPage as s}from"@carats/core";import{clearHydrations as c}from"@carats/hooks";import{transpile as m}from"jjsx";function u(a){let{suspense:e,inAppRouting:d=!0}=a;e.loading=e.loading??(()=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Loading...")),e.error=e.error??(n=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Error: ",n.message)),e.notFound=e.notFound??(()=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Not Found"));async function i(n){let t=setTimeout(()=>document.getElementById("loading-indicator")?.classList.remove("hide"),250);await c();try{let r=await s.call(a,n,async o=>await fetch(o).then(l=>l.json()));document.getElementById("app").innerHTML=r}catch(r){document.getElementById("app").innerHTML=m(e.error(r))}finally{clearTimeout(t),history.pushState(null,"",n),window.dispatchEvent(new Event("load")),document.getElementById("loading-indicator")?.classList.add("hide")}}return d&&window.addEventListener("load",()=>{document.querySelectorAll("a").forEach(t=>{t._isHandled||(t.addEventListener("click",r=>{let o=new URL(t.href);o.origin!==location.origin||t.download||(r.preventDefault(),i(o.pathname+o.search))}),t._isHandled=!0)})}),{clientRender:i}}export{u as default};
1
+ import{renderPage as s}from"@carats/core";import{clearHydrations as c}from"@carats/hooks";import{transpile as u,init as m}from"jjsx";m();function g(o){let{suspense:e,inAppRouting:d=!0}=o;e.loading=e.loading??(()=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Loading...")),e.error=e.error??(n=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Error: ",n.message)),e.notFound=e.notFound??(()=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Not Found"));async function a(){let n=location.pathname+location.search,t=setTimeout(()=>document.getElementById("loading-indicator")?.classList.remove("hide"),250);await c();try{let r=await s.call(o,n,async i=>await fetch(i).then(l=>l.json()));document.getElementById("app").innerHTML=r}catch(r){document.getElementById("app").innerHTML=u(e.error(r))}finally{clearTimeout(t),history.pushState(null,"",n),window.dispatchEvent(new Event("load")),document.getElementById("loading-indicator")?.classList.add("hide")}}return d&&window.addEventListener("load",()=>{document.querySelectorAll("a").forEach(t=>{t._isHandled||(t.addEventListener("click",r=>{new URL(t.href).origin!==location.origin||t.download||(r.preventDefault(),a())}),t._isHandled=!0)})}),{clientRender:a}}export{g as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carats/csr",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "main": "dist/index.js",
5
5
  "dependencies": {
6
6
  "jjsx": "^3.3.0"