@blocklet/pages-kit-inner-components 0.6.24 → 0.6.26

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.
@@ -2,42 +2,42 @@ import { jsx as e, jsxs as R } from "react/jsx-runtime";
2
2
  import { u as z, c as U, d as re, e as ae, f as se, b as ie } from "./state-DSo43FAB.js";
3
3
  import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
4
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";
5
+ import { styled as M, useTheme as le } from "@arcblock/ux/lib/Theme";
6
+ import { useHeaderState as ce } from "@blocklet/pages-kit/builtin/page/header";
7
7
  import { useColorConvert as ue } from "@blocklet/pages-kit/contexts/color";
8
8
  import { setPageDataSource as W } from "@blocklet/pages-kit/utils/data-source";
9
9
  import { generateParamCombinations as pe } from "@blocklet/pages-kit/utils/route";
10
10
  import de from "@blocklet/ui-react/lib/Header";
11
11
  import { cx as me } from "@emotion/css";
12
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";
13
+ import { Box as w, CircularProgress as ge, useTheme as Y, Button as he, Stack as fe, alpha as $, useMediaQuery as be } from "@mui/material";
14
14
  import { useReactive as J, useScroll as ye } from "ahooks";
15
15
  import ve from "isomorphic-dompurify";
16
16
  import O from "lodash/cloneDeep";
17
17
  import xe from "lodash/isEmpty";
18
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";
19
+ import { useEffect as T, lazy as X, useMemo as P, useRef as Z, Suspense as Pe, useState as ke } from "react";
20
+ import { Helmet as we } from "react-helmet";
21
+ import { useSearchParams as ee, Routes as Se, Route as C, Navigate as Ce, ScrollRestoration as Ie } from "react-router-dom";
22
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-MrU6URFS.js";
23
+ import { joinURL as k } from "ufo";
24
+ import { S as Te, P as je, a as Re, B as Oe, g as Ee } from "./index-CaKPHd8j.js";
25
25
  import Me from "@blocklet/ui-react/lib/Footer";
26
26
  import "webfontloader";
27
27
  import { u as Ae, a as Be } from "./session-C72Dq8zg.js";
28
- const Le = M(C)`
28
+ const Le = M(w)`
29
29
  display: contents;
30
30
  & > div > div > .MuiContainer-root {
31
31
  max-width: unset;
32
32
  }
33
33
  `;
34
34
  function Fe({ meta: t, ...o }) {
35
- const c = ce();
36
- return /* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(Me, { ...o, meta: t, theme: c || {} }) });
35
+ const l = le();
36
+ return /* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(Me, { ...o, meta: t, theme: l || {} }) });
37
37
  }
38
- function _e(t) {
38
+ function De(t) {
39
39
  return /* @__PURE__ */ e(
40
- C,
40
+ w,
41
41
  {
42
42
  ...t,
43
43
  sx: [
@@ -54,10 +54,10 @@ function _e(t) {
54
54
  }
55
55
  );
56
56
  }
57
- function $e(t) {
58
- return /* @__PURE__ */ e(De, { ...t });
57
+ function _e(t) {
58
+ return /* @__PURE__ */ e($e, { ...t });
59
59
  }
60
- const De = M(C)`
60
+ const $e = M(w)`
61
61
  position: fixed;
62
62
  left: 0;
63
63
  top: 0;
@@ -77,20 +77,20 @@ function He({
77
77
  const r = Y()?.typography?.fontFamily;
78
78
  T(() => {
79
79
  }, [t, o]);
80
- const s = `${r}, ${Ne}`;
80
+ const i = `${r}, ${Ne}`;
81
81
  return /* @__PURE__ */ e(
82
82
  q,
83
83
  {
84
84
  styles: K`
85
85
  #app {
86
- font-family: ${s};
86
+ font-family: ${i};
87
87
 
88
88
  .page-kit-section__title {
89
- font-family: ${s};
89
+ font-family: ${i};
90
90
  }
91
91
 
