@blocklet/pages-kit-inner-components 0.4.108 → 0.4.110

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 (30) hide show
  1. package/lib/cjs/add-component.js +1 -1
  2. package/lib/cjs/chunks/array-COVLO-B9.js +507 -0
  3. package/lib/cjs/chunks/config-color-BBSht7j-.js +21 -0
  4. package/lib/cjs/chunks/{draft-data-UP_7unuZ.js → draft-data-DPTVTTlh.js} +1 -1
  5. package/lib/cjs/chunks/{home-Bbe5kMJx.js → home-DWk31ISZ.js} +3 -3
  6. package/lib/cjs/chunks/{publish-button-DEDtAl9J.js → publish-button-CK-OfgnP.js} +1 -1
  7. package/lib/cjs/chunks/state-DDwYX2mu.js +1 -0
  8. package/lib/cjs/home.js +1 -1
  9. package/lib/cjs/setting.js +2 -2
  10. package/lib/cjs/uploader.js +1 -1
  11. package/lib/es/add-component.js +3 -3
  12. package/lib/es/chunks/{array-C85JziT_.js → array-NPaNaJ_G.js} +451 -426
  13. package/lib/es/chunks/config-color-JrBPRsTv.js +121 -0
  14. package/lib/es/chunks/{draft-data-0n1CKRWr.js → draft-data-BFlmvWXx.js} +3 -3
  15. package/lib/es/chunks/{home-Dlf4i27b.js → home-BAqpMe5F.js} +4 -4
  16. package/lib/es/chunks/{publish-button-BJk6jKq-.js → publish-button-BiVmX8PH.js} +3 -3
  17. package/lib/es/chunks/{site-state-Bn8mEgOx.js → site-state-BVZLaWr2.js} +3 -3
  18. package/lib/es/chunks/{state-DsXKwImw.js → state-BgKqNapt.js} +12 -12
  19. package/lib/es/components.js +1 -1
  20. package/lib/es/home.js +3 -3
  21. package/lib/es/project-html.js +12 -12
  22. package/lib/es/resources.js +1 -1
  23. package/lib/es/setting.js +152 -151
  24. package/lib/es/site-state.js +6 -6
  25. package/lib/es/uploader.js +6 -64
  26. package/package.json +12 -12
  27. package/lib/cjs/chunks/array-BMkoDb_A.js +0 -507
  28. package/lib/cjs/chunks/config-color-Da8lKUL0.js +0 -21
  29. package/lib/cjs/chunks/state-BoXTl4DM.js +0 -1
  30. package/lib/es/chunks/config-color-B-ax03qd.js +0 -328
