@tmagic/editor 1.1.0-beta.4 → 1.1.0-beta.7

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 (100) hide show
  1. package/dist/{tmagic-editor.es.js → tmagic-editor.mjs} +1361 -1144
  2. package/dist/tmagic-editor.mjs.map +1 -0
  3. package/dist/tmagic-editor.umd.js +1375 -1158
  4. package/dist/tmagic-editor.umd.js.map +1 -1
  5. package/package.json +21 -19
  6. package/src/Editor.vue +14 -12
  7. package/src/components/ContentMenu.vue +87 -99
  8. package/src/components/ScrollViewer.vue +1 -1
  9. package/src/components/ToolButton.vue +150 -167
  10. package/src/fields/UISelect.vue +49 -70
  11. package/src/index.ts +2 -1
  12. package/src/layouts/AddPageBox.vue +2 -2
  13. package/src/layouts/Framework.vue +1 -1
  14. package/src/layouts/NavMenu.vue +2 -2
  15. package/src/layouts/PropsPanel.vue +1 -1
  16. package/src/layouts/Resizer.vue +1 -1
  17. package/src/layouts/sidebar/ComponentListPanel.vue +2 -2
  18. package/src/layouts/sidebar/LayerMenu.vue +2 -2
  19. package/src/layouts/sidebar/LayerPanel.vue +13 -4
  20. package/src/layouts/sidebar/Sidebar.vue +1 -1
  21. package/src/layouts/sidebar/TabPane.vue +2 -2
  22. package/src/layouts/workspace/PageBar.vue +63 -192
  23. package/src/layouts/workspace/PageBarScrollContainer.vue +111 -0
  24. package/src/layouts/workspace/Stage.vue +195 -222
  25. package/src/layouts/workspace/ViewerMenu.vue +142 -146
  26. package/src/layouts/workspace/Workspace.vue +11 -11
  27. package/src/services/BaseService.ts +1 -1
  28. package/src/services/componentList.ts +3 -3
  29. package/src/services/editor.ts +117 -135
  30. package/src/services/events.ts +1 -1
  31. package/src/services/history.ts +1 -1
  32. package/src/services/props.ts +62 -10
  33. package/src/services/storage.ts +133 -0
  34. package/src/services/ui.ts +2 -2
  35. package/src/type.ts +22 -6
  36. package/src/utils/config.ts +1 -1
  37. package/src/utils/editor.ts +1 -1
  38. package/src/utils/operator.ts +210 -0
  39. package/src/utils/props.ts +2 -24
  40. package/src/utils/scroll-viewer.ts +1 -1
  41. package/tsconfig.build.json +13 -0
  42. package/{dist/types/src → types}/Editor.vue.d.ts +7 -8
  43. package/types/components/ContentMenu.vue.d.ts +116 -0
  44. package/types/components/Icon.vue.d.ts +13 -0
  45. package/types/components/ScrollViewer.vue.d.ts +22 -0
  46. package/types/components/ToolButton.vue.d.ts +109 -0
  47. package/types/fields/Code.vue.d.ts +23 -0
  48. package/{dist/types/src → types}/fields/CodeLink.vue.d.ts +4 -6
  49. package/types/fields/UISelect.vue.d.ts +83 -0
  50. package/{dist/types/src → types}/index.d.ts +4 -1
  51. package/types/layouts/AddPageBox.vue.d.ts +4 -0
  52. package/{dist/types/src → types}/layouts/CodeEditor.vue.d.ts +11 -13
  53. package/types/layouts/Framework.vue.d.ts +22 -0
  54. package/types/layouts/NavMenu.vue.d.ts +25 -0
  55. package/types/layouts/PropsPanel.vue.d.ts +245 -0
  56. package/types/layouts/Resizer.vue.d.ts +12 -0
  57. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +14 -0
  58. package/types/layouts/sidebar/LayerMenu.vue.d.ts +100 -0
  59. package/types/layouts/sidebar/LayerPanel.vue.d.ts +1099 -0
  60. package/{dist/types/src → types}/layouts/sidebar/Sidebar.vue.d.ts +3 -5
  61. package/types/layouts/sidebar/TabPane.vue.d.ts +14 -0
  62. package/types/layouts/workspace/PageBar.vue.d.ts +54 -0
  63. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +48 -0
  64. package/types/layouts/workspace/Stage.vue.d.ts +46 -0
  65. package/types/layouts/workspace/ViewerMenu.vue.d.ts +88 -0
  66. package/types/layouts/workspace/Workspace.vue.d.ts +6 -0
  67. package/{dist/types/src → types}/services/BaseService.d.ts +0 -0
  68. package/types/services/componentList.d.ts +14 -0
  69. package/{dist/types/src → types}/services/editor.d.ts +26 -11
  70. package/{dist/types/src → types}/services/events.d.ts +0 -0
  71. package/{dist/types/src → types}/services/history.d.ts +0 -0
  72. package/{dist/types/src → types}/services/props.d.ts +25 -1
  73. package/types/services/storage.d.ts +56 -0
  74. package/{dist/types/src → types}/services/ui.d.ts +1 -1
  75. package/{dist/types/src → types}/type.d.ts +15 -0
  76. package/{dist/types/src → types}/utils/compose.d.ts +1 -1
  77. package/{dist/types/src → types}/utils/config.d.ts +0 -0
  78. package/{dist/types/src → types}/utils/editor.d.ts +2 -2
  79. package/{dist/types/src → types}/utils/index.d.ts +0 -0
  80. package/{dist/types/src → types}/utils/logger.d.ts +0 -0
  81. package/types/utils/operator.d.ts +44 -0
  82. package/{dist/types/src → types}/utils/polyfills.d.ts +0 -0
  83. package/{dist/types/src → types}/utils/props.d.ts +2 -22
  84. package/{dist/types/src → types}/utils/scroll-viewer.d.ts +0 -0
  85. package/{dist/types/src → types}/utils/undo-redo.d.ts +0 -0
  86. package/dist/tmagic-editor.es.js.map +0 -1
  87. package/dist/types/src/components/Icon.vue.d.ts +0 -14
  88. package/dist/types/src/components/ScrollViewer.vue.d.ts +0 -24
  89. package/dist/types/src/fields/Code.vue.d.ts +0 -25
  90. package/dist/types/src/layouts/AddPageBox.vue.d.ts +0 -5
  91. package/dist/types/src/layouts/Framework.vue.d.ts +0 -24
  92. package/dist/types/src/layouts/NavMenu.vue.d.ts +0 -27
  93. package/dist/types/src/layouts/PropsPanel.vue.d.ts +0 -13
  94. package/dist/types/src/layouts/Resizer.vue.d.ts +0 -14
  95. package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -16
  96. package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +0 -16
  97. package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +0 -8
  98. package/dist/types/src/shims-vue.d.ts +0 -6
  99. package/dist/types/src/vite-env.d.ts +0 -1
  100. package/src/vite-env.d.ts +0 -1
@@ -4,31 +4,31 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.iconsVue, global.lodashEs, global.monaco, global.StageCore, global.schema, global.utils, global.events, global.core, global.Gesto, global.ElementPlus, global.KeyController));
5
5
  })(this, (function (exports, vue, serialize, iconsVue, lodashEs, monaco, StageCore, schema, utils, events, core, Gesto, elementPlus, KeyController) { 'use strict';
6
6
 
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
+ const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
8
8
 
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
11
- var n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
12
12
  if (e) {
13
- Object.keys(e).forEach(function (k) {
13
+ for (const k in e) {
14
14
  if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
16
  Object.defineProperty(n, k, d.get ? d : {
17
17
  enumerable: true,
18
- get: function () { return e[k]; }
18
+ get: () => e[k]
19
19
  });
20
20
  }
21
- });
21
+ }
22
22
  }
23
- n["default"] = e;
23
+ n.default = e;
24
24
  return Object.freeze(n);
25
25
  }
26
26
 
27
- var serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize);
28
- var monaco__namespace = /*#__PURE__*/_interopNamespace(monaco);
29
- var StageCore__default = /*#__PURE__*/_interopDefaultLegacy(StageCore);
30
- var Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
31
- var KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
27
+ const serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize);
28
+ const monaco__namespace = /*#__PURE__*/_interopNamespace(monaco);
29
+ const StageCore__default = /*#__PURE__*/_interopDefaultLegacy(StageCore);
30
+ const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
31
+ const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
32
32
 
33
33
  if (typeof global === "undefined") {
34
34
  window.global = window;
@@ -37,15 +37,7 @@
37
37
  window.globalThis = window;
38
38
  }
39
39
 
40
- var _export_sfc = (sfc, props) => {
41
- const target = sfc.__vccOpts || sfc;
42
- for (const [key, val] of props) {
43
- target[key] = val;
44
- }
45
- return target;
46
- };
47
-
48
- const _sfc_main$m = vue.defineComponent({
40
+ const _sfc_main$n = vue.defineComponent({
49
41
  name: "m-fields-vs-code",
50
42
  props: ["model", "name", "config", "prop"],
51
43
  emits: ["change"],
@@ -62,7 +54,16 @@
62
54
  };
63
55
  }
64
56
  });
65
- function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
57
+
58
+ const _export_sfc = (sfc, props) => {
59
+ const target = sfc.__vccOpts || sfc;
60
+ for (const [key, val] of props) {
61
+ target[key] = val;
62
+ }
63
+ return target;
64
+ };
65
+
66
+ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
66
67
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
67
68
  return vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
68
69
  style: vue.normalizeStyle(`height: ${_ctx.height}`),
@@ -71,9 +72,9 @@
71
72
  onSave: _ctx.save
72
73
  }, null, 8, ["style", "init-values", "language", "onSave"]);
73
74
  }
74
- var Code = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$m]]);
75
+ const Code = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$g]]);
75
76
 
76
- const _sfc_main$l = vue.defineComponent({
77
+ const _sfc_main$m = vue.defineComponent({
77
78
  name: "m-fields-code-link",
78
79
  props: {
79
80
  config: {
@@ -97,7 +98,7 @@
97
98
  vue.watchEffect(() => {
98
99
  if (!props.model || !props.name)
99
100
  return;
100
- modelValue.value.form[props.name] = serialize__default["default"](props.model[props.name], {
101
+ modelValue.value.form[props.name] = serialize__default.default(props.model[props.name], {
101
102
  space: 2,
102
103
  unsafe: true
103
104
  }).replace(/"(\w+)":\s/g, "$1: ");
@@ -128,7 +129,8 @@
128
129
  };
129
130
  }
130
131
  });
131
- function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
132
+
133
+ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
132
134
  const _component_m_fields_link = vue.resolveComponent("m-fields-link");
133
135
  return vue.openBlock(), vue.createBlock(_component_m_fields_link, {
134
136
  config: _ctx.formConfig,
@@ -137,26 +139,20 @@
137
139
  onChange: _ctx.changeHandler
138
140
  }, null, 8, ["config", "model", "onChange"]);
139
141
  }
140
- var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
142
+ const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$f]]);
141
143
 
142
- var UISelect_vue_vue_type_style_index_0_lang = /* #__PURE__ */ (() => ".m-fields-ui-select {\n cursor: pointer;\n}\n.m-fields-ui-select i {\n margin-right: 3px;\n}\n.m-fields-ui-select span {\n color: #2882e0;\n}")();
143
-
144
- const _sfc_main$k = vue.defineComponent({
145
- name: "m-fields-ui-select",
144
+ const _hoisted_1$d = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
145
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
146
+ __name: "UISelect",
146
147
  props: {
147
- labelWidth: String,
148
- config: Object,
149
- model: Object,
150
- prop: {
151
- type: String,
152
- default() {
153
- return "";
154
- }
155
- },
156
- name: String
148
+ config: null,
149
+ model: null,
150
+ prop: null,
151
+ name: null
157
152
  },
158
153
  emits: ["change"],
159
- setup(props, { emit }) {
154
+ setup(__props, { emit }) {
155
+ const props = __props;
160
156
  const services = vue.inject("services");
161
157
  const mForm = vue.inject("mForm");
162
158
  const val = vue.computed(() => props.model[props.name]);
@@ -178,97 +174,89 @@
178
174
  cancelHandler();
179
175
  }
180
176
  };
181
- return {
182
- Delete: vue.markRaw(iconsVue.Delete),
183
- Pointer: vue.markRaw(iconsVue.Pointer),
184
- Close: vue.markRaw(iconsVue.Close),
185
- val,
186
- uiSelectMode,
187
- toName: vue.computed(() => {
188
- const config = services?.editorService.getNodeById(val.value);
189
- return config?.name || "";
190
- }),
191
- startSelect() {
192
- if (!services?.uiService)
193
- return;
194
- services.uiService.set("uiSelectMode", true);
195
- uiSelectMode.value = true;
196
- globalThis.document.addEventListener("ui-select", clickHandler);
197
- },
198
- cancelHandler,
199
- deleteHandler() {
200
- if (props.model) {
201
- props.model[props.name] = "";
202
- emit("change", "");
203
- mForm?.$emit("field-change", props.prop, "");
204
- }
177
+ const toName = vue.computed(() => {
178
+ const config = services?.editorService.getNodeById(val.value);
179
+ return config?.name || "";
180
+ });
181
+ const startSelect = () => {
182
+ if (!services?.uiService)
183
+ return;
184
+ services.uiService.set("uiSelectMode", true);
185
+ uiSelectMode.value = true;
186
+ globalThis.document.addEventListener("ui-select", clickHandler);
187
+ };
188
+ const deleteHandler = () => {
189
+ if (props.model) {
190
+ props.model[props.name] = "";
191
+ emit("change", "");
192
+ mForm?.$emit("field-change", props.prop, "");
205
193
  }
206
194
  };
207
- }
208
- });
209
- const _hoisted_1$d = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
210
- function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
211
- const _component_el_button = vue.resolveComponent("el-button");
212
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
213
- return _ctx.uiSelectMode ? (vue.openBlock(), vue.createElementBlock("div", {
214
- key: 0,
215
- class: "m-fields-ui-select",
216
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelHandler && _ctx.cancelHandler(...args))
217
- }, [
218
- vue.createVNode(_component_el_button, {
219
- type: "danger",
220
- icon: _ctx.Delete,
221
- text: "",
222
- style: { "padding": "0" }
223
- }, {
224
- default: vue.withCtx(() => [
225
- _hoisted_1$d
226
- ]),
227
- _: 1
228
- }, 8, ["icon"])
229
- ])) : (vue.openBlock(), vue.createElementBlock("div", {
230
- key: 1,
231
- class: "m-fields-ui-select",
232
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.startSelect && _ctx.startSelect(...args)),
233
- style: { "display": "flex" }
234
- }, [
235
- vue.createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
236
- default: vue.withCtx(() => [
237
- _ctx.val ? (vue.openBlock(), vue.createBlock(_component_el_button, {
238
- key: 0,
239
- style: { "padding": "0" },
240
- type: "danger",
241
- icon: _ctx.Close,
242
- text: "",
243
- onClick: vue.withModifiers(_ctx.deleteHandler, ["stop"])
244
- }, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
245
- ]),
246
- _: 1
247
- }),
248
- vue.createVNode(_component_el_tooltip, {
249
- content: _ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
250
- }, {
251
- default: vue.withCtx(() => [
195
+ return (_ctx, _cache) => {
196
+ const _component_el_button = vue.resolveComponent("el-button");
197
+ const _component_el_tooltip = vue.resolveComponent("el-tooltip");
198
+ return uiSelectMode.value ? (vue.openBlock(), vue.createElementBlock("div", {
199
+ key: 0,
200
+ class: "m-fields-ui-select",
201
+ onClick: cancelHandler
202
+ }, [
252
203
  vue.createVNode(_component_el_button, {
204
+ type: "danger",
205
+ icon: vue.unref(iconsVue.Delete),
253
206
  text: "",
254
- style: { "padding": "0", "margin": "0" }
207
+ style: { "padding": "0" }
255
208
  }, {
256
209
  default: vue.withCtx(() => [
257
- vue.createTextVNode(vue.toDisplayString(_ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
210
+ _hoisted_1$d
258
211
  ]),
259
212
  _: 1
260
- })
261
- ]),
262
- _: 1
263
- }, 8, ["content"])
264
- ]));
265
- }
266
- var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$k]]);
213
+ }, 8, ["icon"])
214
+ ])) : (vue.openBlock(), vue.createElementBlock("div", {
215
+ key: 1,
216
+ class: "m-fields-ui-select",
217
+ onClick: startSelect,
218
+ style: { "display": "flex" }
219
+ }, [
220
+ vue.createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
221
+ default: vue.withCtx(() => [
222
+ vue.unref(val) ? (vue.openBlock(), vue.createBlock(_component_el_button, {
223
+ key: 0,
224
+ style: { "padding": "0" },
225
+ type: "danger",
226
+ icon: vue.unref(iconsVue.Close),
227
+ text: "",
228
+ onClick: vue.withModifiers(deleteHandler, ["stop"])
229
+ }, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
230
+ ]),
231
+ _: 1
232
+ }),
233
+ vue.createVNode(_component_el_tooltip, {
234
+ content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
235
+ }, {
236
+ default: vue.withCtx(() => [
237
+ vue.createVNode(_component_el_button, {
238
+ text: "",
239
+ style: { "padding": "0", "margin": "0" }
240
+ }, {
241
+ default: vue.withCtx(() => [
242
+ vue.createTextVNode(vue.toDisplayString(vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
243
+ ]),
244
+ _: 1
245
+ })
246
+ ]),
247
+ _: 1
248
+ }, 8, ["content"])
249
+ ]));
250
+ };
251
+ }
252
+ });
253
+
254
+ const UISelect_vue_vue_type_style_index_0_lang = '';
267
255
 
268
256
  const toString = (v, language) => {
269
257
  let value = "";
270
258
  if (typeof v !== "string") {
271
- value = serialize__default["default"](v, {
259
+ value = serialize__default.default(v, {
272
260
  space: 2,
273
261
  unsafe: true
274
262
  }).replace(/"(\w+)":\s/g, "$1: ");
@@ -280,7 +268,7 @@
280
268
  }
281
269
  return value;
282
270
  };
283
- const _sfc_main$j = vue.defineComponent({
271
+ const _sfc_main$k = vue.defineComponent({
284
272
  name: "magic-code-editor",
285
273
  props: {
286
274
  initValues: {
@@ -387,14 +375,15 @@
387
375
  };
388
376
  }
389
377
  });
378
+
390
379
  const _hoisted_1$c = {
391
380
  ref: "codeEditor",
392
381
  class: "magic-code-editor"
393
382
  };
394
- function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
383
+ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
395
384
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, null, 512);
396
385
  }
397
- var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
386
+ const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$e]]);
398
387
 
399
388
  let $TMAGIC_EDITOR = {};
