@opentiny/tiny-engine-toolbar-save 2.5.0-rc.4 → 2.5.0-rc.6

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 (2) hide show
  1. package/dist/index.js +65 -65
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./style.css";
2
- import { reactive as N, ref as B, onMounted as P, onUnmounted as x, resolveComponent as f, createElementBlock as L, openBlock as E, createVNode as v, withCtx as d, createBlock as U, createCommentVNode as I, createTextVNode as S, createElementVNode as k } from "vue";
3
- import { ToolbarBase as G, VueMonaco as R } from "@opentiny/tiny-engine-common";
4
- import { Select as j, Checkbox as Y, DialogBox as q, Popover as z, Button as F } from "@opentiny/vue";
5
- import { useCanvas as C, getOptions as H, useNotify as A, useLayout as K, usePage as Q, getMetaApi as W, META_APP as X, useBlock as Z, useMessage as $ } from "@opentiny/tiny-engine-meta-register";
6
- import { constants as V } from "@opentiny/tiny-engine-utils";
2
+ import { reactive as N, ref as B, onMounted as P, onUnmounted as x, resolveComponent as f, createElementBlock as U, openBlock as E, createVNode as p, withCtx as d, createBlock as I, createCommentVNode as G, createTextVNode as S, createElementVNode as k } from "vue";
3
+ import { ToolbarBase as R, VueMonaco as j } from "@opentiny/tiny-engine-common";
4
+ import { Select as Y, Checkbox as q, DialogBox as z, Popover as F, Button as H } from "@opentiny/vue";
5
+ import { useMessage as V, useCanvas as C, getOptions as K, useNotify as A, useLayout as Q, usePage as W, getMetaApi as X, META_APP as Z, useBlock as $ } from "@opentiny/tiny-engine-meta-register";
6
+ import { constants as w } from "@opentiny/tiny-engine-utils";
7
7
  import { handlePageUpdate as ee } from "@opentiny/tiny-engine-common/js/http";
8
- const w = {
8
+ const D = {
9
9
  id: "engine.toolbars.save",
10
10
  type: "toolbars",
11
11
  title: "save",
@@ -15,16 +15,16 @@ const w = {
15
15
  },
16
16
  renderType: "button"
17
17
  }
18
- }, { PAGE_STATUS: g, AUTO_SAVED: D } = V, _ = N({
18
+ }, { publish: te } = V(), { PAGE_STATUS: g, AUTO_SAVED: M } = w, _ = N({
19
19
  visible: !1,
20
20
  code: "",
21
21
  originalCode: "",
22
22
  disabled: !1
23
- }), b = B(!1), te = async (a) => {
23
+ }), b = B(!1), oe = async (a) => {
24
24
  var s;
25
- const e = W(X.BlockManage), { getCurrentBlock: o } = Z(), t = o();
25
+ const e = X(Z.BlockManage), { getCurrentBlock: o } = $(), t = o();
26
26
  t.label = a.fileName, t.content = a, b.value = !0, t.screenshot = await e.getBlockBase64(), await ((s = e.saveBlock) == null ? void 0 : s.call(e, t)), b.value = !1;
27
- }, oe = async (a) => {
27
+ }, ae = async (a) => {
28
28
  const { currentPage: e } = C().pageState, o = {
29
29
  page_content: a
30
30
  };
@@ -33,21 +33,21 @@ const w = {
33
33
  id: e.id,
34
34
  params: { ...e, ...o }
35
35
  };
36
- await ee(t), b.value = !1;
36
+ await ee(t), b.value = !1, te({ topic: "page-saved" });
37
37
  }, O = (a) => {
38
- const { pageSettingState: e, isTemporaryPage: o } = Q(), { isBlock: t, canvasApi: s, pageState: l, resetBlockCanvasState: r, resetPageCanvasState: i } = C(), n = JSON.parse(a), { selectNode: c } = s.value;
38
+ const { pageSettingState: e, isTemporaryPage: o } = W(), { isBlock: t, canvasApi: s, pageState: l, resetBlockCanvasState: r, resetPageCanvasState: i } = C(), n = JSON.parse(a), { selectNode: c } = s.value;
39
39
  if (t() ? r({ ...l, pageSchema: n }) : i({ ...l, pageSchema: n }), e != null && e.isAIPage) {
40
40
  o.saved && (o.saved = !1), o.saved = !0;
41
- const p = "page_content";
42
- return e.currentPageData[p] = n, Promise.resolve();
41
+ const v = "page_content";
42
+ return e.currentPageData[v] = n, Promise.resolve();
43
43
  }
44
- return c(null), t() ? te(n) : oe(n);
45
- }, M = async () => {
46
- var p;
44
+ return c(null), t() ? oe(n) : ae(n);
45
+ }, J = async () => {
46
+ var v;
47
47
  const { isSaved: a, getSchema: e } = C();
48
48
  if (a() || _.disabled)
49
49
  return;
50
- const { beforeSave: o, saveMethod: t, saved: s } = H(w.id);
50
+ const { beforeSave: o, saveMethod: t, saved: s } = K(D.id);
51
51
  try {
52
52
  if (typeof o == "function" && await o(), typeof t == "function" && await t())
53
53
  return;
@@ -57,7 +57,7 @@ const w = {
57
57
  message: `Error in saving: ${u}`
58
58
  });
59
59
  }
