@blocklet/pages-kit-inner-components 0.4.124 → 0.4.126
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/chunks/{home-DMWxIeUw.js → home-q1dzT-BZ.js} +4 -4
- package/lib/cjs/chunks/{publish-button-B_2z7mDz.js → publish-button-CpLC1-Bd.js} +1 -1
- package/lib/cjs/chunks/{site-state-BMf96RZL.js → site-state-C5t-5c6U.js} +6 -6
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +7 -7
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/chunks/{home-DIJ8xaUb.js → home-CSX7cAwr.js} +49 -49
- package/lib/es/chunks/{publish-button-LDqfGwdd.js → publish-button-B2tZwJP0.js} +1 -1
- package/lib/es/chunks/{site-state-kjir-UCL.js → site-state-BLNi12iP.js} +251 -252
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +1 -1
- package/lib/es/project-html.js +160 -99
- package/lib/es/resources.js +1 -1
- package/lib/es/site-state.js +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as O } from "react/jsx-runtime";
|
|
2
|
-
import { d as
|
|
3
|
-
import { useLocaleContext as
|
|
2
|
+
import { d as G, e as ce, g as le, u as ue, c as me } from "./state-DCRhzAYq.js";
|
|
3
|
+
import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import q from "@arcblock/ux/lib/Result";
|
|
5
5
|
import { useHeaderState as pe } from "@blocklet/pages-kit/builtin/page/header";
|
|
6
6
|
import { useColorConvert as de } from "@blocklet/pages-kit/contexts/color";
|
|
@@ -10,17 +10,17 @@ import { cx as K } from "@emotion/css";
|
|
|
10
10
|
import { Global as Q, css as X } from "@emotion/react";
|
|
11
11
|
import Y from "@emotion/styled";
|
|
12
12
|
import { Box as B, CircularProgress as fe, useTheme as he, Button as be, Stack as ye, useMediaQuery as ve } from "@mui/material";
|
|
13
|
-
import { useReactive as Z } from "ahooks";
|
|
14
|
-
import
|
|
13
|
+
import { useReactive as Z, useScroll as we } from "ahooks";
|
|
14
|
+
import Se from "isomorphic-dompurify";
|
|
15
15
|
import _ from "lodash/cloneDeep";
|
|
16
|
-
import
|
|
16
|
+
import ke from "lodash/isEmpty";
|
|
17
17
|
import F from "lodash/isEqual";
|
|
18
|
-
import { useEffect as $, useContext as
|
|
19
|
-
import { Helmet as
|
|
20
|
-
import { useSearchParams as oe, Routes as
|
|
21
|
-
import {
|
|
22
|
-
import { joinURL as
|
|
23
|
-
import { S as
|
|
18
|
+
import { useEffect as $, useContext as Pe, lazy as ee, useMemo as P, useRef as te, Suspense as xe, useState as Ce } from "react";
|
|
19
|
+
import { Helmet as Re } from "react-helmet";
|
|
20
|
+
import { useSearchParams as oe, Routes as Ee, Route as T, Navigate as Me, ScrollRestoration as Ie } from "react-router-dom";
|
|
21
|
+
import { useAsync as ne } from "react-use";
|
|
22
|
+
import { joinURL as j } from "ufo";
|
|
23
|
+
import { S as Te, n as je, P as $e, a as Be, B as Ne, g as Oe } from "./array-CUVFSUuJ.js";
|
|
24
24
|
import { styled as re, useTheme as _e } from "@arcblock/ux/lib/Theme";
|
|
25
25
|
import Ae from "@blocklet/ui-react/lib/Footer";
|
|
26
26
|
import He from "webfontloader";
|
|
@@ -38,9 +38,9 @@ function Ve(e) {
|
|
|
38
38
|
return /* @__PURE__ */ t(B, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...e, children: /* @__PURE__ */ t(fe, { size: 30 }) });
|
|
39
39
|
}
|
|
40
40
|
function ze(e) {
|
|
41
|
-
return /* @__PURE__ */ t(
|
|
41
|
+
return /* @__PURE__ */ t(Ge, { ...e });
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const Ge = re(B)`
|
|
44
44
|
position: fixed;
|
|
45
45
|
left: 0;
|
|
46
46
|
top: 0;
|
|
@@ -51,7 +51,7 @@ const We = re(B)`
|
|
|
51
51
|
opacity: 0.7;
|
|
52
52
|
transform: translateX(-23%) translateY(70%) rotate(-45deg);
|
|
53
53
|
pointer-events: none;
|
|
54
|
-
`,
|
|
54
|
+
`, We = (e) => new Promise((o, n) => {
|
|
55
55
|
(e == null ? void 0 : e.length) > 0 ? He.load({
|
|
56
56
|
google: {
|
|
57
57
|
families: e
|
|
@@ -73,7 +73,7 @@ function qe({
|
|
|
73
73
|
const n = he(), s = (r = n == null ? void 0 : n.typography) == null ? void 0 : r.fontFamily, i = async (l) => {
|
|
74
74
|
if (l && !document.querySelectorAll(`link[href*="${l}" i]`).length)
|
|
75
75
|
try {
|
|
76
|
-
z[l] || (await
|
|
76
|
+
z[l] || (await We([l]), z[l] = !0);
|
|
77
77
|
} catch (a) {
|
|
78
78
|
console.error(a);
|
|
79
79
|
}
|
|
@@ -99,9 +99,9 @@ function qe({
|
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
const { SessionProvider:
|
|
102
|
+
const { SessionProvider: Tt, SessionContext: Je, SessionConsumer: jt, withSession: $t } = De();
|
|
103
103
|
function L() {
|
|
104
|
-
return
|
|
104
|
+
return Pe(Je);
|
|
105
105
|
}
|
|
106
106
|
function Ke(...e) {
|
|
107
107
|
var n;
|
|
@@ -116,7 +116,7 @@ function Qe(...e) {
|
|
|
116
116
|
function Bt() {
|
|
117
117
|
const [e] = oe(), { session: o } = L(), n = Qe("owner", "admin", "pagesEditor", "member"), s = P(() => {
|
|
118
118
|
const r = e.get("mode");
|
|
119
|
-
return
|
|
119
|
+
return Te.includes(r) ? r : "production";
|
|
120
120
|
}, [e]), i = s === "production" ? s : o.user ? n ? s : "production" : null;
|
|
121
121
|
return i ? /* @__PURE__ */ t(Xe, { mode: i }) : null;
|
|
122
122
|
}
|
|
@@ -142,7 +142,7 @@ function Ze({
|
|
|
142
142
|
return l ? /* @__PURE__ */ t(Ve, {}) : a ? o({ state: a }) : null;
|
|
143
143
|
}
|
|
144
144
|
function D({ mode: e, state: o }) {
|
|
145
|
-
const { t: n, locale: s } =
|
|
145
|
+
const { t: n, locale: s } = W(), [i] = oe(), r = i.get("hiddenBadge") === "true", l = i.get("showPublish") === "true", {
|
|
146
146
|
pageIds: a,
|
|
147
147
|
pages: c,
|
|
148
148
|
routeIds: g,
|
|
@@ -150,7 +150,7 @@ function D({ mode: e, state: o }) {
|
|
|
150
150
|
supportedLocales: m,
|
|
151
151
|
config: { defaultLocale: h },
|
|
152
152
|
resources: b
|
|
153
|
-
} = o, y =
|
|
153
|
+
} = o, y = G(o), v = P(
|
|
154
154
|
() => m != null && m.some((p) => p.locale === s) ? s : void 0,
|
|
155
155
|
[s, m]
|
|
156
156
|
), f = Object.values(c).find((p) => (p == null ? void 0 : p.slug) === "/") ? void 0 : Object.values(c)[0], N = P(
|
|
@@ -158,25 +158,25 @@ function D({ mode: e, state: o }) {
|
|
|
158
158
|
const u = c[p];
|
|
159
159
|
return u && {
|
|
160
160
|
id: u.id,
|
|
161
|
-
path:
|
|
161
|
+
path: j("/", v || "", u.slug, e !== "production" ? `?mode=${e}` : "")
|
|
162
162
|
};
|
|
163
|
-
}).filter(
|
|
163
|
+
}).filter(je),
|
|
164
164
|
[a, c, v, e]
|
|
165
165
|
), S = ([...p]) => (e !== "production" && l && p.unshift(
|
|
166
|
-
/* @__PURE__ */ t(
|
|
166
|
+
/* @__PURE__ */ t(xe, { fallback: /* @__PURE__ */ t("div", {}), children: /* @__PURE__ */ t(et, { mode: "production", state: o }) })
|
|
167
167
|
), p);
|
|
168
168
|
return /* @__PURE__ */ O($e, { value: { pages: N }, children: [
|
|
169
|
-
/* @__PURE__ */ O(
|
|
170
|
-
f && /* @__PURE__ */ t(
|
|
169
|
+
/* @__PURE__ */ O(Ee, { children: [
|
|
170
|
+
f && /* @__PURE__ */ t(T, { index: !0, element: /* @__PURE__ */ t(Me, { to: j("/", v || "", f.slug) }) }),
|
|
171
171
|
g == null ? void 0 : g.map((p) => {
|
|
172
|
-
var C, R,
|
|
172
|
+
var C, R, E, M;
|
|
173
173
|
const u = d == null ? void 0 : d[p];
|
|
174
174
|
if (!u || !u.displayTemplateId) return null;
|
|
175
175
|
const x = c[u.displayTemplateId];
|
|
176
176
|
return x ? /* @__PURE__ */ t(
|
|
177
|
-
|
|
177
|
+
T,
|
|
178
178
|
{
|
|
179
|
-
path:
|
|
179
|
+
path: j(":projectIdOrSlug?", u.path),
|
|
180
180
|
element: /* @__PURE__ */ t(
|
|
181
181
|
Fe,
|
|
182
182
|
{
|
|
@@ -187,7 +187,7 @@ function D({ mode: e, state: o }) {
|
|
|
187
187
|
defaultLocale: h,
|
|
188
188
|
headerAddons: S,
|
|
189
189
|
state: o,
|
|
190
|
-
pageData: (
|
|
190
|
+
pageData: (M = (E = (R = (C = u.dataSource) == null ? void 0 : C.pathDataMappings) == null ? void 0 : R[u.id]) == null ? void 0 : E.dataCache) == null ? void 0 : M[v || h || "en"]
|
|
191
191
|
}
|
|
192
192
|
)
|
|
193
193
|
},
|
|
@@ -197,9 +197,9 @@ function D({ mode: e, state: o }) {
|
|
|
197
197
|
a.map((p) => {
|
|
198
198
|
const u = c[p];
|
|
199
199
|
return u ? /* @__PURE__ */ t(
|
|
200
|
-
|
|
200
|
+
T,
|
|
201
201
|
{
|
|
202
|
-
path:
|
|
202
|
+
path: j(":projectIdOrSlug?", u.slug),
|
|
203
203
|
element: /* @__PURE__ */ t(
|
|
204
204
|
A,
|
|
205
205
|
{
|
|
@@ -216,9 +216,9 @@ function D({ mode: e, state: o }) {
|
|
|
216
216
|
) : null;
|
|
217
217
|
}),
|
|
218
218
|
b.pages && Object.values(b.pages).map(({ blockletId: p, page: u }) => /* @__PURE__ */ t(
|
|
219
|
-
|
|
219
|
+
T,
|
|
220
220
|
{
|
|
221
|
-
path:
|
|
221
|
+
path: j("/", `@${p}`, u.slug),
|
|
222
222
|
element: /* @__PURE__ */ t(
|
|
223
223
|
A,
|
|
224
224
|
{
|
|
@@ -234,7 +234,7 @@ function D({ mode: e, state: o }) {
|
|
|
234
234
|
u.id
|
|
235
235
|
)),
|
|
236
236
|
/* @__PURE__ */ t(
|
|
237
|
-
|
|
237
|
+
T,
|
|
238
238
|
{
|
|
239
239
|
path: "*",
|
|
240
240
|
element: /* @__PURE__ */ t(B, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(q, { status: 404, extra: /* @__PURE__ */ t(ie, { href: "/", children: n("common.back") }) }) })
|
|
@@ -283,7 +283,7 @@ function Nt({
|
|
|
283
283
|
path: n,
|
|
284
284
|
pageData: s
|
|
285
285
|
}) {
|
|
286
|
-
const { t: i, locale: r } =
|
|
286
|
+
const { t: i, locale: r } = W(), {
|
|
287
287
|
pages: l,
|
|
288
288
|
supportedLocales: a,
|
|
289
289
|
config: { defaultLocale: c },
|
|
@@ -303,7 +303,7 @@ function Nt({
|
|
|
303
303
|
F(s, y.current) || s && b.page && (J(b.page, o, h, s), y.current = _(s));
|
|
304
304
|
}, [{}]), !d && !(m != null && m.page))
|
|
305
305
|
return /* @__PURE__ */ t(B, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(q, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ t(ie, { href: "/", children: i("common.back") }) }) });
|
|
306
|
-
const v =
|
|
306
|
+
const v = G(o);
|
|
307
307
|
return b.page ? /* @__PURE__ */ t(
|
|
308
308
|
A,
|
|
309
309
|
{
|
|
@@ -323,12 +323,12 @@ function A({
|
|
|
323
323
|
defaultLocale: i,
|
|
324
324
|
headerAddons: r
|
|
325
325
|
}) {
|
|
326
|
-
var N, S, p, u, x, C, R,
|
|
326
|
+
var N, S, p, u, x, C, R, E, M;
|
|
327
327
|
const l = de(), a = ((N = n.locales) == null ? void 0 : N[s]) ?? ((S = n.locales) == null ? void 0 : S[i]) ?? {}, c = a.title || ((p = window.blocklet) == null ? void 0 : p.appName), g = a.description || ((u = window.blocklet) == null ? void 0 : u.appDescription), d = ce(le(a.image), 540), { logo: m, brand: h, description: b, ...y } = pe(), v = P(
|
|
328
328
|
() => (k) => {
|
|
329
|
-
var
|
|
329
|
+
var I;
|
|
330
330
|
let w = (r == null ? void 0 : r(k)) ?? k;
|
|
331
|
-
return w = ((
|
|
331
|
+
return w = ((I = y.addons) == null ? void 0 : I.call(y, w)) ?? w, w;
|
|
332
332
|
},
|
|
333
333
|
[y.addons, r]
|
|
334
334
|
), f = (x = a.header) != null && x.translucent ? ot : se;
|
|
@@ -353,13 +353,13 @@ function A({
|
|
|
353
353
|
...m ? { logo: m } : {},
|
|
354
354
|
...h ? { brand: h } : {},
|
|
355
355
|
...b ? { description: b } : {},
|
|
356
|
-
className: K(((
|
|
356
|
+
className: K(((E = a.header) == null ? void 0 : E.sticky) && "sticky", "page-header"),
|
|
357
357
|
maxWidth: !1,
|
|
358
358
|
addons: v
|
|
359
359
|
}
|
|
360
360
|
),
|
|
361
|
-
/* @__PURE__ */ t(
|
|
362
|
-
/* @__PURE__ */ O(
|
|
361
|
+
/* @__PURE__ */ t(Ie, {}),
|
|
362
|
+
/* @__PURE__ */ O(Re, { children: [
|
|
363
363
|
/* @__PURE__ */ t("title", { children: c }),
|
|
364
364
|
/* @__PURE__ */ t("meta", { name: "og:title", content: c }),
|
|
365
365
|
/* @__PURE__ */ t("meta", { name: "og:description", content: g }),
|
|
@@ -385,7 +385,7 @@ function A({
|
|
|
385
385
|
var U, V;
|
|
386
386
|
const w = n.sections[k];
|
|
387
387
|
if (!w || w.visibility === "hidden") return null;
|
|
388
|
-
const
|
|
388
|
+
const I = (U = w.locales) == null ? void 0 : U[s], ae = ((V = w.locales) == null ? void 0 : V[i]) ?? {};
|
|
389
389
|
return /* @__PURE__ */ t(
|
|
390
390
|
Ne,
|
|
391
391
|
{
|
|
@@ -394,7 +394,7 @@ function A({
|
|
|
394
394
|
mode: e,
|
|
395
395
|
section: w,
|
|
396
396
|
config: {
|
|
397
|
-
...
|
|
397
|
+
...ke(I) ? ae : I,
|
|
398
398
|
locale: s,
|
|
399
399
|
dev: e === "draft" ? {
|
|
400
400
|
mode: e,
|
|
@@ -408,17 +408,17 @@ function A({
|
|
|
408
408
|
})
|
|
409
409
|
}
|
|
410
410
|
),
|
|
411
|
-
!((
|
|
411
|
+
!((M = a.footer) != null && M.hidden) && /* @__PURE__ */ t(Ue, {})
|
|
412
412
|
] });
|
|
413
413
|
}
|
|
414
|
-
const et = ee(() => import("./publish-button-
|
|
414
|
+
const et = ee(() => import("./publish-button-B2tZwJP0.js")), se = Y(ge)`
|
|
415
415
|
&.sticky {
|
|
416
416
|
position: sticky;
|
|
417
417
|
top: 0;
|
|
418
418
|
}
|
|
419
419
|
`;
|
|
420
420
|
function tt({ logo: e }) {
|
|
421
|
-
const [o, n] =
|
|
421
|
+
const [o, n] = Ce(), s = ve((r) => r.breakpoints.down("sm")), { value: i } = ne(() => {
|
|
422
422
|
var a, c;
|
|
423
423
|
const r = new URL(
|
|
424
424
|
s ? ((a = window == null ? void 0 : window.blocklet) == null ? void 0 : a.appLogo) || "/.well-known/service/blocklet/logo" : ((c = window == null ? void 0 : window.blocklet) == null ? void 0 : c.appLogoRect) || "/.well-known/service/blocklet/logo-rect",
|
|
@@ -438,7 +438,7 @@ function tt({ logo: e }) {
|
|
|
438
438
|
if (e)
|
|
439
439
|
return e;
|
|
440
440
|
if (o)
|
|
441
|
-
return /* @__PURE__ */ t(B, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html:
|
|
441
|
+
return /* @__PURE__ */ t(B, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: Se.sanitize(o) } });
|
|
442
442
|
if (i) {
|
|
443
443
|
const r = new URL(i);
|
|
444
444
|
r.searchParams.set("imageFilter", "convert"), r.searchParams.set("f", "png"), r.searchParams.set("h", "80");
|
|
@@ -452,7 +452,7 @@ function ot({
|
|
|
452
452
|
translucentTextColor: o,
|
|
453
453
|
...n
|
|
454
454
|
}) {
|
|
455
|
-
const {
|
|
455
|
+
const { top: s = 0 } = we(() => document.getElementById("app")) || {};
|
|
456
456
|
let i = Math.min(s / 800, 1), r = "";
|
|
457
457
|
if (i > 0.1) {
|
|
458
458
|
i = Math.max(i, 0.6);
|
|
@@ -9,7 +9,7 @@ import { produce as oe } from "immer";
|
|
|
9
9
|
import N from "lodash/difference";
|
|
10
10
|
import { useState as D, useMemo as L, useCallback as P, forwardRef as se, useImperativeHandle as le, useEffect as ae } from "react";
|
|
11
11
|
import { useAsync as ce } from "react-use";
|
|
12
|
-
import { L as de } from "./home-
|
|
12
|
+
import { L as de } from "./home-CSX7cAwr.js";
|
|
13
13
|
import { p as ue, g as me } from "./array-CUVFSUuJ.js";
|
|
14
14
|
function pe(r) {
|
|
15
15
|
const [m, h] = D(!1);
|