400
389
  const setConfig = (option) => {
@@ -403,6 +392,9 @@
403
392
  const getConfig = (key) => $TMAGIC_EDITOR[key];
404
393
 
405
394
  class UndoRedo {
395
+ elementList;
396
+ listCursor;
397
+ listMaxSize;
406
398
  constructor(listMaxSize = 200) {
407
399
  const minListMaxSize = 2;
408
400
  this.elementList = [];
@@ -498,12 +490,12 @@
498
490
  }
499
491
  };
500
492
  class BaseService extends events.EventEmitter {
493
+ pluginOptionsList = {};
494
+ middleware = {};
495
+ taskList = [];
496
+ doingTask = false;
501
497
  constructor(methods = [], serialMethods = []) {
502
498
  super();
503
- this.pluginOptionsList = {};
504
- this.middleware = {};
505
- this.taskList = [];
506
- this.doingTask = false;
507
499
  methods.forEach((propertyName) => {
508
500
  const scope = this;
509
501
  const sourceMethod = scope[propertyName];
@@ -560,14 +552,14 @@
560
552
  }
561
553
 
562
554
  class History extends BaseService {
555
+ state = vue.reactive({
556
+ pageSteps: {},
557
+ pageId: void 0,
558
+ canRedo: false,
559
+ canUndo: false
560
+ });
563
561
  constructor() {
564
562
  super([]);
565
- this.state = vue.reactive({
566
- pageSteps: {},
567
- pageId: void 0,
568
- canRedo: false,
569
- canUndo: false
570
- });
571
563
  this.on("change", this.setCanUndoRedo);
572
564
  }
573
565
  reset() {
@@ -636,88 +628,88 @@
636
628
  this.state.canUndo = undoRedo?.canUndo() || false;
637
629
  }
638
630
  }
639
- var historyService = new History();
631
+ const historyService = new History();
640
632
 
641
- class Props extends BaseService {
633
+ var Protocol = /* @__PURE__ */ ((Protocol2) => {
634
+ Protocol2["OBJECT"] = "object";
635
+ Protocol2["JSON"] = "json";
636
+ Protocol2["STRING"] = "string";
637
+ Protocol2["NUMBER"] = "number";
638
+ Protocol2["BOOLEAN"] = "boolean";
639
+ return Protocol2;
640
+ })(Protocol || {});
641
+ class WebStorage extends BaseService {
642
+ storage = globalThis.localStorage;
643
+ namespace = "tmagic";
642
644
  constructor() {
643
- super(["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue", "createId", "setNewItemId"]);
644
- this.state = vue.reactive({
645
- propsConfigMap: {},
646
- propsValueMap: {}
647
- });
645
+ super(["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]);
648
646
  }
649
- setPropsConfigs(configs) {
650
- Object.keys(configs).forEach((type) => {
651
- this.setPropsConfig(utils.toLine(type), configs[type]);
652
- });
653
- this.emit("props-configs-change");
647
+ async getStorage() {
648
+ return this.storage;
654
649
  }
655
- setPropsConfig(type, config) {
656
- this.state.propsConfigMap[type] = fillConfig(Array.isArray(config) ? config : [config]);
650
+ async getNamespace() {
651
+ return this.namespace;
657
652
  }
658
- async getPropsConfig(type) {
659
- if (type === "area") {
660
- return await this.getPropsConfig("button");
653
+ async clear() {
654
+ const storage2 = await this.getStorage();
655
+ storage2.clear();
656
+ }
657
+ async getItem(key, options = {}) {
658
+ const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
659
+ const { protocol = options.protocol, item } = this.getValueAndProtocol(storage.getItem(`${options.namespace || namespace}:${key}`));
660
+ if (item === null)
661
+ return null;
662
+ switch (protocol) {
663
+ case "object" /* OBJECT */:
664
+ return eval(`(${item})`);
665
+ case "json" /* JSON */:
666
+ return JSON.parse(item);
667
+ case "number" /* NUMBER */:
668
+ return Number(item);
669
+ case "boolean" /* BOOLEAN */:
670
+ return Boolean(item);
671
+ default:
672
+ return item;
661
673
  }
662
- return lodashEs.cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
663
674
  }
664
- setPropsValues(values) {
665
- Object.keys(values).forEach((type) => {
666
- this.setPropsValue(utils.toLine(type), values[type]);
667
- });
675
+ async key(index) {
676
+ const storage2 = await this.getStorage();
677
+ return storage2.key(index);
668
678
  }
669
- setPropsValue(type, value) {
670
- this.state.propsValueMap[type] = value;
679
+ async removeItem(key2, options2 = {}) {
680
+ const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
681
+ storage2.removeItem(`${options2.namespace || namespace2}:${key2}`);
671
682
  }
672
- async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
673
- if (type === "area") {
674
- const value = await this.getPropsValue("button");
675
- value.className = "action-area";
676
- value.text = "";
677
- if (value.style) {
678
- value.style.backgroundColor = "rgba(255, 255, 255, 0)";
679
- }
680
- return value;
683
+ async setItem(key2, value, options2 = {}) {
684
+ const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
685
+ let item2 = value;
686
+ const protocol2 = options2.protocol ? `${options2.protocol}:` : "";
687
+ if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
688
+ item2 = `${protocol2}${value}`;
689
+ } else {
690
+ item2 = `${protocol2}${serialize__default.default(value)}`;
691
+ }
692
+ storage2.setItem(`${options2.namespace || namespace2}:${key2}`, item2);
693
+ }
694
+ getValueAndProtocol(value) {
695
+ let protocol2 = "";
696
+ if (value === null) {
697
+ return {
698
+ item: value,
699
+ protocol: protocol2
700
+ };
681
701
  }
682
- const data = lodashEs.cloneDeep(defaultValue);
683
- await this.setNewItemId(data);
702
+ const item2 = value.replace(new RegExp(`^(${Object.values(Protocol).join("|")})(:)(.+)`), (_$0, $1, _$2, $3) => {
703
+ protocol2 = $1;
704
+ return $3;
705
+ });
684
706
  return {
685
- ...getDefaultPropsValue(type, await this.createId(type)),
686
- ...lodashEs.mergeWith(lodashEs.cloneDeep(this.state.propsValueMap[type] || {}), data)
707
+ protocol: protocol2,
708
+ item: item2
687
709
  };
688
710
  }
689
- async createId(type) {
690
- return `${type}_${lodashEs.random(1e4, false)}`;
691
- }
692
- async setNewItemId(config, parent) {
693
- const oldId = config.id;
694
- config.id = await this.createId(config.type || "component");
695
- if (utils.isPop(config) && parent?.type === schema.NodeType.PAGE) {
696
- updatePopId(oldId, config.id, parent);
697
- }
698
- if (config.items && Array.isArray(config.items)) {
699
- for (const item of config.items) {
700
- await this.setNewItemId(item, config);
701
- }
702
- }
703
- }
704
711
  }
705
- const updatePopId = (oldId, popId, pageConfig) => {
706
- pageConfig.items?.forEach((config) => {
707
- if (config.pop === oldId) {
708
- config.pop = popId;
709
- return;
710
- }
711
- if (config.popId === oldId) {
712
- config.popId = popId;
713
- return;
714
- }
715
- if (Array.isArray(config.items)) {
716
- updatePopId(oldId, popId, config);
717
- }
718
- });
719
- };
720
- var propsService = new Props();
712
+ const storageService = new WebStorage();
721
713
 
722
714
  var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
723
715
  LayerOffset2["TOP"] = "top";
@@ -881,7 +873,266 @@
881
873
  return config.style.left;
882
874
  };
883
875
 
876
+ class Props extends BaseService {
877
+ state = vue.reactive({
878
+ propsConfigMap: {},
879
+ propsValueMap: {}
880
+ });
881
+ constructor() {
882
+ super([
883
+ "setPropsConfig",
884
+ "getPropsConfig",
885
+ "setPropsValue",
886
+ "getPropsValue",
887
+ "createId",
888
+ "setNewItemId",
889
+ "getDefaultPropsValue"
890
+ ]);
891
+ }
892
+ setPropsConfigs(configs) {
893
+ Object.keys(configs).forEach((type) => {
894
+ this.setPropsConfig(utils.toLine(type), configs[type]);
895
+ });
896
+ this.emit("props-configs-change");
897
+ }
898
+ setPropsConfig(type, config) {
899
+ this.state.propsConfigMap[type] = fillConfig(Array.isArray(config) ? config : [config]);
900
+ }
901
+ async getPropsConfig(type) {
902
+ if (type === "area") {
903
+ return await this.getPropsConfig("button");
904
+ }
905
+ return lodashEs.cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
906
+ }
907
+ setPropsValues(values) {
908
+ Object.keys(values).forEach((type) => {
909
+ this.setPropsValue(utils.toLine(type), values[type]);
910
+ });
911
+ }
912
+ setPropsValue(type, value) {
913
+ this.state.propsValueMap[type] = value;
914
+ }
915
+ async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
916
+ if (type === "area") {
917
+ const value = await this.getPropsValue("button");
918
+ value.className = "action-area";
919
+ value.text = "";
920
+ if (value.style) {
921
+ value.style.backgroundColor = "rgba(255, 255, 255, 0)";
922
+ }
923
+ return value;
924
+ }
925
+ const [id, defaultPropsValue, data] = await Promise.all([
926
+ this.createId(type),
927
+ this.getDefaultPropsValue(type),
928
+ this.setNewItemId(lodashEs.cloneDeep({
929
+ type,
930
+ ...defaultValue
931
+ }))
932
+ ]);
933
+ return {
934
+ id,
935
+ ...defaultPropsValue,
936
+ ...lodashEs.mergeWith({}, lodashEs.cloneDeep(this.state.propsValueMap[type] || {}), data)
937
+ };
938
+ }
939
+ guid(digit = 8) {
940
+ return "x".repeat(digit).replace(/[xy]/g, (c) => {
941
+ const r = Math.random() * 16 | 0;
942
+ const v = c == "x" ? r : r & 3 | 8;
943
+ return v.toString(16);
944
+ });
945
+ }
946
+ async createId(type) {
947
+ return `${type}_${this.guid()}`;
948
+ }
949
+ async setNewItemId(config, parent) {
950
+ const oldId = config.id;
951
+ config.id = await this.createId(config.type || "component");
952
+ if (utils.isPop(config) && parent?.type === schema.NodeType.PAGE) {
953
+ updatePopId(oldId, config.id, parent);
954
+ }
955
+ if (config.items && Array.isArray(config.items)) {
956
+ for (const item of config.items) {
957
+ await this.setNewItemId(item, config);
958
+ }
959
+ }
960
+ return config;
961
+ }
962
+ async getDefaultPropsValue(type) {
963
+ return ["page", "container"].includes(type) ? {
964
+ type,
965
+ layout: "absolute",
966
+ style: {},
967
+ name: type,
968
+ items: []
969
+ } : {
970
+ type,
971
+ style: {},
972
+ name: type
973
+ };
974
+ }
975
+ }
976
+ const updatePopId = (oldId, popId, pageConfig) => {
977
+ pageConfig.items?.forEach((config) => {
978
+ if (config.pop === oldId) {
979
+ config.pop = popId;
980
+ return;
981
+ }
982
+ if (config.popId === oldId) {
983
+ config.popId = popId;
984
+ return;
985
+ }
986
+ if (Array.isArray(config.items)) {
987
+ updatePopId(oldId, popId, config);
988
+ }
989
+ });
990
+ };
991
+ const propsService = new Props();
992
+
993
+ const beforePaste = async (position, config) => {
994
+ if (!config[0]?.style)
995
+ return config;
996
+ const curNode = editorService.get("node");
997
+ const { left: referenceLeft, top: referenceTop } = config[0].style;
998
+ const pasteConfigs = await Promise.all(config.map(async (configItem) => {
999
+ const { offsetX = 0, offsetY = 0, ...positionClone } = position;
1000
+ let pastePosition = positionClone;
1001
+ if (!lodashEs.isEmpty(pastePosition) && curNode.items) {
1002
+ pastePosition = getPositionInContainer(pastePosition, curNode.id);
1003
+ }
1004
+ if (pastePosition.left && configItem.style?.left) {
1005
+ pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
1006
+ }
1007
+ if (pastePosition.top && configItem.style?.top) {
1008
+ pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
1009
+ }
1010
+ const pasteConfig = await propsService.setNewItemId(configItem, editorService.get("root"));
1011
+ if (pasteConfig.style) {
1012
+ const { left, top } = pasteConfig.style;
1013
+ if (typeof left === "number" || !!left && !isNaN(Number(left))) {
1014
+ pasteConfig.style.left = Number(left) + offsetX;
1015
+ }
1016
+ if (typeof top === "number" || !!top && !isNaN(Number(top))) {
1017
+ pasteConfig.style.top = Number(top) + offsetY;
1018
+ }
1019
+ pasteConfig.style = {
1020
+ ...pasteConfig.style,
1021
+ ...pastePosition
1022
+ };
1023
+ }
1024
+ if (utils.isPage(pasteConfig)) {
1025
+ pasteConfig.name = generatePageNameByApp(editorService.get("root"));
1026
+ }
1027
+ return pasteConfig;
1028
+ }));
1029
+ return pasteConfigs;
1030
+ };
1031
+ const beforeAdd = async (addNode, parent) => {
1032
+ const { type, inputEvent, ...config } = addNode;
1033
+ const curNode = editorService.get("node");
1034
+ let parentNode;
1035
+ const isPage2 = type === schema.NodeType.PAGE;
1036
+ if (isPage2) {
1037
+ parentNode = editorService.get("root");
1038
+ } else if (parent && typeof parent !== "function") {
1039
+ parentNode = parent;
1040
+ } else if (curNode.items) {
1041
+ parentNode = curNode;
1042
+ } else {
1043
+ parentNode = editorService.getParentById(curNode.id, false);
1044
+ }
1045
+ if (!parentNode)
1046
+ throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
1047
+ const layout = await editorService.getLayout(vue.toRaw(parentNode), addNode);
1048
+ const newNode = { ...vue.toRaw(await propsService.getPropsValue(type, config)) };
1049
+ newNode.style = getInitPositionStyle(newNode.style, layout, parentNode, editorService.get("stage"));
1050
+ if ((parentNode?.type === schema.NodeType.ROOT || curNode.type === schema.NodeType.ROOT) && newNode.type !== schema.NodeType.PAGE) {
1051
+ throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
1052
+ }
1053
+ parentNode?.items?.push(newNode);
1054
+ return {
1055
+ parentNode,
1056
+ newNode,
1057
+ layout,
1058
+ isPage: isPage2
1059
+ };
1060
+ };
1061
+ const getPositionInContainer = (position = {}, id) => {
1062
+ let { left = 0, top = 0 } = position;
1063
+ const parentEl = editorService.get("stage")?.renderer?.contentWindow?.document.getElementById(`${id}`);
1064
+ const parentElRect = parentEl?.getBoundingClientRect();
1065
+ left = left - (parentElRect?.left || 0);
1066
+ top = top - (parentElRect?.top || 0);
1067
+ return {
1068
+ left,
1069
+ top
1070
+ };
1071
+ };
1072
+ const notifyAddToStage = async (parentNode, newNode, layout) => {
1073
+ const stage = editorService.get("stage");
1074
+ const root = editorService.get("root");
1075
+ await stage?.add({ config: lodashEs.cloneDeep(newNode), parent: lodashEs.cloneDeep(parentNode), root: lodashEs.cloneDeep(root) });
1076
+ if (layout === Layout.ABSOLUTE) {
1077
+ const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
1078
+ if (typeof fixedLeft !== "undefined" && newNode.style) {
1079
+ newNode.style.left = fixedLeft;
1080
+ await stage?.update({ config: lodashEs.cloneDeep(newNode), root: lodashEs.cloneDeep(root) });
1081
+ }
1082
+ }
1083
+ };
1084
+ const beforeRemove = async (node) => {
1085
+ if (!node?.id)
1086
+ return;
1087
+ const stage = editorService.get("stage");
1088
+ const root = editorService.get("root");
1089
+ if (!root)
1090
+ throw new Error("\u6CA1\u6709root");
1091
+ const { parent, node: curNode } = editorService.getNodeInfo(node.id, false);
1092
+ if (!parent || !curNode)
1093
+ throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1094
+ const index = getNodeIndex(curNode, parent);
1095
+ if (typeof index !== "number" || index === -1)
1096
+ throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1097
+ parent.items?.splice(index, 1);
1098
+ stage?.remove({ id: node.id, root: lodashEs.cloneDeep(root) });
1099
+ if (node.type === schema.NodeType.PAGE) {
1100
+ editorService.state.pageLength -= 1;
1101
+ if (root.items[0]) {
1102
+ await editorService.select(root.items[0]);
1103
+ stage?.select(root.items[0].id);
1104
+ } else {
1105
+ editorService.set("node", null);
1106
+ editorService.set("nodes", []);
1107
+ editorService.set("parent", null);
1108
+ editorService.set("page", null);
1109
+ editorService.set("stage", null);
1110
+ editorService.set("highlightNode", null);
1111
+ editorService.resetModifiedNodeId();
1112
+ historyService.reset();
1113
+ editorService.emit("remove", node);
1114
+ return;
1115
+ }
1116
+ } else {
1117
+ await editorService.select(parent);
1118
+ stage?.select(parent.id);
1119
+ }
1120
+ return parent;
1121
+ };
1122
+
884
1123
  class Editor$1 extends BaseService {
1124
+ state = vue.reactive({
1125
+ root: null,
1126
+ page: null,
1127
+ parent: null,
1128
+ node: null,
1129
+ nodes: [],
1130
+ stage: null,
1131
+ highlightNode: null,
1132
+ modifiedNodeIds: /* @__PURE__ */ new Map(),
1133
+ pageLength: 0
1134
+ });
1135
+ isHistoryStateChange = false;
885
1136
  constructor() {
886
1137
  super([
887
1138
  "getLayout",
@@ -900,20 +1151,12 @@
900
1151
  "redo",
901
1152
  "highlight"
902
1153
  ], ["select", "update", "moveLayer"]);
903
- this.isHistoryStateChange = false;
904
- this.state = vue.reactive({
905
- root: null,
906
- page: null,
907
- parent: null,
908
- node: null,
909
- stage: null,
910
- highlightNode: null,
911
- modifiedNodeIds: /* @__PURE__ */ new Map(),
912
- pageLength: 0
913
- });
914
1154
  }
915
1155
  set(name, value) {
916
1156
  this.state[name] = value;
1157
+ if (name === "nodes") {
1158
+ this.set("node", value[0]);
1159
+ }
917
1160
  if (name === "root") {
918
1161
  this.state.pageLength = value?.items?.length || 0;
919
1162
  this.emit("root-change", value);
@@ -968,9 +1211,9 @@
968
1211
  }
969
1212
  return Layout.ABSOLUTE;
970
1213
  }
971
- async select(config2) {
972
- const { node, page, parent } = this.selectedConfigExceptionHandler(config2);
973
- this.set("node", node);
1214
+ async select(config) {
1215
+ const { node, page, parent } = this.selectedConfigExceptionHandler(config);
1216
+ this.set("nodes", [node]);
974
1217
  this.set("page", page || null);
975
1218
  this.set("parent", parent || null);
976
1219
  if (page) {
@@ -1010,106 +1253,87 @@
1010
1253
  this.get("stage")?.select(nextPage.id);
1011
1254
  return nextPage;
1012
1255
  }
1013
- highlight(config2) {
1014
- const { node } = this.selectedConfigExceptionHandler(config2);
1256
+ highlight(config) {
1257
+ const { node } = this.selectedConfigExceptionHandler(config);
1015
1258
  const currentHighlightNode = this.get("highlightNode");
1016
1259
  if (currentHighlightNode === node)
1017
1260
  return;
1018
1261
  this.set("highlightNode", node);
1019
1262
  }
1020
- async add(addNode, parent) {
1021
- const { type, inputEvent, ...config2 } = addNode;
1022
- const curNode = this.get("node");
1023
- let parentNode;
1024
- const isPage2 = type === schema.NodeType.PAGE;
1025
- if (isPage2) {
1026
- parentNode = this.get("root");
1027
- } else if (parent && typeof parent !== "function") {
1028
- parentNode = parent;
1029
- } else if (curNode.items) {
1030
- parentNode = curNode;
1031
- } else {
1032
- parentNode = this.getParentById(curNode.id, false);
1033
- }
1034
- if (!parentNode)
1035
- throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
1036
- const layout = await this.getLayout(vue.toRaw(parentNode), addNode);
1037
- const newNode = { ...vue.toRaw(await propsService.getPropsValue(type, config2)) };
1038
- newNode.style = getInitPositionStyle(newNode.style, layout, parentNode, this.get("stage"));
1039
- if ((parentNode?.type === schema.NodeType.ROOT || curNode.type === schema.NodeType.ROOT) && newNode.type !== schema.NodeType.PAGE) {
1040
- throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
1041
- }
1042
- parentNode?.items?.push(newNode);
1263
+ multiSelect(ids) {
1264
+ const nodes = [];
1265
+ const idsUnique = lodashEs.uniq(ids);
1266
+ idsUnique.forEach((id) => {
1267
+ const { node } = this.getNodeInfo(id);
1268
+ if (!node)
1269
+ return;
1270
+ nodes.push(node);
1271
+ });
1272
+ this.set("nodes", nodes);
1273
+ }
1274
+ async multiAdd(configs) {
1043
1275
  const stage = this.get("stage");
1044
- const root = this.get("root");
1045
- await stage?.add({ config: lodashEs.cloneDeep(newNode), parent: lodashEs.cloneDeep(parentNode), root: lodashEs.cloneDeep(root) });
1046
- if (layout === Layout.ABSOLUTE) {
1047
- const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
1048
- if (typeof fixedLeft !== "undefined") {
1049
- newNode.style.left = fixedLeft;
1050
- await stage?.update({ config: lodashEs.cloneDeep(newNode), root: lodashEs.cloneDeep(root) });
1051
- }
1052
- }
1276
+ const newNodes = await Promise.all(configs.map(async (configItem) => {
1277
+ const { parentNode, newNode, layout } = await beforeAdd(configItem);
1278
+ await notifyAddToStage(parentNode, newNode, layout);
1279
+ return newNode;
1280
+ }));
1281
+ const newNodeIds = newNodes.map((node) => node.id);
1282
+ this.addModifiedNodeId(newNodeIds.join("-"));
1283
+ this.pushHistoryState();
1284
+ stage?.multiSelect(newNodeIds);
1285
+ this.emit("multiAdd", newNodes);
1286
+ return newNodes;
1287
+ }
1288
+ async add(addNode, parent) {
1289
+ const stage = this.get("stage");
1290
+ const { parentNode, newNode, layout, isPage: isPage2 } = await beforeAdd(addNode, parent);
1291
+ await notifyAddToStage(parentNode, newNode, layout);
1053
1292
  await this.select(newNode);
1054
1293
  this.addModifiedNodeId(newNode.id);
1055
1294
  if (!isPage2) {
1056
1295
  this.pushHistoryState();
1057
1296
  }
1058
- stage?.select(newNode.id);
1059
1297
  if (isPage2) {
1060
1298
  this.state.pageLength += 1;
1299
+ } else {
1300
+ stage?.select(newNode.id);
1061
1301
  }
1062
1302
  this.emit("add", newNode);
1063
1303
  return newNode;
1064
1304
  }
1065
- async remove(node) {
1066
- if (!node?.id)
1067
- return;
1068
- const root = this.get("root");
1069
- if (!root)
1070
- throw new Error("\u6CA1\u6709root");
1071
- const { parent, node: curNode } = this.getNodeInfo(node.id, false);
1072
- if (!parent || !curNode)
1073
- throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1074
- const index = getNodeIndex(curNode, parent);
1075
- if (typeof index !== "number" || index === -1)
1076
- throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1077
- parent.items?.splice(index, 1);
1078
- const stage = this.get("stage");
1079
- stage?.remove({ id: node.id, root: lodashEs.cloneDeep(this.get("root")) });
1080
- if (node.type === schema.NodeType.PAGE) {
1081
- this.state.pageLength -= 1;
1082
- if (root.items[0]) {
1083
- await this.select(root.items[0]);
1084
- stage?.select(root.items[0].id);
1085
- } else {
1086
- this.set("node", null);
1087
- this.set("parent", null);
1088
- this.set("page", null);
1089
- this.set("stage", null);
1090
- this.set("highlightNode", null);
1091
- this.resetModifiedNodeId();
1092
- historyService.reset();
1093
- this.emit("remove", node);
1094
- return node;
1095
- }
1096
- } else {
1097
- await this.select(parent);
1098
- stage?.select(parent.id);
1305
+ async remove(nodeOrNodeList) {
1306
+ if (Array.isArray(nodeOrNodeList)) {
1307
+ const nodes = nodeOrNodeList;
1308
+ return this.multiRemove(nodes);
1099
1309
  }
1100
- this.addModifiedNodeId(parent.id);
1310
+ const node = nodeOrNodeList;
1311
+ const removeParent = await beforeRemove(node);
1312
+ if (!removeParent)
1313
+ return node;
1314
+ this.addModifiedNodeId(removeParent.id);
1101
1315
  this.pushHistoryState();
1102
1316
  this.emit("remove", node);
1103
1317
  return node;
1104
1318
  }
1105
- async update(config2) {
1106
- if (!config2?.id)
1319
+ async multiRemove(nodes) {
1320
+ await Promise.all(nodes.map(async (removeNode) => {
1321
+ await beforeRemove(removeNode);
1322
+ }));
1323
+ const nodeIds = nodes.map((node) => node.id);
1324
+ this.addModifiedNodeId(nodeIds.join("-"));
1325
+ this.pushHistoryState();
1326
+ this.emit("multiRemove", nodes);
1327
+ return nodes;
1328
+ }
1329
+ async update(config) {
1330
+ if (!config?.id)
1107
1331
  throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
1108
- const info = this.getNodeInfo(config2.id, false);
1332
+ const info = this.getNodeInfo(config.id, false);
1109
1333
  if (!info.node)
1110
- throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config2.id}\u7684\u8282\u70B9`);
1334
+ throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config.id}\u7684\u8282\u70B9`);
1111
1335
  const node = lodashEs.cloneDeep(vue.toRaw(info.node));
1112
- let newConfig = await this.toggleFixedPosition(vue.toRaw(config2), node, this.get("root"));
1336
+ let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, this.get("root"));
1113
1337
  newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
1114
1338
  if (Array.isArray(srcValue)) {
1115
1339
  return srcValue;
@@ -1134,9 +1358,10 @@
1134
1358
  newConfig = setLayout(newConfig, newLayout);
1135
1359
  }
1136
1360
  parentNodeItems[index] = newConfig;
1137
- if (`${newConfig.id}` === `${this.get("node").id}`) {
1138
- this.set("node", newConfig);
1139
- }
1361
+ const nodes = this.get("nodes");
1362
+ const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
1363
+ nodes.splice(targetIndex, 1, newConfig);
1364
+ this.set("nodes", nodes);
1140
1365
  this.get("stage")?.update({ config: lodashEs.cloneDeep(newConfig), root: lodashEs.cloneDeep(this.get("root")) });
1141
1366
  if (newConfig.type === schema.NodeType.PAGE) {
1142
1367
  this.set("page", newConfig);
@@ -1160,34 +1385,19 @@
1160
1385
  this.addModifiedNodeId(parent.id);
1161
1386
  this.pushHistoryState();
1162
1387
  }
1163
- async copy(config2) {
1164
- globalThis.localStorage.setItem(COPY_STORAGE_KEY, serialize__default["default"](config2));
1388
+ async copy(config) {
1389
+ await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
1390
+ protocol: Protocol.OBJECT
1391
+ });
1165
1392
  }
1166
1393
  async paste(position = {}) {
1167
- const configStr = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
1168
- let config = {};
1169
- if (!configStr) {
1170
- return;
1171
- }
1172
- try {
1173
- eval(`config = ${configStr}`);
1174
- } catch (e) {
1175
- console.error(e);
1394
+ const config = await storageService.getItem(COPY_STORAGE_KEY);
1395
+ if (!config)
1176
1396
  return;
1177
- }
1178
- await propsService.setNewItemId(config, this.get("root"));
1179
- if (config.style) {
1180
- config.style = {
1181
- ...config.style,
1182
- ...position
1183
- };
1184
- }
1185
- if (utils.isPage(config)) {
1186
- config.name = generatePageNameByApp(this.get("root"));
1187
- }
1188
- return await this.add(config);
1397
+ const pasteConfigs = await beforePaste(position, config);
1398
+ return await this.multiAdd(pasteConfigs);
1189
1399
  }
1190
- async alignCenter(config2) {
1400
+ async alignCenter(config) {
1191
1401
  const parent = this.get("parent");
1192
1402
  const node = this.get("node");
1193
1403
  const layout = await this.getLayout(vue.toRaw(parent), vue.toRaw(node));
@@ -1212,9 +1422,9 @@
1212
1422
  config: lodashEs.cloneDeep(vue.toRaw(node)),
1213
1423
  root: lodashEs.cloneDeep(this.get("root"))
1214
1424
  });
1215
- this.addModifiedNodeId(config2.id);
1425
+ this.addModifiedNodeId(config.id);
1216
1426
  this.pushHistoryState();
1217
- return config2;
1427
+ return config;
1218
1428
  }
1219
1429
  async moveLayer(offset) {
1220
1430
  const parent = this.get("parent");
@@ -1233,8 +1443,8 @@
1233
1443
  root: lodashEs.cloneDeep(this.get("root"))
1234
1444
  });
1235
1445
  }
1236
- async moveToContainer(config2, targetId) {
1237
- const { node, parent } = this.getNodeInfo(config2.id, false);
1446
+ async moveToContainer(config, targetId) {
1447
+ const { node, parent } = this.getNodeInfo(config.id, false);
1238
1448
  const target = this.getNodeById(targetId, false);
1239
1449
  const stage = this.get("stage");
1240
1450
  if (node && parent && stage) {
@@ -1243,7 +1453,7 @@
1243
1453
  parent.items?.splice(index, 1);
1244
1454
  await stage.remove({ id: node.id, root });
1245
1455
  const layout = await this.getLayout(target);
1246
- const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), config2, (objValue, srcValue) => {
1456
+ const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), config, (objValue, srcValue) => {
1247
1457
  if (Array.isArray(srcValue)) {
1248
1458
  return srcValue;
1249
1459
  }
@@ -1294,6 +1504,7 @@
1294
1504
  this.removeAllListeners();
1295
1505
  this.set("root", null);
1296
1506
  this.set("node", null);
1507
+ this.set("nodes", []);
1297
1508
  this.set("page", null);
1298
1509
  this.set("parent", null);
1299
1510
  }
@@ -1340,12 +1551,12 @@
1340
1551
  }
1341
1552
  return newConfig;
1342
1553
  }
1343
- selectedConfigExceptionHandler(config2) {
1554
+ selectedConfigExceptionHandler(config) {
1344
1555
  let id;
1345
- if (typeof config2 === "string" || typeof config2 === "number") {
1346
- id = config2;
1556
+ if (typeof config === "string" || typeof config === "number") {
1557
+ id = config;
1347
1558
  } else {
1348
- id = config2.id;
1559
+ id = config.id;
1349
1560
  }
1350
1561
  if (!id) {
1351
1562
  throw new Error("\u6CA1\u6709ID\uFF0C\u65E0\u6CD5\u9009\u4E2D");
@@ -1363,7 +1574,7 @@
1363
1574
  };
1364
1575
  }
1365
1576
  }
1366
- var editorService = new Editor$1();
1577
+ const editorService = new Editor$1();
1367
1578
 
1368
1579
  const eventMap = vue.reactive({});
1369
1580
  const methodMap = vue.reactive({});
@@ -1407,7 +1618,7 @@
1407
1618
  return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
1408
1619
  }
1409
1620
  }
1410
- var eventsService = new Events();
1621
+ const eventsService = new Events();
1411
1622
 
1412
1623
  const fillConfig = (config = []) => [
1413
1624
  {
@@ -1613,32 +1824,34 @@
1613
1824
  }
1614
1825
  ];
1615
1826
  const DEFAULT_CONFIG = fillConfig([]);
1616
- const getDefaultPropsValue = (type, id) => ["page", "container"].includes(type) ? {
1617
- type,
1618
- id,
1619
- layout: "absolute",
1620
- style: {},
1621
- name: type,
1622
- items: []
1623
- } : {
1624
- type,
1625
- id,
1626
- style: {},
1627
- name: type
1628
- };
1629
1827
 
1630
1828
  const log = (...args) => {
1829
+ if (process.env.NODE_ENV === "development") {
1830
+ console.log("magic editor: ", ...args);
1831
+ }
1631
1832
  };
1632
1833
  const info = (...args) => {
1834
+ if (process.env.NODE_ENV === "development") {
1835
+ console.info("magic editor: ", ...args);
1836
+ }
1633
1837
  };
1634
1838
  const warn = (...args) => {
1839
+ if (process.env.NODE_ENV === "development") {
1840
+ console.warn("magic editor: ", ...args);
1841
+ }
1635
1842
  };
1636
1843
  const debug = (...args) => {
1844
+ if (process.env.NODE_ENV === "development") {
1845
+ console.debug("magic editor: ", ...args);
1846
+ }
1637
1847
  };
1638
1848
  const error = (...args) => {
1849
+ if (process.env.NODE_ENV === "development") {
1850
+ console.error("magic editor: ", ...args);
1851
+ }
1639
1852
  };
1640
1853
 
1641
- const _sfc_main$i = vue.defineComponent({
1854
+ const _sfc_main$j = vue.defineComponent({
1642
1855
  components: { Plus: iconsVue.Plus },
1643
1856
  setup() {
1644
1857
  const services = vue.inject("services");
@@ -1655,10 +1868,11 @@
1655
1868
  };
1656
1869
  }
1657
1870
  });
1871
+
1658
1872
  const _hoisted_1$b = { class: "m-editor-empty-panel" };
1659
1873
  const _hoisted_2$4 = { class: "m-editor-empty-content" };
1660
- const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1661
- function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1874
+ const _hoisted_3$1 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1875
+ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
1662
1876
  const _component_plus = vue.resolveComponent("plus");
1663
1877
  const _component_el_icon = vue.resolveComponent("el-icon");
1664
1878
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
@@ -1675,14 +1889,14 @@
1675
1889
  _: 1
1676
1890
  })
1677
1891
  ]),
1678
- _hoisted_3$2
1892
+ _hoisted_3$1
1679
1893
  ])
1680
1894
  ])
1681
1895
  ]);
1682
1896
  }
1683
- var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
1897
+ const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$d]]);
1684
1898
 
