@tmagic/editor 1.1.0-beta.5 → 1.1.0-beta.8

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 (103) hide show
  1. package/dist/style.css +4 -0
  2. package/dist/{tmagic-editor.es.js → tmagic-editor.mjs} +1417 -1228
  3. package/dist/tmagic-editor.mjs.map +1 -0
  4. package/dist/tmagic-editor.umd.js +1433 -1242
  5. package/dist/tmagic-editor.umd.js.map +1 -1
  6. package/package.json +21 -19
  7. package/src/Editor.vue +14 -12
  8. package/src/components/ContentMenu.vue +87 -99
  9. package/src/components/Icon.vue +1 -1
  10. package/src/components/ScrollViewer.vue +1 -1
  11. package/src/components/ToolButton.vue +150 -167
  12. package/src/fields/UISelect.vue +49 -70
  13. package/src/index.ts +2 -1
  14. package/src/layouts/AddPageBox.vue +2 -2
  15. package/src/layouts/Framework.vue +1 -1
  16. package/src/layouts/NavMenu.vue +2 -2
  17. package/src/layouts/PropsPanel.vue +1 -1
  18. package/src/layouts/Resizer.vue +1 -1
  19. package/src/layouts/sidebar/ComponentListPanel.vue +2 -2
  20. package/src/layouts/sidebar/LayerMenu.vue +2 -2
  21. package/src/layouts/sidebar/LayerPanel.vue +3 -3
  22. package/src/layouts/sidebar/Sidebar.vue +1 -1
  23. package/src/layouts/sidebar/TabPane.vue +2 -2
  24. package/src/layouts/workspace/PageBar.vue +63 -192
  25. package/src/layouts/workspace/PageBarScrollContainer.vue +111 -0
  26. package/src/layouts/workspace/Stage.vue +195 -222
  27. package/src/layouts/workspace/ViewerMenu.vue +140 -147
  28. package/src/layouts/workspace/Workspace.vue +11 -11
  29. package/src/services/BaseService.ts +1 -1
  30. package/src/services/componentList.ts +3 -3
  31. package/src/services/editor.ts +137 -139
  32. package/src/services/events.ts +1 -1
  33. package/src/services/history.ts +1 -1
  34. package/src/services/props.ts +18 -5
  35. package/src/services/storage.ts +133 -0
  36. package/src/services/ui.ts +2 -2
  37. package/src/theme/component-list-panel.scss +5 -0
  38. package/src/type.ts +22 -6
  39. package/src/utils/config.ts +1 -1
  40. package/src/utils/editor.ts +18 -11
  41. package/src/utils/operator.ts +163 -0
  42. package/src/utils/props.ts +2 -2
  43. package/src/utils/scroll-viewer.ts +1 -1
  44. package/tsconfig.build.json +13 -0
  45. package/{dist/types/src → types}/Editor.vue.d.ts +7 -8
  46. package/types/components/ContentMenu.vue.d.ts +116 -0
  47. package/types/components/Icon.vue.d.ts +13 -0
  48. package/types/components/ScrollViewer.vue.d.ts +22 -0
  49. package/types/components/ToolButton.vue.d.ts +109 -0
  50. package/types/fields/Code.vue.d.ts +23 -0
  51. package/{dist/types/src → types}/fields/CodeLink.vue.d.ts +4 -6
  52. package/types/fields/UISelect.vue.d.ts +83 -0
  53. package/{dist/types/src → types}/index.d.ts +4 -1
  54. package/types/layouts/AddPageBox.vue.d.ts +4 -0
  55. package/{dist/types/src → types}/layouts/CodeEditor.vue.d.ts +11 -13
  56. package/types/layouts/Framework.vue.d.ts +22 -0
  57. package/types/layouts/NavMenu.vue.d.ts +25 -0
  58. package/types/layouts/PropsPanel.vue.d.ts +245 -0
  59. package/types/layouts/Resizer.vue.d.ts +12 -0
  60. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +14 -0
  61. package/types/layouts/sidebar/LayerMenu.vue.d.ts +100 -0
  62. package/types/layouts/sidebar/LayerPanel.vue.d.ts +1099 -0
  63. package/{dist/types/src → types}/layouts/sidebar/Sidebar.vue.d.ts +3 -5
  64. package/types/layouts/sidebar/TabPane.vue.d.ts +14 -0
  65. package/types/layouts/workspace/PageBar.vue.d.ts +54 -0
  66. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +48 -0
  67. package/types/layouts/workspace/Stage.vue.d.ts +46 -0
  68. package/types/layouts/workspace/ViewerMenu.vue.d.ts +88 -0
  69. package/types/layouts/workspace/Workspace.vue.d.ts +6 -0
  70. package/{dist/types/src → types}/services/BaseService.d.ts +0 -0
  71. package/types/services/componentList.d.ts +14 -0
  72. package/{dist/types/src → types}/services/editor.d.ts +22 -12
  73. package/{dist/types/src → types}/services/events.d.ts +0 -0
  74. package/{dist/types/src → types}/services/history.d.ts +0 -0
  75. package/{dist/types/src → types}/services/props.d.ts +6 -0
  76. package/types/services/storage.d.ts +56 -0
  77. package/{dist/types/src → types}/services/ui.d.ts +1 -1
  78. package/{dist/types/src → types}/type.d.ts +15 -0
  79. package/{dist/types/src → types}/utils/compose.d.ts +1 -1
  80. package/{dist/types/src → types}/utils/config.d.ts +0 -0
  81. package/{dist/types/src → types}/utils/editor.d.ts +6 -3
  82. package/{dist/types/src → types}/utils/index.d.ts +0 -0
  83. package/{dist/types/src → types}/utils/logger.d.ts +0 -0
  84. package/types/utils/operator.d.ts +27 -0
  85. package/{dist/types/src → types}/utils/polyfills.d.ts +0 -0
  86. package/{dist/types/src → types}/utils/props.d.ts +2 -2
  87. package/{dist/types/src → types}/utils/scroll-viewer.d.ts +0 -0
  88. package/{dist/types/src → types}/utils/undo-redo.d.ts +0 -0
  89. package/dist/tmagic-editor.es.js.map +0 -1
  90. package/dist/types/src/components/Icon.vue.d.ts +0 -14
  91. package/dist/types/src/components/ScrollViewer.vue.d.ts +0 -24
  92. package/dist/types/src/fields/Code.vue.d.ts +0 -25
  93. package/dist/types/src/layouts/AddPageBox.vue.d.ts +0 -5
  94. package/dist/types/src/layouts/Framework.vue.d.ts +0 -24
  95. package/dist/types/src/layouts/NavMenu.vue.d.ts +0 -27
  96. package/dist/types/src/layouts/PropsPanel.vue.d.ts +0 -13
  97. package/dist/types/src/layouts/Resizer.vue.d.ts +0 -14
  98. package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -16
  99. package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +0 -16
  100. package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +0 -8
  101. package/dist/types/src/shims-vue.d.ts +0 -6
  102. package/dist/types/src/vite-env.d.ts +0 -1
  103. package/src/vite-env.d.ts +0 -1
@@ -1,11 +1,11 @@
1
- import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, markRaw, createElementBlock, createVNode, withCtx, withModifiers, createCommentVNode, createTextVNode, toDisplayString, watch, onMounted, onUnmounted, reactive, toRaw, createElementVNode, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, renderList, normalizeProps, mergeProps, getCurrentInstance, nextTick, Teleport, toHandlers, createSlots, provide } from 'vue';
1
+ import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, createElementBlock, createVNode, unref, withCtx, withModifiers, createCommentVNode, createTextVNode, toDisplayString, watch, onMounted, onUnmounted, reactive, toRaw, createElementVNode, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, markRaw, renderList, normalizeProps, mergeProps, getCurrentInstance, Teleport, nextTick, toHandlers, createSlots, provide } from 'vue';
2
2
  import serialize from 'serialize-javascript';
3
- import { Delete, Pointer, Close, Plus, Edit, ArrowDown, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Files, DocumentCopy, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons-vue';
4
- import { throttle, cloneDeep, mergeWith, random } from 'lodash-es';
3
+ import { Delete, Close, Plus, Edit, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, ArrowDown, Files, DocumentCopy, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons-vue';
4
+ import { throttle, cloneDeep, mergeWith, isEmpty, uniq } from 'lodash-es';
5
5
  import * as monaco from 'monaco-editor';
6
6
  import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS } from '@tmagic/stage';
7
7
  import { NodeType } from '@tmagic/schema';
8
- import { toLine, isPop, getNodePath, isNumber, isPage, removeClassNameByClassName } from '@tmagic/utils';
8
+ import { isPop, getNodePath, isNumber, isPage, toLine, removeClassNameByClassName } from '@tmagic/utils';
9
9
  import { EventEmitter } from 'events';
10
10
  import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
11
11
  import Gesto from 'gesto';
@@ -19,15 +19,7 @@ if (typeof globalThis === "undefined") {
19
19
  window.globalThis = window;
20
20
  }
21
21
 
22
- var _export_sfc = (sfc, props) => {
23
- const target = sfc.__vccOpts || sfc;
24
- for (const [key, val] of props) {
25
- target[key] = val;
26
- }
27
- return target;
28
- };
29
-
30
- const _sfc_main$m = defineComponent({
22
+ const _sfc_main$n = defineComponent({
31
23
  name: "m-fields-vs-code",
32
24
  props: ["model", "name", "config", "prop"],
33
25
  emits: ["change"],
@@ -44,7 +36,16 @@ const _sfc_main$m = defineComponent({
44
36
  };
45
37
  }
46
38
  });
47
- function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
39
+
40
+ const _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
+ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
48
49
  const _component_magic_code_editor = resolveComponent("magic-code-editor");
49
50
  return openBlock(), createBlock(_component_magic_code_editor, {
50
51
  style: normalizeStyle(`height: ${_ctx.height}`),
@@ -53,9 +54,9 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
53
54
  onSave: _ctx.save
54
55
  }, null, 8, ["style", "init-values", "language", "onSave"]);
55
56
  }
56
- var Code = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$m]]);
57
+ const Code = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$g]]);
57
58
 
58
- const _sfc_main$l = defineComponent({
59
+ const _sfc_main$m = defineComponent({
59
60
  name: "m-fields-code-link",
60
61
  props: {
61
62
  config: {
@@ -110,7 +111,8 @@ const _sfc_main$l = defineComponent({
110
111
  };
111
112
  }
112
113
  });
113
- function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
114
+
115
+ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
114
116
  const _component_m_fields_link = resolveComponent("m-fields-link");
115
117
  return openBlock(), createBlock(_component_m_fields_link, {
116
118
  config: _ctx.formConfig,
@@ -119,26 +121,20 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
119
121
  onChange: _ctx.changeHandler
120
122
  }, null, 8, ["config", "model", "onChange"]);
121
123
  }
122
- var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
124
+ const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$f]]);
123
125
 
124
- 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}")();
125
-
126
- const _sfc_main$k = defineComponent({
127
- name: "m-fields-ui-select",
126
+ const _hoisted_1$d = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
127
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
128
+ __name: "UISelect",
128
129
  props: {
129
- labelWidth: String,
130
- config: Object,
131
- model: Object,
132
- prop: {
133
- type: String,
134
- default() {
135
- return "";
136
- }
137
- },
138
- name: String
130
+ config: null,
131
+ model: null,
132
+ prop: null,
133
+ name: null
139
134
  },
140
135
  emits: ["change"],
141
- setup(props, { emit }) {
136
+ setup(__props, { emit }) {
137
+ const props = __props;
142
138
  const services = inject("services");
143
139
  const mForm = inject("mForm");
144
140
  const val = computed(() => props.model[props.name]);
@@ -160,92 +156,84 @@ const _sfc_main$k = defineComponent({
160
156
  cancelHandler();
161
157
  }
162
158
  };
163
- return {
164
- Delete: markRaw(Delete),
165
- Pointer: markRaw(Pointer),
166
- Close: markRaw(Close),
167
- val,
168
- uiSelectMode,
169
- toName: computed(() => {
170
- const config = services?.editorService.getNodeById(val.value);
171
- return config?.name || "";
172
- }),
173
- startSelect() {
174
- if (!services?.uiService)
175
- return;
176
- services.uiService.set("uiSelectMode", true);
177
- uiSelectMode.value = true;
178
- globalThis.document.addEventListener("ui-select", clickHandler);
179
- },
180
- cancelHandler,
181
- deleteHandler() {
182
- if (props.model) {
183
- props.model[props.name] = "";
184
- emit("change", "");
185
- mForm?.$emit("field-change", props.prop, "");
186
- }
159
+ const toName = computed(() => {
160
+ const config = services?.editorService.getNodeById(val.value);
161
+ return config?.name || "";
162
+ });
163
+ const startSelect = () => {
164
+ if (!services?.uiService)
165
+ return;
166
+ services.uiService.set("uiSelectMode", true);
167
+ uiSelectMode.value = true;
168
+ globalThis.document.addEventListener("ui-select", clickHandler);
169
+ };
170
+ const deleteHandler = () => {
171
+ if (props.model) {
172
+ props.model[props.name] = "";
173
+ emit("change", "");
174
+ mForm?.$emit("field-change", props.prop, "");
187
175
  }
188
176
  };
189
- }
190
- });
191
- const _hoisted_1$d = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
192
- function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
193
- const _component_el_button = resolveComponent("el-button");
194
- const _component_el_tooltip = resolveComponent("el-tooltip");
195
- return _ctx.uiSelectMode ? (openBlock(), createElementBlock("div", {
196
- key: 0,
197
- class: "m-fields-ui-select",
198
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelHandler && _ctx.cancelHandler(...args))
199
- }, [
200
- createVNode(_component_el_button, {
201
- type: "danger",
202
- icon: _ctx.Delete,
203
- text: "",
204
- style: { "padding": "0" }
205
- }, {
206
- default: withCtx(() => [
207
- _hoisted_1$d
208
- ]),
209
- _: 1
210
- }, 8, ["icon"])
211
- ])) : (openBlock(), createElementBlock("div", {
212
- key: 1,
213
- class: "m-fields-ui-select",
214
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.startSelect && _ctx.startSelect(...args)),
215
- style: { "display": "flex" }
216
- }, [
217
- createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
218
- default: withCtx(() => [
219
- _ctx.val ? (openBlock(), createBlock(_component_el_button, {
220
- key: 0,
221
- style: { "padding": "0" },
222
- type: "danger",
223
- icon: _ctx.Close,
224
- text: "",
225
- onClick: withModifiers(_ctx.deleteHandler, ["stop"])
226
- }, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
227
- ]),
228
- _: 1
229
- }),
230
- createVNode(_component_el_tooltip, {
231
- content: _ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
232
- }, {
233
- default: withCtx(() => [
177
+ return (_ctx, _cache) => {
178
+ const _component_el_button = resolveComponent("el-button");
179
+ const _component_el_tooltip = resolveComponent("el-tooltip");
180
+ return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
181
+ key: 0,
182
+ class: "m-fields-ui-select",
183
+ onClick: cancelHandler
184
+ }, [
234
185
  createVNode(_component_el_button, {
186
+ type: "danger",
187
+ icon: unref(Delete),
235
188
  text: "",
236
- style: { "padding": "0", "margin": "0" }
189
+ style: { "padding": "0" }
237
190
  }, {
238
191
  default: withCtx(() => [
239
- createTextVNode(toDisplayString(_ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
192
+ _hoisted_1$d
240
193
  ]),
241
194
  _: 1
242
- })
243
- ]),
244
- _: 1
245
- }, 8, ["content"])
246
- ]));
247
- }
248
- var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$k]]);
195
+ }, 8, ["icon"])
196
+ ])) : (openBlock(), createElementBlock("div", {
197
+ key: 1,
198
+ class: "m-fields-ui-select",
199
+ onClick: startSelect,
200
+ style: { "display": "flex" }
201
+ }, [
202
+ createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
203
+ default: withCtx(() => [
204
+ unref(val) ? (openBlock(), createBlock(_component_el_button, {
205
+ key: 0,
206
+ style: { "padding": "0" },
207
+ type: "danger",
208
+ icon: unref(Close),
209
+ text: "",
210
+ onClick: withModifiers(deleteHandler, ["stop"])
211
+ }, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
212
+ ]),
213
+ _: 1
214
+ }),
215
+ createVNode(_component_el_tooltip, {
216
+ content: unref(val) ? unref(toName) + "_" + unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
217
+ }, {
218
+ default: withCtx(() => [
219
+ createVNode(_component_el_button, {
220
+ text: "",
221
+ style: { "padding": "0", "margin": "0" }
222
+ }, {
223
+ default: withCtx(() => [
224
+ createTextVNode(toDisplayString(unref(val) ? unref(toName) + "_" + unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
225
+ ]),
226
+ _: 1
227
+ })
228
+ ]),
229
+ _: 1
230
+ }, 8, ["content"])
231
+ ]));
232
+ };
233
+ }
234
+ });
235
+
236
+ const UISelect_vue_vue_type_style_index_0_lang = '';
249
237
 
250
238
  const toString = (v, language) => {
251
239
  let value = "";
@@ -262,7 +250,7 @@ const toString = (v, language) => {
262
250
  }
263
251
  return value;
264
252
  };
