@blocklet/pages-kit-inner-components 0.4.127 → 0.4.128
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-B6yRf7rx.js +38 -0
- package/lib/cjs/chunks/{publish-button-gJaGa548.js → publish-button-BcyFHcAL.js} +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/es/chunks/home-Crb2pbrM.js +489 -0
- package/lib/es/chunks/{publish-button-C-ra2NsA.js → publish-button-CAJErJjj.js} +1 -1
- package/lib/es/home.js +1 -1
- package/lib/es/theme.js +1 -0
- package/package.json +3 -3
- package/lib/cjs/chunks/home-on-Gjgnl.js +0 -38
- package/lib/es/chunks/home-D5UawjLT.js +0 -507
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),q=require("./state-5jwYHuoB.js"),G=require("@arcblock/ux/lib/Locale/context"),ae=require("@arcblock/ux/lib/Result"),ie=require("@blocklet/pages-kit/builtin/page/header"),ce=require("@blocklet/pages-kit/contexts/color"),W=require("@blocklet/pages-kit/utils/data-source"),le=require("@blocklet/ui-react/lib/Header"),K=require("@emotion/css"),U=require("@emotion/react"),ue=require("@emotion/styled"),P=require("@mui/material"),N=require("ahooks"),de=require("isomorphic-dompurify"),ge=require("lodash/cloneDeep"),fe=require("lodash/isEmpty"),pe=require("lodash/isEqual"),f=require("react"),me=require("react-helmet"),w=require("react-router-dom"),Q=require("react-use"),L=require("ufo"),C=require("./array-3OBY1z8c.js"),O=require("@arcblock/ux/lib/Theme"),he=require("@blocklet/ui-react/lib/Footer");require("webfontloader");const xe=require("@arcblock/did-connect/lib/Session"),S=t=>t&&t.__esModule?t:{default:t},X=S(ae),je=S(le),Y=S(ue),ye=S(de),A=S(ge),be=S(fe),J=S(pe),ve=S(he),we=O.styled(ve.default,{shouldForwardProp:t=>!!t})`
|
|
2
|
+
& > div > .MuiContainer-root {
|
|
3
|
+
max-width: unset;
|
|
4
|
+
}
|
|
5
|
+
`;function Pe({meta:t,...n}){const r=O.useTheme();return e.jsx(we,{...n,meta:t,theme:r||{}})}function Z(t){return e.jsx(P.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...t,children:e.jsx(P.CircularProgress,{size:30})})}function Se(t){return e.jsx(ke,{...t})}const ke=O.styled(P.Box)`
|
|
6
|
+
position: fixed;
|
|
7
|
+
left: 0;
|
|
8
|
+
top: 0;
|
|
9
|
+
z-index: 999999999999;
|
|
10
|
+
width: 80px;
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
text-align: center;
|
|
13
|
+
opacity: 0.7;
|
|
14
|
+
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
`,Re=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
17
|
+
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;function qe({titleFontFamily:t,descriptionFontFamily:n}){var o;const r=P.useTheme(),a=(o=r==null?void 0:r.typography)==null?void 0:o.fontFamily;f.useEffect(()=>{},[t,n]);const s=`${a}, ${Re}`;return e.jsx(U.Global,{styles:U.css`
|
|
18
|
+
#app {
|
|
19
|
+
font-family: ${s};
|
|
20
|
+
|
|
21
|
+
.page-kit-section__title {
|
|
22
|
+
font-family: ${s};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.page-kit-section__description {
|
|
26
|
+
font-family: ${s};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`})}const{SessionProvider:Fe,SessionContext:Ce,SessionConsumer:He,withSession:Ue}=xe.createAuthServiceSessionContext();function V(){return f.useContext(Ce)}function _e(...t){var r;const{session:n}=V();return t.includes((r=n.user)==null?void 0:r.role)}function Me(...t){var a;const{session:n}=V(),r=_e(...t);return((a=window.blocklet)==null?void 0:a.tenantMode)==="multiple"?!!n.user:r}function Ee(){const[t]=w.useSearchParams(),{session:n}=V(),r=Me("owner","admin","pagesEditor","member"),a=f.useMemo(()=>{const o=t.get("mode");return C.STATE_MODES.includes(o)?o:"production"},[t]),s=a==="production"?a:n.user?r?a:"production":null;return s?e.jsx(ee,{mode:s}):null}function ee({mode:t}){if(t!=="draft"){const n=window.__PAGE_STATE__;return n?e.jsx(H,{mode:t,state:n}):e.jsx(Ie,{mode:t,children:({state:r})=>e.jsx(H,{mode:t,state:r})})}return e.jsx(Be,{children:({state:n})=>e.jsx(H,{mode:t,state:n})})}const Be=f.lazy(()=>Promise.resolve().then(()=>require("./draft-data-C4FzOyR5.js")));function Ie({mode:t,children:n}){const r=document.querySelector('meta[property="pages:version"]'),a=r==null?void 0:r.content,s=q.useProjectId(),o=f.useMemo(()=>{if(a==="{{pagesPublishedAt}}"){const c=localStorage.getItem(q.getProjectPageVersionKey(s??""));return Number(c)?Number(c):new Date().getTime()}return Number(a)},[a]),{loading:p,value:i}=Q.useAsync(()=>C.getPages({mode:t,version:o}),[t,o]);return p?e.jsx(Z,{}):i?n({state:i}):null}function H({mode:t,state:n}){const{t:r,locale:a}=G.useLocaleContext(),[s]=w.useSearchParams(),o=s.get("hiddenBadge")==="true",p=s.get("showPublish")==="true",{pageIds:i,pages:c,routeIds:m,routes:g,supportedLocales:u,config:{defaultLocale:x},resources:j}=n,y=q.getAllComponents(n),b=f.useMemo(()=>u!=null&&u.some(d=>d.locale===a)?a:void 0,[a,u]),h=Object.values(c).find(d=>(d==null?void 0:d.slug)==="/")?void 0:Object.values(c)[0],F=f.useMemo(()=>i.map(d=>{const l=c[d];return l&&{id:l.id,path:L.joinURL("/",b||"",l.slug,t!=="production"?`?mode=${t}`:"")}}).filter(C.nonNullable),[i,c,b,t]),k=([...d])=>(t!=="production"&&p&&d.unshift(e.jsx(f.Suspense,{fallback:e.jsx("div",{}),children:e.jsx(Le,{mode:"production",state:n})})),d);return e.jsxs(C.Provider,{value:{pages:F},children:[e.jsxs(w.Routes,{children:[h&&e.jsx(w.Route,{index:!0,element:e.jsx(w.Navigate,{to:L.joinURL("/",b||"",h.slug)})}),m==null?void 0:m.map(d=>{var M,E,B,I;const l=g==null?void 0:g[d];if(!l||!l.displayTemplateId)return null;const _=c[l.displayTemplateId];return _?e.jsx(w.Route,{path:L.joinURL(":projectIdOrSlug?",l.path),element:e.jsx(te,{mode:t,components:y,page:_,locale:b,defaultLocale:x,headerAddons:k,state:n,pageData:(I=(B=(E=(M=l.dataSource)==null?void 0:M.pathDataMappings)==null?void 0:E[l.id])==null?void 0:B.dataCache)==null?void 0:I[b||x||"en"]})},l.id):null}),i.map(d=>{const l=c[d];return l?e.jsx(w.Route,{path:L.joinURL(":projectIdOrSlug?",l.slug),element:e.jsx(D,{mode:t,components:y,page:l,locale:b,defaultLocale:x,headerAddons:k})},l.id):null}),j.pages&&Object.values(j.pages).map(({blockletId:d,page:l})=>e.jsx(w.Route,{path:L.joinURL("/",`@${d}`,l.slug),element:e.jsx(D,{mode:t,components:y,page:l,locale:b,defaultLocale:x,headerAddons:k})},l.id)),e.jsx(w.Route,{path:"*",element:e.jsx(P.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(X.default,{status:404,extra:e.jsx(se,{href:"/",children:r("common.back")})})})})]}),t!=="production"&&!o&&e.jsx(Se,{sx:{bgcolor:"info.light"},children:t}),e.jsx(qe,{})]})}function te({mode:t,pageData:n,components:r,page:a,locale:s,defaultLocale:o,headerAddons:p,state:i}){const c=N.useReactive({page:null});f.useEffect(()=>{const g=a||null;g?c.page=A.default(g):c.page=null},[a,c]);const m=f.useRef();return f.useEffect(()=>{J.default(n,m.current)||n&&c.page&&(W.setPageDataSource(c.page,i,s,n),m.current=A.default(n))},[c.page,n,s,i]),c.page?e.jsx(D,{mode:t,components:r,page:c.page,locale:s,defaultLocale:o,headerAddons:p}):null}function Te({mode:t,state:n,path:r,pageData:a}){const{t:s,locale:o}=G.useLocaleContext(),{pages:p,supportedLocales:i,config:{defaultLocale:c},resources:m}=n,g=Object.values(p).find(h=>(h==null?void 0:h.slug)===r),u=Object.values(m.pages||{}).find(h=>h.page.slug===r),x=f.useMemo(()=>i!=null&&i.some(h=>h.locale===o)?o:void 0,[o,i]),j=N.useReactive({page:null});f.useEffect(()=>{const h=g||(u==null?void 0:u.page)||null;h?j.page=A.default(h):j.page=null},[g,u]);const y=f.useRef();if(f.useEffect(()=>{J.default(a,y.current)||a&&j.page&&(W.setPageDataSource(j.page,n,x,a),y.current=A.default(a))},[{}]),!g&&!(u!=null&&u.page))return e.jsx(P.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(X.default,{style:{background:"inherit"},status:404,extra:e.jsx(se,{href:"/",children:s("common.back")})})});const b=q.getAllComponents(n);return j.page?e.jsx(D,{mode:t,components:b,page:j.page,locale:x,defaultLocale:c}):null}function D({mode:t,components:n,page:r,locale:a,defaultLocale:s,headerAddons:o}){var F,k,d,l,_,M,E,B,I;const p=ce.useColorConvert(),i=((F=r.locales)==null?void 0:F[a])??((k=r.locales)==null?void 0:k[s])??{},c=i.title||((d=window.blocklet)==null?void 0:d.appName),m=i.description||((l=window.blocklet)==null?void 0:l.appDescription),g=q.autoResizeImage(q.getImageAbsoluteUrl(i.image),540),{logo:u,brand:x,description:j,...y}=ie.useHeaderState(),b=f.useMemo(()=>R=>{var T;let v=(o==null?void 0:o(R))??R;return v=((T=y.addons)==null?void 0:T.call(y,v))??v,v},[y.addons,o]),h=(_=i.header)!=null&&_.translucent?oe:ne;return e.jsxs(C.PageProvider,{page:r,defaultLocale:s,currentLocale:a,children:[e.jsx(U.Global,{styles:U.css`
|
|
30
|
+
body {
|
|
31
|
+
background-color: ${p(!i.backgroundColor||i.backgroundColor==="transparent"?"background.default":i.backgroundColor)} !important;
|
|
32
|
+
}
|
|
33
|
+
`}),e.jsx(h,{hideNavMenu:!!((M=i.header)!=null&&M.hideNavMenus),translucentTextColor:(E=i.header)==null?void 0:E.translucentTextColor,...u?{logo:u}:{},...x?{brand:x}:{},...j?{description:j}:{},className:K.cx(((B=i.header)==null?void 0:B.sticky)&&"sticky","page-header"),maxWidth:!1,addons:b}),e.jsx(w.ScrollRestoration,{}),e.jsxs(me.Helmet,{children:[e.jsx("title",{children:c}),e.jsx("meta",{name:"og:title",content:c}),e.jsx("meta",{name:"og:description",content:m}),e.jsx("meta",{name:"og:image",content:g}),e.jsx("meta",{name:"twitter:image:src",content:g}),e.jsx("meta",{name:"twitter:image",content:g}),e.jsx("meta",{property:"twitter:description",content:m}),e.jsx("meta",{property:"twitter:title",content:c}),e.jsx("meta",{name:"description",content:m})]}),e.jsx(P.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:r.sectionIds.map(R=>{var $,z;const v=r.sections[R];if(!v||v.visibility==="hidden")return null;const T=($=v.locales)==null?void 0:$[a],re=((z=v.locales)==null?void 0:z[s])??{};return e.jsx(C.BlockRenderer,{id:R,type:v.component,mode:t,section:v,config:{...be.default(T)?re:T,locale:a,dev:t==="draft"?{mode:t,components:n,defaultLocale:s}:{mode:t}}},R)})}),!((I=i.footer)!=null&&I.hidden)&&e.jsx(Pe,{})]})}const Le=f.lazy(()=>Promise.resolve().then(()=>require("./publish-button-BcyFHcAL.js"))),ne=Y.default(je.default)`
|
|
34
|
+
&.sticky {
|
|
35
|
+
position: sticky;
|
|
36
|
+
top: 0;
|
|
37
|
+
}
|
|
38
|
+
`;function De({logo:t}){const[n,r]=f.useState(),a=P.useMediaQuery(o=>o.breakpoints.down("sm")),{value:s}=Q.useAsync(()=>{var i,c;const o=new URL(a?((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);o.searchParams.delete("imageFilter"),o.searchParams.delete("f");const p=o.toString();return new Promise(m=>{fetch(p).then(g=>{const u=g.headers.get("content-type");u!=null&&u.includes("svg")&&g.text().then(x=>{r(x),m(null)}),m(g.url)})})},[a]);if(t)return t;if(n)return e.jsx(P.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:ye.default.sanitize(n)}});if(s){const o=new URL(s);o.searchParams.set("imageFilter","convert"),o.searchParams.set("f","png"),o.searchParams.set("h","80");const p=o.toString();return e.jsx("img",{src:p,alt:"logo"})}return null}function oe({logo:t,translucentTextColor:n,...r}){const{top:a=0}=N.useScroll(()=>document.getElementById("app"))||{};let s=Math.min(a/800,1),o="";if(s>.1){s=Math.max(s,.6);const p=Math.round(255*Math.min(1-s,.2));o=`rgb(${p}, ${p}, ${p})`}else o=n||"#EEEEEE";return e.jsx(ne,{logo:e.jsx(De,{logo:t}),...r,className:K.cx(s<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${s})`,"--logo-invert":s<=.7?1-s/6:1-s},sx:{backdropFilter:s>=.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:`${o} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:o}}})}const se=Y.default(P.Button)``;exports.Home=Ee;exports.HomeView=ee;exports.Loading=Z;exports.PageRoutes=H;exports.PageView=D;exports.PageViewByPath=Te;exports.PageViewWithDataSource=te;exports.TranslucentHeader=oe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("./state-5jwYHuoB.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-5jwYHuoB.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-B6yRf7rx.js"),O=require("./array-3OBY1z8c.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;
|
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-5jwYHuoB.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-3OBY1z8c.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-5jwYHuoB.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-3OBY1z8c.js");const e=require("./chunks/home-B6yRf7rx.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;
|
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { jsx as e, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import { d as U, e as ie, g as ae, u as le, c as ce } from "./state-DNndJ33Y.js";
|
|
3
|
+
import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
+
import z from "@arcblock/ux/lib/Result";
|
|
5
|
+
import { useHeaderState as ue } from "@blocklet/pages-kit/builtin/page/header";
|
|
6
|
+
import { useColorConvert as me } from "@blocklet/pages-kit/contexts/color";
|
|
7
|
+
import { setPageDataSource as G } from "@blocklet/pages-kit/utils/data-source";
|
|
8
|
+
import pe from "@blocklet/ui-react/lib/Header";
|
|
9
|
+
import { cx as W } from "@emotion/css";
|
|
10
|
+
import { Global as q, css as K } from "@emotion/react";
|
|
11
|
+
import Q from "@emotion/styled";
|
|
12
|
+
import { Box as $, CircularProgress as de, useTheme as ge, Button as fe, Stack as he, useMediaQuery as be } from "@mui/material";
|
|
13
|
+
import { useReactive as X, useScroll as ve } from "ahooks";
|
|
14
|
+
import ye from "isomorphic-dompurify";
|
|
15
|
+
import _ from "lodash/cloneDeep";
|
|
16
|
+
import we from "lodash/isEmpty";
|
|
17
|
+
import Y from "lodash/isEqual";
|
|
18
|
+
import { useEffect as B, useContext as Se, lazy as J, useMemo as x, useRef as Z, Suspense as ke, useState as xe } from "react";
|
|
19
|
+
import { Helmet as Pe } from "react-helmet";
|
|
20
|
+
import { useSearchParams as ee, Routes as Ce, Route as T, Navigate as Re, ScrollRestoration as Me } from "react-router-dom";
|
|
21
|
+
import { useAsync as te } from "react-use";
|
|
22
|
+
import { joinURL as j } from "ufo";
|
|
23
|
+
import { S as Ee, n as Ie, P as Te, a as je, B as Be, g as $e } from "./array-CWudJ_mc.js";
|
|
24
|
+
import { styled as oe, useTheme as Fe } from "@arcblock/ux/lib/Theme";
|
|
25
|
+
import Le from "@blocklet/ui-react/lib/Footer";
|
|
26
|
+
import "webfontloader";
|
|
27
|
+
import { createAuthServiceSessionContext as _e } from "@arcblock/did-connect/lib/Session";
|
|
28
|
+
const Ne = oe(Le, { shouldForwardProp: (t) => !!t })`
|
|
29
|
+
& > div > .MuiContainer-root {
|
|
30
|
+
max-width: unset;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
function Ae({ meta: t, ...o }) {
|
|
34
|
+
const s = Fe();
|
|
35
|
+
return /* @__PURE__ */ e(Ne, { ...o, meta: t, theme: s || {} });
|
|
36
|
+
}
|
|
37
|
+
function He(t) {
|
|
38
|
+
return /* @__PURE__ */ e($, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...t, children: /* @__PURE__ */ e(de, { size: 30 }) });
|
|
39
|
+
}
|
|
40
|
+
function De(t) {
|
|
41
|
+
return /* @__PURE__ */ e(Oe, { ...t });
|
|
42
|
+
}
|
|
43
|
+
const Oe = oe($)`
|
|
44
|
+
position: fixed;
|
|
45
|
+
left: 0;
|
|
46
|
+
top: 0;
|
|
47
|
+
z-index: 999999999999;
|
|
48
|
+
width: 80px;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
text-align: center;
|
|
51
|
+
opacity: 0.7;
|
|
52
|
+
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
`, Ue = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
55
|
+
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;
|
|
56
|
+
function Ve({
|
|
57
|
+
titleFontFamily: t,
|
|
58
|
+
descriptionFontFamily: o
|
|
59
|
+
}) {
|
|
60
|
+
var n;
|
|
61
|
+
const s = ge(), i = (n = s == null ? void 0 : s.typography) == null ? void 0 : n.fontFamily;
|
|
62
|
+
B(() => {
|
|
63
|
+
}, [t, o]);
|
|
64
|
+
const r = `${i}, ${Ue}`;
|
|
65
|
+
return /* @__PURE__ */ e(
|
|
66
|
+
q,
|
|
67
|
+
{
|
|
68
|
+
styles: K`
|
|
69
|
+
#app {
|
|
70
|
+
font-family: ${r};
|
|
71
|
+
|
|
72
|
+
.page-kit-section__title {
|
|
73
|
+
font-family: ${r};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.page-kit-section__description {
|
|
77
|
+
font-family: ${r};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
const { SessionProvider: Mt, SessionContext: ze, SessionConsumer: Et, withSession: It } = _e();
|
|
85
|
+
function H() {
|
|
86
|
+
return Se(ze);
|
|
87
|
+
}
|
|
88
|
+
function Ge(...t) {
|
|
89
|
+
var s;
|
|
90
|
+
const { session: o } = H();
|
|
91
|
+
return t.includes((s = o.user) == null ? void 0 : s.role);
|
|
92
|
+
}
|
|
93
|
+
function We(...t) {
|
|
94
|
+
var i;
|
|
95
|
+
const { session: o } = H(), s = Ge(...t);
|
|
96
|
+
return ((i = window.blocklet) == null ? void 0 : i.tenantMode) === "multiple" ? !!o.user : s;
|
|
97
|
+
}
|
|
98
|
+
function Tt() {
|
|
99
|
+
const [t] = ee(), { session: o } = H(), s = We("owner", "admin", "pagesEditor", "member"), i = x(() => {
|
|
100
|
+
const n = t.get("mode");
|
|
101
|
+
return Ee.includes(n) ? n : "production";
|
|
102
|
+
}, [t]), r = i === "production" ? i : o.user ? s ? i : "production" : null;
|
|
103
|
+
return r ? /* @__PURE__ */ e(qe, { mode: r }) : null;
|
|
104
|
+
}
|
|
105
|
+
function qe({ mode: t }) {
|
|
106
|
+
if (t !== "draft") {
|
|
107
|
+
const o = window.__PAGE_STATE__;
|
|
108
|
+
return o ? /* @__PURE__ */ e(A, { mode: t, state: o }) : /* @__PURE__ */ e(Qe, { mode: t, children: ({ state: s }) => /* @__PURE__ */ e(A, { mode: t, state: s }) });
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ e(Ke, { children: ({ state: o }) => /* @__PURE__ */ e(A, { mode: t, state: o }) });
|
|
111
|
+
}
|
|
112
|
+
const Ke = J(() => import("./draft-data-DoNjnkxB.js"));
|
|
113
|
+
function Qe({
|
|
114
|
+
mode: t,
|
|
115
|
+
children: o
|
|
116
|
+
}) {
|
|
117
|
+
const s = document.querySelector('meta[property="pages:version"]'), i = s == null ? void 0 : s.content, r = le(), n = x(() => {
|
|
118
|
+
if (i === "{{pagesPublishedAt}}") {
|
|
119
|
+
const l = localStorage.getItem(ce(r ?? ""));
|
|
120
|
+
return Number(l) ? Number(l) : (/* @__PURE__ */ new Date()).getTime();
|
|
121
|
+
}
|
|
122
|
+
return Number(i);
|
|
123
|
+
}, [i]), { loading: d, value: a } = te(() => $e({ mode: t, version: n }), [t, n]);
|
|
124
|
+
return d ? /* @__PURE__ */ e(He, {}) : a ? o({ state: a }) : null;
|
|
125
|
+
}
|
|
126
|
+
function A({ mode: t, state: o }) {
|
|
127
|
+
const { t: s, locale: i } = V(), [r] = ee(), n = r.get("hiddenBadge") === "true", d = r.get("showPublish") === "true", {
|
|
128
|
+
pageIds: a,
|
|
129
|
+
pages: l,
|
|
130
|
+
routeIds: g,
|
|
131
|
+
routes: p,
|
|
132
|
+
supportedLocales: u,
|
|
133
|
+
config: { defaultLocale: h },
|
|
134
|
+
resources: b
|
|
135
|
+
} = o, v = U(o), y = x(
|
|
136
|
+
() => u != null && u.some((m) => m.locale === i) ? i : void 0,
|
|
137
|
+
[i, u]
|
|
138
|
+
), f = Object.values(l).find((m) => (m == null ? void 0 : m.slug) === "/") ? void 0 : Object.values(l)[0], F = x(
|
|
139
|
+
() => a.map((m) => {
|
|
140
|
+
const c = l[m];
|
|
141
|
+
return c && {
|
|
142
|
+
id: c.id,
|
|
143
|
+
path: j("/", y || "", c.slug, t !== "production" ? `?mode=${t}` : "")
|
|
144
|
+
};
|
|
145
|
+
}).filter(Ie),
|
|
146
|
+
[a, l, y, t]
|
|
147
|
+
), S = ([...m]) => (t !== "production" && d && m.unshift(
|
|
148
|
+
/* @__PURE__ */ e(ke, { fallback: /* @__PURE__ */ e("div", {}), children: /* @__PURE__ */ e(Ye, { mode: "production", state: o }) })
|
|
149
|
+
), m);
|
|
150
|
+
return /* @__PURE__ */ L(Te, { value: { pages: F }, children: [
|
|
151
|
+
/* @__PURE__ */ L(Ce, { children: [
|
|
152
|
+
f && /* @__PURE__ */ e(T, { index: !0, element: /* @__PURE__ */ e(Re, { to: j("/", y || "", f.slug) }) }),
|
|
153
|
+
g == null ? void 0 : g.map((m) => {
|
|
154
|
+
var C, R, M, E;
|
|
155
|
+
const c = p == null ? void 0 : p[m];
|
|
156
|
+
if (!c || !c.displayTemplateId) return null;
|
|
157
|
+
const P = l[c.displayTemplateId];
|
|
158
|
+
return P ? /* @__PURE__ */ e(
|
|
159
|
+
T,
|
|
160
|
+
{
|
|
161
|
+
path: j(":projectIdOrSlug?", c.path),
|
|
162
|
+
element: /* @__PURE__ */ e(
|
|
163
|
+
Xe,
|
|
164
|
+
{
|
|
165
|
+
mode: t,
|
|
166
|
+
components: v,
|
|
167
|
+
page: P,
|
|
168
|
+
locale: y,
|
|
169
|
+
defaultLocale: h,
|
|
170
|
+
headerAddons: S,
|
|
171
|
+
state: o,
|
|
172
|
+
pageData: (E = (M = (R = (C = c.dataSource) == null ? void 0 : C.pathDataMappings) == null ? void 0 : R[c.id]) == null ? void 0 : M.dataCache) == null ? void 0 : E[y || h || "en"]
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
},
|
|
176
|
+
c.id
|
|
177
|
+
) : null;
|
|
178
|
+
}),
|
|
179
|
+
a.map((m) => {
|
|
180
|
+
const c = l[m];
|
|
181
|
+
return c ? /* @__PURE__ */ e(
|
|
182
|
+
T,
|
|
183
|
+
{
|
|
184
|
+
path: j(":projectIdOrSlug?", c.slug),
|
|
185
|
+
element: /* @__PURE__ */ e(
|
|
186
|
+
N,
|
|
187
|
+
{
|
|
188
|
+
mode: t,
|
|
189
|
+
components: v,
|
|
190
|
+
page: c,
|
|
191
|
+
locale: y,
|
|
192
|
+
defaultLocale: h,
|
|
193
|
+
headerAddons: S
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
},
|
|
197
|
+
c.id
|
|
198
|
+
) : null;
|
|
199
|
+
}),
|
|
200
|
+
b.pages && Object.values(b.pages).map(({ blockletId: m, page: c }) => /* @__PURE__ */ e(
|
|
201
|
+
T,
|
|
202
|
+
{
|
|
203
|
+
path: j("/", `@${m}`, c.slug),
|
|
204
|
+
element: /* @__PURE__ */ e(
|
|
205
|
+
N,
|
|
206
|
+
{
|
|
207
|
+
mode: t,
|
|
208
|
+
components: v,
|
|
209
|
+
page: c,
|
|
210
|
+
locale: y,
|
|
211
|
+
defaultLocale: h,
|
|
212
|
+
headerAddons: S
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
},
|
|
216
|
+
c.id
|
|
217
|
+
)),
|
|
218
|
+
/* @__PURE__ */ e(
|
|
219
|
+
T,
|
|
220
|
+
{
|
|
221
|
+
path: "*",
|
|
222
|
+
element: /* @__PURE__ */ e($, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(z, { status: 404, extra: /* @__PURE__ */ e(re, { href: "/", children: s("common.back") }) }) })
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] }),
|
|
226
|
+
t !== "production" && !n && /* @__PURE__ */ e(De, { sx: { bgcolor: "info.light" }, children: t }),
|
|
227
|
+
/* @__PURE__ */ e(Ve, {})
|
|
228
|
+
] });
|
|
229
|
+
}
|
|
230
|
+
function Xe({
|
|
231
|
+
mode: t,
|
|
232
|
+
pageData: o,
|
|
233
|
+
components: s,
|
|
234
|
+
page: i,
|
|
235
|
+
locale: r,
|
|
236
|
+
defaultLocale: n,
|
|
237
|
+
headerAddons: d,
|
|
238
|
+
state: a
|
|
239
|
+
}) {
|
|
240
|
+
const l = X({
|
|
241
|
+
page: null
|
|
242
|
+
});
|
|
243
|
+
B(() => {
|
|
244
|
+
const p = i || null;
|
|
245
|
+
p ? l.page = _(p) : l.page = null;
|
|
246
|
+
}, [i, l]);
|
|
247
|
+
const g = Z();
|
|
248
|
+
return B(() => {
|
|
249
|
+
Y(o, g.current) || o && l.page && (G(l.page, a, r, o), g.current = _(o));
|
|
250
|
+
}, [l.page, o, r, a]), l.page ? /* @__PURE__ */ e(
|
|
251
|
+
N,
|
|
252
|
+
{
|
|
253
|
+
mode: t,
|
|
254
|
+
components: s,
|
|
255
|
+
page: l.page,
|
|
256
|
+
locale: r,
|
|
257
|
+
defaultLocale: n,
|
|
258
|
+
headerAddons: d
|
|
259
|
+
}
|
|
260
|
+
) : null;
|
|
261
|
+
}
|
|
262
|
+
function jt({
|
|
263
|
+
mode: t,
|
|
264
|
+
state: o,
|
|
265
|
+
path: s,
|
|
266
|
+
pageData: i
|
|
267
|
+
}) {
|
|
268
|
+
const { t: r, locale: n } = V(), {
|
|
269
|
+
pages: d,
|
|
270
|
+
supportedLocales: a,
|
|
271
|
+
config: { defaultLocale: l },
|
|
272
|
+
resources: g
|
|
273
|
+
} = o, p = Object.values(d).find((f) => (f == null ? void 0 : f.slug) === s), u = Object.values(g.pages || {}).find((f) => f.page.slug === s), h = x(
|
|
274
|
+
() => a != null && a.some((f) => f.locale === n) ? n : void 0,
|
|
275
|
+
[n, a]
|
|
276
|
+
), b = X({
|
|
277
|
+
page: null
|
|
278
|
+
});
|
|
279
|
+
B(() => {
|
|
280
|
+
const f = p || (u == null ? void 0 : u.page) || null;
|
|
281
|
+
f ? b.page = _(f) : b.page = null;
|
|
282
|
+
}, [p, u]);
|
|
283
|
+
const v = Z();
|
|
284
|
+
if (B(() => {
|
|
285
|
+
Y(i, v.current) || i && b.page && (G(b.page, o, h, i), v.current = _(i));
|
|
286
|
+
}, [{}]), !p && !(u != null && u.page))
|
|
287
|
+
return /* @__PURE__ */ e($, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(z, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ e(re, { href: "/", children: r("common.back") }) }) });
|
|
288
|
+
const y = U(o);
|
|
289
|
+
return b.page ? /* @__PURE__ */ e(
|
|
290
|
+
N,
|
|
291
|
+
{
|
|
292
|
+
mode: t,
|
|
293
|
+
components: y,
|
|
294
|
+
page: b.page,
|
|
295
|
+
locale: h,
|
|
296
|
+
defaultLocale: l
|
|
297
|
+
}
|
|
298
|
+
) : null;
|
|
299
|
+
}
|
|
300
|
+
function N({
|
|
301
|
+
mode: t,
|
|
302
|
+
components: o,
|
|
303
|
+
page: s,
|
|
304
|
+
locale: i,
|
|
305
|
+
defaultLocale: r,
|
|
306
|
+
headerAddons: n
|
|
307
|
+
}) {
|
|
308
|
+
var F, S, m, c, P, C, R, M, E;
|
|
309
|
+
const d = me(), a = ((F = s.locales) == null ? void 0 : F[i]) ?? ((S = s.locales) == null ? void 0 : S[r]) ?? {}, l = a.title || ((m = window.blocklet) == null ? void 0 : m.appName), g = a.description || ((c = window.blocklet) == null ? void 0 : c.appDescription), p = ie(ae(a.image), 540), { logo: u, brand: h, description: b, ...v } = ue(), y = x(
|
|
310
|
+
() => (k) => {
|
|
311
|
+
var I;
|
|
312
|
+
let w = (n == null ? void 0 : n(k)) ?? k;
|
|
313
|
+
return w = ((I = v.addons) == null ? void 0 : I.call(v, w)) ?? w, w;
|
|
314
|
+
},
|
|
315
|
+
[v.addons, n]
|
|
316
|
+
), f = (P = a.header) != null && P.translucent ? Ze : ne;
|
|
317
|
+
return /* @__PURE__ */ L(je, { page: s, defaultLocale: r, currentLocale: i, children: [
|
|
318
|
+
/* @__PURE__ */ e(
|
|
319
|
+
q,
|
|
320
|
+
{
|
|
321
|
+
styles: K`
|
|
322
|
+
body {
|
|
323
|
+
background-color: ${d(
|
|
324
|
+
!a.backgroundColor || a.backgroundColor === "transparent" ? "background.default" : a.backgroundColor
|
|
325
|
+
)} !important;
|
|
326
|
+
}
|
|
327
|
+
`
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
/* @__PURE__ */ e(
|
|
331
|
+
f,
|
|
332
|
+
{
|
|
333
|
+
hideNavMenu: !!((C = a.header) != null && C.hideNavMenus),
|
|
334
|
+
translucentTextColor: (R = a.header) == null ? void 0 : R.translucentTextColor,
|
|
335
|
+
...u ? { logo: u } : {},
|
|
336
|
+
...h ? { brand: h } : {},
|
|
337
|
+
...b ? { description: b } : {},
|
|
338
|
+
className: W(((M = a.header) == null ? void 0 : M.sticky) && "sticky", "page-header"),
|
|
339
|
+
maxWidth: !1,
|
|
340
|
+
addons: y
|
|
341
|
+
}
|
|
342
|
+
),
|
|
343
|
+
/* @__PURE__ */ e(Me, {}),
|
|
344
|
+
/* @__PURE__ */ L(Pe, { children: [
|
|
345
|
+
/* @__PURE__ */ e("title", { children: l }),
|
|
346
|
+
/* @__PURE__ */ e("meta", { name: "og:title", content: l }),
|
|
347
|
+
/* @__PURE__ */ e("meta", { name: "og:description", content: g }),
|
|
348
|
+
/* @__PURE__ */ e("meta", { name: "og:image", content: p }),
|
|
349
|
+
/* @__PURE__ */ e("meta", { name: "twitter:image:src", content: p }),
|
|
350
|
+
/* @__PURE__ */ e("meta", { name: "twitter:image", content: p }),
|
|
351
|
+
/* @__PURE__ */ e("meta", { property: "twitter:description", content: g }),
|
|
352
|
+
/* @__PURE__ */ e("meta", { property: "twitter:title", content: l }),
|
|
353
|
+
/* @__PURE__ */ e("meta", { name: "description", content: g })
|
|
354
|
+
] }),
|
|
355
|
+
/* @__PURE__ */ e(
|
|
356
|
+
he,
|
|
357
|
+
{
|
|
358
|
+
flexGrow: 1,
|
|
359
|
+
className: "PageView-root",
|
|
360
|
+
sx: {
|
|
361
|
+
// 第一个 .BlockBase-root 的 pt 为 0
|
|
362
|
+
"& .BlockBase-root:first-child": {
|
|
363
|
+
pt: "0 !important"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
children: s.sectionIds.map((k) => {
|
|
367
|
+
var D, O;
|
|
368
|
+
const w = s.sections[k];
|
|
369
|
+
if (!w || w.visibility === "hidden") return null;
|
|
370
|
+
const I = (D = w.locales) == null ? void 0 : D[i], se = ((O = w.locales) == null ? void 0 : O[r]) ?? {};
|
|
371
|
+
return /* @__PURE__ */ e(
|
|
372
|
+
Be,
|
|
373
|
+
{
|
|
374
|
+
id: k,
|
|
375
|
+
type: w.component,
|
|
376
|
+
mode: t,
|
|
377
|
+
section: w,
|
|
378
|
+
config: {
|
|
379
|
+
...we(I) ? se : I,
|
|
380
|
+
locale: i,
|
|
381
|
+
dev: t === "draft" ? {
|
|
382
|
+
mode: t,
|
|
383
|
+
components: o,
|
|
384
|
+
defaultLocale: r
|
|
385
|
+
} : { mode: t }
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
k
|
|
389
|
+
);
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
!((E = a.footer) != null && E.hidden) && /* @__PURE__ */ e(Ae, {})
|
|
394
|
+
] });
|
|
395
|
+
}
|
|
396
|
+
const Ye = J(() => import("./publish-button-CAJErJjj.js")), ne = Q(pe)`
|
|
397
|
+
&.sticky {
|
|
398
|
+
position: sticky;
|
|
399
|
+
top: 0;
|
|
400
|
+
}
|
|
401
|
+
`;
|
|
402
|
+
function Je({ logo: t }) {
|
|
403
|
+
const [o, s] = xe(), i = be((n) => n.breakpoints.down("sm")), { value: r } = te(() => {
|
|
404
|
+
var a, l;
|
|
405
|
+
const n = new URL(
|
|
406
|
+
i ? ((a = window == null ? void 0 : window.blocklet) == null ? void 0 : a.appLogo) || "/.well-known/service/blocklet/logo" : ((l = window == null ? void 0 : window.blocklet) == null ? void 0 : l.appLogoRect) || "/.well-known/service/blocklet/logo-rect",
|
|
407
|
+
window.location.origin
|
|
408
|
+
);
|
|
409
|
+
n.searchParams.delete("imageFilter"), n.searchParams.delete("f");
|
|
410
|
+
const d = n.toString();
|
|
411
|
+
return new Promise((g) => {
|
|
412
|
+
fetch(d).then((p) => {
|
|
413
|
+
const u = p.headers.get("content-type");
|
|
414
|
+
u != null && u.includes("svg") && p.text().then((h) => {
|
|
415
|
+
s(h), g(null);
|
|
416
|
+
}), g(p.url);
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
}, [i]);
|
|
420
|
+
if (t)
|
|
421
|
+
return t;
|
|
422
|
+
if (o)
|
|
423
|
+
return /* @__PURE__ */ e($, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: ye.sanitize(o) } });
|
|
424
|
+
if (r) {
|
|
425
|
+
const n = new URL(r);
|
|
426
|
+
n.searchParams.set("imageFilter", "convert"), n.searchParams.set("f", "png"), n.searchParams.set("h", "80");
|
|
427
|
+
const d = n.toString();
|
|
428
|
+
return /* @__PURE__ */ e("img", { src: d, alt: "logo" });
|
|
429
|
+
}
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
function Ze({
|
|
433
|
+
logo: t,
|
|
434
|
+
translucentTextColor: o,
|
|
435
|
+
...s
|
|
436
|
+
}) {
|
|
437
|
+
const { top: i = 0 } = ve(() => document.getElementById("app")) || {};
|
|
438
|
+
let r = Math.min(i / 800, 1), n = "";
|
|
439
|
+
if (r > 0.1) {
|
|
440
|
+
r = Math.max(r, 0.6);
|
|
441
|
+
const d = Math.round(255 * Math.min(1 - r, 0.2));
|
|
442
|
+
n = `rgb(${d}, ${d}, ${d})`;
|
|
443
|
+
} else
|
|
444
|
+
n = o || "#EEEEEE";
|
|
445
|
+
return /* @__PURE__ */ e(
|
|
446
|
+
ne,
|
|
447
|
+
{
|
|
448
|
+
logo: /* @__PURE__ */ e(Je, { logo: t }),
|
|
449
|
+
...s,
|
|
450
|
+
className: W(r <= 0.7 && "reverse-color"),
|
|
451
|
+
style: {
|
|
452
|
+
backgroundColor: `rgba(255,255,255,${r})`,
|
|
453
|
+
// @ts-ignore
|
|
454
|
+
"--logo-invert": r <= 0.7 ? 1 - r / 6 : 1 - r
|
|
455
|
+
},
|
|
456
|
+
sx: {
|
|
457
|
+
backdropFilter: r >= 0.6 ? "blur(10px)" : "blur(0px)",
|
|
458
|
+
transition: "all 0.3s ease",
|
|
459
|
+
position: "fixed !important",
|
|
460
|
+
left: 0,
|
|
461
|
+
top: 0,
|
|
462
|
+
right: 0,
|
|
463
|
+
bgcolor: "transparent",
|
|
464
|
+
"&.reverse-color": {
|
|
465
|
+
".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
|
|
466
|
+
color: `${n} !important`
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
".header-logo > div": {
|
|
470
|
+
filter: "invert(var(--logo-invert))"
|
|
471
|
+
},
|
|
472
|
+
".header-logo": {
|
|
473
|
+
color: n
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
const re = Q(fe)``;
|
|
480
|
+
export {
|
|
481
|
+
Tt as H,
|
|
482
|
+
He as L,
|
|
483
|
+
A as P,
|
|
484
|
+
Ze as T,
|
|
485
|
+
qe as a,
|
|
486
|
+
Xe as b,
|
|
487
|
+
jt as c,
|
|
488
|
+
N as d
|
|
489
|
+
};
|
|
@@ -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-Crb2pbrM.js";
|
|
13
13
|
import { p as ue, g as me } from "./array-CWudJ_mc.js";
|
|
14
14
|
function pe(r) {
|
|
15
15
|
const [m, h] = D(!1);
|
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-CWudJ_mc.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-Crb2pbrM.js";
|
|
25
25
|
export {
|
|
26
26
|
B as HomeView,
|
|
27
27
|
D as PageRoutes,
|
package/lib/es/theme.js
CHANGED
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.128",
|
|
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
|
|
209
|
-
"@blocklet/pages-kit": "^0.4.
|
|
208
|
+
"@blocklet/pages-kit": "^0.4.128",
|
|
209
|
+
"@blocklet/pages-kit-block-studio": "^0.4.128"
|
|
210
210
|
},
|
|
211
211
|
"devDependencies": {
|
|
212
212
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),_=require("./state-5jwYHuoB.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-3OBY1z8c.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
|
-
& > div > .MuiContainer-root {
|
|
3
|
-
max-width: unset;
|
|
4
|
-
}
|
|
5
|
-
`;function _e({meta:e,...n}){const o=$.useTheme();return t.jsx(Re,{...n,meta:e,theme:o||{}})}function te(e){return t.jsx(S.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...e,children:t.jsx(S.CircularProgress,{size:30})})}function qe(e){return t.jsx(Ce,{...e})}const Ce=$.styled(S.Box)`
|
|
6
|
-
position: fixed;
|
|
7
|
-
left: 0;
|
|
8
|
-
top: 0;
|
|
9
|
-
z-index: 999999999999;
|
|
10
|
-
width: 80px;
|
|
11
|
-
font-size: 12px;
|
|
12
|
-
text-align: center;
|
|
13
|
-
opacity: 0.7;
|
|
14
|
-
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
`,Me=e=>new Promise((n,o)=>{(e==null?void 0:e.length)>0?ke.default.load({google:{families:e},fontactive:()=>{n("success")},fontinactive:()=>{o(new Error("load font fail"))}}):n("success")}),U=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
17
|
-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`,J={};function Ee({titleFontFamily:e,descriptionFontFamily:n}){var s;const o=S.useTheme(),r=(s=o==null?void 0:o.typography)==null?void 0:s.fontFamily,a=async l=>{if(l&&!document.querySelectorAll(`link[href*="${l}" i]`).length)try{J[l]||(await Me([l]),J[l]=!0)}catch(i){console.error(i)}};return p.useEffect(()=>{e&&a(e),n&&a(n)},[e,n]),t.jsx(L.Global,{styles:L.css`
|
|
18
|
-
#app {
|
|
19
|
-
font-family: ${JSON.stringify(r)}, ${U};
|
|
20
|
-
|
|
21
|
-
.page-kit-section__title {
|
|
22
|
-
font-family: ${JSON.stringify(e??r)}, ${U};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.page-kit-section__description {
|
|
26
|
-
font-family: ${JSON.stringify(n??r)}, ${U};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
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-C4FzOyR5.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
|
-
body {
|
|
31
|
-
background-color: ${l(!i.backgroundColor||i.backgroundColor==="transparent"?"background.default":i.backgroundColor)} !important;
|
|
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 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-gJaGa548.js"))),se=Z.default(ve.default)`
|
|
34
|
-
&.sticky {
|
|
35
|
-
position: sticky;
|
|
36
|
-
top: 0;
|
|
37
|
-
}
|
|
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,507 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as O } from "react/jsx-runtime";
|
|
2
|
-
import { d as G, e as ce, g as le, u as ue, c as me } from "./state-DNndJ33Y.js";
|
|
3
|
-
import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
-
import q from "@arcblock/ux/lib/Result";
|
|
5
|
-
import { useHeaderState as pe } from "@blocklet/pages-kit/builtin/page/header";
|
|
6
|
-
import { useColorConvert as de } from "@blocklet/pages-kit/contexts/color";
|
|
7
|
-
import { setPageDataSource as J } from "@blocklet/pages-kit/utils/data-source";
|
|
8
|
-
import ge from "@blocklet/ui-react/lib/Header";
|
|
9
|
-
import { cx as K } from "@emotion/css";
|
|
10
|
-
import { Global as Q, css as X } from "@emotion/react";
|
|
11
|
-
import Y from "@emotion/styled";
|
|
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, useScroll as we } from "ahooks";
|
|
14
|
-
import Se from "isomorphic-dompurify";
|
|
15
|
-
import _ from "lodash/cloneDeep";
|
|
16
|
-
import ke from "lodash/isEmpty";
|
|
17
|
-
import F from "lodash/isEqual";
|
|
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-CWudJ_mc.js";
|
|
24
|
-
import { styled as re, useTheme as _e } from "@arcblock/ux/lib/Theme";
|
|
25
|
-
import Ae from "@blocklet/ui-react/lib/Footer";
|
|
26
|
-
import He from "webfontloader";
|
|
27
|
-
import { createAuthServiceSessionContext as De } from "@arcblock/did-connect/lib/Session";
|
|
28
|
-
const Le = re(Ae, { shouldForwardProp: (e) => !!e })`
|
|
29
|
-
& > div > .MuiContainer-root {
|
|
30
|
-
max-width: unset;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
function Ue({ meta: e, ...o }) {
|
|
34
|
-
const n = _e();
|
|
35
|
-
return /* @__PURE__ */ t(Le, { ...o, meta: e, theme: n || {} });
|
|
36
|
-
}
|
|
37
|
-
function Ve(e) {
|
|
38
|
-
return /* @__PURE__ */ t(B, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...e, children: /* @__PURE__ */ t(fe, { size: 30 }) });
|
|
39
|
-
}
|
|
40
|
-
function ze(e) {
|
|
41
|
-
return /* @__PURE__ */ t(Ge, { ...e });
|
|
42
|
-
}
|
|
43
|
-
const Ge = re(B)`
|
|
44
|
-
position: fixed;
|
|
45
|
-
left: 0;
|
|
46
|
-
top: 0;
|
|
47
|
-
z-index: 999999999999;
|
|
48
|
-
width: 80px;
|
|
49
|
-
font-size: 12px;
|
|
50
|
-
text-align: center;
|
|
51
|
-
opacity: 0.7;
|
|
52
|
-
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
53
|
-
pointer-events: none;
|
|
54
|
-
`, We = (e) => new Promise((o, n) => {
|
|
55
|
-
(e == null ? void 0 : e.length) > 0 ? He.load({
|
|
56
|
-
google: {
|
|
57
|
-
families: e
|
|
58
|
-
},
|
|
59
|
-
fontactive: () => {
|
|
60
|
-
o("success");
|
|
61
|
-
},
|
|
62
|
-
fontinactive: () => {
|
|
63
|
-
n(new Error("load font fail"));
|
|
64
|
-
}
|
|
65
|
-
}) : o("success");
|
|
66
|
-
}), H = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
67
|
-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`, z = {};
|
|
68
|
-
function qe({
|
|
69
|
-
titleFontFamily: e,
|
|
70
|
-
descriptionFontFamily: o
|
|
71
|
-
}) {
|
|
72
|
-
var r;
|
|
73
|
-
const n = he(), s = (r = n == null ? void 0 : n.typography) == null ? void 0 : r.fontFamily, i = async (l) => {
|
|
74
|
-
if (l && !document.querySelectorAll(`link[href*="${l}" i]`).length)
|
|
75
|
-
try {
|
|
76
|
-
z[l] || (await We([l]), z[l] = !0);
|
|
77
|
-
} catch (a) {
|
|
78
|
-
console.error(a);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
return $(() => {
|
|
82
|
-
e && i(e), o && i(o);
|
|
83
|
-
}, [e, o]), /* @__PURE__ */ t(
|
|
84
|
-
Q,
|
|
85
|
-
{
|
|
86
|
-
styles: X`
|
|
87
|
-
#app {
|
|
88
|
-
font-family: ${JSON.stringify(s)}, ${H};
|
|
89
|
-
|
|
90
|
-
.page-kit-section__title {
|
|
91
|
-
font-family: ${JSON.stringify(e ?? s)}, ${H};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.page-kit-section__description {
|
|
95
|
-
font-family: ${JSON.stringify(o ?? s)}, ${H};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
const { SessionProvider: Tt, SessionContext: Je, SessionConsumer: jt, withSession: $t } = De();
|
|
103
|
-
function L() {
|
|
104
|
-
return Pe(Je);
|
|
105
|
-
}
|
|
106
|
-
function Ke(...e) {
|
|
107
|
-
var n;
|
|
108
|
-
const { session: o } = L();
|
|
109
|
-
return e.includes((n = o.user) == null ? void 0 : n.role);
|
|
110
|
-
}
|
|
111
|
-
function Qe(...e) {
|
|
112
|
-
var s;
|
|
113
|
-
const { session: o } = L(), n = Ke(...e);
|
|
114
|
-
return ((s = window.blocklet) == null ? void 0 : s.tenantMode) === "multiple" ? !!o.user : n;
|
|
115
|
-
}
|
|
116
|
-
function Bt() {
|
|
117
|
-
const [e] = oe(), { session: o } = L(), n = Qe("owner", "admin", "pagesEditor", "member"), s = P(() => {
|
|
118
|
-
const r = e.get("mode");
|
|
119
|
-
return Te.includes(r) ? r : "production";
|
|
120
|
-
}, [e]), i = s === "production" ? s : o.user ? n ? s : "production" : null;
|
|
121
|
-
return i ? /* @__PURE__ */ t(Xe, { mode: i }) : null;
|
|
122
|
-
}
|
|
123
|
-
function Xe({ mode: e }) {
|
|
124
|
-
if (e !== "draft") {
|
|
125
|
-
const o = window.__PAGE_STATE__;
|
|
126
|
-
return o ? /* @__PURE__ */ t(D, { mode: e, state: o }) : /* @__PURE__ */ t(Ze, { mode: e, children: ({ state: n }) => /* @__PURE__ */ t(D, { mode: e, state: n }) });
|
|
127
|
-
}
|
|
128
|
-
return /* @__PURE__ */ t(Ye, { children: ({ state: o }) => /* @__PURE__ */ t(D, { mode: e, state: o }) });
|
|
129
|
-
}
|
|
130
|
-
const Ye = ee(() => import("./draft-data-DoNjnkxB.js"));
|
|
131
|
-
function Ze({
|
|
132
|
-
mode: e,
|
|
133
|
-
children: o
|
|
134
|
-
}) {
|
|
135
|
-
const n = document.querySelector('meta[property="pages:version"]'), s = n == null ? void 0 : n.content, i = ue(), r = P(() => {
|
|
136
|
-
if (s === "{{pagesPublishedAt}}") {
|
|
137
|
-
const c = localStorage.getItem(me(i ?? ""));
|
|
138
|
-
return Number(c) ? Number(c) : (/* @__PURE__ */ new Date()).getTime();
|
|
139
|
-
}
|
|
140
|
-
return Number(s);
|
|
141
|
-
}, [s]), { loading: l, value: a } = ne(() => Oe({ mode: e, version: r }), [e, r]);
|
|
142
|
-
return l ? /* @__PURE__ */ t(Ve, {}) : a ? o({ state: a }) : null;
|
|
143
|
-
}
|
|
144
|
-
function D({ mode: e, state: o }) {
|
|
145
|
-
const { t: n, locale: s } = W(), [i] = oe(), r = i.get("hiddenBadge") === "true", l = i.get("showPublish") === "true", {
|
|
146
|
-
pageIds: a,
|
|
147
|
-
pages: c,
|
|
148
|
-
routeIds: g,
|
|
149
|
-
routes: d,
|
|
150
|
-
supportedLocales: m,
|
|
151
|
-
config: { defaultLocale: h },
|
|
152
|
-
resources: b
|
|
153
|
-
} = o, y = G(o), v = P(
|
|
154
|
-
() => m != null && m.some((p) => p.locale === s) ? s : void 0,
|
|
155
|
-
[s, m]
|
|
156
|
-
), f = Object.values(c).find((p) => (p == null ? void 0 : p.slug) === "/") ? void 0 : Object.values(c)[0], N = P(
|
|
157
|
-
() => a.map((p) => {
|
|
158
|
-
const u = c[p];
|
|
159
|
-
return u && {
|
|
160
|
-
id: u.id,
|
|
161
|
-
path: j("/", v || "", u.slug, e !== "production" ? `?mode=${e}` : "")
|
|
162
|
-
};
|
|
163
|
-
}).filter(je),
|
|
164
|
-
[a, c, v, e]
|
|
165
|
-
), S = ([...p]) => (e !== "production" && l && p.unshift(
|
|
166
|
-
/* @__PURE__ */ t(xe, { fallback: /* @__PURE__ */ t("div", {}), children: /* @__PURE__ */ t(et, { mode: "production", state: o }) })
|
|
167
|
-
), p);
|
|
168
|
-
return /* @__PURE__ */ O($e, { value: { pages: N }, children: [
|
|
169
|
-
/* @__PURE__ */ O(Ee, { children: [
|
|
170
|
-
f && /* @__PURE__ */ t(T, { index: !0, element: /* @__PURE__ */ t(Me, { to: j("/", v || "", f.slug) }) }),
|
|
171
|
-
g == null ? void 0 : g.map((p) => {
|
|
172
|
-
var C, R, E, M;
|
|
173
|
-
const u = d == null ? void 0 : d[p];
|
|
174
|
-
if (!u || !u.displayTemplateId) return null;
|
|
175
|
-
const x = c[u.displayTemplateId];
|
|
176
|
-
return x ? /* @__PURE__ */ t(
|
|
177
|
-
T,
|
|
178
|
-
{
|
|
179
|
-
path: j(":projectIdOrSlug?", u.path),
|
|
180
|
-
element: /* @__PURE__ */ t(
|
|
181
|
-
Fe,
|
|
182
|
-
{
|
|
183
|
-
mode: e,
|
|
184
|
-
components: y,
|
|
185
|
-
page: x,
|
|
186
|
-
locale: v,
|
|
187
|
-
defaultLocale: h,
|
|
188
|
-
headerAddons: S,
|
|
189
|
-
state: o,
|
|
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
|
-
}
|
|
192
|
-
)
|
|
193
|
-
},
|
|
194
|
-
u.id
|
|
195
|
-
) : null;
|
|
196
|
-
}),
|
|
197
|
-
a.map((p) => {
|
|
198
|
-
const u = c[p];
|
|
199
|
-
return u ? /* @__PURE__ */ t(
|
|
200
|
-
T,
|
|
201
|
-
{
|
|
202
|
-
path: j(":projectIdOrSlug?", u.slug),
|
|
203
|
-
element: /* @__PURE__ */ t(
|
|
204
|
-
A,
|
|
205
|
-
{
|
|
206
|
-
mode: e,
|
|
207
|
-
components: y,
|
|
208
|
-
page: u,
|
|
209
|
-
locale: v,
|
|
210
|
-
defaultLocale: h,
|
|
211
|
-
headerAddons: S
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
},
|
|
215
|
-
u.id
|
|
216
|
-
) : null;
|
|
217
|
-
}),
|
|
218
|
-
b.pages && Object.values(b.pages).map(({ blockletId: p, page: u }) => /* @__PURE__ */ t(
|
|
219
|
-
T,
|
|
220
|
-
{
|
|
221
|
-
path: j("/", `@${p}`, u.slug),
|
|
222
|
-
element: /* @__PURE__ */ t(
|
|
223
|
-
A,
|
|
224
|
-
{
|
|
225
|
-
mode: e,
|
|
226
|
-
components: y,
|
|
227
|
-
page: u,
|
|
228
|
-
locale: v,
|
|
229
|
-
defaultLocale: h,
|
|
230
|
-
headerAddons: S
|
|
231
|
-
}
|
|
232
|
-
)
|
|
233
|
-
},
|
|
234
|
-
u.id
|
|
235
|
-
)),
|
|
236
|
-
/* @__PURE__ */ t(
|
|
237
|
-
T,
|
|
238
|
-
{
|
|
239
|
-
path: "*",
|
|
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") }) }) })
|
|
241
|
-
}
|
|
242
|
-
)
|
|
243
|
-
] }),
|
|
244
|
-
e !== "production" && !r && /* @__PURE__ */ t(ze, { sx: { bgcolor: "info.light" }, children: e }),
|
|
245
|
-
/* @__PURE__ */ t(qe, {})
|
|
246
|
-
] });
|
|
247
|
-
}
|
|
248
|
-
function Fe({
|
|
249
|
-
mode: e,
|
|
250
|
-
pageData: o,
|
|
251
|
-
components: n,
|
|
252
|
-
page: s,
|
|
253
|
-
locale: i,
|
|
254
|
-
defaultLocale: r,
|
|
255
|
-
headerAddons: l,
|
|
256
|
-
state: a
|
|
257
|
-
}) {
|
|
258
|
-
const c = Z({
|
|
259
|
-
page: null
|
|
260
|
-
});
|
|
261
|
-
$(() => {
|
|
262
|
-
const d = s || null;
|
|
263
|
-
d ? c.page = _(d) : c.page = null;
|
|
264
|
-
}, [s, c]);
|
|
265
|
-
const g = te();
|
|
266
|
-
return $(() => {
|
|
267
|
-
F(o, g.current) || o && c.page && (J(c.page, a, i, o), g.current = _(o));
|
|
268
|
-
}, [c.page, o, i, a]), c.page ? /* @__PURE__ */ t(
|
|
269
|
-
A,
|
|
270
|
-
{
|
|
271
|
-
mode: e,
|
|
272
|
-
components: n,
|
|
273
|
-
page: c.page,
|
|
274
|
-
locale: i,
|
|
275
|
-
defaultLocale: r,
|
|
276
|
-
headerAddons: l
|
|
277
|
-
}
|
|
278
|
-
) : null;
|
|
279
|
-
}
|
|
280
|
-
function Nt({
|
|
281
|
-
mode: e,
|
|
282
|
-
state: o,
|
|
283
|
-
path: n,
|
|
284
|
-
pageData: s
|
|
285
|
-
}) {
|
|
286
|
-
const { t: i, locale: r } = W(), {
|
|
287
|
-
pages: l,
|
|
288
|
-
supportedLocales: a,
|
|
289
|
-
config: { defaultLocale: c },
|
|
290
|
-
resources: g
|
|
291
|
-
} = o, d = Object.values(l).find((f) => (f == null ? void 0 : f.slug) === n), m = Object.values(g.pages || {}).find((f) => f.page.slug === n), h = P(
|
|
292
|
-
() => a != null && a.some((f) => f.locale === r) ? r : void 0,
|
|
293
|
-
[r, a]
|
|
294
|
-
), b = Z({
|
|
295
|
-
page: null
|
|
296
|
-
});
|
|
297
|
-
$(() => {
|
|
298
|
-
const f = d || (m == null ? void 0 : m.page) || null;
|
|
299
|
-
f ? b.page = _(f) : b.page = null;
|
|
300
|
-
}, [d, m]);
|
|
301
|
-
const y = te();
|
|
302
|
-
if ($(() => {
|
|
303
|
-
F(s, y.current) || s && b.page && (J(b.page, o, h, s), y.current = _(s));
|
|
304
|
-
}, [{}]), !d && !(m != null && m.page))
|
|
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 = G(o);
|
|
307
|
-
return b.page ? /* @__PURE__ */ t(
|
|
308
|
-
A,
|
|
309
|
-
{
|
|
310
|
-
mode: e,
|
|
311
|
-
components: v,
|
|
312
|
-
page: b.page,
|
|
313
|
-
locale: h,
|
|
314
|
-
defaultLocale: c
|
|
315
|
-
}
|
|
316
|
-
) : null;
|
|
317
|
-
}
|
|
318
|
-
function A({
|
|
319
|
-
mode: e,
|
|
320
|
-
components: o,
|
|
321
|
-
page: n,
|
|
322
|
-
locale: s,
|
|
323
|
-
defaultLocale: i,
|
|
324
|
-
headerAddons: r
|
|
325
|
-
}) {
|
|
326
|
-
var N, S, p, u, x, C, R, E, M;
|
|
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
|
-
() => (k) => {
|
|
329
|
-
var I;
|
|
330
|
-
let w = (r == null ? void 0 : r(k)) ?? k;
|
|
331
|
-
return w = ((I = y.addons) == null ? void 0 : I.call(y, w)) ?? w, w;
|
|
332
|
-
},
|
|
333
|
-
[y.addons, r]
|
|
334
|
-
), f = (x = a.header) != null && x.translucent ? ot : se;
|
|
335
|
-
return /* @__PURE__ */ O(Be, { page: n, defaultLocale: i, currentLocale: s, children: [
|
|
336
|
-
/* @__PURE__ */ t(
|
|
337
|
-
Q,
|
|
338
|
-
{
|
|
339
|
-
styles: X`
|
|
340
|
-
body {
|
|
341
|
-
background-color: ${l(
|
|
342
|
-
!a.backgroundColor || a.backgroundColor === "transparent" ? "background.default" : a.backgroundColor
|
|
343
|
-
)} !important;
|
|
344
|
-
}
|
|
345
|
-
`
|
|
346
|
-
}
|
|
347
|
-
),
|
|
348
|
-
/* @__PURE__ */ t(
|
|
349
|
-
f,
|
|
350
|
-
{
|
|
351
|
-
hideNavMenu: !!((C = a.header) != null && C.hideNavMenus),
|
|
352
|
-
translucentTextColor: (R = a.header) == null ? void 0 : R.translucentTextColor,
|
|
353
|
-
...m ? { logo: m } : {},
|
|
354
|
-
...h ? { brand: h } : {},
|
|
355
|
-
...b ? { description: b } : {},
|
|
356
|
-
className: K(((E = a.header) == null ? void 0 : E.sticky) && "sticky", "page-header"),
|
|
357
|
-
maxWidth: !1,
|
|
358
|
-
addons: v
|
|
359
|
-
}
|
|
360
|
-
),
|
|
361
|
-
/* @__PURE__ */ t(Ie, {}),
|
|
362
|
-
/* @__PURE__ */ O(Re, { children: [
|
|
363
|
-
/* @__PURE__ */ t("title", { children: c }),
|
|
364
|
-
/* @__PURE__ */ t("meta", { name: "og:title", content: c }),
|
|
365
|
-
/* @__PURE__ */ t("meta", { name: "og:description", content: g }),
|
|
366
|
-
/* @__PURE__ */ t("meta", { name: "og:image", content: d }),
|
|
367
|
-
/* @__PURE__ */ t("meta", { name: "twitter:image:src", content: d }),
|
|
368
|
-
/* @__PURE__ */ t("meta", { name: "twitter:image", content: d }),
|
|
369
|
-
/* @__PURE__ */ t("meta", { property: "twitter:description", content: g }),
|
|
370
|
-
/* @__PURE__ */ t("meta", { property: "twitter:title", content: c }),
|
|
371
|
-
/* @__PURE__ */ t("meta", { name: "description", content: g })
|
|
372
|
-
] }),
|
|
373
|
-
/* @__PURE__ */ t(
|
|
374
|
-
ye,
|
|
375
|
-
{
|
|
376
|
-
flexGrow: 1,
|
|
377
|
-
className: "PageView-root",
|
|
378
|
-
sx: {
|
|
379
|
-
// 第一个 .BlockBase-root 的 pt 为 0
|
|
380
|
-
"& .BlockBase-root:first-child": {
|
|
381
|
-
pt: "0 !important"
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
children: n.sectionIds.map((k) => {
|
|
385
|
-
var U, V;
|
|
386
|
-
const w = n.sections[k];
|
|
387
|
-
if (!w || w.visibility === "hidden") return null;
|
|
388
|
-
const I = (U = w.locales) == null ? void 0 : U[s], ae = ((V = w.locales) == null ? void 0 : V[i]) ?? {};
|
|
389
|
-
return /* @__PURE__ */ t(
|
|
390
|
-
Ne,
|
|
391
|
-
{
|
|
392
|
-
id: k,
|
|
393
|
-
type: w.component,
|
|
394
|
-
mode: e,
|
|
395
|
-
section: w,
|
|
396
|
-
config: {
|
|
397
|
-
...ke(I) ? ae : I,
|
|
398
|
-
locale: s,
|
|
399
|
-
dev: e === "draft" ? {
|
|
400
|
-
mode: e,
|
|
401
|
-
components: o,
|
|
402
|
-
defaultLocale: i
|
|
403
|
-
} : { mode: e }
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
k
|
|
407
|
-
);
|
|
408
|
-
})
|
|
409
|
-
}
|
|
410
|
-
),
|
|
411
|
-
!((M = a.footer) != null && M.hidden) && /* @__PURE__ */ t(Ue, {})
|
|
412
|
-
] });
|
|
413
|
-
}
|
|
414
|
-
const et = ee(() => import("./publish-button-C-ra2NsA.js")), se = Y(ge)`
|
|
415
|
-
&.sticky {
|
|
416
|
-
position: sticky;
|
|
417
|
-
top: 0;
|
|
418
|
-
}
|
|
419
|
-
`;
|
|
420
|
-
function tt({ logo: e }) {
|
|
421
|
-
const [o, n] = Ce(), s = ve((r) => r.breakpoints.down("sm")), { value: i } = ne(() => {
|
|
422
|
-
var a, c;
|
|
423
|
-
const r = new URL(
|
|
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",
|
|
425
|
-
window.location.origin
|
|
426
|
-
);
|
|
427
|
-
r.searchParams.delete("imageFilter"), r.searchParams.delete("f");
|
|
428
|
-
const l = r.toString();
|
|
429
|
-
return new Promise((g) => {
|
|
430
|
-
fetch(l).then((d) => {
|
|
431
|
-
const m = d.headers.get("content-type");
|
|
432
|
-
m != null && m.includes("svg") && d.text().then((h) => {
|
|
433
|
-
n(h), g(null);
|
|
434
|
-
}), g(d.url);
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
}, [s]);
|
|
438
|
-
if (e)
|
|
439
|
-
return e;
|
|
440
|
-
if (o)
|
|
441
|
-
return /* @__PURE__ */ t(B, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: Se.sanitize(o) } });
|
|
442
|
-
if (i) {
|
|
443
|
-
const r = new URL(i);
|
|
444
|
-
r.searchParams.set("imageFilter", "convert"), r.searchParams.set("f", "png"), r.searchParams.set("h", "80");
|
|
445
|
-
const l = r.toString();
|
|
446
|
-
return /* @__PURE__ */ t("img", { src: l, alt: "logo" });
|
|
447
|
-
}
|
|
448
|
-
return null;
|
|
449
|
-
}
|
|
450
|
-
function ot({
|
|
451
|
-
logo: e,
|
|
452
|
-
translucentTextColor: o,
|
|
453
|
-
...n
|
|
454
|
-
}) {
|
|
455
|
-
const { top: s = 0 } = we(() => document.getElementById("app")) || {};
|
|
456
|
-
let i = Math.min(s / 800, 1), r = "";
|
|
457
|
-
if (i > 0.1) {
|
|
458
|
-
i = Math.max(i, 0.6);
|
|
459
|
-
const l = Math.round(255 * Math.min(1 - i, 0.2));
|
|
460
|
-
r = `rgb(${l}, ${l}, ${l})`;
|
|
461
|
-
} else
|
|
462
|
-
r = o || "#EEEEEE";
|
|
463
|
-
return /* @__PURE__ */ t(
|
|
464
|
-
se,
|
|
465
|
-
{
|
|
466
|
-
logo: /* @__PURE__ */ t(tt, { logo: e }),
|
|
467
|
-
...n,
|
|
468
|
-
className: K(i <= 0.7 && "reverse-color"),
|
|
469
|
-
style: {
|
|
470
|
-
backgroundColor: `rgba(255,255,255,${i})`,
|
|
471
|
-
// @ts-ignore
|
|
472
|
-
"--logo-invert": i <= 0.7 ? 1 - i / 6 : 1 - i
|
|
473
|
-
},
|
|
474
|
-
sx: {
|
|
475
|
-
backdropFilter: i >= 0.6 ? "blur(10px)" : "blur(0px)",
|
|
476
|
-
transition: "all 0.3s ease",
|
|
477
|
-
position: "fixed !important",
|
|
478
|
-
left: 0,
|
|
479
|
-
top: 0,
|
|
480
|
-
right: 0,
|
|
481
|
-
bgcolor: "transparent",
|
|
482
|
-
"&.reverse-color": {
|
|
483
|
-
".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
|
|
484
|
-
color: `${r} !important`
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
".header-logo > div": {
|
|
488
|
-
filter: "invert(var(--logo-invert))"
|
|
489
|
-
},
|
|
490
|
-
".header-logo": {
|
|
491
|
-
color: r
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
const ie = Y(be)``;
|
|
498
|
-
export {
|
|
499
|
-
Bt as H,
|
|
500
|
-
Ve as L,
|
|
501
|
-
D as P,
|
|
502
|
-
ot as T,
|
|
503
|
-
Xe as a,
|
|
504
|
-
Fe as b,
|
|
505
|
-
Nt as c,
|
|
506
|
-
A as d
|
|
507
|
-
};
|