@blocklet/pages-kit-inner-components 0.5.25 → 0.5.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/add-component.js +1 -1
- package/lib/cjs/chunks/{array-BEJTeOmf.js → array-CJC7ex3i.js} +1 -1
- package/lib/cjs/chunks/{config-string-DOydtRKn.js → config-string-C4Q0hgG0.js} +1 -1
- package/lib/cjs/chunks/{draft-data-B19cThO_.js → draft-data-Cu9gua-P.js} +1 -1
- package/lib/cjs/chunks/{home-DQhlP6NG.js → home-CimGvyT9.js} +3 -3
- package/lib/cjs/chunks/publish-button-DvwoFH1F.js +1 -0
- package/lib/cjs/chunks/state-jCG5gSUJ.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/setting.js +1 -1
- package/lib/es/add-component.js +3 -3
- package/lib/es/chunks/{array-uzhVAv0S.js → array-9j8tOSbO.js} +1 -1
- package/lib/es/chunks/{config-string-BloDH_C5.js → config-string-CNLg1EYu.js} +1 -1
- package/lib/es/chunks/{draft-data-hZqezCbE.js → draft-data-hSHLdxKp.js} +1 -1
- package/lib/es/chunks/{home-BG1ZwC5Y.js → home-CNk6U8FU.js} +4 -4
- package/lib/es/chunks/{publish-button-CyxGsQeI.js → publish-button-BftBlabj.js} +41 -41
- package/lib/es/chunks/{state-TRx4qpp_.js → state-D5BnGunt.js} +82 -73
- package/lib/es/home.js +3 -3
- package/lib/es/locales.js +12 -4
- package/lib/es/setting.js +2 -2
- package/package.json +3 -3
- package/lib/cjs/chunks/publish-button-CK7LTkaC.js +0 -1
- package/lib/cjs/chunks/state-B4V60dHq.js +0 -1
package/lib/es/add-component.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as e, jsx as I, Fragment as f } from "react/jsx-runtime";
|
|
2
|
-
import { b as oI, i as q, j as IC, n as _, h as CC, k as gC, l as AC, g as iC } from "./chunks/state-
|
|
2
|
+
import { b as oI, i as q, j as IC, n as _, h as CC, k as gC, l as AC, g as iC } from "./chunks/state-D5BnGunt.js";
|
|
3
3
|
import HI from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
|
|
5
5
|
import { Icon as $ } from "@iconify-icon/react";
|
|
@@ -7,14 +7,14 @@ import oC from "@mui/icons-material/Check";
|
|
|
7
7
|
import { Box as D, styled as lI, InputLabel as EI, TextField as h, IconButton as G, Autocomplete as tI, FormControl as wC, Select as sC, MenuItem as Q, ListItemText as nI, Typography as k, OutlinedInput as MC, useTheme as LC, CircularProgress as gI, InputAdornment as jC, Button as X, Grid as V, Stack as uI, Input as XI, CssBaseline as JC, Menu as OC, Dialog as wI, DialogTitle as sI, DialogContent as MI, DialogActions as LI, Tabs as mC, Tab as SC, Card as BC, CardMedia as yC, CardContent as DC, Skeleton as eC } from "@mui/material";
|
|
8
8
|
import { useRequest as bC, useReactive as v, useUpdate as WI, useThrottleFn as TI, useGetState as NC, useAsyncEffect as YI, useBoolean as xI } from "ahooks";
|
|
9
9
|
import rI, { useState as c, useEffect as t, useMemo as E, createContext as jI, useContext as KC, useRef as Z, useCallback as T, createElement as dC, forwardRef as JI, useImperativeHandle as OI } from "react";
|
|
10
|
-
import { I as zC, n as DI, A as cC, b as FC, T as aC, c as HC, B as lC } from "./chunks/array-
|
|
10
|
+
import { I as zC, n as DI, A as cC, b as FC, T as aC, c as HC, B as lC } from "./chunks/array-9j8tOSbO.js";
|
|
11
11
|
import { styled as AI } from "@arcblock/ux/lib/Theme";
|
|
12
12
|
import "@blocklet/pages-kit/builtin/color-picker";
|
|
13
13
|
import "@blocklet/pages-kit/utils/style";
|
|
14
14
|
import { cx as EC } from "@emotion/css";
|
|
15
15
|
import "lodash/without";
|
|
16
16
|
import { red as tC, pink as nC, purple as uC, indigo as XC, blue as WC, cyan as TC, teal as YC, green as xC, lime as rC, yellow as hC, amber as ZC, orange as QC, brown as kC, grey as RC, blueGrey as pC } from "@mui/material/colors";
|
|
17
|
-
import { C as CI } from "./chunks/config-string-
|
|
17
|
+
import { C as CI } from "./chunks/config-string-CNLg1EYu.js";
|
|
18
18
|
import UC from "lodash/cloneDeep";
|
|
19
19
|
import { DragIndicator as fC, SearchRounded as GC, Remove as VC, Add as hI, Language as vC, CopyAll as PC, Settings as _C, Delete as $C } from "@mui/icons-material";
|
|
20
20
|
import { useDrag as qC, useDrop as Ig } from "react-dnd";
|
|
@@ -3,7 +3,7 @@ import "@mui/icons-material";
|
|
|
3
3
|
import { Box as y, styled as Et, Typography as C, Container as Ot, Stack as At, useTheme as xt, createTheme as Ft, ThemeProvider as Ut, Card as Vt, CircularProgress as Dt, Grid as st, CardMedia as Ht, CardContent as Yt } from "@mui/material";
|
|
4
4
|
import Jt, { createContext as yt, useMemo as W, useCallback as M, useContext as bt, Fragment as Mt, isValidElement as wt, useState as K, useEffect as E, useRef as tt } from "react";
|
|
5
5
|
import G from "lodash/keyBy";
|
|
6
|
-
import { f as j, g as N, E as Kt, i as et, m as ot } from "./state-
|
|
6
|
+
import { f as j, g as N, E as Kt, i as et, m as ot } from "./state-D5BnGunt.js";
|
|
7
7
|
import { AIForm as lt, AIFormResult as ct } from "@blocklet/ai-runtime/components";
|
|
8
8
|
import { deepmerge as Gt } from "@mui/utils";
|
|
9
9
|
import rt from "lodash/pick";
|
|
@@ -4,7 +4,7 @@ import { Icon as P } from "@iconify-icon/react";
|
|
|
4
4
|
import { TextField as A, Stack as w, FormControlLabel as F, Switch as L, Box as j, InputAdornment as k } from "@mui/material";
|
|
5
5
|
import { forwardRef as B, useState as D, useEffect as E, useImperativeHandle as U } from "react";
|
|
6
6
|
import { useDebounce as V } from "react-use";
|
|
7
|
-
import { g as x } from "./state-
|
|
7
|
+
import { g as x } from "./state-D5BnGunt.js";
|
|
8
8
|
const J = B(function({ showMarkdown: I, markdown: h, onMarkdownChange: n, showUploader: S, value: o, meta: H, onChange: l, ...a }, z) {
|
|
9
9
|
const [e, c] = D("");
|
|
10
10
|
E(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { u as a, S as o, a as s, b as n } from "./state-
|
|
2
|
+
import { u as a, S as o, a as s, b as n } from "./state-D5BnGunt.js";
|
|
3
3
|
function d({ children: t }) {
|
|
4
4
|
const r = a();
|
|
5
5
|
return /* @__PURE__ */ e(o, { url: s(r ?? ""), name: "root", waitingSynced: !0, children: /* @__PURE__ */ e(i, { children: t }) });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as D } from "react/jsx-runtime";
|
|
2
|
-
import { u as X, d as Y, e as fe, f as he, g as be, c as ye } from "./state-
|
|
2
|
+
import { u as X, d as Y, e as fe, f as he, g as be, c as ye } from "./state-D5BnGunt.js";
|
|
3
3
|
import { useLocaleContext as J } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import Z from "@arcblock/ux/lib/Result";
|
|
5
5
|
import { useHeaderState as ve } from "@blocklet/pages-kit/builtin/page/header";
|
|
@@ -21,7 +21,7 @@ import { Helmet as Be } from "react-helmet";
|
|
|
21
21
|
import { useSearchParams as ue, Routes as Oe, Route as E, Navigate as Fe, ScrollRestoration as Le } from "react-router-dom";
|
|
22
22
|
import { useAsync as pe } from "react-use";
|
|
23
23
|
import { joinURL as S } from "ufo";
|
|
24
|
-
import { S as _e, n as K, P as De, a as Ne, B as $e, g as Ae } from "./array-
|
|
24
|
+
import { S as _e, n as K, P as De, a as Ne, B as $e, g as Ae } from "./array-9j8tOSbO.js";
|
|
25
25
|
import { styled as me, useTheme as He } from "@arcblock/ux/lib/Theme";
|
|
26
26
|
import Ue from "@blocklet/ui-react/lib/Footer";
|
|
27
27
|
import "webfontloader";
|
|
@@ -96,7 +96,7 @@ function Je({ mode: t }) {
|
|
|
96
96
|
}
|
|
97
97
|
return /* @__PURE__ */ e(Ze, { children: ({ state: n }) => /* @__PURE__ */ e(H, { mode: t, state: n }) });
|
|
98
98
|
}
|
|
99
|
-
const Ze = le(() => import("./draft-data-
|
|
99
|
+
const Ze = le(() => import("./draft-data-hSHLdxKp.js"));
|
|
100
100
|
function et({
|
|
101
101
|
mode: t,
|
|
102
102
|
children: n
|
|
@@ -423,7 +423,7 @@ function $({
|
|
|
423
423
|
!((I = l.footer) != null && I.hidden) && /* @__PURE__ */ e(We, {})
|
|
424
424
|
] });
|
|
425
425
|
}
|
|
426
|
-
const tt = le(() => import("./publish-button-
|
|
426
|
+
const tt = le(() => import("./publish-button-BftBlabj.js")), de = re(xe)`
|
|
427
427
|
&.sticky {
|
|
428
428
|
position: sticky;
|
|
429
429
|
top: 0;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as t, jsxs as f, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import { u as ce, c as de } from "./state-
|
|
2
|
+
import { u as ce, c as de } from "./state-D5BnGunt.js";
|
|
3
3
|
import { useLocaleContext as U } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import Q from "@arcblock/ux/lib/Toast";
|
|
5
5
|
import { generateParamCombinations as me } from "@blocklet/pages-kit/utils/route";
|
|
6
6
|
import { Warning as ue, Sync as te, VisibilityOff as ne, KeyboardArrowDown as pe, KeyboardArrowRight as he } from "@mui/icons-material";
|
|
7
7
|
import { LoadingButton as ie } from "@mui/lab";
|
|
8
|
-
import { createSvgIcon as ge, Dialog as fe, DialogTitle as ye, Box as S, IconButton as be, DialogContent as xe, DialogActions as we, Button as ke, Alert as Se, List as De, ListItem as W, ListItemButton as K, ListItemIcon as N, Checkbox as I, ListItemText as F, Tooltip as H, Collapse as
|
|
8
|
+
import { createSvgIcon as ge, Dialog as fe, DialogTitle as ye, Box as S, IconButton as be, DialogContent as xe, DialogActions as we, Button as ke, Alert as Se, List as De, ListItem as W, ListItemButton as K, ListItemIcon as N, Checkbox as I, ListItemText as F, Tooltip as H, Collapse as Ae, Chip as Pe } from "@mui/material";
|
|
9
9
|
import { produce as Oe } from "immer";
|
|
10
10
|
import ee from "lodash/difference";
|
|
11
|
-
import { useState as
|
|
11
|
+
import { useState as j, useMemo as R, useCallback as v, forwardRef as je, useImperativeHandle as ve, useEffect as $, useRef as Te } from "react";
|
|
12
12
|
import { useAsync as Re } from "react-use";
|
|
13
|
-
import { L as ze } from "./home-
|
|
14
|
-
import { p as Le, g as Be } from "./array-
|
|
13
|
+
import { L as ze } from "./home-CNk6U8FU.js";
|
|
14
|
+
import { p as Le, g as Be } from "./array-9j8tOSbO.js";
|
|
15
15
|
function Ee(s) {
|
|
16
|
-
const [y, w] =
|
|
16
|
+
const [y, w] = j(!1);
|
|
17
17
|
return /* @__PURE__ */ t(
|
|
18
18
|
ie,
|
|
19
19
|
{
|
|
@@ -55,9 +55,9 @@ const Ce = ge(
|
|
|
55
55
|
"Close"
|
|
56
56
|
);
|
|
57
57
|
function Me() {
|
|
58
|
-
const [s, y] =
|
|
58
|
+
const [s, y] = j(), w = R(() => s ? /* @__PURE__ */ t(fe, { ...s }) : null, [s]), l = v(() => {
|
|
59
59
|
y(void 0);
|
|
60
|
-
}, []), u =
|
|
60
|
+
}, []), u = v(
|
|
61
61
|
({
|
|
62
62
|
title: b,
|
|
63
63
|
content: c,
|
|
@@ -124,8 +124,8 @@ function Me() {
|
|
|
124
124
|
);
|
|
125
125
|
return { dialog: w, showDialog: u, closeDialog: l };
|
|
126
126
|
}
|
|
127
|
-
const _e =
|
|
128
|
-
const { t: l } = U(), [u, b] =
|
|
127
|
+
const _e = je(({ mode: s, state: y }, w) => {
|
|
128
|
+
const { t: l } = U(), [u, b] = j(!1), { dialog: c, showDialog: D } = Me(), h = ce(), g = v(
|
|
129
129
|
(z) => {
|
|
130
130
|
let k = [];
|
|
131
131
|
D({
|
|
@@ -162,10 +162,10 @@ const _e = Te(({ mode: s, state: y }, w) => {
|
|
|
162
162
|
},
|
|
163
163
|
[s, y, l, h, D]
|
|
164
164
|
);
|
|
165
|
-
|
|
165
|
+
ve(w, () => ({
|
|
166
166
|
openPublishDialog: g
|
|
167
167
|
}));
|
|
168
|
-
const a =
|
|
168
|
+
const a = v(() => {
|
|
169
169
|
g();
|
|
170
170
|
}, [g]);
|
|
171
171
|
return /* @__PURE__ */ f(le, { children: [
|
|
@@ -179,7 +179,7 @@ const _e = Te(({ mode: s, state: y }, w) => {
|
|
|
179
179
|
onClick: a,
|
|
180
180
|
loading: u,
|
|
181
181
|
disabled: u,
|
|
182
|
-
children: l("maker.
|
|
182
|
+
children: l("maker.publish")
|
|
183
183
|
}
|
|
184
184
|
),
|
|
185
185
|
c
|
|
@@ -238,18 +238,18 @@ function We({
|
|
|
238
238
|
onChange: w,
|
|
239
239
|
defaultRouteIds: l
|
|
240
240
|
}) {
|
|
241
|
-
const { t: u, locale: b } = U(), [c, D] =
|
|
241
|
+
const { t: u, locale: b } = U(), [c, D] = j(!1), [h, g] = j(
|
|
242
242
|
() => l ? Object.fromEntries(l.filter((e) => !e.includes("-")).map((e) => [e, !0])) : {}
|
|
243
|
-
), [a, z] =
|
|
243
|
+
), [a, z] = j({}), [k, x] = j(
|
|
244
244
|
() => l ? Object.fromEntries(l.filter((e) => e.includes("-")).map((e) => [e, !0])) : {}
|
|
245
|
-
), [L, J] =
|
|
245
|
+
), [L, J] = j({}), { loading: V, error: B, value: m } = Re(() => Be({ mode: y }), [y]);
|
|
246
246
|
if (B)
|
|
247
247
|
throw B;
|
|
248
|
-
const
|
|
248
|
+
const A = R(() => s.routeIds || [], [s]), q = R(() => (m == null ? void 0 : m.pageIds) || [], [m]), O = R(() => !A || !s.routes ? [] : JSON.parse(JSON.stringify(A)).sort((r, i) => {
|
|
249
249
|
var p, d;
|
|
250
250
|
const n = (p = s.routes) == null ? void 0 : p[r], o = (d = s.routes) == null ? void 0 : d[i];
|
|
251
251
|
return n != null && n.publishedAt && new Date(n.publishedAt).getTime() < new Date(n.updatedAt).getTime() ? -1 : o != null && o.publishedAt && new Date(o.publishedAt).getTime() < new Date(o.updatedAt).getTime() ? 1 : new Date((n == null ? void 0 : n.updatedAt) ?? "").getTime() - new Date((o == null ? void 0 : o.updatedAt) ?? "").getTime();
|
|
252
|
-
}), [s,
|
|
252
|
+
}), [s, A]), G = R(() => {
|
|
253
253
|
if (!O) return [];
|
|
254
254
|
if (!a) return O;
|
|
255
255
|
const e = [...O].filter((r) => !a[r]);
|
|
@@ -258,13 +258,13 @@ function We({
|
|
|
258
258
|
e.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`);
|
|
259
259
|
});
|
|
260
260
|
}), e;
|
|
261
|
-
}, [O, a]),
|
|
261
|
+
}, [O, a]), T = R(
|
|
262
262
|
() => !m || !q || !G ? [] : ee(q, G),
|
|
263
263
|
[G, m, q]
|
|
264
264
|
), E = R(
|
|
265
|
-
() =>
|
|
266
|
-
[
|
|
267
|
-
), X =
|
|
265
|
+
() => A ? [...A].concat(T) : T,
|
|
266
|
+
[A, T]
|
|
267
|
+
), X = v(() => {
|
|
268
268
|
const e = {};
|
|
269
269
|
O == null || O.forEach((r) => {
|
|
270
270
|
var n;
|
|
@@ -295,7 +295,7 @@ function We({
|
|
|
295
295
|
}), r;
|
|
296
296
|
});
|
|
297
297
|
}, [a]);
|
|
298
|
-
const Y =
|
|
298
|
+
const Y = Te(!0);
|
|
299
299
|
$(() => {
|
|
300
300
|
x((e) => {
|
|
301
301
|
const r = { ...e };
|
|
@@ -313,16 +313,16 @@ function We({
|
|
|
313
313
|
const n = { ...i };
|
|
314
314
|
return n[e] = !n[e], n;
|
|
315
315
|
});
|
|
316
|
-
}, Z =
|
|
316
|
+
}, Z = v(
|
|
317
317
|
(e) => {
|
|
318
318
|
g((r) => {
|
|
319
319
|
const i = Oe(r, (n) => {
|
|
320
|
-
c ? (Object.assign(n, Object.fromEntries(E.map((o) => [o, !0]))), delete n[e]) : n[e] ? (delete n[e],
|
|
320
|
+
c ? (Object.assign(n, Object.fromEntries(E.map((o) => [o, !0]))), delete n[e]) : n[e] ? (delete n[e], T.includes(e) && (A || []).filter((o) => {
|
|
321
321
|
var p, d;
|
|
322
322
|
return ((p = s.pages[o]) == null ? void 0 : p.slug) === ((d = m == null ? void 0 : m.pages[e]) == null ? void 0 : d.slug);
|
|
323
323
|
}).forEach((o) => {
|
|
324
324
|
delete n[o];
|
|
325
|
-
})) : (n[e] = !0,
|
|
325
|
+
})) : (n[e] = !0, A && A.includes(e) && T.filter((o) => {
|
|
326
326
|
var p, d;
|
|
327
327
|
return ((p = m == null ? void 0 : m.pages[o]) == null ? void 0 : p.slug) === ((d = s.pages[e]) == null ? void 0 : d.slug);
|
|
328
328
|
}).forEach((o) => {
|
|
@@ -332,28 +332,28 @@ function We({
|
|
|
332
332
|
return D(ee(E, Object.keys(i)).length === 0), i;
|
|
333
333
|
});
|
|
334
334
|
},
|
|
335
|
-
[c, E,
|
|
336
|
-
), se =
|
|
335
|
+
[c, E, T, s, m, A]
|
|
336
|
+
), se = v(
|
|
337
337
|
(e, r) => {
|
|
338
338
|
const i = `${e}-${r.paramOptionIds.join("-")}`;
|
|
339
339
|
x((n) => {
|
|
340
340
|
var d;
|
|
341
341
|
const o = { ...n };
|
|
342
342
|
o[i] = !o[i];
|
|
343
|
-
const p = ((d = a[e]) == null ? void 0 : d.every((
|
|
344
|
-
return g((
|
|
345
|
-
if (p && !
|
|
346
|
-
return { ...
|
|
347
|
-
if (!p &&
|
|
348
|
-
const C = { ...
|
|
343
|
+
const p = ((d = a[e]) == null ? void 0 : d.every((P) => o[`${e}-${P.paramOptionIds.join("-")}`])) ?? !1;
|
|
344
|
+
return g((P) => {
|
|
345
|
+
if (p && !P[e])
|
|
346
|
+
return { ...P, [e]: !0 };
|
|
347
|
+
if (!p && P[e]) {
|
|
348
|
+
const C = { ...P };
|
|
349
349
|
return delete C[e], C;
|
|
350
350
|
}
|
|
351
|
-
return
|
|
351
|
+
return P;
|
|
352
352
|
}), o;
|
|
353
353
|
});
|
|
354
354
|
},
|
|
355
355
|
[a]
|
|
356
|
-
), oe =
|
|
356
|
+
), oe = v(() => {
|
|
357
357
|
D((e) => (e && g({}), !e));
|
|
358
358
|
}, []);
|
|
359
359
|
return $(() => {
|
|
@@ -365,8 +365,8 @@ function We({
|
|
|
365
365
|
/* @__PURE__ */ t(F, { primary: u("common.all") })
|
|
366
366
|
] }) }),
|
|
367
367
|
O.map((e) => {
|
|
368
|
-
var
|
|
369
|
-
const r = (
|
|
368
|
+
var P, C;
|
|
369
|
+
const r = (P = s.routes) == null ? void 0 : P[e];
|
|
370
370
|
if (!r) return null;
|
|
371
371
|
const i = !1, n = a && a[e] && ((C = a[e]) == null ? void 0 : C.length) > 0, o = L[e] !== !1, p = a[e] || [], d = !r.publishedAt || r.updatedAt && new Date(r.updatedAt).getTime() > new Date(r.publishedAt).getTime();
|
|
372
372
|
return /* @__PURE__ */ f(S, { children: [
|
|
@@ -409,7 +409,7 @@ function We({
|
|
|
409
409
|
] })
|
|
410
410
|
}
|
|
411
411
|
),
|
|
412
|
-
n && /* @__PURE__ */ t(
|
|
412
|
+
n && /* @__PURE__ */ t(Ae, { in: o, children: /* @__PURE__ */ t(S, { children: p.map((M) => {
|
|
413
413
|
const _ = `${e}-${M.paramOptionIds.join("-")}`, ae = k[_] || !1;
|
|
414
414
|
return /* @__PURE__ */ t(
|
|
415
415
|
$e,
|
|
@@ -424,14 +424,14 @@ function We({
|
|
|
424
424
|
}) }) })
|
|
425
425
|
] }, e);
|
|
426
426
|
}),
|
|
427
|
-
|
|
427
|
+
T.map((e) => {
|
|
428
428
|
var i, n;
|
|
429
429
|
const r = m == null ? void 0 : m.pages[e];
|
|
430
430
|
return r ? /* @__PURE__ */ t(
|
|
431
431
|
W,
|
|
432
432
|
{
|
|
433
433
|
disablePadding: !0,
|
|
434
|
-
secondaryAction: /* @__PURE__ */ t(
|
|
434
|
+
secondaryAction: /* @__PURE__ */ t(Pe, { color: "warning", label: "deleted", size: "small" }),
|
|
435
435
|
children: /* @__PURE__ */ f(K, { onClick: () => Z(e), dense: !0, children: [
|
|
436
436
|
/* @__PURE__ */ t(N, { children: /* @__PURE__ */ t(I, { edge: "start", checked: c || !!h[e], tabIndex: -1 }) }),
|
|
437
437
|
/* @__PURE__ */ t(
|
|
@@ -8,24 +8,24 @@ import { useLocaleContext as Z } from "@arcblock/ux/lib/Locale/context";
|
|
|
8
8
|
import H, { getYjsDoc as ee } from "@syncedstore/core";
|
|
9
9
|
import { useSyncedStore as te } from "@syncedstore/react";
|
|
10
10
|
import { useLocalStorageState as ne } from "ahooks";
|
|
11
|
-
import { produce as
|
|
11
|
+
import { produce as v } from "immer";
|
|
12
12
|
import N from "lodash/debounce";
|
|
13
13
|
import { customAlphabet as oe } from "nanoid";
|
|
14
|
-
import { createContext as re, useState as E, useRef as se, useMemo as
|
|
14
|
+
import { createContext as re, useState as E, useRef as se, useMemo as g, useCallback as L, useEffect as O, useContext as ce } from "react";
|
|
15
15
|
import { useParams as ie, useNavigate as ae } from "react-router-dom";
|
|
16
16
|
import { IndexeddbPersistence as de } from "y-indexeddb";
|
|
17
17
|
import { WebsocketProvider as le } from "y-websocket";
|
|
18
18
|
import { UndoManager as ue } from "yjs";
|
|
19
19
|
import "@blocklet/pages-kit/types";
|
|
20
20
|
const Je = (n) => {
|
|
21
|
-
const t = blocklet == null ? void 0 : blocklet.componentMountPoints.find((
|
|
21
|
+
const t = blocklet == null ? void 0 : blocklet.componentMountPoints.find((d) => d.name === n);
|
|
22
22
|
return t ? t.mountPoint : "/";
|
|
23
23
|
};
|
|
24
24
|
function me() {
|
|
25
|
-
const { pathname: n } = window.location, t = n.match(/\/admin\/(maker|previewer)\/([^/]+)/),
|
|
26
|
-
if (!
|
|
25
|
+
const { pathname: n } = window.location, t = n.match(/\/admin\/(maker|previewer)\/([^/]+)/), d = t == null ? void 0 : t[2], f = window.__PROJECT_ID__;
|
|
26
|
+
if (!d && !f)
|
|
27
27
|
throw new Error("Unable to get projectId from pathname");
|
|
28
|
-
return
|
|
28
|
+
return d || f;
|
|
29
29
|
}
|
|
30
30
|
function Be(n) {
|
|
31
31
|
return `${n}:pages:version`;
|
|
@@ -46,9 +46,9 @@ function Ke(n) {
|
|
|
46
46
|
return n && !/^(https?:\/\/|\/)/.test(n) ? window.location.origin + b(_, "uploads", n) : n;
|
|
47
47
|
}
|
|
48
48
|
const pe = window.innerWidth <= 750;
|
|
49
|
-
function qe(n, t,
|
|
49
|
+
function qe(n, t, d) {
|
|
50
50
|
if (!n || /\.gif/.test(n)) return n;
|
|
51
|
-
const f = (pe ? t / 1.5 : t) * (
|
|
51
|
+
const f = (pe ? t / 1.5 : t) * (d === "quality" ? 1.5 : 1);
|
|
52
52
|
return we(n, { imageFilter: "resize", w: f, f: "webp" });
|
|
53
53
|
}
|
|
54
54
|
function we(n, t) {
|
|
@@ -60,19 +60,19 @@ async function Pe(n) {
|
|
|
60
60
|
async function Ie(n) {
|
|
61
61
|
return J.post(`/api/projects/${n.id}/update`, n).then((t) => t.data);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const ye = 500, A = oe("abcdefghijklmnopqrstuvwxyz0123456789", 16), B = re(null);
|
|
64
64
|
function Qe({
|
|
65
65
|
url: n,
|
|
66
66
|
name: t,
|
|
67
|
-
children:
|
|
67
|
+
children: d,
|
|
68
68
|
waitingSynced: f
|
|
69
69
|
}) {
|
|
70
|
-
const [I, w] = E(!1), { locale:
|
|
70
|
+
const [I, w] = E(!1), { locale: y } = Z(), S = V(), e = `${S}:MakerLocalState`, o = `${S}:${t}`, [s, r] = ne(e, {
|
|
71
71
|
defaultValue: {},
|
|
72
72
|
listenStorageChange: !0
|
|
73
73
|
}), c = se(s);
|
|
74
74
|
c.current = s;
|
|
75
|
-
const i =
|
|
75
|
+
const i = g(
|
|
76
76
|
() => H({
|
|
77
77
|
dataSourceIds: [],
|
|
78
78
|
dataSources: {},
|
|
@@ -86,22 +86,31 @@ function Qe({
|
|
|
86
86
|
resources: {}
|
|
87
87
|
}),
|
|
88
88
|
[]
|
|
89
|
-
),
|
|
90
|
-
|
|
91
|
-
const p =
|
|
92
|
-
() => new le(n, o,
|
|
89
|
+
), a = g(() => ee(i), [i]);
|
|
90
|
+
g(() => new de(o, a), [o, a]);
|
|
91
|
+
const p = g(
|
|
92
|
+
() => new le(n, o, a, {
|
|
93
93
|
params: {},
|
|
94
94
|
resyncInterval: 5 * 60 * 1e3
|
|
95
95
|
}),
|
|
96
|
-
[n, o,
|
|
97
|
-
),
|
|
96
|
+
[n, o, a]
|
|
97
|
+
), C = L(() => {
|
|
98
98
|
p && (p.disconnect(), p.connect());
|
|
99
|
-
}, [p]),
|
|
99
|
+
}, [p]), h = g(
|
|
100
100
|
() => new ue(
|
|
101
|
-
[
|
|
102
|
-
|
|
101
|
+
[
|
|
102
|
+
a.getArray("pageIds"),
|
|
103
|
+
a.getMap("pages"),
|
|
104
|
+
a.getArray("supportedLocales"),
|
|
105
|
+
a.getMap("config"),
|
|
106
|
+
a.getMap("dataSources"),
|
|
107
|
+
a.getArray("dataSourceIds"),
|
|
108
|
+
a.getArray("routeIds"),
|
|
109
|
+
a.getMap("routes")
|
|
110
|
+
],
|
|
111
|
+
{ doc: a }
|
|
103
112
|
),
|
|
104
|
-
[
|
|
113
|
+
[a]
|
|
105
114
|
), [j, x] = E(null), [R, D] = E(!1), [$, T] = E(void 0), G = L(async () => {
|
|
106
115
|
if (S) {
|
|
107
116
|
D(!0);
|
|
@@ -137,50 +146,50 @@ function Qe({
|
|
|
137
146
|
O(() => {
|
|
138
147
|
S && G();
|
|
139
148
|
}, [S, G]);
|
|
140
|
-
const W =
|
|
149
|
+
const W = g(
|
|
141
150
|
() => ({
|
|
142
|
-
doc:
|
|
151
|
+
doc: a,
|
|
143
152
|
state: i,
|
|
144
153
|
localState: {
|
|
145
154
|
...s,
|
|
146
155
|
// always use the locale from the context
|
|
147
|
-
currentLocale:
|
|
156
|
+
currentLocale: y
|
|
148
157
|
},
|
|
149
158
|
setLocalState: (l) => r(typeof l == "function" ? (u) => l(u ?? {}) : l),
|
|
150
|
-
undoManager:
|
|
159
|
+
undoManager: h,
|
|
151
160
|
projectState: {
|
|
152
161
|
project: j,
|
|
153
162
|
isLoadingProject: R,
|
|
154
163
|
error: $
|
|
155
164
|
},
|
|
156
165
|
updateProject: M,
|
|
157
|
-
forceSync:
|
|
166
|
+
forceSync: C
|
|
158
167
|
}),
|
|
159
168
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
169
|
[
|
|
161
|
-
|
|
170
|
+
a,
|
|
162
171
|
i,
|
|
163
172
|
JSON.stringify(s),
|
|
164
173
|
// resolve the problem of react warning
|
|
165
174
|
r,
|
|
166
|
-
|
|
175
|
+
h,
|
|
167
176
|
j,
|
|
168
177
|
R,
|
|
169
178
|
M,
|
|
170
179
|
$,
|
|
171
|
-
|
|
172
|
-
|
|
180
|
+
y,
|
|
181
|
+
C
|
|
173
182
|
]
|
|
174
183
|
);
|
|
175
184
|
return O(() => {
|
|
176
|
-
|
|
185
|
+
h.on("stack-item-added", ({ stackItem: l }) => {
|
|
177
186
|
const { currentPageId: u, currentLocale: P, pages: m } = c.current;
|
|
178
187
|
l.meta.set("localState", { currentPageId: u, currentLocale: P, pages: m });
|
|
179
|
-
}),
|
|
188
|
+
}), h.on("stack-item-popped", ({ stackItem: l }) => {
|
|
180
189
|
const u = l.meta.get("localState");
|
|
181
190
|
u && r((P) => ({ ...P, ...u }));
|
|
182
191
|
});
|
|
183
|
-
}, [
|
|
192
|
+
}, [h, r]), O(() => {
|
|
184
193
|
p.awareness.setLocalState(s);
|
|
185
194
|
}, [p, s]), O(() => {
|
|
186
195
|
p.once("synced", () => w(!0));
|
|
@@ -196,45 +205,45 @@ function Qe({
|
|
|
196
205
|
}));
|
|
197
206
|
}, P = N(({ status: m }) => {
|
|
198
207
|
m === "connected" ? l() : m === "disconnected" && u();
|
|
199
|
-
},
|
|
208
|
+
}, ye);
|
|
200
209
|
return p.on("status", P), window.addEventListener("online", l), window.addEventListener("offline", u), () => {
|
|
201
210
|
p.off("status", P), window.removeEventListener("online", l), window.removeEventListener("offline", u);
|
|
202
211
|
};
|
|
203
|
-
}, [p, r]), f && !I ? null : /* @__PURE__ */ k(B.Provider, { value: W, children:
|
|
212
|
+
}, [p, r]), f && !I ? null : /* @__PURE__ */ k(B.Provider, { value: W, children: d });
|
|
204
213
|
}
|
|
205
|
-
const
|
|
214
|
+
const he = () => {
|
|
206
215
|
const n = ce(B);
|
|
207
216
|
if (!n)
|
|
208
217
|
throw new Error("Context is null");
|
|
209
|
-
const t = te(n.state), { setLocalState:
|
|
218
|
+
const t = te(n.state), { setLocalState: d, localState: f } = n, I = ae(), w = V(), y = g(
|
|
210
219
|
() => ({
|
|
211
220
|
setCurrentSectionId: (e, o) => {
|
|
212
221
|
var s, r;
|
|
213
|
-
e === f.currentPageId && o === ((r = (s = f.pages) == null ? void 0 : s[e]) == null ? void 0 : r.currentSectionId) || (I(b("/admin/maker", w ?? "", "pages", e)),
|
|
214
|
-
(c) =>
|
|
215
|
-
var
|
|
216
|
-
i.currentPageId = e, i.currentComponentId = void 0, i.customComponentPreviewerProperties = {}, o !== void 0 && (i.pages ?? (i.pages = {}), (
|
|
222
|
+
e === f.currentPageId && o === ((r = (s = f.pages) == null ? void 0 : s[e]) == null ? void 0 : r.currentSectionId) || (I(b("/admin/maker", w ?? "", "pages", e)), d(
|
|
223
|
+
(c) => v(c, (i) => {
|
|
224
|
+
var a;
|
|
225
|
+
i.currentPageId = e, i.currentComponentId = void 0, i.customComponentPreviewerProperties = {}, o !== void 0 && (i.pages ?? (i.pages = {}), (a = i.pages)[e] ?? (a[e] = {}), i.pages[e].currentSectionId = o ?? void 0), o ? window.sessionStorage.setItem("iframe_show_id", `"${o}"`) : window.sessionStorage.removeItem("iframe_show_id");
|
|
217
226
|
})
|
|
218
227
|
));
|
|
219
228
|
},
|
|
220
229
|
setCurrentComponentId: (e) => {
|
|
221
|
-
e !== f.currentComponentId && (I(b("/admin/maker", w ?? "", "components", e)),
|
|
222
|
-
(o) =>
|
|
230
|
+
e !== f.currentComponentId && (I(b("/admin/maker", w ?? "", "components", e)), d(
|
|
231
|
+
(o) => v(o, (s) => {
|
|
223
232
|
s.currentComponentId = e, s.customComponentPreviewerProperties = {};
|
|
224
233
|
})
|
|
225
234
|
));
|
|
226
235
|
},
|
|
227
236
|
setCurrentRouteId: ({ routeId: e, dynamicParams: o }) => {
|
|
228
|
-
|
|
229
|
-
(s) =>
|
|
237
|
+
d(
|
|
238
|
+
(s) => v(s, (r) => {
|
|
230
239
|
r.currentRouteId = e, r.currentDynamicParams = o;
|
|
231
240
|
})
|
|
232
241
|
);
|
|
233
242
|
},
|
|
234
243
|
setCustomComponentPreviewerProperties: (() => {
|
|
235
244
|
const e = {}, o = N(() => {
|
|
236
|
-
|
|
237
|
-
(s) =>
|
|
245
|
+
d(
|
|
246
|
+
(s) => v(s, (r) => {
|
|
238
247
|
r.customComponentPreviewerProperties = {
|
|
239
248
|
...r == null ? void 0 : r.customComponentPreviewerProperties,
|
|
240
249
|
...e
|
|
@@ -247,8 +256,8 @@ const ye = () => {
|
|
|
247
256
|
};
|
|
248
257
|
})(),
|
|
249
258
|
setRouteGenerateProcess: (e) => {
|
|
250
|
-
|
|
251
|
-
(o) =>
|
|
259
|
+
d(
|
|
260
|
+
(o) => v(o, (s) => {
|
|
252
261
|
e ? s.routeGenerateProcess = {
|
|
253
262
|
...s.routeGenerateProcess,
|
|
254
263
|
...e
|
|
@@ -257,8 +266,8 @@ const ye = () => {
|
|
|
257
266
|
);
|
|
258
267
|
},
|
|
259
268
|
resetRouteGenerateProcess: () => {
|
|
260
|
-
|
|
261
|
-
(e) =>
|
|
269
|
+
d(
|
|
270
|
+
(e) => v(e, (o) => {
|
|
262
271
|
o.routeGenerateProcess = {
|
|
263
272
|
progress: "complete"
|
|
264
273
|
};
|
|
@@ -266,11 +275,11 @@ const ye = () => {
|
|
|
266
275
|
);
|
|
267
276
|
}
|
|
268
277
|
}),
|
|
269
|
-
[
|
|
270
|
-
), S =
|
|
278
|
+
[d, I, w]
|
|
279
|
+
), S = g(
|
|
271
280
|
() => ({
|
|
272
281
|
addPage: (e, o) => {
|
|
273
|
-
var c, i,
|
|
282
|
+
var c, i, a, p, C, h;
|
|
274
283
|
const s = (e == null ? void 0 : e.id) ?? A(), r = {
|
|
275
284
|
...e,
|
|
276
285
|
id: s,
|
|
@@ -284,10 +293,10 @@ const ye = () => {
|
|
|
284
293
|
templateConfig: (e == null ? void 0 : e.templateConfig) ?? {
|
|
285
294
|
isTemplate: ((c = e == null ? void 0 : e.templateConfig) == null ? void 0 : c.isTemplate) ?? !0,
|
|
286
295
|
displayTemplateId: ((i = e == null ? void 0 : e.templateConfig) == null ? void 0 : i.displayTemplateId) ?? void 0,
|
|
287
|
-
dataSourceIds: ((
|
|
296
|
+
dataSourceIds: ((a = e == null ? void 0 : e.templateConfig) == null ? void 0 : a.dataSourceIds) ?? void 0,
|
|
288
297
|
dataSourceParameters: ((p = e == null ? void 0 : e.templateConfig) == null ? void 0 : p.dataSourceParameters) ?? {},
|
|
289
|
-
enabledGenerate: ((
|
|
290
|
-
agentId: ((
|
|
298
|
+
enabledGenerate: ((C = e == null ? void 0 : e.templateConfig) == null ? void 0 : C.enabledGenerate) ?? !1,
|
|
299
|
+
agentId: ((h = e == null ? void 0 : e.templateConfig) == null ? void 0 : h.agentId) ?? void 0
|
|
291
300
|
}
|
|
292
301
|
};
|
|
293
302
|
return n.doc.transact(() => {
|
|
@@ -393,7 +402,7 @@ const ye = () => {
|
|
|
393
402
|
...n,
|
|
394
403
|
state: t,
|
|
395
404
|
actions: S,
|
|
396
|
-
localActions:
|
|
405
|
+
localActions: y,
|
|
397
406
|
get currentPage() {
|
|
398
407
|
const {
|
|
399
408
|
localState: { currentPageId: e }
|
|
@@ -423,50 +432,50 @@ const ye = () => {
|
|
|
423
432
|
const { projectId: n } = ie();
|
|
424
433
|
return n ?? me() ?? "";
|
|
425
434
|
}, Xe = () => window.__PROJECT_SLUG__ ?? "";
|
|
426
|
-
function
|
|
435
|
+
function ge(n) {
|
|
427
436
|
var f, I;
|
|
428
437
|
const { resources: t } = n;
|
|
429
438
|
if (!t.components)
|
|
430
439
|
return {};
|
|
431
|
-
const
|
|
440
|
+
const d = {};
|
|
432
441
|
return (I = (f = window == null ? void 0 : window.blocklet) == null ? void 0 : f.componentMountPoints) == null || I.forEach((w) => {
|
|
433
|
-
|
|
442
|
+
d[w.did] = w;
|
|
434
443
|
}), Object.fromEntries(
|
|
435
|
-
Object.entries(t.components).map(([w, { blockletId:
|
|
444
|
+
Object.entries(t.components).map(([w, { blockletId: y, component: S }]) => {
|
|
436
445
|
var e;
|
|
437
446
|
return [
|
|
438
447
|
w,
|
|
439
|
-
{ data: S, blockletId:
|
|
448
|
+
{ data: S, blockletId: y, blockletTitle: ((e = d[y]) == null ? void 0 : e.title) || y }
|
|
440
449
|
];
|
|
441
450
|
})
|
|
442
451
|
);
|
|
443
452
|
}
|
|
444
|
-
function
|
|
453
|
+
function ve(n) {
|
|
445
454
|
const { components: t } = n;
|
|
446
455
|
return t || {};
|
|
447
456
|
}
|
|
448
|
-
function
|
|
457
|
+
function Ce(n) {
|
|
449
458
|
return {
|
|
450
|
-
...
|
|
451
|
-
...
|
|
459
|
+
...ge(n),
|
|
460
|
+
...ve(n)
|
|
452
461
|
};
|
|
453
462
|
}
|
|
454
|
-
const Ye = () =>
|
|
463
|
+
const Ye = () => Ce(he().state);
|
|
455
464
|
export {
|
|
456
465
|
We as E,
|
|
457
466
|
Qe as S,
|
|
458
467
|
ze as a,
|
|
459
|
-
|
|
468
|
+
he as b,
|
|
460
469
|
Be as c,
|
|
461
|
-
|
|
470
|
+
Ce as d,
|
|
462
471
|
Xe as e,
|
|
463
472
|
qe as f,
|
|
464
473
|
Ke as g,
|
|
465
474
|
Ye as h,
|
|
466
475
|
J as i,
|
|
467
476
|
Je as j,
|
|
468
|
-
|
|
469
|
-
|
|
477
|
+
ve as k,
|
|
478
|
+
ge as l,
|
|
470
479
|
me as m,
|
|
471
480
|
A as n,
|
|
472
481
|
Ve as t,
|