@blocklet/pages-kit-inner-components 0.4.125 → 0.4.126
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/lib/cjs/chunks/{home-DMWxIeUw.js → home-q1dzT-BZ.js} +4 -4
- package/lib/cjs/chunks/{publish-button-B_2z7mDz.js → publish-button-CpLC1-Bd.js} +1 -1
- package/lib/cjs/chunks/{site-state-DMexEilp.js → site-state-C5t-5c6U.js} +3 -3
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +7 -7
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/chunks/{home-DIJ8xaUb.js → home-CSX7cAwr.js} +49 -49
- package/lib/es/chunks/{publish-button-LDqfGwdd.js → publish-button-B2tZwJP0.js} +1 -1
- package/lib/es/chunks/{site-state-BHfXVFkY.js → site-state-BLNi12iP.js} +3 -6
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +1 -1
- package/lib/es/project-html.js +160 -99
- package/lib/es/resources.js +1 -1
- package/lib/es/site-state.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),_=require("./state-oc52fQ0j.js"),F=require("@arcblock/ux/lib/Locale/context"),ce=require("@arcblock/ux/lib/Result"),le=require("@blocklet/pages-kit/builtin/page/header"),ue=require("@blocklet/pages-kit/contexts/color"),K=require("@blocklet/pages-kit/utils/data-source"),de=require("@blocklet/ui-react/lib/Header"),Q=require("@emotion/css"),L=require("@emotion/react"),fe=require("@emotion/styled"),S=require("@mui/material"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),_=require("./state-oc52fQ0j.js"),F=require("@arcblock/ux/lib/Locale/context"),ce=require("@arcblock/ux/lib/Result"),le=require("@blocklet/pages-kit/builtin/page/header"),ue=require("@blocklet/pages-kit/contexts/color"),K=require("@blocklet/pages-kit/utils/data-source"),de=require("@blocklet/ui-react/lib/Header"),Q=require("@emotion/css"),L=require("@emotion/react"),fe=require("@emotion/styled"),S=require("@mui/material"),V=require("ahooks"),ge=require("isomorphic-dompurify"),pe=require("lodash/cloneDeep"),me=require("lodash/isEmpty"),he=require("lodash/isEqual"),p=require("react"),xe=require("react-helmet"),w=require("react-router-dom"),X=require("react-use"),D=require("ufo"),q=require("./array-DOclwySd.js"),$=require("@arcblock/ux/lib/Theme"),je=require("@blocklet/ui-react/lib/Footer"),be=require("webfontloader"),ye=require("@arcblock/did-connect/lib/Session"),P=e=>e&&e.__esModule?e:{default:e},Y=P(ce),ve=P(de),Z=P(fe),we=P(ge),O=P(pe),Se=P(me),ee=P(he),Pe=P(je),ke=P(be),Re=$.styled(Pe.default,{shouldForwardProp:e=>!!e})`
|
|
2
2
|
& > div > .MuiContainer-root {
|
|
3
3
|
max-width: unset;
|
|
4
4
|
}
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
font-family: ${JSON.stringify(n??r)}, ${U};
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`})}const{SessionProvider:Ue,SessionContext:Be,SessionConsumer:Ve,withSession:$e}=ye.createAuthServiceSessionContext();function
|
|
29
|
+
`})}const{SessionProvider:Ue,SessionContext:Be,SessionConsumer:Ve,withSession:$e}=ye.createAuthServiceSessionContext();function z(){return p.useContext(Be)}function Ie(...e){var o;const{session:n}=z();return e.includes((o=n.user)==null?void 0:o.role)}function Te(...e){var r;const{session:n}=z(),o=Ie(...e);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!n.user:o}function De(){const[e]=w.useSearchParams(),{session:n}=z(),o=Te("owner","admin","pagesEditor","member"),r=p.useMemo(()=>{const s=e.get("mode");return q.STATE_MODES.includes(s)?s:"production"},[e]),a=r==="production"?r:n.user?o?r:"production":null;return a?t.jsx(ne,{mode:a}):null}function ne({mode:e}){if(e!=="draft"){const n=window.__PAGE_STATE__;return n?t.jsx(A,{mode:e,state:n}):t.jsx(Ne,{mode:e,children:({state:o})=>t.jsx(A,{mode:e,state:o})})}return t.jsx(He,{children:({state:n})=>t.jsx(A,{mode:e,state:n})})}const He=p.lazy(()=>Promise.resolve().then(()=>require("./draft-data-CRdesc3Z.js")));function Ne({mode:e,children:n}){const o=document.querySelector('meta[property="pages:version"]'),r=o==null?void 0:o.content,a=_.useProjectId(),s=p.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const c=localStorage.getItem(_.getProjectPageVersionKey(a??""));return Number(c)?Number(c):new Date().getTime()}return Number(r)},[r]),{loading:l,value:i}=X.useAsync(()=>q.getPages({mode:e,version:s}),[e,s]);return l?t.jsx(te,{}):i?n({state:i}):null}function A({mode:e,state:n}){const{t:o,locale:r}=F.useLocaleContext(),[a]=w.useSearchParams(),s=a.get("hiddenBadge")==="true",l=a.get("showPublish")==="true",{pageIds:i,pages:c,routeIds:m,routes:g,supportedLocales:d,config:{defaultLocale:x},resources:j}=n,b=_.getAllComponents(n),y=p.useMemo(()=>d!=null&&d.some(f=>f.locale===r)?r:void 0,[r,d]),h=Object.values(c).find(f=>(f==null?void 0:f.slug)==="/")?void 0:Object.values(c)[0],N=p.useMemo(()=>i.map(f=>{const u=c[f];return u&&{id:u.id,path:D.joinURL("/",y||"",u.slug,e!=="production"?`?mode=${e}`:"")}}).filter(q.nonNullable),[i,c,y,e]),k=([...f])=>(e!=="production"&&l&&f.unshift(t.jsx(p.Suspense,{fallback:t.jsx("div",{}),children:t.jsx(Le,{mode:"production",state:n})})),f);return t.jsxs(q.Provider,{value:{pages:N},children:[t.jsxs(w.Routes,{children:[h&&t.jsx(w.Route,{index:!0,element:t.jsx(w.Navigate,{to:D.joinURL("/",y||"",h.slug)})}),m==null?void 0:m.map(f=>{var M,E,B,I;const u=g==null?void 0:g[f];if(!u||!u.displayTemplateId)return null;const C=c[u.displayTemplateId];return C?t.jsx(w.Route,{path:D.joinURL(":projectIdOrSlug?",u.path),element:t.jsx(oe,{mode:e,components:b,page:C,locale:y,defaultLocale:x,headerAddons:k,state:n,pageData:(I=(B=(E=(M=u.dataSource)==null?void 0:M.pathDataMappings)==null?void 0:E[u.id])==null?void 0:B.dataCache)==null?void 0:I[y||x||"en"]})},u.id):null}),i.map(f=>{const u=c[f];return u?t.jsx(w.Route,{path:D.joinURL(":projectIdOrSlug?",u.slug),element:t.jsx(H,{mode:e,components:b,page:u,locale:y,defaultLocale:x,headerAddons:k})},u.id):null}),j.pages&&Object.values(j.pages).map(({blockletId:f,page:u})=>t.jsx(w.Route,{path:D.joinURL("/",`@${f}`,u.slug),element:t.jsx(H,{mode:e,components:b,page:u,locale:y,defaultLocale:x,headerAddons:k})},u.id)),t.jsx(w.Route,{path:"*",element:t.jsx(S.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(Y.default,{status:404,extra:t.jsx(ae,{href:"/",children:o("common.back")})})})})]}),e!=="production"&&!s&&t.jsx(qe,{sx:{bgcolor:"info.light"},children:e}),t.jsx(Ee,{})]})}function oe({mode:e,pageData:n,components:o,page:r,locale:a,defaultLocale:s,headerAddons:l,state:i}){const c=V.useReactive({page:null});p.useEffect(()=>{const g=r||null;g?c.page=O.default(g):c.page=null},[r,c]);const m=p.useRef();return p.useEffect(()=>{ee.default(n,m.current)||n&&c.page&&(K.setPageDataSource(c.page,i,a,n),m.current=O.default(n))},[c.page,n,a,i]),c.page?t.jsx(H,{mode:e,components:o,page:c.page,locale:a,defaultLocale:s,headerAddons:l}):null}function Ae({mode:e,state:n,path:o,pageData:r}){const{t:a,locale:s}=F.useLocaleContext(),{pages:l,supportedLocales:i,config:{defaultLocale:c},resources:m}=n,g=Object.values(l).find(h=>(h==null?void 0:h.slug)===o),d=Object.values(m.pages||{}).find(h=>h.page.slug===o),x=p.useMemo(()=>i!=null&&i.some(h=>h.locale===s)?s:void 0,[s,i]),j=V.useReactive({page:null});p.useEffect(()=>{const h=g||(d==null?void 0:d.page)||null;h?j.page=O.default(h):j.page=null},[g,d]);const b=p.useRef();if(p.useEffect(()=>{ee.default(r,b.current)||r&&j.page&&(K.setPageDataSource(j.page,n,x,r),b.current=O.default(r))},[{}]),!g&&!(d!=null&&d.page))return t.jsx(S.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(Y.default,{style:{background:"inherit"},status:404,extra:t.jsx(ae,{href:"/",children:a("common.back")})})});const y=_.getAllComponents(n);return j.page?t.jsx(H,{mode:e,components:y,page:j.page,locale:x,defaultLocale:c}):null}function H({mode:e,components:n,page:o,locale:r,defaultLocale:a,headerAddons:s}){var N,k,f,u,C,M,E,B,I;const l=ue.useColorConvert(),i=((N=o.locales)==null?void 0:N[r])??((k=o.locales)==null?void 0:k[a])??{},c=i.title||((f=window.blocklet)==null?void 0:f.appName),m=i.description||((u=window.blocklet)==null?void 0:u.appDescription),g=_.autoResizeImage(_.getImageAbsoluteUrl(i.image),540),{logo:d,brand:x,description:j,...b}=le.useHeaderState(),y=p.useMemo(()=>R=>{var T;let v=(s==null?void 0:s(R))??R;return v=((T=b.addons)==null?void 0:T.call(b,v))??v,v},[b.addons,s]),h=(C=i.header)!=null&&C.translucent?re:se;return t.jsxs(q.PageProvider,{page:o,defaultLocale:a,currentLocale:r,children:[t.jsx(L.Global,{styles:L.css`
|
|
30
30
|
body {
|
|
31
31
|
background-color: ${l(!i.backgroundColor||i.backgroundColor==="transparent"?"background.default":i.backgroundColor)} !important;
|
|
32
32
|
}
|
|
33
|
-
`}),t.jsx(h,{hideNavMenu:!!((M=i.header)!=null&&M.hideNavMenus),translucentTextColor:(E=i.header)==null?void 0:E.translucentTextColor,...d?{logo:d}:{},...x?{brand:x}:{},...j?{description:j}:{},className:Q.cx(((B=i.header)==null?void 0:B.sticky)&&"sticky","page-header"),maxWidth:!1,addons:y}),t.jsx(w.ScrollRestoration,{}),t.jsxs(xe.Helmet,{children:[t.jsx("title",{children:c}),t.jsx("meta",{name:"og:title",content:c}),t.jsx("meta",{name:"og:description",content:m}),t.jsx("meta",{name:"og:image",content:g}),t.jsx("meta",{name:"twitter:image:src",content:g}),t.jsx("meta",{name:"twitter:image",content:g}),t.jsx("meta",{property:"twitter:description",content:m}),t.jsx("meta",{property:"twitter:title",content:c}),t.jsx("meta",{name:"description",content:m})]}),t.jsx(S.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:o.sectionIds.map(R=>{var
|
|
33
|
+
`}),t.jsx(h,{hideNavMenu:!!((M=i.header)!=null&&M.hideNavMenus),translucentTextColor:(E=i.header)==null?void 0:E.translucentTextColor,...d?{logo:d}:{},...x?{brand:x}:{},...j?{description:j}:{},className:Q.cx(((B=i.header)==null?void 0:B.sticky)&&"sticky","page-header"),maxWidth:!1,addons:y}),t.jsx(w.ScrollRestoration,{}),t.jsxs(xe.Helmet,{children:[t.jsx("title",{children:c}),t.jsx("meta",{name:"og:title",content:c}),t.jsx("meta",{name:"og:description",content:m}),t.jsx("meta",{name:"og:image",content:g}),t.jsx("meta",{name:"twitter:image:src",content:g}),t.jsx("meta",{name:"twitter:image",content:g}),t.jsx("meta",{property:"twitter:description",content:m}),t.jsx("meta",{property:"twitter:title",content:c}),t.jsx("meta",{name:"description",content:m})]}),t.jsx(S.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:o.sectionIds.map(R=>{var W,G;const v=o.sections[R];if(!v||v.visibility==="hidden")return null;const T=(W=v.locales)==null?void 0:W[r],ie=((G=v.locales)==null?void 0:G[a])??{};return t.jsx(q.BlockRenderer,{id:R,type:v.component,mode:e,section:v,config:{...Se.default(T)?ie:T,locale:r,dev:e==="draft"?{mode:e,components:n,defaultLocale:a}:{mode:e}}},R)})}),!((I=i.footer)!=null&&I.hidden)&&t.jsx(_e,{})]})}const Le=p.lazy(()=>Promise.resolve().then(()=>require("./publish-button-CpLC1-Bd.js"))),se=Z.default(ve.default)`
|
|
34
34
|
&.sticky {
|
|
35
35
|
position: sticky;
|
|
36
36
|
top: 0;
|
|
37
37
|
}
|
|
38
|
-
`;function Oe({logo:e}){const[n,o]=p.useState(),r=S.useMediaQuery(s=>s.breakpoints.down("sm")),{value:a}=
|
|
38
|
+
`;function Oe({logo:e}){const[n,o]=p.useState(),r=S.useMediaQuery(s=>s.breakpoints.down("sm")),{value:a}=X.useAsync(()=>{var i,c;const s=new URL(r?((i=window==null?void 0:window.blocklet)==null?void 0:i.appLogo)||"/.well-known/service/blocklet/logo":((c=window==null?void 0:window.blocklet)==null?void 0:c.appLogoRect)||"/.well-known/service/blocklet/logo-rect",window.location.origin);s.searchParams.delete("imageFilter"),s.searchParams.delete("f");const l=s.toString();return new Promise(m=>{fetch(l).then(g=>{const d=g.headers.get("content-type");d!=null&&d.includes("svg")&&g.text().then(x=>{o(x),m(null)}),m(g.url)})})},[r]);if(e)return e;if(n)return t.jsx(S.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:we.default.sanitize(n)}});if(a){const s=new URL(a);s.searchParams.set("imageFilter","convert"),s.searchParams.set("f","png"),s.searchParams.set("h","80");const l=s.toString();return t.jsx("img",{src:l,alt:"logo"})}return null}function re({logo:e,translucentTextColor:n,...o}){const{top:r=0}=V.useScroll(()=>document.getElementById("app"))||{};let a=Math.min(r/800,1),s="";if(a>.1){a=Math.max(a,.6);const l=Math.round(255*Math.min(1-a,.2));s=`rgb(${l}, ${l}, ${l})`}else s=n||"#EEEEEE";return t.jsx(se,{logo:t.jsx(Oe,{logo:e}),...o,className:Q.cx(a<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${a})`,"--logo-invert":a<=.7?1-a/6:1-a},sx:{backdropFilter:a>=.6?"blur(10px)":"blur(0px)",transition:"all 0.3s ease",position:"fixed !important",left:0,top:0,right:0,bgcolor:"transparent","&.reverse-color":{".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button":{color:`${s} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:s}}})}const ae=Z.default(S.Button)``;exports.Home=De;exports.HomeView=ne;exports.Loading=te;exports.PageRoutes=A;exports.PageView=H;exports.PageViewByPath=Ae;exports.PageViewWithDataSource=oe;exports.TranslucentHeader=re;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("./state-oc52fQ0j.js"),q=require("@arcblock/ux/lib/Locale/context"),W=require("@arcblock/ux/lib/Toast"),A=require("@mui/icons-material"),M=require("@mui/lab"),t=require("@mui/material"),R=require("immer"),_=require("lodash/difference"),c=require("react"),N=require("react-use"),F=require("./home-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("./state-oc52fQ0j.js"),q=require("@arcblock/ux/lib/Locale/context"),W=require("@arcblock/ux/lib/Toast"),A=require("@mui/icons-material"),M=require("@mui/lab"),t=require("@mui/material"),R=require("immer"),_=require("lodash/difference"),c=require("react"),N=require("react-use"),F=require("./home-q1dzT-BZ.js"),O=require("./array-DOclwySd.js"),z=s=>s&&s.__esModule?s:{default:s},I=z(W),D=z(_);function H(s){const[g,p]=c.useState(!1);return e.jsx(M.LoadingButton,{...s,loading:s.loading||g,onClick:a=>{var x;const m=(x=s.onClick)==null?void 0:x.call(s,a);m instanceof Promise&&(p(!0),m.finally(()=>{p(!1)}))}})}const J=t.createSvgIcon(e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M7.75732 16.2426L16.2426 7.75736",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M16.2426 16.2426L7.75732 7.75735",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Close");function V(){const[s,g]=c.useState(),p=c.useMemo(()=>s?e.jsx(t.Dialog,{...s}):null,[s]),a=c.useCallback(()=>{g(void 0)},[]),m=c.useCallback(({title:x,content:d,cancelText:L="Cancel",okText:f="Ok",onOk:h,onClose:j,okIcon:B,okColor:n="primary",cancelColor:r="primary",DialogContentProps:k,form:P,...b})=>{g({...b,open:!0,children:e.jsxs("form",{onSubmit:v=>v.preventDefault(),children:[x&&e.jsxs(t.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(t.Box,{children:x}),e.jsx(t.IconButton,{size:"small",onClick:async()=>{a(),j==null||j()},children:e.jsx(J,{})})]}),d&&e.jsx(t.DialogContent,{...k,sx:{mt:-3,...k==null?void 0:k.sx},children:e.jsx(t.Box,{pt:3,children:d})}),e.jsxs(t.DialogActions,{children:[e.jsx(t.Button,{variant:"outlined",color:r||"primary",onClick:j??a,children:L}),e.jsx(H,{variant:"contained",color:n||"primary",startIcon:B,loadingPosition:B?"start":"center",onClick:async()=>{await(h==null?void 0:h()),a()},type:"submit",children:f})]})]}),onClose:j??a})},[a]);return{dialog:p,showDialog:m,closeDialog:a}}const K=c.forwardRef(({mode:s,state:g},p)=>{const{t:a}=q.useLocaleContext(),[m,x]=c.useState(!1),{dialog:d,showDialog:L}=V(),f=C.useProjectId(),h=c.useCallback(B=>{let n=[];L({title:a("maker.publishToProduction"),content:e.jsxs(t.Box,{sx:{minWidth:300},children:[e.jsx(t.Alert,{color:"warning",icon:e.jsx(A.Warning,{}),children:a("maker.publishToProductionTip")}),e.jsx(t.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(U,{state:g,toMode:s,onChange:r=>n=r,defaultRouteIds:B})})]}),okText:a("maker.publish"),cancelText:a("common.cancel"),onOk:async()=>{if((n==null?void 0:n.length)===0){const r=a("maker.publishSelectPagesMessage");throw I.default.error(r),new Error(r)}localStorage.setItem(C.getProjectPageVersionKey(f??""),String(new Date().getTime())),x(!0);try{await O.publishPages({mode:s,routes:n}),I.default.success(a("maker.publishSuccessMessage"))}catch(r){throw I.default.error(r.message),r}finally{x(!1)}}})},[s,g,a,f,L]);c.useImperativeHandle(p,()=>({openPublishDialog:h}));const j=c.useCallback(()=>{h()},[h]);return e.jsxs(e.Fragment,{children:[e.jsx(M.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:j,loading:m,disabled:m,children:a("maker.publishToProduction")}),d]})});function U({state:s,toMode:g,onChange:p,defaultRouteIds:a}){const{t:m,locale:x}=q.useLocaleContext(),[d,L]=c.useState(!1),[f,h]=c.useState(()=>a?Object.fromEntries(a.map(i=>[i,!0])):{}),{loading:j,error:B,value:n}=N.useAsync(()=>O.getPages({mode:g}),[g]);if(B)throw B;const r=c.useMemo(()=>s.routeIds||[],[s]),k=c.useMemo(()=>(n==null?void 0:n.pageIds)||[],[n]),P=c.useMemo(()=>!r||!s.routes?[]:JSON.parse(JSON.stringify(r)).sort((u,y)=>{var w,T;const o=(w=s.routes)==null?void 0:w[u],l=(T=s.routes)==null?void 0:T[y];return o!=null&&o.publishedAt&&new Date(o.publishedAt).getTime()<new Date(o.updatedAt).getTime()?-1:l!=null&&l.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date((o==null?void 0:o.updatedAt)??"").getTime()-new Date((l==null?void 0:l.updatedAt)??"").getTime()}),[s,r]),b=c.useMemo(()=>!n||!k||!r?[]:D.default(k,r),[r,n,k]),v=c.useMemo(()=>r?[...r].concat(b):b,[r,b]),S=c.useCallback(i=>{h(u=>{const y=R.produce(u,o=>{d?(Object.assign(o,Object.fromEntries(v.map(l=>[l,!0]))),delete o[i]):o[i]?(delete o[i],b.includes(i)&&(r||[]).filter(l=>{var w,T;return((w=s.pages[l])==null?void 0:w.slug)===((T=n==null?void 0:n.pages[i])==null?void 0:T.slug)}).forEach(l=>{delete o[l]})):(o[i]=!0,r&&r.includes(i)&&b.filter(l=>{var w,T;return((w=n==null?void 0:n.pages[l])==null?void 0:w.slug)===((T=s.pages[i])==null?void 0:T.slug)}).forEach(l=>{o[l]=!0}))});return L(D.default(v,Object.keys(y)).length===0),y})},[d,v,b,s,n,r]),E=c.useCallback(()=>{L(i=>(i&&h({}),!i))},[]);return c.useEffect(()=>{p(d?null:Object.keys(f))},[d,f,p]),j?e.jsx(F.Loading,{sx:{my:4}}):e.jsxs(t.List,{disablePadding:!0,sx:{maxWidth:500},children:[e.jsx(t.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(t.ListItemButton,{onClick:E,dense:!0,children:[e.jsx(t.ListItemIcon,{children:e.jsx(t.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(t.ListItemText,{primary:m("common.all")})]})}),P.map(i=>{var l;const u=(l=s.routes)==null?void 0:l[i];if(!u)return null;const y=!1,o=!u.publishedAt||u.updatedAt&&new Date(u.updatedAt).getTime()>new Date(u.publishedAt).getTime();return e.jsx(t.ListItem,{disablePadding:!0,secondaryAction:e.jsxs(e.Fragment,{children:[o&&e.jsx(t.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(A.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!u.isPublic&&e.jsx(t.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(A.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),y]}),children:e.jsxs(t.ListItemButton,{onClick:()=>S(i),dense:!0,children:[e.jsx(t.ListItemIcon,{children:e.jsx(t.Checkbox,{edge:"start",checked:d||!!f[i],tabIndex:-1})}),e.jsx(t.ListItemText,{primary:u.path,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},i)}),b.map(i=>{var y,o;const u=n==null?void 0:n.pages[i];return u?e.jsx(t.ListItem,{disablePadding:!0,secondaryAction:e.jsx(t.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(t.ListItemButton,{onClick:()=>S(i),dense:!0,children:[e.jsx(t.ListItemIcon,{children:e.jsx(t.Checkbox,{edge:"start",checked:d||!!f[i],tabIndex:-1})}),e.jsx(t.ListItemText,{primary:u.slug,secondary:(o=(y=u.locales)==null?void 0:y[x])==null?void 0:o.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},i):null})]})}exports.default=K;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
`,n=`.CustomComponent_${s}`;return(await es.default([ts.default({content:[{raw:t,extension:"tsx"}]}),Xt.default({overrideBrowserslist:["> 1%","last 2 versions"],stats:{}}),r=>{r.walkRules(c=>{c.selectors=c.selectors.map(a=>a.replace(/\.(.+)/g,`${n}.$1,${n} .$1`))})}]).process(e)).css},gs=async(t,{componentId:s})=>{const e=await ms(t,{componentId:s});return`export const __PagesKit_CSS__ = ${JSON.stringify(e)};
|
|
4
4
|
|
|
5
5
|
${t}
|
|
6
|
-
`},Ye=W.memoize(async(t,s)=>{let e=L.default.transpileModule(t,{compilerOptions:{jsx:L.default.JsxEmit.React,target:L.default.ScriptTarget.ES2016,module:L.default.ModuleKind.ESNext},transformers:{before:[tt.createBuiltinModuleTransformer(L.default)]}}).outputText;if(s.tailwind&&(e=await gs(e,{componentId:s.componentId})),s.module===he.PreloadComponentScriptModule.ESM)return e;const n=L.default.transpileModule(e,{compilerOptions:{jsx:L.default.JsxEmit.React,target:L.default.ScriptTarget.ES2016,module:L.default.ModuleKind.CommonJS,moduleResolution:L.default.ModuleResolutionKind.Node16}}).outputText;return s.module===he.PreloadComponentScriptModule.CJS?n:ys(s.moduleName,n)},{keyGenerator:(t,s)=>{const e=Ie.createHash("md5").update(t).digest("hex"),n={...s,componentId:s.componentId,module:s.module,...s.module!==he.PreloadComponentScriptModule.ESM?{moduleName:s.moduleName}:{},tailwind:s.tailwind};return JSON.stringify(["transpileModule",e,n])},lruOptions:{max:100,ttl:1e3*60*60}}),hs=async(t,s)=>{var c,a;const n=(a=(c=(await Zt.build({entryPoints:["index.tsx"],external:Object.keys(At.BuiltinModules),format:"esm",target:"esnext",bundle:!0,write:!1,plugins:[{name:"vfs",setup(u){let l=null;u.onResolve({filter:/.*/},d=>d.path==="index.tsx"?{path:"index.tsx",namespace:"vfs"}:d.path==="./component"?{path:"component.tsx",namespace:"vfs"}:null),u.onLoad({filter:/.*/,namespace:"vfs"},async d=>{var h;if(d.path==="index.tsx")return{contents:`export { ${s} } from './component'`,loader:"tsx"};if(d.path==="component.tsx")return{contents:t,loader:"tsx"};if(tt.isRelativeModule(d.path)){const E=d.path.split("/").pop();if(l||(l=await Pe({ensureLoaded:!1})),(h=l==null?void 0:l.chunks)!=null&&h[E])try{const p=w.readFileSync(l.chunks[E],"utf-8");return A.info("get chunk from local file system",E),{contents:p,loader:"tsx"}}catch{}}return null})}}]})).outputFiles)==null?void 0:c[0])==null?void 0:a.contents;if(!n)throw new Error("Failed to build server code");const o=Buffer.from(n).toString();return L.default.transpileModule(o,{compilerOptions:{module:L.default.ModuleKind.ESNext,target:L.default.ScriptTarget.ES2020}}).outputText},ot=W.memoize(async(t,s)=>{const e=await hs(t,s);return new RegExp(`export\\s+\\{\\s+${s}\\s+\\}`,"m").test(e)?e:void 0},{keyGenerator:(t,s)=>{const e=Ie.createHash("md5").update(t).digest("hex");return JSON.stringify(["extractExportValueSchema",e,s])},lruOptions:{max:100,ttl:1e3*60*60}}),ys=(t,s)
|
|
7
|
-
var ${t} =
|
|
6
|
+
`},Ye=W.memoize(async(t,s)=>{let e=L.default.transpileModule(t,{compilerOptions:{jsx:L.default.JsxEmit.React,target:L.default.ScriptTarget.ES2016,module:L.default.ModuleKind.ESNext},transformers:{before:[tt.createBuiltinModuleTransformer(L.default)]}}).outputText;if(s.tailwind&&(e=await gs(e,{componentId:s.componentId})),s.module===he.PreloadComponentScriptModule.ESM)return e;const n=L.default.transpileModule(e,{compilerOptions:{jsx:L.default.JsxEmit.React,target:L.default.ScriptTarget.ES2016,module:L.default.ModuleKind.CommonJS,moduleResolution:L.default.ModuleResolutionKind.Node16}}).outputText;return s.module===he.PreloadComponentScriptModule.CJS?n:ys(s.moduleName,n)},{keyGenerator:(t,s)=>{const e=Ie.createHash("md5").update(t).digest("hex"),n={...s,componentId:s.componentId,module:s.module,...s.module!==he.PreloadComponentScriptModule.ESM?{moduleName:s.moduleName}:{},tailwind:s.tailwind};return JSON.stringify(["transpileModule",e,n])},lruOptions:{max:100,ttl:1e3*60*60}}),hs=async(t,s)=>{var c,a;const n=(a=(c=(await Zt.build({entryPoints:["index.tsx"],external:Object.keys(At.BuiltinModules),format:"esm",target:"esnext",bundle:!0,write:!1,plugins:[{name:"vfs",setup(u){let l=null;u.onResolve({filter:/.*/},d=>d.path==="index.tsx"?{path:"index.tsx",namespace:"vfs"}:d.path==="./component"?{path:"component.tsx",namespace:"vfs"}:null),u.onLoad({filter:/.*/,namespace:"vfs"},async d=>{var h;if(d.path==="index.tsx")return{contents:`export { ${s} } from './component'`,loader:"tsx"};if(d.path==="component.tsx")return{contents:t,loader:"tsx"};if(tt.isRelativeModule(d.path)){const E=d.path.split("/").pop();if(l||(l=await Pe({ensureLoaded:!1})),(h=l==null?void 0:l.chunks)!=null&&h[E])try{const p=w.readFileSync(l.chunks[E],"utf-8");return A.info("get chunk from local file system",E),{contents:p,loader:"tsx"}}catch{}}return null})}}]})).outputFiles)==null?void 0:c[0])==null?void 0:a.contents;if(!n)throw new Error("Failed to build server code");const o=Buffer.from(n).toString();return L.default.transpileModule(o,{compilerOptions:{module:L.default.ModuleKind.ESNext,target:L.default.ScriptTarget.ES2020}}).outputText},ot=W.memoize(async(t,s)=>{const e=await hs(t,s);return new RegExp(`export\\s+\\{\\s+${s}\\s+\\}`,"m").test(e)?e:void 0},{keyGenerator:(t,s)=>{const e=Ie.createHash("md5").update(t).digest("hex");return JSON.stringify(["extractExportValueSchema",e,s])},lruOptions:{max:100,ttl:1e3*60*60}}),ys=(t,s)=>`// GENERATED FILE. DO NOT EDIT.
|
|
7
|
+
var ${t} = function () {
|
|
8
8
|
|
|
9
9
|
const exports = {};
|
|
10
10
|
let moduleExports = null;
|
|
@@ -29,7 +29,7 @@ var ${t} = ${e?"async":""} function () {
|
|
|
29
29
|
|
|
30
30
|
return exports;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
`,oe=new Ue.LRUCache({max:100}),rt=60*60,Re=60;function at(t){A.info("clear preload components cache",{cacheKey:t}),oe.delete(t)}function it(t){for(const s of oe.keys())s.includes(t)&&(A.info("clear preload components cache",{cacheKey:s}),at(s))}function ct({mode:t,instanceId:s,componentId:e,locale:n}){return["getPreloadComponents",t,s,e,n].join("-")}async function Ss({mode:t,req:s,state:e,locale:n,instances:o,module:r}){const{supportedLocales:c,config:{defaultLocale:a}}=e;if(!a)return null;const u=(await Promise.all(o.map(async p=>{try{const i=ct({mode:t,instanceId:p.id,componentId:p.componentId,locale:n});if(t!=="draft"&&p.useCache&&oe.has(i))return A.info(`get preload component from cache: ${i}`),oe.get(i);const y=ie({state:e,componentId:p.componentId});if(!y)return null;const T=await lt({req:s,state:e,componentId:y.id,locale:n,defaultLocale:a,properties:p.properties});if(!T)return null;const $={instanceId:p.id,preload:T};if(t!=="draft"&&p.useCache){let k=rt;p.cacheDuration&&(k=p.cacheDuration),A.info(`set preload component to cache(${k}s): ${i}`),oe.set(i,$,{ttl:k*1e3})}return $}catch(i){return A.error("get preload component error",{instanceId:p.id,componentId:p.componentId},{error:i}),null}}))).filter(p=>!!p),l=Object.values(u.reduce((p,i)=>({...p,...i.preload.components}),{}));async function d(){const p=await Promise.all(l.map(async i=>{const y=ae.componentUMDName({componentId:i.component.id}),T=r===he.PreloadComponentScriptModule.ESM?{module:r,script:await Ye(i.script,{componentId:i.component.id,module:r,tailwind:t!=="draft"})}:{module:r,script:await Ye(i.script,{componentId:i.component.id,module:r,moduleName:y,tailwind:t!=="draft"}),moduleName:y};return[i.component.id,{component:i.component,script:T}]}));return Object.fromEntries(p)}const h=await d();return{config:{defaultLocale:a,supportedLocales:c},components:h,instances:u.map(p=>({id:p.instanceId,componentId:p.preload.component.id,locales:{[p.preload.locale]:{props:p.preload.props}}}))}}async function lt({req:t,state:s,componentId:e,locale:n,defaultLocale:o,properties:r}){const{supportedLocales:c}=s,a=ie({state:s,componentId:e});if(!a)return null;const u=c.some(d=>d.locale===n)?n:o;if(!u)return null;const l=await ut({req:t,state:s,componentId:e,locale:u,defaultLocale:o,properties:r});return l?{component:a,...l}:null}const ws=20;async function ut({req:t,depth:s=0,state:e,componentId:n,locale:o,defaultLocale:r,properties:c}){if(s>ws)throw new RangeError("max component depth exceeded");const a=Es({state:e,componentId:n,properties:c,locale:o});if(!a)return null;const{props:u}=a,l={locale:o||r,components:{[a.component.id]:{component:a.component,script:a.script}},props:{...u}};try{const d=await Is({...a,req:t});d!=null&&d.props&&Object.assign(l.props,d.props)}catch(d){A.error("preload data at server side error",{componentId:n,name:a.component.name},{error:d})}return await Promise.all(Object.entries(u).map(async([d,h])=>{if((h==null?void 0:h.type)===ae.RenderNestedComponent){const E=await ut({req:t,depth:s+1,state:e,componentId:h.componentId,locale:o,defaultLocale:r,properties:h.properties});E&&(Object.assign(l.components,E.components),Object.assign(l.props,{[d]:{type:ae.RenderNestedComponent,componentId:h.componentId,props:E.props}}))}})),l}function Es({state:t,componentId:s,locale:e,properties:n}){const o=ie({state:t,componentId:s});if(!o)return null;const r=ae.mergeComponent({componentId:s,getComponent:c=>ie({state:t,componentId:c}),locale:e,defaultLocale:t.config.defaultLocale,properties:n});return r?{component:o,script:r.script,props:{locale:e,...r.props}}:null}function ie({state:t,componentId:s}){var e,n,o;return((e=t.components[s])==null?void 0:e.data)??((o=(n=t.resources.components)==null?void 0:n[s])==null?void 0:o.component)}function bs({state:t,name:s}){var n,o;const e=s.toLowerCase();return((n=Object.values(t.components).find(r=>{var c;return((c=r.data.name)==null?void 0:c.toLowerCase())===e}))==null?void 0:n.data)??((o=t.resources.components&&Object.values(t.resources.components).find(r=>{var c;return((c=r.component.name)==null?void 0:c.toLowerCase())===e}))==null?void 0:o.component)}async function Is({component:t,script:s,props:e,req:n}){if(!(s!=null&&s.includes("getServerSideProps")))return null;const o=await ot(s,"getServerSideProps");if(!o)return null;const r=new Promise(a=>{setTimeout(()=>{a({})},Re*1e3)});return await Promise.race([r,W.Sandbox.callFunction({code:`${o}
|
|
33
33
|
|
|
34
34
|
export async function getServerSidePropsWrapper(props) {
|
|
35
35
|
const { location, fetch, props: componentProps } = props;
|
package/lib/cjs/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("@blocklet/pages-kit/builtin/utils");require("@blocklet/pages-kit/types");require("@blocklet/pages-kit/utils/property");require("@blocklet/quickjs");require("@blocklet/sdk/lib/config");require("lru-cache");require("node-fetch");require("ufo");require("crypto");const e=require("./chunks/site-state-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("@blocklet/pages-kit/builtin/utils");require("@blocklet/pages-kit/types");require("@blocklet/pages-kit/utils/property");require("@blocklet/quickjs");require("@blocklet/sdk/lib/config");require("lru-cache");require("node-fetch");require("ufo");require("crypto");const e=require("./chunks/site-state-C5t-5c6U.js");exports.CUSTOM_COMPONENT_CACHE_DURATION_IN_SECONDS=e.CUSTOM_COMPONENT_CACHE_DURATION_IN_SECONDS;exports.GET_SERVER_SIDE_PROPS_TIMEOUT_IN_SECONDS=e.GET_SERVER_SIDE_PROPS_TIMEOUT_IN_SECONDS;exports.clearPreloadComponentsCache=e.clearPreloadComponentsCache;exports.clearPreloadComponentsCacheByMode=e.clearPreloadComponentsCacheByMode;exports.getComponentFromState=e.getComponentFromState;exports.getComponentFromStateByName=e.getComponentFromStateByName;exports.getExportSchemaValueFromCode=e.getExportSchemaValueFromCode;exports.getPreloadComponent=e.getPreloadComponent;exports.getPreloadComponents=e.getPreloadComponents;exports.getPreloadComponentsCacheKey=e.getPreloadComponentsCacheKey;
|
package/lib/cjs/home.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-oc52fQ0j.js");require("@arcblock/ux/lib/Locale/context");require("@arcblock/ux/lib/Result");require("@blocklet/pages-kit/builtin/page/header");require("@blocklet/pages-kit/contexts/color");require("@blocklet/pages-kit/utils/data-source");require("@blocklet/ui-react/lib/Header");require("@emotion/css");require("@emotion/react");require("@emotion/styled");require("@mui/material");require("ahooks");require("isomorphic-dompurify");require("lodash/cloneDeep");require("lodash/isEmpty");require("lodash/isEqual");require("react");require("react-helmet");require("react-router-dom");require("react-use");require("ufo");require("./chunks/array-DOclwySd.js");const e=require("./chunks/home-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-oc52fQ0j.js");require("@arcblock/ux/lib/Locale/context");require("@arcblock/ux/lib/Result");require("@blocklet/pages-kit/builtin/page/header");require("@blocklet/pages-kit/contexts/color");require("@blocklet/pages-kit/utils/data-source");require("@blocklet/ui-react/lib/Header");require("@emotion/css");require("@emotion/react");require("@emotion/styled");require("@mui/material");require("ahooks");require("isomorphic-dompurify");require("lodash/cloneDeep");require("lodash/isEmpty");require("lodash/isEqual");require("react");require("react-helmet");require("react-router-dom");require("react-use");require("ufo");require("./chunks/array-DOclwySd.js");const e=require("./chunks/home-q1dzT-BZ.js");exports.HomeView=e.HomeView;exports.PageRoutes=e.PageRoutes;exports.PageView=e.PageView;exports.PageViewByPath=e.PageViewByPath;exports.PageViewWithDataSource=e.PageViewWithDataSource;exports.TranslucentHeader=e.TranslucentHeader;exports.default=e.Home;
|
package/lib/cjs/project-html.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";const
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
${
|
|
1
|
+
"use strict";const z=require("@arcblock/did-auth-storage-nedb"),D=require("@blocklet/sdk/lib/config"),G=require("@blocklet/sdk/lib/service/auth"),K=require("@blocklet/sdk/lib/wallet"),Q=require("@blocklet/sdk/lib/wallet-authenticator"),V=require("@blocklet/sdk/lib/wallet-handler"),P=require("path"),S=require("./chunks/site-state-C5t-5c6U.js"),A=require("@blocklet/crawler/middlewares"),X=require("@blocklet/pages-kit/types"),Y=require("@blocklet/pages-kit/utils/common"),Z=require("@blocklet/pages-kit/utils/preload"),F=require("@blocklet/sdk/lib/component"),ee=require("cheerio/slim"),te=require("express"),E=require("fs"),oe=require("lodash/get"),ne=require("mustache"),I=require("ufo"),u=o=>o&&o.__esModule?o:{default:o};function le(o){if(o&&o.__esModule)return o;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const re=u(z),i=u(D),ce=u(G),se=u(K),ae=u(Q),ie=u(V),ue=u(P),L=le(ee),de=u(oe),pe=u(ne),fe=(o={})=>{const t={data:new Map,timers:new Map,set:(e,a,_=o.ttl||36e5)=>{o.max&&t.data.size>=o.max&&t.delete(t.data.keys().next().value),t.timers.has(e)&&clearTimeout(t.timers.get(e)),t.timers.set(e,setTimeout(()=>t.delete(e),_)),t.data.set(e,a)},get:e=>t.data.get(e),has:e=>t.data.has(e),delete:e=>(t.timers.has(e)&&clearTimeout(t.timers.get(e)),t.timers.delete(e),t.data.delete(e)),clear:()=>{t.data.clear();for(const e of t.timers.values())clearTimeout(e);t.timers.clear()}};return t},O=fe({max:1,ttl:1e3*30});se.default();const he=new ae.default;new ie.default({authenticator:he,tokenStorage:new re.default({dbPath:ue.default.join(i.default.env.dataDir,"auth.db")})});const me=new ce.default,ge=async()=>{try{const o=O.get("blockletInfo");if(o)return o;const{blocklet:t}=await me.getBlocklet();return O.set("blockletInfo",t),t}catch{return null}},we=["/assets/"],U=()=>[!0,"true"].includes(i.default.env.preferences.allowCrawler);function B(){U()?A.initCronCrawlBlocklet({time:"0 0 */12 * * *",options:{}}):A.cancelCronCrawlBlocklet()}B();i.default.events.on(i.default.Events.envUpdate,B);function _e({app:o,viteDevServer:t,state:e}){let a;if(t){const n=E.readFileSync(P.resolve(process.cwd(),"./index.html"),"utf-8");o.use(async(b,v,T)=>{const q=b.originalUrl;a=await t.transformIndexHtml(q,n),T()})}else a=E.readFileSync(P.resolve(process.env.BLOCKLET_APP_DIR,"dist/index.html"),"utf-8");const _=te.Router();_.use((n,b,v)=>{if(n.headers["x-unique-record"]==="dial_http"){S.logger.info("[html] dial http request, return 200 status code"),b.status(200).send("ok");return}v()},A.initSEOMiddleware({autoReturnHtml:!0,allowCrawler:U})),_.get("/:path(*)?",async(n,b,v)=>{var M,$,W;if(we.some(c=>{var p;return(p=n.path)==null?void 0:p.startsWith(c)})){v();return}const T=performance.now(),q=()=>Math.round(performance.now()-T),H="production";let r,h,C=a;if(n.path.startsWith("/pages")){const c=n.params.lang,p=n.cookies.nf_lang,k=new Set([...i.default.env.languages.map(w=>w.code)]);let g=(c&&k.has(c)?c:void 0)||(k.has(p)?p:void 0)||[...k][0];if((!g||!((M=e.supportedLocales)!=null&&M.find(w=>w.locale===g)))&&(g=((W=($=e.supportedLocales)==null?void 0:$[0])==null?void 0:W.locale)||""),g){const w=[];Object.values(e.pages).forEach(s=>{const J=Object.values((s==null?void 0:s.sections)??{}).filter(f=>{var y;return f.component==="custom-component"&&((y=f.config)==null?void 0:y.componentId)}).map(f=>{var y,x;return{id:f.id,componentId:f.config.componentId,useCache:f.config.useCache,cacheDuration:f.config.cacheDuration,properties:(x=(y=f.locales)==null?void 0:y[g])==null?void 0:x.properties}});w.push(...J)});const N=new Promise(s=>{setTimeout(()=>{s({})},90*1e3)});try{await Promise.race([N,S.getPreloadComponents({mode:H,req:n,state:e,locale:g,instances:w,module:X.PreloadComponentScriptModule.UMD_FN}).then(s=>{s&&(h=Z.injectPreloadComponents(s))})])}catch(s){S.logger.warn("getPreloadComponents timeout in promise race, skip inject html elements",s)}}}try{const c=(r==null?void 0:r.title)||i.default.env.appName,p=(r==null?void 0:r.description)||i.default.env.appDescription,k=I.withQuery(I.joinURL(i.default.env.appUrl,"/.well-known/service/blocklet/og.png"),{title:c,description:p});C=pe.default.render(a,{ogTitle:c,ogDescription:p,ogImage:be(r==null?void 0:r.image)||k,pagesPublishedAt:(e==null?void 0:e.config.publishedAt)||new Date().getTime()})}catch{}const l=e==null?void 0:e.config.fontFamily,R=n.query.mode==="draft"||n.url.includes("preview"),m=L.load(C);let d=r==null?void 0:r.backgroundColor;if(d&&Y.isMuiColorKey(d)){const c=await ge();d=de.default(c,`settings.theme.light.palette.${d}`,d)}m("head").find("#injected-head-elements").replaceWith(`
|
|
2
|
+
${d?`<meta name="theme-color" content="${d}" /><style>html,body,#app {background-color: ${d};}</style>`:""}
|
|
3
|
+
${l!=null&&l.title?`<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${l.title}&display=swap">`:""}
|
|
4
|
+
${l!=null&&l.description&&(l==null?void 0:l.description)!==(l==null?void 0:l.title)?`<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${l.description}&display=swap">`:""}
|
|
5
5
|
<script>
|
|
6
6
|
|
|
7
|
-
window.__PAGE_STATE__ = ${JSON.stringify(
|
|
7
|
+
window.__PAGE_STATE__ = ${JSON.stringify(e,null,0)}
|
|
8
8
|
|
|
9
9
|
document.querySelectorAll('link[rel="preload"][as="style"]').forEach(function (link) {
|
|
10
10
|
const l = document.createElement('link');
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
});
|
|
15
15
|
<\/script>
|
|
16
16
|
|
|
17
|
-
${
|
|
17
|
+
${R?`<script src="https://cdn.tailwindcss.com"><\/script>
|
|
18
18
|
<script>
|
|
19
19
|
window.tailwind.config = {
|
|
20
20
|
darkMode: "class",
|
|
21
21
|
};
|
|
22
22
|
<\/script>`:""}
|
|
23
|
-
`);const
|
|
23
|
+
`);const j=D.getBlockletJs();if(j&&m('script[src="__blocklet__.js"]').replaceWith(`<script>${j}<\/script>`),h!=null&&h.html&&m("head").find("#injected-html-elements").replaceWith(h.html),n.cachedHtml){const c=L.load(n.cachedHtml);m("body").html(c("body").html()||"")}C=m.html(),b.send(C),S.logger.info(`[html] render: ${n.path}, ${q()}ms`),m.root().children().remove(),C=null,r=null,h=null}),o.use(_)}function be(o){const t=F.getComponentMountPoint("image-bin");return t&&o&&!/^(https?:\/\/|\/)/.test(o)?i.default.env.appUrl+I.joinURL(t,"uploads",o):o}module.exports=_e;
|
package/lib/cjs/resources.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("./chunks/site-state-
|
|
1
|
+
"use strict";const c=require("./chunks/site-state-C5t-5c6U.js"),M=require("async_hooks"),U=require("express"),F=require("fs"),J=require("joi"),X=require("lodash/groupBy"),W=require("lodash/sortBy"),b=require("path"),$=require("@blocklet/sdk/lib/middlewares/auth"),G=require("@blocklet/sdk/lib/component"),y=t=>t&&t.__esModule?t:{default:t},l=y(F),I=y(J),D=y(X),K=y(W),k=y(b),v=y($);new M.AsyncLocalStorage;const Y=async(t,e,o)=>{var n,s,r,i;try{const{projectId:u}=t.params;if(!u)return o();const f=await c.Project.findByPk(u);if(!f)return e==null?void 0:e.status(404).json({error:"Project not found"});const _=(n=t.user)==null?void 0:n.did,h=((s=t.user)==null?void 0:s.role)||"UNKNOWN_ROLE";if(!_)return e==null?void 0:e.status(401).json({error:"Authentication required"});if(c.isMultiTenant()){const w=f.createdBy===_,a=(i=(r=c.getMultiTenantAllProjectAccessPassports())==null?void 0:r.includes)==null?void 0:i.call(r,h);if(!w&&!a)return e==null?void 0:e.status(403).json({error:"No permission to access this project in multi-tenant mode"})}else if(!["owner","admin","pagesEditor"].includes(h))return e==null?void 0:e.status(403).json({error:"No permission to access this project in single-tenant mode"});t.project=f,t.projectId=u,o()}catch(u){c.logger.error("Project middleware error:",u),e==null||e.status(500).json({error:"Internal server error"})}};function N(t,e){return new Promise((o,n)=>{const s=l.default.createReadStream(t),r=l.default.createWriteStream(e);s.on("error",n),r.on("error",n),r.on("finish",o),s.pipe(r)})}async function T(t,e){await l.default.promises.mkdir(e,{recursive:!0});const o=await l.default.promises.readdir(t,{withFileTypes:!0});for(const n of o){const s=k.default.join(t,n.name),r=k.default.join(e,n.name);n.isDirectory()?await T(s,r):await N(s,r)}}async function z(t,e){(await l.default.promises.stat(t)).isDirectory()?await T(t,e):await N(t,e)}const O=(t,e,o)=>c.isMultiTenant()?v.default()(t,e,o):v.default({roles:["owner","admin","pagesEditor"]})(t,e,o),H=(t,e)=>{const o=G.getResourceExportDir({projectId:t,releaseId:e});return b.join(o,c.COMPONENT_DID,c.RESOURCE_TYPE)},S=U.Router(),B="@page",q="@component",P=":",E="ALL",L="@project",C=({pageId:t,projectId:e})=>[B,e,t].join(P),Q=t=>{const[e,o,n]=t.split(P);if(e===B)return{pageId:n,projectId:o}},A=({componentId:t,projectId:e})=>[q,e,t].join(P),V=t=>{const[e,o,n]=t.split(P);if(e===q)return{componentId:n,projectId:o}},Z=t=>[L,t].join(P),tt=t=>{const[e,o]=t.split(P);if(e===L)return o},et=t=>{try{return JSON.parse(t)}catch{}return{}};async function x(t){const e=await c.SiteState.shared(t).getState("production"),o=await c.Project.findByPk(t),n=e.pageIds.map(r=>{const i=e.pages[r];if(i)return{id:C({pageId:r,projectId:t}),name:i.slug}}).filter(Boolean),s=K.default(Object.values(e.components),r=>r.index).map(({data:r})=>({id:A({componentId:r.id,projectId:t}),name:r.name||r.id}));return{id:Z(t),name:(o==null?void 0:o.name)||"Unnamed Project",children:[{id:C({pageId:E,projectId:t}),name:"Pages",children:n},{id:A({componentId:E,projectId:t}),name:"Components",children:s}]}}S.get("/resources",O,async(t,e)=>{const{projectId:o}=et(t.query.resourcesParams);if(o){t.params={...t.params,projectId:o},await Y(t,e,()=>{});const r=await x(o);e.json({resources:[r]});return}const n=await c.Project.findAll({where:{}}),s=await Promise.all(n.map(r=>x(r.id)));e.json({resources:s})});const ot=I.default.object({projectId:I.default.string().required().min(1),releaseId:I.default.string().allow(""),resources:I.default.array().items(I.default.string()).required(),locale:I.default.string().allow("")});S.post("/resources",O,async(t,e)=>{const{resources:o,projectId:n,releaseId:s}=await ot.validateAsync(t.body),r="production",i=[],u=[];for(const a of o){if(tt(a))continue;const{pageId:m,projectId:j}=Q(a)||{};if(m)m===E||m&&j&&i.push({pageId:m,projectId:j});else{const{componentId:p,projectId:d}=V(a)||{};p===E||p&&d&&u.push({componentId:p,projectId:d})}}const f=D.default(i,"projectId"),_=D.default(u,"projectId"),h=new Set([...Object.keys(f),...Object.keys(_)]),w=H(n,s);l.default.rmSync(w,{recursive:!0,force:!0}),l.default.mkdirSync(w,{recursive:!0});for(const a of h){const m=await c.SiteState.shared(a).getState(r),j=f[a],p=_[a],d=j==null?void 0:j.map(g=>g.pageId),R=p==null?void 0:p.map(g=>g.componentId);if(d!=null&&d.length||R!=null&&R.length){const g=await c.toPackage(m,{exportAssets:!0,pageIds:d,componentIds:R});await z(g,w),l.default.rmSync(g,{recursive:!0,force:!0})}c.logger.info(`Exported resources for project ${a}`,{pageIds:d,componentIds:R})}e.json({})});S.get("/all-resources",O,async(t,e)=>{const{states:o}=await c.getResourceStates(),n=o==null?void 0:o.map(s=>{const r={blockletId:s.blockletId,blockletTitle:s.blockletTitle,components:{}};if(s.state.components&&(r.components=s.state.components),Object.keys(r.components).length!==0)return r}).filter(Boolean);e.json(n)});module.exports=S;
|
package/lib/cjs/site-state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/site-state-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/site-state-C5t-5c6U.js");require("@blocklet/pages-kit/utils/data-source");require("@blocklet/pages-kit/utils/property");require("@blocklet/quickjs");require("@blocklet/sdk/lib/component");require("@blocklet/sdk/lib/config");require("@reactivedata/reactive");require("@syncedstore/core");require("crypto");require("fs");require("glob");require("lib0/decoding");require("lib0/encoding");require("lodash/cloneDeep");require("lodash/debounce");require("lodash/get");require("lodash/isEmpty");require("lodash/pick");require("lodash/set");require("lodash/union");require("lru-cache");require("nanoid");require("p-limit");require("path");require("stream/promises");require("tar");require("ufo");require("wait-on");require("y-protocols/awareness");require("y-protocols/sync");require("yaml");require("yjs");const t=require("@blocklet/pages-kit/types/state");exports.PUBLISH_MODES=e.PUBLISH_MODES;exports.SITE_STATE_PATH=e.SITE_STATE_PATH;exports.STATE_MODES=e.STATE_MODES;exports.default=e.SiteState;exports.fromPackage=e.fromPackage;exports.getResourceStates=e.getResourceStates;exports.initPackResourceStates=e.initPackResourceStates;exports.mergeState=e.mergeState;exports.nextId=e.nextId;exports.toPackage=e.toPackage;exports.triggerReloadAllProjectResource=e.triggerReloadAllProjectResource;Object.keys(t).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>t[r]})});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as O } from "react/jsx-runtime";
|
|
2
|
-
import { d as
|
|
3
|
-
import { useLocaleContext as
|
|
2
|
+
import { d as G, e as ce, g as le, u as ue, c as me } from "./state-DCRhzAYq.js";
|
|
3
|
+
import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import q from "@arcblock/ux/lib/Result";
|
|
5
5
|
import { useHeaderState as pe } from "@blocklet/pages-kit/builtin/page/header";
|
|
6
6
|
import { useColorConvert as de } from "@blocklet/pages-kit/contexts/color";
|
|
@@ -10,17 +10,17 @@ import { cx as K } from "@emotion/css";
|
|
|
10
10
|
import { Global as Q, css as X } from "@emotion/react";
|
|
11
11
|
import Y from "@emotion/styled";
|
|
12
12
|
import { Box as B, CircularProgress as fe, useTheme as he, Button as be, Stack as ye, useMediaQuery as ve } from "@mui/material";
|
|
13
|
-
import { useReactive as Z } from "ahooks";
|
|
14
|
-
import
|
|
13
|
+
import { useReactive as Z, useScroll as we } from "ahooks";
|
|
14
|
+
import Se from "isomorphic-dompurify";
|
|
15
15
|
import _ from "lodash/cloneDeep";
|
|
16
|
-
import
|
|
16
|
+
import ke from "lodash/isEmpty";
|
|
17
17
|
import F from "lodash/isEqual";
|
|
18
|
-
import { useEffect as $, useContext as
|
|
19
|
-
import { Helmet as
|
|
20
|
-
import { useSearchParams as oe, Routes as
|
|
21
|
-
import {
|
|
22
|
-
import { joinURL as
|
|
23
|
-
import { S as
|
|
18
|
+
import { useEffect as $, useContext as Pe, lazy as ee, useMemo as P, useRef as te, Suspense as xe, useState as Ce } from "react";
|
|
19
|
+
import { Helmet as Re } from "react-helmet";
|
|
20
|
+
import { useSearchParams as oe, Routes as Ee, Route as T, Navigate as Me, ScrollRestoration as Ie } from "react-router-dom";
|
|
21
|
+
import { useAsync as ne } from "react-use";
|
|
22
|
+
import { joinURL as j } from "ufo";
|
|
23
|
+
import { S as Te, n as je, P as $e, a as Be, B as Ne, g as Oe } from "./array-CUVFSUuJ.js";
|
|
24
24
|
import { styled as re, useTheme as _e } from "@arcblock/ux/lib/Theme";
|
|
25
25
|
import Ae from "@blocklet/ui-react/lib/Footer";
|
|
26
26
|
import He from "webfontloader";
|
|
@@ -38,9 +38,9 @@ function Ve(e) {
|
|
|
38
38
|
return /* @__PURE__ */ t(B, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...e, children: /* @__PURE__ */ t(fe, { size: 30 }) });
|
|
39
39
|
}
|
|
40
40
|
function ze(e) {
|
|
41
|
-
return /* @__PURE__ */ t(
|
|
41
|
+
return /* @__PURE__ */ t(Ge, { ...e });
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const Ge = re(B)`
|
|
44
44
|
position: fixed;
|
|
45
45
|
left: 0;
|
|
46
46
|
top: 0;
|
|
@@ -51,7 +51,7 @@ const We = re(B)`
|
|
|
51
51
|
opacity: 0.7;
|
|
52
52
|
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
53
53
|
pointer-events: none;
|
|
54
|
-
`,
|
|
54
|
+
`, We = (e) => new Promise((o, n) => {
|
|
55
55
|
(e == null ? void 0 : e.length) > 0 ? He.load({
|
|
56
56
|
google: {
|
|
57
57
|
families: e
|
|
@@ -73,7 +73,7 @@ function qe({
|
|
|
73
73
|
const n = he(), s = (r = n == null ? void 0 : n.typography) == null ? void 0 : r.fontFamily, i = async (l) => {
|
|
74
74
|
if (l && !document.querySelectorAll(`link[href*="${l}" i]`).length)
|
|
75
75
|
try {
|
|
76
|
-
z[l] || (await
|
|
76
|
+
z[l] || (await We([l]), z[l] = !0);
|
|
77
77
|
} catch (a) {
|
|
78
78
|
console.error(a);
|
|
79
79
|
}
|
|
@@ -99,9 +99,9 @@ function qe({
|
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
const { SessionProvider:
|
|
102
|
+
const { SessionProvider: Tt, SessionContext: Je, SessionConsumer: jt, withSession: $t } = De();
|
|
103
103
|
function L() {
|
|
104
|
-
return
|
|
104
|
+
return Pe(Je);
|
|
105
105
|
}
|
|
106
106
|
function Ke(...e) {
|
|
107
107
|
var n;
|
|
@@ -116,7 +116,7 @@ function Qe(...e) {
|
|
|
116
116
|
function Bt() {
|
|
117
117
|
const [e] = oe(), { session: o } = L(), n = Qe("owner", "admin", "pagesEditor", "member"), s = P(() => {
|
|
118
118
|
const r = e.get("mode");
|
|
119
|
-
return
|
|
119
|
+
return Te.includes(r) ? r : "production";
|
|
120
120
|
}, [e]), i = s === "production" ? s : o.user ? n ? s : "production" : null;
|
|
121
121
|
return i ? /* @__PURE__ */ t(Xe, { mode: i }) : null;
|
|
122
122
|
}
|
|
@@ -142,7 +142,7 @@ function Ze({
|
|
|
142
142
|
return l ? /* @__PURE__ */ t(Ve, {}) : a ? o({ state: a }) : null;
|
|
143
143
|
}
|
|
144
144
|
function D({ mode: e, state: o }) {
|
|
145
|
-
const { t: n, locale: s } =
|
|
145
|
+
const { t: n, locale: s } = W(), [i] = oe(), r = i.get("hiddenBadge") === "true", l = i.get("showPublish") === "true", {
|
|
146
146
|
pageIds: a,
|
|
147
147
|
pages: c,
|
|
148
148
|
routeIds: g,
|
|
@@ -150,7 +150,7 @@ function D({ mode: e, state: o }) {
|
|
|
150
150
|
supportedLocales: m,
|
|
151
151
|
config: { defaultLocale: h },
|
|
152
152
|
resources: b
|
|
153
|
-
} = o, y =
|
|
153
|
+
} = o, y = G(o), v = P(
|
|
154
154
|
() => m != null && m.some((p) => p.locale === s) ? s : void 0,
|
|
155
155
|
[s, m]
|
|
156
156
|
), f = Object.values(c).find((p) => (p == null ? void 0 : p.slug) === "/") ? void 0 : Object.values(c)[0], N = P(
|
|
@@ -158,25 +158,25 @@ function D({ mode: e, state: o }) {
|
|
|
158
158
|
const u = c[p];
|
|
159
159
|
return u && {
|
|
160
160
|
id: u.id,
|
|
161
|
-
path:
|
|
161
|
+
path: j("/", v || "", u.slug, e !== "production" ? `?mode=${e}` : "")
|
|
162
162
|
};
|
|
163
|
-
}).filter(
|
|
163
|
+
}).filter(je),
|
|
164
164
|
[a, c, v, e]
|
|
165
165
|
), S = ([...p]) => (e !== "production" && l && p.unshift(
|
|
166
|
-
/* @__PURE__ */ t(
|
|
166
|
+
/* @__PURE__ */ t(xe, { fallback: /* @__PURE__ */ t("div", {}), children: /* @__PURE__ */ t(et, { mode: "production", state: o }) })
|
|
167
167
|
), p);
|
|
168
168
|
return /* @__PURE__ */ O($e, { value: { pages: N }, children: [
|
|
169
|
-
/* @__PURE__ */ O(
|
|
170
|
-
f && /* @__PURE__ */ t(
|
|
169
|
+
/* @__PURE__ */ O(Ee, { children: [
|
|
170
|
+
f && /* @__PURE__ */ t(T, { index: !0, element: /* @__PURE__ */ t(Me, { to: j("/", v || "", f.slug) }) }),
|
|
171
171
|
g == null ? void 0 : g.map((p) => {
|
|
172
|
-
var C, R,
|
|
172
|
+
var C, R, E, M;
|
|
173
173
|
const u = d == null ? void 0 : d[p];
|
|
174
174
|
if (!u || !u.displayTemplateId) return null;
|
|
175
175
|
const x = c[u.displayTemplateId];
|
|
176
176
|
return x ? /* @__PURE__ */ t(
|
|
177
|
-
|
|
177
|
+
T,
|
|
178
178
|
{
|
|
179
|
-
path:
|
|
179
|
+
path: j(":projectIdOrSlug?", u.path),
|
|
180
180
|
element: /* @__PURE__ */ t(
|
|
181
181
|
Fe,
|
|
182
182
|
{
|
|
@@ -187,7 +187,7 @@ function D({ mode: e, state: o }) {
|
|
|
187
187
|
defaultLocale: h,
|
|
188
188
|
headerAddons: S,
|
|
189
189
|
state: o,
|
|
190
|
-
pageData: (
|
|
190
|
+
pageData: (M = (E = (R = (C = u.dataSource) == null ? void 0 : C.pathDataMappings) == null ? void 0 : R[u.id]) == null ? void 0 : E.dataCache) == null ? void 0 : M[v || h || "en"]
|
|
191
191
|
}
|
|
192
192
|
)
|
|
193
193
|
},
|
|
@@ -197,9 +197,9 @@ function D({ mode: e, state: o }) {
|
|
|
197
197
|
a.map((p) => {
|
|
198
198
|
const u = c[p];
|
|
199
199
|
return u ? /* @__PURE__ */ t(
|
|
200
|
-
|
|
200
|
+
T,
|
|
201
201
|
{
|
|
202
|
-
path:
|
|
202
|
+
path: j(":projectIdOrSlug?", u.slug),
|
|
203
203
|
element: /* @__PURE__ */ t(
|
|
204
204
|
A,
|
|
205
205
|
{
|
|
@@ -216,9 +216,9 @@ function D({ mode: e, state: o }) {
|
|
|
216
216
|
) : null;
|
|
217
217
|
}),
|
|
218
218
|
b.pages && Object.values(b.pages).map(({ blockletId: p, page: u }) => /* @__PURE__ */ t(
|
|
219
|
-
|
|
219
|
+
T,
|
|
220
220
|
{
|
|
221
|
-
path:
|
|
221
|
+
path: j("/", `@${p}`, u.slug),
|
|
222
222
|
element: /* @__PURE__ */ t(
|
|
223
223
|
A,
|
|
224
224
|
{
|
|
@@ -234,7 +234,7 @@ function D({ mode: e, state: o }) {
|
|
|
234
234
|
u.id
|
|
235
235
|
)),
|
|
236
236
|
/* @__PURE__ */ t(
|
|
237
|
-
|
|
237
|
+
T,
|
|
238
238
|
{
|
|
239
239
|
path: "*",
|
|
240
240
|
element: /* @__PURE__ */ t(B, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(q, { status: 404, extra: /* @__PURE__ */ t(ie, { href: "/", children: n("common.back") }) }) })
|
|
@@ -283,7 +283,7 @@ function Nt({
|
|
|
283
283
|
path: n,
|
|
284
284
|
pageData: s
|
|
285
285
|
}) {
|
|
286
|
-
const { t: i, locale: r } =
|
|
286
|
+
const { t: i, locale: r } = W(), {
|
|
287
287
|
pages: l,
|
|
288
288
|
supportedLocales: a,
|
|
289
289
|
config: { defaultLocale: c },
|
|
@@ -303,7 +303,7 @@ function Nt({
|
|
|
303
303
|
F(s, y.current) || s && b.page && (J(b.page, o, h, s), y.current = _(s));
|
|
304
304
|
}, [{}]), !d && !(m != null && m.page))
|
|
305
305
|
return /* @__PURE__ */ t(B, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(q, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ t(ie, { href: "/", children: i("common.back") }) }) });
|
|
306
|
-
const v =
|
|
306
|
+
const v = G(o);
|
|
307
307
|
return b.page ? /* @__PURE__ */ t(
|
|
308
308
|
A,
|
|
309
309
|
{
|
|
@@ -323,12 +323,12 @@ function A({
|
|
|
323
323
|
defaultLocale: i,
|
|
324
324
|
headerAddons: r
|
|
325
325
|
}) {
|
|
326
|
-
var N, S, p, u, x, C, R,
|
|
326
|
+
var N, S, p, u, x, C, R, E, M;
|
|
327
327
|
const l = de(), a = ((N = n.locales) == null ? void 0 : N[s]) ?? ((S = n.locales) == null ? void 0 : S[i]) ?? {}, c = a.title || ((p = window.blocklet) == null ? void 0 : p.appName), g = a.description || ((u = window.blocklet) == null ? void 0 : u.appDescription), d = ce(le(a.image), 540), { logo: m, brand: h, description: b, ...y } = pe(), v = P(
|
|
328
328
|
() => (k) => {
|
|
329
|
-
var
|
|
329
|
+
var I;
|
|
330
330
|
let w = (r == null ? void 0 : r(k)) ?? k;
|
|
331
|
-
return w = ((
|
|
331
|
+
return w = ((I = y.addons) == null ? void 0 : I.call(y, w)) ?? w, w;
|
|
332
332
|
},
|
|
333
333
|
[y.addons, r]
|
|
334
334
|
), f = (x = a.header) != null && x.translucent ? ot : se;
|
|
@@ -353,13 +353,13 @@ function A({
|
|
|
353
353
|
...m ? { logo: m } : {},
|
|
354
354
|
...h ? { brand: h } : {},
|
|
355
355
|
...b ? { description: b } : {},
|
|
356
|
-
className: K(((
|
|
356
|
+
className: K(((E = a.header) == null ? void 0 : E.sticky) && "sticky", "page-header"),
|
|
357
357
|
maxWidth: !1,
|
|
358
358
|
addons: v
|
|
359
359
|
}
|
|
360
360
|
),
|
|
361
|
-
/* @__PURE__ */ t(
|
|
362
|
-
/* @__PURE__ */ O(
|
|
361
|
+
/* @__PURE__ */ t(Ie, {}),
|
|
362
|
+
/* @__PURE__ */ O(Re, { children: [
|
|
363
363
|
/* @__PURE__ */ t("title", { children: c }),
|
|
364
364
|
/* @__PURE__ */ t("meta", { name: "og:title", content: c }),
|
|
365
365
|
/* @__PURE__ */ t("meta", { name: "og:description", content: g }),
|
|
@@ -385,7 +385,7 @@ function A({
|
|
|
385
385
|
var U, V;
|
|
386
386
|
const w = n.sections[k];
|
|
387
387
|
if (!w || w.visibility === "hidden") return null;
|
|
388
|
-
const
|
|
388
|
+
const I = (U = w.locales) == null ? void 0 : U[s], ae = ((V = w.locales) == null ? void 0 : V[i]) ?? {};
|
|
389
389
|
return /* @__PURE__ */ t(
|
|
390
390
|
Ne,
|
|
391
391
|
{
|
|
@@ -394,7 +394,7 @@ function A({
|
|
|
394
394
|
mode: e,
|
|
395
395
|
section: w,
|
|
396
396
|
config: {
|
|
397
|
-
...
|
|
397
|
+
...ke(I) ? ae : I,
|
|
398
398
|
locale: s,
|
|
399
399
|
dev: e === "draft" ? {
|
|
400
400
|
mode: e,
|
|
@@ -408,17 +408,17 @@ function A({
|
|
|
408
408
|
})
|
|
409
409
|
}
|
|
410
410
|
),
|
|
411
|
-
!((
|
|
411
|
+
!((M = a.footer) != null && M.hidden) && /* @__PURE__ */ t(Ue, {})
|
|
412
412
|
] });
|
|
413
413
|
}
|
|
414
|
-
const et = ee(() => import("./publish-button-
|
|
414
|
+
const et = ee(() => import("./publish-button-B2tZwJP0.js")), se = Y(ge)`
|
|
415
415
|
&.sticky {
|
|
416
416
|
position: sticky;
|
|
417
417
|
top: 0;
|
|
418
418
|
}
|
|
419
419
|
`;
|
|
420
420
|
function tt({ logo: e }) {
|
|
421
|
-
const [o, n] =
|
|
421
|
+
const [o, n] = Ce(), s = ve((r) => r.breakpoints.down("sm")), { value: i } = ne(() => {
|
|
422
422
|
var a, c;
|
|
423
423
|
const r = new URL(
|
|
424
424
|
s ? ((a = window == null ? void 0 : window.blocklet) == null ? void 0 : a.appLogo) || "/.well-known/service/blocklet/logo" : ((c = window == null ? void 0 : window.blocklet) == null ? void 0 : c.appLogoRect) || "/.well-known/service/blocklet/logo-rect",
|
|
@@ -438,7 +438,7 @@ function tt({ logo: e }) {
|
|
|
438
438
|
if (e)
|
|
439
439
|
return e;
|
|
440
440
|
if (o)
|
|
441
|
-
return /* @__PURE__ */ t(B, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html:
|
|
441
|
+
return /* @__PURE__ */ t(B, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: Se.sanitize(o) } });
|
|
442
442
|
if (i) {
|
|
443
443
|
const r = new URL(i);
|
|
444
444
|
r.searchParams.set("imageFilter", "convert"), r.searchParams.set("f", "png"), r.searchParams.set("h", "80");
|
|
@@ -452,7 +452,7 @@ function ot({
|
|
|
452
452
|
translucentTextColor: o,
|
|
453
453
|
...n
|
|
454
454
|
}) {
|
|
455
|
-
const {
|
|
455
|
+
const { top: s = 0 } = we(() => document.getElementById("app")) || {};
|
|
456
456
|
let i = Math.min(s / 800, 1), r = "";
|
|
457
457
|
if (i > 0.1) {
|
|
458
458
|
i = Math.max(i, 0.6);
|
|
@@ -9,7 +9,7 @@ import { produce as oe } from "immer";
|
|
|
9
9
|
import N from "lodash/difference";
|
|
10
10
|
import { useState as D, useMemo as L, useCallback as P, forwardRef as se, useImperativeHandle as le, useEffect as ae } from "react";
|
|
11
11
|
import { useAsync as ce } from "react-use";
|
|
12
|
-
import { L as de } from "./home-
|
|
12
|
+
import { L as de } from "./home-CSX7cAwr.js";
|
|
13
13
|
import { p as ue, g as me } from "./array-CUVFSUuJ.js";
|
|
14
14
|
function pe(r) {
|
|
15
15
|
const [m, h] = D(!1);
|
|
@@ -271,10 +271,8 @@ ${t}
|
|
|
271
271
|
ttl: 1e3 * 60 * 60
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
), ys = (t, s) =>
|
|
275
|
-
|
|
276
|
-
return `// GENERATED FILE. DO NOT EDIT.
|
|
277
|
-
var ${t} = ${e ? "async" : ""} function () {
|
|
274
|
+
), ys = (t, s) => `// GENERATED FILE. DO NOT EDIT.
|
|
275
|
+
var ${t} = function () {
|
|
278
276
|
|
|
279
277
|
const exports = {};
|
|
280
278
|
let moduleExports = null;
|
|
@@ -299,8 +297,7 @@ var ${t} = ${e ? "async" : ""} function () {
|
|
|
299
297
|
|
|
300
298
|
return exports;
|
|
301
299
|
};
|
|
302
|
-
|
|
303
|
-
}, re = new Re({
|
|
300
|
+
`, re = new Re({
|
|
304
301
|
max: 100
|
|
305
302
|
}), Ss = 60 * 60, We = 60;
|
|
306
303
|
function ws(t) {
|
package/lib/es/components.js
CHANGED
|
@@ -7,7 +7,7 @@ import "lru-cache";
|
|
|
7
7
|
import "node-fetch";
|
|
8
8
|
import "ufo";
|
|
9
9
|
import "crypto";
|
|
10
|
-
import { c as _, G as E, d as i, e as d, j as l, k as N, m as O, h as P, g as c, f as g } from "./chunks/site-state-
|
|
10
|
+
import { c as _, G as E, d as i, e as d, j as l, k as N, m as O, h as P, g as c, f as g } from "./chunks/site-state-BLNi12iP.js";
|
|
11
11
|
export {
|
|
12
12
|
_ as CUSTOM_COMPONENT_CACHE_DURATION_IN_SECONDS,
|
|
13
13
|
E as GET_SERVER_SIDE_PROPS_TIMEOUT_IN_SECONDS,
|
package/lib/es/home.js
CHANGED
|
@@ -21,7 +21,7 @@ import "react-router-dom";
|
|
|
21
21
|
import "react-use";
|
|
22
22
|
import "ufo";
|
|
23
23
|
import "./chunks/array-CUVFSUuJ.js";
|
|
24
|
-
import { a as B, P as D, d as R, c as S, b as W, T as j, H as k } from "./chunks/home-
|
|
24
|
+
import { a as B, P as D, d as R, c as S, b as W, T as j, H as k } from "./chunks/home-CSX7cAwr.js";
|
|
25
25
|
export {
|
|
26
26
|
B as HomeView,
|
|
27
27
|
D as PageRoutes,
|
package/lib/es/project-html.js
CHANGED
|
@@ -1,131 +1,192 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import N from "@arcblock/did-auth-storage-nedb";
|
|
2
|
+
import s, { getBlockletJs as J } from "@blocklet/sdk/lib/config";
|
|
3
|
+
import G from "@blocklet/sdk/lib/service/auth";
|
|
4
|
+
import K from "@blocklet/sdk/lib/wallet";
|
|
5
|
+
import z from "@blocklet/sdk/lib/wallet-authenticator";
|
|
6
|
+
import Q from "@blocklet/sdk/lib/wallet-handler";
|
|
7
|
+
import V, { resolve as x } from "path";
|
|
8
|
+
import { l as I, g as X } from "./chunks/site-state-BLNi12iP.js";
|
|
9
|
+
import { initCronCrawlBlocklet as Y, cancelCronCrawlBlocklet as Z, initSEOMiddleware as q } from "@blocklet/crawler/middlewares";
|
|
10
|
+
import { PreloadComponentScriptModule as F } from "@blocklet/pages-kit/types";
|
|
11
|
+
import { isMuiColorKey as ee } from "@blocklet/pages-kit/utils/common";
|
|
12
|
+
import { injectPreloadComponents as te } from "@blocklet/pages-kit/utils/preload";
|
|
13
|
+
import { getComponentMountPoint as oe } from "@blocklet/sdk/lib/component";
|
|
14
|
+
import * as L from "cheerio/slim";
|
|
15
|
+
import { Router as re } from "express";
|
|
16
|
+
import { readFileSync as M } from "fs";
|
|
17
|
+
import ne from "lodash/get";
|
|
18
|
+
import le from "mustache";
|
|
19
|
+
import { withQuery as ie, joinURL as W } from "ufo";
|
|
20
|
+
const ce = (o = {}) => {
|
|
21
|
+
const t = {
|
|
22
|
+
data: /* @__PURE__ */ new Map(),
|
|
23
|
+
timers: /* @__PURE__ */ new Map(),
|
|
24
|
+
set: (e, d, w = o.ttl || 36e5) => {
|
|
25
|
+
o.max && t.data.size >= o.max && t.delete(t.data.keys().next().value), t.timers.has(e) && clearTimeout(t.timers.get(e)), t.timers.set(
|
|
26
|
+
e,
|
|
27
|
+
setTimeout(() => t.delete(e), w)
|
|
28
|
+
), t.data.set(e, d);
|
|
29
|
+
},
|
|
30
|
+
get: (e) => t.data.get(e),
|
|
31
|
+
has: (e) => t.data.has(e),
|
|
32
|
+
delete: (e) => (t.timers.has(e) && clearTimeout(t.timers.get(e)), t.timers.delete(e), t.data.delete(e)),
|
|
33
|
+
clear: () => {
|
|
34
|
+
t.data.clear();
|
|
35
|
+
for (const e of t.timers.values())
|
|
36
|
+
clearTimeout(e);
|
|
37
|
+
t.timers.clear();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return t;
|
|
41
|
+
}, j = ce({
|
|
42
|
+
max: 1,
|
|
43
|
+
ttl: 1e3 * 30
|
|
44
|
+
// 30 seconds
|
|
45
|
+
});
|
|
46
|
+
K();
|
|
47
|
+
const se = new z();
|
|
48
|
+
new Q({
|
|
49
|
+
authenticator: se,
|
|
50
|
+
tokenStorage: new N({
|
|
51
|
+
dbPath: V.join(s.env.dataDir, "auth.db")
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
const ae = new G(), me = async () => {
|
|
55
|
+
try {
|
|
56
|
+
const o = j.get("blockletInfo");
|
|
57
|
+
if (o)
|
|
58
|
+
return o;
|
|
59
|
+
const { blocklet: t } = await ae.getBlocklet();
|
|
60
|
+
return j.set("blockletInfo", t), t;
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}, pe = ["/assets/"], B = () => [!0, "true"].includes(s.env.preferences.allowCrawler);
|
|
65
|
+
function U() {
|
|
66
|
+
B() ? Y({
|
|
16
67
|
time: "0 0 */12 * * *",
|
|
17
68
|
options: {}
|
|
18
|
-
}) :
|
|
69
|
+
}) : Z();
|
|
19
70
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
app:
|
|
24
|
-
viteDevServer:
|
|
71
|
+
U();
|
|
72
|
+
s.events.on(s.Events.envUpdate, U);
|
|
73
|
+
function Le({
|
|
74
|
+
app: o,
|
|
75
|
+
viteDevServer: t,
|
|
25
76
|
// projectId,
|
|
26
|
-
state:
|
|
77
|
+
state: e
|
|
27
78
|
}) {
|
|
28
|
-
let
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
79
|
+
let d;
|
|
80
|
+
if (t) {
|
|
81
|
+
const r = M(x(process.cwd(), "./index.html"), "utf-8");
|
|
82
|
+
o.use(async (C, y, T) => {
|
|
83
|
+
const _ = C.originalUrl;
|
|
84
|
+
d = await t.transformIndexHtml(_, r), T();
|
|
34
85
|
});
|
|
35
86
|
} else
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
if (
|
|
41
|
-
|
|
87
|
+
d = M(x(process.env.BLOCKLET_APP_DIR, "dist/index.html"), "utf-8");
|
|
88
|
+
const w = re();
|
|
89
|
+
w.use(
|
|
90
|
+
(r, C, y) => {
|
|
91
|
+
if (r.headers["x-unique-record"] === "dial_http") {
|
|
92
|
+
I.info("[html] dial http request, return 200 status code"), C.status(200).send("ok");
|
|
42
93
|
return;
|
|
43
94
|
}
|
|
44
95
|
y();
|
|
45
96
|
},
|
|
46
|
-
|
|
97
|
+
q({
|
|
47
98
|
autoReturnHtml: !0,
|
|
48
|
-
allowCrawler:
|
|
99
|
+
allowCrawler: B
|
|
49
100
|
})
|
|
50
|
-
),
|
|
51
|
-
var
|
|
52
|
-
if (
|
|
53
|
-
var
|
|
54
|
-
return (
|
|
101
|
+
), w.get("/:path(*)?", async (r, C, y) => {
|
|
102
|
+
var $, P, A;
|
|
103
|
+
if (pe.some((i) => {
|
|
104
|
+
var m;
|
|
105
|
+
return (m = r.path) == null ? void 0 : m.startsWith(i);
|
|
55
106
|
})) {
|
|
56
107
|
y();
|
|
57
108
|
return;
|
|
58
109
|
}
|
|
59
|
-
const
|
|
60
|
-
let
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
let
|
|
64
|
-
if ((!
|
|
65
|
-
const
|
|
66
|
-
Object.values(
|
|
67
|
-
const
|
|
68
|
-
(
|
|
69
|
-
var
|
|
70
|
-
return
|
|
110
|
+
const T = performance.now(), _ = () => Math.round(performance.now() - T), D = "production";
|
|
111
|
+
let l, u, k = d;
|
|
112
|
+
if (r.path.startsWith("/pages")) {
|
|
113
|
+
const i = r.params.lang, m = r.cookies.nf_lang, b = /* @__PURE__ */ new Set([...s.env.languages.map((g) => g.code)]);
|
|
114
|
+
let f = (i && b.has(i) ? i : void 0) || (b.has(m) ? m : void 0) || [...b][0];
|
|
115
|
+
if ((!f || !(($ = e.supportedLocales) != null && $.find((g) => g.locale === f))) && (f = ((A = (P = e.supportedLocales) == null ? void 0 : P[0]) == null ? void 0 : A.locale) || ""), f) {
|
|
116
|
+
const g = [];
|
|
117
|
+
Object.values(e.pages).forEach((c) => {
|
|
118
|
+
const R = Object.values((c == null ? void 0 : c.sections) ?? {}).filter(
|
|
119
|
+
(p) => {
|
|
120
|
+
var v;
|
|
121
|
+
return p.component === "custom-component" && ((v = p.config) == null ? void 0 : v.componentId);
|
|
71
122
|
}
|
|
72
|
-
).map((
|
|
73
|
-
var
|
|
123
|
+
).map((p) => {
|
|
124
|
+
var v, E;
|
|
74
125
|
return {
|
|
75
|
-
id:
|
|
76
|
-
componentId:
|
|
77
|
-
useCache:
|
|
78
|
-
cacheDuration:
|
|
79
|
-
properties: (
|
|
126
|
+
id: p.id,
|
|
127
|
+
componentId: p.config.componentId,
|
|
128
|
+
useCache: p.config.useCache,
|
|
129
|
+
cacheDuration: p.config.cacheDuration,
|
|
130
|
+
properties: (E = (v = p.locales) == null ? void 0 : v[f]) == null ? void 0 : E.properties
|
|
80
131
|
};
|
|
81
132
|
});
|
|
82
|
-
|
|
133
|
+
g.push(...R);
|
|
83
134
|
});
|
|
84
|
-
const
|
|
135
|
+
const O = new Promise((c) => {
|
|
85
136
|
setTimeout(() => {
|
|
86
|
-
|
|
137
|
+
c({});
|
|
87
138
|
}, 90 * 1e3);
|
|
88
139
|
});
|
|
89
140
|
try {
|
|
90
141
|
await Promise.race([
|
|
91
|
-
|
|
92
|
-
|
|
142
|
+
O,
|
|
143
|
+
X({
|
|
93
144
|
mode: D,
|
|
94
|
-
req:
|
|
95
|
-
state:
|
|
96
|
-
locale:
|
|
97
|
-
instances:
|
|
98
|
-
module:
|
|
99
|
-
}).then((
|
|
100
|
-
|
|
145
|
+
req: r,
|
|
146
|
+
state: e,
|
|
147
|
+
locale: f,
|
|
148
|
+
instances: g,
|
|
149
|
+
module: F.UMD_FN
|
|
150
|
+
}).then((c) => {
|
|
151
|
+
c && (u = te(c));
|
|
101
152
|
})
|
|
102
153
|
]);
|
|
103
|
-
} catch (
|
|
104
|
-
|
|
154
|
+
} catch (c) {
|
|
155
|
+
I.warn("getPreloadComponents timeout in promise race, skip inject html elements", c);
|
|
105
156
|
}
|
|
106
157
|
}
|
|
107
158
|
}
|
|
108
159
|
try {
|
|
109
|
-
const
|
|
110
|
-
title:
|
|
111
|
-
description:
|
|
160
|
+
const i = (l == null ? void 0 : l.title) || s.env.appName, m = (l == null ? void 0 : l.description) || s.env.appDescription, b = ie(W(s.env.appUrl, "/.well-known/service/blocklet/og.png"), {
|
|
161
|
+
title: i,
|
|
162
|
+
description: m
|
|
112
163
|
});
|
|
113
|
-
|
|
114
|
-
ogTitle:
|
|
115
|
-
ogDescription:
|
|
116
|
-
ogImage:
|
|
117
|
-
pagesPublishedAt: (
|
|
164
|
+
k = le.render(d, {
|
|
165
|
+
ogTitle: i,
|
|
166
|
+
ogDescription: m,
|
|
167
|
+
ogImage: de(l == null ? void 0 : l.image) || b,
|
|
168
|
+
pagesPublishedAt: (e == null ? void 0 : e.config.publishedAt) || (/* @__PURE__ */ new Date()).getTime()
|
|
118
169
|
});
|
|
119
170
|
} catch {
|
|
120
171
|
}
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
172
|
+
const n = e == null ? void 0 : e.config.fontFamily, H = r.query.mode === "draft" || r.url.includes("preview"), h = L.load(k);
|
|
173
|
+
let a = l == null ? void 0 : l.backgroundColor;
|
|
174
|
+
if (a && ee(a)) {
|
|
175
|
+
const i = await me();
|
|
176
|
+
a = ne(
|
|
177
|
+
i,
|
|
178
|
+
// 目前 dark 和 light 还是前端行为,后端通过 从 light 中获取
|
|
179
|
+
`settings.theme.light.palette.${a}`,
|
|
180
|
+
a
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
h("head").find("#injected-head-elements").replaceWith(`
|
|
184
|
+
${a ? `<meta name="theme-color" content="${a}" /><style>html,body,#app {background-color: ${a};}</style>` : ""}
|
|
185
|
+
${n != null && n.title ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${n.title}&display=swap">` : ""}
|
|
186
|
+
${n != null && n.description && (n == null ? void 0 : n.description) !== (n == null ? void 0 : n.title) ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${n.description}&display=swap">` : ""}
|
|
126
187
|
<script>
|
|
127
188
|
|
|
128
|
-
window.__PAGE_STATE__ = ${JSON.stringify(
|
|
189
|
+
window.__PAGE_STATE__ = ${JSON.stringify(e, null, 0)}
|
|
129
190
|
|
|
130
191
|
document.querySelectorAll('link[rel="preload"][as="style"]').forEach(function (link) {
|
|
131
192
|
const l = document.createElement('link');
|
|
@@ -135,25 +196,25 @@ function de({
|
|
|
135
196
|
});
|
|
136
197
|
<\/script>
|
|
137
198
|
|
|
138
|
-
${
|
|
199
|
+
${H ? `<script src="https://cdn.tailwindcss.com"><\/script>
|
|
139
200
|
<script>
|
|
140
201
|
window.tailwind.config = {
|
|
141
202
|
darkMode: "class",
|
|
142
203
|
};
|
|
143
204
|
<\/script>` : ""}
|
|
144
205
|
`);
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
const
|
|
148
|
-
|
|
206
|
+
const S = J();
|
|
207
|
+
if (S && h('script[src="__blocklet__.js"]').replaceWith(`<script>${S}<\/script>`), u != null && u.html && h("head").find("#injected-html-elements").replaceWith(u.html), r.cachedHtml) {
|
|
208
|
+
const i = L.load(r.cachedHtml);
|
|
209
|
+
h("body").html(i("body").html() || "");
|
|
149
210
|
}
|
|
150
|
-
|
|
151
|
-
}),
|
|
211
|
+
k = h.html(), C.send(k), I.info(`[html] render: ${r.path}, ${_()}ms`), h.root().children().remove(), k = null, l = null, u = null;
|
|
212
|
+
}), o.use(w);
|
|
152
213
|
}
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
return
|
|
214
|
+
function de(o) {
|
|
215
|
+
const t = oe("image-bin");
|
|
216
|
+
return t && o && !/^(https?:\/\/|\/)/.test(o) ? s.env.appUrl + W(t, "uploads", o) : o;
|
|
156
217
|
}
|
|
157
218
|
export {
|
|
158
|
-
|
|
219
|
+
Le as default
|
|
159
220
|
};
|
package/lib/es/resources.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as S, i as b, a as M, l as x, C as J, R as X, S as N, t as W, b as G } from "./chunks/site-state-
|
|
1
|
+
import { P as S, i as b, a as M, l as x, C as J, R as X, S as N, t as W, b as G } from "./chunks/site-state-BLNi12iP.js";
|
|
2
2
|
import { AsyncLocalStorage as K } from "async_hooks";
|
|
3
3
|
import { Router as Y } from "express";
|
|
4
4
|
import d from "fs";
|
package/lib/es/site-state.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as v, o as B, p as L, S as U, r as h, b as w, u as y, s as z, n as C, t as F, v as G } from "./chunks/site-state-
|
|
1
|
+
import { q as v, o as B, p as L, S as U, r as h, b as w, u as y, s as z, n as C, t as F, v as G } from "./chunks/site-state-BLNi12iP.js";
|
|
2
2
|
import "@blocklet/pages-kit/utils/data-source";
|
|
3
3
|
import "@blocklet/pages-kit/utils/property";
|
|
4
4
|
import "@blocklet/quickjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit-inner-components",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.126",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -205,8 +205,8 @@
|
|
|
205
205
|
"yaml": "^2.5.0",
|
|
206
206
|
"yjs": "^13.6.18",
|
|
207
207
|
"zustand": "^4.5.5",
|
|
208
|
-
"@blocklet/pages-kit": "^0.4.
|
|
209
|
-
"@blocklet/pages-kit-block-studio": "^0.4.
|
|
208
|
+
"@blocklet/pages-kit": "^0.4.126",
|
|
209
|
+
"@blocklet/pages-kit-block-studio": "^0.4.126"
|
|
210
210
|
},
|
|
211
211
|
"devDependencies": {
|
|
212
212
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|