265
- const _sfc_main$j = defineComponent({
253
+ const _sfc_main$k = defineComponent({
266
254
  name: "magic-code-editor",
267
255
  props: {
268
256
  initValues: {
@@ -369,14 +357,15 @@ const _sfc_main$j = defineComponent({
369
357
  };
370
358
  }
371
359
  });
360
+
372
361
  const _hoisted_1$c = {
373
362
  ref: "codeEditor",
374
363
  class: "magic-code-editor"
375
364
  };
376
- function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
365
+ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
377
366
  return openBlock(), createElementBlock("div", _hoisted_1$c, null, 512);
378
367
  }
379
- var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
368
+ const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$e]]);
380
369
 
381
370
  let $TMAGIC_EDITOR = {};
382
371
  const setConfig = (option) => {
@@ -385,6 +374,9 @@ const setConfig = (option) => {
385
374
  const getConfig = (key) => $TMAGIC_EDITOR[key];
386
375
 
387
376
  class UndoRedo {
377
+ elementList;
378
+ listCursor;
379
+ listMaxSize;
388
380
  constructor(listMaxSize = 200) {
389
381
  const minListMaxSize = 2;
390
382
  this.elementList = [];
@@ -480,12 +472,12 @@ const doAction = async (args, scope, sourceMethod, beforeMethodName, afterMethod
480
472
  }
481
473
  };
482
474
  class BaseService extends EventEmitter {
475
+ pluginOptionsList = {};
476
+ middleware = {};
477
+ taskList = [];
478
+ doingTask = false;
483
479
  constructor(methods = [], serialMethods = []) {
484
480
  super();
485
- this.pluginOptionsList = {};
486
- this.middleware = {};
487
- this.taskList = [];
488
- this.doingTask = false;
489
481
  methods.forEach((propertyName) => {
490
482
  const scope = this;
491
483
  const sourceMethod = scope[propertyName];
@@ -542,14 +534,14 @@ class BaseService extends EventEmitter {
542
534
  }
543
535
 
544
536
  class History extends BaseService {
537
+ state = reactive({
538
+ pageSteps: {},
539
+ pageId: void 0,
540
+ canRedo: false,
541
+ canUndo: false
542
+ });
545
543
  constructor() {
546
544
  super([]);
547
- this.state = reactive({
548
- pageSteps: {},
549
- pageId: void 0,
550
- canRedo: false,
551
- canUndo: false
552
- });
553
545
  this.on("change", this.setCanUndoRedo);
554
546
  }
555
547
  reset() {
@@ -618,117 +610,88 @@ class History extends BaseService {
618
610
  this.state.canUndo = undoRedo?.canUndo() || false;
619
611
  }
620
612
  }
621
- var historyService = new History();
613
+ const historyService = new History();
622
614
 
623
- class Props extends BaseService {
615
+ var Protocol = /* @__PURE__ */ ((Protocol2) => {
616
+ Protocol2["OBJECT"] = "object";
617
+ Protocol2["JSON"] = "json";
618
+ Protocol2["STRING"] = "string";
619
+ Protocol2["NUMBER"] = "number";
620
+ Protocol2["BOOLEAN"] = "boolean";
621
+ return Protocol2;
622
+ })(Protocol || {});
623
+ class WebStorage extends BaseService {
624
+ storage = globalThis.localStorage;
625
+ namespace = "tmagic";
624
626
  constructor() {
625
- super([
626
- "setPropsConfig",
627
- "getPropsConfig",
628
- "setPropsValue",
629
- "getPropsValue",
630
- "createId",
631
- "setNewItemId",
632
- "getDefaultPropsValue"
633
- ]);
634
- this.state = reactive({
635
- propsConfigMap: {},
636
- propsValueMap: {}
637
- });
638
- }
639
- setPropsConfigs(configs) {
640
- Object.keys(configs).forEach((type) => {
641
- this.setPropsConfig(toLine(type), configs[type]);
642
- });
643
- this.emit("props-configs-change");
644
- }
645
- setPropsConfig(type, config) {
646
- this.state.propsConfigMap[type] = fillConfig(Array.isArray(config) ? config : [config]);
627
+ super(["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]);
647
628
  }
648
- async getPropsConfig(type) {
649
- if (type === "area") {
650
- return await this.getPropsConfig("button");
651
- }
652
- return cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
629
+ async getStorage() {
630
+ return this.storage;
653
631
  }
654
- setPropsValues(values) {
655
- Object.keys(values).forEach((type) => {
656
- this.setPropsValue(toLine(type), values[type]);
657
- });
632
+ async getNamespace() {
633
+ return this.namespace;
658
634
  }
659
- setPropsValue(type, value) {
660
- this.state.propsValueMap[type] = value;
635
+ async clear() {
636
+ const storage2 = await this.getStorage();
637
+ storage2.clear();
661
638
  }
662
- async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
663
- if (type === "area") {
664
- const value = await this.getPropsValue("button");
665
- value.className = "action-area";
666
- value.text = "";
667
- if (value.style) {
668
- value.style.backgroundColor = "rgba(255, 255, 255, 0)";
669
- }
670
- return value;
639
+ async getItem(key, options = {}) {
640
+ const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
641
+ const { protocol = options.protocol, item } = this.getValueAndProtocol(storage.getItem(`${options.namespace || namespace}:${key}`));
642
+ if (item === null)
643
+ return null;
644
+ switch (protocol) {
645
+ case "object" /* OBJECT */:
646
+ return eval(`(${item})`);
647
+ case "json" /* JSON */:
648
+ return JSON.parse(item);
649
+ case "number" /* NUMBER */:
650
+ return Number(item);
651
+ case "boolean" /* BOOLEAN */:
652
+ return Boolean(item);
653
+ default:
654
+ return item;
671
655
  }
672
- const [id, defaultPropsValue, data] = await Promise.all([
673
- this.createId(type),
674
- this.getDefaultPropsValue(type),
675
- this.setNewItemId(cloneDeep({
676
- type,
677
- ...defaultValue
678
- }))
679
- ]);
680
- return {
681
- id,
682
- ...defaultPropsValue,
683
- ...mergeWith(cloneDeep(this.state.propsValueMap[type] || {}), data)
684
- };
685
656
  }
686
- async createId(type) {
687
- return `${type}_${random(1e4, false)}`;
657
+ async key(index) {
658
+ const storage2 = await this.getStorage();
659
+ return storage2.key(index);
688
660
  }
689
- async setNewItemId(config, parent) {
690
- const oldId = config.id;
691
- config.id = await this.createId(config.type || "component");
692
- if (isPop(config) && parent?.type === NodeType.PAGE) {
693
- updatePopId(oldId, config.id, parent);
661
+ async removeItem(key2, options2 = {}) {
662
+ const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
663
+ storage2.removeItem(`${options2.namespace || namespace2}:${key2}`);
664
+ }
665
+ async setItem(key2, value, options2 = {}) {
666
+ const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
667
+ let item2 = value;
668
+ const protocol2 = options2.protocol ? `${options2.protocol}:` : "";
669
+ if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
670
+ item2 = `${protocol2}${value}`;
671
+ } else {
672
+ item2 = `${protocol2}${serialize(value)}`;
694
673
  }
695
- if (config.items && Array.isArray(config.items)) {
696
- for (const item of config.items) {
697
- await this.setNewItemId(item, config);
698
- }
674
+ storage2.setItem(`${options2.namespace || namespace2}:${key2}`, item2);
675
+ }
676
+ getValueAndProtocol(value) {
677
+ let protocol2 = "";
678
+ if (value === null) {
679
+ return {
680
+ item: value,
681
+ protocol: protocol2
682
+ };
699
683
  }
700
- return config;
701
- }
702
- async getDefaultPropsValue(type) {
703
- return ["page", "container"].includes(type) ? {
704
- type,
705
- layout: "absolute",
706
- style: {},
707
- name: type,
708
- items: []
709
- } : {
710
- type,
711
- style: {},
712
- name: type
684
+ const item2 = value.replace(new RegExp(`^(${Object.values(Protocol).join("|")})(:)(.+)`), (_$0, $1, _$2, $3) => {
685
+ protocol2 = $1;
686
+ return $3;
687
+ });
688
+ return {
689
+ protocol: protocol2,
690
+ item: item2
713
691
  };
714
692
  }
715
693
  }
716
- const updatePopId = (oldId, popId, pageConfig) => {
717
- pageConfig.items?.forEach((config) => {
718
- if (config.pop === oldId) {
719
- config.pop = popId;
720
- return;
721
- }
722
- if (config.popId === oldId) {
723
- config.popId = popId;
724
- return;
725
- }
726
- if (Array.isArray(config.items)) {
727
- updatePopId(oldId, popId, config);
728
- }
729
- });
730
- };
731
- var propsService = new Props();
694
+ const storageService = new WebStorage();
732
695
 
733
696
  var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
734
697
  LayerOffset2["TOP"] = "top";
@@ -780,10 +743,10 @@ const getRelativeStyle = (style = {}) => ({
780
743
  top: 0,
781
744
  left: 0
782
745
  });
783
- const getMiddleTop = (style = {}, parentNode, stage) => {
784
- let height = style.height || 0;
785
- if (!stage || typeof style.top !== "undefined" || !parentNode.style)
786
- return style.top;
746
+ const getMiddleTop = (node, parentNode, stage) => {
747
+ let height = node.style?.height || 0;
748
+ if (!stage || typeof node.style?.top !== "undefined" || !parentNode.style)
749
+ return node.style?.top;
787
750
  if (!isNumber(height)) {
788
751
  height = 0;
789
752
  }
@@ -794,12 +757,11 @@ const getMiddleTop = (style = {}, parentNode, stage) => {
794
757
  }
795
758
  return (parentHeight - height) / 2;
796
759
  };
797
- const getInitPositionStyle = (style = {}, layout, parentNode, stage) => {
760
+ const getInitPositionStyle = (style = {}, layout) => {
798
761
  if (layout === Layout.ABSOLUTE) {
799
762
  return {
800
763
  ...style,
801
- position: "absolute",
802
- top: getMiddleTop(style, parentNode, stage)
764
+ position: "absolute"
803
765
  };
804
766
  }
805
767
  if (layout === Layout.RELATIVE) {
@@ -891,76 +853,308 @@ const fixNodeLeft = (config, parent, doc) => {
891
853
  }
892
854
  return config.style.left;
893
855
  };
856
+ const fixNodePosition = (config, parent, stage) => {
857
+ if (config.style?.position !== "absolute") {
858
+ return config.style;
859
+ }
860
+ return {
861
+ ...config.style || {},
862
+ top: getMiddleTop(config, parent, stage),
863
+ left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
864
+ };
865
+ };
894
866
 
895
- class Editor$1 extends BaseService {
867
+ class Props extends BaseService {
868
+ state = reactive({
869
+ propsConfigMap: {},
870
+ propsValueMap: {}
871
+ });
896
872
  constructor() {
897
873
  super([
898
- "getLayout",
899
- "select",
900
- "add",
901
- "remove",
902
- "update",
903
- "sort",
904
- "copy",
905
- "paste",
906
- "alignCenter",
907
- "moveLayer",
908
- "moveToContainer",
909
- "move",
910
- "undo",
911
- "redo",
912
- "highlight"
913
- ], ["select", "update", "moveLayer"]);
914
- this.isHistoryStateChange = false;
915
- this.state = reactive({
916
- root: null,
917
- page: null,
918
- parent: null,
919
- node: null,
920
- stage: null,
921
- highlightNode: null,
922
- modifiedNodeIds: /* @__PURE__ */ new Map(),
923
- pageLength: 0
924
- });
874
+ "setPropsConfig",
875
+ "getPropsConfig",
876
+ "setPropsValue",
877
+ "getPropsValue",
878
+ "createId",
879
+ "setNewItemId",
880
+ "getDefaultPropsValue"
881
+ ]);
925
882
  }
926
- set(name, value) {
927
- this.state[name] = value;
928
- if (name === "root") {
929
- this.state.pageLength = value?.items?.length || 0;
930
- this.emit("root-change", value);
931
- }
883
+ setPropsConfigs(configs) {
884
+ Object.keys(configs).forEach((type) => {
885
+ this.setPropsConfig(toLine(type), configs[type]);
886
+ });
887
+ this.emit("props-configs-change");
932
888
  }
933
- get(name) {
934
- return this.state[name];
889
+ setPropsConfig(type, config) {
890
+ this.state.propsConfigMap[type] = fillConfig(Array.isArray(config) ? config : [config]);
935
891
  }
936
- getNodeInfo(id, raw = true) {
937
- let root = this.get("root");
938
- if (raw) {
939
- root = toRaw(root);
940
- }
941
- if (!root)
942
- return {};
943
- if (id === root.id) {
944
- return { node: root };
892
+ async getPropsConfig(type) {
893
+ if (type === "area") {
894
+ return await this.getPropsConfig("button");
945
895
  }
946
- const path = getNodePath(id, root.items);
947
- if (!path.length)
948
- return {};
949
- path.unshift(root);
950
- const info = {};
951
- info.node = path[path.length - 1];
952
- info.parent = path[path.length - 2];
953
- path.forEach((item) => {
954
- if (item.type === NodeType.PAGE) {
955
- info.page = item;
956
- return;
957
- }
896
+ return cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
897
+ }
898
+ setPropsValues(values) {
899
+ Object.keys(values).forEach((type) => {
900
+ this.setPropsValue(toLine(type), values[type]);
958
901
  });
959
- return info;
960
902
  }
961
- getNodeById(id, raw = true) {
962
- const { node } = this.getNodeInfo(id, raw);
963
- return node;
903
+ setPropsValue(type, value) {
904
+ this.state.propsValueMap[type] = value;
905
+ }
906
+ async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
907
+ if (type === "area") {
908
+ const value = await this.getPropsValue("button");
909
+ value.className = "action-area";
910
+ value.text = "";
911
+ if (value.style) {
912
+ value.style.backgroundColor = "rgba(255, 255, 255, 0)";
913
+ }
914
+ return value;
915
+ }
916
+ const [id, defaultPropsValue, data] = await Promise.all([
917
+ this.createId(type),
918
+ this.getDefaultPropsValue(type),
919
+ this.setNewItemId(cloneDeep({
920
+ type,
921
+ ...defaultValue
922
+ }))
923
+ ]);
924
+ return {
925
+ id,
926
+ ...defaultPropsValue,
927
+ ...mergeWith({}, cloneDeep(this.state.propsValueMap[type] || {}), data)
928
+ };
929
+ }
930
+ guid(digit = 8) {
931
+ return "x".repeat(digit).replace(/[xy]/g, (c) => {
932
+ const r = Math.random() * 16 | 0;
933
+ const v = c == "x" ? r : r & 3 | 8;
934
+ return v.toString(16);
935
+ });
936
+ }
937
+ async createId(type) {
938
+ return `${type}_${this.guid()}`;
939
+ }
940
+ async setNewItemId(config, parent) {
941
+ const oldId = config.id;
942
+ config.id = await this.createId(config.type || "component");
943
+ if (isPop(config) && parent?.type === NodeType.PAGE) {
944
+ updatePopId(oldId, config.id, parent);
945
+ }
946
+ if (config.items && Array.isArray(config.items)) {
947
+ for (const item of config.items) {
948
+ await this.setNewItemId(item, config);
949
+ }
950
+ }
951
+ return config;
952
+ }
953
+ async getDefaultPropsValue(type) {
954
+ return ["page", "container"].includes(type) ? {
955
+ type,
956
+ layout: "absolute",
957
+ style: {},
958
+ name: type,
959
+ items: []
960
+ } : {
961
+ type,
962
+ style: {},
963
+ name: type
964
+ };
965
+ }
966
+ }
967
+ const updatePopId = (oldId, popId, pageConfig) => {
968
+ pageConfig.items?.forEach((config) => {
969
+ if (config.pop === oldId) {
970
+ config.pop = popId;
971
+ return;
972
+ }
973
+ if (config.popId === oldId) {
974
+ config.popId = popId;
975
+ return;
976
+ }
977
+ if (Array.isArray(config.items)) {
978
+ updatePopId(oldId, popId, config);
979
+ }
980
+ });
981
+ };
982
+ const propsService = new Props();
983
+
984
+ const beforePaste = async (position, config) => {
985
+ if (!config[0]?.style)
986
+ return config;
987
+ const curNode = editorService.get("node");
988
+ const { left: referenceLeft, top: referenceTop } = config[0].style;
989
+ const pasteConfigs = await Promise.all(config.map(async (configItem) => {
990
+ const { offsetX = 0, offsetY = 0, ...positionClone } = position;
991
+ let pastePosition = positionClone;
992
+ if (!isEmpty(pastePosition) && curNode.items) {
993
+ pastePosition = getPositionInContainer(pastePosition, curNode.id);
994
+ }
995
+ if (pastePosition.left && configItem.style?.left) {
996
+ pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
997
+ }
998
+ if (pastePosition.top && configItem.style?.top) {
999
+ pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
1000
+ }
1001
+ const pasteConfig = await propsService.setNewItemId(configItem, editorService.get("root"));
1002
+ if (pasteConfig.style) {
1003
+ const { left, top } = pasteConfig.style;
1004
+ if (typeof left === "number" || !!left && !isNaN(Number(left))) {
1005
+ pasteConfig.style.left = Number(left) + offsetX;
1006
+ }
1007
+ if (typeof top === "number" || !!top && !isNaN(Number(top))) {
1008
+ pasteConfig.style.top = Number(top) + offsetY;
1009
+ }
1010
+ pasteConfig.style = {
1011
+ ...pasteConfig.style,
1012
+ ...pastePosition
1013
+ };
1014
+ }
1015
+ if (isPage(pasteConfig)) {
1016
+ pasteConfig.name = generatePageNameByApp(editorService.get("root"));
1017
+ }
1018
+ return pasteConfig;
1019
+ }));
1020
+ return pasteConfigs;
1021
+ };
1022
+ const getPositionInContainer = (position = {}, id) => {
1023
+ let { left = 0, top = 0 } = position;
1024
+ const parentEl = editorService.get("stage")?.renderer?.contentWindow?.document.getElementById(`${id}`);
1025
+ const parentElRect = parentEl?.getBoundingClientRect();
1026
+ left = left - (parentElRect?.left || 0);
1027
+ top = top - (parentElRect?.top || 0);
1028
+ return {
1029
+ left,
1030
+ top
1031
+ };
1032
+ };
1033
+ const beforeRemove = async (node) => {
1034
+ if (!node?.id)
1035
+ return;
1036
+ const stage = editorService.get("stage");
1037
+ const root = editorService.get("root");
1038
+ if (!root)
1039
+ throw new Error("\u6CA1\u6709root");
1040
+ const { parent, node: curNode } = editorService.getNodeInfo(node.id, false);
1041
+ if (!parent || !curNode)
1042
+ throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1043
+ const index = getNodeIndex(curNode, parent);
1044
+ if (typeof index !== "number" || index === -1)
1045
+ throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1046
+ parent.items?.splice(index, 1);
1047
+ stage?.remove({ id: node.id, root: cloneDeep(root) });
1048
+ if (node.type === NodeType.PAGE) {
1049
+ editorService.state.pageLength -= 1;
1050
+ if (root.items[0]) {
1051
+ await editorService.select(root.items[0]);
1052
+ stage?.select(root.items[0].id);
1053
+ } else {
1054
+ editorService.set("node", null);
1055
+ editorService.set("nodes", []);
1056
+ editorService.set("parent", null);
1057
+ editorService.set("page", null);
1058
+ editorService.set("stage", null);
1059
+ editorService.set("highlightNode", null);
1060
+ editorService.resetModifiedNodeId();
1061
+ historyService.reset();
1062
+ editorService.emit("remove", node);
1063
+ return;
1064
+ }
1065
+ } else {
1066
+ await editorService.select(parent);
1067
+ stage?.select(parent.id);
1068
+ }
1069
+ return parent;
1070
+ };
1071
+ const getAddParent = (addNode) => {
1072
+ const curNode = editorService.get("node");
1073
+ let parentNode;
1074
+ if (!Array.isArray(addNode) && isPage(addNode)) {
1075
+ parentNode = editorService.get("root");
1076
+ } else if (curNode.items) {
1077
+ parentNode = curNode;
1078
+ } else {
1079
+ parentNode = editorService.getParentById(curNode.id, false);
1080
+ }
1081
+ return parentNode;
1082
+ };
1083
+
1084
+ class Editor$1 extends BaseService {
1085
+ state = reactive({
1086
+ root: null,
1087
+ page: null,
1088
+ parent: null,
1089
+ node: null,
1090
+ nodes: [],
1091
+ stage: null,
1092
+ highlightNode: null,
1093
+ modifiedNodeIds: /* @__PURE__ */ new Map(),
1094
+ pageLength: 0
1095
+ });
1096
+ isHistoryStateChange = false;
1097
+ constructor() {
1098
+ super([
1099
+ "getLayout",
1100
+ "select",
1101
+ "doAdd",
1102
+ "add",
1103
+ "remove",
1104
+ "update",
1105
+ "sort",
1106
+ "copy",
1107
+ "paste",
1108
+ "alignCenter",
1109
+ "moveLayer",
1110
+ "moveToContainer",
1111
+ "move",
1112
+ "undo",
1113
+ "redo",
1114
+ "highlight"
1115
+ ], ["select", "update", "moveLayer"]);
1116
+ }
1117
+ set(name, value) {
1118
+ this.state[name] = value;
1119
+ if (name === "nodes") {
1120
+ this.set("node", value[0]);
1121
+ }
1122
+ if (name === "root") {
1123
+ this.state.pageLength = value?.items?.length || 0;
1124
+ this.emit("root-change", value);
1125
+ }
1126
+ }
1127
+ get(name) {
1128
+ return this.state[name];
1129
+ }
1130
+ getNodeInfo(id, raw = true) {
1131
+ let root = this.get("root");
1132
+ if (raw) {
1133
+ root = toRaw(root);
1134
+ }
1135
+ if (!root)
1136
+ return {};
1137
+ if (id === root.id) {
1138
+ return { node: root };
1139
+ }
1140
+ const path = getNodePath(id, root.items);
1141
+ if (!path.length)
1142
+ return {};
1143
+ path.unshift(root);
1144
+ const info = {};
1145
+ info.node = path[path.length - 1];
1146
+ info.parent = path[path.length - 2];
1147
+ path.forEach((item) => {
1148
+ if (item.type === NodeType.PAGE) {
1149
+ info.page = item;
1150
+ return;
1151
+ }
1152
+ });
1153
+ return info;
1154
+ }
1155
+ getNodeById(id, raw = true) {
1156
+ const { node } = this.getNodeInfo(id, raw);
1157
+ return node;
964
1158
  }
965
1159
  getParentById(id, raw = true) {
966
1160
  if (!this.get("root"))
@@ -979,9 +1173,9 @@ class Editor$1 extends BaseService {
979
1173
  }
980
1174
  return Layout.ABSOLUTE;
981
1175
  }
982
- async select(config2) {
983
- const { node, page, parent } = this.selectedConfigExceptionHandler(config2);
984
- this.set("node", node);
1176
+ async select(config) {
1177
+ const { node, page, parent } = this.selectedConfigExceptionHandler(config);
1178
+ this.set("nodes", [node]);
985
1179
  this.set("page", page || null);
986
1180
  this.set("parent", parent || null);
987
1181
  if (page) {
@@ -1021,107 +1215,103 @@ class Editor$1 extends BaseService {
1021
1215
  this.get("stage")?.select(nextPage.id);
1022
1216
  return nextPage;
1023
1217
  }
1024
- highlight(config2) {
1025
- const { node } = this.selectedConfigExceptionHandler(config2);
1218
+ highlight(config) {
1219
+ const { node } = this.selectedConfigExceptionHandler(config);
1026
1220
  const currentHighlightNode = this.get("highlightNode");
1027
1221
  if (currentHighlightNode === node)
1028
1222
  return;
1029
1223
  this.set("highlightNode", node);
1030
1224
  }
1031
- async add(addNode, parent) {
1032
- const { type, inputEvent, ...config2 } = addNode;
1225
+ multiSelect(ids) {
1226
+ const nodes = [];
1227
+ const idsUnique = uniq(ids);
1228
+ idsUnique.forEach((id) => {
1229
+ const { node } = this.getNodeInfo(id);
1230
+ if (!node)
1231
+ return;
1232
+ nodes.push(node);
1233
+ });
1234
+ this.set("nodes", nodes);
1235
+ }
1236
+ async doAdd(node, parent) {
1237
+ const root = this.get("root");
1033
1238
  const curNode = this.get("node");
1034
- let parentNode;
1035
- const isPage2 = type === NodeType.PAGE;
1036
- if (isPage2) {
1037
- parentNode = this.get("root");
1038
- } else if (parent && typeof parent !== "function") {
1039
- parentNode = parent;
1040
- } else if (curNode.items) {
1041
- parentNode = curNode;
1042
- } else {
1043
- parentNode = this.getParentById(curNode.id, false);
1044
- }
1045
- if (!parentNode)
1046
- throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
1047
- const layout = await this.getLayout(toRaw(parentNode), addNode);
1048
- const newNode = { ...toRaw(await propsService.getPropsValue(type, config2)) };
1049
- newNode.style = getInitPositionStyle(newNode.style, layout, parentNode, this.get("stage"));
1050
- if ((parentNode?.type === NodeType.ROOT || curNode.type === NodeType.ROOT) && newNode.type !== NodeType.PAGE) {
1239
+ const stage = this.get("stage");
1240
+ if ((parent?.type === NodeType.ROOT || curNode.type === NodeType.ROOT) && node.type !== NodeType.PAGE) {
1051
1241
  throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
1052
1242
  }
1053
- parentNode?.items?.push(newNode);
1243
+ const layout = await this.getLayout(toRaw(parent), node);
1244
+ node.style = getInitPositionStyle(node.style, layout);
1245
+ await stage?.add({ config: cloneDeep(node), parent: cloneDeep(parent), root: cloneDeep(root) });
1246
+ node.style = fixNodePosition(node, parent, stage);
1247
+ await stage?.update({ config: cloneDeep(node), root: cloneDeep(root) });
1248
+ parent?.items?.push(node);
1249
+ this.addModifiedNodeId(node.id);
1250
+ return node;
1251
+ }
1252
+ async add(addNode, parent) {
1054
1253
  const stage = this.get("stage");
1055
- const root = this.get("root");
1056
- await stage?.add({ config: cloneDeep(newNode), parent: cloneDeep(parentNode), root: cloneDeep(root) });
1057
- if (layout === Layout.ABSOLUTE) {
1058
- const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
1059
- if (typeof fixedLeft !== "undefined") {
1060
- newNode.style.left = fixedLeft;
1061
- await stage?.update({ config: cloneDeep(newNode), root: cloneDeep(root) });
1062
- }
1063
- }
1064
- await this.select(newNode);
1065
- this.addModifiedNodeId(newNode.id);
1066
- if (!isPage2) {
1067
- this.pushHistoryState();
1068
- }
1069
- if (isPage2) {
1070
- this.state.pageLength += 1;
1254
+ const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(addNode);
1255
+ if (!parentNode)
1256
+ throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
1257
+ const addNodes = [];
1258
+ if (!Array.isArray(addNode)) {
1259
+ const { type, inputEvent, ...config } = addNode;
1260
+ if (!type)
1261
+ throw new Error("\u7EC4\u4EF6\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
1262
+ addNodes.push({ ...toRaw(await propsService.getPropsValue(type, config)) });
1071
1263
  } else {
1072
- stage?.select(newNode.id);
1264
+ addNodes.push(...addNode);
1073
1265
  }
1074
- this.emit("add", newNode);
1075
- return newNode;
1076
- }
1077
- async remove(node) {
1078
- if (!node?.id)
1079
- return;
1080
- const root = this.get("root");
1081
- if (!root)
1082
- throw new Error("\u6CA1\u6709root");
1083
- const { parent, node: curNode } = this.getNodeInfo(node.id, false);
1084
- if (!parent || !curNode)
1085
- throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1086
- const index = getNodeIndex(curNode, parent);
1087
- if (typeof index !== "number" || index === -1)
1088
- throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1089
- parent.items?.splice(index, 1);
1090
- const stage = this.get("stage");
1091
- stage?.remove({ id: node.id, root: cloneDeep(this.get("root")) });
1092
- if (node.type === NodeType.PAGE) {
1093
- this.state.pageLength -= 1;
1094
- if (root.items[0]) {
1095
- await this.select(root.items[0]);
1096
- stage?.select(root.items[0].id);
1266
+ const newNodes = await Promise.all(addNodes.map((node) => this.doAdd(node, parentNode)));
1267
+ if (newNodes.length > 1) {
1268
+ const newNodeIds = newNodes.map((node) => node.id);
1269
+ stage?.multiSelect(newNodeIds);
1270
+ await this.multiSelect(newNodeIds);
1271
+ } else {
1272
+ await this.select(newNodes[0]);
1273
+ if (isPage(newNodes[0])) {
1274
+ this.state.pageLength += 1;
1097
1275
  } else {
1098
- this.set("node", null);
1099
- this.set("parent", null);
1100
- this.set("page", null);
1101
- this.set("stage", null);
1102
- this.set("highlightNode", null);
1103
- this.resetModifiedNodeId();
1104
- historyService.reset();
1105
- this.emit("remove", node);
1106
- return node;
1276
+ stage?.select(newNodes[0].id);
1107
1277
  }
1108
- } else {
1109
- await this.select(parent);
1110
- stage?.select(parent.id);
1111
1278
  }
1112
- this.addModifiedNodeId(parent.id);
1279
+ this.pushHistoryState();
1280
+ this.emit("add", newNodes);
1281
+ return newNodes.length > 1 ? newNodes[0] : newNodes;
1282
+ }
1283
+ async remove(nodeOrNodeList) {
1284
+ if (Array.isArray(nodeOrNodeList)) {
1285
+ const nodes = nodeOrNodeList;
1286
+ return this.multiRemove(nodes);
1287
+ }
1288
+ const node = nodeOrNodeList;
1289
+ const removeParent = await beforeRemove(node);
1290
+ if (!removeParent)
1291
+ return node;
1292
+ this.addModifiedNodeId(removeParent.id);
1113
1293
  this.pushHistoryState();
1114
1294
  this.emit("remove", node);
1115
1295
  return node;
1116
1296
  }
1117
- async update(config2) {
1118
- if (!config2?.id)
1297
+ async multiRemove(nodes) {
1298
+ await Promise.all(nodes.map(async (removeNode) => {
1299
+ await beforeRemove(removeNode);
1300
+ }));
1301
+ const nodeIds = nodes.map((node) => node.id);
1302
+ this.addModifiedNodeId(nodeIds.join("-"));
1303
+ this.pushHistoryState();
1304
+ this.emit("multiRemove", nodes);
1305
+ return nodes;
1306
+ }
1307
+ async update(config) {
1308
+ if (!config?.id)
1119
1309
  throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
1120
- const info = this.getNodeInfo(config2.id, false);
1310
+ const info = this.getNodeInfo(config.id, false);
1121
1311
  if (!info.node)
1122
- throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config2.id}\u7684\u8282\u70B9`);
1312
+ throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config.id}\u7684\u8282\u70B9`);
1123
1313
  const node = cloneDeep(toRaw(info.node));
1124
- let newConfig = await this.toggleFixedPosition(toRaw(config2), node, this.get("root"));
1314
+ let newConfig = await this.toggleFixedPosition(toRaw(config), node, this.get("root"));
1125
1315
  newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => {
1126
1316
  if (Array.isArray(srcValue)) {
1127
1317
  return srcValue;
@@ -1146,9 +1336,10 @@ class Editor$1 extends BaseService {
1146
1336
  newConfig = setLayout(newConfig, newLayout);
1147
1337
  }
1148
1338
  parentNodeItems[index] = newConfig;
1149
- if (`${newConfig.id}` === `${this.get("node").id}`) {
1150
- this.set("node", newConfig);
1151
- }
1339
+ const nodes = this.get("nodes");
1340
+ const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
1341
+ nodes.splice(targetIndex, 1, newConfig);
1342
+ this.set("nodes", nodes);
1152
1343
  this.get("stage")?.update({ config: cloneDeep(newConfig), root: cloneDeep(this.get("root")) });
1153
1344
  if (newConfig.type === NodeType.PAGE) {
1154
1345
  this.set("page", newConfig);
@@ -1172,34 +1363,19 @@ class Editor$1 extends BaseService {
1172
1363
  this.addModifiedNodeId(parent.id);
1173
1364
  this.pushHistoryState();
1174
1365
  }
1175
- async copy(config2) {
1176
- globalThis.localStorage.setItem(COPY_STORAGE_KEY, serialize(config2));
1366
+ async copy(config) {
1367
+ await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
1368
+ protocol: Protocol.OBJECT
1369
+ });
1177
1370
  }
1178
1371
  async paste(position = {}) {
1179
- const configStr = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
1180
- let config = {};
1181
- if (!configStr) {
1372
+ const config = await storageService.getItem(COPY_STORAGE_KEY);
1373
+ if (!Array.isArray(config))
1182
1374
  return;
1183
- }
1184
- try {
1185
- eval(`config = ${configStr}`);
1186
- } catch (e) {
1187
- console.error(e);
1188
- return;
1189
- }
1190
- config = await propsService.setNewItemId(config, this.get("root"));
1191
- if (config.style) {
1192
- config.style = {
1193
- ...config.style,
1194
- ...position
1195
- };
1196
- }
1197
- if (isPage(config)) {
1198
- config.name = generatePageNameByApp(this.get("root"));
1199
- }
1200
- return await this.add(config);
1375
+ const pasteConfigs = await beforePaste(position, config);
1376
+ return this.add(pasteConfigs);
1201
1377
  }
1202
- async alignCenter(config2) {
1378
+ async alignCenter(config) {
1203
1379
  const parent = this.get("parent");
1204
1380
  const node = this.get("node");
1205
1381
  const layout = await this.getLayout(toRaw(parent), toRaw(node));
@@ -1224,9 +1400,9 @@ class Editor$1 extends BaseService {
1224
1400
  config: cloneDeep(toRaw(node)),
1225
1401
  root: cloneDeep(this.get("root"))
1226
1402
  });
1227
- this.addModifiedNodeId(config2.id);
1403
+ this.addModifiedNodeId(config.id);
1228
1404
  this.pushHistoryState();
1229
- return config2;
1405
+ return config;
1230
1406
  }
1231
1407
  async moveLayer(offset) {
1232
1408
  const parent = this.get("parent");
@@ -1245,8 +1421,8 @@ class Editor$1 extends BaseService {
1245
1421
  root: cloneDeep(this.get("root"))
1246
1422
  });
1247
1423
  }
1248
- async moveToContainer(config2, targetId) {
1249
- const { node, parent } = this.getNodeInfo(config2.id, false);
1424
+ async moveToContainer(config, targetId) {
1425
+ const { node, parent } = this.getNodeInfo(config.id, false);
1250
1426
  const target = this.getNodeById(targetId, false);
1251
1427
  const stage = this.get("stage");
1252
1428
  if (node && parent && stage) {
@@ -1255,12 +1431,12 @@ class Editor$1 extends BaseService {
1255
1431
  parent.items?.splice(index, 1);
1256
1432
  await stage.remove({ id: node.id, root });
1257
1433
  const layout = await this.getLayout(target);
1258
- const newConfig = mergeWith(cloneDeep(node), config2, (objValue, srcValue) => {
1434
+ const newConfig = mergeWith(cloneDeep(node), config, (objValue, srcValue) => {
1259
1435
  if (Array.isArray(srcValue)) {
1260
1436
  return srcValue;
1261
1437
  }
1262
1438
  });
1263
- newConfig.style = getInitPositionStyle(newConfig.style, layout, target, stage);
1439
+ newConfig.style = getInitPositionStyle(newConfig.style, layout);
1264
1440
  target.items.push(newConfig);
1265
1441
  await stage.select(targetId);
1266
1442
  await stage.update({ config: cloneDeep(target), root });
@@ -1286,7 +1462,7 @@ class Editor$1 extends BaseService {
1286
1462
  const node = toRaw(this.get("node"));
1287
1463
  if (!node || isPage(node))
1288
1464
  return;
1289
- const { style, id } = node;
1465
+ const { style, id, type } = node;
1290
1466
  if (!style || style.position !== "absolute")
1291
1467
  return;
1292
1468
  if (top && !isNumber(style.top))
@@ -1295,6 +1471,7 @@ class Editor$1 extends BaseService {
1295
1471
  return;
1296
1472
  this.update({
1297
1473
  id,
1474
+ type,
1298
1475
  style: {
1299
1476
  ...style,
1300
1477
  left: Number(style.left) + left,
@@ -1306,6 +1483,7 @@ class Editor$1 extends BaseService {
1306
1483
  this.removeAllListeners();
1307
1484
  this.set("root", null);
1308
1485
  this.set("node", null);
1486
+ this.set("nodes", []);
1309
1487
  this.set("page", null);
1310
1488
  this.set("parent", null);
1311
1489
  }
@@ -1352,12 +1530,12 @@ class Editor$1 extends BaseService {
1352
1530
  }
1353
1531
  return newConfig;
1354
1532
  }
1355
- selectedConfigExceptionHandler(config2) {
1533
+ selectedConfigExceptionHandler(config) {
1356
1534
  let id;
1357
- if (typeof config2 === "string" || typeof config2 === "number") {
1358
- id = config2;
1535
+ if (typeof config === "string" || typeof config === "number") {
1536
+ id = config;
1359
1537
  } else {
1360
- id = config2.id;
1538
+ id = config.id;
1361
1539
  }
1362
1540
  if (!id) {
1363
1541
  throw new Error("\u6CA1\u6709ID\uFF0C\u65E0\u6CD5\u9009\u4E2D");
@@ -1375,7 +1553,7 @@ class Editor$1 extends BaseService {
1375
1553
  };
1376
1554
  }
1377
1555
  }
1378
- var editorService = new Editor$1();
1556
+ const editorService = new Editor$1();
1379
1557
 
1380
1558
  const eventMap = reactive({});
1381
1559
  const methodMap = reactive({});
@@ -1419,7 +1597,7 @@ class Events extends BaseService {
1419
1597
  return cloneDeep(methodMap[type] || DEFAULT_METHODS);
1420
1598
  }
1421
1599
  }
1422
- var eventsService = new Events();
1600
+ const eventsService = new Events();
1423
1601
 
1424
1602
  const fillConfig = (config = []) => [
1425
1603
  {
@@ -1627,17 +1805,32 @@ const fillConfig = (config = []) => [
1627
1805
  const DEFAULT_CONFIG = fillConfig([]);
1628
1806
 
1629
1807
  const log = (...args) => {
1808
+ if (process.env.NODE_ENV === "development") {
1809
+ console.log("magic editor: ", ...args);
1810
+ }
1630
1811
  };
1631
1812
  const info = (...args) => {
1813
+ if (process.env.NODE_ENV === "development") {
1814
+ console.info("magic editor: ", ...args);
1815
+ }
1632
1816
  };
1633
1817
  const warn = (...args) => {
1818
+ if (process.env.NODE_ENV === "development") {
1819
+ console.warn("magic editor: ", ...args);
1820
+ }
1634
1821
  };
1635
1822
  const debug = (...args) => {
1823
+ if (process.env.NODE_ENV === "development") {
1824
+ console.debug("magic editor: ", ...args);
1825
+ }
1636
1826
  };
1637
1827
  const error = (...args) => {
1828
+ if (process.env.NODE_ENV === "development") {
1829
+ console.error("magic editor: ", ...args);
1830
+ }
1638
1831
  };
1639
1832
 
1640
- const _sfc_main$i = defineComponent({
1833
+ const _sfc_main$j = defineComponent({
1641
1834
  components: { Plus },
1642
1835
  setup() {
1643
1836
  const services = inject("services");
@@ -1654,10 +1847,11 @@ const _sfc_main$i = defineComponent({
1654
1847
  };
1655
1848
  }
1656
1849
  });
1850
+
1657
1851
  const _hoisted_1$b = { class: "m-editor-empty-panel" };
1658
1852
  const _hoisted_2$4 = { class: "m-editor-empty-content" };
1659
- const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1660
- function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1853
+ const _hoisted_3$1 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1854
+ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
1661
1855
  const _component_plus = resolveComponent("plus");
1662
1856
  const _component_el_icon = resolveComponent("el-icon");
1663
1857
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
@@ -1674,14 +1868,14 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1674
1868
  _: 1
1675
1869
  })
1676
1870
  ]),
1677
- _hoisted_3$2
1871
+ _hoisted_3$1
1678
1872
  ])
1679
1873
  ])
1680
1874
  ]);
1681
1875
  }
1682
- var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
1876
+ const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$d]]);
1683
1877
 
1684
- const _sfc_main$h = defineComponent({
1878
+ const _sfc_main$i = defineComponent({
1685
1879
  name: "m-editor-resize",
1686
1880
  props: {
1687
1881
  type: {
@@ -1723,18 +1917,19 @@ const _sfc_main$h = defineComponent({
1723
1917
  };
1724
1918
  }
1725
1919
  });
1920
+
1726
1921
  const _hoisted_1$a = {
1727
1922
  ref: "target",
1728
1923
  class: "m-editor-resizer"
1729
1924
  };
1730
- function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1925
+ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
1731
1926
  return openBlock(), createElementBlock("span", _hoisted_1$a, [
1732
1927
  renderSlot(_ctx.$slots, "default")
1733
1928
  ], 512);
1734
1929
  }
1735
- var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h]]);
1930
+ const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$c]]);
1736
1931
 
1737
- const _sfc_main$g = defineComponent({
1932
+ const _sfc_main$h = defineComponent({
1738
1933
  components: {
1739
1934
  AddPageBox,
1740
1935
  Resizer
@@ -1763,12 +1958,13 @@ const _sfc_main$g = defineComponent({
1763
1958
  };
1764
1959
  }
1765
1960
  });
1961
+
1766
1962
  const _hoisted_1$9 = { class: "m-editor" };
1767
1963
  const _hoisted_2$3 = {
1768
1964
  key: 1,
1769
1965
  class: "m-editor-content"
1770
1966
  };
1771
- function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
1967
+ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
1772
1968
  const _component_magic_code_editor = resolveComponent("magic-code-editor");
1773
1969
  const _component_resizer = resolveComponent("resizer");
1774
1970
  const _component_el_scrollbar = resolveComponent("el-scrollbar");
@@ -1814,9 +2010,9 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
1814
2010
  ]))
1815
2011
  ]);
1816
2012
  }
1817
- var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
2013
+ const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$b]]);
1818
2014
 
1819
- const _sfc_main$f = defineComponent({
2015
+ const _sfc_main$g = defineComponent({
1820
2016
  name: "m-icon",
1821
2017
  components: { Edit },
1822
2018
  props: {
@@ -1830,8 +2026,9 @@ const _sfc_main$f = defineComponent({
1830
2026
  };
1831
2027
  }
1832
2028
  });
2029
+
1833
2030
  const _hoisted_1$8 = ["src"];
1834
- function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2031
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
1835
2032
  const _component_edit = resolveComponent("edit");
1836
2033
  const _component_el_icon = resolveComponent("el-icon");
1837
2034
  return !_ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
@@ -1839,10 +2036,12 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
1839
2036
  createVNode(_component_edit)
1840
2037
  ]),
1841
2038
  _: 1
1842
- })) : typeof _ctx.icon === "string" && _ctx.icon.startsWith("http") ? (openBlock(), createElementBlock("img", {
1843
- key: 1,
1844
- src: _ctx.icon
1845
- }, null, 8, _hoisted_1$8)) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
2039
+ })) : typeof _ctx.icon === "string" && _ctx.icon.startsWith("http") ? (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
2040
+ default: withCtx(() => [
2041
+ createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$8)
2042
+ ]),
2043
+ _: 1
2044
+ })) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
1846
2045
  key: 2,
1847
2046
  class: normalizeClass(_ctx.icon)
1848
2047
  }, null, 2)) : (openBlock(), createBlock(_component_el_icon, { key: 3 }, {
@@ -1852,10 +2051,19 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
1852
2051
  _: 1
1853
2052
  }));
1854
2053
  }
1855
- var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f]]);
2054
+ const MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$a]]);
1856
2055
 
1857
- const _sfc_main$e = defineComponent({
1858
- components: { MIcon, ArrowDown },
2056
+ const _hoisted_1$7 = {
2057
+ key: 1,
2058
+ class: "menu-item-text"
2059
+ };
2060
+ const _hoisted_2$2 = {
2061
+ class: "menu-item-text",
2062
+ style: { "margin": "0 5px" }
2063
+ };
2064
+ const _hoisted_3 = { class: "el-dropdown-link menubar-menu-button" };
2065
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2066
+ __name: "ToolButton",
1859
2067
  props: {
1860
2068
  data: {
1861
2069
  type: [Object, String],
@@ -1870,7 +2078,8 @@ const _sfc_main$e = defineComponent({
1870
2078
  default: "click"
1871
2079
  }
1872
2080
  },
1873
- setup(props) {
2081
+ setup(__props) {
2082
+ const props = __props;
1874
2083
  const services = inject("services");
1875
2084
  const uiService = services?.uiService;
1876
2085
  const zoom = computed(() => uiService?.get("zoom") ?? 1);
@@ -1967,176 +2176,155 @@ const _sfc_main$e = defineComponent({
1967
2176
  item2.handler?.(services, event);
1968
2177
  }
1969
2178
  };
1970
- return {
1971
- ZoomIn: markRaw(ZoomIn),
1972
- ZoomOut: markRaw(ZoomOut),
1973
- item,
1974
- zoom,
1975
- disabled,
1976
- display: computed(() => {
1977
- if (!item.value)
1978
- return false;
1979
- if (typeof item.value === "string")
1980
- return true;
1981
- if (typeof item.value.display === "function") {
1982
- return item.value.display(services);
1983
- }
1984
- return item.value.display ?? true;
1985
- }),
1986
- zoomInHandler,
1987
- zoomOutHandler,
1988
- dropdownHandler(command) {
1989
- if (command.item.handler) {
1990
- command.item.handler(services);
1991
- }
1992
- },
1993
- clickHandler(item2, event) {
1994
- if (props.eventType !== "click")
1995
- return;
1996
- if (item2.type === "button") {
1997
- buttonHandler(item2, event);
1998
- }
1999
- },
2000
- mousedownHandler(item2, event) {
2001
- if (props.eventType !== "mousedown")
2002
- return;
2003
- if (item2.type === "button") {
2004
- buttonHandler(item2, event);
2005
- }
2006
- },
2007
- mouseupHandler(item2, event) {
2008
- if (props.eventType !== "mouseup")
2009
- return;
2010
- if (item2.type === "button") {
2011
- buttonHandler(item2, event);
2012
- }
2179
+ const display = computed(() => {
2180
+ if (!item.value)
2181
+ return false;
2182
+ if (typeof item.value === "string")
2183
+ return true;
2184
+ if (typeof item.value.display === "function") {
2185
+ return item.value.display(services);
2186
+ }
2187
+ return item.value.display ?? true;
2188
+ });
2189
+ const dropdownHandler = (command) => {
2190
+ if (command.item.handler) {
2191
+ command.item.handler(services);
2013
2192
  }
2014
2193
  };
2015
- }
2016
- });
2017
- const _hoisted_1$7 = {
2018
- key: 1,
2019
- class: "menu-item-text"
2020
- };
2021
- const _hoisted_2$2 = {
2022
- class: "menu-item-text",
2023
- style: { "margin": "0 5px" }
2024
- };
2025
- const _hoisted_3$1 = { class: "el-dropdown-link menubar-menu-button" };
2026
- function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
2027
- const _component_el_divider = resolveComponent("el-divider");
2028
- const _component_tool_button = resolveComponent("tool-button", true);
2029
- const _component_m_icon = resolveComponent("m-icon");
2030
- const _component_el_button = resolveComponent("el-button");
2031
- const _component_el_tooltip = resolveComponent("el-tooltip");
2032
- const _component_arrow_down = resolveComponent("arrow-down");
2033
- const _component_el_icon = resolveComponent("el-icon");
2034
- const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
2035
- const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
2036
- const _component_el_dropdown = resolveComponent("el-dropdown");
2037
- return _ctx.display ? (openBlock(), createElementBlock("div", {
2038
- key: 0,
2039
- class: normalizeClass(["menu-item", _ctx.item.type]),
2040
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.clickHandler(_ctx.item, $event)),
2041
- onMousedown: _cache[1] || (_cache[1] = ($event) => _ctx.mousedownHandler(_ctx.item, $event)),
2042
- onMouseup: _cache[2] || (_cache[2] = ($event) => _ctx.mouseupHandler(_ctx.item, $event))
2043
- }, [
2044
- _ctx.item.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
2045
- key: 0,
2046
- direction: _ctx.item.direction || "vertical"
2047
- }, null, 8, ["direction"])) : _ctx.item.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$7, toDisplayString(_ctx.item.text), 1)) : _ctx.item.type === "zoom" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2048
- createVNode(_component_tool_button, {
2049
- data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
2050
- "event-type": _ctx.eventType
2051
- }, null, 8, ["data", "event-type"]),
2052
- createElementVNode("span", _hoisted_2$2, toDisplayString(parseInt(`${_ctx.zoom * 100}`, 10)) + "%", 1),
2053
- createVNode(_component_tool_button, {
2054
- data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
2055
- "event-type": _ctx.eventType
2056
- }, null, 8, ["data", "event-type"])
2057
- ], 64)) : _ctx.item.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
2058
- _ctx.item.tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
2194
+ const clickHandler = (item2, event) => {
2195
+ if (props.eventType !== "click")
2196
+ return;
2197
+ if (item2.type === "button") {
2198
+ buttonHandler(item2, event);
2199
+ }
2200
+ };
2201
+ const mousedownHandler = (item2, event) => {
2202
+ if (props.eventType !== "mousedown")
2203
+ return;
2204
+ if (item2.type === "button") {
2205
+ buttonHandler(item2, event);
2206
+ }
2207
+ };
2208
+ const mouseupHandler = (item2, event) => {
2209
+ if (props.eventType !== "mouseup")
2210
+ return;
2211
+ if (item2.type === "button") {
2212
+ buttonHandler(item2, event);
2213
+ }
2214
+ };
2215
+ return (_ctx, _cache) => {
2216
+ const _component_el_divider = resolveComponent("el-divider");
2217
+ const _component_tool_button = resolveComponent("tool-button", true);
2218
+ const _component_el_button = resolveComponent("el-button");
2219
+ const _component_el_tooltip = resolveComponent("el-tooltip");
2220
+ const _component_el_icon = resolveComponent("el-icon");
2221
+ const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
2222
+ const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
2223
+ const _component_el_dropdown = resolveComponent("el-dropdown");
2224
+ return unref(display) ? (openBlock(), createElementBlock("div", {
2059
2225
  key: 0,
2060
- effect: "dark",
2061
- placement: "bottom-start",
2062
- content: _ctx.item.tooltip
2063
- }, {
2064
- default: withCtx(() => [
2065
- createVNode(_component_el_button, {
2226
+ class: normalizeClass(["menu-item", unref(item).type]),
2227
+ onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(item), $event)),
2228
+ onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(unref(item), $event)),
2229
+ onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(unref(item), $event))
2230
+ }, [
2231
+ unref(item).type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
2232
+ key: 0,
2233
+ direction: unref(item).direction || "vertical"
2234
+ }, null, 8, ["direction"])) : unref(item).type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$7, toDisplayString(unref(item).text), 1)) : unref(item).type === "zoom" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2235
+ createVNode(_component_tool_button, {
2236
+ data: { type: "button", icon: unref(ZoomOut), handler: zoomOutHandler, tooltip: "\u7F29\u5C0F" },
2237
+ "event-type": __props.eventType
2238
+ }, null, 8, ["data", "event-type"]),
2239
+ createElementVNode("span", _hoisted_2$2, toDisplayString(parseInt(`${unref(zoom) * 100}`, 10)) + "%", 1),
2240
+ createVNode(_component_tool_button, {
2241
+ data: { type: "button", icon: unref(ZoomIn), handler: zoomInHandler, tooltip: "\u653E\u5927" },
2242
+ "event-type": __props.eventType
2243
+ }, null, 8, ["data", "event-type"])
2244
+ ], 64)) : unref(item).type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
2245
+ unref(item).tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
2246
+ key: 0,
2247
+ effect: "dark",
2248
+ placement: "bottom-start",
2249
+ content: unref(item).tooltip
2250
+ }, {
2251
+ default: withCtx(() => [
2252
+ createVNode(_component_el_button, {
2253
+ size: "small",
2254
+ text: "",
2255
+ disabled: unref(disabled)
2256
+ }, {
2257
+ default: withCtx(() => [
2258
+ unref(item).icon ? (openBlock(), createBlock(MIcon, {
2259
+ key: 0,
2260
+ icon: unref(item).icon
2261
+ }, null, 8, ["icon"])) : createCommentVNode("", true),
2262
+ createElementVNode("span", null, toDisplayString(unref(item).text), 1)
2263
+ ]),
2264
+ _: 1
2265
+ }, 8, ["disabled"])
2266
+ ]),
2267
+ _: 1
2268
+ }, 8, ["content"])) : (openBlock(), createBlock(_component_el_button, {
2269
+ key: 1,
2066
2270
  size: "small",
2067
2271
  text: "",
2068
- disabled: _ctx.disabled
2272
+ disabled: unref(disabled)
2069
2273
  }, {
2070
2274
  default: withCtx(() => [
2071
- _ctx.item.icon ? (openBlock(), createBlock(_component_m_icon, {
2275
+ unref(item).icon ? (openBlock(), createBlock(MIcon, {
2072
2276
  key: 0,
2073
- icon: _ctx.item.icon
2277
+ icon: unref(item).icon
2074
2278
  }, null, 8, ["icon"])) : createCommentVNode("", true),
2075
- createElementVNode("span", null, toDisplayString(_ctx.item.text), 1)
2279
+ createElementVNode("span", null, toDisplayString(unref(item).text), 1)
2076
2280
  ]),
2077
2281
  _: 1
2078
- }, 8, ["disabled"])
2079
- ]),
2080
- _: 1
2081
- }, 8, ["content"])) : (openBlock(), createBlock(_component_el_button, {
2082
- key: 1,
2083
- size: "small",
2084
- text: "",
2085
- disabled: _ctx.disabled
2086
- }, {
2087
- default: withCtx(() => [
2088
- _ctx.item.icon ? (openBlock(), createBlock(_component_m_icon, {
2089
- key: 0,
2090
- icon: _ctx.item.icon
2091
- }, null, 8, ["icon"])) : createCommentVNode("", true),
2092
- createElementVNode("span", null, toDisplayString(_ctx.item.text), 1)
2093
- ]),
2094
- _: 1
2095
- }, 8, ["disabled"]))
2096
- ], 64)) : _ctx.item.type === "dropdown" ? (openBlock(), createBlock(_component_el_dropdown, {
2097
- key: 4,
2098
- trigger: "click",
2099
- disabled: _ctx.disabled,
2100
- onCommand: _ctx.dropdownHandler
2101
- }, {
2102
- dropdown: withCtx(() => [
2103
- _ctx.item.items && _ctx.item.items.length ? (openBlock(), createBlock(_component_el_dropdown_menu, { key: 0 }, {
2282
+ }, 8, ["disabled"]))
2283
+ ], 64)) : unref(item).type === "dropdown" ? (openBlock(), createBlock(_component_el_dropdown, {
2284
+ key: 4,
2285
+ trigger: "click",
2286
+ disabled: unref(disabled),
2287
+ onCommand: dropdownHandler
2288
+ }, {
2289
+ dropdown: withCtx(() => [
2290
+ unref(item).items && unref(item).items.length ? (openBlock(), createBlock(_component_el_dropdown_menu, { key: 0 }, {
2291
+ default: withCtx(() => [
2292
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(item).items, (subItem, index) => {
2293
+ return openBlock(), createBlock(_component_el_dropdown_item, {
2294
+ key: index,
2295
+ command: { item: unref(item), subItem }
2296
+ }, {
2297
+ default: withCtx(() => [
2298
+ createTextVNode(toDisplayString(subItem.text), 1)
2299
+ ]),
2300
+ _: 2
2301
+ }, 1032, ["command"]);
2302
+ }), 128))
2303
+ ]),
2304
+ _: 1
2305
+ })) : createCommentVNode("", true)
2306
+ ]),
2104
2307
  default: withCtx(() => [
2105
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.item.items, (subItem, index) => {
2106
- return openBlock(), createBlock(_component_el_dropdown_item, {
2107
- key: index,
2108
- command: { item: _ctx.item, subItem }
2109
- }, {
2308
+ createElementVNode("span", _hoisted_3, [
2309
+ createTextVNode(toDisplayString(unref(item).text), 1),
2310
+ createVNode(_component_el_icon, { class: "el-icon--right" }, {
2110
2311
  default: withCtx(() => [
2111
- createTextVNode(toDisplayString(subItem.text), 1)
2312
+ createVNode(unref(ArrowDown))
2112
2313
  ]),
2113
- _: 2
2114
- }, 1032, ["command"]);
2115
- }), 128))
2314
+ _: 1
2315
+ })
2316
+ ])
2116
2317
  ]),
2117
2318
  _: 1
2118
- })) : createCommentVNode("", true)
2119
- ]),
2120
- default: withCtx(() => [
2121
- createElementVNode("span", _hoisted_3$1, [
2122
- createTextVNode(toDisplayString(_ctx.item.text), 1),
2123
- createVNode(_component_el_icon, { class: "el-icon--right" }, {
2124
- default: withCtx(() => [
2125
- createVNode(_component_arrow_down)
2126
- ]),
2127
- _: 1
2128
- })
2129
- ])
2130
- ]),
2131
- _: 1
2132
- }, 8, ["disabled", "onCommand"])) : _ctx.item.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.item.component), normalizeProps(mergeProps({ key: 5 }, _ctx.item.props || {})), null, 16)) : createCommentVNode("", true)
2133
- ], 34)) : createCommentVNode("", true);
2134
- }
2135
- var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
2319
+ }, 8, ["disabled"])) : unref(item).type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(unref(item).component), normalizeProps(mergeProps({ key: 5 }, unref(item).props || {})), null, 16)) : createCommentVNode("", true)
2320
+ ], 34)) : createCommentVNode("", true);
2321
+ };
2322
+ }
2323
+ });
2136
2324
 
