@blocklet/pages-kit-inner-components 0.6.38 → 0.6.39
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/{components-CacZMc0_.js → components-D1oFQM3W.js} +3 -3
- package/lib/cjs/chunks/home-DeAzY6p9.js +39 -0
- package/lib/cjs/chunks/index-aDzdRTp1.js +475 -0
- package/lib/cjs/chunks/{publish-button-CxPaQCVl.js → publish-button-BuApNQWc.js} +1 -1
- package/lib/cjs/chunks/site-state-CIj4DvXS.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +1 -1
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/add-component.js +1 -1
- package/lib/es/chunks/{components-BWQM8y6L.js → components-6zI6vrkL.js} +32 -28
- package/lib/es/chunks/home-DaTNieOs.js +652 -0
- package/lib/es/chunks/{index-DBTbT9nm.js → index-Dm9c1YeI.js} +730 -666
- package/lib/es/chunks/{publish-button-Dd-8JzPl.js → publish-button-Tf6i5WAs.js} +2 -2
- package/lib/es/chunks/{site-state-Bx2ZDYuu.js → site-state-CxfQgHjO.js} +235 -231
- package/lib/es/components.js +3 -3
- package/lib/es/home.js +9 -8
- package/lib/es/project-html.js +1 -1
- package/lib/es/resources.js +2 -2
- package/lib/es/site-state.js +2 -2
- package/package.json +3 -3
- package/lib/cjs/chunks/home-DnAiAqUA.js +0 -39
- package/lib/cjs/chunks/index-DwXFWtCu.js +0 -475
- package/lib/cjs/chunks/site-state-8lUnv-C3.js +0 -1
- package/lib/es/chunks/home-1FD52b5s.js +0 -623
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
import { jsx as e, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { u as z, c as U, d as se, e as ie, f as le, b as ce } from "./state-DRjnlQY_.js";
|
|
3
|
+
import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
+
import V from "@arcblock/ux/lib/Result";
|
|
5
|
+
import { styled as M, useTheme as ue } from "@arcblock/ux/lib/Theme";
|
|
6
|
+
import { useHeaderState as pe } from "@blocklet/pages-kit/builtin/page/header";
|
|
7
|
+
import { useColorConvert as de } from "@blocklet/pages-kit/contexts/color";
|
|
8
|
+
import { setPageDataSource as G } from "@blocklet/pages-kit/utils/data-source";
|
|
9
|
+
import { generateParamCombinations as me } from "@blocklet/pages-kit/utils/route";
|
|
10
|
+
import ge from "@blocklet/ui-react/lib/Header";
|
|
11
|
+
import { cx as he } from "@emotion/css";
|
|
12
|
+
import { Global as q, css as K } from "@emotion/react";
|
|
13
|
+
import { Box as k, CircularProgress as fe, useTheme as Y, Button as be, Stack as ye, alpha as $ } from "@mui/material";
|
|
14
|
+
import { useReactive as J, useScroll as xe } from "ahooks";
|
|
15
|
+
import ve from "isomorphic-dompurify";
|
|
16
|
+
import R from "lodash/cloneDeep";
|
|
17
|
+
import Pe from "lodash/isEmpty";
|
|
18
|
+
import Q from "lodash/isEqual";
|
|
19
|
+
import { useRef as A, useEffect as C, lazy as X, useMemo as x, Suspense as ke, useState as we } from "react";
|
|
20
|
+
import { Helmet as Se } from "react-helmet";
|
|
21
|
+
import { useSearchParams as Z, Routes as Ce, Route as S, Navigate as Ie, ScrollRestoration as Te } from "react-router-dom";
|
|
22
|
+
import { useAsync as ee } from "react-use";
|
|
23
|
+
import { joinURL as P } from "ufo";
|
|
24
|
+
import { u as Re, S as je, i as D, P as Me, a as Oe, R as Ee, B as Le, b as te, g as Ae } from "./index-Dm9c1YeI.js";
|
|
25
|
+
import Be from "@blocklet/ui-react/lib/Footer";
|
|
26
|
+
import "webfontloader";
|
|
27
|
+
import { u as _e, a as Fe } from "./session-C72Dq8zg.js";
|
|
28
|
+
const $e = M(k)`
|
|
29
|
+
display: contents;
|
|
30
|
+
& > div > div > .MuiContainer-root {
|
|
31
|
+
max-width: unset;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
function De({ meta: t, ...o }) {
|
|
35
|
+
const s = ue(), { getPageMetaStyle: n } = Re(), r = n();
|
|
36
|
+
return /* @__PURE__ */ e(
|
|
37
|
+
$e,
|
|
38
|
+
{
|
|
39
|
+
sx: {
|
|
40
|
+
".blocklet__footer .MuiContainer-root": {
|
|
41
|
+
...r.maxWidth && {
|
|
42
|
+
maxWidth: r.maxWidth
|
|
43
|
+
},
|
|
44
|
+
...r.px && {
|
|
45
|
+
px: r.px
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
children: /* @__PURE__ */ e(
|
|
50
|
+
Be,
|
|
51
|
+
{
|
|
52
|
+
...o,
|
|
53
|
+
meta: t,
|
|
54
|
+
theme: s || {},
|
|
55
|
+
sx: {
|
|
56
|
+
// ...getPageMetaStyle(),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
let He = null;
|
|
64
|
+
function Ne(t) {
|
|
65
|
+
const o = A(null), { type: s } = t;
|
|
66
|
+
return C(() => {
|
|
67
|
+
s === "app" && o.current;
|
|
68
|
+
}, [s]), /* @__PURE__ */ e(
|
|
69
|
+
k,
|
|
70
|
+
{
|
|
71
|
+
...t,
|
|
72
|
+
ref: o,
|
|
73
|
+
sx: [
|
|
74
|
+
{
|
|
75
|
+
display: "flex",
|
|
76
|
+
flex: 1,
|
|
77
|
+
height: "100%",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
".spinner-wrapper": {
|
|
81
|
+
// 取消出现动画,减少页面撕裂感,但是有弊端,会让每次都出现一下加载 logo
|
|
82
|
+
// animation: 'unset',
|
|
83
|
+
// opacity: 1,
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
...Array.isArray(t.sx) ? t.sx : [t.sx]
|
|
87
|
+
],
|
|
88
|
+
children: s !== "app" && /* @__PURE__ */ e(fe, { size: 30 })
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function ze(t) {
|
|
93
|
+
return /* @__PURE__ */ e(Ue, { ...t });
|
|
94
|
+
}
|
|
95
|
+
const Ue = M(k)`
|
|
96
|
+
position: fixed;
|
|
97
|
+
left: 0;
|
|
98
|
+
top: 0;
|
|
99
|
+
z-index: 999999999999;
|
|
100
|
+
width: 80px;
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
text-align: center;
|
|
103
|
+
opacity: 0.7;
|
|
104
|
+
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
`, We = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
107
|
+
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;
|
|
108
|
+
function Ve({
|
|
109
|
+
titleFontFamily: t,
|
|
110
|
+
descriptionFontFamily: o
|
|
111
|
+
}) {
|
|
112
|
+
const n = Y()?.typography?.fontFamily;
|
|
113
|
+
C(() => {
|
|
114
|
+
}, [t, o]);
|
|
115
|
+
const r = `${n}, ${We}`;
|
|
116
|
+
return /* @__PURE__ */ e(
|
|
117
|
+
q,
|
|
118
|
+
{
|
|
119
|
+
styles: K`
|
|
120
|
+
#app {
|
|
121
|
+
font-family: ${r};
|
|
122
|
+
|
|
123
|
+
.page-kit-section__title {
|
|
124
|
+
font-family: ${r};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.page-kit-section__description {
|
|
128
|
+
font-family: ${r};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
function H(t) {
|
|
136
|
+
return t != null;
|
|
137
|
+
}
|
|
138
|
+
function Tt() {
|
|
139
|
+
const [t] = Z(), { session: o } = _e(), s = Fe("owner", "admin", "pagesEditor", "member"), n = x(() => {
|
|
140
|
+
const a = t.get("mode");
|
|
141
|
+
return je.includes(a) ? a : "production";
|
|
142
|
+
}, [t]), r = n === "production" ? n : o.user ? s ? n : "production" : null;
|
|
143
|
+
return r ? /* @__PURE__ */ e(Ge, { mode: r }) : null;
|
|
144
|
+
}
|
|
145
|
+
function Ge({ mode: t }) {
|
|
146
|
+
if (t !== "draft") {
|
|
147
|
+
const o = window.__PAGE_STATE__;
|
|
148
|
+
return o ? /* @__PURE__ */ e(L, { mode: t, state: o }) : /* @__PURE__ */ e(Ye, { mode: t, children: ({ state: s }) => /* @__PURE__ */ e(L, { mode: t, state: s }) });
|
|
149
|
+
}
|
|
150
|
+
return /* @__PURE__ */ e(Ke, { children: ({ state: o }) => /* @__PURE__ */ e(L, { mode: t, state: o }) });
|
|
151
|
+
}
|
|
152
|
+
const qe = X(() => import("./publish-button-Tf6i5WAs.js")), Ke = X(() => import("./draft-data-mNAXJMtq.js"));
|
|
153
|
+
function Ye({
|
|
154
|
+
mode: t,
|
|
155
|
+
children: o
|
|
156
|
+
}) {
|
|
157
|
+
const n = document.querySelector('meta[property="pages:version"]')?.content, r = z(), a = x(() => {
|
|
158
|
+
if (n === "{{pagesPublishedAt}}") {
|
|
159
|
+
const u = localStorage.getItem(ce(r ?? ""));
|
|
160
|
+
return Number(u) ? Number(u) : (/* @__PURE__ */ new Date()).getTime();
|
|
161
|
+
}
|
|
162
|
+
return Number(n);
|
|
163
|
+
}, [n]), { loading: p, value: c } = ee(() => Ae({ mode: t, version: a }), [t, a]);
|
|
164
|
+
return p ? /* @__PURE__ */ e(Ne, {}) : c ? o({ state: c }) : null;
|
|
165
|
+
}
|
|
166
|
+
function L({ mode: t, state: o }) {
|
|
167
|
+
const { t: s, locale: n } = W(), [r] = Z(), a = z(), p = se(), c = r.get("hiddenBadge") === "true", u = r.get("showPublish") === "true", {
|
|
168
|
+
pageIds: d,
|
|
169
|
+
pages: l,
|
|
170
|
+
routeIds: f,
|
|
171
|
+
routes: m,
|
|
172
|
+
supportedLocales: g,
|
|
173
|
+
config: { defaultLocale: y },
|
|
174
|
+
resources: w
|
|
175
|
+
} = o, b = U(o), v = x(
|
|
176
|
+
() => g?.some((h) => h.locale === n) ? n : void 0,
|
|
177
|
+
[n, g]
|
|
178
|
+
), B = Object.values(m || {}).find((h) => h?.path === "/") || Object.values(l).find((h) => h?.slug === "/") ? void 0 : Object.values(l)[0], ae = x(() => t === "production" ? d?.map((h) => {
|
|
179
|
+
const i = l[h];
|
|
180
|
+
return i && {
|
|
181
|
+
id: i.id,
|
|
182
|
+
path: P("/", p || a || "", i.slug),
|
|
183
|
+
// 是否通过 Link 跳转,如果有 sectionIds 和 sections ,那么认为是内部页面,则通过 Link 跳转
|
|
184
|
+
isLinkToPage: D(i)
|
|
185
|
+
};
|
|
186
|
+
}).filter(H) : f?.map((h) => {
|
|
187
|
+
const i = m[h];
|
|
188
|
+
return i ? {
|
|
189
|
+
id: i.id,
|
|
190
|
+
path: P("/", p || a || "", i.path, `?mode=${t}&showPublish=true`)
|
|
191
|
+
} : null;
|
|
192
|
+
}).filter(H), [d, l, t, m, f, a, p]), I = ([...h]) => (t !== "production" && u && h.unshift(
|
|
193
|
+
/* @__PURE__ */ e(ke, { fallback: /* @__PURE__ */ e("div", {}), children: /* @__PURE__ */ e(qe, { ref: { current: null }, mode: "production", state: o }) })
|
|
194
|
+
), h);
|
|
195
|
+
return /* @__PURE__ */ T(Me, { value: { pages: ae }, children: [
|
|
196
|
+
/* @__PURE__ */ T(Ce, { children: [
|
|
197
|
+
B && /* @__PURE__ */ e(S, { index: !0, element: /* @__PURE__ */ e(Ie, { to: P("/", v || "", B.slug) }) }),
|
|
198
|
+
f?.map((h) => {
|
|
199
|
+
const i = m?.[h];
|
|
200
|
+
if (!i || !i.displayTemplateId) return null;
|
|
201
|
+
const O = l[i.displayTemplateId];
|
|
202
|
+
if (!O) return null;
|
|
203
|
+
let E = [];
|
|
204
|
+
return i.params && i.params.length > 0 && (E = me({
|
|
205
|
+
basePath: i.path,
|
|
206
|
+
params: i.params,
|
|
207
|
+
routeId: i.id,
|
|
208
|
+
paramsOptions: i.paramsOptions,
|
|
209
|
+
currentIndex: 0,
|
|
210
|
+
currentParams: [],
|
|
211
|
+
currentOptionIds: [],
|
|
212
|
+
result: []
|
|
213
|
+
})?.map((_) => {
|
|
214
|
+
const F = _.paramOptionIds.join("-");
|
|
215
|
+
return /* @__PURE__ */ e(
|
|
216
|
+
S,
|
|
217
|
+
{
|
|
218
|
+
path: P(":projectIdOrSlug?", _.path),
|
|
219
|
+
element: /* @__PURE__ */ e(
|
|
220
|
+
N,
|
|
221
|
+
{
|
|
222
|
+
mode: t,
|
|
223
|
+
components: b,
|
|
224
|
+
page: O,
|
|
225
|
+
locale: v,
|
|
226
|
+
defaultLocale: y,
|
|
227
|
+
headerAddons: I,
|
|
228
|
+
state: o,
|
|
229
|
+
pageData: i.dataSource?.pathDataMappings?.[F]?.dataCache?.[v || y || "en"]
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
},
|
|
233
|
+
F
|
|
234
|
+
);
|
|
235
|
+
})), E.push(
|
|
236
|
+
/* @__PURE__ */ e(
|
|
237
|
+
S,
|
|
238
|
+
{
|
|
239
|
+
path: P(":projectIdOrSlug?", i.path),
|
|
240
|
+
element: /* @__PURE__ */ e(
|
|
241
|
+
N,
|
|
242
|
+
{
|
|
243
|
+
mode: t,
|
|
244
|
+
components: b,
|
|
245
|
+
page: O,
|
|
246
|
+
locale: v,
|
|
247
|
+
defaultLocale: y,
|
|
248
|
+
headerAddons: I,
|
|
249
|
+
state: o,
|
|
250
|
+
pageData: i.dataSource?.pathDataMappings?.[i.id]?.dataCache?.[v || y || "en"]
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
},
|
|
254
|
+
i.id
|
|
255
|
+
)
|
|
256
|
+
), E;
|
|
257
|
+
}),
|
|
258
|
+
d?.map((h) => {
|
|
259
|
+
const i = l[h];
|
|
260
|
+
return !i || !D(i) ? null : /* @__PURE__ */ e(
|
|
261
|
+
S,
|
|
262
|
+
{
|
|
263
|
+
path: P(":projectIdOrSlug?", i.slug),
|
|
264
|
+
element: /* @__PURE__ */ e(
|
|
265
|
+
j,
|
|
266
|
+
{
|
|
267
|
+
mode: t,
|
|
268
|
+
components: b,
|
|
269
|
+
page: i,
|
|
270
|
+
locale: v,
|
|
271
|
+
defaultLocale: y,
|
|
272
|
+
headerAddons: I
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
},
|
|
276
|
+
i.id
|
|
277
|
+
);
|
|
278
|
+
}),
|
|
279
|
+
w?.pages && Object.values(w?.pages)?.map(({ blockletId: h, page: i }) => /* @__PURE__ */ e(
|
|
280
|
+
S,
|
|
281
|
+
{
|
|
282
|
+
path: P("/", `@${h}`, i.slug),
|
|
283
|
+
element: /* @__PURE__ */ e(
|
|
284
|
+
j,
|
|
285
|
+
{
|
|
286
|
+
mode: t,
|
|
287
|
+
components: b,
|
|
288
|
+
page: i,
|
|
289
|
+
locale: v,
|
|
290
|
+
defaultLocale: y,
|
|
291
|
+
headerAddons: I
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
},
|
|
295
|
+
i.id
|
|
296
|
+
)),
|
|
297
|
+
/* @__PURE__ */ e(
|
|
298
|
+
S,
|
|
299
|
+
{
|
|
300
|
+
path: "*",
|
|
301
|
+
element: /* @__PURE__ */ e(
|
|
302
|
+
k,
|
|
303
|
+
{
|
|
304
|
+
sx: {
|
|
305
|
+
width: "100vw",
|
|
306
|
+
height: "100vh",
|
|
307
|
+
display: "flex",
|
|
308
|
+
justifyContent: "center",
|
|
309
|
+
alignItems: "center"
|
|
310
|
+
},
|
|
311
|
+
children: /* @__PURE__ */ e(
|
|
312
|
+
V,
|
|
313
|
+
{
|
|
314
|
+
status: 404,
|
|
315
|
+
extra: /* @__PURE__ */ e(re, { href: "/", children: s("common.back") }),
|
|
316
|
+
sx: {
|
|
317
|
+
bgcolor: "transparent",
|
|
318
|
+
width: "100%",
|
|
319
|
+
height: "100%"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
)
|
|
327
|
+
] }),
|
|
328
|
+
t !== "production" && !c && /* @__PURE__ */ e(ze, { sx: { bgcolor: "info.light" }, children: t }),
|
|
329
|
+
/* @__PURE__ */ e(Ve, {})
|
|
330
|
+
] });
|
|
331
|
+
}
|
|
332
|
+
function N({
|
|
333
|
+
mode: t,
|
|
334
|
+
pageData: o,
|
|
335
|
+
components: s,
|
|
336
|
+
page: n,
|
|
337
|
+
locale: r,
|
|
338
|
+
defaultLocale: a,
|
|
339
|
+
headerAddons: p,
|
|
340
|
+
state: c
|
|
341
|
+
}) {
|
|
342
|
+
const u = J({
|
|
343
|
+
page: null
|
|
344
|
+
});
|
|
345
|
+
C(() => {
|
|
346
|
+
const l = n || null;
|
|
347
|
+
l ? u.page = R(l) : u.page = null;
|
|
348
|
+
}, [n, JSON.stringify(n), u]);
|
|
349
|
+
const d = A(void 0);
|
|
350
|
+
return C(() => {
|
|
351
|
+
Q(o, d.current) || o && u.page && (G(u.page, c, r, o), d.current = R(o));
|
|
352
|
+
}, [u.page, o, r, c]), u.page ? /* @__PURE__ */ e(
|
|
353
|
+
j,
|
|
354
|
+
{
|
|
355
|
+
mode: t,
|
|
356
|
+
components: s,
|
|
357
|
+
page: u.page,
|
|
358
|
+
locale: r,
|
|
359
|
+
defaultLocale: a,
|
|
360
|
+
headerAddons: p
|
|
361
|
+
}
|
|
362
|
+
) : null;
|
|
363
|
+
}
|
|
364
|
+
function Rt({
|
|
365
|
+
mode: t,
|
|
366
|
+
state: o,
|
|
367
|
+
path: s,
|
|
368
|
+
pageData: n
|
|
369
|
+
}) {
|
|
370
|
+
const { t: r, locale: a } = W(), {
|
|
371
|
+
pages: p,
|
|
372
|
+
supportedLocales: c,
|
|
373
|
+
config: { defaultLocale: u },
|
|
374
|
+
resources: d
|
|
375
|
+
} = o, l = Object.values(p).find((b) => b?.slug === s), f = Object.values(d?.pages || {}).find((b) => b.page.slug === s), m = x(
|
|
376
|
+
() => c?.some((b) => b.locale === a) ? a : void 0,
|
|
377
|
+
[a, c]
|
|
378
|
+
), g = J({
|
|
379
|
+
page: null
|
|
380
|
+
});
|
|
381
|
+
C(() => {
|
|
382
|
+
const b = l || f?.page || null;
|
|
383
|
+
b ? g.page = R(b) : g.page = null;
|
|
384
|
+
}, [l, f]);
|
|
385
|
+
const y = A(void 0);
|
|
386
|
+
if (C(() => {
|
|
387
|
+
Q(n, y.current) || n && g.page && (G(g.page, o, m, n), y.current = R(n));
|
|
388
|
+
}, [{}]), !l && !f?.page)
|
|
389
|
+
return /* @__PURE__ */ e(
|
|
390
|
+
k,
|
|
391
|
+
{
|
|
392
|
+
sx: {
|
|
393
|
+
width: "100vw",
|
|
394
|
+
height: "100vh",
|
|
395
|
+
display: "flex",
|
|
396
|
+
justifyContent: "center",
|
|
397
|
+
alignItems: "center"
|
|
398
|
+
},
|
|
399
|
+
children: /* @__PURE__ */ e(V, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ e(re, { href: "/", children: r("common.back") }) })
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
const w = U(o);
|
|
403
|
+
return g.page ? /* @__PURE__ */ e(
|
|
404
|
+
j,
|
|
405
|
+
{
|
|
406
|
+
mode: t,
|
|
407
|
+
components: w,
|
|
408
|
+
page: g.page,
|
|
409
|
+
locale: m,
|
|
410
|
+
defaultLocale: u
|
|
411
|
+
}
|
|
412
|
+
) : null;
|
|
413
|
+
}
|
|
414
|
+
function j({
|
|
415
|
+
mode: t,
|
|
416
|
+
components: o,
|
|
417
|
+
page: s,
|
|
418
|
+
locale: n,
|
|
419
|
+
defaultLocale: r,
|
|
420
|
+
headerAddons: a
|
|
421
|
+
}) {
|
|
422
|
+
const p = de(), c = s.locales?.[n] ?? s.locales?.[r] ?? {}, u = c.title || window.blocklet?.appName, d = c.description || window.blocklet?.appDescription, l = ie(le(c.image), 540);
|
|
423
|
+
return /* @__PURE__ */ T(Oe, { page: s, defaultLocale: r, currentLocale: n, children: [
|
|
424
|
+
/* @__PURE__ */ e(
|
|
425
|
+
q,
|
|
426
|
+
{
|
|
427
|
+
styles: K`
|
|
428
|
+
body {
|
|
429
|
+
background-color: ${p(
|
|
430
|
+
!c.backgroundColor || c.backgroundColor === "transparent" ? "background.default" : c.backgroundColor
|
|
431
|
+
)} !important;
|
|
432
|
+
}
|
|
433
|
+
`
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
/* @__PURE__ */ e(Je, { meta: c, headerAddons: a }),
|
|
437
|
+
/* @__PURE__ */ e(Te, {}),
|
|
438
|
+
/* @__PURE__ */ T(Se, { children: [
|
|
439
|
+
/* @__PURE__ */ e("title", { children: u }),
|
|
440
|
+
/* @__PURE__ */ e("meta", { name: "og:title", content: u }),
|
|
441
|
+
/* @__PURE__ */ e("meta", { name: "og:description", content: d }),
|
|
442
|
+
/* @__PURE__ */ e("meta", { name: "og:image", content: l }),
|
|
443
|
+
/* @__PURE__ */ e("meta", { name: "twitter:image:src", content: l }),
|
|
444
|
+
/* @__PURE__ */ e("meta", { name: "twitter:image", content: l }),
|
|
445
|
+
/* @__PURE__ */ e("meta", { property: "twitter:description", content: d }),
|
|
446
|
+
/* @__PURE__ */ e("meta", { property: "twitter:title", content: u }),
|
|
447
|
+
/* @__PURE__ */ e("meta", { name: "description", content: d })
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ e(
|
|
450
|
+
ye,
|
|
451
|
+
{
|
|
452
|
+
className: "PageView-root",
|
|
453
|
+
sx: {
|
|
454
|
+
flexGrow: 1,
|
|
455
|
+
// 第一个 .BlockBase-root 的 pt 为 0
|
|
456
|
+
"& .BlockBase-root:first-child": {
|
|
457
|
+
pt: "0 !important"
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
children: /* @__PURE__ */ e(Ee, { children: s?.sectionIds?.map((f, m) => {
|
|
461
|
+
const g = s.sections[f];
|
|
462
|
+
if (!g || g.visibility === "hidden") return null;
|
|
463
|
+
const y = s.dataSource?.[f]?.[n], w = s.dataSource?.[f]?.[r] ?? {};
|
|
464
|
+
return /* @__PURE__ */ e(k, { sx: { position: "relative" }, children: /* @__PURE__ */ e(
|
|
465
|
+
Le,
|
|
466
|
+
{
|
|
467
|
+
id: f,
|
|
468
|
+
type: g.component,
|
|
469
|
+
mode: t,
|
|
470
|
+
section: g,
|
|
471
|
+
config: {
|
|
472
|
+
...Pe(y) ? w : y,
|
|
473
|
+
locale: n,
|
|
474
|
+
dev: t === "draft" ? {
|
|
475
|
+
mode: t,
|
|
476
|
+
components: o,
|
|
477
|
+
defaultLocale: r
|
|
478
|
+
} : {
|
|
479
|
+
mode: t,
|
|
480
|
+
defaultLocale: r
|
|
481
|
+
// 用于 fallback 的 locale
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
page: s,
|
|
485
|
+
renderIndex: m
|
|
486
|
+
},
|
|
487
|
+
f
|
|
488
|
+
) }, f);
|
|
489
|
+
}) })
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
!c.footer?.hidden && /* @__PURE__ */ e(De, {})
|
|
493
|
+
] });
|
|
494
|
+
}
|
|
495
|
+
const oe = M(ge)`
|
|
496
|
+
&.sticky {
|
|
497
|
+
position: sticky;
|
|
498
|
+
top: 0;
|
|
499
|
+
}
|
|
500
|
+
`;
|
|
501
|
+
function Je({ meta: t, headerAddons: o }) {
|
|
502
|
+
const { logo: s, brand: n, description: r, ...a } = pe(), p = te(), c = x(
|
|
503
|
+
() => (d) => {
|
|
504
|
+
let l = o?.(d) ?? d;
|
|
505
|
+
return l = a.addons?.(l) ?? l, l;
|
|
506
|
+
},
|
|
507
|
+
[a.addons, o]
|
|
508
|
+
), u = x(
|
|
509
|
+
() => t.header?.translucent ? Qe : oe,
|
|
510
|
+
[t.header?.translucent]
|
|
511
|
+
);
|
|
512
|
+
return /* @__PURE__ */ e(
|
|
513
|
+
u,
|
|
514
|
+
{
|
|
515
|
+
hideNavMenu: !!t.header?.hideNavMenus,
|
|
516
|
+
translucentTextColor: t.header?.translucentTextColor,
|
|
517
|
+
...s ? { logo: /* @__PURE__ */ e(ne, { logo: s }) } : {},
|
|
518
|
+
...n ? { brand: n } : {},
|
|
519
|
+
...r ? { description: r } : {},
|
|
520
|
+
className: he(t.header?.sticky && "sticky", "page-header"),
|
|
521
|
+
maxWidth: !1,
|
|
522
|
+
addons: c,
|
|
523
|
+
sx: {
|
|
524
|
+
".header-logo": {
|
|
525
|
+
display: p ? "none !important" : "inline-flex",
|
|
526
|
+
alignItems: "center"
|
|
527
|
+
},
|
|
528
|
+
".header-brand-wrapper": {
|
|
529
|
+
display: p ? "none !important" : "flex"
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
function ne({ logo: t }) {
|
|
536
|
+
const [o, s] = we(), n = te(), { value: r } = ee(() => {
|
|
537
|
+
const a = new URL(
|
|
538
|
+
n ? window?.blocklet?.appLogo || "/.well-known/service/blocklet/logo" : window?.blocklet?.appLogoRect || "/.well-known/service/blocklet/logo-rect",
|
|
539
|
+
window.location.origin
|
|
540
|
+
);
|
|
541
|
+
a.searchParams.delete("imageFilter"), a.searchParams.delete("f");
|
|
542
|
+
const p = a.toString();
|
|
543
|
+
return new Promise((c) => {
|
|
544
|
+
fetch(p).then((u) => {
|
|
545
|
+
u.headers.get("content-type")?.includes("svg") && u.text().then((l) => {
|
|
546
|
+
s(l), c(null);
|
|
547
|
+
}), c(u.url);
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
}, [n]);
|
|
551
|
+
if (n)
|
|
552
|
+
return null;
|
|
553
|
+
if (t)
|
|
554
|
+
return t;
|
|
555
|
+
if (o)
|
|
556
|
+
return /* @__PURE__ */ e(k, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: ve.sanitize(o) } });
|
|
557
|
+
if (r) {
|
|
558
|
+
const a = new URL(r);
|
|
559
|
+
a.searchParams.set("imageFilter", "convert"), a.searchParams.set("f", "png"), a.searchParams.set("h", "80");
|
|
560
|
+
const p = a.toString();
|
|
561
|
+
return /* @__PURE__ */ e("img", { src: p, alt: "logo" });
|
|
562
|
+
}
|
|
563
|
+
return null;
|
|
564
|
+
}
|
|
565
|
+
function Qe({
|
|
566
|
+
logo: t,
|
|
567
|
+
translucentTextColor: o,
|
|
568
|
+
...s
|
|
569
|
+
}) {
|
|
570
|
+
const r = xe(document.getElementById("app"), (m) => m.top < 1200), a = Y(), p = a.palette.mode === "dark", c = Math.min(r?.top ?? 0, 800), u = x(() => {
|
|
571
|
+
let m = Math.min(c / 800, 1), g = "";
|
|
572
|
+
return m > 0.1 ? (m = Math.max(m, 0.6), g = $(a.palette.text.primary, m)) : g = o || "#EEEEEE", {
|
|
573
|
+
backgroundOpacity: m,
|
|
574
|
+
textColor: g,
|
|
575
|
+
isReversed: m < 0.7
|
|
576
|
+
};
|
|
577
|
+
}, [c, 800, a.palette.text.primary, o]), { backgroundOpacity: d, textColor: l, isReversed: f } = u;
|
|
578
|
+
return /* @__PURE__ */ e(
|
|
579
|
+
oe,
|
|
580
|
+
{
|
|
581
|
+
logo: /* @__PURE__ */ e(ne, { logo: t }),
|
|
582
|
+
...s,
|
|
583
|
+
sx: {
|
|
584
|
+
// 基础布局和定位
|
|
585
|
+
position: "fixed !important",
|
|
586
|
+
top: 0,
|
|
587
|
+
left: 0,
|
|
588
|
+
right: 0,
|
|
589
|
+
zIndex: a.zIndex.appBar,
|
|
590
|
+
// 确保在顶层
|
|
591
|
+
backgroundColor: "transparent !important",
|
|
592
|
+
// 主元素始终透明
|
|
593
|
+
// 使用伪元素作为背景层
|
|
594
|
+
"&::before": {
|
|
595
|
+
content: '""',
|
|
596
|
+
position: "absolute",
|
|
597
|
+
top: 0,
|
|
598
|
+
left: 0,
|
|
599
|
+
right: 0,
|
|
600
|
+
bottom: 0,
|
|
601
|
+
zIndex: -1,
|
|
602
|
+
// 置于内容下方
|
|
603
|
+
// 背景样式(颜色和模糊)是固定的
|
|
604
|
+
backgroundColor: $(a.palette.background.default, d),
|
|
605
|
+
backdropFilter: d >= 0.6 ? "blur(10px)" : "blur(0px)",
|
|
606
|
+
// **性能关键**: 只对 opacity 进行动画
|
|
607
|
+
// opacity: backgroundOpacity,
|
|
608
|
+
// 让 CSS 平滑地处理透明度变化
|
|
609
|
+
transition: "backgroundColor 0.3s ease-in-out"
|
|
610
|
+
},
|
|
611
|
+
// --- 文字和图标颜色过渡 ---
|
|
612
|
+
// 直接为 Header 内所有相关元素设置颜色和过渡
|
|
613
|
+
// color: textColor,
|
|
614
|
+
transition: "color 0.3s ease-in-out",
|
|
615
|
+
// 覆盖子组件的颜色,使其继承父级的 `color`
|
|
616
|
+
".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
|
|
617
|
+
color: `${l} !important`
|
|
618
|
+
// 使用 inherit 来同步颜色
|
|
619
|
+
},
|
|
620
|
+
".header-logo, .header-menu": {
|
|
621
|
+
color: `${l} !important`
|
|
622
|
+
},
|
|
623
|
+
"& .navmenu--horizontal": {
|
|
624
|
+
bgcolor: "transparent !important"
|
|
625
|
+
},
|
|
626
|
+
".header-addons *": {
|
|
627
|
+
borderColor: `${l} !important`
|
|
628
|
+
},
|
|
629
|
+
// --- Logo 反色效果 ---
|
|
630
|
+
// filter 也是一个较昂贵的属性,但其影响远小于背景色的重绘
|
|
631
|
+
// 这里的逻辑保持不变,但可以考虑是否有更优的方案(如提供两个颜色的 Logo)
|
|
632
|
+
".header-logo > div": {
|
|
633
|
+
// 暗黑模式不做反转
|
|
634
|
+
filter: p ? "unset" : `invert(${f ? 1 : 0})`,
|
|
635
|
+
transition: "filter 0.3s ease-in-out"
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
const re = M(be)``;
|
|
642
|
+
export {
|
|
643
|
+
Tt as H,
|
|
644
|
+
Ne as L,
|
|
645
|
+
L as P,
|
|
646
|
+
Qe as T,
|
|
647
|
+
Ge as a,
|
|
648
|
+
N as b,
|
|
649
|
+
Rt as c,
|
|
650
|
+
j as d,
|
|
651
|
+
Je as e
|
|
652
|
+
};
|