@blocklet/pages-kit-inner-components 0.5.22 → 0.5.24

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.
@@ -0,0 +1,516 @@
1
+ import { jsx as e, jsxs as D } from "react/jsx-runtime";
2
+ import { u as X, d as Y, e as fe, f as he, g as be, c as ye } from "./state-TRx4qpp_.js";
3
+ import { useLocaleContext as J } from "@arcblock/ux/lib/Locale/context";
4
+ import Z from "@arcblock/ux/lib/Result";
5
+ import { useHeaderState as ve } from "@blocklet/pages-kit/builtin/page/header";
6
+ import { useColorConvert as we } from "@blocklet/pages-kit/contexts/color";
7
+ import { setPageDataSource as ee } from "@blocklet/pages-kit/utils/data-source";
8
+ import { generateParamCombinations as Pe } from "@blocklet/pages-kit/utils/route";
9
+ import xe from "@blocklet/ui-react/lib/Header";
10
+ import { cx as te } from "@emotion/css";
11
+ import { Global as oe, css as ne } from "@emotion/react";
12
+ import re from "@emotion/styled";
13
+ import { Box as F, CircularProgress as ke, useTheme as ae, Button as Se, Stack as Ce, alpha as q, useMediaQuery as je } from "@mui/material";
14
+ import { useReactive as se, useScroll as Ie } from "ahooks";
15
+ import Re from "isomorphic-dompurify";
16
+ import N from "lodash/cloneDeep";
17
+ import Ee from "lodash/isEmpty";
18
+ import ie from "lodash/isEqual";
19
+ import { useEffect as O, lazy as le, useMemo as T, useRef as ce, Suspense as Te, useState as Me } from "react";
20
+ import { Helmet as Be } from "react-helmet";
21
+ import { useSearchParams as ue, Routes as Oe, Route as E, Navigate as Fe, ScrollRestoration as Le } from "react-router-dom";
22
+ import { useAsync as pe } from "react-use";
23
+ import { joinURL as S } from "ufo";
24
+ import { S as _e, n as K, P as De, a as Ne, B as $e, g as Ae } from "./array-uzhVAv0S.js";
25
+ import { styled as me, useTheme as He } from "@arcblock/ux/lib/Theme";
26
+ import Ue from "@blocklet/ui-react/lib/Footer";
27
+ import "webfontloader";
28
+ import { u as Ve, a as ze } from "./session-CVblGhSp.js";
29
+ const Ge = me(Ue, { shouldForwardProp: (t) => !!t })`
30
+ & > div > .MuiContainer-root {
31
+ max-width: unset;
32
+ }
33
+ `;
34
+ function We({ meta: t, ...n }) {
35
+ const s = He();
36
+ return /* @__PURE__ */ e(Ge, { ...n, meta: t, theme: s || {} });
37
+ }
38
+ function qe(t) {
39
+ return /* @__PURE__ */ e(F, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...t, children: /* @__PURE__ */ e(ke, { size: 30 }) });
40
+ }
41
+ function Ke(t) {
42
+ return /* @__PURE__ */ e(Qe, { ...t });
43
+ }
44
+ const Qe = me(F)`
45
+ position: fixed;
46
+ left: 0;
47
+ top: 0;
48
+ z-index: 999999999999;
49
+ width: 80px;
50
+ font-size: 12px;
51
+ text-align: center;
52
+ opacity: 0.7;
53
+ transform: translateX(-23%) translateY(70%) rotate(-45deg);
54
+ pointer-events: none;
55
+ `, Xe = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
56
+ sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`;
57
+ function Ye({
58
+ titleFontFamily: t,
59
+ descriptionFontFamily: n
60
+ }) {
61
+ var o;
62
+ const s = ae(), a = (o = s == null ? void 0 : s.typography) == null ? void 0 : o.fontFamily;
63
+ O(() => {
64
+ }, [t, n]);
65
+ const i = `${a}, ${Xe}`;
66
+ return /* @__PURE__ */ e(
67
+ oe,
68
+ {
69
+ styles: ne`
70
+ #app {
71
+ font-family: ${i};
72
+
73
+ .page-kit-section__title {
74
+ font-family: ${i};
75
+ }
76
+
77
+ .page-kit-section__description {
78
+ font-family: ${i};
79
+ }
80
+ }
81
+ `
82
+ }
83
+ );
84
+ }
85
+ function Bt() {
86
+ const [t] = ue(), { session: n } = Ve(), s = ze("owner", "admin", "pagesEditor", "member"), a = T(() => {
87
+ const o = t.get("mode");
88
+ return _e.includes(o) ? o : "production";
89
+ }, [t]), i = a === "production" ? a : n.user ? s ? a : "production" : null;
90
+ return i ? /* @__PURE__ */ e(Je, { mode: i }) : null;
91
+ }
92
+ function Je({ mode: t }) {
93
+ if (t !== "draft") {
94
+ const n = window.__PAGE_STATE__;
95
+ return n ? /* @__PURE__ */ e(H, { mode: t, state: n }) : /* @__PURE__ */ e(et, { mode: t, children: ({ state: s }) => /* @__PURE__ */ e(H, { mode: t, state: s }) });
96
+ }
97
+ return /* @__PURE__ */ e(Ze, { children: ({ state: n }) => /* @__PURE__ */ e(H, { mode: t, state: n }) });
98
+ }
99
+ const Ze = le(() => import("./draft-data-hZqezCbE.js"));
100
+ function et({
101
+ mode: t,
102
+ children: n
103
+ }) {
104
+ const s = document.querySelector('meta[property="pages:version"]'), a = s == null ? void 0 : s.content, i = X(), o = T(() => {
105
+ if (a === "{{pagesPublishedAt}}") {
106
+ const u = localStorage.getItem(ye(i ?? ""));
107
+ return Number(u) ? Number(u) : (/* @__PURE__ */ new Date()).getTime();
108
+ }
109
+ return Number(a);
110
+ }, [a]), { loading: m, value: l } = pe(() => Ae({ mode: t, version: o }), [t, o]);
111
+ return m ? /* @__PURE__ */ e(qe, {}) : l ? n({ state: l }) : null;
112
+ }
113
+ function H({ mode: t, state: n }) {
114
+ const { t: s, locale: a } = J(), [i] = ue(), o = X(), m = fe(), l = i.get("hiddenBadge") === "true", u = i.get("showPublish") === "true", {
115
+ pageIds: f,
116
+ pages: p,
117
+ routeIds: d,
118
+ routes: h,
119
+ supportedLocales: b,
120
+ config: { defaultLocale: y },
121
+ resources: C
122
+ } = n, g = Y(n), w = T(
123
+ () => b != null && b.some((c) => c.locale === a) ? a : void 0,
124
+ [a, b]
125
+ ), M = Object.values(h || {}).find((c) => (c == null ? void 0 : c.path) === "/") || Object.values(p).find((c) => (c == null ? void 0 : c.slug) === "/") ? void 0 : Object.values(p)[0], L = T(() => t === "production" ? f.map((c) => {
126
+ const r = p[c];
127
+ return r && {
128
+ id: r.id,
129
+ path: S("/", m || o || "", r.slug)
130
+ };
131
+ }).filter(K) : d.map((c) => {
132
+ const r = h[c];
133
+ return r ? {
134
+ id: r.id,
135
+ path: S("/", m || o || "", r.path, `?mode=${t}&showPublish=true`)
136
+ } : null;
137
+ }).filter(K), [f, p, t, h, d, o, m]), k = ([...c]) => (t !== "production" && u && c.unshift(
138
+ /* @__PURE__ */ e(Te, { fallback: /* @__PURE__ */ e("div", {}), children: /* @__PURE__ */ e(tt, { mode: "production", state: n }) })
139
+ ), c);
140
+ return /* @__PURE__ */ D(De, { value: { pages: L }, children: [
141
+ /* @__PURE__ */ D(Oe, { children: [
142
+ M && /* @__PURE__ */ e(E, { index: !0, element: /* @__PURE__ */ e(Fe, { to: S("/", w || "", M.slug) }) }),
143
+ d == null ? void 0 : d.map((c) => {
144
+ var P, v, x, _;
145
+ const r = h == null ? void 0 : h[c];
146
+ if (!r || !r.displayTemplateId) return null;
147
+ const j = p[r.displayTemplateId];
148
+ if (!j) return null;
149
+ let I = [];
150
+ if (r.params && r.params.length > 0) {
151
+ const R = Pe({
152
+ basePath: r.path,
153
+ params: r.params,
154
+ routeId: r.id,
155
+ paramsOptions: r.paramsOptions,
156
+ currentIndex: 0,
157
+ currentParams: [],
158
+ currentOptionIds: [],
159
+ result: []
160
+ });
161
+ I = R == null ? void 0 : R.map((B) => {
162
+ var V, z, G, W;
163
+ const U = B.paramOptionIds.join("-");
164
+ return /* @__PURE__ */ e(
165
+ E,
166
+ {
167
+ path: S(":projectIdOrSlug?", B.path),
168
+ element: /* @__PURE__ */ e(
169
+ Q,
170
+ {
171
+ mode: t,
172
+ components: g,
173
+ page: j,
174
+ locale: w,
175
+ defaultLocale: y,
176
+ headerAddons: k,
177
+ state: n,
178
+ pageData: (W = (G = (z = (V = r.dataSource) == null ? void 0 : V.pathDataMappings) == null ? void 0 : z[U]) == null ? void 0 : G.dataCache) == null ? void 0 : W[w || y || "en"]
179
+ }
180
+ )
181
+ },
182
+ U
183
+ );
184
+ });
185
+ }
186
+ return I.push(
187
+ /* @__PURE__ */ e(
188
+ E,
189
+ {
190
+ path: S(":projectIdOrSlug?", r.path),
191
+ element: /* @__PURE__ */ e(
192
+ Q,
193
+ {
194
+ mode: t,
195
+ components: g,
196
+ page: j,
197
+ locale: w,
198
+ defaultLocale: y,
199
+ headerAddons: k,
200
+ state: n,
201
+ pageData: (_ = (x = (v = (P = r.dataSource) == null ? void 0 : P.pathDataMappings) == null ? void 0 : v[r.id]) == null ? void 0 : x.dataCache) == null ? void 0 : _[w || y || "en"]
202
+ }
203
+ )
204
+ },
205
+ r.id
206
+ )
207
+ ), I;
208
+ }),
209
+ f.map((c) => {
210
+ const r = p[c];
211
+ return r ? /* @__PURE__ */ e(
212
+ E,
213
+ {
214
+ path: S(":projectIdOrSlug?", r.slug),
215
+ element: /* @__PURE__ */ e(
216
+ $,
217
+ {
218
+ mode: t,
219
+ components: g,
220
+ page: r,
221
+ locale: w,
222
+ defaultLocale: y,
223
+ headerAddons: k
224
+ }
225
+ )
226
+ },
227
+ r.id
228
+ ) : null;
229
+ }),
230
+ C.pages && Object.values(C.pages).map(({ blockletId: c, page: r }) => /* @__PURE__ */ e(
231
+ E,
232
+ {
233
+ path: S("/", `@${c}`, r.slug),
234
+ element: /* @__PURE__ */ e(
235
+ $,
236
+ {
237
+ mode: t,
238
+ components: g,
239
+ page: r,
240
+ locale: w,
241
+ defaultLocale: y,
242
+ headerAddons: k
243
+ }
244
+ )
245
+ },
246
+ r.id
247
+ )),
248
+ /* @__PURE__ */ e(
249
+ E,
250
+ {
251
+ path: "*",
252
+ element: /* @__PURE__ */ e(F, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(Z, { status: 404, extra: /* @__PURE__ */ e(ge, { href: "/", children: s("common.back") }) }) })
253
+ }
254
+ )
255
+ ] }),
256
+ t !== "production" && !l && /* @__PURE__ */ e(Ke, { sx: { bgcolor: "info.light" }, children: t }),
257
+ /* @__PURE__ */ e(Ye, {})
258
+ ] });
259
+ }
260
+ function Q({
261
+ mode: t,
262
+ pageData: n,
263
+ components: s,
264
+ page: a,
265
+ locale: i,
266
+ defaultLocale: o,
267
+ headerAddons: m,
268
+ state: l
269
+ }) {
270
+ const u = se({
271
+ page: null
272
+ });
273
+ O(() => {
274
+ const p = a || null;
275
+ p ? u.page = N(p) : u.page = null;
276
+ }, [a, u]);
277
+ const f = ce();
278
+ return O(() => {
279
+ ie(n, f.current) || n && u.page && (ee(u.page, l, i, n), f.current = N(n));
280
+ }, [u.page, n, i, l]), u.page ? /* @__PURE__ */ e(
281
+ $,
282
+ {
283
+ mode: t,
284
+ components: s,
285
+ page: u.page,
286
+ locale: i,
287
+ defaultLocale: o,
288
+ headerAddons: m
289
+ }
290
+ ) : null;
291
+ }
292
+ function Ot({
293
+ mode: t,
294
+ state: n,
295
+ path: s,
296
+ pageData: a
297
+ }) {
298
+ const { t: i, locale: o } = J(), {
299
+ pages: m,
300
+ supportedLocales: l,
301
+ config: { defaultLocale: u },
302
+ resources: f
303
+ } = n, p = Object.values(m).find((g) => (g == null ? void 0 : g.slug) === s), d = Object.values(f.pages || {}).find((g) => g.page.slug === s), h = T(
304
+ () => l != null && l.some((g) => g.locale === o) ? o : void 0,
305
+ [o, l]
306
+ ), b = se({
307
+ page: null
308
+ });
309
+ O(() => {
310
+ const g = p || (d == null ? void 0 : d.page) || null;
311
+ g ? b.page = N(g) : b.page = null;
312
+ }, [p, d]);
313
+ const y = ce();
314
+ if (O(() => {
315
+ ie(a, y.current) || a && b.page && (ee(b.page, n, h, a), y.current = N(a));
316
+ }, [{}]), !p && !(d != null && d.page))
317
+ return /* @__PURE__ */ e(F, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(Z, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ e(ge, { href: "/", children: i("common.back") }) }) });
318
+ const C = Y(n);
319
+ return b.page ? /* @__PURE__ */ e(
320
+ $,
321
+ {
322
+ mode: t,
323
+ components: C,
324
+ page: b.page,
325
+ locale: h,
326
+ defaultLocale: u
327
+ }
328
+ ) : null;
329
+ }
330
+ function $({
331
+ mode: t,
332
+ components: n,
333
+ page: s,
334
+ locale: a,
335
+ defaultLocale: i,
336
+ headerAddons: o
337
+ }) {
338
+ var w, A, M, L, k, c, r, j, I;
339
+ const m = we(), l = ((w = s.locales) == null ? void 0 : w[a]) ?? ((A = s.locales) == null ? void 0 : A[i]) ?? {}, u = l.title || ((M = window.blocklet) == null ? void 0 : M.appName), f = l.description || ((L = window.blocklet) == null ? void 0 : L.appDescription), p = he(be(l.image), 540), { logo: d, brand: h, description: b, ...y } = ve(), C = T(
340
+ () => (P) => {
341
+ var x;
342
+ let v = (o == null ? void 0 : o(P)) ?? P;
343
+ return v = ((x = y.addons) == null ? void 0 : x.call(y, v)) ?? v, v;
344
+ },
345
+ [y.addons, o]
346
+ ), g = (k = l.header) != null && k.translucent ? nt : de;
347
+ return /* @__PURE__ */ D(Ne, { page: s, defaultLocale: i, currentLocale: a, children: [
348
+ /* @__PURE__ */ e(
349
+ oe,
350
+ {
351
+ styles: ne`
352
+ body {
353
+ background-color: ${m(
354
+ !l.backgroundColor || l.backgroundColor === "transparent" ? "background.default" : l.backgroundColor
355
+ )} !important;
356
+ }
357
+ `
358
+ }
359
+ ),
360
+ /* @__PURE__ */ e(
361
+ g,
362
+ {
363
+ hideNavMenu: !!((c = l.header) != null && c.hideNavMenus),
364
+ translucentTextColor: (r = l.header) == null ? void 0 : r.translucentTextColor,
365
+ ...d ? { logo: d } : {},
366
+ ...h ? { brand: h } : {},
367
+ ...b ? { description: b } : {},
368
+ className: te(((j = l.header) == null ? void 0 : j.sticky) && "sticky", "page-header"),
369
+ maxWidth: !1,
370
+ addons: C
371
+ }
372
+ ),
373
+ /* @__PURE__ */ e(Le, {}),
374
+ /* @__PURE__ */ D(Be, { children: [
375
+ /* @__PURE__ */ e("title", { children: u }),
376
+ /* @__PURE__ */ e("meta", { name: "og:title", content: u }),
377
+ /* @__PURE__ */ e("meta", { name: "og:description", content: f }),
378
+ /* @__PURE__ */ e("meta", { name: "og:image", content: p }),
379
+ /* @__PURE__ */ e("meta", { name: "twitter:image:src", content: p }),
380
+ /* @__PURE__ */ e("meta", { name: "twitter:image", content: p }),
381
+ /* @__PURE__ */ e("meta", { property: "twitter:description", content: f }),
382
+ /* @__PURE__ */ e("meta", { property: "twitter:title", content: u }),
383
+ /* @__PURE__ */ e("meta", { name: "description", content: f })
384
+ ] }),
385
+ /* @__PURE__ */ e(
386
+ Ce,
387
+ {
388
+ flexGrow: 1,
389
+ className: "PageView-root",
390
+ sx: {
391
+ // 第一个 .BlockBase-root 的 pt 为 0
392
+ "& .BlockBase-root:first-child": {
393
+ pt: "0 !important"
394
+ }
395
+ },
396
+ children: s.sectionIds.map((P) => {
397
+ var R, B;
398
+ const v = s.sections[P];
399
+ if (!v || v.visibility === "hidden") return null;
400
+ const x = (R = v.locales) == null ? void 0 : R[a], _ = ((B = v.locales) == null ? void 0 : B[i]) ?? {};
401
+ return /* @__PURE__ */ e(
402
+ $e,
403
+ {
404
+ id: P,
405
+ type: v.component,
406
+ mode: t,
407
+ section: v,
408
+ config: {
409
+ ...Ee(x) ? _ : x,
410
+ locale: a,
411
+ dev: t === "draft" ? {
412
+ mode: t,
413
+ components: n,
414
+ defaultLocale: i
415
+ } : { mode: t }
416
+ }
417
+ },
418
+ P
419
+ );
420
+ })
421
+ }
422
+ ),
423
+ !((I = l.footer) != null && I.hidden) && /* @__PURE__ */ e(We, {})
424
+ ] });
425
+ }
426
+ const tt = le(() => import("./publish-button-CyxGsQeI.js")), de = re(xe)`
427
+ &.sticky {
428
+ position: sticky;
429
+ top: 0;
430
+ }
431
+ `;
432
+ function ot({ logo: t }) {
433
+ const [n, s] = Me(), a = je((o) => o.breakpoints.down("sm")), { value: i } = pe(() => {
434
+ var l, u;
435
+ const o = new URL(
436
+ a ? ((l = window == null ? void 0 : window.blocklet) == null ? void 0 : l.appLogo) || "/.well-known/service/blocklet/logo" : ((u = window == null ? void 0 : window.blocklet) == null ? void 0 : u.appLogoRect) || "/.well-known/service/blocklet/logo-rect",
437
+ window.location.origin
438
+ );
439
+ o.searchParams.delete("imageFilter"), o.searchParams.delete("f");
440
+ const m = o.toString();
441
+ return new Promise((f) => {
442
+ fetch(m).then((p) => {
443
+ const d = p.headers.get("content-type");
444
+ d != null && d.includes("svg") && p.text().then((h) => {
445
+ s(h), f(null);
446
+ }), f(p.url);
447
+ });
448
+ });
449
+ }, [a]);
450
+ if (t)
451
+ return t;
452
+ if (n)
453
+ return /* @__PURE__ */ e(F, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: Re.sanitize(n) } });
454
+ if (i) {
455
+ const o = new URL(i);
456
+ o.searchParams.set("imageFilter", "convert"), o.searchParams.set("f", "png"), o.searchParams.set("h", "80");
457
+ const m = o.toString();
458
+ return /* @__PURE__ */ e("img", { src: m, alt: "logo" });
459
+ }
460
+ return null;
461
+ }
462
+ function nt({
463
+ logo: t,
464
+ translucentTextColor: n,
465
+ ...s
466
+ }) {
467
+ const { top: a = 0 } = Ie(() => document.getElementById("app")) || {}, i = ae();
468
+ let o = Math.min(a / 800, 1), m = "";
469
+ return o > 0.1 ? (o = Math.max(o, 0.6), m = q(i.palette.text.primary, o)) : m = n || "#EEEEEE", /* @__PURE__ */ e(
470
+ de,
471
+ {
472
+ logo: /* @__PURE__ */ e(ot, { logo: t }),
473
+ ...s,
474
+ className: te(o <= 0.7 && "reverse-color"),
475
+ style: {
476
+ backgroundColor: q(i.palette.background.default, o),
477
+ // @ts-ignore
478
+ "--logo-invert": o <= 0.7 ? 1 - o / 6 : 1 - o
479
+ },
480
+ sx: {
481
+ backdropFilter: o >= 0.6 ? "blur(10px)" : "blur(0px)",
482
+ transition: "all 0.3s ease",
483
+ position: "fixed !important",
484
+ left: 0,
485
+ top: 0,
486
+ right: 0,
487
+ bgcolor: "transparent",
488
+ "&.reverse-color": {
489
+ ".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
490
+ color: `${m} !important`
491
+ }
492
+ },
493
+ "& .navmenu--horizontal": {
494
+ bgcolor: "transparent !important"
495
+ },
496
+ ".header-logo > div": {
497
+ filter: "invert(var(--logo-invert))"
498
+ },
499
+ ".header-logo": {
500
+ color: m
501
+ }
502
+ }
503
+ }
504
+ );
505
+ }
506
+ const ge = re(Se)``;
507
+ export {
508
+ Bt as H,
509
+ qe as L,
510
+ H as P,
511
+ nt as T,
512
+ Je as a,
513
+ Q as b,
514
+ Ot as c,
515
+ $ as d
516
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as t, jsxs as f, Fragment as le } from "react/jsx-runtime";
2
- import { u as ce, c as de } from "./state-j8jViBMV.js";
2
+ import { u as ce, c as de } from "./state-TRx4qpp_.js";
3
3
  import { useLocaleContext as U } from "@arcblock/ux/lib/Locale/context";
4
4
  import Q from "@arcblock/ux/lib/Toast";
5
5
  import { generateParamCombinations as me } from "@blocklet/pages-kit/utils/route";
@@ -10,8 +10,8 @@ import { produce as Oe } from "immer";
10
10
  import ee from "lodash/difference";
11
11
  import { useState as T, useMemo as R, useCallback as j, forwardRef as Te, useImperativeHandle as je, useEffect as $, useRef as ve } from "react";
12
12
  import { useAsync as Re } from "react-use";
13
- import { L as ze } from "./home-BB778Odl.js";
14
- import { p as Le, g as Be } from "./array-B1QKSYbX.js";
13
+ import { L as ze } from "./home-BG1ZwC5Y.js";
14
+ import { p as Le, g as Be } from "./array-uzhVAv0S.js";
15
15
  function Ee(s) {
16
16
  const [y, w] = T(!1);
17
17
  return /* @__PURE__ */ t(
@@ -37,13 +37,13 @@ function We({ error: n }) {
37
37
  return /* @__PURE__ */ k(z, { children: /* @__PURE__ */ k(K, { severity: "error", children: n.message }) });
38
38
  }
39
39
  var U;
40
- const D = ((U = window.blocklet) == null ? void 0 : U.prefix) || "/", J = Q({
40
+ const _ = ((U = window.blocklet) == null ? void 0 : U.prefix) || "/", J = Q({
41
41
  timeout: 200 * 1e3
42
- }), fe = window.location.protocol === "https:" ? "wss" : "ws", ze = (n) => b(`${fe}://${window.location.hostname}`, D, `api/${n}/ws/pages`), Se = "z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";
42
+ }), fe = window.location.protocol === "https:" ? "wss" : "ws", ze = (n) => b(`${fe}://${window.location.hostname}`, _, `api/${n}/ws/pages`), Se = "z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";
43
43
  var F;
