@blocklet/pages-kit-inner-components 0.1.8 → 0.4.22
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/components-paCr_hhD.js +48 -0
- package/lib/cjs/_chunks/{draft-data-CgY7-dem.js → draft-data-BwJ1xNZb.js} +1 -1
- package/lib/cjs/_chunks/{home-D7i9eFDB.js → home-DQaT0unu.js} +3 -3
- package/lib/cjs/_chunks/publish-button-BNJS7rMq.js +1 -0
- package/lib/cjs/_chunks/site-state-HLTcjGnI.js +1 -0
- package/lib/cjs/_chunks/state-CVPLn5Cq.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/project-html.js +3 -2
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/cjs/theme.js +1 -1
- package/lib/cjs/uploader.js +1 -1
- package/lib/es/_chunks/components-CqR6z_0s.js +454 -0
- package/lib/es/_chunks/{draft-data-CyvourYt.js → draft-data-B6NRV_eF.js} +1 -1
- package/lib/es/_chunks/{home-cM7dMWyx.js → home-C7rHVbsK.js} +12 -12
- package/lib/es/_chunks/{publish-button-D1FdjYsc.js → publish-button-C44FGAGB.js} +7 -7
- package/lib/es/_chunks/{site-state-DH2gSYZG.js → site-state-Bvk8uNN5.js} +183 -181
- package/lib/es/_chunks/{state-C0vjPuun.js → state-CVCmClC_.js} +4 -4
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +6 -6
- package/lib/es/project-html.js +55 -53
- package/lib/es/resources.js +2 -2
- package/lib/es/setting.js +4 -4
- package/lib/es/site-state.js +15 -13
- package/lib/es/theme.js +2 -2
- package/lib/es/uploader.js +1 -1
- package/package.json +17 -17
- package/lib/cjs/_chunks/components-Bu9hOpQX.js +0 -48
- package/lib/cjs/_chunks/publish-button-CrxBSa6-.js +0 -1
- package/lib/cjs/_chunks/site-state-Bnmllv1a.js +0 -1
- package/lib/cjs/_chunks/state-BQClQU2N.js +0 -1
- package/lib/es/_chunks/components-BVBbxiyS.js +0 -453
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { getComponentMountPoint as v } from "@blocklet/pages-kit/builtin/utils";
|
|
2
|
+
import { PreloadComponentScriptModule as b } from "@blocklet/pages-kit/types";
|
|
3
|
+
import { componentUMDName as L, RenderNestedComponent as M, mergeComponent as U } from "@blocklet/pages-kit/utils/property";
|
|
4
|
+
import { memoize as O, Sandbox as _, BuiltinModules as D } from "@blocklet/quickjs";
|
|
5
|
+
import T from "@blocklet/sdk/lib/config";
|
|
6
|
+
import { LRUCache as F } from "lru-cache";
|
|
7
|
+
import B, { Headers as J } from "node-fetch";
|
|
8
|
+
import { joinURL as y, getQuery as G, withQuery as K, parseURL as j, withHttps as Q } from "ufo";
|
|
9
|
+
import W from "@blocklet/logger";
|
|
10
|
+
import A from "vite-plugin-node-polyfills/shims/buffer";
|
|
11
|
+
import { BuiltinModules as V } from "@blocklet/pages-kit/utils/builtin";
|
|
12
|
+
import { createBuiltinModuleTransformer as H, isRelativeModule as I } from "@blocklet/pages-kit/utils/typescript/builtin-module-transformer";
|
|
13
|
+
import { call as z } from "@blocklet/sdk/lib/component";
|
|
14
|
+
import X from "autoprefixer";
|
|
15
|
+
import * as Y from "esbuild";
|
|
16
|
+
import Z from "postcss";
|
|
17
|
+
import q from "tailwindcss";
|
|
18
|
+
import d from "typescript";
|
|
19
|
+
const h = W("pages-kit"), ee = async (t, { componentId: e }) => {
|
|
20
|
+
const o = `@tailwind components;
|
|
21
|
+
@tailwind utilities;
|
|
22
|
+
`, n = `.CustomComponent_${e}`;
|
|
23
|
+
return (await Z([
|
|
24
|
+
q({ content: [{ raw: t, extension: "tsx" }] }),
|
|
25
|
+
X({
|
|
26
|
+
overrideBrowserslist: ["> 1%", "last 2 versions"],
|
|
27
|
+
stats: {}
|
|
28
|
+
}),
|
|
29
|
+
(a) => {
|
|
30
|
+
a.walkRules((r) => {
|
|
31
|
+
r.selectors = r.selectors.map((c) => c.replace(/\.(.+)/g, `${n}.$1,${n} .$1`));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// FIXME: cssnano use browserslist, it is not working with the fs isolation
|
|
35
|
+
// cssnano({ preset: 'default' }),
|
|
36
|
+
]).process(o)).css;
|
|
37
|
+
}, te = async (t, { componentId: e }) => {
|
|
38
|
+
const o = await ee(t, { componentId: e });
|
|
39
|
+
return `export const __PagesKit_CSS__ = ${JSON.stringify(o)};
|
|
40
|
+
|
|
41
|
+
${t}
|
|
42
|
+
`;
|
|
43
|
+
}, $ = O(
|
|
44
|
+
async (t, e) => {
|
|
45
|
+
let o = d.transpileModule(t, {
|
|
46
|
+
compilerOptions: {
|
|
47
|
+
jsx: d.JsxEmit.React,
|
|
48
|
+
target: d.ScriptTarget.ES2016,
|
|
49
|
+
module: d.ModuleKind.ESNext
|
|
50
|
+
},
|
|
51
|
+
transformers: {
|
|
52
|
+
before: [H(d)]
|
|
53
|
+
}
|
|
54
|
+
}).outputText;
|
|
55
|
+
if (e.tailwind && (o = await te(o, { componentId: e.componentId })), e.module === b.ESM) return o;
|
|
56
|
+
const n = d.transpileModule(o, {
|
|
57
|
+
compilerOptions: {
|
|
58
|
+
jsx: d.JsxEmit.React,
|
|
59
|
+
target: d.ScriptTarget.ES2016,
|
|
60
|
+
module: d.ModuleKind.CommonJS,
|
|
61
|
+
moduleResolution: d.ModuleResolutionKind.Node16
|
|
62
|
+
}
|
|
63
|
+
}).outputText;
|
|
64
|
+
return e.module === b.CJS ? n : ne(e.moduleName, n);
|
|
65
|
+
},
|
|
66
|
+
{ keyGenerator: (t, e) => JSON.stringify(["transpileModule", t, e]) }
|
|
67
|
+
), oe = async (t, e) => {
|
|
68
|
+
var r, c;
|
|
69
|
+
const n = (c = (r = (await Y.build({
|
|
70
|
+
entryPoints: ["index.tsx"],
|
|
71
|
+
external: Object.keys(V),
|
|
72
|
+
format: "esm",
|
|
73
|
+
target: "esnext",
|
|
74
|
+
bundle: !0,
|
|
75
|
+
write: !1,
|
|
76
|
+
plugins: [
|
|
77
|
+
{
|
|
78
|
+
name: "vfs",
|
|
79
|
+
setup(u) {
|
|
80
|
+
u.onResolve({ filter: /.*/ }, (s) => s.path === "index.tsx" ? { path: "index.tsx", namespace: "vfs" } : s.path === "./component" ? { path: "component.tsx", namespace: "vfs" } : I(s.path) ? { path: s.path, namespace: "vfs" } : null), u.onLoad({ filter: /.*/, namespace: "vfs" }, async (s) => {
|
|
81
|
+
if (s.path === "index.tsx")
|
|
82
|
+
return { contents: `export { ${e} } from './component'`, loader: "tsx" };
|
|
83
|
+
if (s.path === "component.tsx")
|
|
84
|
+
return { contents: t, loader: "tsx" };
|
|
85
|
+
if (I(s.path)) {
|
|
86
|
+
const l = s.path.split("/").pop(), f = y("chunks", l), { data: g } = await z({
|
|
87
|
+
name: "pages-kit",
|
|
88
|
+
method: "GET",
|
|
89
|
+
path: f
|
|
90
|
+
});
|
|
91
|
+
return { contents: g, loader: "js" };
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
})).outputFiles) == null ? void 0 : r[0]) == null ? void 0 : c.contents;
|
|
99
|
+
if (!n) throw new Error("Failed to build server code");
|
|
100
|
+
const i = A.from(n).toString();
|
|
101
|
+
return d.transpileModule(i, {
|
|
102
|
+
compilerOptions: { module: d.ModuleKind.ESNext, target: d.ScriptTarget.ES2020 }
|
|
103
|
+
}).outputText;
|
|
104
|
+
}, k = O(
|
|
105
|
+
async (t, e) => {
|
|
106
|
+
const o = await oe(t, e);
|
|
107
|
+
return new RegExp(`export\\s+\\{\\s+${e}\\s+\\}`, "m").test(o) ? o : void 0;
|
|
108
|
+
},
|
|
109
|
+
{ keyGenerator: (t, e) => JSON.stringify(["extractExportValueSchema", t, e]) }
|
|
110
|
+
), ne = (t, e) => {
|
|
111
|
+
const o = /\bawait\b/.test(e);
|
|
112
|
+
return `// GENERATED FILE. DO NOT EDIT.
|
|
113
|
+
var ${t} = ${o ? "async" : ""} function () {
|
|
114
|
+
|
|
115
|
+
const exports = {};
|
|
116
|
+
let moduleExports = null;
|
|
117
|
+
|
|
118
|
+
// add commonjs module compatibility layer
|
|
119
|
+
const module = { exports: moduleExports };
|
|
120
|
+
|
|
121
|
+
// execute component code
|
|
122
|
+
${e}
|
|
123
|
+
|
|
124
|
+
// handle possible module.exports
|
|
125
|
+
if (module.exports && module.exports !== moduleExports) {
|
|
126
|
+
// if module.exports is used, use it first
|
|
127
|
+
return typeof module.exports === 'object' ? module.exports : { default: module.exports };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ensure a default export
|
|
131
|
+
if (!('default' in exports) && Object.keys(exports).length === 0) {
|
|
132
|
+
// module has no exports, return null to indicate invalid
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return exports;
|
|
137
|
+
};
|
|
138
|
+
`;
|
|
139
|
+
}, w = new F({
|
|
140
|
+
max: 100
|
|
141
|
+
}), re = 60 * 60, N = 60;
|
|
142
|
+
function se(t) {
|
|
143
|
+
h.info("clear preload components cache", { cacheKey: t }), w.delete(t);
|
|
144
|
+
}
|
|
145
|
+
function je(t) {
|
|
146
|
+
for (const e of w.keys())
|
|
147
|
+
e.includes(t) && (h.info("clear preload components cache", { cacheKey: e }), se(e));
|
|
148
|
+
}
|
|
149
|
+
function ce({
|
|
150
|
+
mode: t,
|
|
151
|
+
instanceId: e,
|
|
152
|
+
componentId: o,
|
|
153
|
+
locale: n
|
|
154
|
+
}) {
|
|
155
|
+
return ["getPreloadComponents", t, e, o, n].join("-");
|
|
156
|
+
}
|
|
157
|
+
async function Ie({
|
|
158
|
+
mode: t,
|
|
159
|
+
req: e,
|
|
160
|
+
state: o,
|
|
161
|
+
locale: n,
|
|
162
|
+
instances: i,
|
|
163
|
+
module: a
|
|
164
|
+
}) {
|
|
165
|
+
const {
|
|
166
|
+
supportedLocales: r,
|
|
167
|
+
config: { defaultLocale: c }
|
|
168
|
+
} = o;
|
|
169
|
+
if (!c) return null;
|
|
170
|
+
const u = (await Promise.all(
|
|
171
|
+
i.map(async (p) => {
|
|
172
|
+
try {
|
|
173
|
+
const m = ce({
|
|
174
|
+
mode: t,
|
|
175
|
+
instanceId: p.id,
|
|
176
|
+
componentId: p.componentId,
|
|
177
|
+
locale: n
|
|
178
|
+
});
|
|
179
|
+
if (t !== "draft" && p.useCache && w.has(m))
|
|
180
|
+
return h.info(`get preload component from cache: ${m}`), w.get(m);
|
|
181
|
+
const x = C({ state: o, componentId: p.componentId });
|
|
182
|
+
if (!x) return null;
|
|
183
|
+
const S = await ie({
|
|
184
|
+
req: e,
|
|
185
|
+
state: o,
|
|
186
|
+
componentId: x.id,
|
|
187
|
+
locale: n,
|
|
188
|
+
defaultLocale: c,
|
|
189
|
+
properties: p.properties
|
|
190
|
+
});
|
|
191
|
+
if (!S) return null;
|
|
192
|
+
const P = { instanceId: p.id, preload: S };
|
|
193
|
+
if (t !== "draft" && p.useCache) {
|
|
194
|
+
let E = re;
|
|
195
|
+
p.cacheDuration && (E = p.cacheDuration), h.info(`set preload component to cache(${E}s): ${m}`), w.set(m, P, {
|
|
196
|
+
ttl: E * 1e3
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return P;
|
|
200
|
+
} catch (m) {
|
|
201
|
+
return h.error("get preload component error", { instanceId: p.id, componentId: p.componentId }, { error: m }), null;
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
)).filter((p) => !!p), s = Object.values(
|
|
205
|
+
u.reduce((p, m) => ({ ...p, ...m.preload.components }), {})
|
|
206
|
+
);
|
|
207
|
+
async function l() {
|
|
208
|
+
const p = await Promise.all(
|
|
209
|
+
s.map(async (m) => {
|
|
210
|
+
const x = L({ componentId: m.component.id }), S = a === b.ESM ? {
|
|
211
|
+
module: a,
|
|
212
|
+
script: await $(m.script, {
|
|
213
|
+
componentId: m.component.id,
|
|
214
|
+
module: a,
|
|
215
|
+
tailwind: t !== "draft"
|
|
216
|
+
})
|
|
217
|
+
} : {
|
|
218
|
+
module: a,
|
|
219
|
+
script: await $(m.script, {
|
|
220
|
+
componentId: m.component.id,
|
|
221
|
+
module: a,
|
|
222
|
+
moduleName: x,
|
|
223
|
+
tailwind: t !== "draft"
|
|
224
|
+
}),
|
|
225
|
+
moduleName: x
|
|
226
|
+
};
|
|
227
|
+
return [m.component.id, { component: m.component, script: S }];
|
|
228
|
+
})
|
|
229
|
+
);
|
|
230
|
+
return Object.fromEntries(p);
|
|
231
|
+
}
|
|
232
|
+
const f = await l();
|
|
233
|
+
return {
|
|
234
|
+
config: { defaultLocale: c, supportedLocales: r },
|
|
235
|
+
components: f,
|
|
236
|
+
instances: u.map((p) => ({
|
|
237
|
+
id: p.instanceId,
|
|
238
|
+
componentId: p.preload.component.id,
|
|
239
|
+
locales: { [p.preload.locale]: { props: p.preload.props } }
|
|
240
|
+
}))
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
async function ie({
|
|
244
|
+
req: t,
|
|
245
|
+
state: e,
|
|
246
|
+
componentId: o,
|
|
247
|
+
locale: n,
|
|
248
|
+
defaultLocale: i,
|
|
249
|
+
properties: a
|
|
250
|
+
}) {
|
|
251
|
+
const { supportedLocales: r } = e, c = C({ state: e, componentId: o });
|
|
252
|
+
if (!c) return null;
|
|
253
|
+
const u = r.some((l) => l.locale === n) ? n : i;
|
|
254
|
+
if (!u) return null;
|
|
255
|
+
const s = await R({ req: t, state: e, componentId: o, locale: u, defaultLocale: i, properties: a });
|
|
256
|
+
return s ? {
|
|
257
|
+
component: c,
|
|
258
|
+
...s
|
|
259
|
+
} : null;
|
|
260
|
+
}
|
|
261
|
+
const ae = 20;
|
|
262
|
+
async function R({
|
|
263
|
+
req: t,
|
|
264
|
+
depth: e = 0,
|
|
265
|
+
state: o,
|
|
266
|
+
componentId: n,
|
|
267
|
+
locale: i,
|
|
268
|
+
defaultLocale: a,
|
|
269
|
+
properties: r
|
|
270
|
+
}) {
|
|
271
|
+
if (e > ae) throw new RangeError("max component depth exceeded");
|
|
272
|
+
const c = pe({ state: o, componentId: n, properties: r, locale: i });
|
|
273
|
+
if (!c) return null;
|
|
274
|
+
const { props: u } = c, s = {
|
|
275
|
+
locale: i || a,
|
|
276
|
+
components: { [c.component.id]: { component: c.component, script: c.script } },
|
|
277
|
+
props: { ...u }
|
|
278
|
+
};
|
|
279
|
+
try {
|
|
280
|
+
const l = await le({ ...c, req: t });
|
|
281
|
+
l != null && l.props && Object.assign(s.props, l.props);
|
|
282
|
+
} catch (l) {
|
|
283
|
+
h.error("preload data at server side error", { componentId: n, name: c.component.name }, { error: l });
|
|
284
|
+
}
|
|
285
|
+
return await Promise.all(
|
|
286
|
+
Object.entries(u).map(async ([l, f]) => {
|
|
287
|
+
if ((f == null ? void 0 : f.type) === M) {
|
|
288
|
+
const g = await R({
|
|
289
|
+
req: t,
|
|
290
|
+
depth: e + 1,
|
|
291
|
+
state: o,
|
|
292
|
+
componentId: f.componentId,
|
|
293
|
+
locale: i,
|
|
294
|
+
defaultLocale: a,
|
|
295
|
+
properties: f.properties
|
|
296
|
+
});
|
|
297
|
+
g && (Object.assign(s.components, g.components), Object.assign(s.props, {
|
|
298
|
+
[l]: {
|
|
299
|
+
type: M,
|
|
300
|
+
componentId: f.componentId,
|
|
301
|
+
props: g.props
|
|
302
|
+
}
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
), s;
|
|
307
|
+
}
|
|
308
|
+
function pe({
|
|
309
|
+
state: t,
|
|
310
|
+
componentId: e,
|
|
311
|
+
locale: o,
|
|
312
|
+
properties: n
|
|
313
|
+
}) {
|
|
314
|
+
const i = C({ state: t, componentId: e });
|
|
315
|
+
if (!i) return null;
|
|
316
|
+
const a = U({
|
|
317
|
+
componentId: e,
|
|
318
|
+
getComponent: (r) => C({ state: t, componentId: r }),
|
|
319
|
+
locale: o,
|
|
320
|
+
defaultLocale: t.config.defaultLocale,
|
|
321
|
+
properties: n
|
|
322
|
+
});
|
|
323
|
+
return a ? { component: i, script: a.script, props: { locale: o, ...a.properties } } : null;
|
|
324
|
+
}
|
|
325
|
+
function C({ state: t, componentId: e }) {
|
|
326
|
+
var o, n, i;
|
|
327
|
+
return ((o = t.components[e]) == null ? void 0 : o.data) ?? ((i = (n = t.resources.components) == null ? void 0 : n[e]) == null ? void 0 : i.component);
|
|
328
|
+
}
|
|
329
|
+
function $e({ state: t, name: e }) {
|
|
330
|
+
var n, i;
|
|
331
|
+
const o = e.toLowerCase();
|
|
332
|
+
return ((n = Object.values(t.components).find((a) => {
|
|
333
|
+
var r;
|
|
334
|
+
return ((r = a.data.name) == null ? void 0 : r.toLowerCase()) === o;
|
|
335
|
+
})) == null ? void 0 : n.data) ?? ((i = t.resources.components && Object.values(t.resources.components).find((a) => {
|
|
336
|
+
var r;
|
|
337
|
+
return ((r = a.component.name) == null ? void 0 : r.toLowerCase()) === o;
|
|
338
|
+
})) == null ? void 0 : i.component);
|
|
339
|
+
}
|
|
340
|
+
async function le({
|
|
341
|
+
component: t,
|
|
342
|
+
script: e,
|
|
343
|
+
props: o,
|
|
344
|
+
req: n
|
|
345
|
+
}) {
|
|
346
|
+
const i = await k(e, "getServerSideProps");
|
|
347
|
+
if (!i) return null;
|
|
348
|
+
const a = new Promise((r, c) => {
|
|
349
|
+
setTimeout(() => c(new Error("getServerSideProps timeout in promise race")), N * 1e3);
|
|
350
|
+
});
|
|
351
|
+
return Promise.race([
|
|
352
|
+
a,
|
|
353
|
+
_.callFunction({
|
|
354
|
+
code: `${i}
|
|
355
|
+
|
|
356
|
+
export async function getServerSidePropsWrapper({ location, fetch, props}) {
|
|
357
|
+
globalThis.location = location
|
|
358
|
+
globalThis.fetch = fetch
|
|
359
|
+
|
|
360
|
+
return getServerSideProps(props);
|
|
361
|
+
}
|
|
362
|
+
`,
|
|
363
|
+
filename: `${t.name || t.id}.js`,
|
|
364
|
+
moduleLoader: (r) => {
|
|
365
|
+
if (r === "@blocklet/pages-kit/builtin/utils")
|
|
366
|
+
return `const { joinURL, withQuery, getQuery, getComponentMountPoint } = globalThis
|
|
367
|
+
export { joinURL, withQuery, getQuery, getComponentMountPoint }
|
|
368
|
+
`;
|
|
369
|
+
if (r === "@blocklet/pages-kit/builtin/dayjs")
|
|
370
|
+
return D.dayjs;
|
|
371
|
+
},
|
|
372
|
+
global: {
|
|
373
|
+
console: {
|
|
374
|
+
// NOTE: do not return logger.xxx result, it will cause memory leak
|
|
375
|
+
// eslint-disable-next-line prettier/prettier
|
|
376
|
+
log: (...r) => {
|
|
377
|
+
h.info(...r);
|
|
378
|
+
},
|
|
379
|
+
warn: (...r) => {
|
|
380
|
+
h.warn(...r);
|
|
381
|
+
},
|
|
382
|
+
error: (...r) => {
|
|
383
|
+
h.error(...r);
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
getComponentMountPoint: v,
|
|
387
|
+
joinURL: y,
|
|
388
|
+
withQuery: K,
|
|
389
|
+
getQuery: G
|
|
390
|
+
},
|
|
391
|
+
functionName: "getServerSidePropsWrapper",
|
|
392
|
+
args: [
|
|
393
|
+
{
|
|
394
|
+
// NOTE: IMPORTANT! place location and fetch (has side effect) at the args not global
|
|
395
|
+
// because the global is shared between all runtime and just init once
|
|
396
|
+
location: { href: y(Q(n.hostname), n.originalUrl) },
|
|
397
|
+
fetch: (r, { ...c } = {}) => {
|
|
398
|
+
const u = typeof r == "string" && r.startsWith("/") ? y(T.env.appUrl, r) : r;
|
|
399
|
+
if (typeof u == "string" && j(u).host === j(T.env.appUrl).host) {
|
|
400
|
+
const s = n.get("cookie");
|
|
401
|
+
if (s) {
|
|
402
|
+
const l = new J(c.headers);
|
|
403
|
+
l.set("cookie", s), c.headers = l;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return B(u, {
|
|
407
|
+
...c,
|
|
408
|
+
timeout: N * 1e3
|
|
409
|
+
}).then((s) => ({
|
|
410
|
+
ok: s.ok,
|
|
411
|
+
status: s.status,
|
|
412
|
+
statusText: s.statusText,
|
|
413
|
+
headers: Object.fromEntries(s.headers.entries()),
|
|
414
|
+
json: () => s.json()
|
|
415
|
+
}));
|
|
416
|
+
},
|
|
417
|
+
props: o
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
})
|
|
421
|
+
]);
|
|
422
|
+
}
|
|
423
|
+
const Ne = O(
|
|
424
|
+
async (t, e, o) => {
|
|
425
|
+
const n = await k(t, e);
|
|
426
|
+
return n ? await _.callFunction({
|
|
427
|
+
code: `
|
|
428
|
+
${n}
|
|
429
|
+
|
|
430
|
+
export function get${e}SchemaWrapper() {
|
|
431
|
+
return ${e};
|
|
432
|
+
}
|
|
433
|
+
`,
|
|
434
|
+
filename: `${o}.js`,
|
|
435
|
+
functionName: `get${e}SchemaWrapper`
|
|
436
|
+
}) : null;
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
keyGenerator: (t, e, o) => JSON.stringify(["getExportSchemaValueFromCode", t, e, o])
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
export {
|
|
443
|
+
re as C,
|
|
444
|
+
N as G,
|
|
445
|
+
Ie as a,
|
|
446
|
+
se as b,
|
|
447
|
+
je as c,
|
|
448
|
+
ce as d,
|
|
449
|
+
ie as e,
|
|
450
|
+
C as f,
|
|
451
|
+
Ne as g,
|
|
452
|
+
$e as h,
|
|
453
|
+
h as l
|
|
454
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { u as o, S as a, k as s, h as n } from "./state-
|
|
2
|
+
import { u as o, S as a, k as s, h as n } from "./state-CVCmClC_.js";
|
|
3
3
|
function d({ children: t }) {
|
|
4
4
|
const r = o();
|
|
5
5
|
return /* @__PURE__ */ e(a, { url: s(r ?? ""), name: "root", waitingSynced: !0, children: /* @__PURE__ */ e(i, { children: t }) });
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as n, jsxs as _, Fragment as U } from "react/jsx-runtime";
|
|
2
|
-
import { a as R, g as N, i as ae, b as ce, E as le, c as ct, d as lt, e as Et, u as de, f as me } from "./state-
|
|
3
|
-
import { useLocaleContext as zt } from "@
|
|
2
|
+
import { a as R, g as N, i as ae, b as ce, E as le, c as ct, d as lt, e as Et, u as de, f as me } from "./state-CVCmClC_.js";
|
|
3
|
+
import { useLocaleContext as zt } from "@blocklet/pages-kit/builtin/locale";
|
|
4
4
|
import Wt from "@arcblock/ux/lib/Result";
|
|
5
5
|
import { useHeaderState as ue } from "@blocklet/pages-kit/builtin/page/header";
|
|
6
6
|
import pe from "@blocklet/ui-react/lib/Header";
|
|
7
7
|
import { cx as k, css as nt } from "@emotion/css";
|
|
8
8
|
import { Global as Lt, css as Ot } from "@emotion/react";
|
|
9
9
|
import Ht from "@emotion/styled";
|
|
10
|
-
import { Box as b, Tooltip as he, styled as At, Stack as dt, Typography as P, Container as fe, useTheme as ge, createTheme as xe, ThemeProvider as be, Card as ye, CircularProgress as Mt, Grid as vt, CardMedia as we, CardContent as ve, Button as ke } from "@mui/material";
|
|
10
|
+
import { Box as b, Tooltip as he, styled as At, Stack as dt, Typography as P, Container as fe, useTheme as ge, createTheme as xe, ThemeProvider as be, Card as ye, CircularProgress as Mt, Grid as vt, CardMedia as we, CardContent as ve, Button as ke } from "@blocklet/pages-kit/builtin/mui/material";
|
|
11
11
|
import { useLatest as _e, useReactive as $e } from "ahooks";
|
|
12
12
|
import Se from "isomorphic-dompurify";
|
|
13
13
|
import { omit as Ut, cloneDeep as kt, isEqual as Ce } from "lodash";
|
|
14
14
|
import Ne from "lodash/isEmpty";
|
|
15
|
-
import Ft, { forwardRef as Ie, useState as T, useCallback as mt, useRef as F, Fragment as Pe, isValidElement as Vt, useEffect as E, useMemo as j, createContext as je, useContext as Gt, lazy as Dt, Suspense as Be } from "react";
|
|
15
|
+
import Ft, { forwardRef as Ie, useState as T, useCallback as mt, useRef as F, Fragment as Pe, isValidElement as Vt, useEffect as E, useMemo as j, createContext as je, useContext as Gt, lazy as Dt, Suspense as Be } from "@blocklet/pages-kit/builtin/react";
|
|
16
16
|
import { Helmet as Re } from "react-helmet";
|
|
17
|
-
import { Link as Te, NavLink as Ee, useNavigate as ze, useSearchParams as We, Routes as Le, Route as Y, Navigate as Oe, ScrollRestoration as He } from "react-router-dom";
|
|
17
|
+
import { Link as Te, NavLink as Ee, useNavigate as ze, useSearchParams as We, Routes as Le, Route as Y, Navigate as Oe, ScrollRestoration as He } from "@blocklet/pages-kit/builtin/react-router-dom";
|
|
18
18
|
import { useUpdate as Ae, useMount as Me, useWindowScroll as Ue, useAsync as qt } from "react-use";
|
|
19
19
|
import { withoutTrailingSlash as tt, isRelative as Fe, parseURL as Ve, joinURL as Q } from "ufo";
|
|
20
20
|
import "@mui/icons-material";
|
|
@@ -22,10 +22,10 @@ import { AIForm as _t, AIFormResult as $t } from "@blocklet/ai-runtime/component
|
|
|
22
22
|
import { deepmerge as Ge } from "@mui/utils";
|
|
23
23
|
import ut from "lodash/pick";
|
|
24
24
|
import { ErrorBoundary as De } from "react-error-boundary";
|
|
25
|
-
import { Icon as ot } from "@iconify/react";
|
|
26
|
-
import qe from "react-markdown";
|
|
25
|
+
import { Icon as ot } from "@blocklet/pages-kit/builtin/iconify/react";
|
|
26
|
+
import qe from "@blocklet/pages-kit/builtin/async/react-markdown";
|
|
27
27
|
import Je from "remark-gfm";
|
|
28
|
-
import { LoadingButton as Ke } from "@mui/lab";
|
|
28
|
+
import { LoadingButton as Ke } from "@blocklet/pages-kit/builtin/mui/lab";
|
|
29
29
|
import { useTheme as pt, styled as $ } from "@arcblock/ux/lib/Theme";
|
|
30
30
|
import Xe from "@arcblock/react-hooks/lib/useBrowser";
|
|
31
31
|
import St from "@arcblock/ux/lib/Colors";
|
|
@@ -43,7 +43,7 @@ import { EmbedIframe as nn } from "@blocklet/embed/react";
|
|
|
43
43
|
import { TwitterTimelineEmbed as on } from "react-twitter-embed";
|
|
44
44
|
import rn from "@blocklet/ui-react/lib/Footer";
|
|
45
45
|
import sn from "webfontloader";
|
|
46
|
-
import { createAuthServiceSessionContext as an } from "@
|
|
46
|
+
import { createAuthServiceSessionContext as an } from "@blocklet/pages-kit/builtin/session";
|
|
47
47
|
function cn(t, e, o, r) {
|
|
48
48
|
t.locales || (t.locales = {}), t.locales[o] = t.locales[o] || {}, t.locales[o].title = r.title ?? t.locales[o].title, t.locales[o].image = r.image ?? t.locales[o].image, t.locales[o].description = r.description ?? t.locales[o].description, Object.entries(r.sectionsData).forEach(([i, s]) => {
|
|
49
49
|
var c, l, d, u;
|
|
@@ -124,7 +124,7 @@ function dn({
|
|
|
124
124
|
}
|
|
125
125
|
) }) });
|
|
126
126
|
}
|
|
127
|
-
const mn = Ft.lazy(() => import("react-syntax-highlighter").then((t) => ({ default: t.Prism }))), un = At((t) => /* @__PURE__ */ n(
|
|
127
|
+
const mn = Ft.lazy(() => import("@blocklet/pages-kit/builtin/async/react-syntax-highlighter").then((t) => ({ default: t.Prism }))), un = At((t) => /* @__PURE__ */ n(
|
|
128
128
|
qe,
|
|
129
129
|
{
|
|
130
130
|
...t,
|
|
@@ -2046,7 +2046,7 @@ function jo({ mode: t }) {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
return /* @__PURE__ */ n(Bo, { children: ({ state: e }) => /* @__PURE__ */ n(et, { mode: t, state: e }) });
|
|
2048
2048
|
}
|
|
2049
|
-
const Bo = Dt(() => import("./draft-data-
|
|
2049
|
+
const Bo = Dt(() => import("./draft-data-B6NRV_eF.js"));
|
|
2050
2050
|
function Ro({
|
|
2051
2051
|
mode: t,
|
|
2052
2052
|
children: e
|
|
@@ -2262,7 +2262,7 @@ function at({
|
|
|
2262
2262
|
!((bt = a.footer) != null && bt.hidden) && /* @__PURE__ */ n(wo, {})
|
|
2263
2263
|
] });
|
|
2264
2264
|
}
|
|
2265
|
-
const To = Dt(() => import("./publish-button-
|
|
2265
|
+
const To = Dt(() => import("./publish-button-C44FGAGB.js")), re = Ht(pe)`
|
|
2266
2266
|
&.sticky {
|
|
2267
2267
|
position: sticky;
|
|
2268
2268
|
top: 0;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as e, jsxs as p, Fragment as H } from "react/jsx-runtime";
|
|
2
|
-
import { u as R, l as J, f as q, P as G } from "./state-
|
|
3
|
-
import { useLocaleContext as V } from "@
|
|
2
|
+
import { u as R, l as J, f as q, P as G } from "./state-CVCmClC_.js";
|
|
3
|
+
import { useLocaleContext as V } from "@blocklet/pages-kit/builtin/locale";
|
|
4
4
|
import I from "@arcblock/ux/lib/Toast";
|
|
5
5
|
import { Warning as F, Sync as Q, VisibilityOff as U } from "@mui/icons-material";
|
|
6
|
-
import { LoadingButton as K } from "@mui/lab";
|
|
7
|
-
import { createSvgIcon as X, Dialog as Y, DialogTitle as Z, Box as E, IconButton as _, DialogContent as $, DialogActions as ee, Button as re, Alert as ie, List as te, ListItem as S, ListItemButton as O, ListItemIcon as z, Checkbox as W, ListItemText as C, Tooltip as M, Chip as ne } from "@mui/material";
|
|
8
|
-
import { produce as oe } from "immer";
|
|
6
|
+
import { LoadingButton as K } from "@blocklet/pages-kit/builtin/mui/lab";
|
|
7
|
+
import { createSvgIcon as X, Dialog as Y, DialogTitle as Z, Box as E, IconButton as _, DialogContent as $, DialogActions as ee, Button as re, Alert as ie, List as te, ListItem as S, ListItemButton as O, ListItemIcon as z, Checkbox as W, ListItemText as C, Tooltip as M, Chip as ne } from "@blocklet/pages-kit/builtin/mui/material";
|
|
8
|
+
import { produce as oe } from "@blocklet/pages-kit/builtin/immer";
|
|
9
9
|
import N from "lodash/difference";
|
|
10
|
-
import { useState as D, useMemo as j, useCallback as L, forwardRef as se, useImperativeHandle as le, useEffect as ce } from "react";
|
|
10
|
+
import { useState as D, useMemo as j, useCallback as L, forwardRef as se, useImperativeHandle as le, useEffect as ce } from "@blocklet/pages-kit/builtin/react";
|
|
11
11
|
import { useAsync as ae } from "react-use";
|
|
12
|
-
import { p as de, g as ue, L as me } from "./home-
|
|
12
|
+
import { p as de, g as ue, L as me } from "./home-C7rHVbsK.js";
|
|
13
13
|
function ge(r) {
|
|
14
14
|
const [a, y] = D(!1);
|
|
15
15
|
return /* @__PURE__ */ e(
|