2137
- const _sfc_main$d = defineComponent({
2325
+ const _sfc_main$e = defineComponent({
2138
2326
  name: "nav-menu",
2139
- components: { ToolButton },
2327
+ components: { ToolButton: _sfc_main$f },
2140
2328
  props: {
2141
2329
  data: {
2142
2330
  type: Object,
@@ -2154,7 +2342,8 @@ const _sfc_main$d = defineComponent({
2154
2342
  };
2155
2343
  }
2156
2344
  });
2157
- function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
2345
+
2346
+ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
2158
2347
  const _component_tool_button = resolveComponent("tool-button");
2159
2348
  return openBlock(), createElementBlock("div", {
2160
2349
  class: "m-editor-nav-menu",
@@ -2176,9 +2365,9 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
2176
2365
  }), 128))
2177
2366
  ], 4);
2178
2367
  }
2179
- var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
2368
+ const NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$9]]);
2180
2369
 
2181
- const _sfc_main$c = defineComponent({
2370
+ const _sfc_main$d = defineComponent({
2182
2371
  name: "m-editor-props-panel",
2183
2372
  emits: ["mounted"],
2184
2373
  setup(props, { emit }) {
@@ -2225,8 +2414,9 @@ const _sfc_main$c = defineComponent({
2225
2414
  };
2226
2415
  }
2227
2416
  });
2417
+
2228
2418
  const _hoisted_1$6 = { class: "`m-editor-props-panel" };
2229
- function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
2419
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2230
2420
  const _component_m_form = resolveComponent("m-form");
2231
2421
  return openBlock(), createElementBlock("div", _hoisted_1$6, [
2232
2422
  renderSlot(_ctx.$slots, "props-panel-header"),
@@ -2241,9 +2431,9 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
2241
2431
  }, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"])
2242
2432
  ]);
2243
2433
  }
2244
- var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
2434
+ const PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$8]]);
2245
2435
 
