@blocklet/pages-kit-inner-components 0.6.2 → 0.6.4

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.
Files changed (42) hide show
  1. package/lib/cjs/add-component.js +420 -1
  2. package/lib/cjs/chunks/draft-data-D44_IEV2.js +1 -0
  3. package/lib/cjs/chunks/home-BYk01EUy.js +39 -0
  4. package/lib/cjs/chunks/index-BRgYwvuv.js +475 -0
  5. package/lib/cjs/chunks/publish-button-C8XPA4g_.js +1 -0
  6. package/lib/cjs/chunks/session-BRtsDvA-.js +1 -0
  7. package/lib/cjs/chunks/site-state-BlQzwACl.js +57 -0
  8. package/lib/cjs/chunks/state-B6BF5wJ-.js +1 -0
  9. package/lib/cjs/components.js +1 -0
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/locales.js +3 -0
  12. package/lib/cjs/project-html.js +4 -4
  13. package/lib/cjs/resources.js +1 -1
  14. package/lib/cjs/setting.js +11 -0
  15. package/lib/cjs/site-state.js +1 -0
  16. package/lib/cjs/theme.js +1 -0
  17. package/lib/cjs/uploader.js +1 -0
  18. package/lib/es/add-component.js +1089 -2
  19. package/lib/es/chunks/{draft-data-bRUHvvzp.js → draft-data-CafrGKeh.js} +4 -5
  20. package/lib/es/chunks/home-DW8SdyfO.js +594 -0
  21. package/lib/es/chunks/index-D5gXPe_7.js +2326 -0
  22. package/lib/es/chunks/{publish-button-Ceet-m88.js → publish-button-XSZrDaTQ.js} +140 -158
  23. package/lib/es/chunks/session-C72Dq8zg.js +19 -0
  24. package/lib/es/chunks/{site-state-Bh8guIeX.js → site-state-BdLTu3Od.js} +201 -170
  25. package/lib/es/chunks/state-0gvZF3k2.js +573 -0
  26. package/lib/es/components.js +24 -0
  27. package/lib/es/home.js +28 -3
  28. package/lib/es/locales.js +1032 -0
  29. package/lib/es/project-html.js +155 -79
  30. package/lib/es/resources.js +137 -93
  31. package/lib/es/setting.js +2294 -0
  32. package/lib/es/site-state.js +48 -0
  33. package/lib/es/theme.js +484 -0
  34. package/lib/es/uploader.js +8 -0
  35. package/package.json +3 -3
  36. package/lib/cjs/chunks/draft-data-CfIMszE7.js +0 -1
  37. package/lib/cjs/chunks/home-DUjl5PbP.js +0 -6
  38. package/lib/cjs/chunks/publish-button-C522nNv6.js +0 -1
  39. package/lib/cjs/chunks/site-state-DDXqWF74.js +0 -57
  40. package/lib/cjs/chunks/state-CtNs8GrN.js +0 -1
  41. package/lib/es/chunks/home-VWWdvIPQ.js +0 -69
  42. package/lib/es/chunks/state-BdNIIXJP.js +0 -502