1685
- const _sfc_main$h = vue.defineComponent({
1899
+ const _sfc_main$i = vue.defineComponent({
1686
1900
  name: "m-editor-resize",
1687
1901
  props: {
1688
1902
  type: {
@@ -1696,7 +1910,7 @@
1696
1910
  vue.onMounted(() => {
1697
1911
  if (!target.value)
1698
1912
  return;
1699
- getso = new Gesto__default["default"](target.value, {
1913
+ getso = new Gesto__default.default(target.value, {
1700
1914
  container: window,
1701
1915
  pinchOutside: true
1702
1916
  }).on("drag", (e) => {
@@ -1724,18 +1938,19 @@
1724
1938
  };
1725
1939
  }
1726
1940
  });
1941
+
1727
1942
  const _hoisted_1$a = {
1728
1943
  ref: "target",
1729
1944
  class: "m-editor-resizer"
1730
1945
  };
1731
- function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1946
+ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
1732
1947
  return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$a, [
1733
1948
  vue.renderSlot(_ctx.$slots, "default")
1734
1949
  ], 512);
1735
1950
  }
1736
- var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h]]);
1951
+ const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$c]]);
1737
1952
 
1738
- const _sfc_main$g = vue.defineComponent({
1953
+ const _sfc_main$h = vue.defineComponent({
1739
1954
  components: {
1740
1955
  AddPageBox,
1741
1956
  Resizer
@@ -1764,12 +1979,13 @@
1764
1979
  };
1765
1980
  }
1766
1981
  });
1982
+
1767
1983
  const _hoisted_1$9 = { class: "m-editor" };
1768
1984
  const _hoisted_2$3 = {
1769
1985
  key: 1,
1770
1986
  class: "m-editor-content"
1771
1987
  };
1772
- function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
1988
+ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
1773
1989
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
1774
1990
  const _component_resizer = vue.resolveComponent("resizer");
1775
1991
  const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
@@ -1815,9 +2031,9 @@
1815
2031
  ]))
1816
2032
  ]);
1817
2033
  }
1818
- var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
2034
+ const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$b]]);
1819
2035
 
1820
- const _sfc_main$f = vue.defineComponent({
2036
+ const _sfc_main$g = vue.defineComponent({
1821
2037
  name: "m-icon",
1822
2038
  components: { Edit: iconsVue.Edit },
1823
2039
  props: {
@@ -1831,8 +2047,9 @@
1831
2047
  };
1832
2048
  }
1833
2049
  });
2050
+
1834
2051
  const _hoisted_1$8 = ["src"];
1835
- function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2052
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
1836
2053
  const _component_edit = vue.resolveComponent("edit");
1837
2054
  const _component_el_icon = vue.resolveComponent("el-icon");
1838
2055
  return !_ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
@@ -1853,10 +2070,19 @@
1853
2070
  _: 1
1854
2071
  }));
1855
2072
  }
1856
- var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f]]);
2073
+ const MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$a]]);
1857
2074
 
