@blocklet/pages-kit-inner-components 0.5.21 → 0.5.23
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 +9 -9
- package/lib/cjs/chunks/home-5a40bAJ6.js +38 -0
- package/lib/cjs/chunks/{publish-button-Cw_MfRfv.js → publish-button-DUYSuenR.js} +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/setting.js +2 -2
- package/lib/es/add-component.js +4 -4
- package/lib/es/chunks/{home-BjT8iYTg.js → home-BB778Odl.js} +174 -171
- package/lib/es/chunks/{publish-button-eIyM_BsP.js → publish-button-BJSEYd0m.js} +1 -1
- package/lib/es/home.js +1 -1
- package/lib/es/setting.js +46 -46
- package/package.json +8 -8
- package/lib/cjs/chunks/home-DH9Z8Tuv.js +0 -38
package/lib/es/setting.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx as t, jsxs as O, Fragment as X } from "react/jsx-runtime";
|
|
2
|
-
import { t as
|
|
2
|
+
import { t as ve, g as Te, b as ce, E as ot, n as Ke, f as xe } from "./chunks/state-j8jViBMV.js";
|
|
3
3
|
import de from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useLocaleContext as C } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
-
import { CodeEditor as
|
|
5
|
+
import { CodeEditor as ge } from "@blocklet/code-editor";
|
|
6
6
|
import nt from "@mui/icons-material/AddRounded";
|
|
7
7
|
import st from "@mui/icons-material/ArrowDownward";
|
|
8
8
|
import ct from "@mui/icons-material/ArrowUpward";
|
|
9
9
|
import dt from "@mui/icons-material/DeleteOutline";
|
|
10
|
-
import { Typography as B, TextField as V, Stack as R, FormLabel as ie, Box as j, TableContainer as at, Paper as Z, Table as Be, TableHead as Fe, TableRow as le, TableCell as oe, TableBody as Je, Button as E, IconButton as ae, InputAdornment as
|
|
10
|
+
import { Typography as B, TextField as V, Stack as R, FormLabel as ie, Box as j, TableContainer as at, Paper as Z, Table as Be, TableHead as Fe, TableRow as le, TableCell as oe, TableBody as Je, Button as E, IconButton as ae, InputAdornment as Pe, alpha as pe, Tooltip as G, buttonClasses as ut, Dialog as Me, Autocomplete as $e, FormControlLabel as pt, Switch as mt, MenuItem as me, DialogTitle as ft, DialogContent as ht, DialogActions as bt, Collapse as yt, Divider as vt, Popper as xt } from "@mui/material";
|
|
11
11
|
import A from "lodash/sortBy";
|
|
12
12
|
import { useCallback as D, useMemo as ne, useRef as J, useId as gt, useEffect as $, useState as Q } from "react";
|
|
13
13
|
import { useUpdate as _e } from "react-use";
|
|
14
14
|
import { ColorItem as Pt, ConfigColorDialog as wt } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
15
|
import { C as kt } from "./chunks/config-string-D8tamRZ1.js";
|
|
16
|
-
import
|
|
16
|
+
import we from "lodash/isEmpty";
|
|
17
17
|
import He from "lodash/set";
|
|
18
|
-
import * as
|
|
19
|
-
import { UploaderButton as Ye, UploaderProvider as
|
|
18
|
+
import * as fe from "yaml";
|
|
19
|
+
import { UploaderButton as Ye, UploaderProvider as ue, useUploader as It, getImageSize as St, getVideoSize as Ot } from "@blocklet/pages-kit/builtin/uploader";
|
|
20
20
|
import jt from "lodash/cloneDeep";
|
|
21
|
-
import
|
|
21
|
+
import he from "@arcblock/ux/lib/Toast";
|
|
22
22
|
import { CustomComponentRenderer as qe, transpileAndLoadScript as Rt, getPropertiesFromCode as zt } from "@blocklet/pages-kit/components";
|
|
23
23
|
import { parsePropertyValue as Nt } from "@blocklet/pages-kit/utils/property";
|
|
24
24
|
import { unstable_useNumberInput as Vt, ClickAwayListener as Ct } from "@mui/base";
|
|
@@ -76,7 +76,7 @@ function rr({
|
|
|
76
76
|
}) {
|
|
77
77
|
const { t: b, locale: k } = C(), v = _e(), o = D(
|
|
78
78
|
(p) => {
|
|
79
|
-
i(
|
|
79
|
+
i(ve(p, a.type));
|
|
80
80
|
},
|
|
81
81
|
[i, a.type]
|
|
82
82
|
), n = ne(() => Array.isArray(r) ? r : [], [r]), s = D(() => {
|
|
@@ -284,7 +284,7 @@ function rr({
|
|
|
284
284
|
] }) : /* @__PURE__ */ O(R, { width: "100%", gap: 1, children: [
|
|
285
285
|
e && /* @__PURE__ */ t(ie, { children: e }),
|
|
286
286
|
/* @__PURE__ */ t(j, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ t(
|
|
287
|
-
|
|
287
|
+
ge,
|
|
288
288
|
{
|
|
289
289
|
keyId: a.id,
|
|
290
290
|
locale: k,
|
|
@@ -314,7 +314,7 @@ function ir({
|
|
|
314
314
|
value: e,
|
|
315
315
|
onChange: r,
|
|
316
316
|
InputProps: {
|
|
317
|
-
endAdornment: /* @__PURE__ */ t(
|
|
317
|
+
endAdornment: /* @__PURE__ */ t(Pe, { position: "end", children: /* @__PURE__ */ t(
|
|
318
318
|
Pt,
|
|
319
319
|
{
|
|
320
320
|
color: e ?? "",
|
|
@@ -351,7 +351,7 @@ function lr({
|
|
|
351
351
|
onUpload: g
|
|
352
352
|
}) {
|
|
353
353
|
const { locale: b } = C(), k = J(null);
|
|
354
|
-
if (!
|
|
354
|
+
if (!we(l.subProperties)) {
|
|
355
355
|
const o = A(Object.values(l.subProperties || {}), "index").filter(
|
|
356
356
|
(n) => n.data.visible !== !1 && n.data.key
|
|
357
357
|
);
|
|
@@ -361,7 +361,7 @@ function lr({
|
|
|
361
361
|
const { data: d } = n, m = d.key ?? d.id, w = s === o.length - 1;
|
|
362
362
|
let c = null;
|
|
363
363
|
try {
|
|
364
|
-
r && typeof r == "object" ? c = r[m] : typeof r == "string" && (c = (l.type === "yaml" ?
|
|
364
|
+
r && typeof r == "object" ? c = r[m] : typeof r == "string" && (c = (l.type === "yaml" ? fe.parse(r || "") : JSON.parse(r || "{}"))[m]);
|
|
365
365
|
} catch {
|
|
366
366
|
}
|
|
367
367
|
c == null && (d.locales && b && d.locales[b] ? c = d.locales[b].defaultValue : d.locales && y && d.locales[y] && (c = d.locales[y].defaultValue));
|
|
@@ -370,12 +370,12 @@ function lr({
|
|
|
370
370
|
let S = {};
|
|
371
371
|
if (typeof r == "string")
|
|
372
372
|
try {
|
|
373
|
-
S = l.type === "yaml" ?
|
|
373
|
+
S = l.type === "yaml" ? fe.parse(r || "") : JSON.parse(r || "{}");
|
|
374
374
|
} catch {
|
|
375
375
|
}
|
|
376
376
|
else typeof r == "object" && r !== null && (S = { ...r });
|
|
377
377
|
He(S, m, P);
|
|
378
|
-
const p =
|
|
378
|
+
const p = ve(S, l.type);
|
|
379
379
|
i == null || i(p);
|
|
380
380
|
} catch (S) {
|
|
381
381
|
console.error("Error updating property:", S);
|
|
@@ -495,7 +495,7 @@ function lr({
|
|
|
495
495
|
}
|
|
496
496
|
),
|
|
497
497
|
/* @__PURE__ */ t(
|
|
498
|
-
|
|
498
|
+
ge,
|
|
499
499
|
{
|
|
500
500
|
keyId: l.id,
|
|
501
501
|
locale: b,
|
|
@@ -538,7 +538,7 @@ function lr({
|
|
|
538
538
|
}
|
|
539
539
|
) });
|
|
540
540
|
}
|
|
541
|
-
const or = ["string", "multiline", "json", "yaml", "url", "component", "custom"];
|
|
541
|
+
const or = ["string", "multiline", "json", "yaml", "url", "component", "custom", "array"];
|
|
542
542
|
function Ue(e) {
|
|
543
543
|
return e.type ? !or.includes(e.type) : !1;
|
|
544
544
|
}
|
|
@@ -690,7 +690,7 @@ function sr({
|
|
|
690
690
|
{
|
|
691
691
|
direction: "row",
|
|
692
692
|
sx: {
|
|
693
|
-
bgcolor: (o) =>
|
|
693
|
+
bgcolor: (o) => pe(o.palette.grey[200], 0.9),
|
|
694
694
|
borderRadius: 1,
|
|
695
695
|
p: 0.5,
|
|
696
696
|
[`.${ut.root}`]: {
|
|
@@ -758,10 +758,10 @@ function cr({
|
|
|
758
758
|
/* @__PURE__ */ t(Me, { open: l, onClose: () => u(!1), children: /* @__PURE__ */ t(j, { component: "img", sx: { objectFit: "contain" }, src: Te(r), alt: e }) })
|
|
759
759
|
] });
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function be(e, r = "") {
|
|
762
762
|
return qt(e, (i, l, u) => {
|
|
763
763
|
const y = r ? `${r}.${u}` : u;
|
|
764
|
-
return $t(l) ? Bt(i,
|
|
764
|
+
return $t(l) ? Bt(i, be(l, y)) : i[y] = l, i;
|
|
765
765
|
}, {});
|
|
766
766
|
}
|
|
767
767
|
const dr = [
|
|
@@ -781,7 +781,7 @@ const dr = [
|
|
|
781
781
|
function re(e, r, i) {
|
|
782
782
|
return !e || !i ? !1 : Object.values(e).some(({ data: l }) => l.id !== r && l.key === i);
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function ye(e, r) {
|
|
785
785
|
var i;
|
|
786
786
|
return !e || !r ? !1 : ((i = e[r]) == null ? void 0 : i.data.visible) ?? !0;
|
|
787
787
|
}
|
|
@@ -791,7 +791,7 @@ function ci({ componentId: e }) {
|
|
|
791
791
|
}
|
|
792
792
|
function ar({ value: e }) {
|
|
793
793
|
var b, k, v;
|
|
794
|
-
const { t: r } = C(), { localState: { currentLocale: i, customComponentPreviewerProperties: l }, state: { config: { defaultLocale: u } }, localActions: { setCustomComponentPreviewerProperties: y } } = ce(), a = ee(e).doc, x =
|
|
794
|
+
const { t: r } = C(), { localState: { currentLocale: i, customComponentPreviewerProperties: l }, state: { config: { defaultLocale: u } }, localActions: { setCustomComponentPreviewerProperties: y } } = ce(), a = ee(e).doc, x = xe(), g = Kt({
|
|
795
795
|
propertiesValue: {
|
|
796
796
|
...y
|
|
797
797
|
}
|
|
@@ -838,8 +838,8 @@ function ar({ value: e }) {
|
|
|
838
838
|
});
|
|
839
839
|
},
|
|
840
840
|
children: [
|
|
841
|
-
/* @__PURE__ */ t(
|
|
842
|
-
/* @__PURE__ */ t(
|
|
841
|
+
/* @__PURE__ */ t(me, { value: "react-component", children: "React Component" }),
|
|
842
|
+
/* @__PURE__ */ t(me, { value: "component", children: "Custom Component" })
|
|
843
843
|
]
|
|
844
844
|
})
|
|
845
845
|
] }),
|
|
@@ -854,7 +854,7 @@ function ar({ value: e }) {
|
|
|
854
854
|
onChange: ({ value: o, id: n, path: s }) => {
|
|
855
855
|
const d = [...s, "data"];
|
|
856
856
|
if (!Ft(e, d)) {
|
|
857
|
-
|
|
857
|
+
he.warning(r("cannotFindPropertyKey", {
|
|
858
858
|
key: d.join(".")
|
|
859
859
|
}));
|
|
860
860
|
return;
|
|
@@ -868,7 +868,7 @@ function ar({ value: e }) {
|
|
|
868
868
|
}
|
|
869
869
|
function ur({ config: e }) {
|
|
870
870
|
const { t: r } = C();
|
|
871
|
-
return /* @__PURE__ */ t(
|
|
871
|
+
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
872
872
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: r("basicInfo") }),
|
|
873
873
|
/* @__PURE__ */ t(V, {
|
|
874
874
|
label: r("name"),
|
|
@@ -954,7 +954,7 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defau
|
|
|
954
954
|
});
|
|
955
955
|
},
|
|
956
956
|
InputProps: {
|
|
957
|
-
endAdornment: !e.key || e.key && re(l.properties, e.id, e.key) ? /* @__PURE__ */ t(
|
|
957
|
+
endAdornment: !e.key || e.key && re(l.properties, e.id, e.key) ? /* @__PURE__ */ t(Pe, {
|
|
958
958
|
position: "end",
|
|
959
959
|
sx: {
|
|
960
960
|
width: 16,
|
|
@@ -999,7 +999,7 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defau
|
|
|
999
999
|
h === "multiline" ? (c.type = "string", c.multiline = !0) : (typeof c.multiline < "u" && delete c.multiline, c.type = h);
|
|
1000
1000
|
});
|
|
1001
1001
|
},
|
|
1002
|
-
children: dr.map((m) => /* @__PURE__ */ t(
|
|
1002
|
+
children: dr.map((m) => /* @__PURE__ */ t(me, { value: m.value, children: m.label }, m.value))
|
|
1003
1003
|
})
|
|
1004
1004
|
] }),
|
|
1005
1005
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, children: [
|
|
@@ -1017,7 +1017,7 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defau
|
|
|
1017
1017
|
var f;
|
|
1018
1018
|
const h = c.properties[e.id].data;
|
|
1019
1019
|
if (w != null && w.forceUpdateProperty) {
|
|
1020
|
-
const P =
|
|
1020
|
+
const P = be(h), S = be(m);
|
|
1021
1021
|
Object.keys(S).forEach((p) => {
|
|
1022
1022
|
P[p] || He(h, p, S[p]);
|
|
1023
1023
|
});
|
|
@@ -1047,7 +1047,7 @@ function pr(e, r) {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, onUpdateConfig: u, useI18nEditor: y = !0 }) {
|
|
1049
1049
|
const { t: a } = C(), x = ke({ variant: "dialog" }), g = e.properties && A(Object.values(e.properties), "index");
|
|
1050
|
-
return /* @__PURE__ */ t(
|
|
1050
|
+
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
1051
1051
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
1052
1052
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: a("properties") }),
|
|
1053
1053
|
/* @__PURE__ */ t(j, { flex: 1 }),
|
|
@@ -1058,7 +1058,7 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
|
|
|
1058
1058
|
gap: 2,
|
|
1059
1059
|
list: e.properties,
|
|
1060
1060
|
renderItem: (b, k, v) => {
|
|
1061
|
-
const o =
|
|
1061
|
+
const o = ye(e.properties, b.id);
|
|
1062
1062
|
return /* @__PURE__ */ t(Z, {
|
|
1063
1063
|
elevation: 0,
|
|
1064
1064
|
className: "property-container",
|
|
@@ -1150,7 +1150,7 @@ function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allCom
|
|
|
1150
1150
|
}
|
|
1151
1151
|
function it({ type: e = "properties", component: r, ...i }) {
|
|
1152
1152
|
var v, o, n;
|
|
1153
|
-
const { t: l } = C(), { state: { components: u, supportedLocales: y, config: { defaultLocale: a } } } = ce(), x =
|
|
1153
|
+
const { t: l } = C(), { state: { components: u, supportedLocales: y, config: { defaultLocale: a } } } = ce(), x = xe(), g = ee(r).doc, b = e === "properties" ? r.properties : e === "parameters" && ((v = r.renderer) == null ? void 0 : v.type) === "component" ? (o = u[r.renderer.componentId]) == null ? void 0 : o.data.properties : void 0, k = ((n = r.renderer) == null ? void 0 : n.type) === "component" ? r : void 0;
|
|
1154
1154
|
return /* @__PURE__ */ O(Me, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
1155
1155
|
/* @__PURE__ */ t(ft, { children: l("i18nEditorTitle") }),
|
|
1156
1156
|
/* @__PURE__ */ t(ht, { children: b && /* @__PURE__ */ t(R, { children: /* @__PURE__ */ O(Be, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
@@ -1230,7 +1230,7 @@ const We = (e, r) => (i) => {
|
|
|
1230
1230
|
i.palette.secondary.main,
|
|
1231
1231
|
i.palette.success.main,
|
|
1232
1232
|
i.palette.warning.main
|
|
1233
|
-
], u = Math.min(l.length - 1, e), y = l[u], a =
|
|
1233
|
+
], u = Math.min(l.length - 1, e), y = l[u], a = pe(y, 0.5), x = pe(y, 1);
|
|
1234
1234
|
return {
|
|
1235
1235
|
// 保留原有的边框样式
|
|
1236
1236
|
borderColor: `${a} !important`,
|
|
@@ -1258,13 +1258,13 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1258
1258
|
n = n === !0 || n === "true";
|
|
1259
1259
|
else if ((o.type === "json" || o.type === "yaml") && typeof n == "string")
|
|
1260
1260
|
try {
|
|
1261
|
-
o.type === "json" ? n = JSON.parse(n) : n =
|
|
1261
|
+
o.type === "json" ? n = JSON.parse(n) : n = fe.parse(n);
|
|
1262
1262
|
} catch (c) {
|
|
1263
1263
|
console.error("Error parsing nested value", n, c), n = {};
|
|
1264
1264
|
}
|
|
1265
1265
|
b[o.key] = n;
|
|
1266
|
-
}), e.type === "array" && !Array.isArray(b) && (b =
|
|
1267
|
-
const v =
|
|
1266
|
+
}), e.type === "array" && !Array.isArray(b) && (b = we(b) ? [] : [b]);
|
|
1267
|
+
const v = ve(b, e.type);
|
|
1268
1268
|
r == null || r(v);
|
|
1269
1269
|
} catch (b) {
|
|
1270
1270
|
console.error("Error converting structure to text:", b);
|
|
@@ -1474,7 +1474,7 @@ function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1474
1474
|
sx: {
|
|
1475
1475
|
pr: 0
|
|
1476
1476
|
},
|
|
1477
|
-
endAdornment: /* @__PURE__ */ O(
|
|
1477
|
+
endAdornment: /* @__PURE__ */ O(Pe, { position: "end", children: [
|
|
1478
1478
|
/* @__PURE__ */ t(Ye, {
|
|
1479
1479
|
onChange: async ({ response: f }) => {
|
|
1480
1480
|
var I, z, N;
|
|
@@ -1538,7 +1538,7 @@ function gr({ value: e }) {
|
|
|
1538
1538
|
(u = e.renderer) != null && u.script || (l.transact(() => {
|
|
1539
1539
|
e.renderer.script = e.renderer.type === "react-component" ? vr : xr;
|
|
1540
1540
|
}), i());
|
|
1541
|
-
}, [e]), /* @__PURE__ */ t(j, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ t(
|
|
1541
|
+
}, [e]), /* @__PURE__ */ t(j, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ t(ge, {
|
|
1542
1542
|
keyId: e.id,
|
|
1543
1543
|
locale: r,
|
|
1544
1544
|
language: "typescript",
|
|
@@ -1552,8 +1552,8 @@ function gr({ value: e }) {
|
|
|
1552
1552
|
}
|
|
1553
1553
|
function Pr({ value: e }) {
|
|
1554
1554
|
var k, v, o;
|
|
1555
|
-
const { t: r } = C(), i = ee(e).doc, { state: { components: l, config: { defaultLocale: u }, resources: y }, localState: { currentLocale: a } } = ce(), x =
|
|
1556
|
-
return /* @__PURE__ */ O(R, { gap: 1, children: [
|
|
1555
|
+
const { t: r } = C(), i = ee(e).doc, { state: { components: l, config: { defaultLocale: u }, resources: y }, localState: { currentLocale: a } } = ce(), x = xe(), g = ((k = l[e.renderer.componentId]) == null ? void 0 : k.data) ?? ((o = (v = y.components) == null ? void 0 : v[e.renderer.componentId]) == null ? void 0 : o.component), b = ke({ variant: "dialog" });
|
|
1556
|
+
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 1, children: [
|
|
1557
1557
|
/* @__PURE__ */ t(Se, {
|
|
1558
1558
|
allComponents: x,
|
|
1559
1559
|
excludes: [e.id],
|
|
@@ -1586,7 +1586,7 @@ function Pr({ value: e }) {
|
|
|
1586
1586
|
}),
|
|
1587
1587
|
/* @__PURE__ */ t(it, { ...Ze(b), component: e, type: "parameters" })
|
|
1588
1588
|
] })
|
|
1589
|
-
] });
|
|
1589
|
+
] }) });
|
|
1590
1590
|
}
|
|
1591
1591
|
function Se({ label: e, options: r, excludes: i, value: l, onChange: u, allComponents: y, ...a }) {
|
|
1592
1592
|
var k;
|
|
@@ -1617,7 +1617,7 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1617
1617
|
$(() => {
|
|
1618
1618
|
(() => {
|
|
1619
1619
|
var w, c;
|
|
1620
|
-
((w = e == null ? void 0 : e.renderer) == null ? void 0 : w.type) === "react-component" &&
|
|
1620
|
+
((w = e == null ? void 0 : e.renderer) == null ? void 0 : w.type) === "react-component" && we(e == null ? void 0 : e.properties) ? Rt((c = e == null ? void 0 : e.renderer) == null ? void 0 : c.script).then((h) => {
|
|
1621
1621
|
const f = zt(h);
|
|
1622
1622
|
b(f);
|
|
1623
1623
|
}) : b(e == null ? void 0 : e.properties);
|
|
@@ -1639,14 +1639,14 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1639
1639
|
visibleProperties: [],
|
|
1640
1640
|
canUsePropertiesKeys: []
|
|
1641
1641
|
};
|
|
1642
|
-
const m = A(Object.values(g), "index"), w = m.filter(({ data: f }) => f.key &&
|
|
1642
|
+
const m = A(Object.values(g), "index"), w = m.filter(({ data: f }) => f.key && ye(g, f.id)), c = m.filter(({ data: f }) => f.key && f.type !== "component"), h = c.map(({ data: f }) => f.key);
|
|
1643
1643
|
return {
|
|
1644
1644
|
canUseProperties: c,
|
|
1645
1645
|
visibleProperties: w,
|
|
1646
1646
|
canUsePropertiesKeys: h
|
|
1647
1647
|
};
|
|
1648
1648
|
}, [JSON.stringify(g)]), s = o(), d = _t(s, "key");
|
|
1649
|
-
return /* @__PURE__ */ t(
|
|
1649
|
+
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
1650
1650
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: x("maker.properties.parameters") }),
|
|
1651
1651
|
!e || n.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ t(de, { style: { fontSize: 12 }, children: x("maker.properties.noParameters") }) : /* @__PURE__ */ O(X, { children: [
|
|
1652
1652
|
/* @__PURE__ */ t(R, { gap: 2, children: n.visibleProperties.map(({ data: m }) => {
|
|
@@ -1687,7 +1687,7 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1687
1687
|
return !Mt(m[h], (f = d == null ? void 0 : d[h]) == null ? void 0 : f.value);
|
|
1688
1688
|
}).filter((h) => {
|
|
1689
1689
|
var f, P, S, p;
|
|
1690
|
-
return !(h === "locale" && !Jt(d[h], "locale") || ((f = d[h]) == null ? void 0 : f.type) === "component" || (((P = d[h]) == null ? void 0 : P.type) === "yaml" || ((S = d[h]) == null ? void 0 : S.type) === "json") &&
|
|
1690
|
+
return !(h === "locale" && !Jt(d[h], "locale") || ((f = d[h]) == null ? void 0 : f.type) === "component" || (((P = d[h]) == null ? void 0 : P.type) === "yaml" || ((S = d[h]) == null ? void 0 : S.type) === "json") && ye(g, (p = d[h]) == null ? void 0 : p.id));
|
|
1691
1691
|
}).reduce((h, f) => h.then(() => {
|
|
1692
1692
|
const P = d[f], S = w.includes(f);
|
|
1693
1693
|
if (P != null && P.id && S)
|
|
@@ -1702,8 +1702,8 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1702
1702
|
const p = `propertyNotFound${f}`;
|
|
1703
1703
|
if (k === p)
|
|
1704
1704
|
return Promise.resolve();
|
|
1705
|
-
|
|
1706
|
-
const I =
|
|
1705
|
+
he.close(k);
|
|
1706
|
+
const I = he.warning(x("maker.properties.propertyNotFound", {
|
|
1707
1707
|
key: f
|
|
1708
1708
|
}), {
|
|
1709
1709
|
key: p
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit-inner-components",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.23",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@arcblock/did-auth": "^1.20.11",
|
|
73
73
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
74
|
-
"@arcblock/did-connect": "^2.13.
|
|
75
|
-
"@arcblock/react-hooks": "^2.13.
|
|
76
|
-
"@arcblock/ux": "^2.13.
|
|
74
|
+
"@arcblock/did-connect": "^2.13.50",
|
|
75
|
+
"@arcblock/react-hooks": "^2.13.50",
|
|
76
|
+
"@arcblock/ux": "^2.13.50",
|
|
77
77
|
"@blocklet/ai-kit": "^0.1.78",
|
|
78
78
|
"@blocklet/ai-runtime": "^0.4.271",
|
|
79
79
|
"@blocklet/code-editor": "^0.4.271",
|
|
80
|
-
"@blocklet/crawler": "^2.3.
|
|
80
|
+
"@blocklet/crawler": "^2.3.50",
|
|
81
81
|
"@blocklet/embed": "^0.2.4",
|
|
82
82
|
"@blocklet/js-sdk": "^1.16.43",
|
|
83
83
|
"@blocklet/logger": "1.16.36",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@blocklet/sdk": "^1.16.43",
|
|
86
86
|
"@blocklet/studio-ui": "^0.4.271",
|
|
87
87
|
"@blocklet/tracker": "^1.16.43",
|
|
88
|
-
"@blocklet/ui-react": "^2.13.
|
|
88
|
+
"@blocklet/ui-react": "^2.13.50",
|
|
89
89
|
"@blocklet/uploader": "^0.1.93",
|
|
90
90
|
"@blocklet/uploader-server": "^0.1.99",
|
|
91
91
|
"@emotion/cache": "^11.13.1",
|
|
@@ -205,8 +205,8 @@
|
|
|
205
205
|
"yaml": "^2.5.0",
|
|
206
206
|
"yjs": "^13.6.18",
|
|
207
207
|
"zustand": "^4.5.5",
|
|
208
|
-
"@blocklet/pages-kit": "^0.5.
|
|
209
|
-
"@blocklet/pages-kit-block-studio": "^0.5.
|
|
208
|
+
"@blocklet/pages-kit": "^0.5.23",
|
|
209
|
+
"@blocklet/pages-kit-block-studio": "^0.5.23"
|
|
210
210
|
},
|
|
211
211
|
"devDependencies": {
|
|
212
212
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),M=require("./state-CA6q2h83.js"),Y=require("@arcblock/ux/lib/Locale/context"),le=require("@arcblock/ux/lib/Result"),ue=require("@blocklet/pages-kit/builtin/page/header"),de=require("@blocklet/pages-kit/contexts/color"),J=require("@blocklet/pages-kit/utils/data-source"),pe=require("@blocklet/pages-kit/utils/route"),ge=require("@blocklet/ui-react/lib/Header"),Z=require("@emotion/css"),N=require("@emotion/react"),me=require("@emotion/styled"),b=require("@mui/material"),G=require("ahooks"),fe=require("isomorphic-dompurify"),he=require("lodash/cloneDeep"),xe=require("lodash/isEmpty"),je=require("lodash/isEqual"),m=require("react"),ye=require("react-helmet"),P=require("react-router-dom"),ee=require("react-use"),E=require("ufo"),I=require("./array-C0IVbCmb.js"),W=require("@arcblock/ux/lib/Theme"),be=require("@blocklet/ui-react/lib/Footer");require("webfontloader");const X=require("./session-BA7Qrcia.js"),S=t=>t&&t.__esModule?t:{default:t},te=S(le),ve=S(ge),ne=S(me),we=S(fe),V=S(he),Pe=S(xe),oe=S(je),ke=S(be),Re=W.styled(ke.default,{shouldForwardProp:t=>!!t})`
|
|
2
|
-
& > div > .MuiContainer-root {
|
|
3
|
-
max-width: unset;
|
|
4
|
-
}
|
|
5
|
-
`;function Se({meta:t,...o}){const r=W.useTheme();return e.jsx(Re,{...o,meta:t,theme:r||{}})}function se(t){return e.jsx(b.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...t,children:e.jsx(b.CircularProgress,{size:30})})}function qe(t){return e.jsx(_e,{...t})}const _e=W.styled(b.Box)`
|
|
6
|
-
position: fixed;
|
|
7
|
-
left: 0;
|
|
8
|
-
top: 0;
|
|
9
|
-
z-index: 999999999999;
|
|
10
|
-
width: 80px;
|
|
11
|
-
font-size: 12px;
|
|
12
|
-
text-align: center;
|
|
13
|
-
opacity: 0.7;
|
|
14
|
-
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
`,Ce=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
17
|
-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;function Ee({titleFontFamily:t,descriptionFontFamily:o}){var n;const r=b.useTheme(),s=(n=r==null?void 0:r.typography)==null?void 0:n.fontFamily;m.useEffect(()=>{},[t,o]);const i=`${s}, ${Ce}`;return e.jsx(N.Global,{styles:N.css`
|
|
18
|
-
#app {
|
|
19
|
-
font-family: ${i};
|
|
20
|
-
|
|
21
|
-
.page-kit-section__title {
|
|
22
|
-
font-family: ${i};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.page-kit-section__description {
|
|
26
|
-
font-family: ${i};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`})}function Me(){const[t]=P.useSearchParams(),{session:o}=X.useSessionContext(),r=X.useIsRoleOrMultiTenant("owner","admin","pagesEditor","member"),s=m.useMemo(()=>{const n=t.get("mode");return I.STATE_MODES.includes(n)?n:"production"},[t]),i=s==="production"?s:o.user?r?s:"production":null;return i?e.jsx(re,{mode:i}):null}function re({mode:t}){if(t!=="draft"){const o=window.__PAGE_STATE__;return o?e.jsx(A,{mode:t,state:o}):e.jsx(Be,{mode:t,children:({state:r})=>e.jsx(A,{mode:t,state:r})})}return e.jsx(Ie,{children:({state:o})=>e.jsx(A,{mode:t,state:o})})}const Ie=m.lazy(()=>Promise.resolve().then(()=>require("./draft-data-BLL0M7MI.js")));function Be({mode:t,children:o}){const r=document.querySelector('meta[property="pages:version"]'),s=r==null?void 0:r.content,i=M.useProjectId(),n=m.useMemo(()=>{if(s==="{{pagesPublishedAt}}"){const l=localStorage.getItem(M.getProjectPageVersionKey(i??""));return Number(l)?Number(l):new Date().getTime()}return Number(s)},[s]),{loading:g,value:a}=ee.useAsync(()=>I.getPages({mode:t,version:n}),[t,n]);return g?e.jsx(se,{}):a?o({state:a}):null}function A({mode:t,state:o}){const{t:r,locale:s}=Y.useLocaleContext(),[i]=P.useSearchParams(),n=i.get("hiddenBadge")==="true",g=i.get("showPublish")==="true",{pageIds:a,pages:l,routeIds:f,routes:d,supportedLocales:p,config:{defaultLocale:h},resources:v}=o,w=M.getAllComponents(o),j=m.useMemo(()=>p!=null&&p.some(u=>u.locale===s)?s:void 0,[s,p]),B=Object.values(d||{}).find(u=>(u==null?void 0:u.path)==="/")||Object.values(l).find(u=>(u==null?void 0:u.slug)==="/")?void 0:Object.values(l)[0],H=m.useMemo(()=>a.map(u=>{const c=l[u];return c&&{id:c.id,path:E.joinURL("/",j||"",c.slug,t!=="production"?`?mode=${t}`:"")}}).filter(I.nonNullable),[a,l,j,t]),q=([...u])=>(t!=="production"&&g&&u.unshift(e.jsx(m.Suspense,{fallback:e.jsx("div",{}),children:e.jsx(Le,{mode:"production",state:o})})),u);return e.jsxs(I.Provider,{value:{pages:H},children:[e.jsxs(P.Routes,{children:[B&&e.jsx(P.Route,{index:!0,element:e.jsx(P.Navigate,{to:E.joinURL("/",j||"",B.slug)})}),f==null?void 0:f.map(u=>{var T,L,k,x;const c=d==null?void 0:d[u];if(!c||!c.displayTemplateId)return null;const _=l[c.displayTemplateId];if(!_)return null;let C=[];if(c.params&&c.params.length>0){const R=pe.generateParamCombinations({basePath:c.path,params:c.params,routeId:c.id,paramsOptions:c.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});C=R==null?void 0:R.map(U=>{var O,$,K,Q;const D=U.paramOptionIds.join("-");return e.jsx(P.Route,{path:E.joinURL(":projectIdOrSlug?",U.path),element:e.jsx(z,{mode:t,components:w,page:_,locale:j,defaultLocale:h,headerAddons:q,state:o,pageData:(Q=(K=($=(O=c.dataSource)==null?void 0:O.pathDataMappings)==null?void 0:$[D])==null?void 0:K.dataCache)==null?void 0:Q[j||h||"en"]})},D)})}return C.push(e.jsx(P.Route,{path:E.joinURL(":projectIdOrSlug?",c.path),element:e.jsx(z,{mode:t,components:w,page:_,locale:j,defaultLocale:h,headerAddons:q,state:o,pageData:(x=(k=(L=(T=c.dataSource)==null?void 0:T.pathDataMappings)==null?void 0:L[c.id])==null?void 0:k.dataCache)==null?void 0:x[j||h||"en"]})},c.id)),C}),a.map(u=>{const c=l[u];return c?e.jsx(P.Route,{path:E.joinURL(":projectIdOrSlug?",c.slug),element:e.jsx(F,{mode:t,components:w,page:c,locale:j,defaultLocale:h,headerAddons:q})},c.id):null}),v.pages&&Object.values(v.pages).map(({blockletId:u,page:c})=>e.jsx(P.Route,{path:E.joinURL("/",`@${u}`,c.slug),element:e.jsx(F,{mode:t,components:w,page:c,locale:j,defaultLocale:h,headerAddons:q})},c.id)),e.jsx(P.Route,{path:"*",element:e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(te.default,{status:404,extra:e.jsx(ie,{href:"/",children:r("common.back")})})})})]}),t!=="production"&&!n&&e.jsx(qe,{sx:{bgcolor:"info.light"},children:t}),e.jsx(Ee,{})]})}function z({mode:t,pageData:o,components:r,page:s,locale:i,defaultLocale:n,headerAddons:g,state:a}){const l=G.useReactive({page:null});m.useEffect(()=>{const d=s||null;d?l.page=V.default(d):l.page=null},[s,l]);const f=m.useRef();return m.useEffect(()=>{oe.default(o,f.current)||o&&l.page&&(J.setPageDataSource(l.page,a,i,o),f.current=V.default(o))},[l.page,o,i,a]),l.page?e.jsx(F,{mode:t,components:r,page:l.page,locale:i,defaultLocale:n,headerAddons:g}):null}function Te({mode:t,state:o,path:r,pageData:s}){const{t:i,locale:n}=Y.useLocaleContext(),{pages:g,supportedLocales:a,config:{defaultLocale:l},resources:f}=o,d=Object.values(g).find(y=>(y==null?void 0:y.slug)===r),p=Object.values(f.pages||{}).find(y=>y.page.slug===r),h=m.useMemo(()=>a!=null&&a.some(y=>y.locale===n)?n:void 0,[n,a]),v=G.useReactive({page:null});m.useEffect(()=>{const y=d||(p==null?void 0:p.page)||null;y?v.page=V.default(y):v.page=null},[d,p]);const w=m.useRef();if(m.useEffect(()=>{oe.default(s,w.current)||s&&v.page&&(J.setPageDataSource(v.page,o,h,s),w.current=V.default(s))},[{}]),!d&&!(p!=null&&p.page))return e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(te.default,{style:{background:"inherit"},status:404,extra:e.jsx(ie,{href:"/",children:i("common.back")})})});const j=M.getAllComponents(o);return v.page?e.jsx(F,{mode:t,components:j,page:v.page,locale:h,defaultLocale:l}):null}function F({mode:t,components:o,page:r,locale:s,defaultLocale:i,headerAddons:n}){var B,H,q,u,c,_,C,T,L;const g=de.useColorConvert(),a=((B=r.locales)==null?void 0:B[s])??((H=r.locales)==null?void 0:H[i])??{},l=a.title||((q=window.blocklet)==null?void 0:q.appName),f=a.description||((u=window.blocklet)==null?void 0:u.appDescription),d=M.autoResizeImage(M.getImageAbsoluteUrl(a.image),540),{logo:p,brand:h,description:v,...w}=ue.useHeaderState(),j=m.useMemo(()=>k=>{var R;let x=(n==null?void 0:n(k))??k;return x=((R=w.addons)==null?void 0:R.call(w,x))??x,x},[w.addons,n]),y=(c=a.header)!=null&&c.translucent?ce:ae;return e.jsxs(I.PageProvider,{page:r,defaultLocale:i,currentLocale:s,children:[e.jsx(N.Global,{styles:N.css`
|
|
30
|
-
body {
|
|
31
|
-
background-color: ${g(!a.backgroundColor||a.backgroundColor==="transparent"?"background.default":a.backgroundColor)} !important;
|
|
32
|
-
}
|
|
33
|
-
`}),e.jsx(y,{hideNavMenu:!!((_=a.header)!=null&&_.hideNavMenus),translucentTextColor:(C=a.header)==null?void 0:C.translucentTextColor,...p?{logo:p}:{},...h?{brand:h}:{},...v?{description:v}:{},className:Z.cx(((T=a.header)==null?void 0:T.sticky)&&"sticky","page-header"),maxWidth:!1,addons:j}),e.jsx(P.ScrollRestoration,{}),e.jsxs(ye.Helmet,{children:[e.jsx("title",{children:l}),e.jsx("meta",{name:"og:title",content:l}),e.jsx("meta",{name:"og:description",content:f}),e.jsx("meta",{name:"og:image",content:d}),e.jsx("meta",{name:"twitter:image:src",content:d}),e.jsx("meta",{name:"twitter:image",content:d}),e.jsx("meta",{property:"twitter:description",content:f}),e.jsx("meta",{property:"twitter:title",content:l}),e.jsx("meta",{name:"description",content:f})]}),e.jsx(b.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:r.sectionIds.map(k=>{var D,O;const x=r.sections[k];if(!x||x.visibility==="hidden")return null;const R=(D=x.locales)==null?void 0:D[s],U=((O=x.locales)==null?void 0:O[i])??{};return e.jsx(I.BlockRenderer,{id:k,type:x.component,mode:t,section:x,config:{...Pe.default(R)?U:R,locale:s,dev:t==="draft"?{mode:t,components:o,defaultLocale:i}:{mode:t}}},k)})}),!((L=a.footer)!=null&&L.hidden)&&e.jsx(Se,{})]})}const Le=m.lazy(()=>Promise.resolve().then(()=>require("./publish-button-Cw_MfRfv.js"))),ae=ne.default(ve.default)`
|
|
34
|
-
&.sticky {
|
|
35
|
-
position: sticky;
|
|
36
|
-
top: 0;
|
|
37
|
-
}
|
|
38
|
-
`;function De({logo:t}){const[o,r]=m.useState(),s=b.useMediaQuery(n=>n.breakpoints.down("sm")),{value:i}=ee.useAsync(()=>{var a,l;const n=new URL(s?((a=window==null?void 0:window.blocklet)==null?void 0:a.appLogo)||"/.well-known/service/blocklet/logo":((l=window==null?void 0:window.blocklet)==null?void 0:l.appLogoRect)||"/.well-known/service/blocklet/logo-rect",window.location.origin);n.searchParams.delete("imageFilter"),n.searchParams.delete("f");const g=n.toString();return new Promise(f=>{fetch(g).then(d=>{const p=d.headers.get("content-type");p!=null&&p.includes("svg")&&d.text().then(h=>{r(h),f(null)}),f(d.url)})})},[s]);if(t)return t;if(o)return e.jsx(b.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:we.default.sanitize(o)}});if(i){const n=new URL(i);n.searchParams.set("imageFilter","convert"),n.searchParams.set("f","png"),n.searchParams.set("h","80");const g=n.toString();return e.jsx("img",{src:g,alt:"logo"})}return null}function ce({logo:t,translucentTextColor:o,...r}){const{top:s=0}=G.useScroll(()=>document.getElementById("app"))||{},i=b.useTheme();let n=Math.min(s/800,1),g="";return n>.1?(n=Math.max(n,.6),g=b.alpha(i.palette.text.primary,n)):g=o||"#EEEEEE",e.jsx(ae,{logo:e.jsx(De,{logo:t}),...r,className:Z.cx(n<=.7&&"reverse-color"),style:{backgroundColor:b.alpha(i.palette.background.default,n),"--logo-invert":n<=.7?1-n/6:1-n},sx:{backdropFilter:n>=.6?"blur(10px)":"blur(0px)",transition:"all 0.3s ease",position:"fixed !important",left:0,top:0,right:0,bgcolor:"transparent","&.reverse-color":{".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button":{color:`${g} !important`}},"& .navmenu--horizontal":{bgcolor:"transparent !important"},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:g}}})}const ie=ne.default(b.Button)``;exports.Home=Me;exports.HomeView=re;exports.Loading=se;exports.PageRoutes=A;exports.PageView=F;exports.PageViewByPath=Te;exports.PageViewWithDataSource=z;exports.TranslucentHeader=ce;
|