@@ -1 +1,420 @@
1
- "use strict";var e=AddComponent;module.exports=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),v=require("./chunks/state-B6BF5wJ-.js"),Y=require("@arcblock/ux/lib/Empty"),N=require("@arcblock/ux/lib/Locale/context"),O=require("@iconify-icon/react"),K=require("@mui/icons-material/Check"),e=require("@mui/material"),D=require("ahooks"),u=require("react"),S=require("./chunks/index-BRgYwvuv.js"),m=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("@mui/icons-material");require("react-dnd");require("@arcblock/ux/lib/Tabs");require("lodash/pick");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 J=require("@mui/material/Box");require("@mui/material/DialogTitle");require("@mui/material/IconButton");require("@mui/material/Dialog");require("@mui/material/useMediaQuery");const Z=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 A=require("@blocklet/ai-kit/api"),ee=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 te=require("dayjs"),oe=require("dayjs/plugin/timezone"),re=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 G=require("@blocklet/pages-kit/utils/common"),ie=require("@blocklet/pages-kit/components"),_=o=>o&&o.__esModule?o:{default:o},$=_(Y),ne=_(K),se=_(J),W=_(te),ae=_(oe),le=_(re);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];m.styled(e.Box)`
2
+ .color-item {
3
+ position: relative;
4
+ }
5
+ .color-item__checked {
6
+ position: absolute;
7
+ top: 0;
8
+ bottom: 0;
9
+ left: 0;
10
+ right: 0;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ color: rgba(255, 255, 255, 0.85);
15
+ }
16
+ .color-item__delete {
17
+ position: absolute;
18
+ top: 0;
19
+ right: 0;
20
+ }
21
+ `;const z=.5;e.styled(e.Box)`
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)`
113
+ position: relative;
114
+ border: 1px solid #c0c0c0;
115
+ min-height: 40px;
116
+ border-radius: 4px;
117
+ padding: 14px 14px;
118
+ .label-box__label {
119
+ left: 6px;
120
+ height: 1em;
121
+ padding: 0 6px;
122
+ line-height: 1;
123
+ }
124
+ .label-box__actions {
125
+ right: 6px;
126
+ }
127
+ .label-box__label,
128
+ .label-box__actions {
129
+ position: absolute;
130
+ background: ${({theme:o})=>o.palette.background.default};
131
+ overflow: visible;
132
+ display: inline-block;
133
+ top: 0;
134
+ transform: translateY(-50%);
135
+ }
136
+ `;const ce=u.createContext({embed:!1}),{Provider:xe}=ce;u.createContext(void 0);A.createStatusApi({axios:v.api,path:"/api/ai/status"});A.createStatusApi({axios:v.api,path:"/api/ai/agent-status"});A.createTextCompletionApi({fetch:ee.createFetch(),path:"/api/ai/completions"});W.default.extend(le.default);W.default.extend(ae.default);m.styled(e.Box)`
137
+ flex-grow: 1;
138
+ display: flex;
139
+ flex-direction: column;
140
+
141
+ > .actions {
142
+ position: sticky;
143
+ bottom: 0px;
144
+ margin-top: 20px;
145
+ z-index: 1;
146
+
147
+ @media (max-height: 700px) {
148
+ position: static;
149
+ }
150
+
151
+ > .connect-tip {
152
+ font-weight: 600;
153
+ font-size: 14px;
154
+ line-height: 17px;
155
+ text-align: center;
156
+ color: #9397a1;
157
+ margin-bottom: 20px;
158
+ }
159
+
160
+ .submit {
161
+ height: 43px;
162
+ width: 100%;
163
+ background: linear-gradient(90deg, #45e4fa 0%, #8a45fa 52.08%, #fa45bc 100%);
164
+ border-radius: 30px;
165
+ box-shadow: none;
166
+ text-transform: none;
167
+ width: 100%;
168
+ border: 0;
169
+ margin: 0;
170
+ padding: 8.5px 14px;
171
+ font-size: 100%;
172
+
173
+ &.Mui-disabled {
174
+ color: rgba(0, 0, 0, 0.26);
175
+ background: rgba(0, 0, 0, 0.12);
176
+ }
177
+ }
178
+ }
179
+
180
+ .MuiFormHelperText-root {
181
+ font-style: normal;
182
+ font-weight: 500;
183
+ font-size: 12px;
184
+ line-height: 14px;
185
+ color: #9397a1;
186
+ margin: 0;
187
+ margin-top: 4px;
188
+ }
189
+
190
+ .MuiOutlinedInput-root {
191
+ background: #fbfbfb;
192
+ border-radius: 4px;
193
+
194
+ fieldset {
195
+ border: 1px solid #f6f6f6;
196
+ }
197
+
198
+ &:hover fieldset {
199
+ border: 1px solid #a482fe;
200
+ }
201
+
202
+ input {
203
+ width: 100%;
204
+ border: 0;
205
+ margin: 0;
206
+ border-radius: 4px;
207
+ padding: 8.5px 14px;
208
+ font-size: 100%;
209
+ }
210
+ }
211
+
212
+ .Mui-focused {
213
+ &.MuiFormLabel-root {
214
+ color: #a482fe;
215
+ }
216
+
217
+ &.MuiOutlinedInput-root {
218
+ fieldset {
219
+ border: 1px solid #a482fe;
220
+ }
221
+ }
222
+ }
223
+
224
+ .Mui-error {
225
+ &.MuiFormLabel-root {
226
+ color: #f16e6e;
227
+ }
228
+
229
+ &.MuiOutlinedInput-root + .MuiFormHelperText-root {
230
+ color: #f16e6e;
231
+ }
232
+
233
+ &.MuiOutlinedInput-root {
234
+ fieldset {
235
+ border: 1px solid #f16e6e;
236
+ }
237
+ }
238
+ }
239
+ `;u.createContext({});m.styled(e.Box)`
240
+ display: flex;
241
+ flex-direction: column;
242
+ flex: 1;
243
+
244
+ .lazy-image-wrapper {
245
+ border-radius: 12px;
246
+
247
+ img {
248
+ border-radius: 12px;
249
+ }
250
+ }
251
+ `;m.styled(e.Box)`
252
+ background: #fbfbfb;
253
+ border: 1px solid #f6f6f6;
254
+ border-radius: 4px;
255
+
256
+ &:has(.selected) {
257
+ border: 1px solid #a482fe;
258
+ }
259
+
260
+ &:has(.Mui-focused) {
261
+ border: 1px solid #a482fe;
262
+ }
263
+
264
+ > .input {
265
+ padding: 12px;
266
+ font-weight: 500;
267
+ font-size: 16px;
268
+ line-height: 19px;
269
+ color: #25292f;
270
+ cursor: pointer;
271
+ }
272
+ `;m.styled(se.default)`
273
+ background: #f6f2ff;
274
+ margin-bottom: 20px;
275
+
276
+ .title {
277
+ font-style: normal;
278
+ font-weight: 700;
279
+ font-size: 24px;
280
+ line-height: 33px;
281
+ color: #25292f;
282
+ }
283
+
284
+ .subtitle {
285
+ font-style: normal;
286
+ font-weight: 500;
287
+ font-size: 16px;
288
+ line-height: 22px;
289
+ color: #9397a1;
290
+ margin-top: 4px;
291
+ }
292
+ `;m.styled(e.Box)`
293
+ display: block;
294
+ padding: 16px;
295
+ text-decoration: none;
296
+ border-radius: 12px;
297
+ cursor: pointer;
298
+ box-shadow:
299
+ rgb(255, 255, 255) 0 0 0 0,
300
+ rgb(226, 232, 240) 0 0 0 1px,
301
+ rgba(0, 0, 0, 0.05) 0 1px 2px 0;
302
+ color: inherit;
303
+ height: 100%;
304
+ position: relative;
305
+
306
+ &:hover {
307
+ box-shadow:
308
+ rgb(255, 255, 255) 0 0 0 0,
309
+ rgb(203, 213, 225) 0 0 0 2px,
310
+ rgba(0, 0, 0, 0.1) 0 10px 15px -3px,
311
+ rgba(0, 0, 0, 0.1) 0 4px 6px -4px;
312
+ }
313
+
314
+ .description {
315
+ word-break: break-all;
316
+ text-overflow: ellipsis;
317
+ display: -webkit-box;
318
+ -webkit-box-orient: vertical;
319
+ -webkit-line-clamp: 2;
320
+ overflow: hidden;
321
+ }
322
+ `;Z.css`
323
+ .MuiMenu-root {
324
+ z-index: 13010 !important;
325
+ }
326
+ `;m.styled(e.Box)`
327
+ display: flex;
328
+ flex-direction: column;
329
+ flex: 1;
330
+
331
+ .lazy-image-wrapper {
332
+ border-radius: 12px;
333
+
334
+ img {
335
+ border-radius: 12px;
336
+ }
337
+ }
338
+ `;m.styled(e.Box)`
339
+ background: #fbfbfb;
340
+ border: 1px solid #f6f6f6;
341
+ border-radius: 4px;
342
+ position: relative;
343
+ cursor: pointer;
344
+
345
+ &:has(.selected) {
346
+ border: 1px solid #a482fe;
347
+ }
348
+
349
+ &:has(.Mui-focused) {
350
+ border: 1px solid #a482fe;
351
+ }
352
+
353
+ > .input {
354
+ padding: 12px;
355
+ font-weight: 500;
356
+ font-size: 16px;
357
+ line-height: 19px;
358
+ color: #25292f;
359
+ cursor: pointer;
360
+ }
361
+ `;m.styled(e.Box)`
362
+ > .ai-button {
363
+ display: none;
364
+ z-index: 1;
365
+
366
+ &.active {
367
+ display: inline-flex;
368
+ }
369
+
370
+ .MuiCircularProgress-root {
371
+ position: absolute;
372
+ left: 0;
373
+ top: 0;
374
+ right: 0;
375
+ bottom: 0;
376
+ margin: auto;
377
+ }
378
+ }
379
+ `;m.styled(e.Box)`
380
+ > .language-button {
381
+ display: none;
382
+ z-index: 1;
383
+
384
+ &.active {
385
+ display: inline-flex;
386
+ }
387
+
388
+ .MuiCircularProgress-root {
389
+ position: absolute;
390
+ left: 0;
391
+ top: 0;
392
+ right: 0;
393
+ bottom: 0;
394
+ margin: auto;
395
+ }
396
+ }
397
+ `;m.styled(e.Box)`
398
+ position: relative;
399
+
400
+ .action {
401
+ position: absolute;
402
+ right: 4px;
403
+ top: 4px;
404
+ z-index: 1;
405
+ display: flex;
406
+ align-items: center;
407
+ }
408
+
409
+ &:hover {
410
+ .language-button {
411
+ display: inline-flex;
412
+ }
413
+ }
414
+
415
+ &:hover {
416
+ .ai-button {
417
+ display: inline-flex;
418
+ }
419
+ }
420
+ `;G.nextId();const de={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:G.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 pe({componentId:o,locale:c,components:l}){const{state:{config:{defaultLocale:d}},localState:{customComponentPreviewerProperties:f}}=v.useStore(),n=v.useAllComponents();return t.jsx(ie.CustomComponentRenderer,{componentId:o,locale:c,dev:{mode:"draft",components:l||n,defaultLocale:d},properties:f?.[o]??{}})}const P=260,ue=5,F="IGNORE_RENDER_BLOCKLET_TITLE",E=(o,c)=>o?Object.entries(o).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})):[],H=[{id:"section",name:"Section",properties:S.SectionBlockDefaultProps},{id:"section-card-list",name:"Section Card List",properties:de},{id:"toc",name:"Toc",properties:S.TocDefaultProps},{id:"iframe",name:"Embed",properties:S.IFrameBlockDefaultProps},{id:"layout-block",name:"Section Layout",properties:{}}].map(o=>({...o,type:"basic",component:o.id}));function V({state:o,open:c,onClose:l,onSelect:d,defaultTab:f,title:n,componentGroups:q,components:b,multiple:x=!1,defaultSelected:h,emptyText:B}){const{t:a}=N.useLocaleContext(),r=D.useReactive({selectedComponent:null,activeTab:f,searchQuery:""}),y=u.useMemo(()=>q||[{name:"basic",label:a("maker.components.basicGroup"),components:H},o&&{name:"custom",label:a("maker.components.customGroup"),components:E(v.getCustomComponents(o),"custom")},o&&{name:"resource",label:a("maker.components.resourceGroup"),components:E(v.getResourceComponents(o),"resource")}].filter(Boolean),[q,a,o,c]),C=r.activeTab||y[0]?.name,j=()=>{r.selectedComponent&&(d(r.selectedComponent),l())},M=i=>{if(i){if(w(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:[],g=s.some(R=>R.id===i.id);r.selectedComponent=g?s.filter(R=>R.id!==i.id):[...s,i]}else r.selectedComponent=i}},w=i=>r.selectedComponent?x?r.selectedComponent.some(s=>s.id===i.id):r.selectedComponent.id===i.id:!1,k=y?.length===0,T=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&&h?r.selectedComponent=x?Array.isArray(h)?h:[h]:h:r.selectedComponent=null},[c,h,x]);const I=T?.length===0,L=B||a(C==="resource"?"maker.components.needAddResource":"maker.components.noComponents"),X=u.useMemo(()=>T?T.reduce((i,s)=>{const g=s.blockletId||F,R=s.blockletTitle||a("maker.components.defaultGroup");return i[g]||(i[g]={title:R,components:[]}),i[g].components.push(s),i},{}):{},[T]);return t.jsxs(e.Dialog,{open:c,onClose:l,maxWidth:"lg",fullWidth:!0,slotProps:{paper:{sx:{height:"80vh",maxHeight:"80vh",display:"flex",flexDirection:"column"}}},children:[t.jsxs(e.DialogTitle,{className:"between",sx:{display:"flex",gap:2},children:[t.jsx(e.Box,{children:n||a("maker.components.addComponent")}),t.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:t.jsx(O.Icon,{icon:"tabler:search",style:{marginRight:8}})}}}),t.jsx(e.IconButton,{size:"small",onClick:l,children:t.jsx(e.Box,{component:O.Icon,icon:"tabler:x",sx:{color:"text.primary"}})})]}),t.jsxs(e.DialogContent,{sx:{display:"flex",gap:2,pl:"8px !important",flex:1,overflow:"hidden"},children:[!k&&t.jsx(e.Box,{sx:{width:150,borderRight:1,borderColor:"divider"},children:t.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)=>t.jsx(e.Tab,{label:i?.label,value:i?.name},s))})}),t.jsx(e.Box,{sx:{flex:1,overflowX:"hidden",overflowY:"auto",pr:1},children:I?t.jsx($.default,{children:L}):t.jsx(U,{wrapperComponent:e.Grid,wrapperComponentProps:{container:!0,spacing:2,sx:I?{height:"100%"}:{}},groups:X,emptyText:L,renderItem:i=>{const s=w(i);return t.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:g=>`solid 15px ${g.palette.primary.main}`,borderRight:g=>`solid 15px ${g.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:t.jsxs(e.Card,{className:"add-component-card",sx:{position:"relative",width:"100%",cursor:"pointer"},onClick:()=>M(i),children:[t.jsx(e.CardMedia,{sx:{width:"100%",height:P,overflow:"auto",position:"relative"},children:t.jsx(Q,{components:b,containerHeight:P,component:i},i.id)}),t.jsx(e.CardContent,{sx:{bgcolor:"background.paper",borderTop:1,borderColor:s?"primary.main":"grey.200"},children:t.jsx(e.Typography,{variant:"body1",noWrap:!0,sx:{fontWeight:"bold"},children:i.name})}),t.jsx(e.Box,{className:"check-container",children:t.jsx(ne.default,{className:"check-icon"})})]})},i.id)}})})]}),t.jsxs(e.DialogActions,{sx:{borderTop:1,borderColor:"divider",p:2},children:[t.jsx(e.Button,{onClick:l,variant:"outlined",children:a("common.cancel")}),t.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 Q({containerHeight:o,component:c,minScale:l=.1,components:d}){const{locale:f}=N.useLocaleContext(),n=D.useReactive({scale:1,shouldScroll:!1,isVisible:!1,hadInit:!1}),{currentPage:q}=v.useStore(),b=u.useRef(null),x=u.useRef(null),h=u.useRef(0),B=u.useRef(null);u.useEffect(()=>{const w=new IntersectionObserver(([k])=>{n.isVisible=k.isIntersecting},{root:null,rootMargin:"50px",threshold:0});return x.current&&w.observe(x.current),()=>w.disconnect()},[]),u.useEffect(()=>{const w=()=>{if(h.current+=1,h.current>ue){k.disconnect();return}if(!c.previewImage&&b.current){const T=b.current.scrollHeight,I=o/T;I<l?(n.scale=l,n.shouldScroll=!0):I<1?(n.scale=I,n.shouldScroll=!1):(n.scale=1,n.shouldScroll=!1)}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{n.hadInit=!0},200)},k=new ResizeObserver(()=>{setTimeout(w,20)});return b.current&&n.isVisible&&k.observe(b.current),()=>{k.disconnect()}},[o,l,n.isVisible,c]);const{id:a,type:r,component:y,properties:C,previewImage:j}=c,M=u.useMemo(()=>n.isVisible?j?t.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"?t.jsx(S.BlockRenderer,{id:a,type:y,section:C,config:{...C,locale:f,editing:!1,dev:{mode:"draft"}},page:q},a):t.jsx(pe,{componentId:a,locale:f,components:d},a):null,[a,r,y,C,f,j,n.isVisible]);return t.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:t.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&&t.jsx(e.Skeleton,{variant:"rectangular",width:"100%",height:"100%"}),t.jsx(e.Box,{ref:b,sx:{width:"100%",height:j?"100%":"auto",pointerEvents:"none",opacity:n.hadInit?1:0},children:M})]})})}function U({groups:o,emptyText:c,renderItem:l,wrapperComponent:d=e.Box,wrapperComponentProps:f={display:"inline-flex",flexWrap:"wrap",gap:1}}){return t.jsx(e.Box,{children:Object.keys(o).length>0?Object.entries(o).map(([n,{title:q,components:b}])=>t.jsxs(e.Box,{sx:{mb:3},children:[n!==F&&t.jsxs(e.Typography,{className:"blocklet-title",variant:"subtitle2",sx:{mb:2,fontWeight:500,color:"text.primary",display:"flex",alignItems:"center",gap:1},children:[t.jsx(e.Box,{component:"span",sx:{width:4,height:20,backgroundColor:"primary.main",borderRadius:1,display:"inline-block"}}),q]}),t.jsx(d,{...f,children:b.map(x=>l(x))})]},n)):t.jsx($.default,{children:c})})}exports.AddComponent=V;exports.AutoScaledComponentRenderer=Q;exports.BASIC_COMPONENT_LIST=H;exports.GroupedComponentsList=U;exports.default=V;exports.formatComponent=E;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-B6BF5wJ-.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;
@@ -0,0 +1,39 @@
1
+ "use strict";const e=require("react/jsx-runtime"),k=require("./state-B6BF5wJ-.js"),$=require("@arcblock/ux/lib/Locale/context"),te=require("@arcblock/ux/lib/Result"),M=require("@arcblock/ux/lib/Theme"),ne=require("@blocklet/pages-kit/builtin/page/header"),oe=require("@blocklet/pages-kit/contexts/color"),G=require("@blocklet/pages-kit/utils/data-source"),re=require("@blocklet/pages-kit/utils/route"),se=require("@blocklet/ui-react/lib/Header"),ae=require("@emotion/css"),B=require("@emotion/react"),y=require("@mui/material"),F=require("ahooks"),ie=require("isomorphic-dompurify"),ce=require("lodash/cloneDeep"),le=require("lodash/isEmpty"),ue=require("lodash/isEqual"),p=require("react"),de=require("react-helmet"),v=require("react-router-dom"),W=require("react-use"),S=require("ufo"),_=require("./index-BRgYwvuv.js"),pe=require("@blocklet/ui-react/lib/Footer");require("webfontloader");const z=require("./session-BRtsDvA-.js"),R=t=>t&&t.__esModule?t:{default:t},K=R(te),ge=R(se),me=R(ie),L=R(ce),he=R(le),Y=R(ue),fe=R(pe),xe=M.styled(y.Box)`
2
+ display: contents;
3
+ & > div > div > .MuiContainer-root {
4
+ max-width: unset;
5
+ }
6
+ `;function je({meta:t,...n}){const c=M.useTheme();return e.jsx(xe,{children:e.jsx(fe.default,{...n,meta:t,theme:c||{}})})}function J(t){return e.jsx(y.Box,{...t,sx:[{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center"},...Array.isArray(t.sx)?t.sx:[t.sx]],children:e.jsx(y.CircularProgress,{size:30})})}function ye(t){return e.jsx(be,{...t})}const be=M.styled(y.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
+ `,Pe=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
18
+ sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;function ve({titleFontFamily:t,descriptionFontFamily:n}){const r=y.useTheme()?.typography?.fontFamily;p.useEffect(()=>{},[t,n]);const a=`${r}, ${Pe}`;return e.jsx(B.Global,{styles:B.css`
19
+ #app {
20
+ font-family: ${a};
21
+
22
+ .page-kit-section__title {
23
+ font-family: ${a};
24
+ }
25
+
26
+ .page-kit-section__description {
27
+ font-family: ${a};
28
+ }
29
+ }
30
+ `})}function V(t){return t!=null}function we(){const[t]=v.useSearchParams(),{session:n}=z.useSessionContext(),c=z.useIsRoleOrMultiTenant("owner","admin","pagesEditor","member"),r=p.useMemo(()=>{const o=t.get("mode");return _.STATE_MODES.includes(o)?o:"production"},[t]),a=r==="production"?r:n.user?c?r:"production":null;return a?e.jsx(Q,{mode:a}):null}function Q({mode:t}){if(t!=="draft"){const n=window.__PAGE_STATE__;return n?e.jsx(E,{mode:t,state:n}):e.jsx(Re,{mode:t,children:({state:c})=>e.jsx(E,{mode:t,state:c})})}return e.jsx(Se,{children:({state:n})=>e.jsx(E,{mode:t,state:n})})}const ke=p.lazy(()=>Promise.resolve().then(()=>require("./publish-button-C8XPA4g_.js"))),Se=p.lazy(()=>Promise.resolve().then(()=>require("./draft-data-D44_IEV2.js")));function Re({mode:t,children:n}){const r=document.querySelector('meta[property="pages:version"]')?.content,a=k.useProjectId(),o=p.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const l=localStorage.getItem(k.getProjectPageVersionKey(a??""));return Number(l)?Number(l):new Date().getTime()}return Number(r)},[r]),{loading:g,value:i}=W.useAsync(()=>_.getPages({mode:t,version:o}),[t,o]);return g?e.jsx(J,{}):i?n({state:i}):null}function E({mode:t,state:n}){const{t:c,locale:r}=$.useLocaleContext(),[a]=v.useSearchParams(),o=k.useProjectId(),g=k.useProjectSlug(),i=a.get("hiddenBadge")==="true",l=a.get("showPublish")==="true",{pageIds:h,pages:u,routeIds:d,routes:j,supportedLocales:b,config:{defaultLocale:P},resources:C}=n,x=k.getAllComponents(n),f=p.useMemo(()=>b?.some(m=>m.locale===r)?r:void 0,[r,b]),q=Object.values(j||{}).find(m=>m?.path==="/")||Object.values(u).find(m=>m?.slug==="/")?void 0:Object.values(u)[0],O=p.useMemo(()=>t==="production"?h.map(m=>{const s=u[m];return s&&{id:s.id,path:S.joinURL("/",g||o||"",s.slug)}}).filter(V):d.map(m=>{const s=j[m];return s?{id:s.id,path:S.joinURL("/",g||o||"",s.path,`?mode=${t}&showPublish=true`)}:null}).filter(V),[h,u,t,j,d,o,g]),T=([...m])=>(t!=="production"&&l&&m.unshift(e.jsx(p.Suspense,{fallback:e.jsx("div",{}),children:e.jsx(ke,{ref:{current:null},mode:"production",state:n})})),m);return e.jsxs(_.Provider,{value:{pages:O},children:[e.jsxs(v.Routes,{children:[q&&e.jsx(v.Route,{index:!0,element:e.jsx(v.Navigate,{to:S.joinURL("/",f||"",q.slug)})}),d?.map(m=>{const s=j?.[m];if(!s||!s.displayTemplateId)return null;const A=u[s.displayTemplateId];if(!A)return null;let D=[];return s.params&&s.params.length>0&&(D=re.generateParamCombinations({basePath:s.path,params:s.params,routeId:s.id,paramsOptions:s.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]})?.map(H=>{const N=H.paramOptionIds.join("-");return e.jsx(v.Route,{path:S.joinURL(":projectIdOrSlug?",H.path),element:e.jsx(U,{mode:t,components:x,page:A,locale:f,defaultLocale:P,headerAddons:T,state:n,pageData:s.dataSource?.pathDataMappings?.[N]?.dataCache?.[f||P||"en"]})},N)})),D.push(e.jsx(v.Route,{path:S.joinURL(":projectIdOrSlug?",s.path),element:e.jsx(U,{mode:t,components:x,page:A,locale:f,defaultLocale:P,headerAddons:T,state:n,pageData:s.dataSource?.pathDataMappings?.[s.id]?.dataCache?.[f||P||"en"]})},s.id)),D}),h.map(m=>{const s=u[m];return s?e.jsx(v.Route,{path:S.joinURL(":projectIdOrSlug?",s.slug),element:e.jsx(I,{mode:t,components:x,page:s,locale:f,defaultLocale:P,headerAddons:T})},s.id):null}),C.pages&&Object.values(C.pages).map(({blockletId:m,page:s})=>e.jsx(v.Route,{path:S.joinURL("/",`@${m}`,s.slug),element:e.jsx(I,{mode:t,components:x,page:s,locale:f,defaultLocale:P,headerAddons:T})},s.id)),e.jsx(v.Route,{path:"*",element:e.jsx(y.Box,{sx:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(K.default,{status:404,extra:e.jsx(ee,{href:"/",children:c("common.back")}),sx:{bgcolor:"transparent",width:"100%",height:"100%"}})})})]}),t!=="production"&&!i&&e.jsx(ye,{sx:{bgcolor:"info.light"},children:t}),e.jsx(ve,{})]})}function U({mode:t,pageData:n,components:c,page:r,locale:a,defaultLocale:o,headerAddons:g,state:i}){const l=F.useReactive({page:null});p.useEffect(()=>{const u=r||null;u?l.page=L.default(u):l.page=null},[r,JSON.stringify(r),l]);const h=p.useRef(void 0);return p.useEffect(()=>{Y.default(n,h.current)||n&&l.page&&(G.setPageDataSource(l.page,i,a,n),h.current=L.default(n))},[l.page,n,a,i]),l.page?e.jsx(I,{mode:t,components:c,page:l.page,locale:a,defaultLocale:o,headerAddons:g}):null}function Ce({mode:t,state:n,path:c,pageData:r}){const{t:a,locale:o}=$.useLocaleContext(),{pages:g,supportedLocales:i,config:{defaultLocale:l},resources:h}=n,u=Object.values(g).find(x=>x?.slug===c),d=Object.values(h.pages||{}).find(x=>x.page.slug===c),j=p.useMemo(()=>i?.some(x=>x.locale===o)?o:void 0,[o,i]),b=F.useReactive({page:null});p.useEffect(()=>{const x=u||d?.page||null;x?b.page=L.default(x):b.page=null},[u,d]);const P=p.useRef(void 0);if(p.useEffect(()=>{Y.default(r,P.current)||r&&b.page&&(G.setPageDataSource(b.page,n,j,r),P.current=L.default(r))},[{}]),!u&&!d?.page)return e.jsx(y.Box,{sx:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(K.default,{style:{background:"inherit"},status:404,extra:e.jsx(ee,{href:"/",children:a("common.back")})})});const C=k.getAllComponents(n);return b.page?e.jsx(I,{mode:t,components:C,page:b.page,locale:j,defaultLocale:l}):null}function I({mode:t,components:n,page:c,locale:r,defaultLocale:a,headerAddons:o}){const g=oe.useColorConvert(),i=c.locales?.[r]??c.locales?.[a]??{},l=i.title||window.blocklet?.appName,h=i.description||window.blocklet?.appDescription,u=k.autoResizeImage(k.getImageAbsoluteUrl(i.image),540),{logo:d,brand:j,description:b,...P}=ne.useHeaderState(),C=p.useMemo(()=>f=>{let w=o?.(f)??f;return w=P.addons?.(w)??w,w},[P.addons,o]),x=p.useMemo(()=>i.header?.translucent?Z:X,[i.header?.translucent]);return e.jsxs(_.PageProvider,{page:c,defaultLocale:a,currentLocale:r,children:[e.jsx(B.Global,{styles:B.css`
31
+ body {
32
+ background-color: ${g(!i.backgroundColor||i.backgroundColor==="transparent"?"background.default":i.backgroundColor)} !important;
33
+ }
34
+ `}),e.jsx(x,{hideNavMenu:!!i.header?.hideNavMenus,translucentTextColor:i.header?.translucentTextColor,...d?{logo:d}:{},...j?{brand:j}:{},...b?{description:b}:{},className:ae.cx(i.header?.sticky&&"sticky","page-header"),maxWidth:!1,addons:C}),e.jsx(v.ScrollRestoration,{}),e.jsxs(de.Helmet,{children:[e.jsx("title",{children:l}),e.jsx("meta",{name:"og:title",content:l}),e.jsx("meta",{name:"og:description",content:h}),e.jsx("meta",{name:"og:image",content:u}),e.jsx("meta",{name:"twitter:image:src",content:u}),e.jsx("meta",{name:"twitter:image",content:u}),e.jsx("meta",{property:"twitter:description",content:h}),e.jsx("meta",{property:"twitter:title",content:l}),e.jsx("meta",{name:"description",content:h})]}),e.jsx(y.Stack,{className:"PageView-root",sx:{flexGrow:1,"& .BlockBase-root:first-child":{pt:"0 !important"}},children:c.sectionIds.map(f=>{const w=c.sections[f];if(!w||w.visibility==="hidden")return null;const q=c.dataSource?.[f]?.[r],O=c.dataSource?.[f]?.[a]??{};return e.jsx(_.BlockRenderer,{id:f,type:w.component,mode:t,section:w,config:{...he.default(q)?O:q,locale:r,dev:t==="draft"?{mode:t,components:n,defaultLocale:a}:{mode:t,defaultLocale:a}},page:c},f)})}),!i.footer?.hidden&&e.jsx(je,{})]})}const X=M.styled(ge.default)`
35
+ &.sticky {
36
+ position: sticky;
37
+ top: 0;
38
+ }
39
+ `;function qe({logo:t}){const[n,c]=p.useState(),r=y.useMediaQuery(o=>o.breakpoints.down("sm")),{value:a}=W.useAsync(()=>{const o=new URL(r?window?.blocklet?.appLogo||"/.well-known/service/blocklet/logo":window?.blocklet?.appLogoRect||"/.well-known/service/blocklet/logo-rect",window.location.origin);o.searchParams.delete("imageFilter"),o.searchParams.delete("f");const g=o.toString();return new Promise(i=>{fetch(g).then(l=>{l.headers.get("content-type")?.includes("svg")&&l.text().then(u=>{c(u),i(null)}),i(l.url)})})},[r]);if(t)return t;if(n)return e.jsx(y.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:me.default.sanitize(n)}});if(a){const o=new URL(a);o.searchParams.set("imageFilter","convert"),o.searchParams.set("f","png"),o.searchParams.set("h","80");const g=o.toString();return e.jsx("img",{src:g,alt:"logo"})}return null}function Z({logo:t,translucentTextColor:n,...c}){const a=F.useScroll(document.getElementById("app"),d=>d.top<1200),o=y.useTheme(),g=Math.min(a?.top??0,800),i=p.useMemo(()=>{let d=Math.min(g/800,1),j="";return d>.1?(d=Math.max(d,.6),j=y.alpha(o.palette.text.primary,d)):j=n||"#EEEEEE",{backgroundOpacity:d,textColor:j,isReversed:d<.7}},[g,800,o.palette.text.primary,n]),{backgroundOpacity:l,textColor:h,isReversed:u}=i;return e.jsx(X,{logo:e.jsx(qe,{logo:t}),...c,sx:{position:"fixed !important",top:0,left:0,right:0,zIndex:o.zIndex.appBar,backgroundColor:"transparent !important","&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:-1,backgroundColor:y.alpha(o.palette.background.default,l),backdropFilter:l>=.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:`${h} !important`},".header-logo":{color:`${h} !important`},"& .navmenu--horizontal":{bgcolor:"transparent !important"},".header-logo > div":{filter:`invert(${u?1:0})`,transition:"filter 0.3s ease-in-out"}}})}const ee=M.styled(y.Button)``;exports.Home=we;exports.HomeView=Q;exports.Loading=J;exports.PageRoutes=E;exports.PageView=I;exports.PageViewByPath=Ce;exports.PageViewWithDataSource=U;exports.TranslucentHeader=Z;