@blocklet/pages-kit-inner-components 0.5.30 → 0.5.32

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.
Files changed (37) hide show
  1. package/lib/cjs/add-component.js +47 -23
  2. package/lib/cjs/chunks/array-DxhrK2d5.js +475 -0
  3. package/lib/cjs/chunks/{config-string-C4Q0hgG0.js → config-string-DqWgB7yO.js} +1 -1
  4. package/lib/cjs/chunks/{draft-data-Cu9gua-P.js → draft-data-DzN2u_NT.js} +1 -1
  5. package/lib/cjs/chunks/home-0fezWT4S.js +38 -0
  6. package/lib/cjs/chunks/{publish-button-DvwoFH1F.js → publish-button-D2jaaXXn.js} +1 -1
  7. package/lib/cjs/chunks/site-state-D5jk8eJT.js +57 -0
  8. package/lib/cjs/chunks/state-DoGBMTzI.js +1 -0
  9. package/lib/cjs/components.js +1 -1
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/locales.js +3 -1
  12. package/lib/cjs/project-html.js +2 -2
  13. package/lib/cjs/resources.js +1 -1
  14. package/lib/cjs/setting.js +1 -1
  15. package/lib/cjs/site-state.js +1 -1
  16. package/lib/es/add-component.js +795 -749
  17. package/lib/es/chunks/array-D6qyZucY.js +2224 -0
  18. package/lib/es/chunks/{config-string-CNLg1EYu.js → config-string-Btybe5Rd.js} +1 -1
  19. package/lib/es/chunks/{draft-data-hSHLdxKp.js → draft-data-DQ7_JyJX.js} +1 -1
  20. package/lib/es/chunks/{home-CNk6U8FU.js → home-Dox9JwvF.js} +112 -96
  21. package/lib/es/chunks/{publish-button-BftBlabj.js → publish-button-T2YJBoty.js} +3 -3
  22. package/lib/es/chunks/{site-state-DJ3JcBMm.js → site-state-DEduMTrY.js} +505 -473
  23. package/lib/es/chunks/state-NhsHvaKm.js +605 -0
  24. package/lib/es/components.js +1 -1
  25. package/lib/es/home.js +3 -3
  26. package/lib/es/locales.js +46 -6
  27. package/lib/es/project-html.js +43 -42
  28. package/lib/es/resources.js +1 -1
  29. package/lib/es/setting.js +2 -2
  30. package/lib/es/site-state.js +1 -1
  31. package/package.json +10 -10
  32. package/lib/cjs/chunks/array-CJC7ex3i.js +0 -467
  33. package/lib/cjs/chunks/home-CimGvyT9.js +0 -38
  34. package/lib/cjs/chunks/site-state-DvIWP0pO.js +0 -57
  35. package/lib/cjs/chunks/state-jCG5gSUJ.js +0 -1
  36. package/lib/es/chunks/array-9j8tOSbO.js +0 -1993
  37. 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
- page: "Page Templates"
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,15 @@ const t = e({
86
87
  }
87
88
  },
