@blocklet/pages-kit-inner-components 0.5.14 → 0.5.15
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-4CkDQ2Eu.js +38 -0
- package/lib/cjs/chunks/{publish-button-DsiOg6dm.js → publish-button-H5zinlnz.js} +1 -1
- package/lib/cjs/chunks/session-BA7Qrcia.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/theme.js +1 -1
- package/lib/es/chunks/{home-CUT5mgH3.js → home-ngRf6bmH.js} +178 -192
- package/lib/es/chunks/{publish-button-CzxT_3xf.js → publish-button-BZZOvMB8.js} +1 -1
- package/lib/es/chunks/session-CVblGhSp.js +21 -0
- package/lib/es/home.js +9 -8
- package/lib/es/theme.js +45 -43
- package/package.json +18 -18
- package/lib/cjs/chunks/home-Brssi57y.js +0 -38
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),M=require("./state-D4MG-uJB.js"),Y=require("@arcblock/ux/lib/Locale/context"),le=require("@arcblock/ux/lib/Result"),ue=require("@blocklet/pages-kit/builtin/page/header"),de=require("@blocklet/pages-kit/contexts/color"),J=require("@blocklet/pages-kit/utils/data-source"),pe=require("@blocklet/pages-kit/utils/route"),ge=require("@blocklet/ui-react/lib/Header"),Z=require("@emotion/css"),N=require("@emotion/react"),me=require("@emotion/styled"),b=require("@mui/material"),G=require("ahooks"),fe=require("isomorphic-dompurify"),he=require("lodash/cloneDeep"),xe=require("lodash/isEmpty"),je=require("lodash/isEqual"),m=require("react"),ye=require("react-helmet"),P=require("react-router-dom"),ee=require("react-use"),E=require("ufo"),I=require("./array-DOh_uyzM.js"),W=require("@arcblock/ux/lib/Theme"),be=require("@blocklet/ui-react/lib/Footer");require("webfontloader");const X=require("./session-BA7Qrcia.js"),S=t=>t&&t.__esModule?t:{default:t},te=S(le),ve=S(ge),ne=S(me),we=S(fe),V=S(he),Pe=S(xe),oe=S(je),ke=S(be),Re=W.styled(ke.default,{shouldForwardProp:t=>!!t})`
|
|
2
|
+
& > div > .MuiContainer-root {
|
|
3
|
+
max-width: unset;
|
|
4
|
+
}
|
|
5
|
+
`;function Se({meta:t,...o}){const r=W.useTheme();return e.jsx(Re,{...o,meta:t,theme:r||{}})}function se(t){return e.jsx(b.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...t,children:e.jsx(b.CircularProgress,{size:30})})}function qe(t){return e.jsx(_e,{...t})}const _e=W.styled(b.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
|
+
`,Ce=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
17
|
+
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;function Ee({titleFontFamily:t,descriptionFontFamily:o}){var n;const r=b.useTheme(),s=(n=r==null?void 0:r.typography)==null?void 0:n.fontFamily;m.useEffect(()=>{},[t,o]);const i=`${s}, ${Ce}`;return e.jsx(N.Global,{styles:N.css`
|
|
18
|
+
#app {
|
|
19
|
+
font-family: ${i};
|
|
20
|
+
|
|
21
|
+
.page-kit-section__title {
|
|
22
|
+
font-family: ${i};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.page-kit-section__description {
|
|
26
|
+
font-family: ${i};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`})}function Me(){const[t]=P.useSearchParams(),{session:o}=X.useSessionContext(),r=X.useIsRoleOrMultiTenant("owner","admin","pagesEditor","member"),s=m.useMemo(()=>{const n=t.get("mode");return I.STATE_MODES.includes(n)?n:"production"},[t]),i=s==="production"?s:o.user?r?s:"production":null;return i?e.jsx(re,{mode:i}):null}function re({mode:t}){if(t!=="draft"){const o=window.__PAGE_STATE__;return o?e.jsx(A,{mode:t,state:o}):e.jsx(Be,{mode:t,children:({state:r})=>e.jsx(A,{mode:t,state:r})})}return e.jsx(Ie,{children:({state:o})=>e.jsx(A,{mode:t,state:o})})}const Ie=m.lazy(()=>Promise.resolve().then(()=>require("./draft-data-DPZIakr4.js")));function Be({mode:t,children:o}){const r=document.querySelector('meta[property="pages:version"]'),s=r==null?void 0:r.content,i=M.useProjectId(),n=m.useMemo(()=>{if(s==="{{pagesPublishedAt}}"){const l=localStorage.getItem(M.getProjectPageVersionKey(i??""));return Number(l)?Number(l):new Date().getTime()}return Number(s)},[s]),{loading:g,value:a}=ee.useAsync(()=>I.getPages({mode:t,version:n}),[t,n]);return g?e.jsx(se,{}):a?o({state:a}):null}function A({mode:t,state:o}){const{t:r,locale:s}=Y.useLocaleContext(),[i]=P.useSearchParams(),n=i.get("hiddenBadge")==="true",g=i.get("showPublish")==="true",{pageIds:a,pages:l,routeIds:f,routes:d,supportedLocales:p,config:{defaultLocale:h},resources:v}=o,w=M.getAllComponents(o),j=m.useMemo(()=>p!=null&&p.some(u=>u.locale===s)?s:void 0,[s,p]),B=Object.values(d||{}).find(u=>(u==null?void 0:u.path)==="/")||Object.values(l).find(u=>(u==null?void 0:u.slug)==="/")?void 0:Object.values(l)[0],H=m.useMemo(()=>a.map(u=>{const c=l[u];return c&&{id:c.id,path:E.joinURL("/",j||"",c.slug,t!=="production"?`?mode=${t}`:"")}}).filter(I.nonNullable),[a,l,j,t]),q=([...u])=>(t!=="production"&&g&&u.unshift(e.jsx(m.Suspense,{fallback:e.jsx("div",{}),children:e.jsx(Le,{mode:"production",state:o})})),u);return e.jsxs(I.Provider,{value:{pages:H},children:[e.jsxs(P.Routes,{children:[B&&e.jsx(P.Route,{index:!0,element:e.jsx(P.Navigate,{to:E.joinURL("/",j||"",B.slug)})}),f==null?void 0:f.map(u=>{var T,L,k,x;const c=d==null?void 0:d[u];if(!c||!c.displayTemplateId)return null;const _=l[c.displayTemplateId];if(!_)return null;let C=[];if(c.params&&c.params.length>0){const R=pe.generateParamCombinations({basePath:c.path,params:c.params,routeId:c.id,paramsOptions:c.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});C=R==null?void 0:R.map(U=>{var O,$,K,Q;const D=U.paramOptionIds.join("-");return e.jsx(P.Route,{path:E.joinURL(":projectIdOrSlug?",U.path),element:e.jsx(z,{mode:t,components:w,page:_,locale:j,defaultLocale:h,headerAddons:q,state:o,pageData:(Q=(K=($=(O=c.dataSource)==null?void 0:O.pathDataMappings)==null?void 0:$[D])==null?void 0:K.dataCache)==null?void 0:Q[j||h||"en"]})},D)})}return C.push(e.jsx(P.Route,{path:E.joinURL(":projectIdOrSlug?",c.path),element:e.jsx(z,{mode:t,components:w,page:_,locale:j,defaultLocale:h,headerAddons:q,state:o,pageData:(x=(k=(L=(T=c.dataSource)==null?void 0:T.pathDataMappings)==null?void 0:L[c.id])==null?void 0:k.dataCache)==null?void 0:x[j||h||"en"]})},c.id)),C}),a.map(u=>{const c=l[u];return c?e.jsx(P.Route,{path:E.joinURL(":projectIdOrSlug?",c.slug),element:e.jsx(F,{mode:t,components:w,page:c,locale:j,defaultLocale:h,headerAddons:q})},c.id):null}),v.pages&&Object.values(v.pages).map(({blockletId:u,page:c})=>e.jsx(P.Route,{path:E.joinURL("/",`@${u}`,c.slug),element:e.jsx(F,{mode:t,components:w,page:c,locale:j,defaultLocale:h,headerAddons:q})},c.id)),e.jsx(P.Route,{path:"*",element:e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(te.default,{status:404,extra:e.jsx(ie,{href:"/",children:r("common.back")})})})})]}),t!=="production"&&!n&&e.jsx(qe,{sx:{bgcolor:"info.light"},children:t}),e.jsx(Ee,{})]})}function z({mode:t,pageData:o,components:r,page:s,locale:i,defaultLocale:n,headerAddons:g,state:a}){const l=G.useReactive({page:null});m.useEffect(()=>{const d=s||null;d?l.page=V.default(d):l.page=null},[s,l]);const f=m.useRef();return m.useEffect(()=>{oe.default(o,f.current)||o&&l.page&&(J.setPageDataSource(l.page,a,i,o),f.current=V.default(o))},[l.page,o,i,a]),l.page?e.jsx(F,{mode:t,components:r,page:l.page,locale:i,defaultLocale:n,headerAddons:g}):null}function Te({mode:t,state:o,path:r,pageData:s}){const{t:i,locale:n}=Y.useLocaleContext(),{pages:g,supportedLocales:a,config:{defaultLocale:l},resources:f}=o,d=Object.values(g).find(y=>(y==null?void 0:y.slug)===r),p=Object.values(f.pages||{}).find(y=>y.page.slug===r),h=m.useMemo(()=>a!=null&&a.some(y=>y.locale===n)?n:void 0,[n,a]),v=G.useReactive({page:null});m.useEffect(()=>{const y=d||(p==null?void 0:p.page)||null;y?v.page=V.default(y):v.page=null},[d,p]);const w=m.useRef();if(m.useEffect(()=>{oe.default(s,w.current)||s&&v.page&&(J.setPageDataSource(v.page,o,h,s),w.current=V.default(s))},[{}]),!d&&!(p!=null&&p.page))return e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(te.default,{style:{background:"inherit"},status:404,extra:e.jsx(ie,{href:"/",children:i("common.back")})})});const j=M.getAllComponents(o);return v.page?e.jsx(F,{mode:t,components:j,page:v.page,locale:h,defaultLocale:l}):null}function F({mode:t,components:o,page:r,locale:s,defaultLocale:i,headerAddons:n}){var B,H,q,u,c,_,C,T,L;const g=de.useColorConvert(),a=((B=r.locales)==null?void 0:B[s])??((H=r.locales)==null?void 0:H[i])??{},l=a.title||((q=window.blocklet)==null?void 0:q.appName),f=a.description||((u=window.blocklet)==null?void 0:u.appDescription),d=M.autoResizeImage(M.getImageAbsoluteUrl(a.image),540),{logo:p,brand:h,description:v,...w}=ue.useHeaderState(),j=m.useMemo(()=>k=>{var R;let x=(n==null?void 0:n(k))??k;return x=((R=w.addons)==null?void 0:R.call(w,x))??x,x},[w.addons,n]),y=(c=a.header)!=null&&c.translucent?ce:ae;return e.jsxs(I.PageProvider,{page:r,defaultLocale:i,currentLocale:s,children:[e.jsx(N.Global,{styles:N.css`
|
|
30
|
+
body {
|
|
31
|
+
background-color: ${g(!a.backgroundColor||a.backgroundColor==="transparent"?"background.default":a.backgroundColor)} !important;
|
|
32
|
+
}
|
|
33
|
+
`}),e.jsx(y,{hideNavMenu:!!((_=a.header)!=null&&_.hideNavMenus),translucentTextColor:(C=a.header)==null?void 0:C.translucentTextColor,...p?{logo:p}:{},...h?{brand:h}:{},...v?{description:v}:{},className:Z.cx(((T=a.header)==null?void 0:T.sticky)&&"sticky","page-header"),maxWidth:!1,addons:j}),e.jsx(P.ScrollRestoration,{}),e.jsxs(ye.Helmet,{children:[e.jsx("title",{children:l}),e.jsx("meta",{name:"og:title",content:l}),e.jsx("meta",{name:"og:description",content:f}),e.jsx("meta",{name:"og:image",content:d}),e.jsx("meta",{name:"twitter:image:src",content:d}),e.jsx("meta",{name:"twitter:image",content:d}),e.jsx("meta",{property:"twitter:description",content:f}),e.jsx("meta",{property:"twitter:title",content:l}),e.jsx("meta",{name:"description",content:f})]}),e.jsx(b.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:r.sectionIds.map(k=>{var D,O;const x=r.sections[k];if(!x||x.visibility==="hidden")return null;const R=(D=x.locales)==null?void 0:D[s],U=((O=x.locales)==null?void 0:O[i])??{};return e.jsx(I.BlockRenderer,{id:k,type:x.component,mode:t,section:x,config:{...Pe.default(R)?U:R,locale:s,dev:t==="draft"?{mode:t,components:o,defaultLocale:i}:{mode:t}}},k)})}),!((L=a.footer)!=null&&L.hidden)&&e.jsx(Se,{})]})}const Le=m.lazy(()=>Promise.resolve().then(()=>require("./publish-button-H5zinlnz.js"))),ae=ne.default(ve.default)`
|
|
34
|
+
&.sticky {
|
|
35
|
+
position: sticky;
|
|
36
|
+
top: 0;
|
|
37
|
+
}
|
|
38
|
+
`;function De({logo:t}){const[o,r]=m.useState(),s=b.useMediaQuery(n=>n.breakpoints.down("sm")),{value:i}=ee.useAsync(()=>{var a,l;const n=new URL(s?((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",window.location.origin);n.searchParams.delete("imageFilter"),n.searchParams.delete("f");const g=n.toString();return new Promise(f=>{fetch(g).then(d=>{const p=d.headers.get("content-type");p!=null&&p.includes("svg")&&d.text().then(h=>{r(h),f(null)}),f(d.url)})})},[s]);if(t)return t;if(o)return e.jsx(b.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:we.default.sanitize(o)}});if(i){const n=new URL(i);n.searchParams.set("imageFilter","convert"),n.searchParams.set("f","png"),n.searchParams.set("h","80");const g=n.toString();return e.jsx("img",{src:g,alt:"logo"})}return null}function ce({logo:t,translucentTextColor:o,...r}){const{top:s=0}=G.useScroll(()=>document.getElementById("app"))||{},i=b.useTheme();let n=Math.min(s/800,1),g="";return n>.1?(n=Math.max(n,.6),g=b.alpha(i.palette.text.primary,n)):g=o||"#EEEEEE",e.jsx(ae,{logo:e.jsx(De,{logo:t}),...r,className:Z.cx(n<=.7&&"reverse-color"),style:{backgroundColor:b.alpha(i.palette.background.default,n),"--logo-invert":n<=.7?1-n/6:1-n},sx:{backdropFilter:n>=.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:`${g} !important`}},"& .navmenu--horizontal":{bgcolor:"transparent !important"},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:g}}})}const ie=ne.default(b.Button)``;exports.Home=Me;exports.HomeView=re;exports.Loading=se;exports.PageRoutes=A;exports.PageView=F;exports.PageViewByPath=Te;exports.PageViewWithDataSource=z;exports.TranslucentHeader=ce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("./state-D4MG-uJB.js"),$=require("@arcblock/ux/lib/Locale/context"),ee=require("@arcblock/ux/lib/Toast"),te=require("@blocklet/pages-kit/utils/route"),P=require("@mui/icons-material"),J=require("@mui/lab"),s=require("@mui/material"),se=require("immer"),ne=require("lodash/difference"),l=require("react"),ie=require("react-use"),re=require("./home-Brssi57y.js"),U=require("./array-DOh_uyzM.js"),G=r=>r&&r.__esModule?r:{default:r},W=G(ee),H=G(ne);function oe(r){const[j,k]=l.useState(!1);return e.jsx(J.LoadingButton,{...r,loading:r.loading||j,onClick:u=>{var b;const p=(b=r.onClick)==null?void 0:b.call(r,u);p instanceof Promise&&(k(!0),p.finally(()=>{k(!1)}))}})}const ae=s.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 le(){const[r,j]=l.useState(),k=l.useMemo(()=>r?e.jsx(s.Dialog,{...r}):null,[r]),u=l.useCallback(()=>{j(void 0)},[]),p=l.useCallback(({title:b,content:d,cancelText:S="Cancel",okText:f="Ok",onOk:g,onClose:c,okIcon:O,okColor:w="primary",cancelColor:y="primary",DialogContentProps:A,form:M,...z})=>{j({...z,open:!0,children:e.jsxs("form",{onSubmit:R=>R.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{u(),c==null||c()},children:e.jsx(ae,{})})]}),d&&e.jsx(s.DialogContent,{...A,sx:{mt:-3,...A==null?void 0:A.sx},children:e.jsx(s.Box,{pt:3,children:d})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:c??u,children:S}),e.jsx(oe,{variant:"contained",color:w||"primary",startIcon:O,loadingPosition:O?"start":"center",onClick:async()=>{await(g==null?void 0:g()),u()},type:"submit",children:f})]})]}),onClose:c??u})},[u]);return{dialog:k,showDialog:p,closeDialog:u}}const ce=l.forwardRef(({mode:r,state:j},k)=>{const{t:u}=$.useLocaleContext(),[p,b]=l.useState(!1),{dialog:d,showDialog:S}=le(),f=F.useProjectId(),g=l.useCallback(O=>{let w=[];S({title:u("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(P.Warning,{}),children:u("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(de,{state:j,toMode:r,onChange:y=>w=y,defaultRouteIds:O})})]}),okText:u("maker.publish"),cancelText:u("common.cancel"),onOk:async()=>{if((w==null?void 0:w.length)===0){const y=u("maker.publishSelectPagesMessage");throw W.default.error(y),new Error(y)}localStorage.setItem(F.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await U.publishPages({mode:r,routes:w}),W.default.success(u("maker.publishSuccessMessage"))}catch(y){throw W.default.error(y.message),y}finally{b(!1)}}})},[r,j,u,f,S]);l.useImperativeHandle(k,()=>({openPublishDialog:g}));const c=l.useCallback(()=>{g()},[g]);return e.jsxs(e.Fragment,{children:[e.jsx(J.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:c,loading:p,disabled:p,children:u("maker.publishToProduction")}),d]})});function ue({routePathInfo:r,checked:j,onClick:k,route:u}){var d,S,f,g,c;const{t:p}=$.useLocaleContext(),b=!((d=r.routeMetaData)!=null&&d.publishedAt)||((S=r.routeMetaData)==null?void 0:S.updatedAt)&&new Date((f=r.routeMetaData)==null?void 0:f.updatedAt)>new Date((g=r.routeMetaData)==null?void 0:g.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{display:"flex",alignItems:"center",sx:{minWidth:"auto"},children:[b&&e.jsx(s.Box,{mr:.35,className:"visible",color:"warning.main",sx:{display:"flex",alignItems:"center"},title:p("maker.pages.needPublish"),children:e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!((c=r.routeMetaData)!=null&&c.isPublic)||!u.isPublic)&&e.jsx(s.Box,{className:"visible",color:"warning.main",children:e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:k,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:j,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:r.path,primaryTypographyProps:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}})]})})}function de({state:r,toMode:j,onChange:k,defaultRouteIds:u}){const{t:p,locale:b}=$.useLocaleContext(),[d,S]=l.useState(!1),[f,g]=l.useState(()=>u?Object.fromEntries(u.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[c,O]=l.useState({}),[w,y]=l.useState(()=>u?Object.fromEntries(u.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[A,M]=l.useState({}),{loading:z,error:R,value:x}=ie.useAsync(()=>U.getPages({mode:j}),[j]);if(R)throw R;const T=l.useMemo(()=>r.routeIds||[],[r]),I=l.useMemo(()=>(x==null?void 0:x.pageIds)||[],[x]),D=l.useMemo(()=>!T||!r.routes?[]:JSON.parse(JSON.stringify(T)).sort((o,i)=>{var h,m;const n=(h=r.routes)==null?void 0:h[o],a=(m=r.routes)==null?void 0:m[i];return n!=null&&n.publishedAt&&new Date(n.publishedAt).getTime()<new Date(n.updatedAt).getTime()?-1:a!=null&&a.publishedAt&&new Date(a.publishedAt).getTime()<new Date(a.updatedAt).getTime()?1:new Date((n==null?void 0:n.updatedAt)??"").getTime()-new Date((a==null?void 0:a.updatedAt)??"").getTime()}),[r,T]),q=l.useMemo(()=>{if(!D)return[];if(!c)return D;const t=[...D].filter(o=>!c[o]);return Object.values(c).forEach(o=>{o.forEach(i=>{t.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`)})}),t},[D,c]),L=l.useMemo(()=>!x||!I||!q?[]:H.default(I,q),[q,x,I]),C=l.useMemo(()=>T?[...T].concat(L):L,[T,L]),_=l.useCallback(()=>{const t={};D==null||D.forEach(o=>{var n;const i=(n=r.routes)==null?void 0:n[o];if(i&&i.params&&i.params.length>0&&i.paramsOptions&&i.paramsOptions.length>0){const a=te.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});a.length>0&&(t[i.id]=a)}}),O(t)},[D,r.routes]);l.useEffect(()=>{_()},[_]),l.useEffect(()=>{M(t=>{const o={...t};return Object.keys(c).forEach(i=>{var n;c[i]&&((n=c[i])==null?void 0:n.length)>0&&o[i]===void 0&&(o[i]=!0)}),o})},[c]);const K=l.useRef(!0);l.useEffect(()=>{y(t=>{const o={...t};return Object.keys(c).length===0||(Object.keys(c).forEach(i=>{const n=c[i]||[],a=d||!!f[i];n.forEach(h=>{const m=`${i}-${h.paramOptionIds.join("-")}`;K.current?o[m]=a||t[m]||!1:o[m]=a})}),K.current=!1),o})},[f,c,d]);const Q=(t,o)=>{o.stopPropagation(),M(i=>{const n={...i};return n[t]=!n[t],n})},N=l.useCallback(t=>{g(o=>{const i=se.produce(o,n=>{d?(Object.assign(n,Object.fromEntries(C.map(a=>[a,!0]))),delete n[t]):n[t]?(delete n[t],L.includes(t)&&(T||[]).filter(a=>{var h,m;return((h=r.pages[a])==null?void 0:h.slug)===((m=x==null?void 0:x.pages[t])==null?void 0:m.slug)}).forEach(a=>{delete n[a]})):(n[t]=!0,T&&T.includes(t)&&L.filter(a=>{var h,m;return((h=x==null?void 0:x.pages[a])==null?void 0:h.slug)===((m=r.pages[t])==null?void 0:m.slug)}).forEach(a=>{n[a]=!0}))});return S(H.default(C,Object.keys(i)).length===0),i})},[d,C,L,r,x,T]),X=l.useCallback((t,o)=>{const i=`${t}-${o.paramOptionIds.join("-")}`;y(n=>{var m;const a={...n};a[i]=!a[i];const h=((m=c[t])==null?void 0:m.every(B=>a[`${t}-${B.paramOptionIds.join("-")}`]))??!1;return g(B=>{if(h&&!B[t])return{...B,[t]:!0};if(!h&&B[t]){const v={...B};return delete v[t],v}return B}),a})},[c]),Y=l.useCallback(()=>{S(t=>(t&&g({}),!t))},[]);return l.useEffect(()=>{const t=d?C:Object.keys(f),o=Object.entries(w).filter(([,n])=>n).map(([n])=>n).filter(n=>n!==void 0),i=Array.from(new Set([...t,...o]));k(d?null:i)},[d,f,w,C,k]),z?e.jsx(re.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:Y,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:p("common.all")})]})}),D.map(t=>{var B,v;const o=(B=r.routes)==null?void 0:B[t];if(!o)return null;const i=!1,n=c&&c[t]&&((v=c[t])==null?void 0:v.length)>0,a=A[t]!==!1,h=c[t]||[],m=!o.publishedAt||o.updatedAt&&new Date(o.updatedAt).getTime()>new Date(o.publishedAt).getTime();return e.jsxs(s.Box,{children:[e.jsx(s.ListItem,{sx:{pr:4},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center"},children:[m&&e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!o.isPublic&&e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),i,n&&e.jsx(s.Box,{onClick:E=>Q(t,E),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:a?e.jsx(P.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(P.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.path,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})}),n&&e.jsx(s.Collapse,{in:a,children:e.jsx(s.Box,{children:h.map(E=>{const V=`${t}-${E.paramOptionIds.join("-")}`,Z=w[V]||!1;return e.jsx(ue,{routePathInfo:E,checked:d||Z,onClick:()=>X(t,E),route:o},V)})})})]},t)}),L.map(t=>{var i,n;const o=x==null?void 0:x.pages[t];return o?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.slug,secondary:(n=(i=o.locales)==null?void 0:i[b])==null?void 0:n.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},t):null})]})}exports.default=ce;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("./state-D4MG-uJB.js"),$=require("@arcblock/ux/lib/Locale/context"),ee=require("@arcblock/ux/lib/Toast"),te=require("@blocklet/pages-kit/utils/route"),P=require("@mui/icons-material"),J=require("@mui/lab"),s=require("@mui/material"),se=require("immer"),ne=require("lodash/difference"),l=require("react"),ie=require("react-use"),re=require("./home-4CkDQ2Eu.js"),U=require("./array-DOh_uyzM.js"),G=r=>r&&r.__esModule?r:{default:r},W=G(ee),H=G(ne);function oe(r){const[j,k]=l.useState(!1);return e.jsx(J.LoadingButton,{...r,loading:r.loading||j,onClick:u=>{var b;const p=(b=r.onClick)==null?void 0:b.call(r,u);p instanceof Promise&&(k(!0),p.finally(()=>{k(!1)}))}})}const ae=s.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 le(){const[r,j]=l.useState(),k=l.useMemo(()=>r?e.jsx(s.Dialog,{...r}):null,[r]),u=l.useCallback(()=>{j(void 0)},[]),p=l.useCallback(({title:b,content:d,cancelText:S="Cancel",okText:f="Ok",onOk:g,onClose:c,okIcon:O,okColor:w="primary",cancelColor:y="primary",DialogContentProps:A,form:M,...z})=>{j({...z,open:!0,children:e.jsxs("form",{onSubmit:R=>R.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{u(),c==null||c()},children:e.jsx(ae,{})})]}),d&&e.jsx(s.DialogContent,{...A,sx:{mt:-3,...A==null?void 0:A.sx},children:e.jsx(s.Box,{pt:3,children:d})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:c??u,children:S}),e.jsx(oe,{variant:"contained",color:w||"primary",startIcon:O,loadingPosition:O?"start":"center",onClick:async()=>{await(g==null?void 0:g()),u()},type:"submit",children:f})]})]}),onClose:c??u})},[u]);return{dialog:k,showDialog:p,closeDialog:u}}const ce=l.forwardRef(({mode:r,state:j},k)=>{const{t:u}=$.useLocaleContext(),[p,b]=l.useState(!1),{dialog:d,showDialog:S}=le(),f=F.useProjectId(),g=l.useCallback(O=>{let w=[];S({title:u("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(P.Warning,{}),children:u("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(de,{state:j,toMode:r,onChange:y=>w=y,defaultRouteIds:O})})]}),okText:u("maker.publish"),cancelText:u("common.cancel"),onOk:async()=>{if((w==null?void 0:w.length)===0){const y=u("maker.publishSelectPagesMessage");throw W.default.error(y),new Error(y)}localStorage.setItem(F.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await U.publishPages({mode:r,routes:w}),W.default.success(u("maker.publishSuccessMessage"))}catch(y){throw W.default.error(y.message),y}finally{b(!1)}}})},[r,j,u,f,S]);l.useImperativeHandle(k,()=>({openPublishDialog:g}));const c=l.useCallback(()=>{g()},[g]);return e.jsxs(e.Fragment,{children:[e.jsx(J.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:c,loading:p,disabled:p,children:u("maker.publishToProduction")}),d]})});function ue({routePathInfo:r,checked:j,onClick:k,route:u}){var d,S,f,g,c;const{t:p}=$.useLocaleContext(),b=!((d=r.routeMetaData)!=null&&d.publishedAt)||((S=r.routeMetaData)==null?void 0:S.updatedAt)&&new Date((f=r.routeMetaData)==null?void 0:f.updatedAt)>new Date((g=r.routeMetaData)==null?void 0:g.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{display:"flex",alignItems:"center",sx:{minWidth:"auto"},children:[b&&e.jsx(s.Box,{mr:.35,className:"visible",color:"warning.main",sx:{display:"flex",alignItems:"center"},title:p("maker.pages.needPublish"),children:e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!((c=r.routeMetaData)!=null&&c.isPublic)||!u.isPublic)&&e.jsx(s.Box,{className:"visible",color:"warning.main",children:e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:k,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:j,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:r.path,primaryTypographyProps:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}})]})})}function de({state:r,toMode:j,onChange:k,defaultRouteIds:u}){const{t:p,locale:b}=$.useLocaleContext(),[d,S]=l.useState(!1),[f,g]=l.useState(()=>u?Object.fromEntries(u.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[c,O]=l.useState({}),[w,y]=l.useState(()=>u?Object.fromEntries(u.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[A,M]=l.useState({}),{loading:z,error:R,value:x}=ie.useAsync(()=>U.getPages({mode:j}),[j]);if(R)throw R;const T=l.useMemo(()=>r.routeIds||[],[r]),I=l.useMemo(()=>(x==null?void 0:x.pageIds)||[],[x]),D=l.useMemo(()=>!T||!r.routes?[]:JSON.parse(JSON.stringify(T)).sort((o,i)=>{var h,m;const n=(h=r.routes)==null?void 0:h[o],a=(m=r.routes)==null?void 0:m[i];return n!=null&&n.publishedAt&&new Date(n.publishedAt).getTime()<new Date(n.updatedAt).getTime()?-1:a!=null&&a.publishedAt&&new Date(a.publishedAt).getTime()<new Date(a.updatedAt).getTime()?1:new Date((n==null?void 0:n.updatedAt)??"").getTime()-new Date((a==null?void 0:a.updatedAt)??"").getTime()}),[r,T]),q=l.useMemo(()=>{if(!D)return[];if(!c)return D;const t=[...D].filter(o=>!c[o]);return Object.values(c).forEach(o=>{o.forEach(i=>{t.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`)})}),t},[D,c]),L=l.useMemo(()=>!x||!I||!q?[]:H.default(I,q),[q,x,I]),C=l.useMemo(()=>T?[...T].concat(L):L,[T,L]),_=l.useCallback(()=>{const t={};D==null||D.forEach(o=>{var n;const i=(n=r.routes)==null?void 0:n[o];if(i&&i.params&&i.params.length>0&&i.paramsOptions&&i.paramsOptions.length>0){const a=te.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});a.length>0&&(t[i.id]=a)}}),O(t)},[D,r.routes]);l.useEffect(()=>{_()},[_]),l.useEffect(()=>{M(t=>{const o={...t};return Object.keys(c).forEach(i=>{var n;c[i]&&((n=c[i])==null?void 0:n.length)>0&&o[i]===void 0&&(o[i]=!0)}),o})},[c]);const K=l.useRef(!0);l.useEffect(()=>{y(t=>{const o={...t};return Object.keys(c).length===0||(Object.keys(c).forEach(i=>{const n=c[i]||[],a=d||!!f[i];n.forEach(h=>{const m=`${i}-${h.paramOptionIds.join("-")}`;K.current?o[m]=a||t[m]||!1:o[m]=a})}),K.current=!1),o})},[f,c,d]);const Q=(t,o)=>{o.stopPropagation(),M(i=>{const n={...i};return n[t]=!n[t],n})},N=l.useCallback(t=>{g(o=>{const i=se.produce(o,n=>{d?(Object.assign(n,Object.fromEntries(C.map(a=>[a,!0]))),delete n[t]):n[t]?(delete n[t],L.includes(t)&&(T||[]).filter(a=>{var h,m;return((h=r.pages[a])==null?void 0:h.slug)===((m=x==null?void 0:x.pages[t])==null?void 0:m.slug)}).forEach(a=>{delete n[a]})):(n[t]=!0,T&&T.includes(t)&&L.filter(a=>{var h,m;return((h=x==null?void 0:x.pages[a])==null?void 0:h.slug)===((m=r.pages[t])==null?void 0:m.slug)}).forEach(a=>{n[a]=!0}))});return S(H.default(C,Object.keys(i)).length===0),i})},[d,C,L,r,x,T]),X=l.useCallback((t,o)=>{const i=`${t}-${o.paramOptionIds.join("-")}`;y(n=>{var m;const a={...n};a[i]=!a[i];const h=((m=c[t])==null?void 0:m.every(B=>a[`${t}-${B.paramOptionIds.join("-")}`]))??!1;return g(B=>{if(h&&!B[t])return{...B,[t]:!0};if(!h&&B[t]){const v={...B};return delete v[t],v}return B}),a})},[c]),Y=l.useCallback(()=>{S(t=>(t&&g({}),!t))},[]);return l.useEffect(()=>{const t=d?C:Object.keys(f),o=Object.entries(w).filter(([,n])=>n).map(([n])=>n).filter(n=>n!==void 0),i=Array.from(new Set([...t,...o]));k(d?null:i)},[d,f,w,C,k]),z?e.jsx(re.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:Y,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:p("common.all")})]})}),D.map(t=>{var B,v;const o=(B=r.routes)==null?void 0:B[t];if(!o)return null;const i=!1,n=c&&c[t]&&((v=c[t])==null?void 0:v.length)>0,a=A[t]!==!1,h=c[t]||[],m=!o.publishedAt||o.updatedAt&&new Date(o.updatedAt).getTime()>new Date(o.publishedAt).getTime();return e.jsxs(s.Box,{children:[e.jsx(s.ListItem,{sx:{pr:4},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center"},children:[m&&e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!o.isPublic&&e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),i,n&&e.jsx(s.Box,{onClick:E=>Q(t,E),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:a?e.jsx(P.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(P.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.path,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})}),n&&e.jsx(s.Collapse,{in:a,children:e.jsx(s.Box,{children:h.map(E=>{const V=`${t}-${E.paramOptionIds.join("-")}`,Z=w[V]||!1;return e.jsx(ue,{routePathInfo:E,checked:d||Z,onClick:()=>X(t,E),route:o},V)})})})]},t)}),L.map(t=>{var i,n;const o=x==null?void 0:x.pages[t];return o?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.slug,secondary:(n=(i=o.locales)==null?void 0:i[b])==null?void 0:n.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},t):null})]})}exports.default=ce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("@arcblock/did-connect/lib/Session"),r=require("react"),{SessionProvider:u,SessionContext:c,SessionConsumer:a,withSession:C}=i.createAuthServiceSessionContext();function t(){return r.useContext(c)}function l(...s){var e;const{session:n}=t();return s.includes((e=n.user)==null?void 0:e.role)}function S(...s){var o;const{session:n}=t(),e=l(...s);return((o=window.blocklet)==null?void 0:o.tenantMode)==="multiple"?!!n.user:e}exports.SessionProvider=u;exports.useIsRoleOrMultiTenant=S;exports.useSessionContext=t;
|
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-D4MG-uJB.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/pages-kit/utils/route");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-DOh_uyzM.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-D4MG-uJB.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/pages-kit/utils/route");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-DOh_uyzM.js");const e=require("./chunks/home-4CkDQ2Eu.js");require("./chunks/session-BA7Qrcia.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/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),r=require("@arcblock/ux/lib/Config"),m=require("@iconify-icon/react"),x=require("@iconify-icons/tabler/chevron-down"),e=require("@mui/material"),o=require("./chunks/session-BA7Qrcia.js"),p=require("./locales.js"),c=s=>s&&s.__esModule?s:{default:s},b=c(x);var n;const a=((n=window.blocklet)==null?void 0:n.prefix)||"/",u=a.endsWith("/")?`${a}admin`:`${a}/admin`,d={fontSize:"5rem","@media (max-width: 1536px)":{fontSize:"5rem"},"@media (max-width: 1200px)":{fontSize:"4rem"},"@media (max-width: 900px)":{fontSize:"3rem"},"@media (max-width: 600px)":{fontSize:"2rem"}};function l(s){return i.jsx(e.Box,{...s,component:m.Icon,icon:b.default})}const f={typography:{big:{...d},button:{textTransform:"none",WebkitTextTransform:"none"},subtitle1:{fontWeight:600,fontSize:"18px",lineHeight:1.5},subtitle2:{fontSize:"14px",lineHeight:"24px",fontWeight:500,marginBottom:"4px"}},palette:{background:{},action:{}},shape:{borderRadius:8},components:{MuiCssBaseline:{},MuiFormLabel:{styleOverrides:{root:{fontSize:"0.875rem"}}},MuiFormControlLabel:{styleOverrides:{root:{marginLeft:0},label:{fontSize:"0.875rem"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"0.875rem"}}},MuiRadio:{styleOverrides:{root:{padding:4,[`.${e.svgIconClasses.fontSizeMedium}`]:{fontSize:"1.25rem"},[`.${e.svgIconClasses.fontSizeSmall}`]:{fontSize:"1.125rem"}}}},MuiCheckbox:{styleOverrides:{root:{padding:4,[`.${e.svgIconClasses.fontSizeMedium}`]:{fontSize:"1.25rem"},[`.${e.svgIconClasses.fontSizeSmall}`]:{fontSize:"1.125rem"}}}},MuiSwitch:{styleOverrides:{root:{height:28,width:48,padding:8,[`&.${e.switchClasses.sizeSmall}`]:{height:26,width:40,padding:8}},switchBase:{padding:4}}},MuiAutocomplete:{defaultProps:{popupIcon:i.jsx(l,{fontSize:14})},variants:[{props:{},style:({theme:s})=>s.unstable_sx({[`.${e.autocompleteClasses.inputRoot}`]:{pt:1.5,pb:.25,[`.${e.autocompleteClasses.input}.${e.inputBaseClasses.input}`]:{px:0,pt:.5,pb:.25},[`&.${e.inputBaseClasses.sizeSmall}`]:{[`.${e.autocompleteClasses.input}.${e.inputBaseClasses.input}`]:{px:0,py:0,pb:"1px"}}}})}]},MuiTextField:{defaultProps:{variant:"filled"},variants:[{props:{},style:({theme:s,ownerState:t})=>s.unstable_sx({[`.${e.inputBaseClasses.root}`]:{borderRadius:1,lineHeight:"1.5rem",[`.${e.inputBaseClasses.input}`]:{height:"1.5rem"},[`&.${e.inputClasses.multiline}`]:{pl:0,pr:0,pt:"16px","& .MuiInputBase-inputMultiline":{py:0}}},[`.${e.inputClasses.root}`]:{mt:1.5,[`&.${e.inputBaseClasses.hiddenLabel}`]:{mt:0,pt:0,[`.${e.selectClasses.select}.${e.inputClasses.input}:focus`]:{bgcolor:"transparent"}}},[`.${e.inputLabelClasses.standard}`]:{transform:"translate(0px, 18px) scale(1)",[`&.${e.inputLabelClasses.sizeSmall}`]:{transform:"translate(0px, 15px) scale(1)"},[`&.${e.inputLabelClasses.shrink}`]:{transform:"translate(0px, -1px) scale(0.8)",[`&.${e.inputLabelClasses.sizeSmall}`]:{transform:"translate(0px, -1px) scale(0.8)"}}},[`.${e.filledInputClasses.root}`]:{":before,:after":{display:"none"},[`.${e.inputBaseClasses.input}`]:{pb:.5,pt:t!=null&&t.label?2:.5,px:1,":focus":{borderRadius:1},[`&.${e.inputBaseClasses.inputSizeSmall}`]:{pb:.25,pt:t!=null&&t.label?1.25:.25},[`&.${e.inputBaseClasses.inputHiddenLabel}`]:{py:.5,[`&.${e.inputBaseClasses.inputSizeSmall}`]:{py:"1px"}}}},[`.${e.inputLabelClasses.filled}`]:{transform:"translate(8px, 11px) scale(1)",[`&.${e.inputLabelClasses.sizeSmall}`]:{transform:"translate(8px, 7px) scale(1)"},[`&.${e.inputLabelClasses.shrink}`]:{transform:"translate(8px, 2px) scale(0.8)",[`&.${e.inputLabelClasses.sizeSmall}`]:{transform:"translate(8px, 0) scale(0.8)"}}},[`.${e.outlinedInputClasses.root}`]:{[`.${e.inputBaseClasses.input}`]:{py:1.25,px:1,[`&.${e.inputBaseClasses.inputSizeSmall}`]:{py:.875},[`&.${e.inputBaseClasses.inputHiddenLabel}`]:{py:.5,[`&.${e.inputBaseClasses.inputSizeSmall}`]:{py:"1px"}}}},[`.${e.inputLabelClasses.outlined}`]:{transform:"translate(8px, 10px) scale(1)",[`&.${e.inputLabelClasses.sizeSmall}`]:{transform:"translate(8px, 7px) scale(1)"},[`&.${e.inputLabelClasses.shrink}`]:{transform:"translate(16px, -7px) scale(0.8)"}}})}]},MuiInput:{defaultProps:{disableUnderline:!0},variants:[{props:{disableUnderline:!0},style:({theme:s})=>s.unstable_sx({fontSize:"0.875rem",lineHeight:"1.5rem",[`&.${e.inputBaseClasses.multiline}`]:{py:0},[`.${e.inputBaseClasses.input}`]:{py:.5,height:"1.5rem"},[`&.${e.inputBaseClasses.sizeSmall}`]:{[`.${e.inputBaseClasses.input}`]:{py:"1px"}}})}]},MuiFilledInput:{styleOverrides:{root:({theme:s})=>s.unstable_sx({fontSize:"0.875rem",bgcolor:s.palette.grey[100],"&:hover":{bgcolor:s.palette.grey[100]},"@media (hover: none)":{bgcolor:s.palette.grey[100]}})}},MuiSelect:{styleOverrides:{select:{display:"flex",alignItems:"center",[`.${e.listItemIconClasses.root}`]:{minWidth:20}}},defaultProps:{variant:"filled",IconComponent:l},variants:[{props:{},style:({theme:s})=>s.unstable_sx({fontSize:"0.875rem",borderRadius:1,lineHeight:"1.5rem",[`&.${e.filledInputClasses.root}`]:{":before,:after":{display:"none"},[`.${e.inputBaseClasses.input}`]:{py:.5,borderRadius:1,[`&.${e.inputBaseClasses.inputSizeSmall}`]:{py:"1px"}}},[`&.${e.outlinedInputClasses.root}`]:{[`.${e.inputBaseClasses.input}`]:{py:.5,borderRadius:1,[`&.${e.inputBaseClasses.inputSizeSmall}`]:{py:"1px"}}}})}]},MuiSlider:{defaultProps:{},variants:[{props:{},style:({theme:s})=>s.unstable_sx({height:3,[`.${e.sliderClasses.track}`]:{borderWidth:0},[`.${e.sliderClasses.thumb}`]:{width:16,height:16},[`&.${e.sliderClasses.sizeSmall}`]:{height:2,[`.${e.sliderClasses.thumb}`]:{width:12,height:12}}})}]},MuiFormHelperText:{styleOverrides:{root:({theme:s})=>s.unstable_sx({mx:1})}},MuiTypography:{variants:[{props:{variant:"body1"},style:({theme:s})=>s.unstable_sx({fontSize:"0.875rem"})},{props:{variant:"body2"},style:({theme:s})=>s.unstable_sx({fontSize:"0.75rem"})}]},MuiMenuItem:{styleOverrides:{root:({theme:s})=>s.unstable_sx({padding:"6px 12px",fontSize:"0.875rem",borderRadius:1,".MuiListItemIcon-root":{minWidth:0,mr:1}})}},MuiListItemButton:{styleOverrides:{root:{padding:"6px 12px"}}},MuiList:{styleOverrides:{root:{padding:4}}},MuiListItemText:{styleOverrides:{primary:{fontSize:"0.875rem"}}},MuiDialogTitle:{styleOverrides:{root:({theme:s})=>s.unstable_sx({padding:"16px 24px",borderBottom:`1px solid ${s.palette.divider}`})}},MuiDialogActions:{styleOverrides:{root:({theme:s})=>s.unstable_sx({borderTop:`1px solid ${s.palette.divider}`,padding:"16px 24px"})}},MuiDialogContent:{styleOverrides:{root:{padding:"12px 24px !important"}}},MuiButton:{defaultProps:{size:"small"},styleOverrides:{}}}},C={typography:{big:{...d},button:{textTransform:"none",WebkitTextTransform:"none"}}},$=({children:s})=>i.jsx(r.ConfigProvider,{theme:f,translations:p.translations,fallbackLocale:"en",injectFirst:!0,children:i.jsx(o.SessionProvider,{serviceHost:a,protectedRoutes:[`${u}/*`],children:s})}),g=({children:s})=>i.jsx(r.ConfigProvider,{theme:C,translations:p.translations,fallbackLocale:"en",injectFirst:!0,children:i.jsx(o.SessionProvider,{serviceHost:a,protectedRoutes:[`${u}/*`],children:s})});exports.DashboardProvider=$;exports.PageProvider=g;
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { d as
|
|
3
|
-
import { useLocaleContext as
|
|
4
|
-
import
|
|
5
|
-
import { useHeaderState as
|
|
6
|
-
import { useColorConvert as
|
|
7
|
-
import { setPageDataSource as
|
|
8
|
-
import { generateParamCombinations as
|
|
1
|
+
import { jsx as e, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { d as q, e as pe, g as me, u as de, c as ge } from "./state-BcZbsEn6.js";
|
|
3
|
+
import { useLocaleContext as K } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
+
import Q from "@arcblock/ux/lib/Result";
|
|
5
|
+
import { useHeaderState as fe } from "@blocklet/pages-kit/builtin/page/header";
|
|
6
|
+
import { useColorConvert as he } from "@blocklet/pages-kit/contexts/color";
|
|
7
|
+
import { setPageDataSource as X } from "@blocklet/pages-kit/utils/data-source";
|
|
8
|
+
import { generateParamCombinations as be } from "@blocklet/pages-kit/utils/route";
|
|
9
9
|
import ye from "@blocklet/ui-react/lib/Header";
|
|
10
|
-
import { cx as
|
|
11
|
-
import { Global as
|
|
12
|
-
import
|
|
13
|
-
import { Box as L, CircularProgress as
|
|
14
|
-
import { useReactive as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { useEffect as F,
|
|
20
|
-
import { Helmet as
|
|
21
|
-
import { useSearchParams as
|
|
22
|
-
import { useAsync as
|
|
23
|
-
import { joinURL as
|
|
24
|
-
import { S as
|
|
25
|
-
import { styled as
|
|
26
|
-
import
|
|
10
|
+
import { cx as Y } from "@emotion/css";
|
|
11
|
+
import { Global as J, css as Z } from "@emotion/react";
|
|
12
|
+
import ee from "@emotion/styled";
|
|
13
|
+
import { Box as L, CircularProgress as ve, useTheme as te, Button as we, Stack as Pe, alpha as G, useMediaQuery as xe } from "@mui/material";
|
|
14
|
+
import { useReactive as oe, useScroll as ke } from "ahooks";
|
|
15
|
+
import Se from "isomorphic-dompurify";
|
|
16
|
+
import $ from "lodash/cloneDeep";
|
|
17
|
+
import Ce from "lodash/isEmpty";
|
|
18
|
+
import ne from "lodash/isEqual";
|
|
19
|
+
import { useEffect as F, lazy as re, useMemo as R, useRef as ae, Suspense as Ie, useState as je } from "react";
|
|
20
|
+
import { Helmet as Re } from "react-helmet";
|
|
21
|
+
import { useSearchParams as se, Routes as Ee, Route as I, Navigate as Te, ScrollRestoration as Me } from "react-router-dom";
|
|
22
|
+
import { useAsync as ie } from "react-use";
|
|
23
|
+
import { joinURL as j } from "ufo";
|
|
24
|
+
import { S as Be, n as Oe, P as Fe, a as Le, B as _e, g as De } from "./array-CO3-y-Ol.js";
|
|
25
|
+
import { styled as le, useTheme as Ne } from "@arcblock/ux/lib/Theme";
|
|
26
|
+
import $e from "@blocklet/ui-react/lib/Footer";
|
|
27
27
|
import "webfontloader";
|
|
28
|
-
import {
|
|
29
|
-
const
|
|
28
|
+
import { u as Ae, a as He } from "./session-CVblGhSp.js";
|
|
29
|
+
const Ue = le($e, { shouldForwardProp: (t) => !!t })`
|
|
30
30
|
& > div > .MuiContainer-root {
|
|
31
31
|
max-width: unset;
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
return /* @__PURE__ */ e(
|
|
34
|
+
function Ve({ meta: t, ...n }) {
|
|
35
|
+
const a = Ne();
|
|
36
|
+
return /* @__PURE__ */ e(Ue, { ...n, meta: t, theme: a || {} });
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */ e(L, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...t, children: /* @__PURE__ */ e(
|
|
38
|
+
function ze(t) {
|
|
39
|
+
return /* @__PURE__ */ e(L, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...t, children: /* @__PURE__ */ e(ve, { size: 30 }) });
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return /* @__PURE__ */ e(
|
|
41
|
+
function Ge(t) {
|
|
42
|
+
return /* @__PURE__ */ e(We, { ...t });
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const We = le(L)`
|
|
45
45
|
position: fixed;
|
|
46
46
|
left: 0;
|
|
47
47
|
top: 0;
|
|
@@ -52,21 +52,21 @@ const qe = ce(L)`
|
|
|
52
52
|
opacity: 0.7;
|
|
53
53
|
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
54
54
|
pointer-events: none;
|
|
55
|
-
`,
|
|
55
|
+
`, qe = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
56
56
|
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;
|
|
57
|
-
function
|
|
57
|
+
function Ke({
|
|
58
58
|
titleFontFamily: t,
|
|
59
59
|
descriptionFontFamily: n
|
|
60
60
|
}) {
|
|
61
61
|
var o;
|
|
62
|
-
const
|
|
62
|
+
const a = te(), r = (o = a == null ? void 0 : a.typography) == null ? void 0 : o.fontFamily;
|
|
63
63
|
F(() => {
|
|
64
64
|
}, [t, n]);
|
|
65
|
-
const l = `${
|
|
65
|
+
const l = `${r}, ${qe}`;
|
|
66
66
|
return /* @__PURE__ */ e(
|
|
67
|
-
|
|
67
|
+
J,
|
|
68
68
|
{
|
|
69
|
-
styles:
|
|
69
|
+
styles: Z`
|
|
70
70
|
#app {
|
|
71
71
|
font-family: ${l};
|
|
72
72
|
|
|
@@ -82,84 +82,70 @@ function Qe({
|
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return Re(Xe);
|
|
88
|
-
}
|
|
89
|
-
function Ye(...t) {
|
|
90
|
-
var r;
|
|
91
|
-
const { session: n } = U();
|
|
92
|
-
return t.includes((r = n.user) == null ? void 0 : r.role);
|
|
93
|
-
}
|
|
94
|
-
function Je(...t) {
|
|
95
|
-
var a;
|
|
96
|
-
const { session: n } = U(), r = Ye(...t);
|
|
97
|
-
return ((a = window.blocklet) == null ? void 0 : a.tenantMode) === "multiple" ? !!n.user : r;
|
|
98
|
-
}
|
|
99
|
-
function _t() {
|
|
100
|
-
const [t] = ie(), { session: n } = U(), r = Je("owner", "admin", "pagesEditor", "member"), a = j(() => {
|
|
85
|
+
function Et() {
|
|
86
|
+
const [t] = se(), { session: n } = Ae(), a = He("owner", "admin", "pagesEditor", "member"), r = R(() => {
|
|
101
87
|
const o = t.get("mode");
|
|
102
|
-
return
|
|
103
|
-
}, [t]), l =
|
|
104
|
-
return l ? /* @__PURE__ */ e(
|
|
88
|
+
return Be.includes(o) ? o : "production";
|
|
89
|
+
}, [t]), l = r === "production" ? r : n.user ? a ? r : "production" : null;
|
|
90
|
+
return l ? /* @__PURE__ */ e(Qe, { mode: l }) : null;
|
|
105
91
|
}
|
|
106
|
-
function
|
|
92
|
+
function Qe({ mode: t }) {
|
|
107
93
|
if (t !== "draft") {
|
|
108
94
|
const n = window.__PAGE_STATE__;
|
|
109
|
-
return n ? /* @__PURE__ */ e(H, { mode: t, state: n }) : /* @__PURE__ */ e(
|
|
95
|
+
return n ? /* @__PURE__ */ e(H, { mode: t, state: n }) : /* @__PURE__ */ e(Ye, { mode: t, children: ({ state: a }) => /* @__PURE__ */ e(H, { mode: t, state: a }) });
|
|
110
96
|
}
|
|
111
|
-
return /* @__PURE__ */ e(
|
|
97
|
+
return /* @__PURE__ */ e(Xe, { children: ({ state: n }) => /* @__PURE__ */ e(H, { mode: t, state: n }) });
|
|
112
98
|
}
|
|
113
|
-
const
|
|
114
|
-
function
|
|
99
|
+
const Xe = re(() => import("./draft-data-DB1pDB18.js"));
|
|
100
|
+
function Ye({
|
|
115
101
|
mode: t,
|
|
116
102
|
children: n
|
|
117
103
|
}) {
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
const c = localStorage.getItem(
|
|
104
|
+
const a = document.querySelector('meta[property="pages:version"]'), r = a == null ? void 0 : a.content, l = de(), o = R(() => {
|
|
105
|
+
if (r === "{{pagesPublishedAt}}") {
|
|
106
|
+
const c = localStorage.getItem(ge(l ?? ""));
|
|
121
107
|
return Number(c) ? Number(c) : (/* @__PURE__ */ new Date()).getTime();
|
|
122
108
|
}
|
|
123
|
-
return Number(
|
|
124
|
-
}, [
|
|
125
|
-
return d ? /* @__PURE__ */ e(
|
|
109
|
+
return Number(r);
|
|
110
|
+
}, [r]), { loading: d, value: s } = ie(() => De({ mode: t, version: o }), [t, o]);
|
|
111
|
+
return d ? /* @__PURE__ */ e(ze, {}) : s ? n({ state: s }) : null;
|
|
126
112
|
}
|
|
127
113
|
function H({ mode: t, state: n }) {
|
|
128
|
-
const { t:
|
|
114
|
+
const { t: a, locale: r } = K(), [l] = se(), o = l.get("hiddenBadge") === "true", d = l.get("showPublish") === "true", {
|
|
129
115
|
pageIds: s,
|
|
130
116
|
pages: c,
|
|
131
117
|
routeIds: g,
|
|
132
118
|
routes: p,
|
|
133
119
|
supportedLocales: m,
|
|
134
120
|
config: { defaultLocale: f },
|
|
135
|
-
resources:
|
|
136
|
-
} = n, w =
|
|
137
|
-
() => m != null && m.some((u) => u.locale ===
|
|
138
|
-
[
|
|
139
|
-
), E = Object.values(p || {}).find((u) => (u == null ? void 0 : u.path) === "/") || Object.values(c).find((u) => (u == null ? void 0 : u.slug) === "/") ? void 0 : Object.values(c)[0], _ =
|
|
121
|
+
resources: v
|
|
122
|
+
} = n, w = q(n), b = R(
|
|
123
|
+
() => m != null && m.some((u) => u.locale === r) ? r : void 0,
|
|
124
|
+
[r, m]
|
|
125
|
+
), E = Object.values(p || {}).find((u) => (u == null ? void 0 : u.path) === "/") || Object.values(c).find((u) => (u == null ? void 0 : u.slug) === "/") ? void 0 : Object.values(c)[0], _ = R(
|
|
140
126
|
() => s.map((u) => {
|
|
141
127
|
const i = c[u];
|
|
142
128
|
return i && {
|
|
143
129
|
id: i.id,
|
|
144
|
-
path:
|
|
130
|
+
path: j("/", b || "", i.slug, t !== "production" ? `?mode=${t}` : "")
|
|
145
131
|
};
|
|
146
|
-
}).filter(
|
|
132
|
+
}).filter(Oe),
|
|
147
133
|
[s, c, b, t]
|
|
148
|
-
),
|
|
149
|
-
/* @__PURE__ */ e(
|
|
134
|
+
), k = ([...u]) => (t !== "production" && d && u.unshift(
|
|
135
|
+
/* @__PURE__ */ e(Ie, { fallback: /* @__PURE__ */ e("div", {}), children: /* @__PURE__ */ e(Je, { mode: "production", state: n }) })
|
|
150
136
|
), u);
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
E && /* @__PURE__ */ e(I, { index: !0, element: /* @__PURE__ */ e(
|
|
137
|
+
return /* @__PURE__ */ N(Fe, { value: { pages: _ }, children: [
|
|
138
|
+
/* @__PURE__ */ N(Ee, { children: [
|
|
139
|
+
E && /* @__PURE__ */ e(I, { index: !0, element: /* @__PURE__ */ e(Te, { to: j("/", b || "", E.slug) }) }),
|
|
154
140
|
g == null ? void 0 : g.map((u) => {
|
|
155
|
-
var
|
|
141
|
+
var T, M, P, h;
|
|
156
142
|
const i = p == null ? void 0 : p[u];
|
|
157
143
|
if (!i || !i.displayTemplateId) return null;
|
|
158
|
-
const
|
|
159
|
-
if (!
|
|
144
|
+
const S = c[i.displayTemplateId];
|
|
145
|
+
if (!S) return null;
|
|
160
146
|
let C = [];
|
|
161
147
|
if (i.params && i.params.length > 0) {
|
|
162
|
-
const
|
|
148
|
+
const x = be({
|
|
163
149
|
basePath: i.path,
|
|
164
150
|
params: i.params,
|
|
165
151
|
routeId: i.id,
|
|
@@ -169,24 +155,24 @@ function H({ mode: t, state: n }) {
|
|
|
169
155
|
currentOptionIds: [],
|
|
170
156
|
result: []
|
|
171
157
|
});
|
|
172
|
-
C =
|
|
173
|
-
var O, V, z
|
|
174
|
-
const B =
|
|
158
|
+
C = x == null ? void 0 : x.map((D) => {
|
|
159
|
+
var O, U, V, z;
|
|
160
|
+
const B = D.paramOptionIds.join("-");
|
|
175
161
|
return /* @__PURE__ */ e(
|
|
176
162
|
I,
|
|
177
163
|
{
|
|
178
|
-
path:
|
|
164
|
+
path: j(":projectIdOrSlug?", D.path),
|
|
179
165
|
element: /* @__PURE__ */ e(
|
|
180
|
-
|
|
166
|
+
W,
|
|
181
167
|
{
|
|
182
168
|
mode: t,
|
|
183
169
|
components: w,
|
|
184
|
-
page:
|
|
170
|
+
page: S,
|
|
185
171
|
locale: b,
|
|
186
172
|
defaultLocale: f,
|
|
187
|
-
headerAddons:
|
|
173
|
+
headerAddons: k,
|
|
188
174
|
state: n,
|
|
189
|
-
pageData: (
|
|
175
|
+
pageData: (z = (V = (U = (O = i.dataSource) == null ? void 0 : O.pathDataMappings) == null ? void 0 : U[B]) == null ? void 0 : V.dataCache) == null ? void 0 : z[b || f || "en"]
|
|
190
176
|
}
|
|
191
177
|
)
|
|
192
178
|
},
|
|
@@ -198,18 +184,18 @@ function H({ mode: t, state: n }) {
|
|
|
198
184
|
/* @__PURE__ */ e(
|
|
199
185
|
I,
|
|
200
186
|
{
|
|
201
|
-
path:
|
|
187
|
+
path: j(":projectIdOrSlug?", i.path),
|
|
202
188
|
element: /* @__PURE__ */ e(
|
|
203
|
-
|
|
189
|
+
W,
|
|
204
190
|
{
|
|
205
191
|
mode: t,
|
|
206
192
|
components: w,
|
|
207
|
-
page:
|
|
193
|
+
page: S,
|
|
208
194
|
locale: b,
|
|
209
195
|
defaultLocale: f,
|
|
210
|
-
headerAddons:
|
|
196
|
+
headerAddons: k,
|
|
211
197
|
state: n,
|
|
212
|
-
pageData: (h = (
|
|
198
|
+
pageData: (h = (P = (M = (T = i.dataSource) == null ? void 0 : T.pathDataMappings) == null ? void 0 : M[i.id]) == null ? void 0 : P.dataCache) == null ? void 0 : h[b || f || "en"]
|
|
213
199
|
}
|
|
214
200
|
)
|
|
215
201
|
},
|
|
@@ -222,35 +208,35 @@ function H({ mode: t, state: n }) {
|
|
|
222
208
|
return i ? /* @__PURE__ */ e(
|
|
223
209
|
I,
|
|
224
210
|
{
|
|
225
|
-
path:
|
|
211
|
+
path: j(":projectIdOrSlug?", i.slug),
|
|
226
212
|
element: /* @__PURE__ */ e(
|
|
227
|
-
|
|
213
|
+
A,
|
|
228
214
|
{
|
|
229
215
|
mode: t,
|
|
230
216
|
components: w,
|
|
231
217
|
page: i,
|
|
232
218
|
locale: b,
|
|
233
219
|
defaultLocale: f,
|
|
234
|
-
headerAddons:
|
|
220
|
+
headerAddons: k
|
|
235
221
|
}
|
|
236
222
|
)
|
|
237
223
|
},
|
|
238
224
|
i.id
|
|
239
225
|
) : null;
|
|
240
226
|
}),
|
|
241
|
-
|
|
227
|
+
v.pages && Object.values(v.pages).map(({ blockletId: u, page: i }) => /* @__PURE__ */ e(
|
|
242
228
|
I,
|
|
243
229
|
{
|
|
244
|
-
path:
|
|
230
|
+
path: j("/", `@${u}`, i.slug),
|
|
245
231
|
element: /* @__PURE__ */ e(
|
|
246
|
-
|
|
232
|
+
A,
|
|
247
233
|
{
|
|
248
234
|
mode: t,
|
|
249
235
|
components: w,
|
|
250
236
|
page: i,
|
|
251
237
|
locale: b,
|
|
252
238
|
defaultLocale: f,
|
|
253
|
-
headerAddons:
|
|
239
|
+
headerAddons: k
|
|
254
240
|
}
|
|
255
241
|
)
|
|
256
242
|
},
|
|
@@ -260,39 +246,39 @@ function H({ mode: t, state: n }) {
|
|
|
260
246
|
I,
|
|
261
247
|
{
|
|
262
248
|
path: "*",
|
|
263
|
-
element: /* @__PURE__ */ e(L, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(
|
|
249
|
+
element: /* @__PURE__ */ e(L, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(Q, { status: 404, extra: /* @__PURE__ */ e(ue, { href: "/", children: a("common.back") }) }) })
|
|
264
250
|
}
|
|
265
251
|
)
|
|
266
252
|
] }),
|
|
267
|
-
t !== "production" && !o && /* @__PURE__ */ e(
|
|
268
|
-
/* @__PURE__ */ e(
|
|
253
|
+
t !== "production" && !o && /* @__PURE__ */ e(Ge, { sx: { bgcolor: "info.light" }, children: t }),
|
|
254
|
+
/* @__PURE__ */ e(Ke, {})
|
|
269
255
|
] });
|
|
270
256
|
}
|
|
271
|
-
function
|
|
257
|
+
function W({
|
|
272
258
|
mode: t,
|
|
273
259
|
pageData: n,
|
|
274
|
-
components:
|
|
275
|
-
page:
|
|
260
|
+
components: a,
|
|
261
|
+
page: r,
|
|
276
262
|
locale: l,
|
|
277
263
|
defaultLocale: o,
|
|
278
264
|
headerAddons: d,
|
|
279
265
|
state: s
|
|
280
266
|
}) {
|
|
281
|
-
const c =
|
|
267
|
+
const c = oe({
|
|
282
268
|
page: null
|
|
283
269
|
});
|
|
284
270
|
F(() => {
|
|
285
|
-
const p =
|
|
286
|
-
p ? c.page =
|
|
287
|
-
}, [
|
|
288
|
-
const g =
|
|
271
|
+
const p = r || null;
|
|
272
|
+
p ? c.page = $(p) : c.page = null;
|
|
273
|
+
}, [r, c]);
|
|
274
|
+
const g = ae();
|
|
289
275
|
return F(() => {
|
|
290
|
-
|
|
276
|
+
ne(n, g.current) || n && c.page && (X(c.page, s, l, n), g.current = $(n));
|
|
291
277
|
}, [c.page, n, l, s]), c.page ? /* @__PURE__ */ e(
|
|
292
|
-
|
|
278
|
+
A,
|
|
293
279
|
{
|
|
294
280
|
mode: t,
|
|
295
|
-
components:
|
|
281
|
+
components: a,
|
|
296
282
|
page: c.page,
|
|
297
283
|
locale: l,
|
|
298
284
|
defaultLocale: o,
|
|
@@ -300,66 +286,66 @@ function q({
|
|
|
300
286
|
}
|
|
301
287
|
) : null;
|
|
302
288
|
}
|
|
303
|
-
function
|
|
289
|
+
function Tt({
|
|
304
290
|
mode: t,
|
|
305
291
|
state: n,
|
|
306
|
-
path:
|
|
307
|
-
pageData:
|
|
292
|
+
path: a,
|
|
293
|
+
pageData: r
|
|
308
294
|
}) {
|
|
309
|
-
const { t: l, locale: o } =
|
|
295
|
+
const { t: l, locale: o } = K(), {
|
|
310
296
|
pages: d,
|
|
311
297
|
supportedLocales: s,
|
|
312
298
|
config: { defaultLocale: c },
|
|
313
299
|
resources: g
|
|
314
|
-
} = n, p = Object.values(d).find((
|
|
315
|
-
() => s != null && s.some((
|
|
300
|
+
} = n, p = Object.values(d).find((y) => (y == null ? void 0 : y.slug) === a), m = Object.values(g.pages || {}).find((y) => y.page.slug === a), f = R(
|
|
301
|
+
() => s != null && s.some((y) => y.locale === o) ? o : void 0,
|
|
316
302
|
[o, s]
|
|
317
|
-
),
|
|
303
|
+
), v = oe({
|
|
318
304
|
page: null
|
|
319
305
|
});
|
|
320
306
|
F(() => {
|
|
321
|
-
const
|
|
322
|
-
|
|
307
|
+
const y = p || (m == null ? void 0 : m.page) || null;
|
|
308
|
+
y ? v.page = $(y) : v.page = null;
|
|
323
309
|
}, [p, m]);
|
|
324
|
-
const w =
|
|
310
|
+
const w = ae();
|
|
325
311
|
if (F(() => {
|
|
326
|
-
|
|
312
|
+
ne(r, w.current) || r && v.page && (X(v.page, n, f, r), w.current = $(r));
|
|
327
313
|
}, [{}]), !p && !(m != null && m.page))
|
|
328
|
-
return /* @__PURE__ */ e(L, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(
|
|
329
|
-
const b =
|
|
330
|
-
return
|
|
331
|
-
|
|
314
|
+
return /* @__PURE__ */ e(L, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(Q, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ e(ue, { href: "/", children: l("common.back") }) }) });
|
|
315
|
+
const b = q(n);
|
|
316
|
+
return v.page ? /* @__PURE__ */ e(
|
|
317
|
+
A,
|
|
332
318
|
{
|
|
333
319
|
mode: t,
|
|
334
320
|
components: b,
|
|
335
|
-
page:
|
|
321
|
+
page: v.page,
|
|
336
322
|
locale: f,
|
|
337
323
|
defaultLocale: c
|
|
338
324
|
}
|
|
339
325
|
) : null;
|
|
340
326
|
}
|
|
341
|
-
function
|
|
327
|
+
function A({
|
|
342
328
|
mode: t,
|
|
343
329
|
components: n,
|
|
344
|
-
page:
|
|
345
|
-
locale:
|
|
330
|
+
page: a,
|
|
331
|
+
locale: r,
|
|
346
332
|
defaultLocale: l,
|
|
347
333
|
headerAddons: o
|
|
348
334
|
}) {
|
|
349
|
-
var E, _,
|
|
350
|
-
const d =
|
|
351
|
-
() => (
|
|
352
|
-
var
|
|
353
|
-
let h = (o == null ? void 0 : o(
|
|
354
|
-
return h = ((
|
|
335
|
+
var E, _, k, u, i, S, C, T, M;
|
|
336
|
+
const d = he(), s = ((E = a.locales) == null ? void 0 : E[r]) ?? ((_ = a.locales) == null ? void 0 : _[l]) ?? {}, c = s.title || ((k = window.blocklet) == null ? void 0 : k.appName), g = s.description || ((u = window.blocklet) == null ? void 0 : u.appDescription), p = pe(me(s.image), 540), { logo: m, brand: f, description: v, ...w } = fe(), b = R(
|
|
337
|
+
() => (P) => {
|
|
338
|
+
var x;
|
|
339
|
+
let h = (o == null ? void 0 : o(P)) ?? P;
|
|
340
|
+
return h = ((x = w.addons) == null ? void 0 : x.call(w, h)) ?? h, h;
|
|
355
341
|
},
|
|
356
342
|
[w.addons, o]
|
|
357
|
-
),
|
|
358
|
-
return /* @__PURE__ */
|
|
343
|
+
), y = (i = s.header) != null && i.translucent ? et : ce;
|
|
344
|
+
return /* @__PURE__ */ N(Le, { page: a, defaultLocale: l, currentLocale: r, children: [
|
|
359
345
|
/* @__PURE__ */ e(
|
|
360
|
-
|
|
346
|
+
J,
|
|
361
347
|
{
|
|
362
|
-
styles:
|
|
348
|
+
styles: Z`
|
|
363
349
|
body {
|
|
364
350
|
background-color: ${d(
|
|
365
351
|
!s.backgroundColor || s.backgroundColor === "transparent" ? "background.default" : s.backgroundColor
|
|
@@ -369,20 +355,20 @@ function $({
|
|
|
369
355
|
}
|
|
370
356
|
),
|
|
371
357
|
/* @__PURE__ */ e(
|
|
372
|
-
|
|
358
|
+
y,
|
|
373
359
|
{
|
|
374
|
-
hideNavMenu: !!((
|
|
360
|
+
hideNavMenu: !!((S = s.header) != null && S.hideNavMenus),
|
|
375
361
|
translucentTextColor: (C = s.header) == null ? void 0 : C.translucentTextColor,
|
|
376
362
|
...m ? { logo: m } : {},
|
|
377
363
|
...f ? { brand: f } : {},
|
|
378
|
-
...
|
|
379
|
-
className:
|
|
364
|
+
...v ? { description: v } : {},
|
|
365
|
+
className: Y(((T = s.header) == null ? void 0 : T.sticky) && "sticky", "page-header"),
|
|
380
366
|
maxWidth: !1,
|
|
381
367
|
addons: b
|
|
382
368
|
}
|
|
383
369
|
),
|
|
384
|
-
/* @__PURE__ */ e(
|
|
385
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ e(Me, {}),
|
|
371
|
+
/* @__PURE__ */ N(Re, { children: [
|
|
386
372
|
/* @__PURE__ */ e("title", { children: c }),
|
|
387
373
|
/* @__PURE__ */ e("meta", { name: "og:title", content: c }),
|
|
388
374
|
/* @__PURE__ */ e("meta", { name: "og:description", content: g }),
|
|
@@ -394,7 +380,7 @@ function $({
|
|
|
394
380
|
/* @__PURE__ */ e("meta", { name: "description", content: g })
|
|
395
381
|
] }),
|
|
396
382
|
/* @__PURE__ */ e(
|
|
397
|
-
|
|
383
|
+
Pe,
|
|
398
384
|
{
|
|
399
385
|
flexGrow: 1,
|
|
400
386
|
className: "PageView-root",
|
|
@@ -404,21 +390,21 @@ function $({
|
|
|
404
390
|
pt: "0 !important"
|
|
405
391
|
}
|
|
406
392
|
},
|
|
407
|
-
children:
|
|
393
|
+
children: a.sectionIds.map((P) => {
|
|
408
394
|
var B, O;
|
|
409
|
-
const h =
|
|
395
|
+
const h = a.sections[P];
|
|
410
396
|
if (!h || h.visibility === "hidden") return null;
|
|
411
|
-
const
|
|
397
|
+
const x = (B = h.locales) == null ? void 0 : B[r], D = ((O = h.locales) == null ? void 0 : O[l]) ?? {};
|
|
412
398
|
return /* @__PURE__ */ e(
|
|
413
|
-
|
|
399
|
+
_e,
|
|
414
400
|
{
|
|
415
|
-
id:
|
|
401
|
+
id: P,
|
|
416
402
|
type: h.component,
|
|
417
403
|
mode: t,
|
|
418
404
|
section: h,
|
|
419
405
|
config: {
|
|
420
|
-
...
|
|
421
|
-
locale:
|
|
406
|
+
...Ce(x) ? D : x,
|
|
407
|
+
locale: r,
|
|
422
408
|
dev: t === "draft" ? {
|
|
423
409
|
mode: t,
|
|
424
410
|
components: n,
|
|
@@ -426,25 +412,25 @@ function $({
|
|
|
426
412
|
} : { mode: t }
|
|
427
413
|
}
|
|
428
414
|
},
|
|
429
|
-
|
|
415
|
+
P
|
|
430
416
|
);
|
|
431
417
|
})
|
|
432
418
|
}
|
|
433
419
|
),
|
|
434
|
-
!((
|
|
420
|
+
!((M = s.footer) != null && M.hidden) && /* @__PURE__ */ e(Ve, {})
|
|
435
421
|
] });
|
|
436
422
|
}
|
|
437
|
-
const
|
|
423
|
+
const Je = re(() => import("./publish-button-BZZOvMB8.js")), ce = ee(ye)`
|
|
438
424
|
&.sticky {
|
|
439
425
|
position: sticky;
|
|
440
426
|
top: 0;
|
|
441
427
|
}
|
|
442
428
|
`;
|
|
443
|
-
function
|
|
444
|
-
const [n,
|
|
429
|
+
function Ze({ logo: t }) {
|
|
430
|
+
const [n, a] = je(), r = xe((o) => o.breakpoints.down("sm")), { value: l } = ie(() => {
|
|
445
431
|
var s, c;
|
|
446
432
|
const o = new URL(
|
|
447
|
-
|
|
433
|
+
r ? ((s = window == null ? void 0 : window.blocklet) == null ? void 0 : s.appLogo) || "/.well-known/service/blocklet/logo" : ((c = window == null ? void 0 : window.blocklet) == null ? void 0 : c.appLogoRect) || "/.well-known/service/blocklet/logo-rect",
|
|
448
434
|
window.location.origin
|
|
449
435
|
);
|
|
450
436
|
o.searchParams.delete("imageFilter"), o.searchParams.delete("f");
|
|
@@ -453,15 +439,15 @@ function nt({ logo: t }) {
|
|
|
453
439
|
fetch(d).then((p) => {
|
|
454
440
|
const m = p.headers.get("content-type");
|
|
455
441
|
m != null && m.includes("svg") && p.text().then((f) => {
|
|
456
|
-
|
|
442
|
+
a(f), g(null);
|
|
457
443
|
}), g(p.url);
|
|
458
444
|
});
|
|
459
445
|
});
|
|
460
|
-
}, [
|
|
446
|
+
}, [r]);
|
|
461
447
|
if (t)
|
|
462
448
|
return t;
|
|
463
449
|
if (n)
|
|
464
|
-
return /* @__PURE__ */ e(L, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html:
|
|
450
|
+
return /* @__PURE__ */ e(L, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: Se.sanitize(n) } });
|
|
465
451
|
if (l) {
|
|
466
452
|
const o = new URL(l);
|
|
467
453
|
o.searchParams.set("imageFilter", "convert"), o.searchParams.set("f", "png"), o.searchParams.set("h", "80");
|
|
@@ -470,21 +456,21 @@ function nt({ logo: t }) {
|
|
|
470
456
|
}
|
|
471
457
|
return null;
|
|
472
458
|
}
|
|
473
|
-
function
|
|
459
|
+
function et({
|
|
474
460
|
logo: t,
|
|
475
461
|
translucentTextColor: n,
|
|
476
|
-
...
|
|
462
|
+
...a
|
|
477
463
|
}) {
|
|
478
|
-
const { top:
|
|
479
|
-
let o = Math.min(
|
|
480
|
-
return o > 0.1 ? (o = Math.max(o, 0.6), d =
|
|
481
|
-
|
|
464
|
+
const { top: r = 0 } = ke(() => document.getElementById("app")) || {}, l = te();
|
|
465
|
+
let o = Math.min(r / 800, 1), d = "";
|
|
466
|
+
return o > 0.1 ? (o = Math.max(o, 0.6), d = G(l.palette.text.primary, o)) : d = n || "#EEEEEE", /* @__PURE__ */ e(
|
|
467
|
+
ce,
|
|
482
468
|
{
|
|
483
|
-
logo: /* @__PURE__ */ e(
|
|
484
|
-
...
|
|
485
|
-
className:
|
|
469
|
+
logo: /* @__PURE__ */ e(Ze, { logo: t }),
|
|
470
|
+
...a,
|
|
471
|
+
className: Y(o <= 0.7 && "reverse-color"),
|
|
486
472
|
style: {
|
|
487
|
-
backgroundColor:
|
|
473
|
+
backgroundColor: G(l.palette.background.default, o),
|
|
488
474
|
// @ts-ignore
|
|
489
475
|
"--logo-invert": o <= 0.7 ? 1 - o / 6 : 1 - o
|
|
490
476
|
},
|
|
@@ -514,14 +500,14 @@ function rt({
|
|
|
514
500
|
}
|
|
515
501
|
);
|
|
516
502
|
}
|
|
517
|
-
const
|
|
503
|
+
const ue = ee(we)``;
|
|
518
504
|
export {
|
|
519
|
-
|
|
520
|
-
|
|
505
|
+
Et as H,
|
|
506
|
+
ze as L,
|
|
521
507
|
H as P,
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
508
|
+
et as T,
|
|
509
|
+
Qe as a,
|
|
510
|
+
W as b,
|
|
511
|
+
Tt as c,
|
|
512
|
+
A as d
|
|
527
513
|
};
|
|
@@ -10,7 +10,7 @@ import { produce as Oe } from "immer";
|
|
|
10
10
|
import ee from "lodash/difference";
|
|
11
11
|
import { useState as T, useMemo as R, useCallback as j, forwardRef as Te, useImperativeHandle as je, useEffect as W, useRef as ve } from "react";
|
|
12
12
|
import { useAsync as Re } from "react-use";
|
|
13
|
-
import { L as Ee } from "./home-
|
|
13
|
+
import { L as Ee } from "./home-ngRf6bmH.js";
|
|
14
14
|
import { p as ze, g as Be } from "./array-CO3-y-Ol.js";
|
|
15
15
|
function Le(s) {
|
|
16
16
|
const [y, w] = T(!1);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createAuthServiceSessionContext as i } from "@arcblock/did-connect/lib/Session";
|
|
2
|
+
import { useContext as r } from "react";
|
|
3
|
+
const { SessionProvider: S, SessionContext: u, SessionConsumer: f, withSession: m } = i();
|
|
4
|
+
function t() {
|
|
5
|
+
return r(u);
|
|
6
|
+
}
|
|
7
|
+
function c(...s) {
|
|
8
|
+
var e;
|
|
9
|
+
const { session: n } = t();
|
|
10
|
+
return s.includes((e = n.user) == null ? void 0 : e.role);
|
|
11
|
+
}
|
|
12
|
+
function h(...s) {
|
|
13
|
+
var o;
|
|
14
|
+
const { session: n } = t(), e = c(...s);
|
|
15
|
+
return ((o = window.blocklet) == null ? void 0 : o.tenantMode) === "multiple" ? !!n.user : e;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
S,
|
|
19
|
+
h as a,
|
|
20
|
+
t as u
|
|
21
|
+
};
|
package/lib/es/home.js
CHANGED
|
@@ -22,13 +22,14 @@ import "react-router-dom";
|
|
|
22
22
|
import "react-use";
|
|
23
23
|
import "ufo";
|
|
24
24
|
import "./chunks/array-CO3-y-Ol.js";
|
|
25
|
-
import { a as
|
|
25
|
+
import { a as R, P as S, d as W, c as j, b as k, T as q, H as v } from "./chunks/home-ngRf6bmH.js";
|
|
26
|
+
import "./chunks/session-CVblGhSp.js";
|
|
26
27
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
R as HomeView,
|
|
29
|
+
S as PageRoutes,
|
|
30
|
+
W as PageView,
|
|
31
|
+
j as PageViewByPath,
|
|
32
|
+
k as PageViewWithDataSource,
|
|
33
|
+
q as TranslucentHeader,
|
|
34
|
+
v as default
|
|
34
35
|
};
|
package/lib/es/theme.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { ConfigProvider as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import
|
|
5
|
-
import { listItemIconClasses as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider as f } from "@arcblock/ux/lib/Config";
|
|
3
|
+
import { Icon as y } from "@iconify-icon/react";
|
|
4
|
+
import g from "@iconify-icons/tabler/chevron-down";
|
|
5
|
+
import { listItemIconClasses as S, switchClasses as z, svgIconClasses as n, sliderClasses as a, outlinedInputClasses as d, inputBaseClasses as t, filledInputClasses as m, inputLabelClasses as i, inputClasses as l, selectClasses as v, autocompleteClasses as p, Box as M } from "@mui/material";
|
|
6
|
+
import { S as b } from "./chunks/session-CVblGhSp.js";
|
|
7
|
+
import { translations as c } from "./locales.js";
|
|
8
|
+
var x;
|
|
9
|
+
const o = ((x = window.blocklet) == null ? void 0 : x.prefix) || "/", $ = o.endsWith("/") ? `${o}admin` : `${o}/admin`, h = {
|
|
8
10
|
fontSize: "5rem",
|
|
9
11
|
"@media (max-width: 1536px)": {
|
|
10
12
|
fontSize: "5rem"
|
|
@@ -20,11 +22,11 @@ const f = {
|
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
24
|
function u(e) {
|
|
23
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ s(M, { ...e, component: y, icon: g });
|
|
24
26
|
}
|
|
25
|
-
const
|
|
27
|
+
const I = {
|
|
26
28
|
typography: {
|
|
27
|
-
big: { ...
|
|
29
|
+
big: { ...h },
|
|
28
30
|
button: {
|
|
29
31
|
// @ts-ignore
|
|
30
32
|
textTransform: "none",
|
|
@@ -81,10 +83,10 @@ const S = {
|
|
|
81
83
|
styleOverrides: {
|
|
82
84
|
root: {
|
|
83
85
|
padding: 4,
|
|
84
|
-
[`.${
|
|
86
|
+
[`.${n.fontSizeMedium}`]: {
|
|
85
87
|
fontSize: "1.25rem"
|
|
86
88
|
},
|
|
87
|
-
[`.${
|
|
89
|
+
[`.${n.fontSizeSmall}`]: {
|
|
88
90
|
fontSize: "1.125rem"
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -94,10 +96,10 @@ const S = {
|
|
|
94
96
|
styleOverrides: {
|
|
95
97
|
root: {
|
|
96
98
|
padding: 4,
|
|
97
|
-
[`.${
|
|
99
|
+
[`.${n.fontSizeMedium}`]: {
|
|
98
100
|
fontSize: "1.25rem"
|
|
99
101
|
},
|
|
100
|
-
[`.${
|
|
102
|
+
[`.${n.fontSizeSmall}`]: {
|
|
101
103
|
fontSize: "1.125rem"
|
|
102
104
|
}
|
|
103
105
|
}
|
|
@@ -109,7 +111,7 @@ const S = {
|
|
|
109
111
|
height: 28,
|
|
110
112
|
width: 48,
|
|
111
113
|
padding: 8,
|
|
112
|
-
[`&.${
|
|
114
|
+
[`&.${z.sizeSmall}`]: {
|
|
113
115
|
height: 26,
|
|
114
116
|
width: 40,
|
|
115
117
|
padding: 8
|
|
@@ -121,21 +123,21 @@ const S = {
|
|
|
121
123
|
}
|
|
122
124
|
},
|
|
123
125
|
MuiAutocomplete: {
|
|
124
|
-
defaultProps: { popupIcon: /* @__PURE__ */
|
|
126
|
+
defaultProps: { popupIcon: /* @__PURE__ */ s(u, { fontSize: 14 }) },
|
|
125
127
|
variants: [
|
|
126
128
|
{
|
|
127
129
|
props: {},
|
|
128
130
|
style: ({ theme: e }) => e.unstable_sx({
|
|
129
|
-
[`.${
|
|
131
|
+
[`.${p.inputRoot}`]: {
|
|
130
132
|
pt: 1.5,
|
|
131
133
|
pb: 0.25,
|
|
132
|
-
[`.${
|
|
134
|
+
[`.${p.input}.${t.input}`]: {
|
|
133
135
|
px: 0,
|
|
134
136
|
pt: 0.5,
|
|
135
137
|
pb: 0.25
|
|
136
138
|
},
|
|
137
139
|
[`&.${t.sizeSmall}`]: {
|
|
138
|
-
[`.${
|
|
140
|
+
[`.${p.input}.${t.input}`]: {
|
|
139
141
|
px: 0,
|
|
140
142
|
py: 0,
|
|
141
143
|
pb: "1px"
|
|
@@ -174,7 +176,7 @@ const S = {
|
|
|
174
176
|
[`&.${t.hiddenLabel}`]: {
|
|
175
177
|
mt: 0,
|
|
176
178
|
pt: 0,
|
|
177
|
-
[`.${
|
|
179
|
+
[`.${v.select}.${l.input}:focus`]: {
|
|
178
180
|
bgcolor: "transparent"
|
|
179
181
|
}
|
|
180
182
|
}
|
|
@@ -192,7 +194,7 @@ const S = {
|
|
|
192
194
|
}
|
|
193
195
|
},
|
|
194
196
|
// filled
|
|
195
|
-
[`.${
|
|
197
|
+
[`.${m.root}`]: {
|
|
196
198
|
":before,:after": { display: "none" },
|
|
197
199
|
[`.${t.input}`]: {
|
|
198
200
|
pb: 0.5,
|
|
@@ -226,7 +228,7 @@ const S = {
|
|
|
226
228
|
}
|
|
227
229
|
},
|
|
228
230
|
// outlined
|
|
229
|
-
[`.${
|
|
231
|
+
[`.${d.root}`]: {
|
|
230
232
|
[`.${t.input}`]: {
|
|
231
233
|
py: 1.25,
|
|
232
234
|
px: 1,
|
|
@@ -297,7 +299,7 @@ const S = {
|
|
|
297
299
|
select: {
|
|
298
300
|
display: "flex",
|
|
299
301
|
alignItems: "center",
|
|
300
|
-
[`.${
|
|
302
|
+
[`.${S.root}`]: {
|
|
301
303
|
minWidth: 20
|
|
302
304
|
}
|
|
303
305
|
}
|
|
@@ -311,7 +313,7 @@ const S = {
|
|
|
311
313
|
borderRadius: 1,
|
|
312
314
|
lineHeight: "1.5rem",
|
|
313
315
|
// filled
|
|
314
|
-
[`&.${
|
|
316
|
+
[`&.${m.root}`]: {
|
|
315
317
|
":before,:after": { display: "none" },
|
|
316
318
|
[`.${t.input}`]: {
|
|
317
319
|
py: 0.5,
|
|
@@ -322,7 +324,7 @@ const S = {
|
|
|
322
324
|
}
|
|
323
325
|
},
|
|
324
326
|
// outlined
|
|
325
|
-
[`&.${
|
|
327
|
+
[`&.${d.root}`]: {
|
|
326
328
|
[`.${t.input}`]: {
|
|
327
329
|
py: 0.5,
|
|
328
330
|
borderRadius: 1,
|
|
@@ -342,16 +344,16 @@ const S = {
|
|
|
342
344
|
props: {},
|
|
343
345
|
style: ({ theme: e }) => e.unstable_sx({
|
|
344
346
|
height: 3,
|
|
345
|
-
[`.${
|
|
347
|
+
[`.${a.track}`]: {
|
|
346
348
|
borderWidth: 0
|
|
347
349
|
},
|
|
348
|
-
[`.${
|
|
350
|
+
[`.${a.thumb}`]: {
|
|
349
351
|
width: 16,
|
|
350
352
|
height: 16
|
|
351
353
|
},
|
|
352
|
-
[`&.${
|
|
354
|
+
[`&.${a.sizeSmall}`]: {
|
|
353
355
|
height: 2,
|
|
354
|
-
[`.${
|
|
356
|
+
[`.${a.thumb}`]: {
|
|
355
357
|
width: 12,
|
|
356
358
|
height: 12
|
|
357
359
|
}
|
|
@@ -447,36 +449,36 @@ const S = {
|
|
|
447
449
|
styleOverrides: {}
|
|
448
450
|
}
|
|
449
451
|
}
|
|
450
|
-
},
|
|
452
|
+
}, C = {
|
|
451
453
|
typography: {
|
|
452
454
|
// @ts-ignore
|
|
453
|
-
big: { ...
|
|
455
|
+
big: { ...h },
|
|
454
456
|
button: {
|
|
455
457
|
// @ts-ignore
|
|
456
458
|
textTransform: "none",
|
|
457
459
|
WebkitTextTransform: "none"
|
|
458
460
|
}
|
|
459
461
|
}
|
|
460
|
-
},
|
|
461
|
-
|
|
462
|
+
}, B = ({ children: e }) => /* @__PURE__ */ s(
|
|
463
|
+
f,
|
|
462
464
|
{
|
|
463
|
-
theme:
|
|
464
|
-
translations:
|
|
465
|
+
theme: I,
|
|
466
|
+
translations: c,
|
|
465
467
|
fallbackLocale: "en",
|
|
466
468
|
injectFirst: !0,
|
|
467
|
-
children: e
|
|
469
|
+
children: /* @__PURE__ */ s(b, { serviceHost: o, protectedRoutes: [`${$}/*`], children: e })
|
|
468
470
|
}
|
|
469
|
-
),
|
|
470
|
-
|
|
471
|
+
), H = ({ children: e }) => /* @__PURE__ */ s(
|
|
472
|
+
f,
|
|
471
473
|
{
|
|
472
|
-
theme:
|
|
473
|
-
translations:
|
|
474
|
+
theme: C,
|
|
475
|
+
translations: c,
|
|
474
476
|
fallbackLocale: "en",
|
|
475
477
|
injectFirst: !0,
|
|
476
|
-
children: e
|
|
478
|
+
children: /* @__PURE__ */ s(b, { serviceHost: o, protectedRoutes: [`${$}/*`], children: e })
|
|
477
479
|
}
|
|
478
480
|
);
|
|
479
481
|
export {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
+
B as DashboardProvider,
|
|
483
|
+
H as PageProvider
|
|
482
484
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit-inner-components",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -69,24 +69,24 @@
|
|
|
69
69
|
"url": "git+https://github.com/blocklet/pages-kit.git"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@arcblock/did-auth": "^1.20.
|
|
72
|
+
"@arcblock/did-auth": "^1.20.11",
|
|
73
73
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
74
|
-
"@arcblock/did-connect": "^2.13.
|
|
75
|
-
"@arcblock/react-hooks": "^2.13.
|
|
76
|
-
"@arcblock/ux": "^2.13.
|
|
77
|
-
"@blocklet/ai-kit": "^0.1.
|
|
78
|
-
"@blocklet/ai-runtime": "^0.4.
|
|
79
|
-
"@blocklet/code-editor": "^0.4.
|
|
80
|
-
"@blocklet/crawler": "^2.3.
|
|
74
|
+
"@arcblock/did-connect": "^2.13.41",
|
|
75
|
+
"@arcblock/react-hooks": "^2.13.41",
|
|
76
|
+
"@arcblock/ux": "^2.13.41",
|
|
77
|
+
"@blocklet/ai-kit": "^0.1.76",
|
|
78
|
+
"@blocklet/ai-runtime": "^0.4.270",
|
|
79
|
+
"@blocklet/code-editor": "^0.4.270",
|
|
80
|
+
"@blocklet/crawler": "^2.3.36",
|
|
81
81
|
"@blocklet/embed": "^0.2.4",
|
|
82
82
|
"@blocklet/js-sdk": "^1.16.43",
|
|
83
83
|
"@blocklet/logger": "1.16.36",
|
|
84
|
-
"@blocklet/quickjs": "^0.4.
|
|
84
|
+
"@blocklet/quickjs": "^0.4.270",
|
|
85
85
|
"@blocklet/sdk": "^1.16.43",
|
|
86
|
-
"@blocklet/studio-ui": "^0.4.
|
|
86
|
+
"@blocklet/studio-ui": "^0.4.270",
|
|
87
87
|
"@blocklet/tracker": "^1.16.43",
|
|
88
|
-
"@blocklet/ui-react": "^2.13.
|
|
89
|
-
"@blocklet/uploader": "^0.1.
|
|
88
|
+
"@blocklet/ui-react": "^2.13.41",
|
|
89
|
+
"@blocklet/uploader": "^0.1.91",
|
|
90
90
|
"@blocklet/uploader-server": "^0.1.98",
|
|
91
91
|
"@emotion/cache": "^11.13.1",
|
|
92
92
|
"@emotion/css": "^11.13.0",
|
|
@@ -106,9 +106,9 @@
|
|
|
106
106
|
"@mui/styles": "^5.16.14",
|
|
107
107
|
"@mui/utils": "^5.16.6",
|
|
108
108
|
"@mui/x-date-pickers": "^7.13.0",
|
|
109
|
-
"@ocap/client": "^1.20.
|
|
110
|
-
"@ocap/mcrypto": "^1.20.
|
|
111
|
-
"@ocap/wallet": "^1.20.
|
|
109
|
+
"@ocap/client": "^1.20.11",
|
|
110
|
+
"@ocap/mcrypto": "^1.20.11",
|
|
111
|
+
"@ocap/wallet": "^1.20.11",
|
|
112
112
|
"@reactivedata/reactive": "^0.2.2",
|
|
113
113
|
"@syncedstore/core": "^0.6.0",
|
|
114
114
|
"@syncedstore/react": "^0.6.0",
|
|
@@ -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.5.
|
|
209
|
-
"@blocklet/pages-kit-block-studio": "^0.5.
|
|
208
|
+
"@blocklet/pages-kit": "^0.5.15",
|
|
209
|
+
"@blocklet/pages-kit-block-studio": "^0.5.15"
|
|
210
210
|
},
|
|
211
211
|
"devDependencies": {
|
|
212
212
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),E=require("./state-D4MG-uJB.js"),Y=require("@arcblock/ux/lib/Locale/context"),le=require("@arcblock/ux/lib/Result"),ue=require("@blocklet/pages-kit/builtin/page/header"),de=require("@blocklet/pages-kit/contexts/color"),J=require("@blocklet/pages-kit/utils/data-source"),pe=require("@blocklet/pages-kit/utils/route"),ge=require("@blocklet/ui-react/lib/Header"),Z=require("@emotion/css"),N=require("@emotion/react"),me=require("@emotion/styled"),b=require("@mui/material"),G=require("ahooks"),fe=require("isomorphic-dompurify"),he=require("lodash/cloneDeep"),xe=require("lodash/isEmpty"),je=require("lodash/isEqual"),m=require("react"),ye=require("react-helmet"),P=require("react-router-dom"),ee=require("react-use"),M=require("ufo"),I=require("./array-DOh_uyzM.js"),W=require("@arcblock/ux/lib/Theme"),be=require("@blocklet/ui-react/lib/Footer");require("webfontloader");const ve=require("@arcblock/did-connect/lib/Session"),R=t=>t&&t.__esModule?t:{default:t},te=R(le),we=R(ge),ne=R(me),Pe=R(fe),V=R(he),Se=R(xe),oe=R(je),ke=R(be),Re=W.styled(ke.default,{shouldForwardProp:t=>!!t})`
|
|
2
|
-
& > div > .MuiContainer-root {
|
|
3
|
-
max-width: unset;
|
|
4
|
-
}
|
|
5
|
-
`;function Ce({meta:t,...o}){const s=W.useTheme();return e.jsx(Re,{...o,meta:t,theme:s||{}})}function se(t){return e.jsx(b.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...t,children:e.jsx(b.CircularProgress,{size:30})})}function qe(t){return e.jsx(_e,{...t})}const _e=W.styled(b.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=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
17
|
-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;function Ee({titleFontFamily:t,descriptionFontFamily:o}){var n;const s=b.useTheme(),r=(n=s==null?void 0:s.typography)==null?void 0:n.fontFamily;m.useEffect(()=>{},[t,o]);const c=`${r}, ${Me}`;return e.jsx(N.Global,{styles:N.css`
|
|
18
|
-
#app {
|
|
19
|
-
font-family: ${c};
|
|
20
|
-
|
|
21
|
-
.page-kit-section__title {
|
|
22
|
-
font-family: ${c};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.page-kit-section__description {
|
|
26
|
-
font-family: ${c};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`})}const{SessionProvider:Ae,SessionContext:Ie,SessionConsumer:Ne,withSession:Ve}=ve.createAuthServiceSessionContext();function $(){return m.useContext(Ie)}function Be(...t){var s;const{session:o}=$();return t.includes((s=o.user)==null?void 0:s.role)}function Te(...t){var r;const{session:o}=$(),s=Be(...t);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!o.user:s}function Le(){const[t]=P.useSearchParams(),{session:o}=$(),s=Te("owner","admin","pagesEditor","member"),r=m.useMemo(()=>{const n=t.get("mode");return I.STATE_MODES.includes(n)?n:"production"},[t]),c=r==="production"?r:o.user?s?r:"production":null;return c?e.jsx(re,{mode:c}):null}function re({mode:t}){if(t!=="draft"){const o=window.__PAGE_STATE__;return o?e.jsx(A,{mode:t,state:o}):e.jsx(Oe,{mode:t,children:({state:s})=>e.jsx(A,{mode:t,state:s})})}return e.jsx(De,{children:({state:o})=>e.jsx(A,{mode:t,state:o})})}const De=m.lazy(()=>Promise.resolve().then(()=>require("./draft-data-DPZIakr4.js")));function Oe({mode:t,children:o}){const s=document.querySelector('meta[property="pages:version"]'),r=s==null?void 0:s.content,c=E.useProjectId(),n=m.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const l=localStorage.getItem(E.getProjectPageVersionKey(c??""));return Number(l)?Number(l):new Date().getTime()}return Number(r)},[r]),{loading:g,value:a}=ee.useAsync(()=>I.getPages({mode:t,version:n}),[t,n]);return g?e.jsx(se,{}):a?o({state:a}):null}function A({mode:t,state:o}){const{t:s,locale:r}=Y.useLocaleContext(),[c]=P.useSearchParams(),n=c.get("hiddenBadge")==="true",g=c.get("showPublish")==="true",{pageIds:a,pages:l,routeIds:f,routes:d,supportedLocales:p,config:{defaultLocale:h},resources:v}=o,w=E.getAllComponents(o),j=m.useMemo(()=>p!=null&&p.some(u=>u.locale===r)?r:void 0,[r,p]),B=Object.values(d||{}).find(u=>(u==null?void 0:u.path)==="/")||Object.values(l).find(u=>(u==null?void 0:u.slug)==="/")?void 0:Object.values(l)[0],H=m.useMemo(()=>a.map(u=>{const i=l[u];return i&&{id:i.id,path:M.joinURL("/",j||"",i.slug,t!=="production"?`?mode=${t}`:"")}}).filter(I.nonNullable),[a,l,j,t]),C=([...u])=>(t!=="production"&&g&&u.unshift(e.jsx(m.Suspense,{fallback:e.jsx("div",{}),children:e.jsx(He,{mode:"production",state:o})})),u);return e.jsxs(I.Provider,{value:{pages:H},children:[e.jsxs(P.Routes,{children:[B&&e.jsx(P.Route,{index:!0,element:e.jsx(P.Navigate,{to:M.joinURL("/",j||"",B.slug)})}),f==null?void 0:f.map(u=>{var T,L,S,x;const i=d==null?void 0:d[u];if(!i||!i.displayTemplateId)return null;const q=l[i.displayTemplateId];if(!q)return null;let _=[];if(i.params&&i.params.length>0){const k=pe.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});_=k==null?void 0:k.map(U=>{var O,K,Q,X;const D=U.paramOptionIds.join("-");return e.jsx(P.Route,{path:M.joinURL(":projectIdOrSlug?",U.path),element:e.jsx(z,{mode:t,components:w,page:q,locale:j,defaultLocale:h,headerAddons:C,state:o,pageData:(X=(Q=(K=(O=i.dataSource)==null?void 0:O.pathDataMappings)==null?void 0:K[D])==null?void 0:Q.dataCache)==null?void 0:X[j||h||"en"]})},D)})}return _.push(e.jsx(P.Route,{path:M.joinURL(":projectIdOrSlug?",i.path),element:e.jsx(z,{mode:t,components:w,page:q,locale:j,defaultLocale:h,headerAddons:C,state:o,pageData:(x=(S=(L=(T=i.dataSource)==null?void 0:T.pathDataMappings)==null?void 0:L[i.id])==null?void 0:S.dataCache)==null?void 0:x[j||h||"en"]})},i.id)),_}),a.map(u=>{const i=l[u];return i?e.jsx(P.Route,{path:M.joinURL(":projectIdOrSlug?",i.slug),element:e.jsx(F,{mode:t,components:w,page:i,locale:j,defaultLocale:h,headerAddons:C})},i.id):null}),v.pages&&Object.values(v.pages).map(({blockletId:u,page:i})=>e.jsx(P.Route,{path:M.joinURL("/",`@${u}`,i.slug),element:e.jsx(F,{mode:t,components:w,page:i,locale:j,defaultLocale:h,headerAddons:C})},i.id)),e.jsx(P.Route,{path:"*",element:e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(te.default,{status:404,extra:e.jsx(ce,{href:"/",children:s("common.back")})})})})]}),t!=="production"&&!n&&e.jsx(qe,{sx:{bgcolor:"info.light"},children:t}),e.jsx(Ee,{})]})}function z({mode:t,pageData:o,components:s,page:r,locale:c,defaultLocale:n,headerAddons:g,state:a}){const l=G.useReactive({page:null});m.useEffect(()=>{const d=r||null;d?l.page=V.default(d):l.page=null},[r,l]);const f=m.useRef();return m.useEffect(()=>{oe.default(o,f.current)||o&&l.page&&(J.setPageDataSource(l.page,a,c,o),f.current=V.default(o))},[l.page,o,c,a]),l.page?e.jsx(F,{mode:t,components:s,page:l.page,locale:c,defaultLocale:n,headerAddons:g}):null}function Fe({mode:t,state:o,path:s,pageData:r}){const{t:c,locale:n}=Y.useLocaleContext(),{pages:g,supportedLocales:a,config:{defaultLocale:l},resources:f}=o,d=Object.values(g).find(y=>(y==null?void 0:y.slug)===s),p=Object.values(f.pages||{}).find(y=>y.page.slug===s),h=m.useMemo(()=>a!=null&&a.some(y=>y.locale===n)?n:void 0,[n,a]),v=G.useReactive({page:null});m.useEffect(()=>{const y=d||(p==null?void 0:p.page)||null;y?v.page=V.default(y):v.page=null},[d,p]);const w=m.useRef();if(m.useEffect(()=>{oe.default(r,w.current)||r&&v.page&&(J.setPageDataSource(v.page,o,h,r),w.current=V.default(r))},[{}]),!d&&!(p!=null&&p.page))return e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(te.default,{style:{background:"inherit"},status:404,extra:e.jsx(ce,{href:"/",children:c("common.back")})})});const j=E.getAllComponents(o);return v.page?e.jsx(F,{mode:t,components:j,page:v.page,locale:h,defaultLocale:l}):null}function F({mode:t,components:o,page:s,locale:r,defaultLocale:c,headerAddons:n}){var B,H,C,u,i,q,_,T,L;const g=de.useColorConvert(),a=((B=s.locales)==null?void 0:B[r])??((H=s.locales)==null?void 0:H[c])??{},l=a.title||((C=window.blocklet)==null?void 0:C.appName),f=a.description||((u=window.blocklet)==null?void 0:u.appDescription),d=E.autoResizeImage(E.getImageAbsoluteUrl(a.image),540),{logo:p,brand:h,description:v,...w}=ue.useHeaderState(),j=m.useMemo(()=>S=>{var k;let x=(n==null?void 0:n(S))??S;return x=((k=w.addons)==null?void 0:k.call(w,x))??x,x},[w.addons,n]),y=(i=a.header)!=null&&i.translucent?ie:ae;return e.jsxs(I.PageProvider,{page:s,defaultLocale:c,currentLocale:r,children:[e.jsx(N.Global,{styles:N.css`
|
|
30
|
-
body {
|
|
31
|
-
background-color: ${g(!a.backgroundColor||a.backgroundColor==="transparent"?"background.default":a.backgroundColor)} !important;
|
|
32
|
-
}
|
|
33
|
-
`}),e.jsx(y,{hideNavMenu:!!((q=a.header)!=null&&q.hideNavMenus),translucentTextColor:(_=a.header)==null?void 0:_.translucentTextColor,...p?{logo:p}:{},...h?{brand:h}:{},...v?{description:v}:{},className:Z.cx(((T=a.header)==null?void 0:T.sticky)&&"sticky","page-header"),maxWidth:!1,addons:j}),e.jsx(P.ScrollRestoration,{}),e.jsxs(ye.Helmet,{children:[e.jsx("title",{children:l}),e.jsx("meta",{name:"og:title",content:l}),e.jsx("meta",{name:"og:description",content:f}),e.jsx("meta",{name:"og:image",content:d}),e.jsx("meta",{name:"twitter:image:src",content:d}),e.jsx("meta",{name:"twitter:image",content:d}),e.jsx("meta",{property:"twitter:description",content:f}),e.jsx("meta",{property:"twitter:title",content:l}),e.jsx("meta",{name:"description",content:f})]}),e.jsx(b.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:s.sectionIds.map(S=>{var D,O;const x=s.sections[S];if(!x||x.visibility==="hidden")return null;const k=(D=x.locales)==null?void 0:D[r],U=((O=x.locales)==null?void 0:O[c])??{};return e.jsx(I.BlockRenderer,{id:S,type:x.component,mode:t,section:x,config:{...Se.default(k)?U:k,locale:r,dev:t==="draft"?{mode:t,components:o,defaultLocale:c}:{mode:t}}},S)})}),!((L=a.footer)!=null&&L.hidden)&&e.jsx(Ce,{})]})}const He=m.lazy(()=>Promise.resolve().then(()=>require("./publish-button-DsiOg6dm.js"))),ae=ne.default(we.default)`
|
|
34
|
-
&.sticky {
|
|
35
|
-
position: sticky;
|
|
36
|
-
top: 0;
|
|
37
|
-
}
|
|
38
|
-
`;function Ue({logo:t}){const[o,s]=m.useState(),r=b.useMediaQuery(n=>n.breakpoints.down("sm")),{value:c}=ee.useAsync(()=>{var a,l;const n=new URL(r?((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",window.location.origin);n.searchParams.delete("imageFilter"),n.searchParams.delete("f");const g=n.toString();return new Promise(f=>{fetch(g).then(d=>{const p=d.headers.get("content-type");p!=null&&p.includes("svg")&&d.text().then(h=>{s(h),f(null)}),f(d.url)})})},[r]);if(t)return t;if(o)return e.jsx(b.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:Pe.default.sanitize(o)}});if(c){const n=new URL(c);n.searchParams.set("imageFilter","convert"),n.searchParams.set("f","png"),n.searchParams.set("h","80");const g=n.toString();return e.jsx("img",{src:g,alt:"logo"})}return null}function ie({logo:t,translucentTextColor:o,...s}){const{top:r=0}=G.useScroll(()=>document.getElementById("app"))||{},c=b.useTheme();let n=Math.min(r/800,1),g="";return n>.1?(n=Math.max(n,.6),g=b.alpha(c.palette.text.primary,n)):g=o||"#EEEEEE",e.jsx(ae,{logo:e.jsx(Ue,{logo:t}),...s,className:Z.cx(n<=.7&&"reverse-color"),style:{backgroundColor:b.alpha(c.palette.background.default,n),"--logo-invert":n<=.7?1-n/6:1-n},sx:{backdropFilter:n>=.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:`${g} !important`}},"& .navmenu--horizontal":{bgcolor:"transparent !important"},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:g}}})}const ce=ne.default(b.Button)``;exports.Home=Le;exports.HomeView=re;exports.Loading=se;exports.PageRoutes=A;exports.PageView=F;exports.PageViewByPath=Fe;exports.PageViewWithDataSource=z;exports.TranslucentHeader=ie;
|