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