2246
- const _sfc_main$b = defineComponent({
2436
+ const _sfc_main$c = defineComponent({
2247
2437
  name: "ui-component-panel",
2248
2438
  components: { MIcon },
2249
2439
  setup() {
@@ -2309,9 +2499,10 @@ const _sfc_main$b = defineComponent({
2309
2499
  };
2310
2500
  }
2311
2501
  });
2502
+
2312
2503
  const _hoisted_1$5 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
2313
2504
  const _hoisted_2$1 = ["onClick", "onDragstart"];
2314
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2505
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2315
2506
  const _component_el_input = resolveComponent("el-input");
2316
2507
  const _component_m_icon = resolveComponent("m-icon");
2317
2508
  const _component_el_tooltip = resolveComponent("el-tooltip");
@@ -2383,22 +2574,17 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2383
2574
  _: 3
2384
2575
  });
2385
2576
  }
2386
- var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
2577
+ const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$7]]);
2387
2578
 
2388
- const _sfc_main$a = defineComponent({
2389
- components: { ToolButton },
2579
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2580
+ __name: "ContentMenu",
2390
2581
  props: {
2391
- menuData: {
2392
- type: Array,
2393
- default: () => []
2394
- },
2395
- isSubMenu: {
2396
- type: Boolean,
2397
- default: false
2398
- }
2582
+ menuData: { default: () => [] },
2583
+ isSubMenu: { type: Boolean, default: false }
2399
2584
  },
2400
2585
  emits: ["hide", "show"],
2401
- setup(props, { emit }) {
2586
+ setup(__props, { expose, emit }) {
2587
+ const props = __props;
2402
2588
  const menu = ref();
2403
2589
  const subMenu = ref();
2404
2590
  const visible = ref(false);
@@ -2424,6 +2610,36 @@ const _sfc_main$a = defineComponent({
2424
2610
  }
2425
2611
  hide();
2426
2612
  };
2613
+ const show = (e) => {
2614
+ setTimeout(() => {
2615
+ visible.value = true;
2616
+ nextTick(() => {
2617
+ const menuHeight = menu.value?.clientHeight || 0;
2618
+ let top = e.clientY;
2619
+ if (menuHeight + e.clientY > document.body.clientHeight) {
2620
+ top = document.body.clientHeight - menuHeight;
2621
+ }
2622
+ menuStyle.value = {
2623
+ top: `${top}px`,
2624
+ left: `${e.clientX}px`
2625
+ };
2626
+ emit("show");
2627
+ });
2628
+ }, 300);
2629
+ };
2630
+ const showSubMenu = (item) => {
2631
+ const menuItem = item;
2632
+ if (typeof item !== "object" || !menuItem.items?.length) {
2633
+ return;
2634
+ }
2635
+ subMenuData.value = menuItem.items;
2636
+ if (menu.value) {
2637
+ subMenu.value.show({
2638
+ clientX: menu.value.offsetLeft + menu.value.clientWidth,
2639
+ clientY: menu.value.offsetTop
2640
+ });
2641
+ }
2642
+ };
2427
2643
  onMounted(() => {
2428
2644
  if (props.isSubMenu)
2429
2645
  return;
@@ -2434,81 +2650,47 @@ const _sfc_main$a = defineComponent({
2434
2650
  return;
2435
2651
  globalThis.removeEventListener("mousedown", hideHandler, true);
2436
2652
  });
2437
- return {
2438
- menu,
2439
- subMenu,
2440
- visible,
2441
- menuStyle,
2442
- subMenuData,
2653
+ expose({
2443
2654
  hide,
2444
- show(e) {
2445
- setTimeout(() => {
2446
- visible.value = true;
2447
- nextTick(() => {
2448
- const menuHeight = menu.value?.clientHeight || 0;
2449
- let top = e.clientY;
2450
- if (menuHeight + e.clientY > document.body.clientHeight) {
2451
- top = document.body.clientHeight - menuHeight;
2452
- }
2453
- menuStyle.value = {
2454
- top: `${top}px`,
2455
- left: `${e.clientX}px`
2456
- };
2457
- emit("show");
2458
- });
2459
- }, 300);
2460
- },
2461
- showSubMenu(item) {
2462
- const menuItem = item;
2463
- if (typeof item !== "object" || !menuItem.items?.length) {
2464
- return;
2465
- }
2466
- subMenuData.value = menuItem.items;
2467
- if (menu.value) {
2468
- subMenu.value.show({
2469
- clientX: menu.value.offsetLeft + menu.value.clientWidth,
2470
- clientY: menu.value.offsetTop
2471
- });
2472
- }
2473
- }
2655
+ show
2656
+ });
2657
+ return (_ctx, _cache) => {
2658
+ const _component_content_menu = resolveComponent("content-menu", true);
2659
+ return __props.menuData.length && visible.value ? (openBlock(), createElementBlock("div", {
2660
+ key: 0,
2661
+ class: "magic-editor-content-menu",
2662
+ ref_key: "menu",
2663
+ ref: menu,
2664
+ style: normalizeStyle(menuStyle.value)
2665
+ }, [
2666
+ createElementVNode("div", null, [
2667
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
2668
+ return openBlock(), createBlock(_sfc_main$f, {
2669
+ "event-type": "mouseup",
2670
+ data: item,
2671
+ key: index,
2672
+ onMouseup: hide,
2673
+ onMouseenter: ($event) => showSubMenu(item)
2674
+ }, null, 8, ["data", "onMouseenter"]);
2675
+ }), 128))
2676
+ ]),
2677
+ (openBlock(), createBlock(Teleport, { to: "body" }, [
2678
+ createVNode(_component_content_menu, {
2679
+ class: "sub-menu",
2680
+ ref_key: "subMenu",
2681
+ ref: subMenu,
2682
+ "menu-data": subMenuData.value,
2683
+ "is-sub-menu": true,
2684
+ onHide: hide
2685
+ }, null, 8, ["menu-data"])
2686
+ ]))
2687
+ ], 4)) : createCommentVNode("", true);
2474
2688
  };
2475
2689
  }
2476
2690
  });