1858
- const _sfc_main$e = vue.defineComponent({
1859
- components: { MIcon, ArrowDown: iconsVue.ArrowDown },
2075
+ const _hoisted_1$7 = {
2076
+ key: 1,
2077
+ class: "menu-item-text"
2078
+ };
2079
+ const _hoisted_2$2 = {
2080
+ class: "menu-item-text",
2081
+ style: { "margin": "0 5px" }
2082
+ };
2083
+ const _hoisted_3 = { class: "el-dropdown-link menubar-menu-button" };
2084
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
2085
+ __name: "ToolButton",
1860
2086
  props: {
1861
2087
  data: {
1862
2088
  type: [Object, String],
@@ -1871,7 +2097,8 @@
1871
2097
  default: "click"
1872
2098
  }
1873
2099
  },
1874
- setup(props) {
2100
+ setup(__props) {
2101
+ const props = __props;
1875
2102
  const services = vue.inject("services");
1876
2103
  const uiService = services?.uiService;
1877
2104
  const zoom = vue.computed(() => uiService?.get("zoom") ?? 1);
@@ -1968,176 +2195,155 @@
1968
2195
  item2.handler?.(services, event);
1969
2196
  }
1970
2197
  };
1971
- return {
1972
- ZoomIn: vue.markRaw(iconsVue.ZoomIn),
1973
- ZoomOut: vue.markRaw(iconsVue.ZoomOut),
1974
- item,
1975
- zoom,
1976
- disabled,
1977
- display: vue.computed(() => {
1978
- if (!item.value)
1979
- return false;
1980
- if (typeof item.value === "string")
1981
- return true;
1982
- if (typeof item.value.display === "function") {
1983
- return item.value.display(services);
1984
- }
1985
- return item.value.display ?? true;
1986
- }),
1987
- zoomInHandler,
1988
- zoomOutHandler,
1989
- dropdownHandler(command) {
1990
- if (command.item.handler) {
1991
- command.item.handler(services);
1992
- }
1993
- },
1994
- clickHandler(item2, event) {
1995
- if (props.eventType !== "click")
1996
- return;
1997
- if (item2.type === "button") {
1998
- buttonHandler(item2, event);
1999
- }
2000
- },
2001
- mousedownHandler(item2, event) {
2002
- if (props.eventType !== "mousedown")
2003
- return;
2004
- if (item2.type === "button") {
2005
- buttonHandler(item2, event);
2006
- }
2007
- },
2008
- mouseupHandler(item2, event) {
2009
- if (props.eventType !== "mouseup")
2010
- return;
2011
- if (item2.type === "button") {
2012
- buttonHandler(item2, event);
2013
- }
2198
+ const display = vue.computed(() => {
2199
+ if (!item.value)
2200
+ return false;
2201
+ if (typeof item.value === "string")
2202
+ return true;
2203
+ if (typeof item.value.display === "function") {
2204
+ return item.value.display(services);
2205
+ }
2206
+ return item.value.display ?? true;
2207
+ });
2208
+ const dropdownHandler = (command) => {
2209
+ if (command.item.handler) {
2210
+ command.item.handler(services);
2014
2211
  }
2015
2212
  };
2016
- }
2017
- });
2018
- const _hoisted_1$7 = {
2019
- key: 1,
2020
- class: "menu-item-text"
2021
- };
2022
- const _hoisted_2$2 = {
2023
- class: "menu-item-text",
2024
- style: { "margin": "0 5px" }
2025
- };
2026
- const _hoisted_3$1 = { class: "el-dropdown-link menubar-menu-button" };
2027
- function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
2028
- const _component_el_divider = vue.resolveComponent("el-divider");
2029
- const _component_tool_button = vue.resolveComponent("tool-button", true);
2030
- const _component_m_icon = vue.resolveComponent("m-icon");
2031
- const _component_el_button = vue.resolveComponent("el-button");
2032
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
2033
- const _component_arrow_down = vue.resolveComponent("arrow-down");
2034
- const _component_el_icon = vue.resolveComponent("el-icon");
2035
- const _component_el_dropdown_item = vue.resolveComponent("el-dropdown-item");
2036
- const _component_el_dropdown_menu = vue.resolveComponent("el-dropdown-menu");
2037
- const _component_el_dropdown = vue.resolveComponent("el-dropdown");
2038
- return _ctx.display ? (vue.openBlock(), vue.createElementBlock("div", {
2039
- key: 0,
2040
- class: vue.normalizeClass(["menu-item", _ctx.item.type]),
2041
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.clickHandler(_ctx.item, $event)),
2042
- onMousedown: _cache[1] || (_cache[1] = ($event) => _ctx.mousedownHandler(_ctx.item, $event)),
2043
- onMouseup: _cache[2] || (_cache[2] = ($event) => _ctx.mouseupHandler(_ctx.item, $event))
2044
- }, [
2045
- _ctx.item.type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
2046
- key: 0,
2047
- direction: _ctx.item.direction || "vertical"
2048
- }, null, 8, ["direction"])) : _ctx.item.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, vue.toDisplayString(_ctx.item.text), 1)) : _ctx.item.type === "zoom" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
2049
- vue.createVNode(_component_tool_button, {
2050
- data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
2051
- "event-type": _ctx.eventType
2052
- }, null, 8, ["data", "event-type"]),
2053
- vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(parseInt(`${_ctx.zoom * 100}`, 10)) + "%", 1),
2054
- vue.createVNode(_component_tool_button, {
2055
- data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
2056
- "event-type": _ctx.eventType
2057
- }, null, 8, ["data", "event-type"])
2058
- ], 64)) : _ctx.item.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
2059
- _ctx.item.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
2213
+ const clickHandler = (item2, event) => {
2214
+ if (props.eventType !== "click")
2215
+ return;
2216
+ if (item2.type === "button") {
2217
+ buttonHandler(item2, event);
2218
+ }
2219
+ };
2220
+ const mousedownHandler = (item2, event) => {
2221
+ if (props.eventType !== "mousedown")
2222
+ return;
2223
+ if (item2.type === "button") {
2224
+ buttonHandler(item2, event);
2225
+ }
2226
+ };
2227
+ const mouseupHandler = (item2, event) => {
2228
+ if (props.eventType !== "mouseup")
2229
+ return;
2230
+ if (item2.type === "button") {
2231
+ buttonHandler(item2, event);
2232
+ }
2233
+ };
2234
+ return (_ctx, _cache) => {
2235
+ const _component_el_divider = vue.resolveComponent("el-divider");
2236
+ const _component_tool_button = vue.resolveComponent("tool-button", true);
2237
+ const _component_el_button = vue.resolveComponent("el-button");
2238
+ const _component_el_tooltip = vue.resolveComponent("el-tooltip");
2239
+ const _component_el_icon = vue.resolveComponent("el-icon");
2240
+ const _component_el_dropdown_item = vue.resolveComponent("el-dropdown-item");
2241
+ const _component_el_dropdown_menu = vue.resolveComponent("el-dropdown-menu");
2242
+ const _component_el_dropdown = vue.resolveComponent("el-dropdown");
2243
+ return vue.unref(display) ? (vue.openBlock(), vue.createElementBlock("div", {
2060
2244
  key: 0,
2061
- effect: "dark",
2062
- placement: "bottom-start",
2063
- content: _ctx.item.tooltip
2064
- }, {
2065
- default: vue.withCtx(() => [
2066
- vue.createVNode(_component_el_button, {
2245
+ class: vue.normalizeClass(["menu-item", vue.unref(item).type]),
2246
+ onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(vue.unref(item), $event)),
2247
+ onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(vue.unref(item), $event)),
2248
+ onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(vue.unref(item), $event))
2249
+ }, [
2250
+ vue.unref(item).type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
2251
+ key: 0,
2252
+ direction: vue.unref(item).direction || "vertical"
2253
+ }, null, 8, ["direction"])) : vue.unref(item).type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, vue.toDisplayString(vue.unref(item).text), 1)) : vue.unref(item).type === "zoom" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
2254
+ vue.createVNode(_component_tool_button, {
2255
+ data: { type: "button", icon: vue.unref(iconsVue.ZoomOut), handler: zoomOutHandler, tooltip: "\u7F29\u5C0F" },
2256
+ "event-type": __props.eventType
2257
+ }, null, 8, ["data", "event-type"]),
2258
+ vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(parseInt(`${vue.unref(zoom) * 100}`, 10)) + "%", 1),
2259
+ vue.createVNode(_component_tool_button, {
2260
+ data: { type: "button", icon: vue.unref(iconsVue.ZoomIn), handler: zoomInHandler, tooltip: "\u653E\u5927" },
2261
+ "event-type": __props.eventType
2262
+ }, null, 8, ["data", "event-type"])
2263
+ ], 64)) : vue.unref(item).type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
2264
+ vue.unref(item).tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
2265
+ key: 0,
2266
+ effect: "dark",
2267
+ placement: "bottom-start",
2268
+ content: vue.unref(item).tooltip
2269
+ }, {
2270
+ default: vue.withCtx(() => [
2271
+ vue.createVNode(_component_el_button, {
2272
+ size: "small",
2273
+ text: "",
2274
+ disabled: vue.unref(disabled)
2275
+ }, {
2276
+ default: vue.withCtx(() => [
2277
+ vue.unref(item).icon ? (vue.openBlock(), vue.createBlock(MIcon, {
2278
+ key: 0,
2279
+ icon: vue.unref(item).icon
2280
+ }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
2281
+ vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(item).text), 1)
2282
+ ]),
2283
+ _: 1
2284
+ }, 8, ["disabled"])
2285
+ ]),
2286
+ _: 1
2287
+ }, 8, ["content"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
2288
+ key: 1,
2067
2289
  size: "small",
2068
2290
  text: "",
2069
- disabled: _ctx.disabled
2291
+ disabled: vue.unref(disabled)
2070
2292
  }, {
2071
2293
  default: vue.withCtx(() => [
2072
- _ctx.item.icon ? (vue.openBlock(), vue.createBlock(_component_m_icon, {
2294
+ vue.unref(item).icon ? (vue.openBlock(), vue.createBlock(MIcon, {
2073
2295
  key: 0,
2074
- icon: _ctx.item.icon
2296
+ icon: vue.unref(item).icon
2075
2297
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
2076
- vue.createElementVNode("span", null, vue.toDisplayString(_ctx.item.text), 1)
2298
+ vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(item).text), 1)
2077
2299
  ]),
2078
2300
  _: 1
2079
- }, 8, ["disabled"])
2080
- ]),
2081
- _: 1
2082
- }, 8, ["content"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
2083
- key: 1,
2084
- size: "small",
2085
- text: "",
2086
- disabled: _ctx.disabled
2087
- }, {
2088
- default: vue.withCtx(() => [
2089
- _ctx.item.icon ? (vue.openBlock(), vue.createBlock(_component_m_icon, {
2090
- key: 0,
2091
- icon: _ctx.item.icon
2092
- }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
2093
- vue.createElementVNode("span", null, vue.toDisplayString(_ctx.item.text), 1)
2094
- ]),
2095
- _: 1
2096
- }, 8, ["disabled"]))
2097
- ], 64)) : _ctx.item.type === "dropdown" ? (vue.openBlock(), vue.createBlock(_component_el_dropdown, {
2098
- key: 4,
2099
- trigger: "click",
2100
- disabled: _ctx.disabled,
2101
- onCommand: _ctx.dropdownHandler
2102
- }, {
2103
- dropdown: vue.withCtx(() => [
2104
- _ctx.item.items && _ctx.item.items.length ? (vue.openBlock(), vue.createBlock(_component_el_dropdown_menu, { key: 0 }, {
2301
+ }, 8, ["disabled"]))
2302
+ ], 64)) : vue.unref(item).type === "dropdown" ? (vue.openBlock(), vue.createBlock(_component_el_dropdown, {
2303
+ key: 4,
2304
+ trigger: "click",
2305
+ disabled: vue.unref(disabled),
2306
+ onCommand: dropdownHandler
2307
+ }, {
2308
+ dropdown: vue.withCtx(() => [
2309
+ vue.unref(item).items && vue.unref(item).items.length ? (vue.openBlock(), vue.createBlock(_component_el_dropdown_menu, { key: 0 }, {
2310
+ default: vue.withCtx(() => [
2311
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(item).items, (subItem, index) => {
2312
+ return vue.openBlock(), vue.createBlock(_component_el_dropdown_item, {
2313
+ key: index,
2314
+ command: { item: vue.unref(item), subItem }
2315
+ }, {
2316
+ default: vue.withCtx(() => [
2317
+ vue.createTextVNode(vue.toDisplayString(subItem.text), 1)
2318
+ ]),
2319
+ _: 2
2320
+ }, 1032, ["command"]);
2321
+ }), 128))
2322
+ ]),
2323
+ _: 1
2324
+ })) : vue.createCommentVNode("", true)
2325
+ ]),
2105
2326
  default: vue.withCtx(() => [
2106
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.item.items, (subItem, index) => {
2107
- return vue.openBlock(), vue.createBlock(_component_el_dropdown_item, {
2108
- key: index,
2109
- command: { item: _ctx.item, subItem }
2110
- }, {
2327
+ vue.createElementVNode("span", _hoisted_3, [
2328
+ vue.createTextVNode(vue.toDisplayString(vue.unref(item).text), 1),
2329
+ vue.createVNode(_component_el_icon, { class: "el-icon--right" }, {
2111
2330
  default: vue.withCtx(() => [
2112
- vue.createTextVNode(vue.toDisplayString(subItem.text), 1)
2331
+ vue.createVNode(vue.unref(iconsVue.ArrowDown))
2113
2332
  ]),
2114
- _: 2
2115
- }, 1032, ["command"]);
2116
- }), 128))
2333
+ _: 1
2334
+ })
2335
+ ])
2117
2336
  ]),
2118
2337
  _: 1
2119
- })) : vue.createCommentVNode("", true)
2120
- ]),
2121
- default: vue.withCtx(() => [
2122
- vue.createElementVNode("span", _hoisted_3$1, [
2123
- vue.createTextVNode(vue.toDisplayString(_ctx.item.text), 1),
2124
- vue.createVNode(_component_el_icon, { class: "el-icon--right" }, {
2125
- default: vue.withCtx(() => [
2126
- vue.createVNode(_component_arrow_down)
2127
- ]),
2128
- _: 1
2129
- })
2130
- ])
2131
- ]),
2132
- _: 1
2133
- }, 8, ["disabled", "onCommand"])) : _ctx.item.type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.item.component), vue.normalizeProps(vue.mergeProps({ key: 5 }, _ctx.item.props || {})), null, 16)) : vue.createCommentVNode("", true)
2134
- ], 34)) : vue.createCommentVNode("", true);
2135
- }
2136
- var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
2338
+ }, 8, ["disabled"])) : vue.unref(item).type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(item).component), vue.normalizeProps(vue.mergeProps({ key: 5 }, vue.unref(item).props || {})), null, 16)) : vue.createCommentVNode("", true)
2339
+ ], 34)) : vue.createCommentVNode("", true);
2340
+ };
2341
+ }
2342
+ });
2137
2343
 
2138
- const _sfc_main$d = vue.defineComponent({
2344
+ const _sfc_main$e = vue.defineComponent({
2139
2345
  name: "nav-menu",
2140
- components: { ToolButton },
2346
+ components: { ToolButton: _sfc_main$f },
2141
2347
  props: {
2142
2348
  data: {
2143
2349
  type: Object,
@@ -2155,7 +2361,8 @@
2155
2361
  };
2156
2362
  }
2157
2363
  });
2158
- function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
2364
+
2365
+ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
2159
2366
  const _component_tool_button = vue.resolveComponent("tool-button");
2160
2367
  return vue.openBlock(), vue.createElementBlock("div", {
2161
2368
  class: "m-editor-nav-menu",
@@ -2177,9 +2384,9 @@
2177
2384
  }), 128))
2178
2385
  ], 4);
2179
2386
  }
2180
- var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
2387
+ const NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$9]]);
2181
2388
 
2182
- const _sfc_main$c = vue.defineComponent({
2389
+ const _sfc_main$d = vue.defineComponent({
2183
2390
  name: "m-editor-props-panel",
2184
2391
  emits: ["mounted"],
2185
2392
  setup(props, { emit }) {
@@ -2226,8 +2433,9 @@
2226
2433
  };
2227
2434
  }
2228
2435
  });
2436
+
2229
2437
  const _hoisted_1$6 = { class: "`m-editor-props-panel" };
2230
- function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
2438
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2231
2439
  const _component_m_form = vue.resolveComponent("m-form");
2232
2440
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
2233
2441
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
@@ -2242,9 +2450,9 @@
2242
2450
  }, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"])
2243
2451
  ]);
2244
2452
  }
2245
- var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
2453
+ const PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$8]]);
2246
2454
 
