@carats/csr 0.0.15 → 0.0.17
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 +4 -4
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ declare global {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
declare function
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
declare function clientRender(): Promise<void>;
|
|
15
|
+
declare function goTo(url: string): void;
|
|
16
|
+
declare function mount(facets: Facets): void;
|
|
17
17
|
|
|
18
|
-
export {
|
|
18
|
+
export { clientRender, goTo, mount };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{clearHydrations as
|
|
1
|
+
import{clearHydrations as c}from"@carats/hooks";import{getPageComponent as p,renderPage as u}from"@carats/render";import{init as f,transpile as g}from"jjsx";window.ssp||(window.ssp={for:void 0,data:null});var r={};async function a(){let{suspense:e}=r;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"));let t=location.pathname+location.search,s=setTimeout(()=>document.getElementById("loading-indicator")?.classList.remove("hide"),250);await c();try{let{component:n}=p.call(r,location.href),o=n.defaultProps;if(n.burnished&&window.ssp.for!==t){let d=`/culet${t}`;o=await fetch(d).then(l=>l.json()),window.ssp.data=o,window.ssp.for=t}else o=window.ssp.data;let i=await u.call(r,n,o);document.getElementById("app").innerHTML=i}catch(n){document.getElementById("app").innerHTML=g(e.error(n))}finally{clearTimeout(s),window.dispatchEvent(new Event("load")),document.getElementById("loading-indicator")?.classList.add("hide")}}function y(e){if(new URL(e,location.origin).origin!==location.origin){window.location.href=e;return}history.pushState(null,"",e),a()}function L(e){f(),r=e;let{inAppRouting:t=!0}=e;t&&(window.addEventListener("load",()=>{document.querySelectorAll("a").forEach(n=>{n._isHandled||new URL(n.href,location.origin).origin!==location.origin||n.download||(n.addEventListener("click",i=>{i.preventDefault(),history.pushState(null,"",n.href),a()}),n._isHandled=!0)})}),window.addEventListener("popstate",a))}export{a as clientRender,y as goTo,L as mount};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carats/csr",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
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.7",
|
|
11
11
|
"@carats/url": "^0.0.1"
|
|
12
12
|
},
|
|
13
13
|
"description": "CSR module for Carats",
|