@blocklet/pages-kit-inner-components 0.6.51 → 0.6.53
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 +15 -106
- package/lib/cjs/chunks/{draft-data-CBA2Fr-1.js → draft-data-Bhf423Y1.js} +1 -1
- package/lib/cjs/chunks/{home-BcAK1oy2.js → home-BKn7-Ncc.js} +2 -2
- package/lib/cjs/chunks/{index-Bs3OlRQc.js → index-HSHOGLHs.js} +25 -25
- package/lib/cjs/chunks/{publish-button-DHrxOxEB.js → publish-button-CeewavTH.js} +1 -1
- package/lib/cjs/chunks/state-DH94MEh-.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +3 -3
- package/lib/cjs/setting.js +3 -3
- package/lib/es/add-component.js +288 -262
- package/lib/es/chunks/{draft-data-mNAXJMtq.js → draft-data-oEuh4Tps.js} +1 -1
- package/lib/es/chunks/{home-BIMdDiCg.js → home-CmH9KpXZ.js} +3 -3
- package/lib/es/chunks/{index-NQgjITtC.js → index-ni6tn8EL.js} +662 -630
- package/lib/es/chunks/{publish-button-DjP_C3Xb.js → publish-button-DdJy6U4r.js} +3 -3
- package/lib/es/chunks/state-DdT-7UdS.js +684 -0
- package/lib/es/home.js +3 -3
- package/lib/es/locales.js +16 -4
- package/lib/es/setting.js +779 -782
- package/package.json +9 -11
- package/lib/cjs/chunks/state-B5PBvcI6.js +0 -1
- package/lib/es/chunks/state-DRjnlQY_.js +0 -604
package/lib/cjs/add-component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),v=require("./chunks/state-DH94MEh-.js"),X=require("@arcblock/ux/lib/Empty"),P=require("@arcblock/ux/lib/Locale/context"),O=require("@iconify-icon/react"),Y=require("@mui/icons-material/Check"),e=require("@mui/material"),N=require("ahooks"),u=require("react"),S=require("./chunks/index-HSHOGLHs.js"),f=require("@arcblock/ux/lib/Theme");require("@blocklet/pages-kit/builtin/color-picker");require("@blocklet/pages-kit/utils/style");require("@emotion/css");require("lodash/without");const p=require("@mui/material/colors");require("@blocklet/pages-kit/builtin/uploader");require("react-use");require("lodash/cloneDeep");require("@dnd-kit/core");require("@dnd-kit/sortable");require("@mui/icons-material");require("@dnd-kit/utilities");require("@mui/lab");require("immer");require("lodash/omit");require("react-router-dom");require("@arcblock/ux/lib/Button");require("is-uri");require("@arcblock/ux/lib/Toast");require("@mui/material/Tooltip");require("@mui/icons-material/KeyboardArrowLeft");const K=require("@mui/material/Box");require("@mui/material/DialogTitle");require("@mui/material/IconButton");require("@mui/material/Dialog");require("@mui/material/useMediaQuery");const J=require("@emotion/react");require("@mui/material/Alert");require("@mui/material/AlertTitle");require("react-error-boundary");require("ufo");require("lodash/isEmpty");require("yaml");require("@mui/material/Typography");require("joi");const E=require("@blocklet/aigne-hub/api"),Z=require("@blocklet/js-sdk");require("@mui/x-date-pickers");require("@mui/x-date-pickers/AdapterDayjs");require("@mui/x-date-pickers/LocalizationProvider");require("circular-natal-horoscope-js/dist");const ee=require("dayjs"),te=require("dayjs/plugin/timezone"),oe=require("dayjs/plugin/utc");require("fast-deep-equal");require("lodash/isNil");require("tz-lookup");require("@mui/icons-material/CheckCircleOutline");require("lodash/uniq");require("lodash/get");require("lodash/set");const D=require("@blocklet/pages-kit/utils/common"),re=require("@blocklet/pages-kit/components"),_=t=>t&&t.__esModule?t:{default:t},G=_(X),ie=_(Y),ne=_(K),H=_(ee),se=_(te),ae=_(oe);p.red[300],p.pink[300],p.purple[300],p.indigo[300],p.blue[300],p.cyan[300],p.teal[300],p.green[300],p.lime[300],p.yellow[300],p.amber[300],p.orange[300],p.brown[300],p.grey[300],p.blueGrey[300];f.styled(e.Box)`
|
|
2
2
|
.color-item {
|
|
3
3
|
position: relative;
|
|
4
4
|
}
|
|
@@ -18,98 +18,7 @@
|
|
|
18
18
|
top: 0;
|
|
19
19
|
right: 0;
|
|
20
20
|
}
|
|
21
|
-
`;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
padding: 8px;
|
|
25
|
-
border-bottom: ${({theme:o})=>`1px solid ${o.palette.divider}`};
|
|
26
|
-
user-select: none;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
position: relative;
|
|
29
|
-
|
|
30
|
-
:hover {
|
|
31
|
-
background-color: rgba(200, 200, 200, 0.3);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&.selected {
|
|
35
|
-
background-color: rgba(200, 200, 200, 0.3);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&.sub-selected {
|
|
39
|
-
background-color: rgba(200, 200, 200, 0.3);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&.disabledDrag {
|
|
43
|
-
cursor: default;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
> .drag,
|
|
47
|
-
> .actions {
|
|
48
|
-
line-height: 1;
|
|
49
|
-
|
|
50
|
-
svg {
|
|
51
|
-
font-size: 16px;
|
|
52
|
-
vertical-align: middle;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
> .drag {
|
|
57
|
-
cursor: grab;
|
|
58
|
-
opacity: ${z};
|
|
59
|
-
position: relative;
|
|
60
|
-
|
|
61
|
-
&.disabledDrag {
|
|
62
|
-
cursor: default;
|
|
63
|
-
|
|
64
|
-
&:has(.origin-drag-icon):after {
|
|
65
|
-
content: '';
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: 50%;
|
|
68
|
-
left: 50%;
|
|
69
|
-
width: 120%;
|
|
70
|
-
height: 1px;
|
|
71
|
-
background-color: ${({theme:o})=>o.palette.error.main};
|
|
72
|
-
transform: translate(-50%, -50%) rotate(-45deg);
|
|
73
|
-
z-index: 1;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
> .actions {
|
|
79
|
-
display: flex;
|
|
80
|
-
align-items: center;
|
|
81
|
-
overflow: hidden;
|
|
82
|
-
|
|
83
|
-
> * {
|
|
84
|
-
margin-right: 0.5em;
|
|
85
|
-
opacity: 0;
|
|
86
|
-
display: inline-block;
|
|
87
|
-
cursor: pointer;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
> .visible {
|
|
91
|
-
display: inline-block;
|
|
92
|
-
opacity: ${z};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&:hover {
|
|
97
|
-
> .actions {
|
|
98
|
-
> * {
|
|
99
|
-
display: inline-block;
|
|
100
|
-
opacity: ${z} !important;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
> .name {
|
|
106
|
-
flex: 1;
|
|
107
|
-
overflow: hidden;
|
|
108
|
-
text-overflow: ellipsis;
|
|
109
|
-
padding: 0 4px;
|
|
110
|
-
font-size: 14px;
|
|
111
|
-
}
|
|
112
|
-
`;e.styled(e.Box)`
|
|
21
|
+
`;e.styled(e.Box)(({theme:t})=>({display:"flex",alignItems:"center",padding:"8px",borderBottom:`1px solid ${t.palette.divider}`,userSelect:"none",cursor:"pointer",position:"relative","&:hover":{backgroundColor:"rgba(200, 200, 200, 0.3)","& .actions":{opacity:1}},"&.selected":{backgroundColor:"rgba(200, 200, 200, 0.3)"},"&.sub-selected":{backgroundColor:"rgba(200, 200, 200, 0.3)"},"&.section-hidden":{"& .drag-handle, & .content":{color:t.palette.text.disabled}},"&.dragging":{opacity:.4,zIndex:1e3},"&.drop-target-top::before":{content:'""',position:"absolute",top:-2,left:0,right:0,height:2,backgroundColor:t.palette.primary.main,borderRadius:1,zIndex:10},"&.drop-target-bottom::after":{content:'""',position:"absolute",bottom:-2,left:0,right:0,height:2,backgroundColor:t.palette.primary.main,borderRadius:1,zIndex:10},"& .drag-handle":{cursor:"grab",opacity:.5,position:"relative",lineHeight:1,svg:{fontSize:"16px",verticalAlign:"middle"},"&:active":{cursor:"grabbing"}},"& .content":{flex:1,overflow:"hidden",textOverflow:"ellipsis",padding:"0 4px",fontSize:"14px"},"& .actions":{position:"absolute",maxHeight:"32px",top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",gap:t.spacing(.5),padding:t.spacing(.5),opacity:0,transition:"opacity 0.2s ease",backgroundColor:e.alpha(t.palette.background.paper,.8),backdropFilter:"blur(2px)",borderRadius:t.spacing(.5),margin:`auto ${t.spacing(.5)}`,"& > *":{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:t.spacing(.25),borderRadius:t.spacing(.5),transition:"all 0.2s ease",color:t.palette.text.secondary,"&:hover":{backgroundColor:t.palette.action.hover,color:t.palette.text.primary},svg:{fontSize:"16px"}},"& > .visible":{opacity:1}},"&.section-hidden .actions, &.section-locked .actions":{opacity:.7}}));e.styled(e.Box)`
|
|
113
22
|
position: relative;
|
|
114
23
|
border: 1px solid #c0c0c0;
|
|
115
24
|
min-height: 40px;
|
|
@@ -127,13 +36,13 @@
|
|
|
127
36
|
.label-box__label,
|
|
128
37
|
.label-box__actions {
|
|
129
38
|
position: absolute;
|
|
130
|
-
background: ${({theme:
|
|
39
|
+
background: ${({theme:t})=>t.palette.background.paper};
|
|
131
40
|
overflow: visible;
|
|
132
41
|
display: inline-block;
|
|
133
42
|
top: 0;
|
|
134
43
|
transform: translateY(-50%);
|
|
135
44
|
}
|
|
136
|
-
`;const
|
|
45
|
+
`;const le=u.createContext({embed:!1}),{Provider:ue}=le;u.createContext(void 0);E.createStatusApi({axios:v.api,path:"/api/ai/status"});E.createStatusApi({axios:v.api,path:"/api/ai/agent-status"});E.createTextCompletionApi({fetch:Z.createFetch(),path:"/api/ai/completions"});H.default.extend(ae.default);H.default.extend(se.default);f.styled(e.Box)`
|
|
137
46
|
flex-grow: 1;
|
|
138
47
|
display: flex;
|
|
139
48
|
flex-direction: column;
|
|
@@ -236,7 +145,7 @@
|
|
|
236
145
|
}
|
|
237
146
|
}
|
|
238
147
|
}
|
|
239
|
-
`;u.createContext({});
|
|
148
|
+
`;u.createContext({});f.styled(e.Box)`
|
|
240
149
|
display: flex;
|
|
241
150
|
flex-direction: column;
|
|
242
151
|
flex: 1;
|
|
@@ -248,7 +157,7 @@
|
|
|
248
157
|
border-radius: 12px;
|
|
249
158
|
}
|
|
250
159
|
}
|
|
251
|
-
`;
|
|
160
|
+
`;f.styled(e.Box)`
|
|
252
161
|
background: #fbfbfb;
|
|
253
162
|
border: 1px solid #f6f6f6;
|
|
254
163
|
border-radius: 4px;
|
|
@@ -269,7 +178,7 @@
|
|
|
269
178
|
color: #25292f;
|
|
270
179
|
cursor: pointer;
|
|
271
180
|
}
|
|
272
|
-
`;
|
|
181
|
+
`;f.styled(ne.default)`
|
|
273
182
|
background: #f6f2ff;
|
|
274
183
|
margin-bottom: 20px;
|
|
275
184
|
|
|
@@ -289,7 +198,7 @@
|
|
|
289
198
|
color: #9397a1;
|
|
290
199
|
margin-top: 4px;
|
|
291
200
|
}
|
|
292
|
-
`;
|
|
201
|
+
`;f.styled(e.Box)`
|
|
293
202
|
display: block;
|
|
294
203
|
padding: 16px;
|
|
295
204
|
text-decoration: none;
|
|
@@ -319,11 +228,11 @@
|
|
|
319
228
|
-webkit-line-clamp: 2;
|
|
320
229
|
overflow: hidden;
|
|
321
230
|
}
|
|
322
|
-
`;
|
|
231
|
+
`;J.css`
|
|
323
232
|
.MuiMenu-root {
|
|
324
233
|
z-index: 13010 !important;
|
|
325
234
|
}
|
|
326
|
-
`;
|
|
235
|
+
`;f.styled(e.Box)`
|
|
327
236
|
display: flex;
|
|
328
237
|
flex-direction: column;
|
|
329
238
|
flex: 1;
|
|
@@ -335,7 +244,7 @@
|
|
|
335
244
|
border-radius: 12px;
|
|
336
245
|
}
|
|
337
246
|
}
|
|
338
|
-
`;
|
|
247
|
+
`;f.styled(e.Box)`
|
|
339
248
|
background: #fbfbfb;
|
|
340
249
|
border: 1px solid #f6f6f6;
|
|
341
250
|
border-radius: 4px;
|
|
@@ -358,7 +267,7 @@
|
|
|
358
267
|
color: #25292f;
|
|
359
268
|
cursor: pointer;
|
|
360
269
|
}
|
|
361
|
-
`;
|
|
270
|
+
`;f.styled(e.Box)`
|
|
362
271
|
> .ai-button {
|
|
363
272
|
display: none;
|
|
364
273
|
z-index: 1;
|
|
@@ -376,7 +285,7 @@
|
|
|
376
285
|
margin: auto;
|
|
377
286
|
}
|
|
378
287
|
}
|
|
379
|
-
`;
|
|
288
|
+
`;f.styled(e.Box)`
|
|
380
289
|
> .language-button {
|
|
381
290
|
display: none;
|
|
382
291
|
z-index: 1;
|
|
@@ -394,7 +303,7 @@
|
|
|
394
303
|
margin: auto;
|
|
395
304
|
}
|
|
396
305
|
}
|
|
397
|
-
`;
|
|
306
|
+
`;f.styled(e.Box)`
|
|
398
307
|
position: relative;
|
|
399
308
|
|
|
400
309
|
.action {
|
|
@@ -417,4 +326,4 @@
|
|
|
417
326
|
display: inline-flex;
|
|
418
327
|
}
|
|
419
328
|
}
|
|
420
|
-
`;
|
|
329
|
+
`;D.nextId();const ce={type:"default",title:"Section CardList",description:"This is Section CardList",center:!0,dark:!1,background:"",col:3,gap:2,align:"top",textAlign:"left",iconSize:100,padding:"normal",list:[{id:D.nextId(),title:"Simplified Service Delivery",description:"Block Server's Service Gateway makes networking easy with access to load balancing, SSL termination, automatic and customizable URL mapping, and redirects.",image:"https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png"}]};function de({componentId:t,locale:c,components:l}){const{state:{config:{defaultLocale:d}},localState:{customComponentPreviewerProperties:m}}=v.useStore(),n=v.useAllComponents();return o.jsx(re.CustomComponentRenderer,{componentId:t,locale:c,dev:{mode:"draft",components:l||n,defaultLocale:d},properties:m?.[t]??{}})}const L=260,pe=5,F="IGNORE_RENDER_BLOCKLET_TITLE",M=(t,c)=>t?Object.entries(t).map(([l,d])=>({id:l,component:l,name:d?.data?.name||d?.component?.name||l,properties:d?.data||d.component,previewImage:d?.data?.previewImage||null,type:c,blockletId:d?.blockletId,blockletTitle:d?.blockletTitle})):[],W=[{id:"section",name:"Section",properties:S.SectionBlockDefaultProps},{id:"section-card-list",name:"Section Card List",properties:ce},{id:"toc",name:"Toc",properties:S.TocDefaultProps},{id:"iframe",name:"Embed",properties:S.IFrameBlockDefaultProps},{id:"layout-block",name:"Section Layout",properties:{}}].map(t=>({...t,type:"basic",component:t.id}));function V({state:t,open:c,onClose:l,onSelect:d,defaultTab:m,title:n,componentGroups:q,components:b,multiple:x=!1,defaultSelected:g,emptyText:B}){const{t:a}=P.useLocaleContext(),r=N.useReactive({selectedComponent:null,activeTab:m,searchQuery:""}),y=u.useMemo(()=>q||[{name:"basic",label:a("maker.components.basicGroup"),components:W},t&&{name:"custom",label:a("maker.components.customGroup"),components:M(v.getCustomComponents(t),"custom")},t&&{name:"resource",label:a("maker.components.resourceGroup"),components:M(v.getResourceComponents(t),"resource")}].filter(Boolean),[q,a,t,c]),C=r.activeTab||y[0]?.name,j=()=>{r.selectedComponent&&(d(r.selectedComponent),l())},z=i=>{if(i){if(k(i)){x?r.selectedComponent=r.selectedComponent.filter(s=>s.id!==i.id):r.selectedComponent=null;return}if(x){const s=Array.isArray(r.selectedComponent)?r.selectedComponent:[],h=s.some(R=>R.id===i.id);r.selectedComponent=h?s.filter(R=>R.id!==i.id):[...s,i]}else r.selectedComponent=i}},k=i=>r.selectedComponent?x?r.selectedComponent.some(s=>s.id===i.id):r.selectedComponent.id===i.id:!1,w=y?.length===0,I=u.useMemo(()=>{const i=y.find(s=>s?.name===C)?.components||[];return r.searchQuery?i.filter(s=>s.name.toLowerCase().includes(r.searchQuery.toLowerCase())):i},[C,y,r.searchQuery]);u.useEffect(()=>{r.searchQuery="",c&&g?r.selectedComponent=x?Array.isArray(g)?g:[g]:g:r.selectedComponent=null},[c,g,x]);const T=I?.length===0,A=B||a(C==="resource"?"maker.components.needAddResource":"maker.components.noComponents"),U=u.useMemo(()=>I?I.reduce((i,s)=>{const h=s.blockletId||F,R=s.blockletTitle||a("maker.components.defaultGroup");return i[h]||(i[h]={title:R,components:[]}),i[h].components.push(s),i},{}):{},[I]);return o.jsxs(e.Dialog,{open:c,onClose:l,maxWidth:"lg",fullWidth:!0,slotProps:{paper:{sx:{height:"80vh",maxHeight:"80vh",display:"flex",flexDirection:"column"}}},children:[o.jsxs(e.DialogTitle,{className:"between",sx:{display:"flex",gap:2},children:[o.jsx(e.Box,{children:n||a("maker.components.addComponent")}),o.jsx(e.TextField,{size:"small",placeholder:a("maker.components.searchComponent"),value:r.searchQuery,onChange:i=>r.searchQuery=i.target.value,sx:{flex:1,maxWidth:350},slotProps:{input:{startAdornment:o.jsx(O.Icon,{icon:"tabler:search",style:{marginRight:8}})}}}),o.jsx(e.IconButton,{size:"small",onClick:l,children:o.jsx(e.Box,{component:O.Icon,icon:"tabler:x",sx:{color:"text.primary"}})})]}),o.jsxs(e.DialogContent,{sx:{display:"flex",gap:2,pl:"8px !important",flex:1,overflow:"hidden"},children:[!w&&o.jsx(e.Box,{sx:{width:150,borderRight:1,borderColor:"divider"},children:o.jsx(e.Tabs,{orientation:"vertical",value:C,onChange:(i,s)=>r.activeTab=s,sx:{"& .MuiTab-root":{alignItems:"flex-start",textAlign:"left",minHeight:48,py:1.5,px:2}},children:y.map((i,s)=>o.jsx(e.Tab,{label:i?.label,value:i?.name},s))})}),o.jsx(e.Box,{sx:{flex:1,overflowX:"hidden",overflowY:"auto",pr:1},children:T?o.jsx(G.default,{children:A}):o.jsx(Q,{wrapperComponent:e.Grid,wrapperComponentProps:{container:!0,spacing:2,sx:T?{height:"100%"}:{}},groups:U,emptyText:A,renderItem:i=>{const s=k(i);return o.jsx(e.Grid,{sx:{width:"100%","& .add-component-card":{boxShadow:"none",border:1,borderColor:s?"primary.main":"grey.200","& .check-container":{display:s?"flex":"none",position:"absolute",right:0,bottom:0,justifyContent:"flex-end",alignItems:"flex-end",width:30,height:30,overflow:"hidden",transition:"all 0.3s ease",color:"white","&::after":{position:"absolute",zIndex:0,display:"block",width:0,height:0,borderTop:"transparent solid 15px",borderLeft:"transparent solid 15px",borderBottom:h=>`solid 15px ${h.palette.primary.main}`,borderRight:h=>`solid 15px ${h.palette.primary.main}`,transition:"all 0.1s ease",content:'""'},"& .check-icon":{position:"relative",zIndex:2,margin:"0 1px 1px 0",fontSize:16,transition:"all 0.2s ease"}}}},size:{xs:12,md:6,lg:4},children:o.jsxs(e.Card,{className:"add-component-card",sx:{position:"relative",width:"100%",cursor:"pointer"},onClick:()=>z(i),children:[o.jsx(e.CardMedia,{sx:{width:"100%",height:L,overflow:"auto",position:"relative"},children:o.jsx($,{components:b,containerHeight:L,component:i},i.id)}),o.jsx(e.CardContent,{sx:{bgcolor:"background.paper",borderTop:1,borderColor:s?"primary.main":"grey.200"},children:o.jsx(e.Typography,{variant:"body1",noWrap:!0,sx:{fontWeight:"bold"},children:i.name})}),o.jsx(e.Box,{className:"check-container",children:o.jsx(ie.default,{className:"check-icon"})})]})},i.id)}})})]}),o.jsxs(e.DialogActions,{sx:{borderTop:1,borderColor:"divider",p:2},children:[o.jsx(e.Button,{onClick:l,variant:"outlined",children:a("common.cancel")}),o.jsx(e.Button,{onClick:j,variant:"contained",disabled:!r.selectedComponent||x&&Array.isArray(r.selectedComponent)&&r.selectedComponent.length===0,children:x&&Array.isArray(r.selectedComponent)&&r.selectedComponent.length>0?a("common.addMultiple",{count:r.selectedComponent.length}):a("common.add")})]})]})}function $({containerHeight:t,component:c,minScale:l=.1,components:d}){const{locale:m}=P.useLocaleContext(),n=N.useReactive({scale:1,shouldScroll:!1,isVisible:!1,hadInit:!1}),{currentPage:q}=v.useStore(),b=u.useRef(null),x=u.useRef(null),g=u.useRef(0),B=u.useRef(null);u.useEffect(()=>{const k=new IntersectionObserver(([w])=>{n.isVisible=w.isIntersecting},{root:null,rootMargin:"50px",threshold:0});return x.current&&k.observe(x.current),()=>k.disconnect()},[]),u.useEffect(()=>{const k=()=>{if(g.current+=1,g.current>pe){w.disconnect();return}if(!c.previewImage&&b.current){const I=b.current.scrollHeight,T=t/I;T<l?(n.scale=l,n.shouldScroll=!0):T<1?(n.scale=T,n.shouldScroll=!1):(n.scale=1,n.shouldScroll=!1)}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{n.hadInit=!0},200)},w=new ResizeObserver(()=>{setTimeout(k,20)});return b.current&&n.isVisible&&w.observe(b.current),()=>{w.disconnect()}},[t,l,n.isVisible,c]);const{id:a,type:r,component:y,properties:C,previewImage:j}=c,z=u.useMemo(()=>n.isVisible?j?o.jsx(e.Box,{component:"img",loading:"lazy",src:v.getImageAbsoluteUrl(j),alt:c.name,sx:{width:"100%",height:"100%",objectFit:"cover",borderRadius:1,cursor:"pointer"}},a):r==="basic"?o.jsx(S.BlockRenderer,{id:a,type:y,section:C,config:{...C,locale:m,editing:!1,dev:{mode:"draft"}},page:q},a):o.jsx(de,{componentId:a,locale:m,components:d},a):null,[a,r,y,C,m,j,n.isVisible]);return o.jsx(e.Box,{ref:x,sx:{position:"relative",width:"100%",height:"100%",overflowX:"hidden",overflowY:n.shouldScroll?"auto":"hidden",transition:"all 0.3s ease"},children:o.jsxs(e.Box,{sx:{transform:`scale(${n.scale})`,transformOrigin:"top left",width:`${100/n.scale}%`,height:n.hadInit&&n.shouldScroll?"100%":`${100/n.scale}%`},children:[!n.hadInit&&o.jsx(e.Skeleton,{variant:"rectangular",width:"100%",height:"100%"}),o.jsx(e.Box,{ref:b,sx:{width:"100%",height:j?"100%":"auto",pointerEvents:"none",opacity:n.hadInit?1:0},children:z})]})})}function Q({groups:t,emptyText:c,renderItem:l,wrapperComponent:d=e.Box,wrapperComponentProps:m={display:"inline-flex",flexWrap:"wrap",gap:1}}){return o.jsx(e.Box,{children:Object.keys(t).length>0?Object.entries(t).map(([n,{title:q,components:b}])=>o.jsxs(e.Box,{sx:{mb:3},children:[n!==F&&o.jsxs(e.Typography,{className:"blocklet-title",variant:"subtitle2",sx:{mb:2,fontWeight:500,color:"text.primary",display:"flex",alignItems:"center",gap:1},children:[o.jsx(e.Box,{component:"span",sx:{width:4,height:20,backgroundColor:"primary.main",borderRadius:1,display:"inline-block"}}),q]}),o.jsx(d,{...m,children:b.map(x=>l(x))})]},n)):o.jsx(G.default,{children:c})})}exports.AddComponent=V;exports.AutoScaledComponentRenderer=$;exports.BASIC_COMPONENT_LIST=W;exports.GroupedComponentsList=Q;exports.default=V;exports.formatComponent=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-DH94MEh-.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),w=require("./state-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),w=require("./state-DH94MEh-.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-HSHOGLHs.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
2
|
display: contents;
|
|
3
3
|
& > div > div > .MuiContainer-root {
|
|
4
4
|
max-width: unset;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
font-family: ${r};
|
|
28
28
|
}
|
|
29
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-
|
|
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-CeewavTH.js"))),Ce=d.lazy(()=>Promise.resolve().then(()=>require("./draft-data-Bhf423Y1.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
31
|
body {
|
|
32
32
|
background-color: ${p(!l.backgroundColor||l.backgroundColor==="transparent"?"background.default":l.backgroundColor)} !important;
|
|
33
33
|
}
|