2477
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
2478
- const _component_tool_button = resolveComponent("tool-button");
2479
- const _component_content_menu = resolveComponent("content-menu", true);
2480
- return _ctx.menuData.length && _ctx.visible ? (openBlock(), createElementBlock("div", {
2481
- key: 0,
2482
- class: "magic-editor-content-menu",
2483
- ref: "menu",
2484
- style: normalizeStyle(_ctx.menuStyle)
2485
- }, [
2486
- createElementVNode("div", null, [
2487
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
2488
- return openBlock(), createBlock(_component_tool_button, {
2489
- "event-type": "mouseup",
2490
- data: item,
2491
- key: index,
2492
- onMouseup: _ctx.hide,
2493
- onMouseenter: ($event) => _ctx.showSubMenu(item)
2494
- }, null, 8, ["data", "onMouseup", "onMouseenter"]);
2495
- }), 128))
2496
- ]),
2497
- (openBlock(), createBlock(Teleport, { to: "body" }, [
2498
- createVNode(_component_content_menu, {
2499
- class: "sub-menu",
2500
- ref: "subMenu",
2501
- "menu-data": _ctx.subMenuData,
2502
- "is-sub-menu": true,
2503
- onHide: _ctx.hide
2504
- }, null, 8, ["menu-data", "onHide"])
2505
- ]))
2506
- ], 4)) : createCommentVNode("", true);
2507
- }
2508
- var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
2509
2691
 
2510
- const _sfc_main$9 = defineComponent({
2511
- components: { ContentMenu },
2692
+ const _sfc_main$a = defineComponent({
2693
+ components: { ContentMenu: _sfc_main$b },
2512
2694
  setup() {
2513
2695
  const services = inject("services");
2514
2696
  const menu = ref();
@@ -2590,7 +2772,8 @@ const _sfc_main$9 = defineComponent({
2590
2772
  };
2591
2773
  }
2592
2774
  });
2593
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
2775
+
2776
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2594
2777
  const _component_content_menu = resolveComponent("content-menu");
2595
2778
  return openBlock(), createBlock(_component_content_menu, {
2596
2779
  "menu-data": _ctx.menuData,
@@ -2598,7 +2781,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
2598
2781
  style: { "overflow": "initial" }
2599
2782
  }, null, 8, ["menu-data"]);
2600
2783
  }
2601
- var LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
2784
+ const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$6]]);
2602
2785
 
2603
2786
  const throttleTime = 150;
2604
2787
  const select = async (data, editorService) => {
@@ -2698,7 +2881,7 @@ const useFilter = (tree) => ({
2698
2881
  tree.value?.filter(val);
2699
2882
  }
2700
2883
  });