88
89
  maker: {
90
+ sections: {
91
+ empty: "No Sections",
92
+ emptySubItems: "No Sub Sections",
93
+ dropHere: "Drop here"
94
+ },
95
+ layoutBlock: {
96
+ draftPlaceholder: `Use grid to arrange sections layout \r
97
+ ( this tip only show in draft mode)`
98
+ },
89
99
  pageTitle: "Pages Editor",
90
100
  save: "Save",
91
101
  publish: "Publish",
@@ -96,6 +106,7 @@ const t = e({
96
106
  publishSuccessMessage: "Published",
97
107
  importSuccessMessage: "Imported successfully",
98
108
  preview: "Preview",
109
+ pagePreview: "Preview",
99
110
  livePreview: "Live Preview",
100
111
  production: "Production",
101
112
  draft: "Draft",
@@ -148,7 +159,9 @@ const t = e({
148
159
  addPage: "Create Page",
149
160
  createResource: "Create Resource",
150
161
  addResource: "Add Resource from Store",
151
- pages: "Page Templates",
162
+ pages: "Pages",
163
+ template: "Templates",
164
+ sections: "Sections",
152
165
  deleteTitle: "Delete {name} page?",
153
166
  deleteSectionTitle: "Delete {name} section?",
154
167
  empty: "No pages",
@@ -285,7 +298,14 @@ const t = e({
285
298
  llmPropertyDescribe: "Description for AI",
286
299
  loading: "Loading...",
287
300
  componentNotFound: "Component not found",
288
- templateName: "Template Name"
301
+ templateName: "Template Name",
302
+ mobile: "Mobile",
303
+ desktop: "Desktop",
304
+ columns: "Columns",
305
+ visualGridLayout: "Configure Grid Layout",
306
+ dragResizeInstructions: "Drag and resize cards to set layout, you can set different layouts for desktop and mobile",
307
+ setAsBackgroundElement: "Set as background element (cannot drag and resize)",
308
+ setAsNormalElement: "Set as normal element (can drag and resize)"
289
309
  },
290
310
  siteMap: {
291
311
  routes: "Routes",
@@ -528,7 +548,8 @@ const t = e({
528
548
  topToggle: {
529
549
  sitemap: "站点地图",
530
550
  data: "数据源",
531
- page: "页面模板"
551
+ template: "模板",
552
+ page: "页面"
532
553
  },
533
554
  dataSourceEmpty: '暂无数据源,点击"添加"按钮创建',
534
555
  selectDataSource: "请选择左侧的数据源进行操作",
@@ -575,6 +596,15 @@ const t = e({
575
596
  }
576
597
  },
577
598
  maker: {
599
+ sections: {
600
+ empty: "暂无卡片",
601
+ emptySubItems: "暂无子卡片",
602
+ dropHere: "拖拽到这里"
603
+ },
604
+ layoutBlock: {
605
+ draftPlaceholder: `使用网格布局对卡片进行排版 \r
606
+ (此提示仅在草稿模式下显示)`
607
+ },
578
608
  pageTitle: "页面编辑器",
579
609
  save: "保存",
580
610
  publish: "发布",
@@ -585,6 +615,7 @@ const t = e({
585
615
  publishSuccessMessage: "发布成功",
586
616
  importSuccessMessage: "导入成功",
587
617
  preview: "预览",
618
+ pagePreview: "页面预览",
588
619
  livePreview: "实时预览",
589
620
  production: "正式版",
590
621
  draft: "草稿",
@@ -637,7 +668,9 @@ const t = e({
637
668
  addPage: "创建页面",
638
669
  createResource: "创建资源",
639
670
  addResource: "从商店添加资源",
640
- pages: "页面模板",
671
+ pages: "页面",
672
+ template: "模板",
673
+ sections: "卡片",
641
674
  deleteTitle: "删除 {name} 页面?",
642
675
  deleteSectionTitle: "删除 {name} 卡片?",
643
676
  empty: "暂无页面",
@@ -774,7 +807,14 @@ const t = e({
774
807
  llmPropertyDescribe: "AI提示描述",
775
808
  loading: "加载中...",
776
809
  componentNotFound: "未找到组件",
777
- templateName: "模板名称"
810
+ templateName: "模板名称",
811
+ mobile: "移动端",
812
+ desktop: "桌面端",
813
+ columns: "列数",
814
+ visualGridLayout: "配置网格布局",
815
+ dragResizeInstructions: "通过调整卡片位置和大小调整布局,可以分别设置桌面端和移动端两种布局",
816
+ setAsBackgroundElement: "设置为背景卡片(无法拖拽排序、无法设置大小)",
817
+ setAsNormalElement: "设置为普通卡片(可拖拽排序、可设置大小)"
778
818
  },
779
819
  siteMap: {
780
820
  routes: "路由列表",
@@ -1,11 +1,11 @@
1
1
  import N from "@arcblock/did-auth-storage-nedb";
2
- import i, { getBlockletJs as H } from "@blocklet/sdk/lib/config";
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-DJ3JcBMm.js";
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(i.env.dataDir, "auth.db")
51
+ dbPath: G.join(l.env.dataDir, "auth.db")
52
52
  })
53
53
  });
54
- const ce = new O(), se = async () => {
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
- }, ie = ["/assets/"];
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
- }), i.env.preferences.snapkitEnabled && i.env.preferences.snapkitEndpoint && i.env.SNAP_KIT_ACCESS_KEY && h.use(
87
+ }), l.env.preferences.snapkitEnabled && l.env.preferences.snapkitEndpoint && l.env.SNAP_KIT_ACCESS_KEY && h.use(
88
88
  Q({
89
- endpoint: i.env.preferences.snapkitEndpoint,
90
- accessKey: i.env.SNAP_KIT_ACCESS_KEY,
91
- cacheMax: i.env.preferences.snapkitCacheSize || 100
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 (ie.some((s) => {
96
- var p;
97
- return (p = n.path) == null ? void 0 : p.startsWith(s);
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, b = d;
103
+ let c, u, S = d;
104
104
  if (n.path.startsWith("/pages")) {
105
- const s = n.params.lang, p = n.cookies.nf_lang, v = /* @__PURE__ */ new Set([...i.env.languages.map((w) => w.code)]);
106
- let g = (s && v.has(s) ? s : void 0) || (v.has(p) ? p : void 0) || [...v][0];
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((l) => {
110
- const B = Object.values((l == null ? void 0 : l.sections) ?? {}).filter(
111
- (m) => {
112
- var S;
113
- return m.component === "custom-component" && ((S = m.config) == null ? void 0 : S.componentId);
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((m) => {
116
- var S, $;
115
+ ).map((p) => {
116
+ var v, $;
117
117
  return {
118
- id: m.id,
119
- componentId: m.config.componentId,
120
- useCache: m.config.useCache,
121
- cacheDuration: m.config.cacheDuration,
122
- properties: ($ = (S = m.locales) == null ? void 0 : S[g]) == null ? void 0 : $.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((l) => {
128
+ const U = new Promise((i) => {
128
129
  setTimeout(() => {
129
- l({});
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((l) => {
143
- l && (u = Z(l));
143
+ }).then((i) => {
144
+ i && (u = Z(i));
144
145
  })
145
146
  ]);
146
- } catch (l) {
147
- T.warn("getPreloadComponents timeout in promise race, skip inject html elements", l);
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) || i.env.appName, p = (c == null ? void 0 : c.description) || i.env.appDescription, v = oe(W(i.env.appUrl, "/.well-known/service/blocklet/og.png"), {
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: p
155
+ description: m
155
156
  });
156
- b = te.render(d, {
157
+ S = te.render(d, {
157
158
  ogTitle: s,
158
- ogDescription: p,
159
- ogImage: le(c == null ? void 0 : c.image) || v,
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(b);
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 se();
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
- b = f.html(), k.send(b), T.info(`[html] render: ${n.path}, ${C()}ms`), f.root().children().remove(), b = null, c = null, u = null;
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) ? i.env.appUrl + W(t, "uploads", o) : 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
@@ -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-DJ3JcBMm.js";
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";
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-D5BnGunt.js";
2
+ import { t as ve, g as Te, b as ce, E as ot, n as Ke, h as xe } from "./chunks/state-NhsHvaKm.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-CNLg1EYu.js";
15
+ import { C as kt } from "./chunks/config-string-Btybe5Rd.js";
16
16
  import we from "lodash/isEmpty";
17
17
  import He from "lodash/set";
18
18
  import * as fe from "yaml";
@@ -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-DJ3JcBMm.js";
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.30",
3
+ "version": "0.5.32",
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.52",
75
- "@arcblock/react-hooks": "^2.13.52",
76
- "@arcblock/ux": "^2.13.52",
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.4",
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.52",
88
- "@blocklet/uploader": "^0.1.93",
89
- "@blocklet/uploader-server": "^0.1.99",
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.30",
208
- "@blocklet/pages-kit-block-studio": "^0.5.30"
207
+ "@blocklet/pages-kit": "^0.5.32",
208
+ "@blocklet/pages-kit-block-studio": "^0.5.32"
209
209
  },
210
210
  "devDependencies": {
211
211
  "@trivago/prettier-plugin-sort-imports": "^5.2.1",