92
92
  .page-kit-section__description {
93
- font-family: ${s};
93
+ font-family: ${i};
94
94
  }
95
95
  }
96
96
  `
@@ -100,66 +100,66 @@ function He({
100
100
  function N(t) {
101
101
  return t != null;
102
102
  }
103
- function wt() {
104
- const [t] = ee(), { session: o } = Ae(), c = Be("owner", "admin", "pagesEditor", "member"), r = P(() => {
103
+ function kt() {
104
+ const [t] = ee(), { session: o } = Ae(), l = Be("owner", "admin", "pagesEditor", "member"), r = P(() => {
105
105
  const n = t.get("mode");
106
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;
107
+ }, [t]), i = r === "production" ? r : o.user ? l ? r : "production" : null;
108
+ return i ? /* @__PURE__ */ e(ze, { mode: i }) : null;
109
109
  }
110
110
  function ze({ mode: t }) {
111
111
  if (t !== "draft") {
112
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 }) });
113
+ return o ? /* @__PURE__ */ e(F, { mode: t, state: o }) : /* @__PURE__ */ e(Ge, { mode: t, children: ({ state: l }) => /* @__PURE__ */ e(F, { mode: t, state: l }) });
114
114
  }
115
115
  return /* @__PURE__ */ e(Ve, { children: ({ state: o }) => /* @__PURE__ */ e(F, { mode: t, state: o }) });
116
116
  }
117
- const Ue = X(() => import("./publish-button-CaPZ_kmc.js")), Ve = X(() => import("./draft-data-CpCuyq4R.js"));
117
+ const Ue = X(() => import("./publish-button-BvvRgazT.js")), Ve = X(() => import("./draft-data-CpCuyq4R.js"));
118
118
  function Ge({
119
119
  mode: t,
120
120
  children: o
121
121
  }) {
122
- const r = document.querySelector('meta[property="pages:version"]')?.content, s = z(), n = P(() => {
122
+ const r = document.querySelector('meta[property="pages:version"]')?.content, i = z(), n = P(() => {
123
123
  if (r === "{{pagesPublishedAt}}") {
124
- const l = localStorage.getItem(ie(s ?? ""));
125
- return Number(l) ? Number(l) : (/* @__PURE__ */ new Date()).getTime();
124
+ const c = localStorage.getItem(ie(i ?? ""));
125
+ return Number(c) ? Number(c) : (/* @__PURE__ */ new Date()).getTime();
126
126
  }
127
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;
128
+ }, [r]), { loading: m, value: s } = te(() => Ee({ mode: t, version: n }), [t, n]);
129
+ return m ? /* @__PURE__ */ e(De, {}) : s ? o({ state: s }) : null;
130
130
  }
131
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,
132
+ const { t: l, locale: r } = V(), [i] = ee(), n = z(), m = re(), s = i.get("hiddenBadge") === "true", c = i.get("showPublish") === "true", {
133
+ pageIds: h,
134
134
  pages: u,
135
- routeIds: p,
136
- routes: b,
137
- supportedLocales: y,
135
+ routeIds: y,
136
+ routes: p,
137
+ supportedLocales: f,
138
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];
139
+ resources: S
140
+ } = o, b = U(o), g = P(
141
+ () => f?.some((d) => d.locale === r) ? r : void 0,
142
+ [r, f]
143
+ ), I = Object.values(p || {}).find((d) => d?.path === "/") || Object.values(u).find((d) => d?.slug === "/") ? void 0 : Object.values(u)[0], A = P(() => t === "production" ? h.map((d) => {
144
+ const a = u[d];
145
145
  return a && {
146
146
  id: a.id,
147
- path: w("/", d || n || "", a.slug)
147
+ path: k("/", m || n || "", a.slug)
148
148
  };
149
- }).filter(N) : p.map((m) => {
150
- const a = b[m];
149
+ }).filter(N) : y.map((d) => {
150
+ const a = p[d];
151
151
  return a ? {
152
152
  id: a.id,
153
- path: w("/", d || n || "", a.path, `?mode=${t}&showPublish=true`)
153
+ path: k("/", m || n || "", a.path, `?mode=${t}&showPublish=true`)
154
154
  } : null;
155
- }).filter(N), [g, u, t, b, p, n, d]), j = ([...m]) => (t !== "production" && l && m.unshift(
155
+ }).filter(N), [h, u, t, p, y, n, m]), j = ([...d]) => (t !== "production" && c && d.unshift(
156
156
  /* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e("div", {}), children: /* @__PURE__ */ e(Ue, { ref: { current: null }, mode: "production", state: o }) })
157
- ), m);
157
+ ), d);
158
158
  return /* @__PURE__ */ R(je, { value: { pages: A }, children: [
159
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];
160
+ I && /* @__PURE__ */ e(C, { index: !0, element: /* @__PURE__ */ e(Ce, { to: k("/", g || "", I.slug) }) }),
161
+ y?.map((d) => {
162
+ const a = p?.[d];
163
163
  if (!a || !a.displayTemplateId) return null;
164
164
  const B = u[a.displayTemplateId];
165
165
  if (!B) return null;
@@ -173,44 +173,44 @@ function F({ mode: t, state: o }) {
173
173
  currentParams: [],
174
174
  currentOptionIds: [],
175
175
  result: []
176
- })?.map((_) => {
177
- const $ = _.paramOptionIds.join("-");
176
+ })?.map((D) => {
177
+ const _ = D.paramOptionIds.join("-");
178
178
  return /* @__PURE__ */ e(
179
- S,
179
+ C,
180
180
  {
181
- path: w(":projectIdOrSlug?", _.path),
181
+ path: k(":projectIdOrSlug?", D.path),
182
182
  element: /* @__PURE__ */ e(
183
183
  H,
184
184
  {
185
185
  mode: t,
186
- components: f,
186
+ components: b,
187
187
  page: B,
188
- locale: h,
188
+ locale: g,
189
189
  defaultLocale: v,
190
190
  headerAddons: j,
191
191
  state: o,
192
- pageData: a.dataSource?.pathDataMappings?.[$]?.dataCache?.[h || v || "en"]
192
+ pageData: a.dataSource?.pathDataMappings?.[_]?.dataCache?.[g || v || "en"]
193
193
  }
194
194
  )
195
195
  },
196
- $
196
+ _
197
197
  );
198
198
  })), L.push(
199
199
  /* @__PURE__ */ e(
200
- S,
200
+ C,
201
201
  {
202
- path: w(":projectIdOrSlug?", a.path),
202
+ path: k(":projectIdOrSlug?", a.path),
203
203
  element: /* @__PURE__ */ e(
204
204
  H,
205
205
  {
206
206
  mode: t,
207
- components: f,
207
+ components: b,
208
208
  page: B,
209
- locale: h,
209
+ locale: g,
210
210
  defaultLocale: v,
211
211
  headerAddons: j,
212
212
  state: o,
213
- pageData: a.dataSource?.pathDataMappings?.[a.id]?.dataCache?.[h || v || "en"]
213
+ pageData: a.dataSource?.pathDataMappings?.[a.id]?.dataCache?.[g || v || "en"]
214
214
  }
215
215
  )
216
216
  },
@@ -218,19 +218,19 @@ function F({ mode: t, state: o }) {
218
218
  )
219
219
  ), L;
220
220
  }),
221
- g.map((m) => {
222
- const a = u[m];
221
+ h.map((d) => {
222
+ const a = u[d];
223
223
  return a ? /* @__PURE__ */ e(
224
- S,
224
+ C,
225
225
  {
226
- path: w(":projectIdOrSlug?", a.slug),
226
+ path: k(":projectIdOrSlug?", a.slug),
227
227
  element: /* @__PURE__ */ e(
228
228
  E,
229
229
  {
230
230
  mode: t,
231
- components: f,
231
+ components: b,
232
232
  page: a,
233
- locale: h,
233
+ locale: g,
234
234
  defaultLocale: v,
235
235
  headerAddons: j
236
236
  }
@@ -239,17 +239,17 @@ function F({ mode: t, state: o }) {
239
239
  a.id
240
240
  ) : null;
241
241
  }),
242
- k.pages && Object.values(k.pages).map(({ blockletId: m, page: a }) => /* @__PURE__ */ e(
243
- S,
242
+ S.pages && Object.values(S.pages).map(({ blockletId: d, page: a }) => /* @__PURE__ */ e(
243
+ C,
244
244
  {
245
- path: w("/", `@${m}`, a.slug),
245
+ path: k("/", `@${d}`, a.slug),
246
246
  element: /* @__PURE__ */ e(
247
247
  E,
248
248
  {
249
249
  mode: t,
250
- components: f,
250
+ components: b,
251
251
  page: a,
252
- locale: h,
252
+ locale: g,
253
253
  defaultLocale: v,
254
254
  headerAddons: j
255
255
  }
@@ -258,11 +258,11 @@ function F({ mode: t, state: o }) {
258
258
  a.id
259
259
  )),
260
260
  /* @__PURE__ */ e(
261
- S,
261
+ C,
262
262
  {
263
263
  path: "*",
264
264
  element: /* @__PURE__ */ e(
265
- C,
265
+ w,
266
266
  {
267
267
  sx: {
268
268
  width: "100vw",
@@ -275,7 +275,7 @@ function F({ mode: t, state: o }) {
275
275
  G,
276
276
  {
277
277
  status: 404,
278
- extra: /* @__PURE__ */ e(ne, { href: "/", children: c("common.back") }),
278
+ extra: /* @__PURE__ */ e(ne, { href: "/", children: l("common.back") }),
279
279
  sx: {
280
280
  bgcolor: "transparent",
281
281
  width: "100%",
@@ -288,69 +288,69 @@ function F({ mode: t, state: o }) {
288
288
  }
289
289
  )
290
290
  ] }),
291
- t !== "production" && !i && /* @__PURE__ */ e($e, { sx: { bgcolor: "info.light" }, children: t }),
291
+ t !== "production" && !s && /* @__PURE__ */ e(_e, { sx: { bgcolor: "info.light" }, children: t }),
292
292
  /* @__PURE__ */ e(He, {})
293
293
  ] });
294
294
  }
295
295
  function H({
296
296
  mode: t,
297
297
  pageData: o,
298
- components: c,
298
+ components: l,
299
299
  page: r,
300
- locale: s,
300
+ locale: i,
301
301
  defaultLocale: n,
302
- headerAddons: d,
303
- state: i
302
+ headerAddons: m,
303
+ state: s
304
304
  }) {
305
- const l = J({
305
+ const c = J({
306
306
  page: null
307
307
  });
308
308
  T(() => {
309
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);
310
+ u ? c.page = O(u) : c.page = null;
311
+ }, [r, JSON.stringify(r), c]);
312
+ const h = Z(void 0);
313
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(
314
+ Q(o, h.current) || o && c.page && (W(c.page, s, i, o), h.current = O(o));
315
+ }, [c.page, o, i, s]), c.page ? /* @__PURE__ */ e(
316
316
  E,
317
317
  {
318
318
  mode: t,
319
- components: c,
320
- page: l.page,
321
- locale: s,
319
+ components: l,
320
+ page: c.page,
321
+ locale: i,
322
322
  defaultLocale: n,
323
- headerAddons: d
323
+ headerAddons: m
324
324
  }
325
325
  ) : null;
326
326
  }
327
- function kt({
327
+ function wt({
328
328
  mode: t,
329
329
  state: o,
330
- path: c,
330
+ path: l,
331
331
  pageData: r
332
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({
333
+ const { t: i, locale: n } = V(), {
334
+ pages: m,
335
+ supportedLocales: s,
336
+ config: { defaultLocale: c },
337
+ resources: h
338
+ } = o, u = Object.values(m).find((b) => b?.slug === l), y = Object.values(h.pages || {}).find((b) => b.page.slug === l), p = P(
339
+ () => s?.some((b) => b.locale === n) ? n : void 0,
340
+ [n, s]
341
+ ), f = J({
342
342
  page: null
343
343
  });
344
344
  T(() => {
345
- const f = u || p?.page || null;
346
- f ? y.page = O(f) : y.page = null;
347
- }, [u, p]);
345
+ const b = u || y?.page || null;
346
+ b ? f.page = O(b) : f.page = null;
347
+ }, [u, y]);
348
348
  const v = Z(void 0);
349
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)
350
+ Q(r, v.current) || r && f.page && (W(f.page, o, p, r), v.current = O(r));
351
+ }, [{}]), !u && !y?.page)
352
352
  return /* @__PURE__ */ e(
353
- C,
353
+ w,
354
354
  {
355
355
  sx: {
356
356
  width: "100vw",
@@ -359,76 +359,76 @@ function kt({
359
359
  justifyContent: "center",
360
360
  alignItems: "center"
361
361
  },
362
- children: /* @__PURE__ */ e(G, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ e(ne, { href: "/", children: s("common.back") }) })
362
+ children: /* @__PURE__ */ e(G, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ e(ne, { href: "/", children: i("common.back") }) })
363
363
  }
364
364
  );
365
- const k = U(o);
366
- return y.page ? /* @__PURE__ */ e(
365
+ const S = U(o);
366
+ return f.page ? /* @__PURE__ */ e(
367
367
  E,
368
368
  {
369
369
  mode: t,
370
- components: k,
371
- page: y.page,
372
- locale: b,
373
- defaultLocale: l
370
+ components: S,
371
+ page: f.page,
372
+ locale: p,
373
+ defaultLocale: c
374
374
  }
375
375
  ) : null;
376
376
  }
377
377
  function E({
378
378
  mode: t,
379
379
  components: o,
380
- page: c,
380
+ page: l,
381
381
  locale: r,
382
- defaultLocale: s,
382
+ defaultLocale: i,
383
383
  headerAddons: n
384
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;
385
+ const m = ue(), s = l.locales?.[r] ?? l.locales?.[i] ?? {}, c = s.title || window.blocklet?.appName, h = s.description || window.blocklet?.appDescription, u = ae(se(s.image), 540), { logo: y, brand: p, description: f, ...v } = ce(), S = P(
386
+ () => (g) => {
387
+ let x = n?.(g) ?? g;
388
388
  return x = v.addons?.(x) ?? x, x;
389
389
  },
390
390
  [v.addons, n]
391
- ), f = P(
392
- () => i.header?.translucent ? qe : oe,
393
- [i.header?.translucent]
391
+ ), b = P(
392
+ () => s.header?.translucent ? qe : oe,
393
+ [s.header?.translucent]
394
394
  );
395
- return /* @__PURE__ */ R(Re, { page: c, defaultLocale: s, currentLocale: r, children: [
395
+ return /* @__PURE__ */ R(Re, { page: l, defaultLocale: i, currentLocale: r, children: [
396
396
  /* @__PURE__ */ e(
397
397
  q,
398
398
  {
399
399
  styles: K`