2247
- const _sfc_main$b = vue.defineComponent({
2455
+ const _sfc_main$c = vue.defineComponent({
2248
2456
  name: "ui-component-panel",
2249
2457
  components: { MIcon },
2250
2458
  setup() {
@@ -2274,7 +2482,7 @@
2274
2482
  dragstartHandler({ text, type, data = {} }, e) {
2275
2483
  if (e.dataTransfer) {
2276
2484
  e.dataTransfer.effectAllowed = "move";
2277
- e.dataTransfer.setData("data", serialize__default["default"]({
2485
+ e.dataTransfer.setData("data", serialize__default.default({
2278
2486
  name: text,
2279
2487
  type,
2280
2488
  ...data
@@ -2310,9 +2518,10 @@
2310
2518
  };
2311
2519
  }
2312
2520
  });
2521
+
2313
2522
  const _hoisted_1$5 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
2314
2523
  const _hoisted_2$1 = ["onClick", "onDragstart"];
2315
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2524
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2316
2525
  const _component_el_input = vue.resolveComponent("el-input");
2317
2526
  const _component_m_icon = vue.resolveComponent("m-icon");
2318
2527
  const _component_el_tooltip = vue.resolveComponent("el-tooltip");
@@ -2384,22 +2593,17 @@
2384
2593
  _: 3
2385
2594
  });
2386
2595
  }
2387
- var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
2596
+ const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$7]]);
2388
2597
 
2389
- const _sfc_main$a = vue.defineComponent({
2390
- components: { ToolButton },
2598
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
2599
+ __name: "ContentMenu",
2391
2600
  props: {
2392
- menuData: {
2393
- type: Array,
2394
- default: () => []
2395
- },
2396
- isSubMenu: {
2397
- type: Boolean,
2398
- default: false
2399
- }
2601
+ menuData: { default: () => [] },
2602
+ isSubMenu: { type: Boolean, default: false }
2400
2603
  },
2401
2604
  emits: ["hide", "show"],
2402
- setup(props, { emit }) {
2605
+ setup(__props, { expose, emit }) {
2606
+ const props = __props;
2403
2607
  const menu = vue.ref();
2404
2608
  const subMenu = vue.ref();
2405
2609
  const visible = vue.ref(false);
@@ -2425,6 +2629,36 @@
2425
2629
  }
2426
2630
  hide();
2427
2631
  };
2632
+ const show = (e) => {
2633
+ setTimeout(() => {
2634
+ visible.value = true;
2635
+ vue.nextTick(() => {
2636
+ const menuHeight = menu.value?.clientHeight || 0;
2637
+ let top = e.clientY;
2638
+ if (menuHeight + e.clientY > document.body.clientHeight) {
2639
+ top = document.body.clientHeight - menuHeight;
2640
+ }
2641
+ menuStyle.value = {
2642
+ top: `${top}px`,
2643
+ left: `${e.clientX}px`
2644
+ };
2645
+ emit("show");
2646
+ });
2647
+ }, 300);
2648
+ };
2649
+ const showSubMenu = (item) => {
2650
+ const menuItem = item;
2651
+ if (typeof item !== "object" || !menuItem.items?.length) {
2652
+ return;
2653
+ }
2654
+ subMenuData.value = menuItem.items;
2655
+ if (menu.value) {
2656
+ subMenu.value.show({
2657
+ clientX: menu.value.offsetLeft + menu.value.clientWidth,
2658
+ clientY: menu.value.offsetTop
2659
+ });
2660
+ }
2661
+ };
2428
2662
  vue.onMounted(() => {
2429
2663
  if (props.isSubMenu)
2430
2664
  return;
@@ -2435,81 +2669,47 @@
2435
2669
  return;
2436
2670
  globalThis.removeEventListener("mousedown", hideHandler, true);
2437
2671
  });
2438
- return {
2439
- menu,
2440
- subMenu,
2441
- visible,
2442
- menuStyle,
2443
- subMenuData,
2672
+ expose({
2444
2673
  hide,
2445
- show(e) {
2446
- setTimeout(() => {
2447
- visible.value = true;
2448
- vue.nextTick(() => {
2449
- const menuHeight = menu.value?.clientHeight || 0;
2450
- let top = e.clientY;
2451
- if (menuHeight + e.clientY > document.body.clientHeight) {
2452
- top = document.body.clientHeight - menuHeight;
2453
- }
2454
- menuStyle.value = {
2455
- top: `${top}px`,
2456
- left: `${e.clientX}px`
2457
- };
2458
- emit("show");
2459
- });
2460
- }, 300);
2461
- },
2462
- showSubMenu(item) {
2463
- const menuItem = item;
2464
- if (typeof item !== "object" || !menuItem.items?.length) {
2465
- return;
2466
- }
2467
- subMenuData.value = menuItem.items;
2468
- if (menu.value) {
2469
- subMenu.value.show({
2470
- clientX: menu.value.offsetLeft + menu.value.clientWidth,
2471
- clientY: menu.value.offsetTop
2472
- });
2473
- }
2474
- }
2674
+ show
2675
+ });
2676
+ return (_ctx, _cache) => {
2677
+ const _component_content_menu = vue.resolveComponent("content-menu", true);
2678
+ return __props.menuData.length && visible.value ? (vue.openBlock(), vue.createElementBlock("div", {
2679
+ key: 0,
2680
+ class: "magic-editor-content-menu",
2681
+ ref_key: "menu",
2682
+ ref: menu,
2683
+ style: vue.normalizeStyle(menuStyle.value)
2684
+ }, [
2685
+ vue.createElementVNode("div", null, [
2686
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
2687
+ return vue.openBlock(), vue.createBlock(_sfc_main$f, {
2688
+ "event-type": "mouseup",
2689
+ data: item,
2690
+ key: index,
2691
+ onMouseup: hide,
2692
+ onMouseenter: ($event) => showSubMenu(item)
2693
+ }, null, 8, ["data", "onMouseenter"]);
2694
+ }), 128))
2695
+ ]),
2696
+ (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
2697
+ vue.createVNode(_component_content_menu, {
2698
+ class: "sub-menu",
2699
+ ref_key: "subMenu",
2700
+ ref: subMenu,
2701
+ "menu-data": subMenuData.value,
2702
+ "is-sub-menu": true,
2703
+ onHide: hide
2704
+ }, null, 8, ["menu-data"])
2705
+ ]))
2706
+ ], 4)) : vue.createCommentVNode("", true);
2475
2707
  };
2476
2708
  }
2477
2709
  });
2478
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
2479
- const _component_tool_button = vue.resolveComponent("tool-button");
2480
- const _component_content_menu = vue.resolveComponent("content-menu", true);
2481
- return _ctx.menuData.length && _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
2482
- key: 0,
2483
- class: "magic-editor-content-menu",
2484
- ref: "menu",
2485
- style: vue.normalizeStyle(_ctx.menuStyle)
2486
- }, [
2487
- vue.createElementVNode("div", null, [
2488
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
2489
- return vue.openBlock(), vue.createBlock(_component_tool_button, {
2490
- "event-type": "mouseup",
2491
- data: item,
2492
- key: index,
2493
- onMouseup: _ctx.hide,
2494
- onMouseenter: ($event) => _ctx.showSubMenu(item)
2495
- }, null, 8, ["data", "onMouseup", "onMouseenter"]);
2496
- }), 128))
2497
- ]),
2498
- (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
2499
- vue.createVNode(_component_content_menu, {
2500
- class: "sub-menu",
2501
- ref: "subMenu",
2502
- "menu-data": _ctx.subMenuData,
2503
- "is-sub-menu": true,
2504
- onHide: _ctx.hide
2505
- }, null, 8, ["menu-data", "onHide"])
2506
- ]))
2507
- ], 4)) : vue.createCommentVNode("", true);
2508
- }
2509
- var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
2510
2710
 
2511
- const _sfc_main$9 = vue.defineComponent({
2512
- components: { ContentMenu },
2711
+ const _sfc_main$a = vue.defineComponent({
2712
+ components: { ContentMenu: _sfc_main$b },
2513
2713
  setup() {
2514
2714
  const services = vue.inject("services");
2515
2715
  const menu = vue.ref();
@@ -2591,7 +2791,8 @@
2591
2791
  };
2592
2792
  }
2593
2793
  });
2594
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
2794
+
2795
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2595
2796
  const _component_content_menu = vue.resolveComponent("content-menu");
2596
2797
  return vue.openBlock(), vue.createBlock(_component_content_menu, {
2597
2798
  "menu-data": _ctx.menuData,
@@ -2599,7 +2800,7 @@
2599
2800
  style: { "overflow": "initial" }
2600
2801
  }, null, 8, ["menu-data"]);
2601
2802
  }
2602
- var LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
2803
+ const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$6]]);
2603
2804
 
2604
2805
  const throttleTime = 150;
2605
2806
  const select = async (data, editorService) => {
@@ -2633,9 +2834,17 @@
2633
2834
  return true;
2634
2835
  return false;
2635
2836
  },
2636
- handleDragEnd() {
2837
+ async handleDragEnd(e) {
2637
2838
  if (!tree.value)
2638
2839
  return;
2840
+ const { data: node } = e;
2841
+ const parent = editorService?.getParentById(node.id, false);
2842
+ const layout = await editorService?.getLayout(parent);
2843
+ node.style.position = layout;
2844
+ if (layout === Layout.RELATIVE) {
2845
+ node.style.top = 0;
2846
+ node.style.left = 0;
2847
+ }
2639
2848
  const { data } = tree.value;
2640
2849
  const [page] = data;
2641
2850
  editorService?.update(page);
@@ -2691,7 +2900,7 @@
2691
2900
  tree.value?.filter(val);
2692
2901
  }
2693
2902
  });
2694
- const _sfc_main$8 = vue.defineComponent({
2903
+ const _sfc_main$9 = vue.defineComponent({
2695
2904
  name: "magic-editor-layer-panel",
2696
2905
  components: { LayerMenu },
2697
2906
  setup() {
@@ -2738,8 +2947,9 @@
2738
2947
  };
2739
2948
  }
2740
2949
  });
2950
+
2741
2951
  const _hoisted_1$4 = ["id", "onMouseenter"];
2742
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2952
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2743
2953
  const _component_el_input = vue.resolveComponent("el-input");
2744
2954
  const _component_el_tree = vue.resolveComponent("el-tree");
2745
2955
  const _component_layer_menu = vue.resolveComponent("layer-menu");
@@ -2801,9 +3011,9 @@
2801
3011
  _: 3
2802
3012
  });
2803
3013
  }
2804
- var LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
3014
+ const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$5]]);
2805
3015
 
2806
- const _sfc_main$7 = vue.defineComponent({
3016
+ const _sfc_main$8 = vue.defineComponent({
2807
3017
  components: { MIcon },
2808
3018
  props: {
2809
3019
  data: {
@@ -2840,11 +3050,12 @@
2840
3050
  };
2841
3051
  }
2842
3052
  });
3053
+
2843
3054
  const _hoisted_1$3 = {
2844
3055
  key: 1,
2845
3056
  class: "magic-editor-tab-panel-title"
2846
3057
  };
2847
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
3058
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
2848
3059
  const _component_m_icon = vue.resolveComponent("m-icon");
2849
3060
  const _component_el_tab_pane = vue.resolveComponent("el-tab-pane");
2850
3061
  return _ctx.config ? (vue.openBlock(), vue.createBlock(_component_el_tab_pane, {
@@ -2890,9 +3101,9 @@
2890
3101
  _: 3
2891
3102
  }, 8, ["name"])) : vue.createCommentVNode("", true);
2892
3103
  }
2893
- var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
3104
+ const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$4]]);
2894
3105
 
2895
- const _sfc_main$6 = vue.defineComponent({
3106
+ const _sfc_main$7 = vue.defineComponent({
2896
3107
  components: { TabPane },
2897
3108
  name: "m-sidebar",
2898
3109
  props: {
@@ -2911,7 +3122,8 @@
2911
3122
  };
2912
3123
  }
2913
3124
  });
2914
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3125
+
3126
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
2915
3127
  const _component_tab_pane = vue.resolveComponent("tab-pane");
2916
3128
  const _component_el_tabs = vue.resolveComponent("el-tabs");
2917
3129
  return _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createBlock(_component_el_tabs, {
@@ -2946,331 +3158,258 @@
2946
3158
  _: 3
2947
3159
  }, 8, ["modelValue"])) : vue.createCommentVNode("", true);
2948
3160
  }
2949
- var Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
3161
+ const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3]]);
2950
3162
 
2951
- const useScroll = (root) => {
2952
- const pageBar = vue.ref();
2953
- const itemsContainer = vue.ref();
2954
- const pageBarWidth = vue.ref(0);
2955
- const canScroll = vue.ref(false);
2956
- const itemsContainerWidth = vue.computed(() => pageBarWidth.value - 105);
2957
- let translateLeft = 0;
2958
- const resizeObserver = new ResizeObserver((entries) => {
2959
- for (const { contentRect } of entries) {
2960
- const { width } = contentRect;
2961
- pageBarWidth.value = width || 0;
2962
- setCanScroll();
2963
- }
2964
- });
2965
- const setCanScroll = () => {
2966
- if (itemsContainer.value) {
2967
- canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
2968
- }
2969
- };
2970
- const scroll = (type) => {
2971
- if (!itemsContainer.value)
2972
- return;
2973
- const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
2974
- if (type === "left") {
2975
- translateLeft += 100;
2976
- if (translateLeft > 0) {
2977
- translateLeft = 0;
3163
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
3164
+ __name: "PageBarScrollContainer",
3165
+ setup(__props) {
3166
+ const services = vue.inject("services");
3167
+ const editorService = services?.editorService;
3168
+ const pageBar = vue.ref();
3169
+ const itemsContainer = vue.ref();
3170
+ const pageBarWidth = vue.ref(0);
3171
+ const canScroll = vue.ref(false);
3172
+ const itemsContainerWidth = vue.computed(() => pageBarWidth.value - 105);
3173
+ let translateLeft = 0;
3174
+ const resizeObserver = new ResizeObserver((entries) => {
3175
+ for (const { contentRect } of entries) {
3176
+ const { width } = contentRect;
3177
+ pageBarWidth.value = width || 0;
3178
+ setCanScroll();
2978
3179
  }
2979
- } else if (type === "right") {
2980
- translateLeft -= 100;
2981
- if (-translateLeft > maxScrollLeft) {
2982
- translateLeft = -maxScrollLeft;
3180
+ });
3181
+ const setCanScroll = () => {
3182
+ if (itemsContainer.value) {
3183
+ canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
2983
3184
  }
2984
- } else if (type === "start") {
2985
- translateLeft = 0;
2986
- } else if (type === "end") {
2987
- translateLeft = -maxScrollLeft;
2988
- }
2989
- itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
2990
- };
2991
- vue.onMounted(() => {
2992
- pageBar.value && resizeObserver.observe(pageBar.value);
2993
- });
2994
- vue.onUnmounted(() => {
2995
- resizeObserver.disconnect();
2996
- });
2997
- vue.watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
2998
- setTimeout(() => {
2999
- setCanScroll();
3000
- if (length < preLength) {
3001
- scroll("start");
3002
- } else {
3003
- scroll("end");
3185
+ };
3186
+ const scroll = (type) => {
3187
+ if (!itemsContainer.value)
3188
+ return;
3189
+ const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
3190
+ if (type === "left") {
3191
+ translateLeft += 100;
3192
+ if (translateLeft > 0) {
3193
+ translateLeft = 0;
3194
+ }
3195
+ } else if (type === "right") {
3196
+ translateLeft -= 100;
3197
+ if (-translateLeft > maxScrollLeft) {
3198
+ translateLeft = -maxScrollLeft;
3199
+ }
3200
+ } else if (type === "start") {
3201
+ translateLeft = 0;
3202
+ } else if (type === "end") {
3203
+ translateLeft = -maxScrollLeft;
3004
3204
  }
3205
+ itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
3206
+ };
3207
+ vue.onMounted(() => {
3208
+ pageBar.value && resizeObserver.observe(pageBar.value);
3209
+ });
3210
+ vue.onUnmounted(() => {
3211
+ resizeObserver.disconnect();
3005
3212
  });
3006
- });
3007
- return {
3008
- pageBar,
3009
- itemsContainer,
3010
- canScroll,
3011
- itemsContainerWidth,
3012
- scroll
3013
- };
3014
- };
3015
- const _sfc_main$5 = vue.defineComponent({
3016
- components: { ArrowLeftBold: iconsVue.ArrowLeftBold, ArrowRightBold: iconsVue.ArrowRightBold, CaretBottom: iconsVue.CaretBottom, Plus: iconsVue.Plus, ToolButton },
3017
- setup() {
3018
- const services = vue.inject("services");
3019
- const editorService = services?.editorService;
3020
3213
  const root = vue.computed(() => editorService?.get("root"));
3021
- return {
3022
- Delete: vue.markRaw(iconsVue.Delete),
3023
- DocumentCopy: vue.markRaw(iconsVue.DocumentCopy),
3024
- ...useScroll(root),
3025
- root,
3026
- page: vue.computed(() => editorService?.get("page")),
3027
- switchPage(page) {
3028
- editorService?.select(page);
3029
- },
3030
- addPage() {
3031
- if (!editorService)
3032
- return;
3033
- const pageConfig = {
3034
- type: schema.NodeType.PAGE,
3035
- name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
3036
- };
3037
- editorService.add(pageConfig);
3038
- },
3039
- copy(node) {
3040
- node && editorService?.copy(node);
3041
- editorService?.paste({
3042
- left: 0,
3043
- top: 0
3044
- });
3045
- },
3046
- remove(node) {
3047
- editorService?.remove(node);
3048
- }
3214
+ vue.watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
3215
+ setTimeout(() => {
3216
+ setCanScroll();
3217
+ if (length < preLength) {
3218
+ scroll("start");
3219
+ } else {
3220
+ scroll("end");
3221
+ }
3222
+ });
3223
+ });
3224
+ const addPage = () => {
3225
+ if (!editorService)
3226
+ return;
3227
+ const pageConfig = {
3228
+ type: schema.NodeType.PAGE,
3229
+ name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
3230
+ };
3231
+ editorService.add(pageConfig);
3049
3232
  };
3050
- }
3051
- });
3052
- const _hoisted_1$2 = {
3053
- class: "m-editor-page-bar",
3054
- ref: "pageBar"
3055
- };
3056
- const _hoisted_2 = ["onClick"];
3057
- const _hoisted_3 = { class: "m-editor-page-bar-title" };
3058
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
3059
- const _component_plus = vue.resolveComponent("plus");
3060
- const _component_el_icon = vue.resolveComponent("el-icon");
3061
- const _component_arrow_left_bold = vue.resolveComponent("arrow-left-bold");
3062
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
3063
- const _component_tool_button = vue.resolveComponent("tool-button");
3064
- const _component_caret_bottom = vue.resolveComponent("caret-bottom");
3065
- const _component_el_popover = vue.resolveComponent("el-popover");
3066
- const _component_arrow_right_bold = vue.resolveComponent("arrow-right-bold");
3067
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
3068
- vue.createElementVNode("div", {
3069
- id: "m-editor-page-bar-add-icon",
3070
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3071
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.addPage && _ctx.addPage(...args))
3072
- }, [
3073
- vue.createVNode(_component_el_icon, null, {
3074
- default: vue.withCtx(() => [
3075
- vue.createVNode(_component_plus)
3076
- ]),
3077
- _: 1
3078
- })
3079
- ]),
3080
- _ctx.canScroll ? (vue.openBlock(), vue.createElementBlock("div", {
3081
- key: 0,
3082
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3083
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.scroll("left"))
3084
- }, [
3085
- vue.createVNode(_component_el_icon, null, {
3086
- default: vue.withCtx(() => [
3087
- vue.createVNode(_component_arrow_left_bold)
3233
+ return (_ctx, _cache) => {
3234
+ const _component_el_icon = vue.resolveComponent("el-icon");
3235
+ return vue.openBlock(), vue.createElementBlock("div", {
3236
+ class: "m-editor-page-bar",
3237
+ ref_key: "pageBar",
3238
+ ref: pageBar
3239
+ }, [
3240
+ vue.createElementVNode("div", {
3241
+ id: "m-editor-page-bar-add-icon",
3242
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3243
+ onClick: addPage
3244
+ }, [
3245
+ vue.createVNode(_component_el_icon, null, {
3246
+ default: vue.withCtx(() => [
3247
+ vue.createVNode(vue.unref(iconsVue.Plus))
3248
+ ]),
3249
+ _: 1
3250
+ })
3088
3251
  ]),
3089
- _: 1
3090
- })
3091
- ])) : vue.createCommentVNode("", true),
3092
- _ctx.root ? (vue.openBlock(), vue.createElementBlock("div", {
3093
- key: 1,
3094
- class: "m-editor-page-bar-items",
3095
- ref: "itemsContainer",
3096
- style: vue.normalizeStyle(`width: ${_ctx.itemsContainerWidth}px`)
3097
- }, [
3098
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.items, (item) => {
3099
- return vue.openBlock(), vue.createElementBlock("div", {
3100
- key: item.key,
3101
- class: vue.normalizeClass(["m-editor-page-bar-item", { active: _ctx.page?.id === item.id }]),
3102
- onClick: ($event) => _ctx.switchPage(item)
3252
+ canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
3253
+ key: 0,
3254
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3255
+ onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
3103
3256
  }, [
3104
- vue.createElementVNode("div", _hoisted_3, [
3105
- vue.renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
3106
- vue.createVNode(_component_el_tooltip, {
3107
- effect: "dark",
3108
- placement: "top-start",
3109
- content: item.name
3110
- }, {
3111
- default: vue.withCtx(() => [
3112
- vue.createElementVNode("span", null, vue.toDisplayString(item.name), 1)
3113
- ]),
3114
- _: 2
3115
- }, 1032, ["content"])
3116
- ])
3117
- ]),
3118
- vue.createVNode(_component_el_popover, {
3119
- "popper-class": "page-bar-popover",
3120
- placement: "top",
3121
- width: 160,
3122
- trigger: "hover"
3123
- }, {
3124
- reference: vue.withCtx(() => [
3125
- vue.createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
3126
- default: vue.withCtx(() => [
3127
- vue.createVNode(_component_caret_bottom)
3128
- ]),
3129
- _: 1
3130
- })
3257
+ vue.createVNode(_component_el_icon, null, {
3258
+ default: vue.withCtx(() => [
3259
+ vue.createVNode(vue.unref(iconsVue.ArrowLeftBold))
3131
3260
  ]),
3261
+ _: 1
3262
+ })
3263
+ ])) : vue.createCommentVNode("", true),
3264
+ vue.unref(root) ? (vue.openBlock(), vue.createElementBlock("div", {
3265
+ key: 1,
3266
+ class: "m-editor-page-bar-items",
3267
+ ref_key: "itemsContainer",
3268
+ ref: itemsContainer,
3269
+ style: vue.normalizeStyle(`width: ${vue.unref(itemsContainerWidth)}px`)
3270
+ }, [
3271
+ vue.renderSlot(_ctx.$slots, "default")
3272
+ ], 4)) : vue.createCommentVNode("", true),
3273
+ canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
3274
+ key: 2,
3275
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3276
+ onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
3277
+ }, [
3278
+ vue.createVNode(_component_el_icon, null, {
3132
3279
  default: vue.withCtx(() => [
3133
- vue.createElementVNode("div", null, [
3134
- vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
3135
- vue.createVNode(_component_tool_button, {
3136
- data: {
3137
- type: "button",
3138
- text: "\u590D\u5236",
3139
- icon: _ctx.DocumentCopy,
3140
- handler: () => _ctx.copy(item)
3141
- }
3142
- }, null, 8, ["data"]),
3143
- vue.createVNode(_component_tool_button, {
3144
- data: {
3145
- type: "button",
3146
- text: "\u5220\u9664",
3147
- icon: _ctx.Delete,
3148
- handler: () => _ctx.remove(item)
3149
- }
3150
- }, null, 8, ["data"])
3151
- ])
3152
- ])
3280
+ vue.createVNode(vue.unref(iconsVue.ArrowRightBold))
3153
3281
  ]),
3154
- _: 2
3155
- }, 1024)
3156
- ], 10, _hoisted_2);
3157
- }), 128))
3158
- ], 4)) : vue.createCommentVNode("", true),
3159
- _ctx.canScroll ? (vue.openBlock(), vue.createElementBlock("div", {
3160
- key: 2,
3161
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3162
- onClick: _cache[2] || (_cache[2] = ($event) => _ctx.scroll("right"))
3163
- }, [
3164
- vue.createVNode(_component_el_icon, null, {
3165
- default: vue.withCtx(() => [
3166
- vue.createVNode(_component_arrow_right_bold)
3167
- ]),
3168
- _: 1
3169
- })
3170
- ])) : vue.createCommentVNode("", true)
3171
- ], 512);
3172
- }
3173
- var PageBar = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
3174
-
3175
- class ScrollViewer$1 {
3176
- constructor(options) {
3177
- this.enter = false;
3178
- this.targetEnter = false;
3179
- this.keydown = false;
3180
- this.zoom = 1;
3181
- this.scrollLeft = 0;
3182
- this.scrollTop = 0;
3183
- this.x = 0;
3184
- this.y = 0;
3185
- this.resizeObserver = new ResizeObserver((entries) => {
3186
- for (const { contentRect } of entries) {
3187
- const { width, height } = contentRect;
3188
- const targetRect = this.target.getBoundingClientRect();
3189
- const targetWidth = targetRect.width * this.zoom;
3190
- const targetMarginTop = Number(this.target.style.marginTop) || 0;
3191
- const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
3192
- if (targetWidth < width) {
3193
- this.target._left = 0;
3194
- }
3195
- if (targetHeight < height) {
3196
- this.target._top = 0;
3197
- }
3198
- this.scroll();
3199
- }
3200
- });
3201
- this.wheelHandler = (event) => {
3202
- if (this.targetEnter)
3203
- return;
3204
- const { deltaX, deltaY, currentTarget } = event;
3205
- if (currentTarget !== this.container)
3206
- return;
3207
- this.setScrollOffset(deltaX, deltaY);
3208
- this.scroll();
3209
- this.scrollLeft = this.target._left;
3210
- this.scrollTop = this.target._top;
3211
- };
3212
- this.mouseEnterHandler = () => {
3213
- this.enter = true;
3214
- };
3215
- this.mouseLeaveHandler = () => {
3216
- this.enter = false;
3217
- };
3218
- this.targetMouseEnterHandler = () => {
3219
- this.targetEnter = true;
3282
+ _: 1
3283
+ })
3284
+ ])) : vue.createCommentVNode("", true)
3285
+ ], 512);
3220
3286
  };