2701
- const _sfc_main$8 = defineComponent({
2884
+ const _sfc_main$9 = defineComponent({
2702
2885
  name: "magic-editor-layer-panel",
2703
2886
  components: { LayerMenu },
2704
2887
  setup() {
@@ -2745,8 +2928,9 @@ const _sfc_main$8 = defineComponent({
2745
2928
  };
2746
2929
  }
2747
2930
  });
2931
+
2748
2932
  const _hoisted_1$4 = ["id", "onMouseenter"];
2749
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2933
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2750
2934
  const _component_el_input = resolveComponent("el-input");
2751
2935
  const _component_el_tree = resolveComponent("el-tree");
2752
2936
  const _component_layer_menu = resolveComponent("layer-menu");
@@ -2808,9 +2992,9 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2808
2992
  _: 3
2809
2993
  });
2810
2994
  }
2811
- var LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
2995
+ const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$5]]);
2812
2996
 
2813
- const _sfc_main$7 = defineComponent({
2997
+ const _sfc_main$8 = defineComponent({
2814
2998
  components: { MIcon },
2815
2999
  props: {
2816
3000
  data: {
@@ -2847,11 +3031,12 @@ const _sfc_main$7 = defineComponent({
2847
3031
  };
2848
3032
  }
2849
3033
  });
3034
+
2850
3035
  const _hoisted_1$3 = {
2851
3036
  key: 1,
2852
3037
  class: "magic-editor-tab-panel-title"
2853
3038
  };
2854
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
3039
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
2855
3040
  const _component_m_icon = resolveComponent("m-icon");
2856
3041
  const _component_el_tab_pane = resolveComponent("el-tab-pane");
2857
3042
  return _ctx.config ? (openBlock(), createBlock(_component_el_tab_pane, {
@@ -2897,9 +3082,9 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2897
3082
  _: 3
2898
3083
  }, 8, ["name"])) : createCommentVNode("", true);
2899
3084
  }
2900
- var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
3085
+ const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$4]]);
2901
3086
 
2902
- const _sfc_main$6 = defineComponent({
3087
+ const _sfc_main$7 = defineComponent({
2903
3088
  components: { TabPane },
2904
3089
  name: "m-sidebar",
2905
3090
  props: {
@@ -2918,7 +3103,8 @@ const _sfc_main$6 = defineComponent({
2918
3103
  };
2919
3104
  }
2920
3105
  });
2921
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3106
+
3107
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
2922
3108
  const _component_tab_pane = resolveComponent("tab-pane");
2923
3109
  const _component_el_tabs = resolveComponent("el-tabs");
2924
3110
  return _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createBlock(_component_el_tabs, {
@@ -2953,331 +3139,258 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2953
3139
  _: 3
2954
3140
  }, 8, ["modelValue"])) : createCommentVNode("", true);
2955
3141
  }
2956
- var Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
3142
+ const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3]]);
2957
3143
 
2958
- const useScroll = (root) => {
2959
- const pageBar = ref();
2960
- const itemsContainer = ref();
2961
- const pageBarWidth = ref(0);
2962
- const canScroll = ref(false);
2963
- const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
2964
- let translateLeft = 0;
2965
- const resizeObserver = new ResizeObserver((entries) => {
2966
- for (const { contentRect } of entries) {
2967
- const { width } = contentRect;
2968
- pageBarWidth.value = width || 0;
2969
- setCanScroll();
2970
- }
2971
- });
2972
- const setCanScroll = () => {
2973
- if (itemsContainer.value) {
2974
- canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
2975
- }
2976
- };
2977
- const scroll = (type) => {
2978
- if (!itemsContainer.value)
2979
- return;
2980
- const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
2981
- if (type === "left") {
2982
- translateLeft += 100;
2983
- if (translateLeft > 0) {
2984
- translateLeft = 0;
3144
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3145
+ __name: "PageBarScrollContainer",
3146
+ setup(__props) {
3147
+ const services = inject("services");
3148
+ const editorService = services?.editorService;
3149
+ const pageBar = ref();
3150
+ const itemsContainer = ref();
3151
+ const pageBarWidth = ref(0);
3152
+ const canScroll = ref(false);
3153
+ const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
3154
+ let translateLeft = 0;
3155
+ const resizeObserver = new ResizeObserver((entries) => {
3156
+ for (const { contentRect } of entries) {
3157
+ const { width } = contentRect;
3158
+ pageBarWidth.value = width || 0;
3159
+ setCanScroll();
2985
3160
  }
2986
- } else if (type === "right") {
2987
- translateLeft -= 100;
2988
- if (-translateLeft > maxScrollLeft) {
2989
- translateLeft = -maxScrollLeft;
3161
+ });
3162
+ const setCanScroll = () => {
3163
+ if (itemsContainer.value) {
3164
+ canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
2990
3165
  }
2991
- } else if (type === "start") {
2992
- translateLeft = 0;
2993
- } else if (type === "end") {
2994
- translateLeft = -maxScrollLeft;
2995
- }
2996
- itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
2997
- };
2998
- onMounted(() => {
2999
- pageBar.value && resizeObserver.observe(pageBar.value);
3000
- });
3001
- onUnmounted(() => {
3002
- resizeObserver.disconnect();
3003
- });
3004
- watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
3005
- setTimeout(() => {
3006
- setCanScroll();
3007
- if (length < preLength) {
3008
- scroll("start");
3009
- } else {
3010
- scroll("end");
3166
+ };
3167
+ const scroll = (type) => {
3168
+ if (!itemsContainer.value)
3169
+ return;
3170
+ const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
3171
+ if (type === "left") {
3172
+ translateLeft += 100;
3173
+ if (translateLeft > 0) {
3174
+ translateLeft = 0;
3175
+ }
3176
+ } else if (type === "right") {
3177
+ translateLeft -= 100;
3178
+ if (-translateLeft > maxScrollLeft) {
3179
+ translateLeft = -maxScrollLeft;
3180
+ }
3181
+ } else if (type === "start") {
3182
+ translateLeft = 0;
3183
+ } else if (type === "end") {
3184
+ translateLeft = -maxScrollLeft;
3011
3185
  }
3186
+ itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
3187
+ };
3188
+ onMounted(() => {
3189
+ pageBar.value && resizeObserver.observe(pageBar.value);
3190
+ });
3191
+ onUnmounted(() => {
3192
+ resizeObserver.disconnect();
3012
3193
  });
3013
- });
3014
- return {
3015
- pageBar,
3016
- itemsContainer,
3017
- canScroll,
3018
- itemsContainerWidth,
3019
- scroll
3020
- };
3021
- };
3022
- const _sfc_main$5 = defineComponent({
3023
- components: { ArrowLeftBold, ArrowRightBold, CaretBottom, Plus, ToolButton },
3024
- setup() {
3025
- const services = inject("services");
3026
- const editorService = services?.editorService;
3027
3194
  const root = computed(() => editorService?.get("root"));
3028
- return {
3029
- Delete: markRaw(Delete),
3030
- DocumentCopy: markRaw(DocumentCopy),
3031
- ...useScroll(root),
3032
- root,
3033
- page: computed(() => editorService?.get("page")),
3034
- switchPage(page) {
3035
- editorService?.select(page);
3036
- },
3037
- addPage() {
3038
- if (!editorService)
3039
- return;
3040
- const pageConfig = {
3041
- type: NodeType.PAGE,
3042
- name: generatePageNameByApp(toRaw(editorService.get("root")))
3043
- };
3044
- editorService.add(pageConfig);
3045
- },
3046
- copy(node) {
3047
- node && editorService?.copy(node);
3048
- editorService?.paste({
3049
- left: 0,
3050
- top: 0
3051
- });
3052
- },
3053
- remove(node) {
3054
- editorService?.remove(node);
3055
- }
3195
+ watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
3196
+ setTimeout(() => {
3197
+ setCanScroll();
3198
+ if (length < preLength) {
3199
+ scroll("start");
3200
+ } else {
3201
+ scroll("end");
3202
+ }
3203
+ });
3204
+ });
3205
+ const addPage = () => {
3206
+ if (!editorService)
3207
+ return;
3208
+ const pageConfig = {
3209
+ type: NodeType.PAGE,
3210
+ name: generatePageNameByApp(toRaw(editorService.get("root")))
3211
+ };
3212
+ editorService.add(pageConfig);
3056
3213
  };
3057
- }
3058
- });
3059
- const _hoisted_1$2 = {
3060
- class: "m-editor-page-bar",
3061
- ref: "pageBar"
3062
- };
3063
- const _hoisted_2 = ["onClick"];
3064
- const _hoisted_3 = { class: "m-editor-page-bar-title" };
3065
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
3066
- const _component_plus = resolveComponent("plus");
3067
- const _component_el_icon = resolveComponent("el-icon");
3068
- const _component_arrow_left_bold = resolveComponent("arrow-left-bold");
3069
- const _component_el_tooltip = resolveComponent("el-tooltip");
3070
- const _component_tool_button = resolveComponent("tool-button");
3071
- const _component_caret_bottom = resolveComponent("caret-bottom");
3072
- const _component_el_popover = resolveComponent("el-popover");
3073
- const _component_arrow_right_bold = resolveComponent("arrow-right-bold");
3074
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
3075
- createElementVNode("div", {
3076
- id: "m-editor-page-bar-add-icon",
3077
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3078
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.addPage && _ctx.addPage(...args))
3079
- }, [
3080
- createVNode(_component_el_icon, null, {
3081
- default: withCtx(() => [
3082
- createVNode(_component_plus)
3083
- ]),
3084
- _: 1
3085
- })
3086
- ]),
3087
- _ctx.canScroll ? (openBlock(), createElementBlock("div", {
3088
- key: 0,
3089
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3090
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.scroll("left"))
3091
- }, [
3092
- createVNode(_component_el_icon, null, {
3093
- default: withCtx(() => [
3094
- createVNode(_component_arrow_left_bold)
3214
+ return (_ctx, _cache) => {
3215
+ const _component_el_icon = resolveComponent("el-icon");
3216
+ return openBlock(), createElementBlock("div", {
3217
+ class: "m-editor-page-bar",
3218
+ ref_key: "pageBar",
3219
+ ref: pageBar
3220
+ }, [
3221
+ createElementVNode("div", {
3222
+ id: "m-editor-page-bar-add-icon",
3223
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3224
+ onClick: addPage
3225
+ }, [
3226
+ createVNode(_component_el_icon, null, {
3227
+ default: withCtx(() => [
3228
+ createVNode(unref(Plus))
3229
+ ]),
3230
+ _: 1
3231
+ })
3095
3232
  ]),
3096
- _: 1
3097
- })
3098
- ])) : createCommentVNode("", true),
3099
- _ctx.root ? (openBlock(), createElementBlock("div", {
3100
- key: 1,
3101
- class: "m-editor-page-bar-items",
3102
- ref: "itemsContainer",
3103
- style: normalizeStyle(`width: ${_ctx.itemsContainerWidth}px`)
3104
- }, [
3105
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.items, (item) => {
3106
- return openBlock(), createElementBlock("div", {
3107
- key: item.key,
3108
- class: normalizeClass(["m-editor-page-bar-item", { active: _ctx.page?.id === item.id }]),
3109
- onClick: ($event) => _ctx.switchPage(item)
3233
+ canScroll.value ? (openBlock(), createElementBlock("div", {
3234
+ key: 0,
3235
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3236
+ onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
3110
3237
  }, [
3111
- createElementVNode("div", _hoisted_3, [
3112
- renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
3113
- createVNode(_component_el_tooltip, {
3114
- effect: "dark",
3115
- placement: "top-start",
3116
- content: item.name
3117
- }, {
3118
- default: withCtx(() => [
3119
- createElementVNode("span", null, toDisplayString(item.name), 1)
3120
- ]),
3121
- _: 2
3122
- }, 1032, ["content"])
3123
- ])
3124
- ]),
3125
- createVNode(_component_el_popover, {
3126
- "popper-class": "page-bar-popover",
3127
- placement: "top",
3128
- width: 160,
3129
- trigger: "hover"
3130
- }, {
3131
- reference: withCtx(() => [
3132
- createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
3133
- default: withCtx(() => [
3134
- createVNode(_component_caret_bottom)
3135
- ]),
3136
- _: 1
3137
- })
3238
+ createVNode(_component_el_icon, null, {
3239
+ default: withCtx(() => [
3240
+ createVNode(unref(ArrowLeftBold))
3138
3241
  ]),
3242
+ _: 1
3243
+ })
3244
+ ])) : createCommentVNode("", true),
3245
+ unref(root) ? (openBlock(), createElementBlock("div", {
3246
+ key: 1,
3247
+ class: "m-editor-page-bar-items",
3248
+ ref_key: "itemsContainer",
3249
+ ref: itemsContainer,
3250
+ style: normalizeStyle(`width: ${unref(itemsContainerWidth)}px`)
3251
+ }, [
3252
+ renderSlot(_ctx.$slots, "default")
3253
+ ], 4)) : createCommentVNode("", true),
3254
+ canScroll.value ? (openBlock(), createElementBlock("div", {
3255
+ key: 2,
3256
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3257
+ onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
3258
+ }, [
3259
+ createVNode(_component_el_icon, null, {
3139
3260
  default: withCtx(() => [
3140
- createElementVNode("div", null, [
3141
- renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
3142
- createVNode(_component_tool_button, {
3143
- data: {
3144
- type: "button",
3145
- text: "\u590D\u5236",
3146
- icon: _ctx.DocumentCopy,
3147
- handler: () => _ctx.copy(item)
3148
- }
3149
- }, null, 8, ["data"]),
3150
- createVNode(_component_tool_button, {
3151
- data: {
3152
- type: "button",
3153
- text: "\u5220\u9664",
3154
- icon: _ctx.Delete,
3155
- handler: () => _ctx.remove(item)
3156
- }
3157
- }, null, 8, ["data"])
3158
- ])
3159
- ])
3261
+ createVNode(unref(ArrowRightBold))
3160
3262
  ]),
3161
- _: 2
3162
- }, 1024)
3163
- ], 10, _hoisted_2);
3164
- }), 128))
3165
- ], 4)) : createCommentVNode("", true),
3166
- _ctx.canScroll ? (openBlock(), createElementBlock("div", {
3167
- key: 2,
3168
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3169
- onClick: _cache[2] || (_cache[2] = ($event) => _ctx.scroll("right"))
3170
- }, [
3171
- createVNode(_component_el_icon, null, {
3172
- default: withCtx(() => [
3173
- createVNode(_component_arrow_right_bold)
3174
- ]),
3175
- _: 1
3176
- })
3177
- ])) : createCommentVNode("", true)
3178
- ], 512);
3179
- }
3180
- var PageBar = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
3181
-
3182
- class ScrollViewer$1 {
3183
- constructor(options) {
3184
- this.enter = false;
3185
- this.targetEnter = false;
3186
- this.keydown = false;
3187
- this.zoom = 1;
3188
- this.scrollLeft = 0;
3189
- this.scrollTop = 0;
3190
- this.x = 0;
3191
- this.y = 0;
3192
- this.resizeObserver = new ResizeObserver((entries) => {
3193
- for (const { contentRect } of entries) {
3194
- const { width, height } = contentRect;
3195
- const targetRect = this.target.getBoundingClientRect();
3196
- const targetWidth = targetRect.width * this.zoom;
3197
- const targetMarginTop = Number(this.target.style.marginTop) || 0;
3198
- const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
3199
- if (targetWidth < width) {
3200
- this.target._left = 0;
3201
- }
3202
- if (targetHeight < height) {
3203
- this.target._top = 0;
3204
- }
3205
- this.scroll();
3206
- }
3207
- });
3208
- this.wheelHandler = (event) => {
3209
- if (this.targetEnter)
3210
- return;
3211
- const { deltaX, deltaY, currentTarget } = event;
3212
- if (currentTarget !== this.container)
3213
- return;
3214
- this.setScrollOffset(deltaX, deltaY);
3215
- this.scroll();
3216
- this.scrollLeft = this.target._left;
3217
- this.scrollTop = this.target._top;
3218
- };
3219
- this.mouseEnterHandler = () => {
3220
- this.enter = true;
3221
- };
3222
- this.mouseLeaveHandler = () => {
3223
- this.enter = false;
3224
- };
3225
- this.targetMouseEnterHandler = () => {
3226
- this.targetEnter = true;
3263
+ _: 1
3264
+ })
3265
+ ])) : createCommentVNode("", true)
3266
+ ], 512);
3227
3267
  };