400
400
  body {
401
- background-color: ${d(
402
- !i.backgroundColor || i.backgroundColor === "transparent" ? "background.default" : i.backgroundColor
401
+ background-color: ${m(
402
+ !s.backgroundColor || s.backgroundColor === "transparent" ? "background.default" : s.backgroundColor
403
403
  )} !important;
404
404
  }
405
405
  `
406
406
  }
407
407
  ),
408
408
  /* @__PURE__ */ e(
409
- f,
409
+ b,
410
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"),
411
+ hideNavMenu: !!s.header?.hideNavMenus,
412
+ translucentTextColor: s.header?.translucentTextColor,
413
+ ...y ? { logo: y } : {},
414
+ ...p ? { brand: p } : {},
415
+ ...f ? { description: f } : {},
416
+ className: me(s.header?.sticky && "sticky", "page-header"),
417
417
  maxWidth: !1,
418
- addons: k
418
+ addons: S
419
419
  }
420
420
  ),
421
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 }),
422
+ /* @__PURE__ */ R(we, { children: [
423
+ /* @__PURE__ */ e("title", { children: c }),
424
+ /* @__PURE__ */ e("meta", { name: "og:title", content: c }),
425
+ /* @__PURE__ */ e("meta", { name: "og:description", content: h }),
426
426
  /* @__PURE__ */ e("meta", { name: "og:image", content: u }),
427
427
  /* @__PURE__ */ e("meta", { name: "twitter:image:src", content: u }),
428
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 })
429
+ /* @__PURE__ */ e("meta", { property: "twitter:description", content: h }),
430
+ /* @__PURE__ */ e("meta", { property: "twitter:title", content: c }),
431
+ /* @__PURE__ */ e("meta", { name: "description", content: h })
432
432
  ] }),
433
433
  /* @__PURE__ */ e(
434
434
  fe,
@@ -441,14 +441,14 @@ function E({
441
441
  pt: "0 !important"
442
442
  }
443
443
  },
444
- children: c.sectionIds.map((h) => {
445
- const x = c.sections[h];
444
+ children: l.sectionIds.map((g) => {
445
+ const x = l.sections[g];
446
446
  if (!x || x.visibility === "hidden") return null;
447
- const I = c.dataSource?.[h]?.[r], A = c.dataSource?.[h]?.[s] ?? {};
448
- return /* @__PURE__ */ e(
447
+ const I = l.dataSource?.[g]?.[r], A = l.dataSource?.[g]?.[i] ?? {};
448
+ return /* @__PURE__ */ e(w, { sx: { position: "relative" }, children: /* @__PURE__ */ e(
449
449
  Oe,
450
450
  {
451
- id: h,
451
+ id: g,
452
452
  type: x.component,
453
453
  mode: t,
454
454
  section: x,
@@ -458,21 +458,21 @@ function E({
458
458
  dev: t === "draft" ? {
459
459
  mode: t,
460
460
  components: o,
461
- defaultLocale: s
461
+ defaultLocale: i
462
462
  } : {
463
463
  mode: t,
464
- defaultLocale: s
464
+ defaultLocale: i
465
465
  // 用于 fallback 的 locale
466
466
  }
467
467
  },
468
- page: c
468
+ page: l
469
469
  },
470
- h
471
- );
470
+ g
471
+ ) }, g);
472
472
  })
473
473
  }
474
474
  ),
475
- !i.footer?.hidden && /* @__PURE__ */ e(Fe, {})
475
+ !s.footer?.hidden && /* @__PURE__ */ e(Fe, {})
476
476
  ] });
477
477
  }
478
478
  const oe = M(de)`
@@ -482,51 +482,51 @@ const oe = M(de)`
482
482
  }
483
483
  `;
484
484
  function We({ logo: t }) {
485
- const [o, c] = we(), r = be((n) => n.breakpoints.down("sm")), { value: s } = te(() => {
485
+ const [o, l] = ke(), r = be((n) => n.breakpoints.down("sm")), { value: i } = te(() => {
486
486
  const n = new URL(
487
487
  r ? window?.blocklet?.appLogo || "/.well-known/service/blocklet/logo" : window?.blocklet?.appLogoRect || "/.well-known/service/blocklet/logo-rect",
488
488
  window.location.origin
489
489
  );
490
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);
491
+ const m = n.toString();
492
+ return new Promise((s) => {
493
+ fetch(m).then((c) => {
494
+ c.headers.get("content-type")?.includes("svg") && c.text().then((u) => {
495
+ l(u), s(null);
496
+ }), s(c.url);
497
497
  });
498
498
  });
499
499
  }, [r]);
500
500
  if (t)
501
501
  return t;
502
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);
503
+ return /* @__PURE__ */ e(w, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: ve.sanitize(o) } });
504
+ if (i) {
505
+ const n = new URL(i);
506
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" });
507
+ const m = n.toString();
508
+ return /* @__PURE__ */ e("img", { src: m, alt: "logo" });
509
509
  }
510
510
  return null;
511
511
  }