3221
- this.targetMouseLeaveHandler = () => {
3222
- this.targetEnter = false;
3287
+ }
3288
+ });
3289
+
3290
+ const _hoisted_1$2 = ["onClick"];
3291
+ const _hoisted_2 = { class: "m-editor-page-bar-title" };
3292
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
3293
+ __name: "PageBar",
3294
+ setup(__props) {
3295
+ const services = vue.inject("services");
3296
+ const editorService = services?.editorService;
3297
+ const root = vue.computed(() => editorService?.get("root"));
3298
+ const page = vue.computed(() => editorService?.get("page"));
3299
+ const switchPage = (page2) => {
3300
+ editorService?.select(page2);
3223
3301
  };
3224
- this.mousedownHandler = (event) => {
3225
- if (!this.keydown)
3226
- return;
3227
- event.stopImmediatePropagation();
3228
- event.stopPropagation();
3229
- this.target.style.cursor = "grabbing";
3230
- this.x = event.clientX;
3231
- this.y = event.clientY;
3232
- document.addEventListener("mousemove", this.mousemoveHandler);
3233
- document.addEventListener("mouseup", this.mouseupHandler);
3302
+ const copy = (node) => {
3303
+ node && editorService?.copy(node);
3304
+ editorService?.paste({
3305
+ left: 0,
3306
+ top: 0
3307
+ });
3234
3308
  };
3235
- this.mouseupHandler = () => {
3236
- this.x = 0;
3237
- this.y = 0;
3238
- this.scrollLeft = this.target._left;
3239
- this.scrollTop = this.target._top;
3240
- this.removeHandler();
3309
+ const remove = (node) => {
3310
+ editorService?.remove(node);
3241
3311
  };
3242
- this.mousemoveHandler = (event) => {
3243
- event.stopImmediatePropagation();
3244
- event.stopPropagation();
3245
- const deltaX = event.clientX - this.x;
3246
- const deltaY = event.clientY - this.y;
3247
- this.setScrollOffset(deltaX, deltaY);
3248
- this.scroll();
3312
+ return (_ctx, _cache) => {
3313
+ const _component_el_tooltip = vue.resolveComponent("el-tooltip");
3314
+ const _component_el_icon = vue.resolveComponent("el-icon");
3315
+ const _component_el_popover = vue.resolveComponent("el-popover");
3316
+ return vue.openBlock(), vue.createBlock(_sfc_main$6, null, {
3317
+ default: vue.withCtx(() => [
3318
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(root) && vue.unref(root).items || [], (item) => {
3319
+ return vue.openBlock(), vue.createElementBlock("div", {
3320
+ class: vue.normalizeClass(["m-editor-page-bar-item", { active: vue.unref(page)?.id === item.id }]),
3321
+ key: item.key,
3322
+ onClick: ($event) => switchPage(item)
3323
+ }, [
3324
+ vue.createElementVNode("div", _hoisted_2, [
3325
+ vue.renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
3326
+ vue.createVNode(_component_el_tooltip, {
3327
+ effect: "dark",
3328
+ placement: "top-start",
3329
+ content: item.name
3330
+ }, {
3331
+ default: vue.withCtx(() => [
3332
+ vue.createElementVNode("span", null, vue.toDisplayString(item.name), 1)
3333
+ ]),
3334
+ _: 2
3335
+ }, 1032, ["content"])
3336
+ ])
3337
+ ]),
3338
+ vue.createVNode(_component_el_popover, {
3339
+ "popper-class": "page-bar-popover",
3340
+ placement: "top",
3341
+ width: 160,
3342
+ trigger: "hover"
3343
+ }, {
3344
+ reference: vue.withCtx(() => [
3345
+ vue.createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
3346
+ default: vue.withCtx(() => [
3347
+ vue.createVNode(vue.unref(iconsVue.CaretBottom))
3348
+ ]),
3349
+ _: 1
3350
+ })
3351
+ ]),
3352
+ default: vue.withCtx(() => [
3353
+ vue.createElementVNode("div", null, [
3354
+ vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
3355
+ vue.createVNode(_sfc_main$f, {
3356
+ data: {
3357
+ type: "button",
3358
+ text: "\u590D\u5236",
3359
+ icon: vue.unref(iconsVue.DocumentCopy),
3360
+ handler: () => copy(item)
3361
+ }
3362
+ }, null, 8, ["data"]),
3363
+ vue.createVNode(_sfc_main$f, {
3364
+ data: {
3365
+ type: "button",
3366
+ text: "\u5220\u9664",
3367
+ icon: vue.unref(iconsVue.Delete),
3368
+ handler: () => remove(item)
3369
+ }
3370
+ }, null, 8, ["data"])
3371
+ ])
3372
+ ])
3373
+ ]),
3374
+ _: 2
3375
+ }, 1024)
3376
+ ], 10, _hoisted_1$2);
3377
+ }), 128))
3378
+ ]),
3379
+ _: 3
3380
+ });
3249
3381
  };
3250
- this.keydownHandler = (event) => {
3251
- if (event.code === Keys.ESCAPE && this.enter) {
3252
- event.preventDefault();
3253
- event.stopImmediatePropagation();
3254
- event.stopPropagation();
3255
- }
3256
- if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
3257
- return;
3382
+ }
3383
+ });
3384
+
3385
+ class ScrollViewer$1 {
3386
+ enter = false;
3387
+ targetEnter = false;
3388
+ keydown = false;
3389
+ container;
3390
+ target;
3391
+ zoom = 1;
3392
+ scrollLeft = 0;
3393
+ scrollTop = 0;
3394
+ x = 0;
3395
+ y = 0;
3396
+ resizeObserver = new ResizeObserver((entries) => {
3397
+ for (const { contentRect } of entries) {
3398
+ const { width, height } = contentRect;
3399
+ const targetRect = this.target.getBoundingClientRect();
3400
+ const targetWidth = targetRect.width * this.zoom;
3401
+ const targetMarginTop = Number(this.target.style.marginTop) || 0;
3402
+ const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
3403
+ if (targetWidth < width) {
3404
+ this.target._left = 0;
3258
3405
  }
3259
- this.keydown = true;
3260
- this.target.style.cursor = "grab";
3261
- this.container.addEventListener("mousedown", this.mousedownHandler);
3262
- };
3263
- this.keyupHandler = (event) => {
3264
- if (event.code !== Keys.ESCAPE || !this.keydown) {
3265
- return;
3406
+ if (targetHeight < height) {
3407
+ this.target._top = 0;
3266
3408
  }
3267
- event.preventDefault();
3268
- event.stopImmediatePropagation();
3269
- event.stopPropagation();
3270
- this.keydown = false;
3271
- event.preventDefault();
3272
- this.removeHandler();
3273
- };
3409
+ this.scroll();
3410
+ }
3411
+ });
3412
+ constructor(options) {
3274
3413
  this.container = options.container;
3275
3414
  this.target = options.target;
3276
3415
  this.zoom = options.zoom;
@@ -3306,6 +3445,79 @@
3306
3445
  document.removeEventListener("mousemove", this.mousemoveHandler);
3307
3446
  document.removeEventListener("mouseup", this.mouseupHandler);
3308
3447
  }
3448
+ wheelHandler = (event) => {
3449
+ if (this.targetEnter)
3450
+ return;
3451
+ const { deltaX, deltaY, currentTarget } = event;
3452
+ if (currentTarget !== this.container)
3453
+ return;
3454
+ this.setScrollOffset(deltaX, deltaY);
3455
+ this.scroll();
3456
+ this.scrollLeft = this.target._left;
3457
+ this.scrollTop = this.target._top;
3458
+ };
3459
+ mouseEnterHandler = () => {
3460
+ this.enter = true;
3461
+ };
3462
+ mouseLeaveHandler = () => {
3463
+ this.enter = false;
3464
+ };
3465
+ targetMouseEnterHandler = () => {
3466
+ this.targetEnter = true;
3467
+ };
3468
+ targetMouseLeaveHandler = () => {
3469
+ this.targetEnter = false;
3470
+ };
3471
+ mousedownHandler = (event) => {
3472
+ if (!this.keydown)
3473
+ return;
3474
+ event.stopImmediatePropagation();
3475
+ event.stopPropagation();
3476
+ this.target.style.cursor = "grabbing";
3477
+ this.x = event.clientX;
3478
+ this.y = event.clientY;
3479
+ document.addEventListener("mousemove", this.mousemoveHandler);
3480
+ document.addEventListener("mouseup", this.mouseupHandler);
3481
+ };
3482
+ mouseupHandler = () => {
3483
+ this.x = 0;
3484
+ this.y = 0;
3485
+ this.scrollLeft = this.target._left;
3486
+ this.scrollTop = this.target._top;
3487
+ this.removeHandler();
3488
+ };
3489
+ mousemoveHandler = (event) => {
3490
+ event.stopImmediatePropagation();
3491
+ event.stopPropagation();
3492
+ const deltaX = event.clientX - this.x;
3493
+ const deltaY = event.clientY - this.y;
3494
+ this.setScrollOffset(deltaX, deltaY);
3495
+ this.scroll();
3496
+ };
3497
+ keydownHandler = (event) => {
3498
+ if (event.code === Keys.ESCAPE && this.enter) {
3499
+ event.preventDefault();
3500
+ event.stopImmediatePropagation();
3501
+ event.stopPropagation();
3502
+ }
3503
+ if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
3504
+ return;
3505
+ }
3506
+ this.keydown = true;
3507
+ this.target.style.cursor = "grab";
3508
+ this.container.addEventListener("mousedown", this.mousedownHandler);
3509
+ };
3510
+ keyupHandler = (event) => {
3511
+ if (event.code !== Keys.ESCAPE || !this.keydown) {
3512
+ return;
3513
+ }
3514
+ event.preventDefault();
3515
+ event.stopImmediatePropagation();
3516
+ event.stopPropagation();
3517
+ this.keydown = false;
3518
+ event.preventDefault();
3519
+ this.removeHandler();
3520
+ };
3309
3521
  setScrollOffset(deltaX, deltaY) {
3310
3522
  const { width, height } = this.container.getBoundingClientRect();
3311
3523
  const targetRect = this.target.getBoundingClientRect();
@@ -3373,11 +3585,12 @@
3373
3585
  };
3374
3586
  }
3375
3587
  });
3588
+
3376
3589
  const _hoisted_1$1 = {
3377
3590
  class: "m-editor-scroll-viewer-container",
3378
3591
  ref: "container"
3379
3592
  };
3380
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3593
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3381
3594
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
3382
3595
  vue.createElementVNode("div", {
3383
3596
  ref: "el",
@@ -3387,170 +3600,172 @@
3387
3600
  ], 4)
3388
3601
  ], 512);
3389
3602
  }
3390
- var ScrollViewer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
3603
+ const ScrollViewer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$2]]);
3391
3604
 
