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