@blocklet/pages-kit-inner-components 0.6.3 → 0.6.5
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 +420 -1
- package/lib/cjs/chunks/draft-data-D44_IEV2.js +1 -0
- package/lib/cjs/chunks/home-BYk01EUy.js +39 -0
- package/lib/cjs/chunks/index-BRgYwvuv.js +475 -0
- package/lib/cjs/chunks/publish-button-C8XPA4g_.js +1 -0
- package/lib/cjs/chunks/session-BRtsDvA-.js +1 -0
- package/lib/cjs/chunks/site-state-BlQzwACl.js +57 -0
- package/lib/cjs/chunks/state-B6BF5wJ-.js +1 -0
- package/lib/cjs/components.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +3 -0
- package/lib/cjs/project-html.js +4 -4
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +11 -0
- package/lib/cjs/site-state.js +1 -0
- package/lib/cjs/theme.js +1 -0
- package/lib/cjs/uploader.js +1 -0
- package/lib/es/add-component.js +1089 -2
- package/lib/es/chunks/{draft-data-bRUHvvzp.js → draft-data-CafrGKeh.js} +4 -5
- package/lib/es/chunks/home-DW8SdyfO.js +594 -0
- package/lib/es/chunks/index-D5gXPe_7.js +2326 -0
- package/lib/es/chunks/{publish-button-Ceet-m88.js → publish-button-XSZrDaTQ.js} +140 -158
- package/lib/es/chunks/session-C72Dq8zg.js +19 -0
- package/lib/es/chunks/{site-state-BoVWlYLn.js → site-state-BdLTu3Od.js} +197 -170
- package/lib/es/chunks/state-0gvZF3k2.js +573 -0
- package/lib/es/components.js +24 -0
- package/lib/es/home.js +28 -3
- package/lib/es/locales.js +1032 -0
- package/lib/es/project-html.js +155 -79
- package/lib/es/resources.js +137 -93
- package/lib/es/setting.js +2294 -0
- package/lib/es/site-state.js +48 -0
- package/lib/es/theme.js +484 -0
- package/lib/es/uploader.js +8 -0
- package/package.json +3 -3
- package/lib/cjs/chunks/draft-data-CfIMszE7.js +0 -1
- package/lib/cjs/chunks/home-DUjl5PbP.js +0 -6
- package/lib/cjs/chunks/publish-button-C522nNv6.js +0 -1
- package/lib/cjs/chunks/site-state-BG2d2tBl.js +0 -57
- package/lib/cjs/chunks/state-CtNs8GrN.js +0 -1
- package/lib/es/chunks/home-VWWdvIPQ.js +0 -69
- package/lib/es/chunks/state-BdNIIXJP.js +0 -502
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { p as b, n as j, o as q, S as v, q as y, r as B, u as L, v as U, b as h, x as z, w as C, t as F, y as G } from "./chunks/site-state-BdLTu3Od.js";
|
|
2
|
+
import { nextId as K } from "@blocklet/pages-kit/utils/common";
|
|
3
|
+
import "@blocklet/pages-kit/utils/page-model";
|
|
4
|
+
import "@blocklet/pages-kit/utils/property";
|
|
5
|
+
import "@blocklet/pages-kit/utils/route";
|
|
6
|
+
import "@blocklet/sdk/lib/component";
|
|
7
|
+
import "@blocklet/sdk/lib/config";
|
|
8
|
+
import "@reactivedata/reactive";
|
|
9
|
+
import "@syncedstore/core";
|
|
10
|
+
import "fs";
|
|
11
|
+
import "glob";
|
|
12
|
+
import "lib0/decoding";
|
|
13
|
+
import "lib0/encoding";
|
|
14
|
+
import "lodash/cloneDeep";
|
|
15
|
+
import "lodash/debounce";
|
|
16
|
+
import "lodash/get";
|
|
17
|
+
import "lodash/isEmpty";
|
|
18
|
+
import "lodash/set";
|
|
19
|
+
import "lodash/union";
|
|
20
|
+
import "lru-cache";
|
|
21
|
+
import "p-limit";
|
|
22
|
+
import "path";
|
|
23
|
+
import "sequelize";
|
|
24
|
+
import "stream/promises";
|
|
25
|
+
import "tar";
|
|
26
|
+
import "ufo";
|
|
27
|
+
import "wait-on";
|
|
28
|
+
import "y-protocols/awareness";
|
|
29
|
+
import "y-protocols/sync";
|
|
30
|
+
import "yaml";
|
|
31
|
+
import "yjs";
|
|
32
|
+
export * from "@blocklet/pages-kit/types/state";
|
|
33
|
+
export {
|
|
34
|
+
b as PUBLISH_MODES,
|
|
35
|
+
j as SITE_STATE_PATH,
|
|
36
|
+
q as STATE_MODES,
|
|
37
|
+
v as default,
|
|
38
|
+
y as defaultState,
|
|
39
|
+
B as downloadAsset,
|
|
40
|
+
L as downloadAssets,
|
|
41
|
+
U as fromPackage,
|
|
42
|
+
h as getResourceStates,
|
|
43
|
+
z as initPackResourceStates,
|
|
44
|
+
C as mergeState,
|
|
45
|
+
K as nextId,
|
|
46
|
+
F as toPackage,
|
|
47
|
+
G as triggerReloadAllProjectResource
|
|
48
|
+
};
|
package/lib/es/theme.js
ADDED
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider as c } from "@arcblock/ux/lib/Config";
|
|
3
|
+
import { Icon as h } from "@iconify-icon/react";
|
|
4
|
+
import $ from "@iconify-icons/tabler/chevron-down";
|
|
5
|
+
import { listItemIconClasses as y, switchClasses as S, svgIconClasses as s, sliderClasses as o, outlinedInputClasses as m, inputBaseClasses as t, filledInputClasses as u, inputLabelClasses as i, inputClasses as l, selectClasses as g, autocompleteClasses as p, Box as z } from "@mui/material";
|
|
6
|
+
import { useMemo as v } from "react";
|
|
7
|
+
import { useLocation as M } from "react-router-dom";
|
|
8
|
+
import { S as I } from "./chunks/session-C72Dq8zg.js";
|
|
9
|
+
import { translations as C } from "./locales.js";
|
|
10
|
+
const n = window.blocklet?.prefix || "/", O = n.endsWith("/") ? `${n}admin` : `${n}/admin`, f = {
|
|
11
|
+
fontSize: "5rem",
|
|
12
|
+
"@media (max-width: 1536px)": {
|
|
13
|
+
fontSize: "5rem"
|
|
14
|
+
},
|
|
15
|
+
"@media (max-width: 1200px)": {
|
|
16
|
+
fontSize: "4rem"
|
|
17
|
+
},
|
|
18
|
+
"@media (max-width: 900px)": {
|
|
19
|
+
fontSize: "3rem"
|
|
20
|
+
},
|
|
21
|
+
"@media (max-width: 600px)": {
|
|
22
|
+
fontSize: "2rem"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function x(e) {
|
|
26
|
+
return /* @__PURE__ */ a(z, { ...e, component: h, icon: $ });
|
|
27
|
+
}
|
|
28
|
+
const T = {
|
|
29
|
+
typography: {
|
|
30
|
+
big: { ...f },
|
|
31
|
+
button: {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
textTransform: "none",
|
|
34
|
+
WebkitTextTransform: "none"
|
|
35
|
+
},
|
|
36
|
+
subtitle1: {
|
|
37
|
+
fontWeight: 600,
|
|
38
|
+
fontSize: "18px",
|
|
39
|
+
lineHeight: 1.5
|
|
40
|
+
},
|
|
41
|
+
subtitle2: {
|
|
42
|
+
fontSize: "14px",
|
|
43
|
+
lineHeight: "24px",
|
|
44
|
+
fontWeight: 500,
|
|
45
|
+
marginBottom: "4px"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
palette: {
|
|
49
|
+
background: {},
|
|
50
|
+
action: {
|
|
51
|
+
// selected: 'rgba(25, 118, 210, 0.08)',
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
shape: {
|
|
55
|
+
borderRadius: 8
|
|
56
|
+
},
|
|
57
|
+
components: {
|
|
58
|
+
MuiCssBaseline: {},
|
|
59
|
+
MuiFormLabel: {
|
|
60
|
+
styleOverrides: {
|
|
61
|
+
root: {
|
|
62
|
+
fontSize: "0.875rem"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
MuiFormControlLabel: {
|
|
67
|
+
styleOverrides: {
|
|
68
|
+
root: {
|
|
69
|
+
marginLeft: 0
|
|
70
|
+
},
|
|
71
|
+
label: {
|
|
72
|
+
fontSize: "0.875rem"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
MuiInputLabel: {
|
|
77
|
+
styleOverrides: {
|
|
78
|
+
root: {
|
|
79
|
+
fontSize: "0.875rem"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
MuiRadio: {
|
|
84
|
+
styleOverrides: {
|
|
85
|
+
root: {
|
|
86
|
+
padding: 4,
|
|
87
|
+
[`.${s.fontSizeMedium}`]: {
|
|
88
|
+
fontSize: "1.25rem"
|
|
89
|
+
},
|
|
90
|
+
[`.${s.fontSizeSmall}`]: {
|
|
91
|
+
fontSize: "1.125rem"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
MuiCheckbox: {
|
|
97
|
+
styleOverrides: {
|
|
98
|
+
root: {
|
|
99
|
+
padding: 4,
|
|
100
|
+
[`.${s.fontSizeMedium}`]: {
|
|
101
|
+
fontSize: "1.25rem"
|
|
102
|
+
},
|
|
103
|
+
[`.${s.fontSizeSmall}`]: {
|
|
104
|
+
fontSize: "1.125rem"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
MuiSwitch: {
|
|
110
|
+
styleOverrides: {
|
|
111
|
+
root: {
|
|
112
|
+
height: 28,
|
|
113
|
+
width: 48,
|
|
114
|
+
padding: 8,
|
|
115
|
+
[`&.${S.sizeSmall}`]: {
|
|
116
|
+
height: 26,
|
|
117
|
+
width: 40,
|
|
118
|
+
padding: 8
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
switchBase: {
|
|
122
|
+
padding: 4
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
MuiAutocomplete: {
|
|
127
|
+
defaultProps: { popupIcon: /* @__PURE__ */ a(x, { fontSize: 14 }) },
|
|
128
|
+
variants: [
|
|
129
|
+
{
|
|
130
|
+
props: {},
|
|
131
|
+
style: ({ theme: e }) => e.unstable_sx({
|
|
132
|
+
[`.${p.inputRoot}`]: {
|
|
133
|
+
pt: 1.5,
|
|
134
|
+
pb: 0.25,
|
|
135
|
+
[`.${p.input}.${t.input}`]: {
|
|
136
|
+
px: 0,
|
|
137
|
+
pt: 0.5,
|
|
138
|
+
pb: 0.25
|
|
139
|
+
},
|
|
140
|
+
[`&.${t.sizeSmall}`]: {
|
|
141
|
+
[`.${p.input}.${t.input}`]: {
|
|
142
|
+
px: 0,
|
|
143
|
+
py: 0,
|
|
144
|
+
pb: "1px"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
MuiTextField: {
|
|
153
|
+
defaultProps: { variant: "filled" },
|
|
154
|
+
variants: [
|
|
155
|
+
{
|
|
156
|
+
props: {},
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
style: ({ theme: e, ownerState: r }) => e.unstable_sx({
|
|
159
|
+
[`.${t.root}`]: {
|
|
160
|
+
borderRadius: 1,
|
|
161
|
+
lineHeight: "1.5rem",
|
|
162
|
+
[`.${t.input}`]: {
|
|
163
|
+
height: "1.5rem"
|
|
164
|
+
},
|
|
165
|
+
[`&.${l.multiline}`]: {
|
|
166
|
+
pl: 0,
|
|
167
|
+
pr: 0,
|
|
168
|
+
pt: r?.label ? 2 : 1,
|
|
169
|
+
"& .MuiInputBase-inputMultiline": {
|
|
170
|
+
py: 0
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// standard
|
|
175
|
+
[`.${l.root}`]: {
|
|
176
|
+
mt: 1.5,
|
|
177
|
+
[`&.${t.hiddenLabel}`]: {
|
|
178
|
+
mt: 0,
|
|
179
|
+
pt: 0,
|
|
180
|
+
[`.${g.select}.${l.input}:focus`]: {
|
|
181
|
+
bgcolor: "transparent"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
[`.${i.standard}`]: {
|
|
186
|
+
transform: "translate(0px, 18px) scale(1)",
|
|
187
|
+
[`&.${i.sizeSmall}`]: {
|
|
188
|
+
transform: "translate(0px, 15px) scale(1)"
|
|
189
|
+
},
|
|
190
|
+
[`&.${i.shrink}`]: {
|
|
191
|
+
transform: "translate(0px, -1px) scale(0.8)",
|
|
192
|
+
[`&.${i.sizeSmall}`]: {
|
|
193
|
+
transform: "translate(0px, -1px) scale(0.8)"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
// filled
|
|
198
|
+
[`.${u.root}`]: {
|
|
199
|
+
":before,:after": { display: "none" },
|
|
200
|
+
[`.${t.input}`]: {
|
|
201
|
+
pb: 0.5,
|
|
202
|
+
pt: r?.label ? 2 : 0.5,
|
|
203
|
+
px: 1,
|
|
204
|
+
":focus": {
|
|
205
|
+
borderRadius: 1
|
|
206
|
+
},
|
|
207
|
+
[`&.${t.inputSizeSmall}`]: {
|
|
208
|
+
pb: 0.25,
|
|
209
|
+
pt: r?.label ? 1.25 : 0.25,
|
|
210
|
+
...r?.multiline ? {
|
|
211
|
+
pt: 0
|
|
212
|
+
} : {}
|
|
213
|
+
},
|
|
214
|
+
[`&.${t.inputHiddenLabel}`]: {
|
|
215
|
+
py: 0.5,
|
|
216
|
+
[`&.${t.inputSizeSmall}`]: {
|
|
217
|
+
py: "1px"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
[`.${i.filled}`]: {
|
|
223
|
+
transform: "translate(8px, 11px) scale(1)",
|
|
224
|
+
[`&.${i.sizeSmall}`]: {
|
|
225
|
+
transform: "translate(8px, 7px) scale(1)"
|
|
226
|
+
},
|
|
227
|
+
[`&.${i.shrink}`]: {
|
|
228
|
+
transform: "translate(8px, 2px) scale(0.8)",
|
|
229
|
+
[`&.${i.sizeSmall}`]: {
|
|
230
|
+
transform: "translate(8px, 0) scale(0.8)"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
// outlined
|
|
235
|
+
[`.${m.root}`]: {
|
|
236
|
+
[`.${t.input}`]: {
|
|
237
|
+
py: 1.25,
|
|
238
|
+
px: 1,
|
|
239
|
+
[`&.${t.inputSizeSmall}`]: {
|
|
240
|
+
py: 0.875
|
|
241
|
+
},
|
|
242
|
+
[`&.${t.inputHiddenLabel}`]: {
|
|
243
|
+
py: 0.5,
|
|
244
|
+
[`&.${t.inputSizeSmall}`]: {
|
|
245
|
+
py: "1px"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
[`.${i.outlined}`]: {
|
|
251
|
+
transform: "translate(8px, 10px) scale(1)",
|
|
252
|
+
[`&.${i.sizeSmall}`]: {
|
|
253
|
+
transform: "translate(8px, 7px) scale(1)"
|
|
254
|
+
},
|
|
255
|
+
[`&.${i.shrink}`]: {
|
|
256
|
+
transform: "translate(16px, -7px) scale(0.8)"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
MuiInput: {
|
|
264
|
+
defaultProps: { disableUnderline: !0 },
|
|
265
|
+
variants: [
|
|
266
|
+
{
|
|
267
|
+
props: { disableUnderline: !0 },
|
|
268
|
+
style: ({ theme: e }) => e.unstable_sx({
|
|
269
|
+
fontSize: "0.875rem",
|
|
270
|
+
lineHeight: "1.5rem",
|
|
271
|
+
[`&.${t.multiline}`]: {
|
|
272
|
+
py: 0
|
|
273
|
+
},
|
|
274
|
+
[`.${t.input}`]: {
|
|
275
|
+
py: 0.5,
|
|
276
|
+
height: "1.5rem"
|
|
277
|
+
},
|
|
278
|
+
[`&.${t.sizeSmall}`]: {
|
|
279
|
+
[`.${t.input}`]: {
|
|
280
|
+
py: "1px"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
MuiFilledInput: {
|
|
288
|
+
styleOverrides: {
|
|
289
|
+
root: ({ theme: e }) => e.unstable_sx({
|
|
290
|
+
fontSize: "0.875rem",
|
|
291
|
+
bgcolor: e.palette.grey[100],
|
|
292
|
+
"&:hover": {
|
|
293
|
+
bgcolor: e.palette.grey[100]
|
|
294
|
+
},
|
|
295
|
+
"@media (hover: none)": {
|
|
296
|
+
bgcolor: e.palette.grey[100]
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
MuiSelect: {
|
|
302
|
+
styleOverrides: {
|
|
303
|
+
select: {
|
|
304
|
+
display: "flex",
|
|
305
|
+
alignItems: "center",
|
|
306
|
+
[`.${y.root}`]: {
|
|
307
|
+
minWidth: 20
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
defaultProps: { variant: "filled", IconComponent: x },
|
|
312
|
+
variants: [
|
|
313
|
+
{
|
|
314
|
+
props: {},
|
|
315
|
+
style: ({ theme: e }) => e.unstable_sx({
|
|
316
|
+
fontSize: "0.875rem",
|
|
317
|
+
borderRadius: 1,
|
|
318
|
+
lineHeight: "1.5rem",
|
|
319
|
+
// filled
|
|
320
|
+
[`&.${u.root}`]: {
|
|
321
|
+
":before,:after": { display: "none" },
|
|
322
|
+
[`.${t.input}`]: {
|
|
323
|
+
py: 0.5,
|
|
324
|
+
borderRadius: 1,
|
|
325
|
+
[`&.${t.inputSizeSmall}`]: {
|
|
326
|
+
py: "1px"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
// outlined
|
|
331
|
+
[`&.${m.root}`]: {
|
|
332
|
+
[`.${t.input}`]: {
|
|
333
|
+
py: 0.5,
|
|
334
|
+
borderRadius: 1,
|
|
335
|
+
[`&.${t.inputSizeSmall}`]: {
|
|
336
|
+
py: "1px"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
})
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
MuiSlider: {
|
|
345
|
+
defaultProps: {},
|
|
346
|
+
variants: [
|
|
347
|
+
{
|
|
348
|
+
props: {},
|
|
349
|
+
style: ({ theme: e }) => e.unstable_sx({
|
|
350
|
+
height: 3,
|
|
351
|
+
[`.${o.track}`]: {
|
|
352
|
+
borderWidth: 0
|
|
353
|
+
},
|
|
354
|
+
[`.${o.thumb}`]: {
|
|
355
|
+
width: 16,
|
|
356
|
+
height: 16
|
|
357
|
+
},
|
|
358
|
+
[`&.${o.sizeSmall}`]: {
|
|
359
|
+
height: 2,
|
|
360
|
+
[`.${o.thumb}`]: {
|
|
361
|
+
width: 12,
|
|
362
|
+
height: 12
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
MuiFormHelperText: {
|
|
370
|
+
styleOverrides: {
|
|
371
|
+
root: ({ theme: e }) => e.unstable_sx({
|
|
372
|
+
mx: 1
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
MuiTypography: {
|
|
377
|
+
variants: [
|
|
378
|
+
{
|
|
379
|
+
props: { variant: "body1" },
|
|
380
|
+
style: ({ theme: e }) => e.unstable_sx({
|
|
381
|
+
fontSize: "0.875rem"
|
|
382
|
+
})
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
props: { variant: "body2" },
|
|
386
|
+
style: ({ theme: e }) => e.unstable_sx({
|
|
387
|
+
fontSize: "0.75rem"
|
|
388
|
+
})
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
},
|
|
392
|
+
MuiMenuItem: {
|
|
393
|
+
styleOverrides: {
|
|
394
|
+
root: ({ theme: e }) => e.unstable_sx({
|
|
395
|
+
padding: "6px 12px",
|
|
396
|
+
fontSize: "0.875rem",
|
|
397
|
+
borderRadius: 1,
|
|
398
|
+
".MuiListItemIcon-root": {
|
|
399
|
+
minWidth: 0,
|
|
400
|
+
mr: 1
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
MuiListItemButton: {
|
|
406
|
+
styleOverrides: {
|
|
407
|
+
root: {
|
|
408
|
+
padding: "6px 12px"
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
MuiList: {
|
|
413
|
+
styleOverrides: {
|
|
414
|
+
root: {
|
|
415
|
+
padding: 4
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
MuiListItemText: {
|
|
420
|
+
styleOverrides: {
|
|
421
|
+
primary: {
|
|
422
|
+
fontSize: "0.875rem"
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
MuiDialogTitle: {
|
|
427
|
+
styleOverrides: {
|
|
428
|
+
root: ({ theme: e }) => e.unstable_sx({
|
|
429
|
+
padding: "16px 24px",
|
|
430
|
+
borderBottom: `1px solid ${e.palette.divider}`
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
MuiDialogActions: {
|
|
435
|
+
styleOverrides: {
|
|
436
|
+
root: ({ theme: e }) => e.unstable_sx({
|
|
437
|
+
borderTop: `1px solid ${e.palette.divider}`,
|
|
438
|
+
padding: "16px 24px"
|
|
439
|
+
})
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
MuiDialogContent: {
|
|
443
|
+
styleOverrides: {
|
|
444
|
+
root: {
|
|
445
|
+
padding: "12px 24px !important"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
MuiButton: {
|
|
450
|
+
defaultProps: {
|
|
451
|
+
size: "small"
|
|
452
|
+
},
|
|
453
|
+
styleOverrides: {}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}, L = {
|
|
457
|
+
typography: {
|
|
458
|
+
// @ts-ignore
|
|
459
|
+
big: { ...f },
|
|
460
|
+
button: {
|
|
461
|
+
// @ts-ignore
|
|
462
|
+
textTransform: "none",
|
|
463
|
+
WebkitTextTransform: "none"
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}, A = ({
|
|
467
|
+
children: e,
|
|
468
|
+
isDashboard: r = !1
|
|
469
|
+
}) => {
|
|
470
|
+
const d = M().pathname.startsWith("/admin/maker") || r, b = v(() => d ? T : L, [d]);
|
|
471
|
+
return /* @__PURE__ */ a(
|
|
472
|
+
c,
|
|
473
|
+
{
|
|
474
|
+
theme: b,
|
|
475
|
+
translations: C,
|
|
476
|
+
fallbackLocale: "en",
|
|
477
|
+
injectFirst: !0,
|
|
478
|
+
children: /* @__PURE__ */ a(I, { serviceHost: n, protectedRoutes: [`${O}/*`], children: e })
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
};
|
|
482
|
+
export {
|
|
483
|
+
A as PagesKitThemeProvider
|
|
484
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UploaderButton as r, UploaderProvider as d, getImageSize as t, getVideoSize as a, useUploader as i } from "@blocklet/pages-kit/builtin/uploader";
|
|
2
|
+
export {
|
|
3
|
+
r as UploaderButton,
|
|
4
|
+
d as UploaderProvider,
|
|
5
|
+
t as getImageSize,
|
|
6
|
+
a as getVideoSize,
|
|
7
|
+
i as useUploader
|
|
8
|
+
};
|
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.5",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -203,8 +203,8 @@
|
|
|
203
203
|
"yaml": "^2.5.0",
|
|
204
204
|
"yjs": "^13.6.18",
|
|
205
205
|
"zustand": "^4.5.5",
|
|
206
|
-
"@blocklet/pages-kit": "^0.6.
|
|
207
|
-
"@blocklet/pages-kit-block-studio": "^0.6.
|
|
206
|
+
"@blocklet/pages-kit": "^0.6.5",
|
|
207
|
+
"@blocklet/pages-kit-block-studio": "^0.6.5"
|
|
208
208
|
},
|
|
209
209
|
"devDependencies": {
|
|
210
210
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("./home-DUjl5PbP.js"),r=require("./state-CtNs8GrN.js");function n({children:t}){const e=r.useProjectId();return s.jsx(r.StoreProvider,{url:o.getWssURL(e??""),name:"root",waitingSynced:!0,children:s.jsx(u,{children:t})})}function u({children:t}){const{state:e}=r.useStore();return t({state:e})}exports.default=n;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";const d=require("@arcblock/ux/lib/Theme"),p=require("@blocklet/ui-react/lib/Header"),h=require("@mui/material"),s=require("react"),w=require("react-router-dom"),g=require("@arcblock/did-connect/lib/Session"),P=require("@blocklet/js-sdk"),l=require("ufo");require("lodash/isEmpty");require("yaml");const f=require("react/jsx-runtime"),q=e=>e&&e.__esModule?e:{default:e},S=q(p),{SessionProvider:F,SessionContext:_,SessionConsumer:C,withSession:$}=g.createAuthServiceSessionContext();function r(){return s.useContext(_)}function j(...e){const{session:t}=r();return e.includes(t.user?.role)}function I(...e){const{session:t}=r(),o=j(...e);return window.blocklet?.tenantMode==="multiple"?!!t.user:o}const m=window.blocklet?.prefix||"/",i=P.createAxios({timeout:200*1e3}),R=window.location.protocol==="https:"?"wss":"ws",b=e=>l.joinURL(`${R}://${window.location.hostname}`,m,`api/${e}/ws/pages`),y="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";blocklet?.componentMountPoints.find(e=>e.did===y)?.mountPoint||l.joinURL(m,"/image-bin");function u(){const{pathname:e}=window.location,o=e.match(/\/admin\/(maker|previewer)\/([^/]+)/)?.[2],n=window.__PROJECT_ID__;if(!o&&!n)throw new Error("Unable to get projectId from pathname");return o||n}function M(e){return`${e}:pages:version`}const k=["production","draft"];function x({mode:e,version:t}={}){const o=t&&typeof t=="number"?{mode:e,version:t}:{mode:e};return i.get(`/api/${u()}/pages`,{params:o}).then(n=>n.data)}function E({mode:e,routes:t}){return i.post(`/api/${u()}/pages/publish`,{mode:e,routes:t}).then(o=>o.data)}function D(){const[e]=w.useSearchParams(),{session:t}=r(),o=I("owner","admin","pagesEditor","member"),n=s.useMemo(()=>{const a=e.get("mode");return k.includes(a)?a:"production"},[e]),c=n==="production"?n:t.user?o?n:"production":null;return c?f.jsx(HomeView,{mode:c}):null}s.lazy(()=>Promise.resolve().then(()=>require("./publish-button-C522nNv6.js")));s.lazy(()=>Promise.resolve().then(()=>require("./draft-data-CfIMszE7.js")));d.styled(S.default)`
|
|
2
|
-
&.sticky {
|
|
3
|
-
position: sticky;
|
|
4
|
-
top: 0;
|
|
5
|
-
}
|
|
6
|
-
`;d.styled(h.Button)``;exports.api=i;exports.d=D;exports.getPages=x;exports.getProjectIdFromPathnameOrWindow=u;exports.getProjectPageVersionKey=M;exports.getWssURL=b;exports.publishPages=E;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("./home-DUjl5PbP.js"),$=require("@arcblock/ux/lib/Locale/context"),X=require("@arcblock/ux/lib/Toast"),Y=require("@blocklet/pages-kit/utils/route"),O=require("@mui/icons-material"),F=require("@mui/lab"),s=require("@mui/material"),Z=require("immer"),ee=require("lodash/difference"),a=require("react"),te=require("react-use"),se=require("./state-CtNs8GrN.js"),H=n=>n&&n.__esModule?n:{default:n},E=H(X),V=H(ee);function ne(n){return e.jsx(s.Box,{...n,sx:[{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center"},...Array.isArray(n.sx)?n.sx:[n.sx]],children:e.jsx(s.CircularProgress,{size:30})})}function ie(n){const[x,g]=a.useState(!1);return e.jsx(F.LoadingButton,{...n,loading:n.loading||x,onClick:c=>{const m=n.onClick?.(c);m instanceof Promise&&(g(!0),m.finally(()=>{g(!1)}))}})}const oe=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 re(){const[n,x]=a.useState(),g=a.useMemo(()=>n?e.jsx(s.Dialog,{...n}):null,[n]),c=a.useCallback(()=>{x(void 0)},[]),m=a.useCallback(({title:b,content:d,cancelText:P="Cancel",okText:f="Ok",onOk:y,onClose:u,okIcon:B,okColor:k="primary",cancelColor:h="primary",DialogContentProps:v,form:I,...M})=>{x({...M,open:!0,children:e.jsxs("form",{onSubmit:L=>L.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:L=>`1px solid ${L.palette.divider}`},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{c(),u?.()},children:e.jsx(oe,{})})]}),d&&e.jsx(s.DialogContent,{...v,sx:{mt:-3,...v?.sx,bgcolor:"background.paper"},children:e.jsx(s.Box,{sx:{pt:3},children:d})}),e.jsxs(s.DialogActions,{sx:{bgcolor:"background.paper"},children:[e.jsx(s.Button,{variant:"outlined",color:h||"primary",onClick:u??c,children:P}),e.jsx(ie,{variant:"contained",color:k||"primary",startIcon:B,loadingPosition:B?"start":"center",onClick:async()=>{await y?.(),c()},type:"submit",children:f})]})]}),onClose:u??c})},[c]);return{dialog:g,showDialog:m,closeDialog:c}}const ae=({ref:n,mode:x,state:g})=>{const{t:c}=$.useLocaleContext(),[m,b]=a.useState(!1),{dialog:d,showDialog:P}=re(),f=se.useProjectId(),y=a.useCallback(B=>{let k=[];P({title:c("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(O.Warning,{}),children:c("maker.publishToProductionTip")}),e.jsx(s.Box,{sx:{maxHeight:"50vh",overflow:"auto",mt:2},children:e.jsx(ce,{state:g,toMode:x,onChange:h=>k=h,defaultRouteIds:B})})]}),okText:c("maker.publish"),cancelText:c("common.cancel"),onOk:async()=>{if(k?.length===0){const h=c("maker.publishSelectPagesMessage");throw E.default.error(h),new Error(h)}localStorage.setItem(q.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await q.publishPages({mode:x,routes:k}),E.default.success(c("maker.publishSuccessMessage"))}catch(h){throw E.default.error(h.message),h}finally{b(!1)}}})},[x,g,c,f,P]);a.useImperativeHandle(n,()=>({openPublishDialog:y}));const u=a.useCallback(()=>{y()},[y]);return e.jsxs(e.Fragment,{children:[e.jsx(F.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:u,loading:m,disabled:m,children:c("maker.publish")}),d]})};function le({routePathInfo:n,checked:x,onClick:g,route:c}){const{t:m}=$.useLocaleContext(),b=!n.routeMetaData?.publishedAt||n.routeMetaData?.updatedAt&&new Date(n.routeMetaData?.updatedAt)>new Date(n.routeMetaData?.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center",minWidth:"auto"},children:[b&&e.jsx(s.Box,{className:"visible",title:m("maker.pages.needPublish"),sx:{mr:.35,color:"warning.main",display:"flex",alignItems:"center"},children:e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(O.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!n.routeMetaData?.isPublic||!c.isPublic)&&e.jsx(s.Box,{className:"visible",sx:{color:"warning.main"},children:e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(O.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:g,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:x,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:n.path,slotProps:{primary:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}}})]})})}function ce({state:n,toMode:x,onChange:g,defaultRouteIds:c}){const{t:m,locale:b}=$.useLocaleContext(),[d,P]=a.useState(!1),[f,y]=a.useState(()=>c?Object.fromEntries(c.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[u,B]=a.useState({}),[k,h]=a.useState(()=>c?Object.fromEntries(c.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[v,I]=a.useState({}),{loading:M,error:L,value:w}=te.useAsync(()=>q.getPages({mode:x}),[x]);if(L)throw L;const j=a.useMemo(()=>n.routeIds||[],[n]),R=a.useMemo(()=>w?.pageIds||[],[w]),D=a.useMemo(()=>!j||!n.routes?[]:JSON.parse(JSON.stringify(j)).sort((i,o)=>{const r=n.routes?.[i],l=n.routes?.[o];return r?.publishedAt&&new Date(r.publishedAt).getTime()<new Date(r.updatedAt).getTime()?-1:l?.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date(r?.updatedAt??"").getTime()-new Date(l?.updatedAt??"").getTime()}),[n,j]),z=a.useMemo(()=>{if(!D)return[];if(!u)return D;const t=[...D].filter(i=>!u[i]);return Object.values(u).forEach(i=>{i.forEach(o=>{t.push(`${o.originalRouteId}-${o.paramOptionIds.join("-")}`)})}),t},[D,u]),C=a.useMemo(()=>!w||!R||!z?[]:V.default(R,z),[z,w,R]),T=a.useMemo(()=>j?[...j].concat(C):C,[j,C]),W=a.useCallback(()=>{const t={};D?.forEach(i=>{const o=n.routes?.[i];if(o&&o.params&&o.params.length>0&&o.paramsOptions&&o.paramsOptions.length>0){const r=Y.generateParamCombinations({basePath:o.path,params:o.params,routeId:o.id,paramsOptions:o.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});r.length>0&&(t[o.id]=r)}}),B(t)},[D,n.routes]);a.useEffect(()=>{W()},[W]),a.useEffect(()=>{I(t=>{const i={...t};return Object.keys(u).forEach(o=>{u[o]&&u[o]?.length>0&&i[o]===void 0&&(i[o]=!0)}),i})},[u]);const _=a.useRef(!0);a.useEffect(()=>{h(t=>{const i={...t};return Object.keys(u).length===0||(Object.keys(u).forEach(o=>{const r=u[o]||[],l=d||!!f[o];r.forEach(A=>{const p=`${o}-${A.paramOptionIds.join("-")}`;_.current?i[p]=l||t[p]||!1:i[p]=l})}),_.current=!1),i})},[f,u,d]);const J=(t,i)=>{i.stopPropagation(),I(o=>{const r={...o};return r[t]=!r[t],r})},K=a.useCallback(t=>{y(i=>{const o=Z.produce(i,r=>{d?(Object.assign(r,Object.fromEntries(T.map(l=>[l,!0]))),delete r[t]):r[t]?(delete r[t],C.includes(t)&&(j||[]).filter(l=>n.pages[l]?.slug===w?.pages[t]?.slug).forEach(l=>{delete r[l]})):(r[t]=!0,j&&j.includes(t)&&C.filter(l=>w?.pages[l]?.slug===n.pages[t]?.slug).forEach(l=>{r[l]=!0}))});return P(V.default(T,Object.keys(o)).length===0),o})},[d,T,C,n,w,j]),U=a.useCallback((t,i)=>{const o=`${t}-${i.paramOptionIds.join("-")}`;h(r=>{const l={...r};l[o]=!l[o];const A=u[t]?.every(p=>l[`${t}-${p.paramOptionIds.join("-")}`])??!1;return y(p=>{if(A&&!p[t])return{...p,[t]:!0};if(!A&&p[t]){const S={...p};return delete S[t],S}return p}),l})},[u]),G=a.useCallback(()=>{P(t=>(t&&y({}),!t))},[]);return a.useEffect(()=>{const t=d?T:Object.keys(f),i=Object.entries(k).filter(([,r])=>r).map(([r])=>r).filter(r=>r!==void 0),o=Array.from(new Set([...t,...i]));g(d?null:o)},[d,f,k,T,g]),M?e.jsx(ne,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:G,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),D.map(t=>{const i=n.routes?.[t];if(!i)return null;const o=!1,r=u&&u[t]&&u[t]?.length>0,l=v[t]!==!1,A=u[t]||[],p=!i.publishedAt||i.updatedAt&&new Date(i.updatedAt).getTime()>new Date(i.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:[p&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(O.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!i.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(O.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),o,r&&e.jsx(s.Box,{onClick:S=>J(t,S),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:l?e.jsx(O.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(O.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>K(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:i.path,slotProps:{primary:{noWrap:!0,textOverflow:"ellipsis"},secondary:{noWrap:!0,textOverflow:"ellipsis"}}})]})}),r&&e.jsx(s.Collapse,{in:l,children:e.jsx(s.Box,{children:A.map(S=>{const N=`${t}-${S.paramOptionIds.join("-")}`,Q=k[N]||!1;return e.jsx(le,{routePathInfo:S,checked:d||Q,onClick:()=>U(t,S),route:i},N)})})})]},t)}),C.map(t=>{const i=w?.pages[t];return i?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>K(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:i.slug,secondary:i.locales?.[b]?.title,slotProps:{primary:{noWrap:!0,textOverflow:"ellipsis"},secondary:{noWrap:!0,textOverflow:"ellipsis"}}})]})},t):null})]})}exports.default=ae;
|