3392
- const _sfc_main$3 = vue.defineComponent({
3393
- components: { ContentMenu },
3394
- setup() {
3605
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3606
+ __name: "ViewerMenu",
3607
+ props: {
3608
+ isMultiSelect: { type: Boolean, default: false }
3609
+ },
3610
+ setup(__props, { expose }) {
3611
+ const props = __props;
3395
3612
  const services = vue.inject("services");
3396
3613
  const editorService = services?.editorService;
3397
3614
  const menu = vue.ref();
3398
3615
  const canPaste = vue.ref(false);
3399
3616
  const canCenter = vue.ref(false);
3400
3617
  const node = vue.computed(() => editorService?.get("node"));
3618
+ const nodes = vue.computed(() => editorService?.get("nodes"));
3401
3619
  const parent = vue.computed(() => editorService?.get("parent"));
3402
- const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
3620
+ const stage = vue.computed(() => editorService?.get("stage"));
3403
3621
  const stageContentMenu = vue.inject("stageContentMenu", []);
3404
- vue.onMounted(() => {
3405
- const data = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
3622
+ const menuData = vue.reactive([
3623
+ {
3624
+ type: "button",
3625
+ text: "\u6C34\u5E73\u5C45\u4E2D",
3626
+ display: () => canCenter.value && !props.isMultiSelect,
3627
+ handler: () => {
3628
+ if (!node.value)
3629
+ return;
3630
+ editorService?.alignCenter(node.value);
3631
+ }
3632
+ },
3633
+ {
3634
+ type: "button",
3635
+ text: "\u590D\u5236",
3636
+ icon: vue.markRaw(iconsVue.DocumentCopy),
3637
+ handler: () => {
3638
+ nodes.value && editorService?.copy(nodes.value);
3639
+ canPaste.value = true;
3640
+ }
3641
+ },
3642
+ {
3643
+ type: "button",
3644
+ text: "\u7C98\u8D34",
3645
+ display: () => canPaste.value,
3646
+ handler: () => {
3647
+ const rect = menu.value?.$el.getBoundingClientRect();
3648
+ const parentRect = stage.value?.container?.getBoundingClientRect();
3649
+ const initialLeft = (rect?.left || 0) - (parentRect?.left || 0);
3650
+ const initialTop = (rect?.top || 0) - (parentRect?.top || 0);
3651
+ if (!nodes.value || nodes.value.length === 0)
3652
+ return;
3653
+ editorService?.paste({ left: initialLeft, top: initialTop });
3654
+ }
3655
+ },
3656
+ {
3657
+ type: "divider",
3658
+ direction: "horizontal",
3659
+ display: () => {
3660
+ if (!node.value)
3661
+ return false;
3662
+ return !utils.isPage(node.value);
3663
+ }
3664
+ },
3665
+ {
3666
+ type: "button",
3667
+ text: "\u4E0A\u79FB\u4E00\u5C42",
3668
+ icon: vue.markRaw(iconsVue.Top),
3669
+ display: () => !utils.isPage(node.value) && !props.isMultiSelect,
3670
+ handler: () => {
3671
+ editorService?.moveLayer(1);
3672
+ }
3673
+ },
3674
+ {
3675
+ type: "button",
3676
+ text: "\u4E0B\u79FB\u4E00\u5C42",
3677
+ icon: vue.markRaw(iconsVue.Bottom),
3678
+ display: () => !utils.isPage(node.value) && !props.isMultiSelect,
3679
+ handler: () => {
3680
+ editorService?.moveLayer(-1);
3681
+ }
3682
+ },
3683
+ {
3684
+ type: "button",
3685
+ text: "\u7F6E\u9876",
3686
+ display: () => !utils.isPage(node.value) && !props.isMultiSelect,
3687
+ handler: () => {
3688
+ editorService?.moveLayer(LayerOffset.TOP);
3689
+ }
3690
+ },
3691
+ {
3692
+ type: "button",
3693
+ text: "\u7F6E\u5E95",
3694
+ display: () => !utils.isPage(node.value) && !props.isMultiSelect,
3695
+ handler: () => {
3696
+ editorService?.moveLayer(LayerOffset.BOTTOM);
3697
+ }
3698
+ },
3699
+ {
3700
+ type: "divider",
3701
+ direction: "horizontal",
3702
+ display: () => !utils.isPage(node.value) && !props.isMultiSelect
3703
+ },
3704
+ {
3705
+ type: "button",
3706
+ text: "\u5220\u9664",
3707
+ icon: iconsVue.Delete,
3708
+ display: () => !utils.isPage(node.value),
3709
+ handler: () => {
3710
+ nodes.value && editorService?.remove(nodes.value);
3711
+ }
3712
+ },
3713
+ {
3714
+ type: "divider",
3715
+ direction: "horizontal"
3716
+ },
3717
+ {
3718
+ type: "button",
3719
+ text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
3720
+ handler: () => {
3721
+ editorService?.get("stage").clearGuides();
3722
+ }
3723
+ },
3724
+ ...stageContentMenu
3725
+ ]);
3726
+ vue.onMounted(async () => {
3727
+ const data = await storageService.getItem(COPY_STORAGE_KEY);
3406
3728
  canPaste.value = data !== "undefined" && !!data;
3407
3729
  });
3408
3730
  vue.watch(parent, async () => {
3409
3731
  if (!parent.value || !editorService)
3410
3732
  return canCenter.value = false;
3411
3733
  const layout = await editorService.getLayout(parent.value);
3412
- canCenter.value = [Layout.ABSOLUTE, Layout.FIXED].includes(layout) && ![schema.NodeType.ROOT, schema.NodeType.PAGE, "pop"].includes(`${node.value?.type}`);
3734
+ const isLayoutConform = [Layout.ABSOLUTE, Layout.FIXED].includes(layout);
3735
+ const isTypeConform = nodes.value?.every((selectedNode) => ![schema.NodeType.ROOT, schema.NodeType.PAGE, "pop"].includes(`${selectedNode?.type}`));
3736
+ canCenter.value = isLayoutConform && !!isTypeConform;
3413
3737
  }, { immediate: true });
3414
- return {
3415
- menu,
3416
- menuData: vue.reactive([
3417
- {
3418
- type: "button",
3419
- text: "\u6C34\u5E73\u5C45\u4E2D",
3420
- display: () => canCenter.value,
3421
- handler: () => {
3422
- node.value && editorService?.alignCenter(node.value);
3423
- }
3424
- },
3425
- {
3426
- type: "button",
3427
- text: "\u590D\u5236",
3428
- icon: vue.markRaw(iconsVue.DocumentCopy),
3429
- handler: () => {
3430
- node.value && editorService?.copy(node.value);
3431
- canPaste.value = true;
3432
- }
3433
- },
3434
- {
3435
- type: "button",
3436
- text: "\u7C98\u8D34",
3437
- display: () => canPaste.value,
3438
- handler: () => {
3439
- const stage = editorService?.get("stage");
3440
- const rect = menu.value?.$el.getBoundingClientRect();
3441
- const parentRect = stage?.container?.getBoundingClientRect();
3442
- let left = (rect?.left || 0) - (parentRect?.left || 0);
3443
- let top = (rect?.top || 0) - (parentRect?.top || 0);
3444
- if (node.value?.items && stage) {
3445
- const parentEl = stage.renderer.contentWindow?.document.getElementById(`${node.value.id}`);
3446
- const parentElRect = parentEl?.getBoundingClientRect();
3447
- left = left - (parentElRect?.left || 0);
3448
- top = top - (parentElRect?.top || 0);
3449
- }
3450
- editorService?.paste({ left, top });
3451
- }
3452
- },
3453
- {
3454
- type: "divider",
3455
- direction: "horizontal",
3456
- display: () => !isPage.value
3457
- },
3458
- {
3459
- type: "button",
3460
- text: "\u4E0A\u79FB\u4E00\u5C42",
3461
- icon: vue.markRaw(iconsVue.Top),
3462
- display: () => !isPage.value,
3463
- handler: () => {
3464
- editorService?.moveLayer(1);
3465
- }
3466
- },
3467
- {
3468
- type: "button",
3469
- text: "\u4E0B\u79FB\u4E00\u5C42",
3470
- icon: vue.markRaw(iconsVue.Bottom),
3471
- display: () => !isPage.value,
3472
- handler: () => {
3473
- editorService?.moveLayer(-1);
3474
- }
3475
- },
3476
- {
3477
- type: "button",
3478
- text: "\u7F6E\u9876",
3479
- display: () => !isPage.value,
3480
- handler: () => {
3481
- editorService?.moveLayer(LayerOffset.TOP);
3482
- }
3483
- },
3484
- {
3485
- type: "button",
3486
- text: "\u7F6E\u5E95",
3487
- display: () => !isPage.value,
3488
- handler: () => {
3489
- editorService?.moveLayer(LayerOffset.BOTTOM);
3490
- }
3491
- },
3492
- {
3493
- type: "divider",
3494
- direction: "horizontal",
3495
- display: () => !isPage.value
3496
- },
3497
- {
3498
- type: "button",
3499
- text: "\u5220\u9664",
3500
- icon: iconsVue.Delete,
3501
- display: () => !isPage.value,
3502
- handler: () => {
3503
- node.value && editorService?.remove(node.value);
3504
- }
3505
- },
3506
- {
3507
- type: "divider",
3508
- direction: "horizontal"
3509
- },
3510
- {
3511
- type: "button",
3512
- text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
3513
- handler: () => {
3514
- editorService?.get("stage").clearGuides();
3515
- }
3516
- },
3517
- ...stageContentMenu
3518
- ]),
3519
- show(e) {
3520
- menu.value?.show(e);
3521
- }
3738
+ const show = (e) => {
3739
+ menu.value?.show(e);
3740
+ };
3741
+ expose({ show });
3742
+ return (_ctx, _cache) => {
3743
+ return vue.openBlock(), vue.createBlock(_sfc_main$b, {
3744
+ "menu-data": menuData,
3745
+ ref_key: "menu",
3746
+ ref: menu
3747
+ }, null, 8, ["menu-data"]);
3522
3748
  };
3523
3749
  }
3524
3750
  });
3525
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
3526
- const _component_content_menu = vue.resolveComponent("content-menu");
3527
- return vue.openBlock(), vue.createBlock(_component_content_menu, {
3528
- "menu-data": _ctx.menuData,
3529
- ref: "menu"
3530
- }, null, 8, ["menu-data"]);
3531
- }
3532
- var ViewerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
3533
3751
 
3534
- const _sfc_main$2 = vue.defineComponent({
3535
- name: "magic-stage",
3536
- components: {
3537
- ViewerMenu,
3538
- ScrollViewer
3539
- },
3540
- setup() {
3752
+ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3753
+ __name: "Stage",
3754
+ setup(__props) {
3755
+ let stage = null;
3756
+ let runtime = null;
3541
3757
  const services = vue.inject("services");
3542
3758
  const stageOptions = vue.inject("stageOptions");
3543
3759
  const stageWrap = vue.ref();
3544
3760
  const stageContainer = vue.ref();
3545
3761
  const menu = vue.ref();
3762
+ const isMultiSelect = vue.computed(() => services?.editorService.get("nodes")?.length > 1);
3546
3763
  const stageRect = vue.computed(() => services?.uiService.get("stageRect"));
3547
3764
  const uiSelectMode = vue.computed(() => services?.uiService.get("uiSelectMode"));
3548
3765
  const root = vue.computed(() => services?.editorService.get("root"));
3549
3766
  const page = vue.computed(() => services?.editorService.get("page"));
3550
3767
  const zoom = vue.computed(() => services?.uiService.get("zoom") || 1);
3551
3768
  const node = vue.computed(() => services?.editorService.get("node"));
3552
- let stage = null;
3553
- let runtime = null;
3554
3769
  const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
3555
3770
  vue.watchEffect(() => {
3556
3771
  if (stage)
@@ -3559,7 +3774,7 @@
3559
3774
  return;
3560
3775
  if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value)
3561
3776
  return;
3562
- stage = new StageCore__default["default"]({
3777
+ stage = new StageCore__default.default({
3563
3778
  render: stageOptions.render,
3564
3779
  runtimeUrl: stageOptions.runtimeUrl,
3565
3780
  zoom: zoom.value,
@@ -3590,6 +3805,9 @@
3590
3805
  stage?.on("highlight", (el) => {
3591
3806
  services?.editorService.highlight(el.id);
3592
3807
  });
3808
+ stage?.on("multiSelect", (els) => {
3809
+ services?.editorService.multiSelect(els.map((el) => el.id));
3810
+ });
3593
3811
  stage?.on("update", (ev) => {
3594
3812
  if (ev.parentEl) {
3595
3813
  services?.editorService.moveToContainer({ id: ev.el.id, style: ev.style }, ev.parentEl.id);
@@ -3648,100 +3866,96 @@
3648
3866
  resizeObserver.disconnect();
3649
3867
  services?.editorService.set("stage", null);
3650
3868
  });
3651
- return {
3652
- stageWrap,
3653
- stageContainer,
3654
- menu,
3655
- stageRect,
3656
- zoom,
3657
- contextmenuHandler(e2) {
3658
- e2.preventDefault();
3659
- menu.value?.show(e2);
3660
- },
3661
- dragoverHandler(e2) {
3662
- e2.preventDefault();
3663
- if (e2.dataTransfer) {
3664
- e2.dataTransfer.dropEffect = "move";
3665
- }
3666
- },
3667
- async dropHandler(e) {
3668
- e.preventDefault();
3669
- const doc = stage?.renderer.contentWindow?.document;
3670
- const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
3671
- let parent = page.value;
3672
- if (parentEl) {
3673
- parent = services?.editorService.getNodeById(parentEl.id, false);
3674
- }
3675
- if (e.dataTransfer && parent && stageContainer.value && stage) {
3676
- const config = eval(`(${e.dataTransfer.getData("data")})`);
3677
- const layout = await services?.editorService.getLayout(parent);
3678
- const containerRect = stageContainer.value.getBoundingClientRect();
3679
- const { scrollTop, scrollLeft } = stage.mask;
3680
- const { style = {} } = config;
3681
- let top = 0;
3682
- let left = 0;
3683
- let position = "relative";
3684
- if (layout === Layout.ABSOLUTE) {
3685
- position = "absolute";
3686
- top = e.clientY - containerRect.top + scrollTop;
3687
- left = e.clientX - containerRect.left + scrollLeft;
3688
- if (parentEl && doc) {
3689
- const { left: parentLeft, top: parentTop } = StageCore.getOffset(parentEl);
3690
- left = left - StageCore.calcValueByFontsize(doc, parentLeft);
3691
- top = top - StageCore.calcValueByFontsize(doc, parentTop);
3692
- }
3869
+ const contextmenuHandler = (e2) => {
3870
+ e2.preventDefault();
3871
+ menu.value?.show(e2);
3872
+ };
3873
+ const dragoverHandler = (e2) => {
3874
+ e2.preventDefault();
3875
+ if (e2.dataTransfer) {
3876
+ e2.dataTransfer.dropEffect = "move";
3877
+ }
3878
+ };
3879
+ const dropHandler = async (e) => {
3880
+ e.preventDefault();
3881
+ const doc = stage?.renderer.contentWindow?.document;
3882
+ const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
3883
+ let parent = page.value;
3884
+ if (parentEl) {
3885
+ parent = services?.editorService.getNodeById(parentEl.id, false);
3886
+ }
3887
+ if (e.dataTransfer && parent && stageContainer.value && stage) {
3888
+ const config = eval(`(${e.dataTransfer.getData("data")})`);
3889
+ const layout = await services?.editorService.getLayout(parent);
3890
+ const containerRect = stageContainer.value.getBoundingClientRect();
3891
+ const { scrollTop, scrollLeft } = stage.mask;
3892
+ const { style = {} } = config;
3893
+ let top = 0;
3894
+ let left = 0;
3895
+ let position = "relative";
3896
+ if (layout === Layout.ABSOLUTE) {
3897
+ position = "absolute";
3898
+ top = e.clientY - containerRect.top + scrollTop;
3899
+ left = e.clientX - containerRect.left + scrollLeft;
3900
+ if (parentEl && doc) {
3901
+ const { left: parentLeft, top: parentTop } = StageCore.getOffset(parentEl);
3902
+ left = left - StageCore.calcValueByFontsize(doc, parentLeft);
3903
+ top = top - StageCore.calcValueByFontsize(doc, parentTop);
3693
3904
  }
3694
- config.style = {
3695
- ...style,
3696
- position,
3697
- top,
3698
- left
3699
- };
3700
- config.inputEvent = e;
3701
- services?.editorService.add(config, parent);
3702
3905
  }
3906
+ config.style = {
3907
+ ...style,
3908
+ position,
3909
+ top,
3910
+ left
3911
+ };
3912
+ config.inputEvent = e;
3913
+ services?.editorService.add(config, parent);
3703
3914
  }
3704
3915
  };
3916
+ return (_ctx, _cache) => {
3917
+ return vue.openBlock(), vue.createBlock(ScrollViewer, {
3918
+ class: "m-editor-stage",
3919
+ ref_key: "stageWrap",
3920
+ ref: stageWrap,
3921
+ width: vue.unref(stageRect)?.width,
3922
+ height: vue.unref(stageRect)?.height,
3923
+ zoom: vue.unref(zoom)
3924
+ }, {
3925
+ default: vue.withCtx(() => [
3926
+ vue.createElementVNode("div", {
3927
+ class: "m-editor-stage-container",
3928
+ ref_key: "stageContainer",
3929
+ ref: stageContainer,
3930
+ style: vue.normalizeStyle(`transform: scale(${vue.unref(zoom)})`),
3931
+ onContextmenu: contextmenuHandler,
3932
+ onDrop: dropHandler,
3933
+ onDragover: dragoverHandler
3934
+ }, null, 36),
3935
+ (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
3936
+ vue.createVNode(_sfc_main$3, {
3937
+ ref_key: "menu",
3938
+ ref: menu,
3939
+ "is-multi-select": vue.unref(isMultiSelect)
3940
+ }, null, 8, ["is-multi-select"])
3941
+ ]))
3942
+ ]),
3943
+ _: 1
3944
+ }, 8, ["width", "height", "zoom"]);
3945
+ };
3705
3946
  }
3706
3947
  });
3707
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3708
- const _component_viewer_menu = vue.resolveComponent("viewer-menu");
3709
- const _component_scroll_viewer = vue.resolveComponent("scroll-viewer");
3710
- return vue.openBlock(), vue.createBlock(_component_scroll_viewer, {
3711
- class: "m-editor-stage",
3712
- ref: "stageWrap",
3713
- width: _ctx.stageRect?.width,
3714
- height: _ctx.stageRect?.height,
3715
- zoom: _ctx.zoom
3716
- }, {
3717
- default: vue.withCtx(() => [
3718
- vue.createElementVNode("div", {
3719
- class: "m-editor-stage-container",
3720
- ref: "stageContainer",
3721
- style: vue.normalizeStyle(`transform: scale(${_ctx.zoom})`),
3722
- onContextmenu: _cache[0] || (_cache[0] = (...args) => _ctx.contextmenuHandler && _ctx.contextmenuHandler(...args)),
3723
- onDrop: _cache[1] || (_cache[1] = (...args) => _ctx.dropHandler && _ctx.dropHandler(...args)),
3724
- onDragover: _cache[2] || (_cache[2] = (...args) => _ctx.dragoverHandler && _ctx.dragoverHandler(...args))
3725
- }, null, 36),
3726
- (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
3727
- vue.createVNode(_component_viewer_menu, { ref: "menu" }, null, 512)
3728
- ]))
3729
- ]),
3730
- _: 1
3731
- }, 8, ["width", "height", "zoom"]);
3732
- }
3733
- var MagicStage = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
3734
3948
 
3735
3949
  const _sfc_main$1 = vue.defineComponent({
3736
3950
  name: "m-editor-workspace",
3737
3951
  components: {
3738
- PageBar,
3739
- MagicStage
3952
+ PageBar: _sfc_main$5,
3953
+ MagicStage: _sfc_main$2
3740
3954
  },
3741
3955
  setup() {
3742
3956
  const services = vue.inject("services");
3743
3957
  const workspace = vue.ref();
3744
- const node = vue.computed(() => services?.editorService.get("node"));
3958
+ const nodes = vue.computed(() => services?.editorService.get("nodes"));
3745
3959
  let keycon;
3746
3960
  const mouseenterHandler = () => {
3747
3961
  workspace.value?.focus();
@@ -3752,31 +3966,31 @@
3752
3966
  vue.onMounted(() => {
3753
3967
  workspace.value?.addEventListener("mouseenter", mouseenterHandler);
3754
3968
  workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
3755
- keycon = new KeyController__default["default"](workspace.value);
3969
+ keycon = new KeyController__default.default(workspace.value);
3756
3970
  const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
3757
3971
  const ctrl = isMac ? "meta" : "ctrl";
3758
3972
  keycon.keyup("delete", (e) => {
3759
3973
  e.inputEvent.preventDefault();
3760
- if (!node.value || utils.isPage(node.value))
3974
+ if (!nodes.value || utils.isPage(nodes.value[0]))
3761
3975
  return;
3762
- services?.editorService.remove(node.value);
3976
+ services?.editorService.remove(nodes.value);
3763
3977
  }).keyup("backspace", (e) => {
3764
3978
  e.inputEvent.preventDefault();
3765
- if (!node.value || utils.isPage(node.value))
3979
+ if (!nodes.value || utils.isPage(nodes.value[0]))
3766
3980
  return;
3767
- services?.editorService.remove(node.value);
3981
+ services?.editorService.remove(nodes.value);
3768
3982
  }).keydown([ctrl, "c"], (e) => {
3769
3983
  e.inputEvent.preventDefault();
3770
- node.value && services?.editorService.copy(node.value);
3984
+ nodes.value && services?.editorService.copy(nodes.value);
3771
3985
  }).keydown([ctrl, "v"], (e) => {
3772
3986
  e.inputEvent.preventDefault();
3773
- node.value && services?.editorService.paste();
3987
+ nodes.value && services?.editorService.paste();
3774
3988
  }).keydown([ctrl, "x"], (e) => {
3775
3989
  e.inputEvent.preventDefault();
3776
- if (!node.value || utils.isPage(node.value))
3990
+ if (!nodes.value || utils.isPage(nodes.value[0]))
3777
3991
  return;
3778
- services?.editorService.copy(node.value);
3779
- services?.editorService.remove(node.value);
3992
+ services?.editorService.copy(nodes.value);
3993
+ services?.editorService.remove(nodes.value);
3780
3994
  }).keydown([ctrl, "z"], (e) => {
3781
3995
  e.inputEvent.preventDefault();
3782
3996
  services?.editorService.undo();
@@ -3838,6 +4052,7 @@
3838
4052
  };
3839
4053
  }
3840
4054
  });
4055
+
3841
4056
  const _hoisted_1 = {
3842
4057
  class: "m-editor-workspace",
3843
4058
  tabindex: "1",
@@ -3862,14 +4077,14 @@
3862
4077
  })
3863
4078
  ], 512);
3864
4079
  }
3865
- var Workspace = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
4080
+ const Workspace = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
3866
4081
 
3867
4082
  class ComponentList extends BaseService {
4083
+ state = vue.reactive({
4084
+ list: []
4085
+ });
3868
4086
  constructor() {
3869
4087
  super([]);
3870
- this.state = vue.reactive({
3871
- list: []
3872
- });
3873
4088
  }
3874
4089
  setList(componentGroupList) {
3875
4090
  this.state.list = componentGroupList;
@@ -3878,7 +4093,7 @@
3878
4093
  return this.state.list;
3879
4094
  }
3880
4095
  }
3881
- var componentListService = new ComponentList();
4096
+ const componentListService = new ComponentList();
3882
4097
 
3883
4098
  const DEFAULT_LEFT_COLUMN_WIDTH = 310;
3884
4099
  const MIN_LEFT_COLUMN_WIDTH = 45;
@@ -3998,7 +4213,7 @@
3998
4213
  return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
3999
4214
  }
4000
4215
  }
4001
- var uiService = new Ui();
4216
+ const uiService = new Ui();
4002
4217
 
4003
4218
  const _sfc_main = vue.defineComponent({
4004
4219
  name: "m-editor",
@@ -4128,7 +4343,8 @@
4128
4343
  historyService,
4129
4344
  propsService,
4130
4345
  editorService,
4131
- uiService
4346
+ uiService,
4347
+ storageService
4132
4348
  };
4133
4349
  vue.provide("services", services);
4134
4350
  vue.provide("layerContentMenu", props.layerContentMenu);
@@ -4147,6 +4363,7 @@
4147
4363
  return services;
4148
4364
  }
4149
4365
  });
4366
+
4150
4367
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4151
4368
  const _component_nav_menu = vue.resolveComponent("nav-menu");
4152
4369
  const _component_sidebar = vue.resolveComponent("sidebar");
@@ -4207,18 +4424,18 @@
4207
4424
  _: 3
4208
4425
  }, 8, ["code-options"]);
4209
4426
  }
4210
- var Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
4427
+ const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
4211
4428
 
4212
- var index$1 = /* #__PURE__ */ (() => ".m-editor-nav-menu {\n display: flex;\n z-index: 5;\n -webkit-box-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n align-items: center;\n background-color: #ffffff;\n font-size: 19.2px;\n color: #070303;\n font-weight: 400;\n box-sizing: border-box;\n margin: 0px;\n flex: 0 0 35px;\n border-bottom: 1px solid #d8dee8;\n}\n.m-editor-nav-menu > div {\n display: flex;\n height: 100%;\n z-index: 1;\n align-items: center;\n}\n.m-editor-nav-menu .menu-center {\n justify-content: center;\n}\n.m-editor-nav-menu .menu-right {\n justify-content: flex-end;\n}\n.m-editor-nav-menu .menu-item {\n flex-direction: row;\n -webkit-box-align: center;\n align-items: center;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1;\n height: 100%;\n color: rgba(255, 255, 255, 0.7);\n box-sizing: inherit;\n z-index: 1;\n display: flex !important;\n transition: all 0.3s ease 0s;\n border-bottom: 2px solid transparent;\n margin: 0;\n}\n.m-editor-nav-menu .menu-item .is-disabled {\n opacity: 0.5;\n}\n.m-editor-nav-menu .menu-item .is-text {\n padding: 5px;\n}\n.m-editor-nav-menu .menu-item .is-text,\n.m-editor-nav-menu .menu-item i {\n color: #070303;\n}\n.m-editor-nav-menu .menu-item .icon {\n display: flex;\n -webkit-box-align: center;\n align-items: center;\n height: 100%;\n padding: 0px 8px;\n}\n.m-editor-nav-menu .menu-item .menu-item-text {\n color: #070303;\n}\n.m-editor {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.m-editor-content {\n width: 100%;\n height: calc(100% - 35px);\n display: flex;\n justify-self: space-between;\n}\n.m-editor-framework-center {\n position: relative;\n transform: translateZ(0);\n flex: 1;\n}\n.m-editor-framework-left {\n background-color: #ffffff;\n}\n.m-editor-framework-center .el-scrollbar__view {\n height: 100%;\n min-height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.m-editor-empty-panel {\n display: flex;\n flex: 1;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n height: calc(100% - 32px);\n}\n.m-editor-empty-content {\n display: flex;\n justify-content: space-evenly;\n flex-direction: row;\n width: 100%;\n}\n.m-editor-empty-button {\n border: 3px solid rgba(0, 0, 0, 0.2);\n padding: 10px 40px;\n color: rgba(0, 0, 0, 0.6);\n cursor: pointer;\n}\n.m-editor-empty-button i {\n height: 180px;\n line-height: 180px;\n font-size: 100px;\n}\n.m-editor-empty-button p {\n text-align: center;\n font-size: 20px;\n margin-top: 5px;\n}\n.m-editor-empty-button:hover {\n border-color: #2882e0;\n color: #2882e0;\n}\n.m-editor-sidebar {\n height: 100%;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header {\n background: #2882e0;\n border: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header.is-left {\n width: 40px;\n margin-right: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__nav-wrap {\n margin: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__nav {\n border: 0;\n border-radius: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .tab-label {\n margin-left: 2px;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left {\n line-height: 15px;\n border: 0;\n height: auto;\n padding: 8px;\n color: rgb(255, 255, 255);\n box-sizing: border-box;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left.is-active {\n background: #ffffff;\n border: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left.is-active i {\n color: #353140;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left.is-active .magic-editor-tab-panel-title {\n color: #353140;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left:first-child {\n border-right: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header i {\n font-size: 25px;\n color: rgba(255, 255, 255, 0.6);\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header i:hover {\n color: rgb(255, 255, 255);\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .magic-editor-tab-panel-title {\n font-size: 12px;\n white-space: normal;\n}\n.m-editor-sidebar .el-scrollbar {\n height: 100%;\n}\n.m-editor-sidebar .el-tree {\n min-height: 100%;\n}\n.m-editor-sidebar .fold-icon {\n position: absolute;\n bottom: 8px;\n left: 0px;\n width: 45px;\n padding-left: 8px;\n color: #fff;\n font-size: 32px;\n opacity: 0.8;\n cursor: pointer;\n}\n.m-editor-sidebar .fold-icon:hover {\n background: rgba(0, 0, 0, 0.2);\n}\n.m-editor-sidebar .el-tabs__content,\n.m-editor-sidebar .el-tab-pane {\n height: 100%;\n}\n.magic-editor-layer-panel {\n background: #ffffff;\n}\n.magic-editor-layer-panel .search-input {\n background: #ffffff;\n color: #bbbbbb;\n padding: 10px;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 1;\n}\n.magic-editor-layer-panel .search-input .el-input__suffix {\n padding: 10px 5px;\n}\n.magic-editor-layer-panel .node-content {\n flex: 1;\n display: flex;\n width: 100%;\n}\n.magic-editor-layer-panel .node-content > div {\n width: 8px;\n}\n.magic-editor-layer-panel .node-content > span {\n width: calc(100% - 68px);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.magic-editor-layer-panel .node-content > i {\n margin-right: 10px;\n font-size: 20px;\n}\n.magic-editor-layer-panel .node-content > i.lock {\n color: #bbb;\n}\n.magic-editor-layer-panel,\n.magic-editor-layer-panel .el-tree {\n background-color: #ffffff;\n color: #313a40;\n}\n.magic-editor-layer-panel .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {\n background-color: #2882e0;\n color: #fff;\n}\n.magic-editor-layer-panel .cus-tree-node {\n width: 100%;\n overflow: hidden;\n}\n.magic-editor-layer-panel .cus-tree-node-hover {\n background-color: #f3f5f9;\n width: 100%;\n}\n.magic-editor-layer-panel .el-tree-node:focus > .el-tree-node__content {\n background-color: #2882e0;\n color: #fff;\n}\n.ui-tree-tip {\n width: 100%;\n height: 25px;\n margin-left: 10px;\n background: #ffffff;\n font-style: italic;\n color: #555554;\n position: absolute;\n top: 40px;\n left: 0;\n z-index: 1;\n}\n.ui-component-panel {\n height: 100%;\n border-top: 0 !important;\n margin-top: 50px;\n background-color: #ffffff;\n}\n.ui-component-panel .search-input {\n background: #f8fbff;\n color: #bbbbbb;\n padding: 10px;\n position: absolute;\n top: 0;\n left: 0;\n box-sizing: border-box;\n z-index: 1;\n}\n.ui-component-panel .search-input .el-input__prefix {\n padding: 10px;\n}\n.ui-component-panel .search-input .el-input__suffix {\n padding: 10px 5px;\n}\n.ui-component-panel .el-collapse-item > div:first-of-type {\n border-bottom: 1px solid #d9dbdd;\n margin-bottom: 10px;\n}\n.ui-component-panel .el-collapse-item__header {\n background: #ffffff;\n color: #070303;\n height: 25px;\n line-height: 25px;\n padding-left: 10px;\n font-size: 12px;\n}\n.ui-component-panel .el-collapse-item__header i {\n margin-right: 5px;\n font-size: 14px;\n}\n.ui-component-panel .el-collapse-item__wrap {\n background: #ffffff;\n border-bottom: 0;\n}\n.ui-component-panel .el-collapse-item__wrap .el-collapse-item__content {\n padding: 10px;\n display: flex;\n flex-wrap: wrap;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item {\n display: flex;\n overflow: hidden;\n text-overflow: ellipsis;\n margin: 5px 10px;\n box-sizing: border-box;\n color: #070303;\n flex-direction: column;\n width: 42px;\n cursor: pointer;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item i {\n font-size: 20px;\n background: #fff;\n height: 40px;\n width: 40px;\n line-height: 40px;\n border-radius: 5px;\n color: #909090;\n border: 1px solid #d9dbdd;\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n margin-bottom: 5px;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item i:hover {\n background: #2882e0;\n color: #fff;\n border-color: #4e8be1;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item span {\n font-size: 12px;\n text-align: center;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item .el-tooltip {\n width: 50px;\n height: 30px;\n line-height: 15px;\n display: block;\n white-space: normal;\n margin: 0;\n}\n.m-editor-resizer {\n border-left: 1px solid transparent;\n border-right: 1px solid transparent;\n width: 8px;\n margin: 0 -5px;\n height: 100%;\n opacity: 0.9;\n background: padding-box #d8dee8;\n box-sizing: border-box;\n cursor: col-resize;\n z-index: 1;\n}\n.m-editor-resizer:hover {\n border-color: #d8dee8;\n}\n.m-editor-resizer .icon-container {\n visibility: hidden;\n opacity: 0;\n transition: opacity 0.4s;\n width: 20px;\n height: 120px;\n line-height: 120px;\n text-align: center;\n background: #d8dee8;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n cursor: pointer;\n}\n.m-editor-resizer .icon-container.position-left {\n transform: translate(calc(-100% - 4px), -50%);\n}\n.m-editor-resizer .icon-container.position-right {\n transform: translate(calc(100% + 4px), -50%);\n}\n.m-editor-resizer .icon {\n color: #fff;\n font-size: 18px;\n}\n.magic-editor-resizer:hover .icon-container {\n visibility: visible;\n opacity: 1;\n}\n.m-editor-workspace {\n height: 100%;\n width: 100%;\n user-select: none;\n}\n.m-editor-workspace:focus-visible {\n outline: 0;\n}\n.m-editor-page-bar {\n position: fixed;\n bottom: 0;\n left: 0;\n display: flex;\n width: 100%;\n height: 32px;\n line-height: 32px;\n color: #070303;\n background-color: #f3f3f3;\n border-top: 1px solid #d9dbdd;\n z-index: 2;\n overflow: hidden;\n}\n.m-editor-page-bar-items {\n display: flex;\n transition: transform 0.3s;\n}\n.m-editor-page-bar-item {\n padding: 0 10px;\n cursor: pointer;\n border-right: 1px solid #d9dbdd;\n display: flex;\n justify-items: center;\n align-items: center;\n background-color: #f3f3f3;\n white-space: nowrap;\n}\n.m-editor-page-bar-item.active {\n background-color: #fff;\n cursor: text;\n}\n.m-editor-page-bar-item.active .m-editor-page-bar-menu-icon {\n cursor: pointer;\n}\n.m-editor-page-bar-item-icon {\n position: relative;\n z-index: 1;\n}\n.m-editor-page-bar-item-title {\n max-width: 150px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n.page-bar-popover.el-popper.el-popover {\n padding: 10px 0;\n}\n.page-bar-popover .menu-item {\n cursor: pointer;\n transition: all 0.2s ease 0s;\n padding: 5px 14px;\n}\n.page-bar-popover .menu-item .el-button--text,\n.page-bar-popover .menu-item i {\n color: #070303;\n}\n.page-bar-popover .menu-item:hover {\n background-color: #f3f5f9;\n}\n.m-editor-props-panel {\n padding: 0 10px;\n}\n.m-editor-props-panel.small .el-form-item__label {\n font-size: 12px;\n}\n.m-editor-props-panel.small .m-fieldset legend {\n font-size: 12px;\n}\n.m-editor-props-panel.small .el-tabs__item {\n font-size: 12px;\n}\n.m-editor-props-panel .el-input__wrapper {\n border-radius: 0;\n}\n.m-editor-props-panel-popper.small span,\n.m-editor-props-panel-popper.small a,\n.m-editor-props-panel-popper.small p {\n font-size: 12px;\n}\n.magic-editor-content-menu {\n position: fixed;\n font-size: 12px;\n background: #fff;\n box-shadow: 0 2px 8px 2px rgba(68, 73, 77, 0.16);\n z-index: 9999;\n transform-origin: 0% 0%;\n font-weight: 600;\n padding: 4px 0px;\n overflow: auto;\n max-height: 100%;\n}\n.magic-editor-content-menu .menu-item {\n color: #333;\n display: flex;\n -webkit-box-align: center;\n align-items: center;\n cursor: pointer;\n min-width: 140px;\n transition: all 0.2s ease 0s;\n padding: 5px 14px;\n border-left: 2px solid transparent;\n}\n.magic-editor-content-menu .menu-item .el-button {\n width: 100%;\n justify-content: flex-start;\n}\n.magic-editor-content-menu .menu-item .el-button--text,\n.magic-editor-content-menu .menu-item i {\n color: #070303;\n}\n.magic-editor-content-menu .menu-item.divider {\n padding: 0 14px;\n}\n.magic-editor-content-menu .menu-item.divider .el-divider {\n margin: 0;\n}\n.magic-editor-content-menu .menu-item:hover {\n background-color: #f3f5f9;\n}\n.m-editor-stage {\n position: relative;\n width: 100%;\n height: calc(100% - 32px);\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.m-editor-stage-container {\n width: 100%;\n height: 100%;\n z-index: 0;\n position: relative;\n transition: transform 0.3s;\n box-sizing: content-box;\n box-shadow: rgba(0, 0, 0, 0.04) 0px 3px 5px;\n}\n.m-editor-stage-container::-webkit-scrollbar {\n width: 0 !important;\n}\n.magic-code-editor {\n width: 100%;\n}\n.magic-code-editor .margin {\n margin: 0;\n}")();
4429
+ const index$1 = '';
4213
4430
 
4214
4431
  const defaultInstallOpt = {};
4215
- var index = {
4432
+ const index = {
4216
4433
  install: (app, opt) => {
4217
4434
  const option = Object.assign(defaultInstallOpt, opt || {});
4218
4435
  app.config.globalProperties.$TMAGIC_EDITOR = option;
4219
4436
  setConfig(option);
4220
4437
  app.component(Editor.name, Editor);
4221
- app.component(uiSelect.name, uiSelect);
4438
+ app.component("m-fields-ui-select", _sfc_main$l);
4222
4439
  app.component(CodeLink.name, CodeLink);
4223
4440
  app.component(Code.name, Code);
4224
4441
  app.component(CodeEditor.name, CodeEditor);
@@ -4237,11 +4454,11 @@
4237
4454
  exports.PropsPanel = PropsPanel;
4238
4455
  exports.TMagicCodeEditor = CodeEditor;
4239
4456
  exports.TMagicEditor = Editor;
4240
- exports.ToolButton = ToolButton;
4457
+ exports.ToolButton = _sfc_main$f;
4241
4458
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
4242
4459
  exports.change2Fixed = change2Fixed;
4243
4460
  exports.debug = debug;
4244
- exports["default"] = index;
4461
+ exports.default = index;
4245
4462
  exports.editorService = editorService;
4246
4463
  exports.error = error;
4247
4464
  exports.eventsService = eventsService;
@@ -4250,7 +4467,6 @@
4250
4467
  exports.generatePageName = generatePageName;
4251
4468
  exports.generatePageNameByApp = generatePageNameByApp;
4252
4469
  exports.getConfig = getConfig;
4253
- exports.getDefaultPropsValue = getDefaultPropsValue;
4254
4470
  exports.getGuideLineFromCache = getGuideLineFromCache;
4255
4471
  exports.getInitPositionStyle = getInitPositionStyle;
4256
4472
  exports.getNodeIndex = getNodeIndex;
@@ -4264,6 +4480,7 @@
4264
4480
  exports.propsService = propsService;
4265
4481
  exports.setConfig = setConfig;
4266
4482
  exports.setLayout = setLayout;
4483
+ exports.storageService = storageService;
4267
4484
  exports.uiService = uiService;
4268
4485
  exports.warn = warn;
4269
4486