512
512
  function qe({
513
513
  logo: t,
514
514
  translucentTextColor: o,
515
- ...c
515
+ ...l
516
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", {
517
+ const i = ye(document.getElementById("app"), (p) => p.top < 1200), n = Y(), m = n.palette.mode === "dark", s = Math.min(i?.top ?? 0, 800), c = P(() => {
518
+ let p = Math.min(s / 800, 1), f = "";
519
+ return p > 0.1 ? (p = Math.max(p, 0.6), f = $(n.palette.text.primary, p)) : f = o || "#EEEEEE", {
520
520
  backgroundOpacity: p,
521
- textColor: b,
521
+ textColor: f,
522
522
  isReversed: p < 0.7
523
523
  };
524
- }, [d, 800, n.palette.text.primary, o]), { backgroundOpacity: l, textColor: g, isReversed: u } = i;
524
+ }, [s, 800, n.palette.text.primary, o]), { backgroundOpacity: h, textColor: u, isReversed: y } = c;
525
525
  return /* @__PURE__ */ e(
526
526
  oe,
527
527
  {
528
528
  logo: /* @__PURE__ */ e(We, { logo: t }),
529
- ...c,
529
+ ...l,
530
530
  sx: {
531
531
  // 基础布局和定位
532
532
  position: "fixed !important",
@@ -548,8 +548,8 @@ function qe({
548
548
  zIndex: -1,
549
549
  // 置于内容下方
550
550
  // 背景样式(颜色和模糊)是固定的
551
- backgroundColor: D(n.palette.background.default, l),
552
- backdropFilter: l >= 0.6 ? "blur(10px)" : "blur(0px)",
551
+ backgroundColor: $(n.palette.background.default, h),
552
+ backdropFilter: h >= 0.6 ? "blur(10px)" : "blur(0px)",
553
553
  // **性能关键**: 只对 opacity 进行动画
554
554
  // opacity: backgroundOpacity,
555
555
  // 让 CSS 平滑地处理透明度变化
@@ -561,11 +561,11 @@ function qe({
561
561
  transition: "color 0.3s ease-in-out",
562
562
  // 覆盖子组件的颜色,使其继承父级的 `color`
563
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`
564
+ color: `${u} !important`
565
565
  // 使用 inherit 来同步颜色
566
566
  },
567
567
  ".header-logo": {
568
- color: `${g} !important`
568
+ color: `${u} !important`
569
569
  },
570
570
  "& .navmenu--horizontal": {
571
571
  bgcolor: "transparent !important"
@@ -574,7 +574,8 @@ function qe({
574
574
  // filter 也是一个较昂贵的属性,但其影响远小于背景色的重绘
575
575
  // 这里的逻辑保持不变,但可以考虑是否有更优的方案(如提供两个颜色的 Logo)
576
576
  ".header-logo > div": {
577
- filter: `invert(${u ? 1 : 0})`,
577
+ // 暗黑模式不做反转
578
+ filter: m ? "unset" : `invert(${y ? 1 : 0})`,
578
579
  transition: "filter 0.3s ease-in-out"
579
580
  }
580
581
  }
@@ -583,12 +584,12 @@ function qe({
583
584
  }
584
585
  const ne = M(he)``;
585
586
  export {
586
- wt as H,
587
- _e as L,
587
+ kt as H,
588
+ De as L,
588
589
  F as P,
589
590
  qe as T,
590
591
  ze as a,
591
592
  H as b,
592
- kt as c,
593
+ wt as c,
593
594
  E as d
594
595
  };