@carats/csr 0.0.9 → 0.0.11
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 +3 -3
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Facets } from '@carats/render';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
interface HTMLAnchorElement {
|
|
@@ -11,8 +11,8 @@ declare global {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
declare function BuildCarats(
|
|
14
|
+
declare function BuildCarats(facets: Facets): Promise<{
|
|
15
15
|
clientRender: () => Promise<void>;
|
|
16
|
-
}
|
|
16
|
+
}>;
|
|
17
17
|
|
|
18
18
|
export { BuildCarats as default };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{clearHydrations as u}from"@carats/hooks";import{getPageComponent as f,renderPage as w}from"@carats/render";import{matchRoute as g}from"@carats/url";import{init as h,transpile as E}from"jjsx";window.ssp||(window.ssp={for:void 0,data:null});async function y(r){h();let l=await fetch("/.carats/hallmarks").then(o=>o.json()),{suspense:t,inAppRouting:c=!0}=r;t.loading=t.loading??(()=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Loading...")),t.error=t.error??(o=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Error: ",o.message)),t.notFound=t.notFound??(()=>JJSX.jsxFactory(JJSX.fragmentFactory,null,"\u{1F48E} Not Found"));async function s(){let o=location.pathname+location.search,e=setTimeout(()=>document.getElementById("loading-indicator")?.classList.remove("hide"),250);await u();try{let{component:n,params:d}=f.call(r,location.pathname),a=window.ssp.data;if(window.ssp.for!==n.name&&(a=n.defaultProps||{url:o,params:d},l.some(i=>g(i,location.pathname)))){let i=`/api${o}`;a=await fetch(i).then(p=>p.json()),window.ssp.data=a,window.ssp.for=n.name}let m=await w.call(r,n,a);document.getElementById("app").innerHTML=m}catch(n){document.getElementById("app").innerHTML=E(t.error(n))}finally{clearTimeout(e),window.dispatchEvent(new Event("load")),document.getElementById("loading-indicator")?.classList.add("hide")}}return c&&window.addEventListener("load",()=>{document.querySelectorAll("a").forEach(e=>{e._isHandled||(e.addEventListener("click",n=>{history.pushState(null,"",e.href),!(new URL(e.href).origin!==location.origin||e.download)&&(n.preventDefault(),s())}),e._isHandled=!0)})}),{clientRender:s}}export{y as default};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carats/csr",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"jjsx": "^3.3.0"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"@carats/hooks": "^0.0.2",
|
|
10
|
-
"@carats/render": "^0.0.
|
|
10
|
+
"@carats/render": "^0.0.4",
|
|
11
11
|
"@carats/url": "^0.0.1"
|
|
12
12
|
},
|
|
13
13
|
"description": "CSR module for Carats",
|