@blocklet/pages-kit-inner-components 0.5.29 → 0.5.31
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 +47 -23
- package/lib/cjs/chunks/array-BH41o7C6.js +475 -0
- package/lib/cjs/chunks/{config-string-C4Q0hgG0.js → config-string-B3JoYJVu.js} +1 -1
- package/lib/cjs/chunks/{draft-data-Cu9gua-P.js → draft-data-hZaTeHgL.js} +1 -1
- package/lib/cjs/chunks/home-B6E0yAU3.js +38 -0
- package/lib/cjs/chunks/{publish-button-DvwoFH1F.js → publish-button-CO_WU_f5.js} +1 -1
- package/lib/cjs/chunks/site-state-D5jk8eJT.js +57 -0
- package/lib/cjs/chunks/state-DxOb57hO.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +3 -1
- package/lib/cjs/project-html.js +2 -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/es/add-component.js +795 -749
- package/lib/es/chunks/array-NLDZzhVt.js +2224 -0
- package/lib/es/chunks/{config-string-CNLg1EYu.js → config-string-DutyRoOh.js} +1 -1
- package/lib/es/chunks/{draft-data-hSHLdxKp.js → draft-data-DjX0kpDC.js} +1 -1
- package/lib/es/chunks/{home-CNk6U8FU.js → home-CxRa0eKd.js} +112 -96
- package/lib/es/chunks/{publish-button-BftBlabj.js → publish-button-1bl_Nuva.js} +3 -3
- package/lib/es/chunks/site-state-DEduMTrY.js +2073 -0
- package/lib/es/chunks/state-C02ZI8vz.js +605 -0
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +3 -3
- package/lib/es/locales.js +44 -6
- package/lib/es/project-html.js +43 -42
- package/lib/es/resources.js +51 -51
- package/lib/es/setting.js +2 -2
- package/lib/es/site-state.js +1 -1
- package/package.json +10 -10
- package/lib/cjs/chunks/array-CJC7ex3i.js +0 -467
- package/lib/cjs/chunks/home-CimGvyT9.js +0 -38
- package/lib/cjs/chunks/site-state-JgP3yURe.js +0 -57
- package/lib/cjs/chunks/state-jCG5gSUJ.js +0 -1
- package/lib/es/chunks/array-9j8tOSbO.js +0 -1993
- package/lib/es/chunks/site-state-BB9-Tm4i.js +0 -1930
- package/lib/es/chunks/state-D5BnGunt.js +0 -483
package/lib/es/locales.js
CHANGED
|
@@ -39,7 +39,8 @@ const t = e({
|
|
|
39
39
|
topToggle: {
|
|
40
40
|
sitemap: "Sitemap",
|
|
41
41
|
data: "Data Source",
|
|
42
|
-
|
|
42
|
+
template: "Templates",
|
|
43
|
+
page: "Pages"
|
|
43
44
|
},
|
|
44
45
|
dataSourceEmpty: 'No data sources yet, click "Add" button to create',
|
|
45
46
|
selectDataSource: "Please select a data source from the list",
|
|
@@ -86,6 +87,14 @@ const t = e({
|
|
|
86
87
|
}
|
|
87
88
|
},
|
|
88
89
|
maker: {
|
|
90
|
+
sections: {
|
|
91
|
+
empty: "No Sections",
|
|
92
|
+
emptySubItems: "No Sub Sections"
|
|
93
|
+
},
|
|
94
|
+
layoutBlock: {
|
|
95
|
+
draftPlaceholder: `Use grid to arrange sections layout \r
|
|
96
|
+
( this tip only show in draft mode)`
|
|
97
|
+
},
|
|
89
98
|
pageTitle: "Pages Editor",
|
|
90
99
|
save: "Save",
|
|
91
100
|
publish: "Publish",
|
|
@@ -96,6 +105,7 @@ const t = e({
|
|
|
96
105
|
publishSuccessMessage: "Published",
|
|
97
106
|
importSuccessMessage: "Imported successfully",
|
|
98
107
|
preview: "Preview",
|
|
108
|
+
pagePreview: "Preview",
|
|
99
109
|
livePreview: "Live Preview",
|
|
100
110
|
production: "Production",
|
|
101
111
|
draft: "Draft",
|
|
@@ -148,7 +158,9 @@ const t = e({
|
|
|
148
158
|
addPage: "Create Page",
|
|
149
159
|
createResource: "Create Resource",
|
|
150
160
|
addResource: "Add Resource from Store",
|
|
151
|
-
pages: "
|
|
161
|
+
pages: "Pages",
|
|
162
|
+
template: "Templates",
|
|
163
|
+
sections: "Sections",
|
|
152
164
|
deleteTitle: "Delete {name} page?",
|
|
153
165
|
deleteSectionTitle: "Delete {name} section?",
|
|
154
166
|
empty: "No pages",
|
|
@@ -285,7 +297,14 @@ const t = e({
|
|
|
285
297
|
llmPropertyDescribe: "Description for AI",
|
|
286
298
|
loading: "Loading...",
|
|
287
299
|
componentNotFound: "Component not found",
|
|
288
|
-
templateName: "Template Name"
|
|
300
|
+
templateName: "Template Name",
|
|
301
|
+
mobile: "Mobile",
|
|
302
|
+
desktop: "Desktop",
|
|
303
|
+
columns: "Columns",
|
|
304
|
+
visualGridLayout: "Configure Grid Layout",
|
|
305
|
+
dragResizeInstructions: "Drag and resize cards to set layout, you can set different layouts for desktop and mobile",
|
|
306
|
+
setAsBackgroundElement: "Set as background element (cannot drag and resize)",
|
|
307
|
+
setAsNormalElement: "Set as normal element (can drag and resize)"
|
|
289
308
|
},
|
|
290
309
|
siteMap: {
|
|
291
310
|
routes: "Routes",
|
|
@@ -528,7 +547,8 @@ const t = e({
|
|
|
528
547
|
topToggle: {
|
|
529
548
|
sitemap: "站点地图",
|
|
530
549
|
data: "数据源",
|
|
531
|
-
|
|
550
|
+
template: "模板",
|
|
551
|
+
page: "页面"
|
|
532
552
|
},
|
|
533
553
|
dataSourceEmpty: '暂无数据源,点击"添加"按钮创建',
|
|
534
554
|
selectDataSource: "请选择左侧的数据源进行操作",
|
|
@@ -575,6 +595,14 @@ const t = e({
|
|
|
575
595
|
}
|
|
576
596
|
},
|
|
577
597
|
maker: {
|
|
598
|
+
sections: {
|
|
599
|
+
empty: "暂无卡片",
|
|
600
|
+
emptySubItems: "暂无子卡片"
|
|
601
|
+
},
|
|
602
|
+
layoutBlock: {
|
|
603
|
+
draftPlaceholder: `使用网格布局对卡片进行排版 \r
|
|
604
|
+
(此提示仅在草稿模式下显示)`
|
|
605
|
+
},
|
|
578
606
|
pageTitle: "页面编辑器",
|
|
579
607
|
save: "保存",
|
|
580
608
|
publish: "发布",
|
|
@@ -585,6 +613,7 @@ const t = e({
|
|
|
585
613
|
publishSuccessMessage: "发布成功",
|
|
586
614
|
importSuccessMessage: "导入成功",
|
|
587
615
|
preview: "预览",
|
|
616
|
+
pagePreview: "页面预览",
|
|
588
617
|
livePreview: "实时预览",
|
|
589
618
|
production: "正式版",
|
|
590
619
|
draft: "草稿",
|
|
@@ -637,7 +666,9 @@ const t = e({
|
|
|
637
666
|
addPage: "创建页面",
|
|
638
667
|
createResource: "创建资源",
|
|
639
668
|
addResource: "从商店添加资源",
|
|
640
|
-
pages: "
|
|
669
|
+
pages: "页面",
|
|
670
|
+
template: "模板",
|
|
671
|
+
sections: "卡片",
|
|
641
672
|
deleteTitle: "删除 {name} 页面?",
|
|
642
673
|
deleteSectionTitle: "删除 {name} 卡片?",
|
|
643
674
|
empty: "暂无页面",
|
|
@@ -774,7 +805,14 @@ const t = e({
|
|
|
774
805
|
llmPropertyDescribe: "AI提示描述",
|
|
775
806
|
loading: "加载中...",
|
|
776
807
|
componentNotFound: "未找到组件",
|
|
777
|
-
templateName: "模板名称"
|
|
808
|
+
templateName: "模板名称",
|
|
809
|
+
mobile: "移动端",
|
|
810
|
+
desktop: "桌面端",
|
|
811
|
+
columns: "列数",
|
|
812
|
+
visualGridLayout: "配置网格布局",
|
|
813
|
+
dragResizeInstructions: "通过调整卡片位置和大小调整布局,可以分别设置桌面端和移动端两种布局",
|
|
814
|
+
setAsBackgroundElement: "设置为背景卡片(无法拖拽排序、无法设置大小)",
|
|
815
|
+
setAsNormalElement: "设置为普通卡片(可拖拽排序、可设置大小)"
|
|
778
816
|
},
|
|
779
817
|
siteMap: {
|
|
780
818
|
routes: "路由列表",
|
package/lib/es/project-html.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import N from "@arcblock/did-auth-storage-nedb";
|
|
2
|
-
import
|
|
2
|
+
import l, { getBlockletJs as H } from "@blocklet/sdk/lib/config";
|
|
3
3
|
import O from "@blocklet/sdk/lib/service/auth";
|
|
4
4
|
import R from "@blocklet/sdk/lib/wallet";
|
|
5
5
|
import J from "@blocklet/sdk/lib/wallet-authenticator";
|
|
6
6
|
import z from "@blocklet/sdk/lib/wallet-handler";
|
|
7
7
|
import G, { resolve as x } from "path";
|
|
8
|
-
import { l as T, g as Y } from "./chunks/site-state-
|
|
8
|
+
import { l as T, g as Y } from "./chunks/site-state-DEduMTrY.js";
|
|
9
9
|
import { createSnapshotMiddleware as Q } from "@arcblock/crawler-middleware";
|
|
10
10
|
import { PreloadComponentScriptModule as V } from "@blocklet/pages-kit/types";
|
|
11
11
|
import { isMuiColorKey as X } from "@blocklet/pages-kit/utils/common";
|
|
@@ -48,10 +48,10 @@ const re = new J();
|
|
|
48
48
|
new z({
|
|
49
49
|
authenticator: re,
|
|
50
50
|
tokenStorage: new N({
|
|
51
|
-
dbPath: G.join(
|
|
51
|
+
dbPath: G.join(l.env.dataDir, "auth.db")
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
|
-
const ce = new O(),
|
|
54
|
+
const ce = new O(), ie = async () => {
|
|
55
55
|
try {
|
|
56
56
|
const o = j.get("blockletInfo");
|
|
57
57
|
if (o)
|
|
@@ -61,7 +61,7 @@ const ce = new O(), se = async () => {
|
|
|
61
61
|
} catch {
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
|
-
},
|
|
64
|
+
}, se = ["/assets/"];
|
|
65
65
|
function Pe({
|
|
66
66
|
app: o,
|
|
67
67
|
viteDevServer: t,
|
|
@@ -84,49 +84,50 @@ function Pe({
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
_();
|
|
87
|
-
}),
|
|
87
|
+
}), l.env.preferences.snapkitEnabled && l.env.preferences.snapkitEndpoint && l.env.SNAP_KIT_ACCESS_KEY && h.use(
|
|
88
88
|
Q({
|
|
89
|
-
endpoint:
|
|
90
|
-
accessKey:
|
|
91
|
-
cacheMax:
|
|
89
|
+
endpoint: l.env.preferences.snapkitEndpoint,
|
|
90
|
+
accessKey: l.env.SNAP_KIT_ACCESS_KEY,
|
|
91
|
+
cacheMax: l.env.preferences.snapkitCacheSize || 100
|
|
92
92
|
})
|
|
93
93
|
), h.get("/:path(*)?", async (n, k, _) => {
|
|
94
94
|
var E, P, A;
|
|
95
|
-
if (
|
|
96
|
-
var
|
|
97
|
-
return (
|
|
95
|
+
if (se.some((s) => {
|
|
96
|
+
var m;
|
|
97
|
+
return (m = n.path) == null ? void 0 : m.startsWith(s);
|
|
98
98
|
})) {
|
|
99
99
|
_();
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
const y = performance.now(), C = () => Math.round(performance.now() - y), D = "production";
|
|
103
|
-
let c, u,
|
|
103
|
+
let c, u, S = d;
|
|
104
104
|
if (n.path.startsWith("/pages")) {
|
|
105
|
-
const s = n.params.lang,
|
|
106
|
-
let g = (s &&
|
|
105
|
+
const s = n.params.lang, m = n.cookies.nf_lang, b = /* @__PURE__ */ new Set([...l.env.languages.map((w) => w.code)]);
|
|
106
|
+
let g = (s && b.has(s) ? s : void 0) || (b.has(m) ? m : void 0) || [...b][0];
|
|
107
107
|
if ((!g || !((E = e.supportedLocales) != null && E.find((w) => w.locale === g))) && (g = ((A = (P = e.supportedLocales) == null ? void 0 : P[0]) == null ? void 0 : A.locale) || ""), g) {
|
|
108
108
|
const w = [];
|
|
109
|
-
Object.values(e.pages).forEach((
|
|
110
|
-
const B = Object.values((
|
|
111
|
-
(
|
|
112
|
-
var
|
|
113
|
-
return
|
|
109
|
+
Object.values(e.pages).forEach((i) => {
|
|
110
|
+
const B = Object.values((i == null ? void 0 : i.sections) ?? {}).filter(
|
|
111
|
+
(p) => {
|
|
112
|
+
var v;
|
|
113
|
+
return p.component === "custom-component" && ((v = p.config) == null ? void 0 : v.componentId);
|
|
114
114
|
}
|
|
115
|
-
).map((
|
|
116
|
-
var
|
|
115
|
+
).map((p) => {
|
|
116
|
+
var v, $;
|
|
117
117
|
return {
|
|
118
|
-
id:
|
|
119
|
-
componentId:
|
|
120
|
-
useCache:
|
|
121
|
-
cacheDuration:
|
|
122
|
-
properties: ($ = (
|
|
118
|
+
id: p.id,
|
|
119
|
+
componentId: p.config.componentId,
|
|
120
|
+
useCache: p.config.useCache,
|
|
121
|
+
cacheDuration: p.config.cacheDuration,
|
|
122
|
+
properties: ($ = (v = i == null ? void 0 : i.dataSource) == null ? void 0 : v[p.id]) == null ? void 0 : $[g]
|
|
123
|
+
// ?? i.locales?.[respectLocale!]?.properties,
|
|
123
124
|
};
|
|
124
125
|
});
|
|
125
126
|
w.push(...B);
|
|
126
127
|
});
|
|
127
|
-
const U = new Promise((
|
|
128
|
+
const U = new Promise((i) => {
|
|
128
129
|
setTimeout(() => {
|
|
129
|
-
|
|
130
|
+
i({});
|
|
130
131
|
}, 90 * 1e3);
|
|
131
132
|
});
|
|
132
133
|
try {
|
|
@@ -139,32 +140,32 @@ function Pe({
|
|
|
139
140
|
locale: g,
|
|
140
141
|
instances: w,
|
|
141
142
|
module: V.UMD_FN
|
|
142
|
-
}).then((
|
|
143
|
-
|
|
143
|
+
}).then((i) => {
|
|
144
|
+
i && (u = Z(i));
|
|
144
145
|
})
|
|
145
146
|
]);
|
|
146
|
-
} catch (
|
|
147
|
-
T.warn("getPreloadComponents timeout in promise race, skip inject html elements",
|
|
147
|
+
} catch (i) {
|
|
148
|
+
T.warn("getPreloadComponents timeout in promise race, skip inject html elements", i);
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
try {
|
|
152
|
-
const s = (c == null ? void 0 : c.title) ||
|
|
153
|
+
const s = (c == null ? void 0 : c.title) || l.env.appName, m = (c == null ? void 0 : c.description) || l.env.appDescription, b = oe(W(l.env.appUrl, "/.well-known/service/blocklet/og.png"), {
|
|
153
154
|
title: s,
|
|
154
|
-
description:
|
|
155
|
+
description: m
|
|
155
156
|
});
|
|
156
|
-
|
|
157
|
+
S = te.render(d, {
|
|
157
158
|
ogTitle: s,
|
|
158
|
-
ogDescription:
|
|
159
|
-
ogImage: le(c == null ? void 0 : c.image) ||
|
|
159
|
+
ogDescription: m,
|
|
160
|
+
ogImage: le(c == null ? void 0 : c.image) || b,
|
|
160
161
|
pagesPublishedAt: (e == null ? void 0 : e.config.publishedAt) || (/* @__PURE__ */ new Date()).getTime()
|
|
161
162
|
});
|
|
162
163
|
} catch {
|
|
163
164
|
}
|
|
164
|
-
const r = e == null ? void 0 : e.config.fontFamily, K = n.query.mode === "draft" || n.url.includes("preview"), f = M.load(
|
|
165
|
+
const r = e == null ? void 0 : e.config.fontFamily, K = n.query.mode === "draft" || n.url.includes("preview"), f = M.load(S);
|
|
165
166
|
let a = c == null ? void 0 : c.backgroundColor;
|
|
166
167
|
if (a && X(a)) {
|
|
167
|
-
const s = await
|
|
168
|
+
const s = await ie();
|
|
168
169
|
a = ee(
|
|
169
170
|
s,
|
|
170
171
|
// 目前 dark 和 light 还是前端行为,后端通过 从 light 中获取
|
|
@@ -200,12 +201,12 @@ function Pe({
|
|
|
200
201
|
const s = M.load(n.cachedHtml);
|
|
201
202
|
f("body").html(s("body").html() || "");
|
|
202
203
|
}
|
|
203
|
-
|
|
204
|
+
S = f.html(), k.send(S), T.info(`[html] render: ${n.path}, ${C()}ms`), f.root().children().remove(), S = null, c = null, u = null;
|
|
204
205
|
}), o.use(h);
|
|
205
206
|
}
|
|
206
207
|
function le(o) {
|
|
207
208
|
const t = q("image-bin");
|
|
208
|
-
return t && o && !/^(https?:\/\/|\/)/.test(o) ?
|
|
209
|
+
return t && o && !/^(https?:\/\/|\/)/.test(o) ? l.env.appUrl + W(t, "uploads", o) : o;
|
|
209
210
|
}
|
|
210
211
|
export {
|
|
211
212
|
Pe as default
|
package/lib/es/resources.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as S, i as b, a as M, l as x, C as J, R as X, S as N, t as W, b as G } from "./chunks/site-state-
|
|
1
|
+
import { P as S, i as b, a as M, l as x, C as J, R as X, S as N, t as W, b as G } from "./chunks/site-state-DEduMTrY.js";
|
|
2
2
|
import { AsyncLocalStorage as K } from "async_hooks";
|
|
3
3
|
import { Router as Y } from "express";
|
|
4
4
|
import d from "fs";
|
|
@@ -9,16 +9,16 @@ import C, { join as z } from "path";
|
|
|
9
9
|
import D from "@blocklet/sdk/lib/middlewares/auth";
|
|
10
10
|
import { getResourceExportDir as H } from "@blocklet/sdk/lib/component";
|
|
11
11
|
new K();
|
|
12
|
-
const Q = async (
|
|
12
|
+
const Q = async (o, t, e) => {
|
|
13
13
|
var n, s, r, i;
|
|
14
14
|
try {
|
|
15
|
-
const { projectId: a } =
|
|
15
|
+
const { projectId: a } = o.params;
|
|
16
16
|
if (!a)
|
|
17
|
-
return
|
|
17
|
+
return e();
|
|
18
18
|
const m = await S.findByPk(a);
|
|
19
19
|
if (!m)
|
|
20
20
|
return t == null ? void 0 : t.status(404).json({ error: "Project not found" });
|
|
21
|
-
const y = (n =
|
|
21
|
+
const y = (n = o.user) == null ? void 0 : n.did, w = ((s = o.user) == null ? void 0 : s.role) || "UNKNOWN_ROLE";
|
|
22
22
|
if (!y)
|
|
23
23
|
return t == null ? void 0 : t.status(401).json({ error: "Authentication required" });
|
|
24
24
|
if (b()) {
|
|
@@ -27,75 +27,75 @@ const Q = async (e, t, o) => {
|
|
|
27
27
|
return t == null ? void 0 : t.status(403).json({ error: "No permission to access this project in multi-tenant mode" });
|
|
28
28
|
} else if (!["owner", "admin", "pagesEditor"].includes(w))
|
|
29
29
|
return t == null ? void 0 : t.status(403).json({ error: "No permission to access this project in single-tenant mode" });
|
|
30
|
-
|
|
30
|
+
o.project = m, o.projectId = a, e();
|
|
31
31
|
} catch (a) {
|
|
32
32
|
x.error("Project middleware error:", a), t == null || t.status(500).json({ error: "Internal server error" });
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
function
|
|
36
|
-
return new Promise((
|
|
37
|
-
const s = d.createReadStream(
|
|
38
|
-
s.on("error", n), r.on("error", n), r.on("finish",
|
|
35
|
+
function B(o, t) {
|
|
36
|
+
return new Promise((e, n) => {
|
|
37
|
+
const s = d.createReadStream(o), r = d.createWriteStream(t);
|
|
38
|
+
s.on("error", n), r.on("error", n), r.on("finish", e), s.pipe(r);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
async function
|
|
41
|
+
async function T(o, t) {
|
|
42
42
|
await d.promises.mkdir(t, { recursive: !0 });
|
|
43
|
-
const
|
|
44
|
-
for (const n of
|
|
45
|
-
const s = C.join(
|
|
46
|
-
n.isDirectory() ? await
|
|
43
|
+
const e = await d.promises.readdir(o, { withFileTypes: !0 });
|
|
44
|
+
for (const n of e) {
|
|
45
|
+
const s = C.join(o, n.name), r = C.join(t, n.name);
|
|
46
|
+
n.isDirectory() ? await T(s, r) : await B(s, r);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
async function V(
|
|
50
|
-
(await d.promises.stat(
|
|
49
|
+
async function V(o, t) {
|
|
50
|
+
(await d.promises.stat(o)).isDirectory() ? await T(o, t) : await B(o, t);
|
|
51
51
|
}
|
|
52
|
-
const h = (
|
|
53
|
-
const
|
|
54
|
-
return z(
|
|
55
|
-
}, O = Y(), L = "@page", U = "@component", I = ":", E = "ALL", F = "@project", k = ({ pageId:
|
|
56
|
-
const [t,
|
|
57
|
-
if (t === L) return { pageId: n, projectId:
|
|
58
|
-
}, v = ({ componentId:
|
|
59
|
-
const [t,
|
|
60
|
-
if (t === U) return { componentId: n, projectId:
|
|
61
|
-
},
|
|
62
|
-
const [t,
|
|
63
|
-
if (t === F) return
|
|
64
|
-
}, rt = (
|
|
52
|
+
const h = (o, t, e) => b() ? D()(o, t, e) : D({ roles: ["owner", "admin", "pagesEditor"] })(o, t, e), Z = (o, t) => {
|
|
53
|
+
const e = H({ projectId: o, releaseId: t });
|
|
54
|
+
return z(e, J, X);
|
|
55
|
+
}, O = Y(), L = "@page", U = "@component", I = ":", E = "ALL", F = "@project", k = ({ pageId: o, projectId: t }) => [L, t, o].join(I), q = (o) => {
|
|
56
|
+
const [t, e, n] = o.split(I);
|
|
57
|
+
if (t === L) return { pageId: n, projectId: e };
|
|
58
|
+
}, v = ({ componentId: o, projectId: t }) => [U, t, o].join(I), tt = (o) => {
|
|
59
|
+
const [t, e, n] = o.split(I);
|
|
60
|
+
if (t === U) return { componentId: n, projectId: e };
|
|
61
|
+
}, ot = (o) => [F, o].join(I), et = (o) => {
|
|
62
|
+
const [t, e] = o.split(I);
|
|
63
|
+
if (t === F) return e;
|
|
64
|
+
}, rt = (o) => {
|
|
65
65
|
try {
|
|
66
|
-
return JSON.parse(
|
|
66
|
+
return JSON.parse(o);
|
|
67
67
|
} catch {
|
|
68
68
|
}
|
|
69
69
|
return {};
|
|
70
70
|
};
|
|
71
|
-
async function A(
|
|
72
|
-
const t = await N.
|
|
71
|
+
async function A(o) {
|
|
72
|
+
const t = await N.getStateByProjectId(o, "production"), e = await S.findByPk(o), n = t.pageIds.map((r) => {
|
|
73
73
|
const i = t.pages[r];
|
|
74
74
|
if (i)
|
|
75
|
-
return { id: k({ pageId: r, projectId:
|
|
75
|
+
return { id: k({ pageId: r, projectId: o }), name: i.slug };
|
|
76
76
|
}).filter(Boolean), s = $(Object.values(t.components), (r) => r.index).map(({ data: r }) => ({
|
|
77
|
-
id: v({ componentId: r.id, projectId:
|
|
77
|
+
id: v({ componentId: r.id, projectId: o }),
|
|
78
78
|
name: r.name || r.id
|
|
79
79
|
}));
|
|
80
80
|
return {
|
|
81
|
-
id:
|
|
82
|
-
name: (
|
|
81
|
+
id: ot(o),
|
|
82
|
+
name: (e == null ? void 0 : e.name) || "Unnamed Project",
|
|
83
83
|
children: [
|
|
84
|
-
{ id: k({ pageId: E, projectId:
|
|
84
|
+
{ id: k({ pageId: E, projectId: o }), name: "Pages", children: n },
|
|
85
85
|
{
|
|
86
|
-
id: v({ componentId: E, projectId:
|
|
86
|
+
id: v({ componentId: E, projectId: o }),
|
|
87
87
|
name: "Components",
|
|
88
88
|
children: s
|
|
89
89
|
}
|
|
90
90
|
]
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
O.get("/resources", h, async (
|
|
94
|
-
const { projectId:
|
|
95
|
-
if (
|
|
96
|
-
|
|
93
|
+
O.get("/resources", h, async (o, t) => {
|
|
94
|
+
const { projectId: e } = rt(o.query.resourcesParams);
|
|
95
|
+
if (e) {
|
|
96
|
+
o.params = { ...o.params, projectId: e }, await Q(o, t, () => {
|
|
97
97
|
});
|
|
98
|
-
const r = await A(
|
|
98
|
+
const r = await A(e);
|
|
99
99
|
t.json({ resources: [r] });
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
@@ -113,10 +113,10 @@ const nt = g.object({
|
|
|
113
113
|
resources: g.array().items(g.string()).required(),
|
|
114
114
|
locale: g.string().allow("")
|
|
115
115
|
});
|
|
116
|
-
O.post("/resources", h, async (
|
|
117
|
-
const { resources:
|
|
118
|
-
for (const c of
|
|
119
|
-
if (
|
|
116
|
+
O.post("/resources", h, async (o, t) => {
|
|
117
|
+
const { resources: e, projectId: n, releaseId: s } = await nt.validateAsync(o.body), r = "production", i = [], a = [];
|
|
118
|
+
for (const c of e) {
|
|
119
|
+
if (et(c))
|
|
120
120
|
continue;
|
|
121
121
|
const { pageId: l, projectId: f } = q(c) || {};
|
|
122
122
|
if (l)
|
|
@@ -135,7 +135,7 @@ O.post("/resources", h, async (e, t) => {
|
|
|
135
135
|
const m = _(i, "projectId"), y = _(a, "projectId"), w = /* @__PURE__ */ new Set([...Object.keys(m), ...Object.keys(y)]), P = Z(n, s);
|
|
136
136
|
d.rmSync(P, { recursive: !0, force: !0 }), d.mkdirSync(P, { recursive: !0 });
|
|
137
137
|
for (const c of w) {
|
|
138
|
-
const l = await N.
|
|
138
|
+
const l = await N.getStateByProjectId(c, r), f = m[c], u = y[c], p = f == null ? void 0 : f.map((j) => j.pageId), R = u == null ? void 0 : u.map((j) => j.componentId);
|
|
139
139
|
if (p != null && p.length || R != null && R.length) {
|
|
140
140
|
const j = await W(l, {
|
|
141
141
|
exportAssets: !0,
|
|
@@ -151,8 +151,8 @@ O.post("/resources", h, async (e, t) => {
|
|
|
151
151
|
}
|
|
152
152
|
t.json({});
|
|
153
153
|
});
|
|
154
|
-
O.get("/all-resources", h, async (
|
|
155
|
-
const { states:
|
|
154
|
+
O.get("/all-resources", h, async (o, t) => {
|
|
155
|
+
const { states: e } = await G(), n = e == null ? void 0 : e.map((s) => {
|
|
156
156
|
const r = {
|
|
157
157
|
blockletId: s.blockletId,
|
|
158
158
|
blockletTitle: s.blockletTitle,
|
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, h as xe } from "./chunks/state-
|
|
2
|
+
import { t as ve, g as Te, b as ce, E as ot, n as Ke, h as xe } from "./chunks/state-C02ZI8vz.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-
|
|
15
|
+
import { C as kt } from "./chunks/config-string-DutyRoOh.js";
|
|
16
16
|
import we from "lodash/isEmpty";
|
|
17
17
|
import He from "lodash/set";
|
|
18
18
|
import * as fe from "yaml";
|
package/lib/es/site-state.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as j, o as q, p as v, S as B, r as L, s as U, u as h, b as y, w as z, v as C, n as F, t as G, x as J } from "./chunks/site-state-
|
|
1
|
+
import { q as j, o as q, p as v, S as B, r as L, s as U, u as h, b as y, w as z, v as C, n as F, t as G, x as J } from "./chunks/site-state-DEduMTrY.js";
|
|
2
2
|
import "@blocklet/pages-kit/utils/property";
|
|
3
3
|
import "@blocklet/pages-kit/utils/route";
|
|
4
4
|
import "@blocklet/sdk/lib/component";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit-inner-components",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.31",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -71,22 +71,22 @@
|
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@arcblock/did-auth": "^1.20.11",
|
|
73
73
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
74
|
-
"@arcblock/did-connect": "^2.13.
|
|
75
|
-
"@arcblock/react-hooks": "^2.13.
|
|
76
|
-
"@arcblock/ux": "^2.13.
|
|
74
|
+
"@arcblock/did-connect": "^2.13.57",
|
|
75
|
+
"@arcblock/react-hooks": "^2.13.57",
|
|
76
|
+
"@arcblock/ux": "^2.13.57",
|
|
77
77
|
"@blocklet/ai-kit": "^0.1.78",
|
|
78
78
|
"@blocklet/ai-runtime": "^0.4.271",
|
|
79
79
|
"@blocklet/code-editor": "^0.4.271",
|
|
80
|
-
"@blocklet/embed": "^0.2.
|
|
80
|
+
"@blocklet/embed": "^0.2.5",
|
|
81
81
|
"@blocklet/js-sdk": "^1.16.43",
|
|
82
82
|
"@blocklet/logger": "1.16.36",
|
|
83
83
|
"@blocklet/quickjs": "^0.4.271",
|
|
84
84
|
"@blocklet/sdk": "^1.16.43",
|
|
85
85
|
"@blocklet/studio-ui": "^0.4.271",
|
|
86
86
|
"@blocklet/tracker": "^1.16.43",
|
|
87
|
-
"@blocklet/ui-react": "^2.13.
|
|
88
|
-
"@blocklet/uploader": "^0.1.
|
|
89
|
-
"@blocklet/uploader-server": "^0.1.
|
|
87
|
+
"@blocklet/ui-react": "^2.13.57",
|
|
88
|
+
"@blocklet/uploader": "^0.1.95",
|
|
89
|
+
"@blocklet/uploader-server": "^0.1.100",
|
|
90
90
|
"@emotion/cache": "^11.13.1",
|
|
91
91
|
"@emotion/css": "^11.13.0",
|
|
92
92
|
"@emotion/react": "^11.13.0",
|
|
@@ -204,8 +204,8 @@
|
|
|
204
204
|
"yaml": "^2.5.0",
|
|
205
205
|
"yjs": "^13.6.18",
|
|
206
206
|
"zustand": "^4.5.5",
|
|
207
|
-
"@blocklet/pages-kit": "^0.5.
|
|
208
|
-
"@blocklet/pages-kit
|
|
207
|
+
"@blocklet/pages-kit-block-studio": "^0.5.31",
|
|
208
|
+
"@blocklet/pages-kit": "^0.5.31"
|
|
209
209
|
},
|
|
210
210
|
"devDependencies": {
|
|
211
211
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|