@blocklet/pages-kit-inner-components 0.6.81 → 0.6.83
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/add-component.js +1 -1
- package/lib/cjs/chunks/home-B7hfvyqp.js +39 -0
- package/lib/cjs/chunks/{index-CiYwdeK9.js → index-CQ-RsKbV.js} +29 -29
- package/lib/cjs/chunks/{publish-button-DV23sfgB.js → publish-button-TNCCmLRN.js} +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +2 -2
- package/lib/es/add-component.js +1 -1
- package/lib/es/chunks/{home-BZB9zOlO.js → home-C2DPQgb-.js} +109 -109
- package/lib/es/chunks/{index-Bggolyu_.js → index-BbpNoQ0a.js} +400 -362
- package/lib/es/chunks/{publish-button-Dm2Nce-b.js → publish-button-BvdMXp8L.js} +2 -2
- package/lib/es/home.js +2 -2
- package/lib/es/locales.js +8 -0
- package/package.json +3 -3
- package/lib/cjs/chunks/home-CjhOAEa7.js +0 -39
|
@@ -10,8 +10,8 @@ import { produce as De } from "immer";
|
|
|
10
10
|
import Z from "lodash/difference";
|
|
11
11
|
import { useState as D, useMemo as C, useCallback as O, useImperativeHandle as Oe, useEffect as E, useRef as Ae } from "react";
|
|
12
12
|
import { useAsync as je } from "react-use";
|
|
13
|
-
import { L as ve } from "./home-
|
|
14
|
-
import { p as Ce, g as Re } from "./index-
|
|
13
|
+
import { L as ve } from "./home-C2DPQgb-.js";
|
|
14
|
+
import { p as Ce, g as Re } from "./index-BbpNoQ0a.js";
|
|
15
15
|
function ze(s) {
|
|
16
16
|
const [u, g] = D(!1);
|
|
17
17
|
return /* @__PURE__ */ t(
|
package/lib/es/home.js
CHANGED
|
@@ -21,8 +21,8 @@ import "react-helmet";
|
|
|
21
21
|
import "react-router-dom";
|
|
22
22
|
import "react-use";
|
|
23
23
|
import "ufo";
|
|
24
|
-
import "./chunks/index-
|
|
25
|
-
import { a as R, e as S, P as W, d as j, c as k, b as q, T as v, H as z } from "./chunks/home-
|
|
24
|
+
import "./chunks/index-BbpNoQ0a.js";
|
|
25
|
+
import { a as R, e as S, P as W, d as j, c as k, b as q, T as v, H as z } from "./chunks/home-C2DPQgb-.js";
|
|
26
26
|
import "./chunks/session-Dx5M-1r2.js";
|
|
27
27
|
export {
|
|
28
28
|
R as HomeView,
|
package/lib/es/locales.js
CHANGED
|
@@ -364,6 +364,10 @@ const t = e({
|
|
|
364
364
|
title: "Vertical Alignment",
|
|
365
365
|
helper: "Set the vertical alignment of content in the layout"
|
|
366
366
|
},
|
|
367
|
+
textAlign: {
|
|
368
|
+
title: "Text Alignment",
|
|
369
|
+
helper: "Set text alignment for content inside the layout"
|
|
370
|
+
},
|
|
367
371
|
justifyContent: {
|
|
368
372
|
title: "Horizontal Alignment",
|
|
369
373
|
helper: "Set the horizontal alignment of content in the layout"
|
|
@@ -949,6 +953,10 @@ const t = e({
|
|
|
949
953
|
title: "垂直内容对齐",
|
|
950
954
|
helper: "设置布局中垂直内容的对齐方式"
|
|
951
955
|
},
|
|
956
|
+
textAlign: {
|
|
957
|
+
title: "文本对齐",
|
|
958
|
+
helper: "设置布局中文本的对齐方式"
|
|
959
|
+
},
|
|
952
960
|
justifyContent: {
|
|
953
961
|
title: "水平内容对齐",
|
|
954
962
|
helper: "设置布局中水平内容的对齐方式"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit-inner-components",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.83",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -201,8 +201,8 @@
|
|
|
201
201
|
"yaml": "^2.5.0",
|
|
202
202
|
"yjs": "^13.6.18",
|
|
203
203
|
"zustand": "^4.5.5",
|
|
204
|
-
"@blocklet/pages-kit": "^0.6.
|
|
205
|
-
"@blocklet/pages-kit
|
|
204
|
+
"@blocklet/pages-kit-block-studio": "^0.6.83",
|
|
205
|
+
"@blocklet/pages-kit": "^0.6.83"
|
|
206
206
|
},
|
|
207
207
|
"devDependencies": {
|
|
208
208
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),w=require("./state-BdtFHk36.js"),N=require("@arcblock/ux/lib/Locale/context"),ne=require("@arcblock/ux/lib/Result"),q=require("@arcblock/ux/lib/Theme"),oe=require("@blocklet/pages-kit/builtin/page/header"),re=require("@blocklet/pages-kit/contexts/color"),V=require("@blocklet/pages-kit/utils/data-source"),se=require("@blocklet/pages-kit/utils/route"),ae=require("@blocklet/ui-react/lib/Header"),ie=require("@emotion/css"),T=require("@emotion/react"),j=require("@mui/material"),A=require("ahooks"),ce=require("isomorphic-dompurify"),le=require("lodash/cloneDeep"),ue=require("lodash/isEmpty"),de=require("lodash/isEqual"),d=require("react"),pe=require("react-helmet"),P=require("react-router-dom"),W=require("react-use"),S=require("ufo"),v=require("./index-CiYwdeK9.js"),ge=require("@blocklet/ui-react/lib/Footer");require("webfontloader");const F=require("./session-BZ3-x8Ef.js"),R=t=>t&&t.__esModule?t:{default:t},$=R(ne),me=R(ae),he=R(ce),L=R(le),fe=R(ue),G=R(de),xe=R(ge),je=q.styled(j.Box)`
|
|
2
|
-
display: contents;
|
|
3
|
-
& > div > div > .MuiContainer-root {
|
|
4
|
-
max-width: unset;
|
|
5
|
-
}
|
|
6
|
-
`;function ye({meta:t,...n}){const a=q.useTheme(),{getPageMetaStyle:o}=v.usePageContext(),r=o();return e.jsx(je,{sx:{".blocklet__footer .MuiContainer-root":{...r.maxWidth&&{maxWidth:r.maxWidth},...r.px&&{px:r.px}}},children:e.jsx(xe.default,{...n,meta:t,theme:a||{},sx:{}})})}let be=null;function K(t){const n=d.useRef(null),{type:a}=t;return d.useEffect(()=>{a==="app"&&n.current},[a]),e.jsx(j.Box,{...t,ref:n,sx:[{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",".spinner-wrapper":{}},...Array.isArray(t.sx)?t.sx:[t.sx]],children:a!=="app"&&e.jsx(j.CircularProgress,{size:30})})}function Pe(t){return e.jsx(ve,{...t})}const ve=q.styled(j.Box)`
|
|
7
|
-
position: fixed;
|
|
8
|
-
left: 0;
|
|
9
|
-
top: 0;
|
|
10
|
-
z-index: 999999999999;
|
|
11
|
-
width: 80px;
|
|
12
|
-
font-size: 12px;
|
|
13
|
-
text-align: center;
|
|
14
|
-
opacity: 0.7;
|
|
15
|
-
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
16
|
-
pointer-events: none;
|
|
17
|
-
`,we=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
18
|
-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;function ke({titleFontFamily:t,descriptionFontFamily:n}){const o=j.useTheme()?.typography?.fontFamily;d.useEffect(()=>{},[t,n]);const r=`${o}, ${we}`;return e.jsx(T.Global,{styles:T.css`
|
|
19
|
-
#app {
|
|
20
|
-
font-family: ${r};
|
|
21
|
-
|
|
22
|
-
.page-kit-section__title {
|
|
23
|
-
font-family: ${r};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.page-kit-section__description {
|
|
27
|
-
font-family: ${r};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`})}function z(t){return t!=null}function Se(){const[t]=P.useSearchParams(),{session:n}=F.useSessionContext(),a=F.useIsRoleOrMultiTenant("owner","admin","pagesEditor","member"),o=d.useMemo(()=>{const s=t.get("mode");return v.STATE_MODES.includes(s)?s:"production"},[t]),r=o==="production"?o:n.user?a?o:"production":null;return r?e.jsx(Y,{mode:r}):null}function Y({mode:t}){if(t!=="draft"){const n=window.__PAGE_STATE__;return n?e.jsx(_,{mode:t,state:n}):e.jsx(Me,{mode:t,children:({state:a})=>e.jsx(_,{mode:t,state:a})})}return e.jsx(Ce,{children:({state:n})=>e.jsx(_,{mode:t,state:n})})}const Re=d.lazy(()=>Promise.resolve().then(()=>require("./publish-button-DV23sfgB.js"))),Ce=d.lazy(()=>Promise.resolve().then(()=>require("./draft-data-CkVvOh60.js")));function Me({mode:t,children:n}){const o=document.querySelector('meta[property="pages:version"]')?.content,r=w.useProjectId(),s=d.useMemo(()=>{if(o==="{{pagesPublishedAt}}"){const u=localStorage.getItem(w.getProjectPageVersionKey(r??""));return Number(u)?Number(u):new Date().getTime()}return Number(o)},[o]),{loading:p,value:l}=W.useAsync(()=>v.getPages({mode:t,version:s}),[t,s]);return p?e.jsx(K,{}):l?n({state:l}):null}function _({mode:t,state:n}){const{t:a,locale:o}=N.useLocaleContext(),[r]=P.useSearchParams(),s=w.useProjectId(),p=w.useProjectSlug(),l=r.get("hiddenBadge")==="true",u=r.get("showPublish")==="true",{pageIds:g,pages:c,routeIds:x,routes:m,supportedLocales:h,config:{defaultLocale:b},resources:C}=n,y=w.getAllComponents(n),k=d.useMemo(()=>h?.some(f=>f.locale===o)?o:void 0,[o,h]),D=Object.values(m||{}).find(f=>f?.path==="/")||Object.values(c).find(f=>f?.slug==="/")?void 0:Object.values(c)[0],te=d.useMemo(()=>t==="production"?g?.map(f=>{const i=c[f];return i&&{id:i.id,path:S.joinURL("/",p||s||"",i.slug),isLinkToPage:v.isLinkToPage(i)}}).filter(z):x?.map(f=>{const i=m[f];return i?{id:i.id,path:S.joinURL("/",p||s||"",i.path,`?mode=${t}&showPublish=true`)}:null}).filter(z),[g,c,t,m,x,s,p]),I=([...f])=>(t!=="production"&&u&&f.unshift(e.jsx(d.Suspense,{fallback:e.jsx("div",{}),children:e.jsx(Re,{ref:{current:null},mode:"production",state:n})})),f);return e.jsxs(v.Provider,{value:{pages:te},children:[e.jsxs(P.Routes,{children:[D&&e.jsx(P.Route,{index:!0,element:e.jsx(P.Navigate,{to:S.joinURL("/",k||"",D.slug)})}),x?.map(f=>{const i=m?.[f];if(!i||!i.displayTemplateId)return null;const E=c[i.displayTemplateId];if(!E)return null;let B=[];return i.params&&i.params.length>0&&(B=se.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]})?.map(H=>{const U=H.paramOptionIds.join("-");return e.jsx(P.Route,{path:S.joinURL(":projectIdOrSlug?",H.path),element:e.jsx(O,{mode:t,components:y,page:E,locale:k,defaultLocale:b,headerAddons:I,state:n,pageData:i.dataSource?.pathDataMappings?.[U]?.dataCache?.[k||b||"en"]})},U)})),B.push(e.jsx(P.Route,{path:S.joinURL(":projectIdOrSlug?",i.path),element:e.jsx(O,{mode:t,components:y,page:E,locale:k,defaultLocale:b,headerAddons:I,state:n,pageData:i.dataSource?.pathDataMappings?.[i.id]?.dataCache?.[k||b||"en"]})},i.id)),B}),g?.map(f=>{const i=c[f];return!i||!v.isLinkToPage(i)?null:e.jsx(P.Route,{path:S.joinURL(":projectIdOrSlug?",i.slug),element:e.jsx(M,{mode:t,components:y,page:i,locale:k,defaultLocale:b,headerAddons:I})},i.id)}),C?.pages&&Object.values(C?.pages)?.map(({blockletId:f,page:i})=>e.jsx(P.Route,{path:S.joinURL("/",`@${f}`,i.slug),element:e.jsx(M,{mode:t,components:y,page:i,locale:k,defaultLocale:b,headerAddons:I})},i.id)),e.jsx(P.Route,{path:"*",element:e.jsx(j.Box,{sx:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx($.default,{status:404,extra:e.jsx(ee,{href:"/",children:a("common.back")}),sx:{bgcolor:"transparent",width:"100%",height:"100%"}})})})]}),t!=="production"&&!l&&e.jsx(Pe,{sx:{bgcolor:"info.light"},children:t}),e.jsx(ke,{})]})}function O({mode:t,pageData:n,components:a,page:o,locale:r,defaultLocale:s,headerAddons:p,state:l}){const u=A.useReactive({page:null});d.useEffect(()=>{const c=o||null;c?u.page=L.default(c):u.page=null},[o,JSON.stringify(o),u]);const g=d.useRef(void 0);return d.useEffect(()=>{G.default(n,g.current)||n&&u.page&&(V.setPageDataSource(u.page,l,r,n),g.current=L.default(n))},[u.page,n,r,l]),u.page?e.jsx(M,{mode:t,components:a,page:u.page,locale:r,defaultLocale:s,headerAddons:p}):null}function qe({mode:t,state:n,path:a,pageData:o}){const{t:r,locale:s}=N.useLocaleContext(),{pages:p,supportedLocales:l,config:{defaultLocale:u},resources:g}=n,c=Object.values(p).find(y=>y?.slug===a),x=Object.values(g?.pages||{}).find(y=>y.page.slug===a),m=d.useMemo(()=>l?.some(y=>y.locale===s)?s:void 0,[s,l]),h=A.useReactive({page:null});d.useEffect(()=>{const y=c||x?.page||null;y?h.page=L.default(y):h.page=null},[c,x]);const b=d.useRef(void 0);if(d.useEffect(()=>{G.default(o,b.current)||o&&h.page&&(V.setPageDataSource(h.page,n,m,o),b.current=L.default(o))},[{}]),!c&&!x?.page)return e.jsx(j.Box,{sx:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx($.default,{style:{background:"inherit"},status:404,extra:e.jsx(ee,{href:"/",children:r("common.back")})})});const C=w.getAllComponents(n);return h.page?e.jsx(M,{mode:t,components:C,page:h.page,locale:m,defaultLocale:u}):null}function M({mode:t,components:n,page:a,locale:o,defaultLocale:r,headerAddons:s}){const p=re.useColorConvert(),l=a.locales?.[o]??a.locales?.[r]??{},u=l.title||window.blocklet?.appName,g=l.description||window.blocklet?.appDescription,c=w.autoResizeImage(w.getImageAbsoluteUrl(l.image),540);return e.jsxs(v.PageProvider,{page:a,defaultLocale:r,currentLocale:o,children:[e.jsx(T.Global,{styles:T.css`
|
|
31
|
-
body {
|
|
32
|
-
background-color: ${p(!l.backgroundColor||l.backgroundColor==="transparent"?"background.default":l.backgroundColor)} !important;
|
|
33
|
-
}
|
|
34
|
-
`}),e.jsx(Q,{meta:l,headerAddons:s}),e.jsx(P.ScrollRestoration,{}),e.jsxs(pe.Helmet,{children:[e.jsx("title",{children:u}),e.jsx("meta",{name:"og:title",content:u}),e.jsx("meta",{name:"og:description",content:g}),e.jsx("meta",{name:"og:image",content:c}),e.jsx("meta",{name:"twitter:image:src",content:c}),e.jsx("meta",{name:"twitter:image",content:c}),e.jsx("meta",{property:"twitter:description",content:g}),e.jsx("meta",{property:"twitter:title",content:u}),e.jsx("meta",{name:"description",content:g})]}),e.jsx(j.Stack,{className:"PageView-root",sx:{flexGrow:1,"& > *:first-child .BlockBase-root":{pt:"0 !important"},zIndex:0},children:e.jsx(v.RenderQueueProvider,{children:a?.sectionIds?.map((x,m)=>{const h=a.sections[x];if(!h||h.visibility==="hidden")return null;const b=a.dataSource?.[x]?.[o],C=a.dataSource?.[x]?.[r]??{};return e.jsx(j.Box,{sx:{position:"relative"},children:e.jsx(v.BlockRenderer,{id:x,type:h.component,mode:t,section:h,config:{...fe.default(b)?C:b,locale:o,dev:t==="draft"?{mode:t,components:n,defaultLocale:r}:{mode:t,defaultLocale:r}},page:a,renderIndex:m},x)},x)})})}),!l.footer?.hidden&&e.jsx(ye,{})]})}const J=q.styled(me.default)`
|
|
35
|
-
&.sticky {
|
|
36
|
-
position: sticky;
|
|
37
|
-
top: 0;
|
|
38
|
-
}
|
|
39
|
-
`;function Q({meta:t,headerAddons:n}){const{logo:a,brand:o,description:r,...s}=oe.useHeaderState(),p=v.useIsMobile(),l=d.useMemo(()=>g=>{let c=n?.(g)??g;return c=s.addons?.(c)??c,c},[s.addons,n]),u=d.useMemo(()=>t.header?.translucent?Z:J,[t.header?.translucent]);return e.jsx(u,{hideNavMenu:!!t.header?.hideNavMenus,translucentTextColor:t.header?.translucentTextColor,...a?{logo:e.jsx(X,{logo:a})}:{},...o?{brand:o}:{},...r?{description:r}:{},className:ie.cx(t.header?.sticky&&"sticky","page-header"),maxWidth:!1,addons:l,sx:{animation:"header-show 0.3s cubic-bezier(0.4, 0, 0.2, 1)",".header-logo":{display:p?"none !important":"inline-flex",alignItems:"center"},".header-brand-wrapper":{display:p?"none !important":"flex"},"@keyframes header-show":{from:{opacity:0},to:{opacity:1}}}})}function X({logo:t}){const[n,a]=d.useState(),o=v.useIsMobile(),{value:r}=W.useAsync(()=>{const s=new URL(o?window?.blocklet?.appLogo||"/.well-known/service/blocklet/logo":window?.blocklet?.appLogoRect||"/.well-known/service/blocklet/logo-rect",window.location.origin);s.searchParams.delete("imageFilter"),s.searchParams.delete("f");const p=s.toString();return new Promise(l=>{fetch(p).then(u=>{u.headers.get("content-type")?.includes("svg")&&u.text().then(c=>{a(c),l(null)}),l(u.url)})})},[o]);if(o)return null;if(t)return t;if(n)return e.jsx(j.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:he.default.sanitize(n)}});if(r){const s=new URL(r);s.searchParams.set("imageFilter","convert"),s.searchParams.set("f","png"),s.searchParams.set("h","80");const p=s.toString();return e.jsx("img",{src:p,alt:"logo"})}return null}function Z({logo:t,translucentTextColor:n,...a}){const r=A.useScroll(document.getElementById("app"),m=>m.top<1200),s=j.useTheme(),p=s.palette.mode==="dark",l=Math.min(r?.top??0,800),u=d.useMemo(()=>{let m=Math.min(l/800,1),h="";return m>.1?(m=Math.max(m,.6),h=j.alpha(s.palette.text.primary,m)):h=n||"#EEEEEE",{backgroundOpacity:m,textColor:h,isReversed:m<.7}},[l,800,s.palette.text.primary,n]),{backgroundOpacity:g,textColor:c,isReversed:x}=u;return e.jsx(J,{logo:e.jsx(X,{logo:t}),...a,sx:{position:"fixed !important",top:0,left:0,right:0,zIndex:s.zIndex.appBar,backgroundColor:"transparent !important","&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:-1,backgroundColor:j.alpha(s.palette.background.default,g),backdropFilter:g>=.6?"blur(10px)":"blur(0px)",transition:"backgroundColor 0.3s ease-in-out"},transition:"color 0.3s ease-in-out",".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button":{color:`${c} !important`},".header-logo, .header-menu":{color:`${c} !important`},"& .navmenu--horizontal":{bgcolor:"transparent !important"},".header-addons *":{borderColor:`${c} !important`},".header-logo > div":{filter:p?"unset":`invert(${x?1:0})`,transition:"filter 0.3s ease-in-out"}}})}const ee=q.styled(j.Button)``;exports.Home=Se;exports.HomeView=Y;exports.Loading=K;exports.PageHeader=Q;exports.PageRoutes=_;exports.PageView=M;exports.PageViewByPath=qe;exports.PageViewWithDataSource=O;exports.TranslucentHeader=Z;
|