@@ -1,328 +0,0 @@
1
- import { jsx as o, jsxs as f, Fragment as W } from "react/jsx-runtime";
2
- import j from "@arcblock/ux/lib/Empty";
3
- import { useLocaleContext as G } from "@arcblock/ux/lib/Locale/context";
4
- import { styled as R } from "@arcblock/ux/lib/Theme";
5
- import { useMuiColorPalette as E } from "@blocklet/pages-kit/contexts/color";
6
- import { isGradient as B, getSafeGradient as S, isColorString as H } from "@blocklet/pages-kit/utils/style";
7
- import "@emotion/css";
8
- import { TextField as L, Stack as P, FormControlLabel as _, Switch as U, Box as a, InputAdornment as X, Dialog as N, DialogTitle as O, Typography as I, ButtonGroup as Y, Button as K, DialogContent as $, Tooltip as q, Skeleton as J, DialogActions as Q } from "@mui/material";
9
- import { useReactive as Z, useLocalStorageState as ee, useBoolean as oe } from "ahooks";
10
- import "lodash/without";
11
- import { forwardRef as A, useState as ie, useEffect as re, useImperativeHandle as V, lazy as te, useCallback as le, Suspense as ne } from "react";
12
- import ae from "tinycolor2";
13
- import { red as ce, pink as se, purple as ue, indigo as de, blue as me, cyan as pe, teal as fe, green as ge, lime as he, yellow as ye, amber as be, orange as xe, brown as Ce, grey as ve, blueGrey as ke } from "@mui/material/colors";
14
- import { getImageSize as z, getVideoSize as D, UploaderButton as Ke } from "../uploader.js";
15
- import { Icon as we } from "@iconify-icon/react";
16
- import { useDebounce as Ie } from "react-use";
17
- import { b as F } from "./state-DsXKwImw.js";
18
- ce[300], se[300], ue[300], // deepPurple['300'],
19
- de[300], me[300], // lightBlue['300'],
20
- pe[300], fe[300], ge[300], // lightGreen['300'],
21
- he[300], ye[300], be[300], xe[300], // deepOrange['300'],
22
- Ce[300], ve[300], ke[300];
23
- const Ue = A(function({ showMarkdown: g, markdown: c, onMarkdownChange: s, showUploader: e, value: t, meta: w, onChange: u, ...d }, y) {
24
- const [l, b] = ie("");
25
- re(() => {
26
- b(t || "");
27
- }, [t, b]);
28
- const k = async () => {
29
- if (l !== t) {
30
- const i = F(l);
31
- if (!i) {
32
- u(l, void 0);
33
- return;
34
- }
35
- const p = await z(i).catch(() => D(i)).catch(() => {
36
- });
37
- u(l, { ...p, filename: l });
38
- }
39
- };
40
- Ie(
41
- () => {
42
- l !== t && u(l);
43
- },
44
- 300,
45
- [l]
46
- ), V(y, () => ({
47
- submit: k
48
- }));
49
- const m = {};
50
- return e && (m.InputProps = {
51
- sx: { pr: 0 },
52
- endAdornment: /* @__PURE__ */ o(X, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ o(
53
- Ke,
54
- {
55
- onChange: async ({ response: i }) => {
56
- var x;
57
- const p = (x = i == null ? void 0 : i.data) == null ? void 0 : x.filename, C = F(p) || "";
58
- let r = {};
59
- C && (r = await z(C).catch(() => D(C)).catch(() => {
60
- })), u(p, {
61
- ...r,
62
- filename: p
63
- });
64
- }
65
- }
66
- ) })
67
- }), /* @__PURE__ */ o(
68
- L,
69
- {
70
- size: "small",
71
- fullWidth: !0,
72
- ...d,
73
- label: /* @__PURE__ */ f(P, { direction: "row", spacing: 1, alignItems: "center", children: [
74
- d.label,
75
- g && /* @__PURE__ */ f(W, { children: [
76
- " (",
77
- /* @__PURE__ */ o(
78
- _,
79
- {
80
- checked: c,
81
- label: /* @__PURE__ */ o(a, { component: we, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
82
- labelPlacement: "start",
83
- control: /* @__PURE__ */ o(U, { size: "small" }),
84
- sx: { ml: 0.25, pr: 1 },
85
- onChange: (i, p) => s == null ? void 0 : s(p)
86
- }
87
- ),
88
- ")"
89
- ] })
90
- ] }),
91
- InputLabelProps: { shrink: !0, ...d.InputLabelProps },
92
- value: l,
93
- onChange: (i) => b(i.target.value),
94
- ...m,
95
- onKeyDown: (i) => {
96
- i.keyCode !== 229 && i.key === "Enter" && k();
97
- }
98
- }
99
- );
100
- }), Te = te(() => import("react-best-gradient-color-picker")), M = 400, T = 270;
101
- function Xe({ color: h, sx: g = {}, ...c }) {
102
- H(h);
103
- const s = {};
104
- return B(h) ? s.backgroundImage = h : s.backgroundColor = h, /* @__PURE__ */ o(
105
- a,
106
- {
107
- sx: {
108
- ...g,
109
- width: "100%",
110
- paddingBottom: "100%",
111
- cursor: "pointer",
112
- transition: "opacity 0.2s",
113
- border: "1px solid #ccc",
114
- borderRadius: 0.5,
115
- "&:hover": {
116
- opacity: 0.75
117
- },
118
- ...s
119
- },
120
- ...c
121
- }
122
- );
123
- }
124
- const Ne = A(function({ onSave: g, enableMuiPalette: c = !0 }, s) {
125
- const e = Z({
126
- value: "",
127
- originalMuiKey: null
128
- }), { t } = G(), [w, u] = ee("pages-kit:color-picker-active-tab", {
129
- defaultValue: 0
130
- }), d = E(), y = {};
131
- e.value ? B(e.value) ? y.backgroundImage = e.value : y.backgroundColor = e.value : y.border = "1px solid #ccc";
132
- const [l, { setFalse: b, setTrue: k }] = oe(!1), m = le(() => {
133
- b();
134
- }, [b]), i = c && w === 0;
135
- V(s, () => ({
136
- open({ value: r } = { value: "" }) {
137
- if (c && d.isMuiColorKey(r)) {
138
- e.originalMuiKey = r;
139
- const x = d.getColorByMuiKey(r);
140
- e.value = S(x || r), u(0);
141
- } else
142
- e.originalMuiKey = null, e.value = S(r), c || u(1);
143
- k();
144
- },
145
- close() {
146
- m();
147
- }
148
- }));
149
- const p = () => {
150
- if (c && d)
151
- if (i) {
152
- const r = d.getMuiKeyByColor(e.value);
153
- g({ value: r || e.value }, m);
154
- } else
155
- g({ value: e.value }, m);
156
- else
157
- g({ value: e.value }, m);
158
- }, { groupedMuiColors: C } = d;
159
- return /* @__PURE__ */ f(N, { disableEnforceFocus: !0, open: l, onClose: m, hideBackdrop: !0, children: [
160
- /* @__PURE__ */ f(O, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
161
- /* @__PURE__ */ o(I, { variant: "inherit", component: "div", children: t("maker.configColor") }),
162
- c && /* @__PURE__ */ f(Y, { size: "small", "aria-label": "color mode selector", children: [
163
- /* @__PURE__ */ o(
164
- K,
165
- {
166
- variant: i ? "contained" : "outlined",
167
- onClick: () => u(0),
168
- sx: {
169
- fontWeight: 500,
170
- textTransform: "none",
171
- minWidth: "unset"
172
- },
173
- children: t("maker.configColorMuiTheme") || "Theme Color"
174
- }
175
- ),
176
- /* @__PURE__ */ o(
177
- K,
178
- {
179
- variant: w === 1 ? "contained" : "outlined",
180
- onClick: () => u(1),
181
- sx: {
182
- fontWeight: 500,
183
- textTransform: "none",
184
- minWidth: "unset"
185
- },
186
- children: t("maker.configColorCustomColor") || "Custom Color"
187
- }
188
- )
189
- ] })
190
- ] }),
191
- /* @__PURE__ */ f($, { sx: { width: 600, display: "flex", flexDirection: "row", gap: 2, overflowX: "hidden" }, children: [
192
- /* @__PURE__ */ f(
193
- a,
194
- {
195
- sx: {
196
- ...y,
197
- flex: "0 0 270px",
198
- borderRadius: 1,
199
- display: "flex",
200
- alignItems: "center",
201
- justifyContent: "center",
202
- position: "sticky",
203
- top: 0
204
- },
205
- children: [
206
- !e.value && /* @__PURE__ */ o(j, { children: t("error.notConfig") }),
207
- e.originalMuiKey && i && /* @__PURE__ */ o(
208
- I,
209
- {
210
- variant: "body2",
211
- sx: {
212
- bgcolor: "rgba(255,255,255,0.7)",
213
- px: 2,
214
- py: 1,
215
- borderRadius: 1,
216
- color: "#000",
217
- maxWidth: "90%",
218
- textAlign: "center"
219
- },
220
- children: e.originalMuiKey
221
- }
222
- )
223
- ]
224
- },
225
- "color-preview"
226
- ),
227
- /* @__PURE__ */ o(a, { sx: { flex: 1 }, children: i ? (
228
- // MUI 主题色面板
229
- /* @__PURE__ */ o(a, { sx: { height: M }, children: Object.entries(C).map(([r, x]) => /* @__PURE__ */ f(a, { sx: { pb: 1.5 }, children: [
230
- /* @__PURE__ */ o(
231
- I,
232
- {
233
- variant: "subtitle2",
234
- gutterBottom: !0,
235
- sx: { textTransform: "capitalize", mb: 0.5, lineHeight: 1 },
236
- children: r
237
- }
238
- ),
239
- /* @__PURE__ */ o(a, { sx: { display: "flex", flexWrap: "wrap", gap: 1 }, children: x.map((n) => {
240
- let v = "";
241
- return e.originalMuiKey === n.colorKey && (n.colorValue === "transparent" ? v = "rgba(0,0,0,0.7)" : ae(n.colorValue).isDark() ? v = "rgba(255,255,255,0.8)" : v = "rgba(0,0,0,0.7)"), /* @__PURE__ */ o(q, { title: n.colorKey, children: /* @__PURE__ */ o(
242
- a,
243
- {
244
- onClick: () => {
245
- e.value = n.colorValue, e.originalMuiKey = n.colorKey;
246
- },
247
- sx: {
248
- width: 28,
249
- height: 28,
250
- bgcolor: n.colorValue,
251
- border: e.originalMuiKey === n.colorKey ? `2px solid ${v}` : "1px solid #ccc",
252
- borderRadius: 0.5,
253
- cursor: "pointer",
254
- "&:hover": { opacity: 0.8 },
255
- display: "flex",
256
- alignItems: "center",
257
- justifyContent: "center",
258
- // 透明色时显示棋盘背景
259
- ...n.colorValue === "transparent" ? {
260
- background: "repeating-conic-gradient(#CCCCCC 0% 25%, #FFFFFF 0% 50%) 50% / 10px 10px"
261
- } : {}
262
- },
263
- children: e.originalMuiKey === n.colorKey && /* @__PURE__ */ o(
264
- "i",
265
- {
266
- className: "i-mdi:check",
267
- style: {
268
- color: v,
269
- fontSize: "1.2rem"
270
- }
271
- }
272
- )
273
- }
274
- ) }, n.colorKey);
275
- }) })
276
- ] }, r)) })
277
- ) : (
278
- // 自定义颜色选择器
279
- /* @__PURE__ */ o(a, { sx: { overflowY: "auto", overflowX: "hidden" }, children: /* @__PURE__ */ o(ne, { fallback: /* @__PURE__ */ o(J, { variant: "rectangular", width: T, height: M }), children: /* @__PURE__ */ o(
280
- Te,
281
- {
282
- disableDarkMode: !0,
283
- width: T,
284
- height: T,
285
- value: e.value,
286
- onChange: (r) => {
287
- e.value = r, e.originalMuiKey = null;
288
- },
289
- hidePresets: !0,
290
- hideAdvancedSliders: !0,
291
- hideColorGuide: !0,
292
- hideInputType: !0
293
- }
294
- ) }) })
295
- ) })
296
- ] }),
297
- /* @__PURE__ */ f(Q, { children: [
298
- /* @__PURE__ */ o(K, { variant: "outlined", size: "small", onClick: m, children: t("common.cancel") }),
299
- /* @__PURE__ */ o(K, { variant: "contained", size: "small", onClick: p, children: t("maker.save") })
300
- ] })
301
- ] });
302
- });
303
- R(a)`
304
- .color-item {
305
- position: relative;
306
- }
307
- .color-item__checked {
308
- position: absolute;
309
- top: 0;
310
- bottom: 0;
311
- left: 0;
312
- right: 0;
313
- display: flex;
314
- justify-content: center;
315
- align-items: center;
316
- color: rgba(255, 255, 255, 0.85);
317
- }
318
- .color-item__delete {
319
- position: absolute;
320
- top: 0;
321
- right: 0;
322
- }
323
- `;
324
- export {
325
- Ue as C,
326
- Xe as a,
327
- Ne as b
328
- };