3228
- this.targetMouseLeaveHandler = () => {
3229
- this.targetEnter = false;
3268
+ }
3269
+ });
3270
+
3271
+ const _hoisted_1$2 = ["onClick"];
3272
+ const _hoisted_2 = { class: "m-editor-page-bar-title" };
3273
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3274
+ __name: "PageBar",
3275
+ setup(__props) {
3276
+ const services = inject("services");
3277
+ const editorService = services?.editorService;
3278
+ const root = computed(() => editorService?.get("root"));
3279
+ const page = computed(() => editorService?.get("page"));
3280
+ const switchPage = (page2) => {
3281
+ editorService?.select(page2);
3230
3282
  };
3231
- this.mousedownHandler = (event) => {
3232
- if (!this.keydown)
3233
- return;
3234
- event.stopImmediatePropagation();
3235
- event.stopPropagation();
3236
- this.target.style.cursor = "grabbing";
3237
- this.x = event.clientX;
3238
- this.y = event.clientY;
3239
- document.addEventListener("mousemove", this.mousemoveHandler);
3240
- document.addEventListener("mouseup", this.mouseupHandler);
3283
+ const copy = (node) => {
3284
+ node && editorService?.copy(node);
3285
+ editorService?.paste({
3286
+ left: 0,
3287
+ top: 0
3288
+ });
3241
3289
  };
3242
- this.mouseupHandler = () => {
3243
- this.x = 0;
3244
- this.y = 0;
3245
- this.scrollLeft = this.target._left;
3246
- this.scrollTop = this.target._top;
3247
- this.removeHandler();
3290
+ const remove = (node) => {
3291
+ editorService?.remove(node);
3248
3292
  };
3249
- this.mousemoveHandler = (event) => {
3250
- event.stopImmediatePropagation();
3251
- event.stopPropagation();
3252
- const deltaX = event.clientX - this.x;
3253
- const deltaY = event.clientY - this.y;
3254
- this.setScrollOffset(deltaX, deltaY);
3255
- this.scroll();
3293
+ return (_ctx, _cache) => {
3294
+ const _component_el_tooltip = resolveComponent("el-tooltip");
3295
+ const _component_el_icon = resolveComponent("el-icon");
3296
+ const _component_el_popover = resolveComponent("el-popover");
3297
+ return openBlock(), createBlock(_sfc_main$6, null, {
3298
+ default: withCtx(() => [
3299
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(root) && unref(root).items || [], (item) => {
3300
+ return openBlock(), createElementBlock("div", {
3301
+ class: normalizeClass(["m-editor-page-bar-item", { active: unref(page)?.id === item.id }]),
3302
+ key: item.key,
3303
+ onClick: ($event) => switchPage(item)
3304
+ }, [
3305
+ createElementVNode("div", _hoisted_2, [
3306
+ renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
3307
+ createVNode(_component_el_tooltip, {
3308
+ effect: "dark",
3309
+ placement: "top-start",
3310
+ content: item.name
3311
+ }, {
3312
+ default: withCtx(() => [
3313
+ createElementVNode("span", null, toDisplayString(item.name), 1)
3314
+ ]),
3315
+ _: 2
3316
+ }, 1032, ["content"])
3317
+ ])
3318
+ ]),
3319
+ createVNode(_component_el_popover, {
3320
+ "popper-class": "page-bar-popover",
3321
+ placement: "top",
3322
+ width: 160,
3323
+ trigger: "hover"
3324
+ }, {
3325
+ reference: withCtx(() => [
3326
+ createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
3327
+ default: withCtx(() => [
3328
+ createVNode(unref(CaretBottom))
3329
+ ]),
3330
+ _: 1
3331
+ })
3332
+ ]),
3333
+ default: withCtx(() => [
3334
+ createElementVNode("div", null, [
3335
+ renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
3336
+ createVNode(_sfc_main$f, {
3337
+ data: {
3338
+ type: "button",
3339
+ text: "\u590D\u5236",
3340
+ icon: unref(DocumentCopy),
3341
+ handler: () => copy(item)
3342
+ }
3343
+ }, null, 8, ["data"]),
3344
+ createVNode(_sfc_main$f, {
3345
+ data: {
3346
+ type: "button",
3347
+ text: "\u5220\u9664",
3348
+ icon: unref(Delete),
3349
+ handler: () => remove(item)
3350
+ }
3351
+ }, null, 8, ["data"])
3352
+ ])
3353
+ ])
3354
+ ]),
3355
+ _: 2
3356
+ }, 1024)
3357
+ ], 10, _hoisted_1$2);
3358
+ }), 128))
3359
+ ]),
3360
+ _: 3
3361
+ });
3256
3362
  };
3257
- this.keydownHandler = (event) => {
3258
- if (event.code === Keys.ESCAPE && this.enter) {
3259
- event.preventDefault();
3260
- event.stopImmediatePropagation();
3261
- event.stopPropagation();
3262
- }
3263
- if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
3264
- return;
3363
+ }
3364
+ });
3365
+
3366
+ class ScrollViewer$1 {
3367
+ enter = false;
3368
+ targetEnter = false;
3369
+ keydown = false;
3370
+ container;
3371
+ target;
3372
+ zoom = 1;
3373
+ scrollLeft = 0;
3374
+ scrollTop = 0;
3375
+ x = 0;
3376
+ y = 0;
3377
+ resizeObserver = new ResizeObserver((entries) => {
3378
+ for (const { contentRect } of entries) {
3379
+ const { width, height } = contentRect;
3380
+ const targetRect = this.target.getBoundingClientRect();
3381
+ const targetWidth = targetRect.width * this.zoom;
3382
+ const targetMarginTop = Number(this.target.style.marginTop) || 0;
3383
+ const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
3384
+ if (targetWidth < width) {
3385
+ this.target._left = 0;
3265
3386
  }
3266
- this.keydown = true;
3267
- this.target.style.cursor = "grab";
3268
- this.container.addEventListener("mousedown", this.mousedownHandler);
3269
- };
3270
- this.keyupHandler = (event) => {
3271
- if (event.code !== Keys.ESCAPE || !this.keydown) {
3272
- return;
3387
+ if (targetHeight < height) {
3388
+ this.target._top = 0;
3273
3389
  }
3274
- event.preventDefault();
3275
- event.stopImmediatePropagation();
3276
- event.stopPropagation();
3277
- this.keydown = false;
3278
- event.preventDefault();
3279
- this.removeHandler();
3280
- };
3390
+ this.scroll();
3391
+ }
3392
+ });
3393
+ constructor(options) {
3281
3394
  this.container = options.container;
3282
3395
  this.target = options.target;
3283
3396
  this.zoom = options.zoom;
@@ -3313,6 +3426,79 @@ class ScrollViewer$1 {
3313
3426
  document.removeEventListener("mousemove", this.mousemoveHandler);
3314
3427
  document.removeEventListener("mouseup", this.mouseupHandler);
3315
3428
  }
3429
+ wheelHandler = (event) => {
3430
+ if (this.targetEnter)
3431
+ return;
3432
+ const { deltaX, deltaY, currentTarget } = event;
3433
+ if (currentTarget !== this.container)
3434
+ return;
3435
+ this.setScrollOffset(deltaX, deltaY);
3436
+ this.scroll();
3437
+ this.scrollLeft = this.target._left;
3438
+ this.scrollTop = this.target._top;
3439
+ };
3440
+ mouseEnterHandler = () => {
3441
+ this.enter = true;
3442
+ };
3443
+ mouseLeaveHandler = () => {
3444
+ this.enter = false;
3445
+ };
3446
+ targetMouseEnterHandler = () => {
3447
+ this.targetEnter = true;
3448
+ };
3449
+ targetMouseLeaveHandler = () => {
3450
+ this.targetEnter = false;
3451
+ };
3452
+ mousedownHandler = (event) => {
3453
+ if (!this.keydown)
3454
+ return;
3455
+ event.stopImmediatePropagation();
3456
+ event.stopPropagation();
3457
+ this.target.style.cursor = "grabbing";
3458
+ this.x = event.clientX;
3459
+ this.y = event.clientY;
3460
+ document.addEventListener("mousemove", this.mousemoveHandler);
3461
+ document.addEventListener("mouseup", this.mouseupHandler);
3462
+ };
3463
+ mouseupHandler = () => {
3464
+ this.x = 0;
3465
+ this.y = 0;
3466
+ this.scrollLeft = this.target._left;
3467
+ this.scrollTop = this.target._top;
3468
+ this.removeHandler();
3469
+ };
3470
+ mousemoveHandler = (event) => {
3471
+ event.stopImmediatePropagation();
3472
+ event.stopPropagation();
3473
+ const deltaX = event.clientX - this.x;
3474
+ const deltaY = event.clientY - this.y;
3475
+ this.setScrollOffset(deltaX, deltaY);
3476
+ this.scroll();
3477
+ };
3478
+ keydownHandler = (event) => {
3479
+ if (event.code === Keys.ESCAPE && this.enter) {
3480
+ event.preventDefault();
3481
+ event.stopImmediatePropagation();
3482
+ event.stopPropagation();
3483
+ }
3484
+ if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
3485
+ return;
3486
+ }
3487
+ this.keydown = true;
3488
+ this.target.style.cursor = "grab";
3489
+ this.container.addEventListener("mousedown", this.mousedownHandler);
3490
+ };
3491
+ keyupHandler = (event) => {
3492
+ if (event.code !== Keys.ESCAPE || !this.keydown) {
3493
+ return;
3494
+ }
3495
+ event.preventDefault();
3496
+ event.stopImmediatePropagation();
3497
+ event.stopPropagation();
3498
+ this.keydown = false;
3499
+ event.preventDefault();
3500
+ this.removeHandler();
3501
+ };
3316
3502
  setScrollOffset(deltaX, deltaY) {
3317
3503
  const { width, height } = this.container.getBoundingClientRect();
3318
3504
  const targetRect = this.target.getBoundingClientRect();
@@ -3380,11 +3566,12 @@ const _sfc_main$4 = defineComponent({
3380
3566
  };
3381
3567
  }
3382
3568
  });
3569
+
3383
3570
  const _hoisted_1$1 = {
3384
3571
  class: "m-editor-scroll-viewer-container",
3385
3572
  ref: "container"
3386
3573
  };
3387
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3574
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3388
3575
  return openBlock(), createElementBlock("div", _hoisted_1$1, [
3389
3576
  createElementVNode("div", {
3390
3577
  ref: "el",
@@ -3394,170 +3581,170 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3394
3581
  ], 4)
3395
3582
  ], 512);
3396
3583
  }
3397
- var ScrollViewer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
3584
+ const ScrollViewer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$2]]);
3398
3585
 
