@blocklet/pages-kit-inner-components 0.4.99 → 0.4.101
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 +378 -0
- package/lib/cjs/chunks/array-BMkoDb_A.js +507 -0
- package/lib/cjs/chunks/config-color-Da8lKUL0.js +21 -0
- package/lib/cjs/chunks/{draft-data-Quz8toC_.js → draft-data-UP_7unuZ.js} +1 -1
- package/lib/cjs/chunks/home-CMaoUDJD.js +36 -0
- package/lib/cjs/chunks/publish-button-ByqPCT2Y.js +1 -0
- package/lib/cjs/chunks/state-BoXTl4DM.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/setting.js +3 -23
- package/lib/cjs/theme.js +3 -3
- package/lib/es/add-component.js +2991 -0
- package/lib/es/chunks/array-C85JziT_.js +2086 -0
- package/lib/es/chunks/config-color-B-ax03qd.js +328 -0
- package/lib/es/chunks/{draft-data-B1GJKphX.js → draft-data-0n1CKRWr.js} +1 -1
- package/lib/es/chunks/home-BBfstt15.js +470 -0
- package/lib/es/chunks/{publish-button-BY10Od4q.js → publish-button-OwaTBakj.js} +8 -7
- package/lib/es/chunks/state-DsXKwImw.js +425 -0
- package/lib/es/home.js +10 -8
- package/lib/es/locales.js +17 -179
- package/lib/es/setting.js +929 -1112
- package/lib/es/theme.js +53 -59
- package/package.json +21 -19
- package/lib/cjs/chunks/home-D9IcqQld.js +0 -542
- package/lib/cjs/chunks/publish-button-6WQRr1s7.js +0 -1
- package/lib/cjs/chunks/state-eTpgUKhB.js +0 -1
- package/lib/es/chunks/home-Cclj5ETj.js +0 -2357
- package/lib/es/chunks/state-CYDNg8EG.js +0 -420
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
import { jsx as o, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import { g as L, a as re, b as se, u as ie, c as ce } from "./state-DsXKwImw.js";
|
|
3
|
+
import { cloneDeep as C } from "lodash";
|
|
4
|
+
import { useLocaleContext as q } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
+
import J from "@arcblock/ux/lib/Result";
|
|
6
|
+
import { useHeaderState as ae } from "@blocklet/pages-kit/builtin/page/header";
|
|
7
|
+
import { useColorConvert as le } from "@blocklet/pages-kit/contexts/color";
|
|
8
|
+
import ue from "@blocklet/ui-react/lib/Header";
|
|
9
|
+
import { cx as X } from "@emotion/css";
|
|
10
|
+
import { Global as Y, css as F } from "@emotion/react";
|
|
11
|
+
import Q from "@emotion/styled";
|
|
12
|
+
import { Box as j, CircularProgress as me, Button as fe, Stack as pe } from "@mui/material";
|
|
13
|
+
import { useReactive as de } from "ahooks";
|
|
14
|
+
import ge from "isomorphic-dompurify";
|
|
15
|
+
import G from "lodash/cloneDeep";
|
|
16
|
+
import he from "lodash/isEmpty";
|
|
17
|
+
import be from "lodash/isEqual";
|
|
18
|
+
import { useEffect as T, useContext as ve, lazy as Z, useMemo as P, useRef as ye, Suspense as Se, useState as xe } from "react";
|
|
19
|
+
import { Helmet as we } from "react-helmet";
|
|
20
|
+
import { useSearchParams as Pe, Routes as ke, Route as E, Navigate as Ce, ScrollRestoration as je } from "react-router-dom";
|
|
21
|
+
import { useWindowScroll as Ee, useAsync as K } from "react-use";
|
|
22
|
+
import { joinURL as I } from "ufo";
|
|
23
|
+
import { S as Ie, n as Re, P as Me, a as Te, B as $e, g as Oe } from "./array-C85JziT_.js";
|
|
24
|
+
import { styled as ee, useTheme as Ne } from "@arcblock/ux/lib/Theme";
|
|
25
|
+
import _e from "@blocklet/ui-react/lib/Footer";
|
|
26
|
+
import Be from "webfontloader";
|
|
27
|
+
import { createAuthServiceSessionContext as Ae } from "@arcblock/did-connect/lib/Session";
|
|
28
|
+
function He(e, n, t, r) {
|
|
29
|
+
e.locales || (e.locales = {}), e.locales[t] = C(e.locales[t] || {}), e.locales[t].title = r.title ?? e.locales[t].title, e.locales[t].image = r.image ?? e.locales[t].image, e.locales[t].description = r.description ?? e.locales[t].description, Object.entries(r.sectionsData).forEach(([s, i]) => {
|
|
30
|
+
var a, h, v, p;
|
|
31
|
+
const c = Object.values(e.sections).find(
|
|
32
|
+
(l) => l.id === s || l.name === s
|
|
33
|
+
);
|
|
34
|
+
if (c && c.isTemplateSection)
|
|
35
|
+
if (c.locales = C(c.locales || {}), c.locales[t] = C(c.locales[t] || {}), c.component === "custom-component") {
|
|
36
|
+
const l = (a = c.config) == null ? void 0 : a.componentId;
|
|
37
|
+
if (!l)
|
|
38
|
+
return;
|
|
39
|
+
const d = ((h = n.components[l]) == null ? void 0 : h.data) || ((p = (v = n.resources.components) == null ? void 0 : v[l]) == null ? void 0 : p.component);
|
|
40
|
+
if (!d)
|
|
41
|
+
return;
|
|
42
|
+
c.locales[t].properties = C(c.locales[t].properties || {}), Object.entries(i || {}).forEach(([g, b]) => {
|
|
43
|
+
var m, x;
|
|
44
|
+
const S = ((m = d == null ? void 0 : d.properties) == null ? void 0 : m[g]) || Object.values((d == null ? void 0 : d.properties) || {}).find((u) => {
|
|
45
|
+
var f;
|
|
46
|
+
return ((f = u.data) == null ? void 0 : f.key) === g;
|
|
47
|
+
});
|
|
48
|
+
S && (c.locales[t].properties[(x = S.data) == null ? void 0 : x.id] = {
|
|
49
|
+
value: b
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
} else
|
|
53
|
+
c.locales[t] = {
|
|
54
|
+
...C(c.locales[t]),
|
|
55
|
+
...i || {}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const Ue = ee(_e, { shouldForwardProp: (e) => !!e })`
|
|
60
|
+
& > div > .MuiContainer-root {
|
|
61
|
+
max-width: unset;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
function ze({ meta: e, ...n }) {
|
|
65
|
+
const t = Ne();
|
|
66
|
+
return /* @__PURE__ */ o(Ue, { ...n, meta: e, theme: t || {} });
|
|
67
|
+
}
|
|
68
|
+
function Ve(e) {
|
|
69
|
+
return /* @__PURE__ */ o(j, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...e, children: /* @__PURE__ */ o(me, { size: 30 }) });
|
|
70
|
+
}
|
|
71
|
+
function Ge(e) {
|
|
72
|
+
return /* @__PURE__ */ o(We, { ...e });
|
|
73
|
+
}
|
|
74
|
+
const We = ee(j)`
|
|
75
|
+
position: fixed;
|
|
76
|
+
left: 0;
|
|
77
|
+
top: 0;
|
|
78
|
+
z-index: 999999999999;
|
|
79
|
+
width: 80px;
|
|
80
|
+
font-size: 12px;
|
|
81
|
+
text-align: center;
|
|
82
|
+
opacity: 0.7;
|
|
83
|
+
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
`, De = (e) => new Promise((n, t) => {
|
|
86
|
+
(e == null ? void 0 : e.length) > 0 ? Be.load({
|
|
87
|
+
google: {
|
|
88
|
+
families: e
|
|
89
|
+
},
|
|
90
|
+
fontactive: () => {
|
|
91
|
+
n("success");
|
|
92
|
+
},
|
|
93
|
+
fontinactive: () => {
|
|
94
|
+
t(new Error("load font fail"));
|
|
95
|
+
}
|
|
96
|
+
}) : n("success");
|
|
97
|
+
}), W = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
98
|
+
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`, D = {};
|
|
99
|
+
function Le({
|
|
100
|
+
titleFontFamily: e,
|
|
101
|
+
descriptionFontFamily: n
|
|
102
|
+
}) {
|
|
103
|
+
const t = async (r) => {
|
|
104
|
+
if (r && !document.querySelectorAll(`link[href*="${r}" i]`).length)
|
|
105
|
+
try {
|
|
106
|
+
D[r] || (await De([r]), D[r] = !0);
|
|
107
|
+
} catch (s) {
|
|
108
|
+
console.error(s);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return T(() => {
|
|
112
|
+
e && t(e), n && t(n);
|
|
113
|
+
}, [e, n]), /* @__PURE__ */ o(
|
|
114
|
+
Y,
|
|
115
|
+
{
|
|
116
|
+
styles: F`
|
|
117
|
+
#app {
|
|
118
|
+
.page-kit-section__title {
|
|
119
|
+
font-family: ${JSON.stringify(e)}, ${W};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.page-kit-section__description {
|
|
123
|
+
font-family: ${JSON.stringify(n)}, ${W};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
const { SessionProvider: It, SessionContext: qe, SessionConsumer: Rt, withSession: Mt } = Ae();
|
|
131
|
+
function O() {
|
|
132
|
+
return ve(qe);
|
|
133
|
+
}
|
|
134
|
+
function Je(...e) {
|
|
135
|
+
var t;
|
|
136
|
+
const { session: n } = O();
|
|
137
|
+
return e.includes((t = n.user) == null ? void 0 : t.role);
|
|
138
|
+
}
|
|
139
|
+
function Xe(...e) {
|
|
140
|
+
var r;
|
|
141
|
+
const { session: n } = O(), t = Je(...e);
|
|
142
|
+
return ((r = window.blocklet) == null ? void 0 : r.tenantMode) === "multiple" ? !!n.user : t;
|
|
143
|
+
}
|
|
144
|
+
function Tt() {
|
|
145
|
+
const [e] = Pe(), { session: n } = O(), t = Xe("owner", "admin", "pagesEditor", "member"), r = P(() => {
|
|
146
|
+
const i = e.get("mode");
|
|
147
|
+
return Ie.includes(i) ? i : "production";
|
|
148
|
+
}, [e]), s = r === "production" ? r : n.user ? t ? r : "production" : null;
|
|
149
|
+
return s ? /* @__PURE__ */ o(Ye, { mode: s }) : null;
|
|
150
|
+
}
|
|
151
|
+
function Ye({ mode: e }) {
|
|
152
|
+
if (e !== "draft") {
|
|
153
|
+
const n = window.__PAGE_STATE__;
|
|
154
|
+
return n ? /* @__PURE__ */ o(M, { mode: e, state: n }) : /* @__PURE__ */ o(Qe, { mode: e, children: ({ state: t }) => /* @__PURE__ */ o(M, { mode: e, state: t }) });
|
|
155
|
+
}
|
|
156
|
+
return /* @__PURE__ */ o(Fe, { children: ({ state: n }) => /* @__PURE__ */ o(M, { mode: e, state: n }) });
|
|
157
|
+
}
|
|
158
|
+
const Fe = Z(() => import("./draft-data-0n1CKRWr.js"));
|
|
159
|
+
function Qe({
|
|
160
|
+
mode: e,
|
|
161
|
+
children: n
|
|
162
|
+
}) {
|
|
163
|
+
const t = document.querySelector('meta[property="pages:version"]'), r = t == null ? void 0 : t.content, s = ie(), i = P(() => {
|
|
164
|
+
if (r === "{{pagesPublishedAt}}") {
|
|
165
|
+
const h = localStorage.getItem(ce(s ?? ""));
|
|
166
|
+
return Number(h) ? Number(h) : (/* @__PURE__ */ new Date()).getTime();
|
|
167
|
+
}
|
|
168
|
+
return Number(r);
|
|
169
|
+
}, [r]), { loading: c, value: a } = K(() => Oe({ mode: e, version: i }), [e, i]);
|
|
170
|
+
return c ? /* @__PURE__ */ o(Ve, {}) : a ? n({ state: a }) : null;
|
|
171
|
+
}
|
|
172
|
+
function M({ mode: e, state: n }) {
|
|
173
|
+
var b, S, m, x;
|
|
174
|
+
const { t, locale: r } = q(), {
|
|
175
|
+
pageIds: s,
|
|
176
|
+
pages: i,
|
|
177
|
+
supportedLocales: c,
|
|
178
|
+
config: { defaultLocale: a },
|
|
179
|
+
resources: h
|
|
180
|
+
} = n, v = L(n), p = P(
|
|
181
|
+
() => c != null && c.some((u) => u.locale === r) ? r : void 0,
|
|
182
|
+
[r, c]
|
|
183
|
+
), l = Object.values(i).find((u) => (u == null ? void 0 : u.slug) === "/") ? void 0 : Object.values(i)[0], d = P(
|
|
184
|
+
() => s.map((u) => {
|
|
185
|
+
const f = i[u];
|
|
186
|
+
return f && {
|
|
187
|
+
id: f.id,
|
|
188
|
+
path: I("/", p || "", f.slug, e !== "production" ? `?mode=${e}` : "")
|
|
189
|
+
};
|
|
190
|
+
}).filter(Re),
|
|
191
|
+
[s, i, p, e]
|
|
192
|
+
), g = ([...u]) => (e !== "production" && u.unshift(
|
|
193
|
+
/* @__PURE__ */ o(Se, { fallback: /* @__PURE__ */ o("div", {}), children: /* @__PURE__ */ o(Ze, { mode: "production", state: n }) })
|
|
194
|
+
), u);
|
|
195
|
+
return /* @__PURE__ */ R(Me, { value: { pages: d }, children: [
|
|
196
|
+
/* @__PURE__ */ R(ke, { children: [
|
|
197
|
+
l && /* @__PURE__ */ o(E, { index: !0, element: /* @__PURE__ */ o(Ce, { to: I("/", p || "", l.slug) }) }),
|
|
198
|
+
s.map((u) => {
|
|
199
|
+
const f = i[u];
|
|
200
|
+
return f ? /* @__PURE__ */ o(
|
|
201
|
+
E,
|
|
202
|
+
{
|
|
203
|
+
path: I(":projectIdOrSlug?", f.slug),
|
|
204
|
+
element: /* @__PURE__ */ o(
|
|
205
|
+
$,
|
|
206
|
+
{
|
|
207
|
+
mode: e,
|
|
208
|
+
components: v,
|
|
209
|
+
page: f,
|
|
210
|
+
locale: p,
|
|
211
|
+
defaultLocale: a,
|
|
212
|
+
headerAddons: g
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
},
|
|
216
|
+
f.id
|
|
217
|
+
) : null;
|
|
218
|
+
}),
|
|
219
|
+
h.pages && Object.values(h.pages).map(({ blockletId: u, page: f }) => /* @__PURE__ */ o(
|
|
220
|
+
E,
|
|
221
|
+
{
|
|
222
|
+
path: I("/", `@${u}`, f.slug),
|
|
223
|
+
element: /* @__PURE__ */ o(
|
|
224
|
+
$,
|
|
225
|
+
{
|
|
226
|
+
mode: e,
|
|
227
|
+
components: v,
|
|
228
|
+
page: f,
|
|
229
|
+
locale: p,
|
|
230
|
+
defaultLocale: a,
|
|
231
|
+
headerAddons: g
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
},
|
|
235
|
+
f.id
|
|
236
|
+
)),
|
|
237
|
+
/* @__PURE__ */ o(
|
|
238
|
+
E,
|
|
239
|
+
{
|
|
240
|
+
path: "*",
|
|
241
|
+
element: /* @__PURE__ */ o(j, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ o(J, { status: 404, extra: /* @__PURE__ */ o(oe, { href: "/", children: t("common.back") }) }) })
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }),
|
|
245
|
+
e !== "production" && /* @__PURE__ */ o(Ge, { sx: { bgcolor: "info.light" }, children: e }),
|
|
246
|
+
/* @__PURE__ */ o(
|
|
247
|
+
Le,
|
|
248
|
+
{
|
|
249
|
+
titleFontFamily: (S = (b = n.config) == null ? void 0 : b.fontFamily) == null ? void 0 : S.title,
|
|
250
|
+
descriptionFontFamily: (x = (m = n.config) == null ? void 0 : m.fontFamily) == null ? void 0 : x.description
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
] });
|
|
254
|
+
}
|
|
255
|
+
function $t({
|
|
256
|
+
mode: e,
|
|
257
|
+
state: n,
|
|
258
|
+
path: t,
|
|
259
|
+
pageData: r
|
|
260
|
+
}) {
|
|
261
|
+
const { t: s, locale: i } = q(), {
|
|
262
|
+
pages: c,
|
|
263
|
+
supportedLocales: a,
|
|
264
|
+
config: { defaultLocale: h },
|
|
265
|
+
resources: v
|
|
266
|
+
} = n, p = Object.values(c).find((m) => (m == null ? void 0 : m.slug) === t), l = Object.values(v.pages || {}).find((m) => m.page.slug === t), d = P(
|
|
267
|
+
() => a != null && a.some((m) => m.locale === i) ? i : void 0,
|
|
268
|
+
[i, a]
|
|
269
|
+
), g = de({
|
|
270
|
+
page: null
|
|
271
|
+
});
|
|
272
|
+
T(() => {
|
|
273
|
+
const m = p || (l == null ? void 0 : l.page) || null;
|
|
274
|
+
m ? g.page = G(m) : g.page = null;
|
|
275
|
+
}, [p, l]);
|
|
276
|
+
const b = ye();
|
|
277
|
+
if (T(() => {
|
|
278
|
+
be(r, b.current) || r && g.page && (He(g.page, n, d, r), b.current = G(r));
|
|
279
|
+
}, [{}]), !p && !(l != null && l.page))
|
|
280
|
+
return /* @__PURE__ */ o(j, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ o(J, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ o(oe, { href: "/", children: s("common.back") }) }) });
|
|
281
|
+
const S = L(n);
|
|
282
|
+
return g.page ? /* @__PURE__ */ o(
|
|
283
|
+
$,
|
|
284
|
+
{
|
|
285
|
+
mode: e,
|
|
286
|
+
components: S,
|
|
287
|
+
page: g.page,
|
|
288
|
+
locale: d,
|
|
289
|
+
defaultLocale: h
|
|
290
|
+
}
|
|
291
|
+
) : null;
|
|
292
|
+
}
|
|
293
|
+
function $({
|
|
294
|
+
mode: e,
|
|
295
|
+
components: n,
|
|
296
|
+
page: t,
|
|
297
|
+
locale: r,
|
|
298
|
+
defaultLocale: s,
|
|
299
|
+
headerAddons: i
|
|
300
|
+
}) {
|
|
301
|
+
var x, u, f, N, _, B, A, H, U;
|
|
302
|
+
const c = le(), a = ((x = t.locales) == null ? void 0 : x[r]) ?? ((u = t.locales) == null ? void 0 : u[s]) ?? {}, h = a.title || ((f = window.blocklet) == null ? void 0 : f.appName), v = a.description || ((N = window.blocklet) == null ? void 0 : N.appDescription), p = re(se(a.image), 540), { logo: l, brand: d, description: g, ...b } = ae(), S = P(
|
|
303
|
+
() => (w) => {
|
|
304
|
+
var k;
|
|
305
|
+
let y = (i == null ? void 0 : i(w)) ?? w;
|
|
306
|
+
return y = ((k = b.addons) == null ? void 0 : k.call(b, y)) ?? y, y;
|
|
307
|
+
},
|
|
308
|
+
[b.addons, i]
|
|
309
|
+
), m = (_ = a.header) != null && _.translucent ? et : te;
|
|
310
|
+
return /* @__PURE__ */ R(Te, { page: t, defaultLocale: s, currentLocale: r, children: [
|
|
311
|
+
!!a.backgroundColor && /* @__PURE__ */ o(
|
|
312
|
+
Y,
|
|
313
|
+
{
|
|
314
|
+
styles: F`
|
|
315
|
+
body {
|
|
316
|
+
background-color: ${c(a.backgroundColor)} !important;
|
|
317
|
+
}
|
|
318
|
+
`
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ o(
|
|
322
|
+
m,
|
|
323
|
+
{
|
|
324
|
+
hideNavMenu: !!((B = a.header) != null && B.hideNavMenus),
|
|
325
|
+
translucentTextColor: (A = a.header) == null ? void 0 : A.translucentTextColor,
|
|
326
|
+
...l ? { logo: l } : {},
|
|
327
|
+
...d ? { brand: d } : {},
|
|
328
|
+
...g ? { description: g } : {},
|
|
329
|
+
className: X(((H = a.header) == null ? void 0 : H.sticky) && "sticky", "page-header"),
|
|
330
|
+
maxWidth: !1,
|
|
331
|
+
addons: S
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ o(je, {}),
|
|
335
|
+
/* @__PURE__ */ R(we, { children: [
|
|
336
|
+
/* @__PURE__ */ o("title", { children: h }),
|
|
337
|
+
/* @__PURE__ */ o("meta", { name: "og:title", content: h }),
|
|
338
|
+
/* @__PURE__ */ o("meta", { name: "og:description", content: v }),
|
|
339
|
+
/* @__PURE__ */ o("meta", { name: "og:image", content: p }),
|
|
340
|
+
/* @__PURE__ */ o("meta", { name: "twitter:image:src", content: p }),
|
|
341
|
+
/* @__PURE__ */ o("meta", { name: "twitter:image", content: p }),
|
|
342
|
+
/* @__PURE__ */ o("meta", { property: "twitter:description", content: v }),
|
|
343
|
+
/* @__PURE__ */ o("meta", { property: "twitter:title", content: h }),
|
|
344
|
+
/* @__PURE__ */ o("meta", { name: "description", content: v })
|
|
345
|
+
] }),
|
|
346
|
+
/* @__PURE__ */ o(
|
|
347
|
+
pe,
|
|
348
|
+
{
|
|
349
|
+
flexGrow: 1,
|
|
350
|
+
className: "PageView-root",
|
|
351
|
+
sx: {
|
|
352
|
+
// 第一个 .BlockBase-root 的 pt 为 0
|
|
353
|
+
"& .BlockBase-root:first-child": {
|
|
354
|
+
pt: "0 !important"
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
children: t.sectionIds.map((w) => {
|
|
358
|
+
var z, V;
|
|
359
|
+
const y = t.sections[w];
|
|
360
|
+
if (!y || y.visibility === "hidden") return null;
|
|
361
|
+
const k = (z = y.locales) == null ? void 0 : z[r], ne = ((V = y.locales) == null ? void 0 : V[s]) ?? {};
|
|
362
|
+
return /* @__PURE__ */ o(
|
|
363
|
+
$e,
|
|
364
|
+
{
|
|
365
|
+
id: w,
|
|
366
|
+
type: y.component,
|
|
367
|
+
mode: e,
|
|
368
|
+
section: y,
|
|
369
|
+
config: {
|
|
370
|
+
...he(k) ? ne : k,
|
|
371
|
+
locale: r,
|
|
372
|
+
dev: e === "draft" ? {
|
|
373
|
+
mode: e,
|
|
374
|
+
components: n,
|
|
375
|
+
defaultLocale: s
|
|
376
|
+
} : { mode: e }
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
w
|
|
380
|
+
);
|
|
381
|
+
})
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
!((U = a.footer) != null && U.hidden) && /* @__PURE__ */ o(ze, {})
|
|
385
|
+
] });
|
|
386
|
+
}
|
|
387
|
+
const Ze = Z(() => import("./publish-button-OwaTBakj.js")), te = Q(ue)`
|
|
388
|
+
&.sticky {
|
|
389
|
+
position: sticky;
|
|
390
|
+
top: 0;
|
|
391
|
+
}
|
|
392
|
+
`;
|
|
393
|
+
function Ke({ logo: e }) {
|
|
394
|
+
const [n, t] = xe(), { value: r } = K(() => new Promise((s) => {
|
|
395
|
+
fetch("/.well-known/service/blocklet/logo-rect").then((i) => {
|
|
396
|
+
const c = i.headers.get("content-type");
|
|
397
|
+
c != null && c.includes("svg") && i.text().then((a) => {
|
|
398
|
+
t(a), s(null);
|
|
399
|
+
}), s(i.url);
|
|
400
|
+
});
|
|
401
|
+
}), []);
|
|
402
|
+
if (e)
|
|
403
|
+
return e;
|
|
404
|
+
if (n)
|
|
405
|
+
return /* @__PURE__ */ o(j, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: ge.sanitize(n) } });
|
|
406
|
+
if (r) {
|
|
407
|
+
const s = new URL(r);
|
|
408
|
+
s.searchParams.set("imageFilter", "convert"), s.searchParams.set("f", "png"), s.searchParams.set("h", "80");
|
|
409
|
+
const i = s.toString();
|
|
410
|
+
return /* @__PURE__ */ o("img", { src: i, alt: "logo" });
|
|
411
|
+
}
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
function et({
|
|
415
|
+
logo: e,
|
|
416
|
+
translucentTextColor: n,
|
|
417
|
+
...t
|
|
418
|
+
}) {
|
|
419
|
+
const { y: r } = Ee();
|
|
420
|
+
let s = Math.min(r / 800, 1), i = "";
|
|
421
|
+
if (s > 0.1) {
|
|
422
|
+
s = Math.max(s, 0.6);
|
|
423
|
+
const c = Math.round(255 * Math.min(1 - s, 0.2));
|
|
424
|
+
i = `rgb(${c}, ${c}, ${c})`;
|
|
425
|
+
} else
|
|
426
|
+
i = n || "#EEEEEE";
|
|
427
|
+
return /* @__PURE__ */ o(
|
|
428
|
+
te,
|
|
429
|
+
{
|
|
430
|
+
logo: /* @__PURE__ */ o(Ke, { logo: e }),
|
|
431
|
+
...t,
|
|
432
|
+
className: X(s <= 0.7 && "reverse-color"),
|
|
433
|
+
style: {
|
|
434
|
+
backgroundColor: `rgba(255,255,255,${s})`,
|
|
435
|
+
// @ts-ignore
|
|
436
|
+
"--logo-invert": s <= 0.7 ? 1 - s / 6 : 1 - s
|
|
437
|
+
},
|
|
438
|
+
sx: {
|
|
439
|
+
backdropFilter: s >= 0.6 ? "blur(10px)" : "blur(0px)",
|
|
440
|
+
transition: "all 0.3s ease",
|
|
441
|
+
position: "fixed !important",
|
|
442
|
+
left: 0,
|
|
443
|
+
top: 0,
|
|
444
|
+
right: 0,
|
|
445
|
+
bgcolor: "transparent",
|
|
446
|
+
"&.reverse-color": {
|
|
447
|
+
".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
|
|
448
|
+
color: `${i} !important`
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
".header-logo > div": {
|
|
452
|
+
filter: "invert(var(--logo-invert))"
|
|
453
|
+
},
|
|
454
|
+
".header-logo": {
|
|
455
|
+
color: i
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
const oe = Q(fe)``;
|
|
462
|
+
export {
|
|
463
|
+
Tt as H,
|
|
464
|
+
Ve as L,
|
|
465
|
+
M as P,
|
|
466
|
+
et as T,
|
|
467
|
+
Ye as a,
|
|
468
|
+
$t as b,
|
|
469
|
+
$ as c
|
|
470
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as p, Fragment as H } from "react/jsx-runtime";
|
|
2
|
-
import { u as R,
|
|
2
|
+
import { u as R, m as J, c as q, P as G } from "./state-DsXKwImw.js";
|
|
3
3
|
import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import I from "@arcblock/ux/lib/Toast";
|
|
5
5
|
import { Warning as F, Sync as Q, VisibilityOff as U } from "@mui/icons-material";
|
|
@@ -9,7 +9,8 @@ import { produce as oe } from "immer";
|
|
|
9
9
|
import N from "lodash/difference";
|
|
10
10
|
import { useState as D, useMemo as j, useCallback as L, forwardRef as se, useImperativeHandle as le, useEffect as ce } from "react";
|
|
11
11
|
import { useAsync as ae } from "react-use";
|
|
12
|
-
import {
|
|
12
|
+
import { L as de } from "./home-BBfstt15.js";
|
|
13
|
+
import { p as ue, g as me } from "./array-C85JziT_.js";
|
|
13
14
|
function ge(r) {
|
|
14
15
|
const [a, y] = D(!1);
|
|
15
16
|
return /* @__PURE__ */ e(
|
|
@@ -122,7 +123,7 @@ function he() {
|
|
|
122
123
|
);
|
|
123
124
|
return { dialog: y, showDialog: d, closeDialog: n };
|
|
124
125
|
}
|
|
125
|
-
const
|
|
126
|
+
const je = se(({ mode: r, state: a }, y) => {
|
|
126
127
|
const { t: n } = V(), [d, g] = D(!1), { dialog: u, showDialog: T } = he(), h = R(), f = L(
|
|
127
128
|
(P) => {
|
|
128
129
|
let t = [];
|
|
@@ -150,7 +151,7 @@ const Ie = se(({ mode: r, state: a }, y) => {
|
|
|
150
151
|
}
|
|
151
152
|
localStorage.setItem(q(h ?? ""), String((/* @__PURE__ */ new Date()).getTime())), g(!0);
|
|
152
153
|
try {
|
|
153
|
-
await
|
|
154
|
+
await ue({ mode: r, pages: t }), I.success(n("maker.publishSuccessMessage"));
|
|
154
155
|
} catch (m) {
|
|
155
156
|
throw I.error(m.message), m;
|
|
156
157
|
} finally {
|
|
@@ -192,7 +193,7 @@ function fe({
|
|
|
192
193
|
}) {
|
|
193
194
|
const { t: d, locale: g } = V(), [u, T] = D(!1), [h, f] = D(
|
|
194
195
|
() => n ? Object.fromEntries(n.map((i) => [i, !0])) : {}
|
|
195
|
-
), { loading: w, error: P, value: t } = ae(() =>
|
|
196
|
+
), { loading: w, error: P, value: t } = ae(() => me({ mode: a }), [a]);
|
|
196
197
|
if (P)
|
|
197
198
|
throw P;
|
|
198
199
|
const k = j(() => JSON.parse(JSON.stringify(r.pageIds)).sort((l, b) => {
|
|
@@ -223,7 +224,7 @@ function fe({
|
|
|
223
224
|
}, [h]);
|
|
224
225
|
return ce(() => {
|
|
225
226
|
y(u ? null : Object.keys(h));
|
|
226
|
-
}, [u, h, y]), w ? /* @__PURE__ */ e(
|
|
227
|
+
}, [u, h, y]), w ? /* @__PURE__ */ e(de, { sx: { my: 4 } }) : /* @__PURE__ */ p(te, { disablePadding: !0, sx: { maxWidth: 500 }, children: [
|
|
227
228
|
/* @__PURE__ */ e(S, { sx: { position: "sticky", top: 0, bgcolor: "background.paper", zIndex: 1 }, disablePadding: !0, children: /* @__PURE__ */ p(O, { onClick: A, dense: !0, children: [
|
|
228
229
|
/* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(W, { edge: "start", checked: u, tabIndex: -1 }) }),
|
|
229
230
|
/* @__PURE__ */ e(C, { primary: d("common.all") })
|
|
@@ -277,5 +278,5 @@ function fe({
|
|
|
277
278
|
] });
|
|
278
279
|
}
|
|
279
280
|
export {
|
|
280
|
-
|
|
281
|
+
je as default
|
|
281
282
|
};
|