@blocklet/pages-kit-inner-components 0.5.56 → 0.6.1

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