44
- (F = blocklet == null ? void 0 : blocklet.componentMountPoints.find((n) => n.did === Se)) != null && F.mountPoint || b(D, "/image-bin");
44
+ (F = blocklet == null ? void 0 : blocklet.componentMountPoints.find((n) => n.did === Se)) != null && F.mountPoint || b(_, "/image-bin");
45
45
  function Ke(n) {
46
- return n && !/^(https?:\/\/|\/)/.test(n) ? window.location.origin + b(D, "uploads", n) : n;
46
+ return n && !/^(https?:\/\/|\/)/.test(n) ? window.location.origin + b(_, "uploads", n) : n;
47
47
  }
48
48
  const pe = window.innerWidth <= 750;
49
49
  function qe(n, t, a) {
@@ -102,22 +102,22 @@ function Qe({
102
102
  { doc: d }
103
103
  ),
104
104
  [d]
105
- ), [j, x] = E(null), [R, $] = E(!1), [T, _] = E(void 0), G = L(async () => {
105
+ ), [j, x] = E(null), [R, D] = E(!1), [$, T] = E(void 0), G = L(async () => {
106
106
  if (S) {
107
- $(!0);
107
+ D(!0);
108
108
  try {
109
109
  const l = await Pe(S);
110
110
  x(l);
111
111
  } catch (l) {
112
112
  console.error("Failed to fetch project:", l);
113
113
  } finally {
114
- $(!1);
114
+ D(!1);
115
115
  }
116
116
  }
117
117
  }, [S]), M = L(
118
118
  async (l, u) => {
119
119
  var P;
120
- if (_(void 0), !!S) {
120
+ if (T(void 0), !!S) {
121
121
  u != null && u.optimisticUpdate && j && x((m) => ({
122
122
  ...m,
123
123
  ...l
@@ -128,7 +128,7 @@ function Qe({
128
128
  });
129
129
  x(m);
130
130
  } catch (m) {
131
- console.error("Failed to update project:", m), u != null && u.optimisticUpdate && x(j), _((P = m == null ? void 0 : m.response) == null ? void 0 : P.data);
131
+ console.error("Failed to update project:", m), u != null && u.optimisticUpdate && x(j), T((P = m == null ? void 0 : m.response) == null ? void 0 : P.data);
132
132
  }
133
133
  }
134
134
  },
@@ -151,7 +151,7 @@ function Qe({
151
151
  projectState: {
152
152
  project: j,
153
153
  isLoadingProject: R,
154
- error: T
154
+ error: $
155
155
  },
156
156
  updateProject: M,
157
157
  forceSync: g
@@ -167,7 +167,7 @@ function Qe({
167
167
  j,
168
168
  R,
169
169
  M,
170
- T,
170
+ $,
171
171
  h,
172
172
  g
173
173
  ]
@@ -422,7 +422,7 @@ const ye = () => {
422
422
  }, V = () => {
423
423
  const { projectId: n } = ie();
424
424
  return n ?? me() ?? "";
425
- };
425
+ }, Xe = () => window.__PROJECT_SLUG__ ?? "";
426
426
  function ve(n) {
427
427
  var f, I;
428
428
  const { resources: t } = n;
@@ -451,7 +451,7 @@ function ge(n) {
451
451
  ...Ce(n)
452
452
  };
453
453
  }
454
- const Xe = () => ge(ye().state);
454
+ const Ye = () => ge(ye().state);
455
455
  export {
456
456
  We as E,
457
457
  Qe as S,
@@ -459,14 +459,15 @@ export {
459
459
  ye as b,
460
460
  Be as c,
461
461
  ge as d,
462
- qe as e,
463
- Xe as f,
462
+ Xe as e,
463
+ qe as f,
464
464
  Ke as g,
465
- J as h,
466
- Je as i,
467
- Ce as j,
468
- ve as k,
469
- me as l,
465
+ Ye as h,
466
+ J as i,
467
+ Je as j,
468
+ Ce as k,
469
+ ve as l,
470
+ me as m,
470
471
  A as n,
471
472
  Ve as t,
472
473
  V as u
package/lib/es/home.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import "./chunks/state-j8jViBMV.js";
2
+ import "./chunks/state-TRx4qpp_.js";
3
3
  import "@arcblock/ux/lib/Locale/context";
4
4
  import "@arcblock/ux/lib/Result";
5
5
  import "@blocklet/pages-kit/builtin/page/header";
@@ -21,8 +21,8 @@ import "react-helmet";
21
21
  import "react-router-dom";
22
22
  import "react-use";
23
23
  import "ufo";
24
- import "./chunks/array-B1QKSYbX.js";
25
- import { a as R, P as S, d as W, c as j, b as k, T as q, H as v } from "./chunks/home-BB778Odl.js";
24
+ import "./chunks/array-uzhVAv0S.js";
25
+ import { a as R, P as S, d as W, c as j, b as k, T as q, H as v } from "./chunks/home-BG1ZwC5Y.js";
26
26
  import "./chunks/session-CVblGhSp.js";
27
27
  export {
28
28
  R as HomeView,
package/lib/es/setting.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as t, jsxs as O, Fragment as X } from "react/jsx-runtime";
2
- import { t as ve, g as Te, b as ce, E as ot, n as Ke, f as xe } from "./chunks/state-j8jViBMV.js";
2
+ import { t as ve, g as Te, b as ce, E as ot, n as Ke, h as xe } from "./chunks/state-TRx4qpp_.js";
3
3
  import de from "@arcblock/ux/lib/Empty";
4
4
  import { useLocaleContext as C } from "@arcblock/ux/lib/Locale/context";
5
5
  import { CodeEditor as ge } from "@blocklet/code-editor";
@@ -12,7 +12,7 @@ import A from "lodash/sortBy";
12
12
  import { useCallback as D, useMemo as ne, useRef as J, useId as gt, useEffect as $, useState as Q } from "react";
13
13
  import { useUpdate as _e } from "react-use";
14
14
  import { ColorItem as Pt, ConfigColorDialog as wt } from "@blocklet/pages-kit/builtin/color-picker";
15
- import { C as kt } from "./chunks/config-string-D8tamRZ1.js";
15
+ import { C as kt } from "./chunks/config-string-BloDH_C5.js";
16
16
  import we from "lodash/isEmpty";
17
17
  import He from "lodash/set";
18
18
  import * as fe from "yaml";