3399
- const _sfc_main$3 = defineComponent({
3400
- components: { ContentMenu },
3401
- setup() {
3586
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3587
+ __name: "ViewerMenu",
3588
+ props: {
3589
+ isMultiSelect: { type: Boolean, default: false }
3590
+ },
3591
+ setup(__props, { expose }) {
3592
+ const props = __props;
3402
3593
  const services = inject("services");
3403
3594
  const editorService = services?.editorService;
3404
3595
  const menu = ref();
3405
3596
  const canPaste = ref(false);
3406
3597
  const canCenter = ref(false);
3407
3598
  const node = computed(() => editorService?.get("node"));
3599
+ const nodes = computed(() => editorService?.get("nodes"));
3408
3600
  const parent = computed(() => editorService?.get("parent"));
3409
- const isPage = computed(() => node.value?.type === NodeType.PAGE);
3601
+ const stage = computed(() => editorService?.get("stage"));
3410
3602
  const stageContentMenu = inject("stageContentMenu", []);
3411
- onMounted(() => {
3412
- const data = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
3413
- canPaste.value = data !== "undefined" && !!data;
3414
- });
3603
+ const menuData = reactive([
3604
+ {
3605
+ type: "button",
3606
+ text: "\u6C34\u5E73\u5C45\u4E2D",
3607
+ display: () => canCenter.value && !props.isMultiSelect,
3608
+ handler: () => {
3609
+ if (!node.value)
3610
+ return;
3611
+ editorService?.alignCenter(node.value);
3612
+ }
3613
+ },
3614
+ {
3615
+ type: "button",
3616
+ text: "\u590D\u5236",
3617
+ icon: markRaw(DocumentCopy),
3618
+ handler: () => {
3619
+ nodes.value && editorService?.copy(nodes.value);
3620
+ canPaste.value = true;
3621
+ }
3622
+ },
3623
+ {
3624
+ type: "button",
3625
+ text: "\u7C98\u8D34",
3626
+ display: () => canPaste.value,
3627
+ handler: () => {
3628
+ const rect = menu.value?.$el.getBoundingClientRect();
3629
+ const parentRect = stage.value?.container?.getBoundingClientRect();
3630
+ const initialLeft = (rect?.left || 0) - (parentRect?.left || 0);
3631
+ const initialTop = (rect?.top || 0) - (parentRect?.top || 0);
3632
+ if (!nodes.value || nodes.value.length === 0)
3633
+ return;
3634
+ editorService?.paste({ left: initialLeft, top: initialTop });
3635
+ }
3636
+ },
3637
+ {
3638
+ type: "divider",
3639
+ direction: "horizontal",
3640
+ display: () => {
3641
+ if (!node.value)
3642
+ return false;
3643
+ return !isPage(node.value);
3644
+ }
3645
+ },
3646
+ {
3647
+ type: "button",
3648
+ text: "\u4E0A\u79FB\u4E00\u5C42",
3649
+ icon: markRaw(Top),
3650
+ display: () => !isPage(node.value) && !props.isMultiSelect,
3651
+ handler: () => {
3652
+ editorService?.moveLayer(1);
3653
+ }
3654
+ },
3655
+ {
3656
+ type: "button",
3657
+ text: "\u4E0B\u79FB\u4E00\u5C42",
3658
+ icon: markRaw(Bottom),
3659
+ display: () => !isPage(node.value) && !props.isMultiSelect,
3660
+ handler: () => {
3661
+ editorService?.moveLayer(-1);
3662
+ }
3663
+ },
3664
+ {
3665
+ type: "button",
3666
+ text: "\u7F6E\u9876",
3667
+ display: () => !isPage(node.value) && !props.isMultiSelect,
3668
+ handler: () => {
3669
+ editorService?.moveLayer(LayerOffset.TOP);
3670
+ }
3671
+ },
3672
+ {
3673
+ type: "button",
3674
+ text: "\u7F6E\u5E95",
3675
+ display: () => !isPage(node.value) && !props.isMultiSelect,
3676
+ handler: () => {
3677
+ editorService?.moveLayer(LayerOffset.BOTTOM);
3678
+ }
3679
+ },
3680
+ {
3681
+ type: "divider",
3682
+ direction: "horizontal",
3683
+ display: () => !isPage(node.value) && !props.isMultiSelect
3684
+ },
3685
+ {
3686
+ type: "button",
3687
+ text: "\u5220\u9664",
3688
+ icon: Delete,
3689
+ display: () => !isPage(node.value),
3690
+ handler: () => {
3691
+ nodes.value && editorService?.remove(nodes.value);
3692
+ }
3693
+ },
3694
+ {
3695
+ type: "divider",
3696
+ direction: "horizontal"
3697
+ },
3698
+ {
3699
+ type: "button",
3700
+ text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
3701
+ handler: () => {
3702
+ editorService?.get("stage").clearGuides();
3703
+ }
3704
+ },
3705
+ ...stageContentMenu
3706
+ ]);
3415
3707
  watch(parent, async () => {
3416
3708
  if (!parent.value || !editorService)
3417
3709
  return canCenter.value = false;
3418
3710
  const layout = await editorService.getLayout(parent.value);
3419
- canCenter.value = [Layout.ABSOLUTE, Layout.FIXED].includes(layout) && ![NodeType.ROOT, NodeType.PAGE, "pop"].includes(`${node.value?.type}`);
3711
+ const isLayoutConform = [Layout.ABSOLUTE, Layout.FIXED].includes(layout);
3712
+ const isTypeConform = nodes.value?.every((selectedNode) => ![NodeType.ROOT, NodeType.PAGE, "pop"].includes(`${selectedNode?.type}`));
3713
+ canCenter.value = isLayoutConform && !!isTypeConform;
3420
3714
  }, { immediate: true });
3421
- return {
3422
- menu,
3423
- menuData: reactive([
3424
- {
3425
- type: "button",
3426
- text: "\u6C34\u5E73\u5C45\u4E2D",
3427
- display: () => canCenter.value,
3428
- handler: () => {
3429
- node.value && editorService?.alignCenter(node.value);
3430
- }
3431
- },
3432
- {
3433
- type: "button",
3434
- text: "\u590D\u5236",
3435
- icon: markRaw(DocumentCopy),
3436
- handler: () => {
3437
- node.value && editorService?.copy(node.value);
3438
- canPaste.value = true;
3439
- }
3440
- },
3441
- {
3442
- type: "button",
3443
- text: "\u7C98\u8D34",
3444
- display: () => canPaste.value,
3445
- handler: () => {
3446
- const stage = editorService?.get("stage");
3447
- const rect = menu.value?.$el.getBoundingClientRect();
3448
- const parentRect = stage?.container?.getBoundingClientRect();
3449
- let left = (rect?.left || 0) - (parentRect?.left || 0);
3450
- let top = (rect?.top || 0) - (parentRect?.top || 0);
3451
- if (node.value?.items && stage) {
3452
- const parentEl = stage.renderer.contentWindow?.document.getElementById(`${node.value.id}`);
3453
- const parentElRect = parentEl?.getBoundingClientRect();
3454
- left = left - (parentElRect?.left || 0);
3455
- top = top - (parentElRect?.top || 0);
3456
- }
3457
- editorService?.paste({ left, top });
3458
- }
3459
- },
3460
- {
3461
- type: "divider",
3462
- direction: "horizontal",
3463
- display: () => !isPage.value
3464
- },
3465
- {
3466
- type: "button",
3467
- text: "\u4E0A\u79FB\u4E00\u5C42",
3468
- icon: markRaw(Top),
3469
- display: () => !isPage.value,
3470
- handler: () => {
3471
- editorService?.moveLayer(1);
3472
- }
3473
- },
3474
- {
3475
- type: "button",
3476
- text: "\u4E0B\u79FB\u4E00\u5C42",
3477
- icon: markRaw(Bottom),
3478
- display: () => !isPage.value,
3479
- handler: () => {
3480
- editorService?.moveLayer(-1);
3481
- }
3482
- },
3483
- {
3484
- type: "button",
3485
- text: "\u7F6E\u9876",
3486
- display: () => !isPage.value,
3487
- handler: () => {
3488
- editorService?.moveLayer(LayerOffset.TOP);
3489
- }
3490
- },
3491
- {
3492
- type: "button",
3493
- text: "\u7F6E\u5E95",
3494
- display: () => !isPage.value,
3495
- handler: () => {
3496
- editorService?.moveLayer(LayerOffset.BOTTOM);
3497
- }
3498
- },
3499
- {
3500
- type: "divider",
3501
- direction: "horizontal",
3502
- display: () => !isPage.value
3503
- },
3504
- {
3505
- type: "button",
3506
- text: "\u5220\u9664",
3507
- icon: Delete,
3508
- display: () => !isPage.value,
3509
- handler: () => {
3510
- node.value && editorService?.remove(node.value);
3511
- }
3512
- },
3513
- {
3514
- type: "divider",
3515
- direction: "horizontal"
3516
- },
3517
- {
3518
- type: "button",
3519
- text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
3520
- handler: () => {
3521
- editorService?.get("stage").clearGuides();
3522
- }
3523
- },
3524
- ...stageContentMenu
3525
- ]),
3526
- show(e) {
3527
- menu.value?.show(e);
3528
- }
3715
+ const show = async (e) => {
3716
+ menu.value?.show(e);
3717
+ const data = await storageService.getItem(COPY_STORAGE_KEY);
3718
+ canPaste.value = data !== "undefined" && !!data;
3719
+ };
3720
+ expose({ show });
3721
+ return (_ctx, _cache) => {
3722
+ return openBlock(), createBlock(_sfc_main$b, {
3723
+ "menu-data": menuData,
3724
+ ref_key: "menu",
3725
+ ref: menu
3726
+ }, null, 8, ["menu-data"]);
3529
3727
  };
3530
3728
  }
3531
3729
  });
3532
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
3533
- const _component_content_menu = resolveComponent("content-menu");
3534
- return openBlock(), createBlock(_component_content_menu, {
3535
- "menu-data": _ctx.menuData,
3536
- ref: "menu"
3537
- }, null, 8, ["menu-data"]);
3538
- }
3539
- var ViewerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
3540
3730
 
3541
- const _sfc_main$2 = defineComponent({
3542
- name: "magic-stage",
3543
- components: {
3544
- ViewerMenu,
3545
- ScrollViewer
3546
- },
3547
- setup() {
3731
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3732
+ __name: "Stage",
3733
+ setup(__props) {
3734
+ let stage = null;
3735
+ let runtime = null;
3548
3736
  const services = inject("services");
3549
3737
  const stageOptions = inject("stageOptions");
3550
3738
  const stageWrap = ref();
3551
3739
  const stageContainer = ref();
3552
3740
  const menu = ref();
3741
+ const isMultiSelect = computed(() => services?.editorService.get("nodes")?.length > 1);
3553
3742
  const stageRect = computed(() => services?.uiService.get("stageRect"));
3554
3743
  const uiSelectMode = computed(() => services?.uiService.get("uiSelectMode"));
3555
3744
  const root = computed(() => services?.editorService.get("root"));
3556
3745
  const page = computed(() => services?.editorService.get("page"));
3557
3746
  const zoom = computed(() => services?.uiService.get("zoom") || 1);
3558
3747
  const node = computed(() => services?.editorService.get("node"));
3559
- let stage = null;
3560
- let runtime = null;
3561
3748
  const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
3562
3749
  watchEffect(() => {
3563
3750
  if (stage)
@@ -3597,6 +3784,9 @@ const _sfc_main$2 = defineComponent({
3597
3784
  stage?.on("highlight", (el) => {
3598
3785
  services?.editorService.highlight(el.id);
3599
3786
  });
3787
+ stage?.on("multiSelect", (els) => {
3788
+ services?.editorService.multiSelect(els.map((el) => el.id));
3789
+ });
3600
3790
  stage?.on("update", (ev) => {
3601
3791
  if (ev.parentEl) {
3602
3792
  services?.editorService.moveToContainer({ id: ev.el.id, style: ev.style }, ev.parentEl.id);
@@ -3655,100 +3845,96 @@ const _sfc_main$2 = defineComponent({
3655
3845
  resizeObserver.disconnect();
3656
3846
  services?.editorService.set("stage", null);
3657
3847
  });
3658
- return {
3659
- stageWrap,
3660
- stageContainer,
3661
- menu,
3662
- stageRect,
3663
- zoom,
3664
- contextmenuHandler(e2) {
3665
- e2.preventDefault();
3666
- menu.value?.show(e2);
3667
- },
3668
- dragoverHandler(e2) {
3669
- e2.preventDefault();
3670
- if (e2.dataTransfer) {
3671
- e2.dataTransfer.dropEffect = "move";
3672
- }
3673
- },
3674
- async dropHandler(e) {
3675
- e.preventDefault();
3676
- const doc = stage?.renderer.contentWindow?.document;
3677
- const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
3678
- let parent = page.value;
3679
- if (parentEl) {
3680
- parent = services?.editorService.getNodeById(parentEl.id, false);
3681
- }
3682
- if (e.dataTransfer && parent && stageContainer.value && stage) {
3683
- const config = eval(`(${e.dataTransfer.getData("data")})`);
3684
- const layout = await services?.editorService.getLayout(parent);
3685
- const containerRect = stageContainer.value.getBoundingClientRect();
3686
- const { scrollTop, scrollLeft } = stage.mask;
3687
- const { style = {} } = config;
3688
- let top = 0;
3689
- let left = 0;
3690
- let position = "relative";
3691
- if (layout === Layout.ABSOLUTE) {
3692
- position = "absolute";
3693
- top = e.clientY - containerRect.top + scrollTop;
3694
- left = e.clientX - containerRect.left + scrollLeft;
3695
- if (parentEl && doc) {
3696
- const { left: parentLeft, top: parentTop } = getOffset(parentEl);
3697
- left = left - calcValueByFontsize(doc, parentLeft);
3698
- top = top - calcValueByFontsize(doc, parentTop);
3699
- }
3848
+ const contextmenuHandler = (e2) => {
3849
+ e2.preventDefault();
3850
+ menu.value?.show(e2);
3851
+ };
3852
+ const dragoverHandler = (e2) => {
3853
+ e2.preventDefault();
3854
+ if (e2.dataTransfer) {
3855
+ e2.dataTransfer.dropEffect = "move";
3856
+ }
3857
+ };
3858
+ const dropHandler = async (e) => {
3859
+ e.preventDefault();
3860
+ const doc = stage?.renderer.contentWindow?.document;
3861
+ const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
3862
+ let parent = page.value;
3863
+ if (parentEl) {
3864
+ parent = services?.editorService.getNodeById(parentEl.id, false);
3865
+ }
3866
+ if (e.dataTransfer && parent && stageContainer.value && stage) {
3867
+ const config = eval(`(${e.dataTransfer.getData("data")})`);
3868
+ const layout = await services?.editorService.getLayout(parent);
3869
+ const containerRect = stageContainer.value.getBoundingClientRect();
3870
+ const { scrollTop, scrollLeft } = stage.mask;
3871
+ const { style = {} } = config;
3872
+ let top = 0;
3873
+ let left = 0;
3874
+ let position = "relative";
3875
+ if (layout === Layout.ABSOLUTE) {
3876
+ position = "absolute";
3877
+ top = e.clientY - containerRect.top + scrollTop;
3878
+ left = e.clientX - containerRect.left + scrollLeft;
3879
+ if (parentEl && doc) {
3880
+ const { left: parentLeft, top: parentTop } = getOffset(parentEl);
3881
+ left = left - calcValueByFontsize(doc, parentLeft);
3882
+ top = top - calcValueByFontsize(doc, parentTop);
3700
3883
  }
3701
- config.style = {
3702
- ...style,
3703
- position,
3704
- top,
3705
- left
3706
- };
3707
- config.inputEvent = e;
3708
- services?.editorService.add(config, parent);
3709
3884
  }
3885
+ config.style = {
3886
+ ...style,
3887
+ position,
3888
+ top,
3889
+ left
3890
+ };
3891
+ config.inputEvent = e;
3892
+ services?.editorService.add(config, parent);
3710
3893
  }
3711
3894
  };
3895
+ return (_ctx, _cache) => {
3896
+ return openBlock(), createBlock(ScrollViewer, {
3897
+ class: "m-editor-stage",
3898
+ ref_key: "stageWrap",
3899
+ ref: stageWrap,
3900
+ width: unref(stageRect)?.width,
3901
+ height: unref(stageRect)?.height,
3902
+ zoom: unref(zoom)
3903
+ }, {
3904
+ default: withCtx(() => [
3905
+ createElementVNode("div", {
3906
+ class: "m-editor-stage-container",
3907
+ ref_key: "stageContainer",
3908
+ ref: stageContainer,
3909
+ style: normalizeStyle(`transform: scale(${unref(zoom)})`),
3910
+ onContextmenu: contextmenuHandler,
3911
+ onDrop: dropHandler,
3912
+ onDragover: dragoverHandler
3913
+ }, null, 36),
3914
+ (openBlock(), createBlock(Teleport, { to: "body" }, [
3915
+ createVNode(_sfc_main$3, {
3916
+ ref_key: "menu",
3917
+ ref: menu,
3918
+ "is-multi-select": unref(isMultiSelect)
3919
+ }, null, 8, ["is-multi-select"])
3920
+ ]))
3921
+ ]),
3922
+ _: 1
3923
+ }, 8, ["width", "height", "zoom"]);
3924
+ };
3712
3925
  }
3713
3926
  });
3714
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3715
- const _component_viewer_menu = resolveComponent("viewer-menu");
3716
- const _component_scroll_viewer = resolveComponent("scroll-viewer");
3717
- return openBlock(), createBlock(_component_scroll_viewer, {
3718
- class: "m-editor-stage",
3719
- ref: "stageWrap",
3720
- width: _ctx.stageRect?.width,
3721
- height: _ctx.stageRect?.height,
3722
- zoom: _ctx.zoom
3723
- }, {
3724
- default: withCtx(() => [
3725
- createElementVNode("div", {
3726
- class: "m-editor-stage-container",
3727
- ref: "stageContainer",
3728
- style: normalizeStyle(`transform: scale(${_ctx.zoom})`),
3729
- onContextmenu: _cache[0] || (_cache[0] = (...args) => _ctx.contextmenuHandler && _ctx.contextmenuHandler(...args)),
3730
- onDrop: _cache[1] || (_cache[1] = (...args) => _ctx.dropHandler && _ctx.dropHandler(...args)),
3731
- onDragover: _cache[2] || (_cache[2] = (...args) => _ctx.dragoverHandler && _ctx.dragoverHandler(...args))
3732
- }, null, 36),
3733
- (openBlock(), createBlock(Teleport, { to: "body" }, [
3734
- createVNode(_component_viewer_menu, { ref: "menu" }, null, 512)
3735
- ]))
3736
- ]),
3737
- _: 1
3738
- }, 8, ["width", "height", "zoom"]);
3739
- }
3740
- var MagicStage = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
3741
3927
 
3742
3928
  const _sfc_main$1 = defineComponent({
3743
3929
  name: "m-editor-workspace",
3744
3930
  components: {
3745
- PageBar,
3746
- MagicStage
3931
+ PageBar: _sfc_main$5,
3932
+ MagicStage: _sfc_main$2
3747
3933
  },
3748
3934
  setup() {
3749
3935
  const services = inject("services");
3750
3936
  const workspace = ref();
3751
- const node = computed(() => services?.editorService.get("node"));
3937
+ const nodes = computed(() => services?.editorService.get("nodes"));
3752
3938
  let keycon;
3753
3939
  const mouseenterHandler = () => {
3754
3940
  workspace.value?.focus();
@@ -3764,26 +3950,26 @@ const _sfc_main$1 = defineComponent({
3764
3950
  const ctrl = isMac ? "meta" : "ctrl";
3765
3951
  keycon.keyup("delete", (e) => {
3766
3952
  e.inputEvent.preventDefault();
3767
- if (!node.value || isPage(node.value))
3953
+ if (!nodes.value || isPage(nodes.value[0]))
3768
3954
  return;
3769
- services?.editorService.remove(node.value);
3955
+ services?.editorService.remove(nodes.value);
3770
3956
  }).keyup("backspace", (e) => {
3771
3957
  e.inputEvent.preventDefault();
3772
- if (!node.value || isPage(node.value))
3958
+ if (!nodes.value || isPage(nodes.value[0]))
3773
3959
  return;
3774
- services?.editorService.remove(node.value);
3960
+ services?.editorService.remove(nodes.value);
3775
3961
  }).keydown([ctrl, "c"], (e) => {
3776
3962
  e.inputEvent.preventDefault();
3777
- node.value && services?.editorService.copy(node.value);
3963
+ nodes.value && services?.editorService.copy(nodes.value);
3778
3964
  }).keydown([ctrl, "v"], (e) => {
3779
3965
  e.inputEvent.preventDefault();
3780
- node.value && services?.editorService.paste();
3966
+ nodes.value && services?.editorService.paste({ offsetX: 10, offsetY: 10 });
3781
3967
  }).keydown([ctrl, "x"], (e) => {
3782
3968
  e.inputEvent.preventDefault();
3783
- if (!node.value || isPage(node.value))
3969
+ if (!nodes.value || isPage(nodes.value[0]))
3784
3970
  return;
3785
- services?.editorService.copy(node.value);
3786
- services?.editorService.remove(node.value);
3971
+ services?.editorService.copy(nodes.value);
3972
+ services?.editorService.remove(nodes.value);
3787
3973
  }).keydown([ctrl, "z"], (e) => {
3788
3974
  e.inputEvent.preventDefault();
3789
3975
  services?.editorService.undo();
@@ -3845,6 +4031,7 @@ const _sfc_main$1 = defineComponent({
3845
4031
  };
3846
4032
  }
3847
4033
  });
4034
+
3848
4035
  const _hoisted_1 = {
3849
4036
  class: "m-editor-workspace",
3850
4037
  tabindex: "1",
@@ -3869,14 +4056,14 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
3869
4056
  })
3870
4057
  ], 512);
3871
4058
  }
3872
- var Workspace = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
4059
+ const Workspace = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
3873
4060
 
3874
4061
  class ComponentList extends BaseService {
4062
+ state = reactive({
4063
+ list: []
4064
+ });
3875
4065
  constructor() {
3876
4066
  super([]);
3877
- this.state = reactive({
3878
- list: []
3879
- });
3880
4067
  }
3881
4068
  setList(componentGroupList) {
3882
4069
  this.state.list = componentGroupList;
@@ -3885,7 +4072,7 @@ class ComponentList extends BaseService {
3885
4072
  return this.state.list;
3886
4073
  }
3887
4074
  }
3888
- var componentListService = new ComponentList();
4075
+ const componentListService = new ComponentList();
3889
4076
 
3890
4077
  const DEFAULT_LEFT_COLUMN_WIDTH = 310;
3891
4078
  const MIN_LEFT_COLUMN_WIDTH = 45;
@@ -4005,7 +4192,7 @@ class Ui extends BaseService {
4005
4192
  return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
4006
4193
  }
4007
4194
  }
4008
- var uiService = new Ui();
4195
+ const uiService = new Ui();
4009
4196
 
4010
4197
  const _sfc_main = defineComponent({
4011
4198
  name: "m-editor",
@@ -4135,7 +4322,8 @@ const _sfc_main = defineComponent({
4135
4322
  historyService,
4136
4323
  propsService,
4137
4324
  editorService,
4138
- uiService
4325
+ uiService,
4326
+ storageService
4139
4327
  };
4140
4328
  provide("services", services);
4141
4329
  provide("layerContentMenu", props.layerContentMenu);
@@ -4154,6 +4342,7 @@ const _sfc_main = defineComponent({
4154
4342
  return services;
4155
4343
  }
4156
4344
  });
4345
+
4157
4346
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4158
4347
  const _component_nav_menu = resolveComponent("nav-menu");
4159
4348
  const _component_sidebar = resolveComponent("sidebar");
@@ -4214,23 +4403,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4214
4403
  _: 3
4215
4404
  }, 8, ["code-options"]);
4216
4405
  }
4217
- var Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
4406
+ const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
4218
4407
 
4219
- 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}")();
4408
+ const index$1 = '';
4220
4409
 
4221
4410
  const defaultInstallOpt = {};
4222
- var index = {
4411
+ const index = {
4223
4412
  install: (app, opt) => {
4224
4413
  const option = Object.assign(defaultInstallOpt, opt || {});
4225
4414
  app.config.globalProperties.$TMAGIC_EDITOR = option;
4226
4415
  setConfig(option);
4227
4416
  app.component(Editor.name, Editor);
4228
- app.component(uiSelect.name, uiSelect);
4417
+ app.component("m-fields-ui-select", _sfc_main$l);
4229
4418
  app.component(CodeLink.name, CodeLink);
4230
4419
  app.component(Code.name, Code);
4231
4420
  app.component(CodeEditor.name, CodeEditor);
4232
4421
  }
4233
4422
  };
4234
4423
 
4235
- export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, uiService, warn };
4236
- //# sourceMappingURL=tmagic-editor.es.js.map
4424
+ export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$f as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, warn };
4425
+ //# sourceMappingURL=tmagic-editor.mjs.map