60
- const l = (p = K().layoutState) == null ? void 0 : p.pageStatus, r = l == null ? void 0 : l.state, i = l == null ? void 0 : l.data, n = {
60
+ const l = (v = Q().layoutState) == null ? void 0 : v.pageStatus, r = l == null ? void 0 : l.state, i = l == null ? void 0 : l.data, n = {
61
61
  [g.Release]: "当前页面未锁定,请先锁定再保存",
62
62
  [g.Empty]: "当前应用无页面,请先新建页面再保存",
63
63
  [g.Guest]: "官网演示应用不能保存页面,如需体验请切换应用",
@@ -84,31 +84,31 @@ const w = {
84
84
  });
85
85
  }
86
86
  });
87
- }, ae = () => {
87
+ }, ne = () => {
88
88
  try {
89
- const a = localStorage.getItem(D) ?? "";
89
+ const a = localStorage.getItem(M) ?? "";
90
90
  return JSON.parse(a) ?? !1;
91
91
  } catch {
92
92
  return !1;
93
93
  }
94
- }, ne = (a) => {
94
+ }, se = (a) => {
95
95
  try {
96
- return localStorage.setItem(D, JSON.stringify(a)), !0;
96
+ return localStorage.setItem(M, JSON.stringify(a)), !0;
97
97
  } catch {
98
98
  return !1;
99
99
  }
100
- }, { OPEN_DELAY: se } = V, ie = {
100
+ }, { OPEN_DELAY: ie } = w, le = {
101
101
  saveCommon: O,
102
- openCommon: M
103
- }, le = {
102
+ openCommon: J
103
+ }, ce = {
104
104
  components: {
105
- VueMonaco: R,
106
- TinyButton: F,
107
- TinyPopover: z,
108
- TinyDialogBox: q,
109
- TinyCheckbox: Y,
110
- TinySelect: j,
111
- ToolbarBase: G
105
+ VueMonaco: j,
106
+ TinyButton: H,
107
+ TinyPopover: F,
108
+ TinyDialogBox: z,
109
+ TinyCheckbox: q,
110
+ TinySelect: Y,
111
+ ToolbarBase: R
112
112
  },
113
113
  props: {
114
114
  iconExpand: {
@@ -132,7 +132,7 @@ const w = {
132
132
  checked: !1,
133
133
  timeValue: 5,
134
134
  preservationTime: null
135
- }), o = B(null), { isSaved: t, setSaved: s, getSchema: l } = C(), { subscribe: r, unsubscribe: i } = $(), n = "toolbar-save", c = B(null);
135
+ }), o = B(null), { isSaved: t, setSaved: s, getSchema: l } = C(), { subscribe: r, unsubscribe: i } = V(), n = "toolbar-save", c = B(null);
136
136
  P(() => {
137
137
  r({
138
138
  topic: "pageOrBlockInit",
@@ -162,10 +162,10 @@ const w = {
162
162
  }), x(() => {
163
163
  i({ topic: "pageOrBlockInit", subscriber: n }), i({ topic: "schemaChange", subscriber: n }), i({ topic: "schemaImport", subscriber: n });
164
164
  });
165
- const p = () => {
165
+ const v = () => {
166
166
  e.visible = !1, e.originalCode = "";
167
167
  }, u = () => {
168
- b.value || M();
168
+ b.value || J();
169
169
  }, h = () => {
170
170
  O();
171
171
  }, T = {
@@ -178,11 +178,11 @@ const w = {
178
178
  clearTimeout(e.preservationTime), e.preservationTime = setTimeout(() => {
179
179
  u(), m();
180
180
  }, e.timeValue * 60 * 1e3);
181
- }, J = () => {
182
- ne(e.checked), e.checked ? m() : clearTimeout(e.preservationTime);
181
+ }, L = () => {
182
+ se(e.checked), e.checked ? m() : clearTimeout(e.preservationTime);
183
183
  };
184
184
  return P(() => {
185
- e.checked = ae(), e.checked && m();
185
+ e.checked = ne(), e.checked && m();
186
186
  }), x(() => {
187
187
  clearTimeout(e.preservationTime);
188
188
  }), {
@@ -191,43 +191,43 @@ const w = {
191
191
  editorOptions: T,
192
192
  isLoading: b,
193
193
  isSaved: t,
194
- close: p,
194
+ close: v,
195
195
  openApi: u,
196
196
  saveApi: h,
197
197
  delayOptions: a,
198
- saveConfig: J,
199
- OPEN_DELAY: se
198
+ saveConfig: L,
199
+ OPEN_DELAY: ie
200
200
  };
201
201
  }
202
- }, ce = (a, e) => {
202
+ }, re = (a, e) => {
203
203
  const o = a.__vccOpts || a;
204
204
  for (const [t, s] of e)
205
205
  o[t] = s;
206
206
  return o;
207
- }, re = { class: "toolbar-save" }, de = { class: "save-style" }, ue = { class: "save-time" }, me = { class: "save-button-group" };
207
+ }, de = { class: "toolbar-save" }, ue = { class: "save-style" }, me = { class: "save-time" }, pe = { class: "save-button-group" };
208
208
  function ve(a, e, o, t, s, l) {
209
- const r = f("svg-icon"), i = f("tiny-checkbox"), n = f("tiny-select"), c = f("tiny-button"), p = f("tiny-popover"), u = f("vue-monaco"), h = f("tiny-dialog-box"), T = f("toolbar-base");
210
- return E(), L("div", re, [
211
- v(T, {
209
+ const r = f("svg-icon"), i = f("tiny-checkbox"), n = f("tiny-select"), c = f("tiny-button"), v = f("tiny-popover"), u = f("vue-monaco"), h = f("tiny-dialog-box"), T = f("toolbar-base");
210
+ return E(), U("div", de, [
211
+ p(T, {
212
212
  content: t.isLoading ? "保存中" : "保存",
213
213
  icon: o.options.icon.default || o.options.icon,
214
214
  options: { ...o.options, showDots: !t.isSaved() },
215
215
  onClickApi: t.openApi
216
216
  }, {
217
217
  button: d(() => [
218
- v(p, {
218
+ p(v, {
219
219
  "visible-arrow": !1,
220
220
  width: "203",
221
221
  trigger: "click",
222
222
  "open-delay": t.OPEN_DELAY.Default
223
223
  }, {
224
224
  reference: d(() => [
225
- v(r, { name: o.iconExpand }, null, 8, ["name"])
225
+ p(r, { name: o.iconExpand }, null, 8, ["name"])
226
226
  ]),
227
227
  default: d(() => [
228
- k("div", de, [
228
+ k("div", ue, [
229
229
  e[6] || (e[6] = k("div", { class: "save-setting" }, "保存设置", -1)),
230
- v(i, {
230
+ p(i, {
231
231
  modelValue: t.state.checked,
232
232
  "onUpdate:modelValue": e[0] || (e[0] = (m) => t.state.checked = m),
233
233
  name: "tiny-checkbox"
@@ -237,9 +237,9 @@ function ve(a, e, o, t, s, l) {
237
237
  ])),
238
238
  _: 1
239
239
  }, 8, ["modelValue"]),
240
- k("div", ue, [
240
+ k("div", me, [
241
241
  e[4] || (e[4] = k("div", { class: "save-time-label" }, "保存间隔", -1)),
242
- v(n, {
242
+ p(n, {
243
243
  modelValue: t.state.timeValue,
244
244
  "onUpdate:modelValue": e[1] || (e[1] = (m) => t.state.timeValue = m),
245
245
  options: t.delayOptions,
@@ -247,8 +247,8 @@ function ve(a, e, o, t, s, l) {
247
247
  autocomplete: ""
248
248
  }, null, 8, ["modelValue", "options", "disabled"])
249
249
  ]),
250
- k("div", me, [
251
- v(c, {
250
+ k("div", pe, [
251
+ p(c, {
252
252
  type: "primary",
253
253
  onClick: t.saveConfig
254
254
  }, {
@@ -264,7 +264,7 @@ function ve(a, e, o, t, s, l) {
264
264
  }, 8, ["open-delay"])
265
265
  ]),
266
266
  default: d(() => [
267
- v(h, {
267
+ p(h, {
268
268
  class: "dialog-box",
269
269
  modal: !1,
270
270
  fullscreen: !0,
@@ -274,13 +274,13 @@ function ve(a, e, o, t, s, l) {
274
274
  "onUpdate:visible": e[2] || (e[2] = (m) => t.state.visible = m)
275
275
  }, {
276
276
  footer: d(() => [
277
- v(c, { onClick: t.close }, {
277
+ p(c, { onClick: t.close }, {
278
278
  default: d(() => e[7] || (e[7] = [
279
279
  S("取 消")
280
280
  ])),
281
281
  _: 1
282
282
  }, 8, ["onClick"]),
283
- v(c, {
283
+ p(c, {
284
284
  type: "primary",
285
285
  onClick: t.saveApi
286
286
  }, {
@@ -291,7 +291,7 @@ function ve(a, e, o, t, s, l) {
291
291
  }, 8, ["onClick"])
292
292
  ]),
293
293
  default: d(() => [
294
- t.state.visible ? (E(), U(u, {
294
+ t.state.visible ? (E(), I(u, {
295
295
  key: 0,
296
296
  ref: "editor",
297
297
  class: "monaco-editor",
@@ -299,7 +299,7 @@ function ve(a, e, o, t, s, l) {
299
299
  options: t.editorOptions,
300
300
  value: t.state.code,
301
301
  original: t.state.originalCode
302
- }, null, 8, ["options", "value", "original"])) : I("", !0)
302
+ }, null, 8, ["options", "value", "original"])) : G("", !0)
303
303
  ]),
304
304
  _: 1
305
305
  }, 8, ["visible"])
@@ -308,11 +308,11 @@ function ve(a, e, o, t, s, l) {
308
308
  }, 8, ["content", "icon", "options", "onClickApi"])
309
309
  ]);
310
310
  }
311
- const pe = /* @__PURE__ */ ce(le, [["render", ve], ["__scopeId", "data-v-047f42c8"]]), Ce = {
312
- ...w,
313
- entry: pe,
314
- apis: ie
311
+ const fe = /* @__PURE__ */ re(ce, [["render", ve], ["__scopeId", "data-v-047f42c8"]]), he = {
312
+ ...D,
313
+ entry: fe,
314
+ apis: le
315
315
  };
316
316
  export {
317
- Ce as default
317
+ he as default
318
318
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-save",
3
- "version": "2.5.0-rc.4",
3
+ "version": "2.5.0-rc.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,12 +25,12 @@
25
25
  "license": "MIT",
26
26
  "homepage": "https://opentiny.design/tiny-engine",
27
27
  "dependencies": {
28
- "@opentiny/tiny-engine-common": "2.5.0-rc.4",
29
- "@opentiny/tiny-engine-meta-register": "2.5.0-rc.4",
30
- "@opentiny/tiny-engine-utils": "2.5.0-rc.4"
28
+ "@opentiny/tiny-engine-common": "2.5.0-rc.6",
29
+ "@opentiny/tiny-engine-meta-register": "2.5.0-rc.6",
30
+ "@opentiny/tiny-engine-utils": "2.5.0-rc.6"
31
31
  },
32
32
  "devDependencies": {
33
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-rc.4",
33
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-rc.6",
34
34
  "@vitejs/plugin-vue": "^5.1.2",
35
35
  "@vitejs/plugin-vue-jsx": "^4.0.1",
36
36
  "vite": "^5.4.2"
@@ -39,5 +39,5 @@
39
39
  "@opentiny/vue": "^3.20.0",
40
40
  "vue": "^3.4.15"
41
41
  },
42
- "gitHead": "37ad17e95ed469c5b0b64d8246698d7c7e78393d"
42
+ "gitHead": "5989f69d75c8175c6b6bacc627c4eef975be1c50"
43
43
  }