@tmagic/editor 1.0.0-beta.15 → 1.0.0-beta.16

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 (63) hide show
  1. package/coverage/clover.xml +28 -22
  2. package/coverage/coverage-final.json +2 -1
  3. package/coverage/lcov-report/index.html +15 -15
  4. package/coverage/lcov-report/src/Editor.vue.html +1 -1
  5. package/coverage/lcov-report/src/components/ContentMenu.vue.html +1 -1
  6. package/coverage/lcov-report/src/components/Icon.vue.html +1 -1
  7. package/coverage/lcov-report/src/components/ScrollViewer.vue.html +1 -1
  8. package/coverage/lcov-report/src/components/ToolButton.vue.html +3 -3
  9. package/coverage/lcov-report/src/components/index.html +1 -1
  10. package/coverage/lcov-report/src/index.html +1 -1
  11. package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +1 -1
  12. package/coverage/lcov-report/src/layouts/Framework.vue.html +1 -1
  13. package/coverage/lcov-report/src/layouts/NavMenu.vue.html +1 -1
  14. package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +1 -1
  15. package/coverage/lcov-report/src/layouts/Resizer.vue.html +1 -1
  16. package/coverage/lcov-report/src/layouts/index.html +1 -1
  17. package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +1 -1
  18. package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +1 -1
  19. package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +1 -1
  20. package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +23 -140
  21. package/coverage/lcov-report/{undo-redo.ts.html → src/layouts/sidebar/TabPane.vue.html} +94 -118
  22. package/coverage/lcov-report/src/layouts/sidebar/index.html +31 -16
  23. package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +1 -1
  24. package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +1 -1
  25. package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +1 -1
  26. package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +1 -1
  27. package/coverage/lcov-report/src/layouts/workspace/index.html +1 -1
  28. package/coverage/lcov-report/src/services/BaseService.ts.html +1 -1
  29. package/coverage/lcov-report/src/services/componentList.ts.html +1 -1
  30. package/coverage/lcov-report/src/services/editor.ts.html +2 -2
  31. package/coverage/lcov-report/src/services/events.ts.html +1 -1
  32. package/coverage/lcov-report/src/services/history.ts.html +1 -1
  33. package/coverage/lcov-report/src/services/index.html +1 -1
  34. package/coverage/lcov-report/src/services/props.ts.html +1 -1
  35. package/coverage/lcov-report/src/services/ui.ts.html +1 -1
  36. package/coverage/lcov-report/src/type.ts.html +1 -1
  37. package/coverage/lcov-report/src/utils/compose.ts.html +1 -1
  38. package/coverage/lcov-report/src/utils/config.ts.html +1 -1
  39. package/coverage/lcov-report/src/utils/editor.ts.html +1 -1
  40. package/coverage/lcov-report/src/utils/index.html +1 -1
  41. package/coverage/lcov-report/src/utils/index.ts.html +1 -1
  42. package/coverage/lcov-report/src/utils/logger.ts.html +1 -1
  43. package/coverage/lcov-report/src/utils/props.ts.html +1 -1
  44. package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +1 -1
  45. package/coverage/lcov-report/src/utils/undo-redo.ts.html +1 -1
  46. package/coverage/lcov.info +56 -48
  47. package/dist/style.css +3 -0
  48. package/dist/tmagic-editor.es.js +185 -124
  49. package/dist/tmagic-editor.es.js.map +1 -1
  50. package/dist/tmagic-editor.umd.js +186 -125
  51. package/dist/tmagic-editor.umd.js.map +1 -1
  52. package/dist/types/src/fields/UISelect.vue.d.ts +4 -1
  53. package/dist/types/src/layouts/CodeEditor.vue.d.ts +13 -4
  54. package/dist/types/src/layouts/sidebar/Sidebar.vue.d.ts +2 -3
  55. package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +14 -0
  56. package/package.json +7 -7
  57. package/src/components/ToolButton.vue +2 -2
  58. package/src/fields/UISelect.vue +14 -6
  59. package/src/layouts/CodeEditor.vue +20 -10
  60. package/src/layouts/sidebar/Sidebar.vue +13 -52
  61. package/src/layouts/sidebar/TabPane.vue +68 -0
  62. package/src/services/editor.ts +1 -1
  63. package/src/theme/props-panel.scss +4 -0
@@ -1,9 +1,9 @@
1
- import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, createElementBlock, createElementVNode, toDisplayString, withModifiers, createCommentVNode, watch, onMounted, onUnmounted, reactive, toRaw, createVNode, withCtx, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, markRaw, renderList, createTextVNode, normalizeProps, mergeProps, getCurrentInstance, nextTick, withDirectives, Teleport, vShow, toHandlers, createSlots, provide } from 'vue';
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, withDirectives, Teleport, vShow, 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';
4
+ import { throttle, cloneDeep, mergeWith, random } from 'lodash-es';
3
5
  import * as monaco from 'monaco-editor';
4
- import { Plus, Edit, ArrowDown, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Delete, Files, DocumentCopy, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons';
5
6
  import { NodeType } from '@tmagic/schema';
6
- import { cloneDeep, mergeWith, random, throttle } from 'lodash-es';
7
7
  import { toLine, isPop, getNodePath, isNumber, isPage } from '@tmagic/utils';
8
8
  import { EventEmitter as EventEmitter$2 } from 'events';
9
9
  import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
@@ -23,7 +23,7 @@ var _export_sfc = (sfc, props) => {
23
23
  return target;
24
24
  };
25
25
 
26
- const _sfc_main$l = defineComponent({
26
+ const _sfc_main$m = defineComponent({
27
27
  name: "m-fields-vs-code",
28
28
  props: ["model", "name", "config", "prop"],
29
29
  emits: ["change"],
@@ -40,7 +40,7 @@ const _sfc_main$l = defineComponent({
40
40
  };
41
41
  }
42
42
  });
43
- function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
43
+ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
44
44
  const _component_magic_code_editor = resolveComponent("magic-code-editor");
45
45
  return openBlock(), createBlock(_component_magic_code_editor, {
46
46
  style: normalizeStyle(`height: ${_ctx.height}`),
@@ -49,9 +49,9 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
49
49
  onSave: _ctx.save
50
50
  }, null, 8, ["style", "init-values", "language", "onSave"]);
51
51
  }
52
- var Code = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
52
+ var Code = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$m]]);
53
53
 
54
- const _sfc_main$k = defineComponent({
54
+ const _sfc_main$l = defineComponent({
55
55
  name: "m-fields-code-link",
56
56
  props: {
57
57
  config: {
@@ -106,7 +106,7 @@ const _sfc_main$k = defineComponent({
106
106
  };
107
107
  }
108
108
  });
109
- function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
109
+ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
110
110
  const _component_m_fields_link = resolveComponent("m-fields-link");
111
111
  return openBlock(), createBlock(_component_m_fields_link, {
112
112
  config: _ctx.formConfig,
@@ -115,11 +115,11 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
115
115
  onChange: _ctx.changeHandler
116
116
  }, null, 8, ["config", "model", "onChange"]);
117
117
  }
118
- var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$k]]);
118
+ var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
119
119
 
120
120
  var UISelect_vue_vue_type_style_index_0_lang = '';
121
121
 
122
- const _sfc_main$j = defineComponent({
122
+ const _sfc_main$k = defineComponent({
123
123
  name: "m-fields-ui-select",
124
124
  props: {
125
125
  labelWidth: String,
@@ -157,6 +157,9 @@ const _sfc_main$j = defineComponent({
157
157
  }
158
158
  };
159
159
  return {
160
+ Delete: markRaw(Delete),
161
+ Pointer: markRaw(Pointer),
162
+ Close: markRaw(Close),
160
163
  val,
161
164
  uiSelectMode,
162
165
  toName: computed(() => {
@@ -181,34 +184,64 @@ const _sfc_main$j = defineComponent({
181
184
  };
182
185
  }
183
186
  });
184
- const _hoisted_1$c = /* @__PURE__ */ createElementVNode("i", {
185
- class: "el-icon-delete",
186
- style: { "color": "rgb(221, 75, 57)" }
187
- }, "\u53D6\u6D88", -1);
188
- const _hoisted_2$5 = [
189
- _hoisted_1$c
190
- ];
191
- const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-thumb" }, null, -1);
192
- function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
187
+ const _hoisted_1$c = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
188
+ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
189
+ const _component_el_button = resolveComponent("el-button");
190
+ const _component_el_tooltip = resolveComponent("el-tooltip");
193
191
  return _ctx.uiSelectMode ? (openBlock(), createElementBlock("div", {
194
192
  key: 0,
195
193
  class: "m-fields-ui-select",
196
194
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelHandler && _ctx.cancelHandler(...args))
197
- }, _hoisted_2$5)) : (openBlock(), createElementBlock("div", {
195
+ }, [
196
+ createVNode(_component_el_button, {
197
+ type: "danger",
198
+ icon: _ctx.Delete,
199
+ text: "",
200
+ style: { "padding": "0" }
201
+ }, {
202
+ default: withCtx(() => [
203
+ _hoisted_1$c
204
+ ]),
205
+ _: 1
206
+ }, 8, ["icon"])
207
+ ])) : (openBlock(), createElementBlock("div", {
198
208
  key: 1,
199
209
  class: "m-fields-ui-select",
200
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.startSelect && _ctx.startSelect(...args))
210
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.startSelect && _ctx.startSelect(...args)),
211
+ style: { "display": "flex" }
201
212
  }, [
202
- _hoisted_3$3,
203
- createElementVNode("span", null, toDisplayString(_ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1),
204
- _ctx.val ? (openBlock(), createElementBlock("i", {
205
- key: 0,
206
- class: "el-icon-delete",
207
- onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.deleteHandler && _ctx.deleteHandler(...args), ["stop"]))
208
- })) : createCommentVNode("", true)
213
+ createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
214
+ default: withCtx(() => [
215
+ _ctx.val ? (openBlock(), createBlock(_component_el_button, {
216
+ key: 0,
217
+ style: { "padding": "0" },
218
+ type: "danger",
219
+ icon: _ctx.Close,
220
+ text: "",
221
+ onClick: withModifiers(_ctx.deleteHandler, ["stop"])
222
+ }, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
223
+ ]),
224
+ _: 1
225
+ }),
226
+ createVNode(_component_el_tooltip, {
227
+ content: _ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
228
+ }, {
229
+ default: withCtx(() => [
230
+ createVNode(_component_el_button, {
231
+ text: "",
232
+ style: { "padding": "0", "margin": "0" }
233
+ }, {
234
+ default: withCtx(() => [
235
+ createTextVNode(toDisplayString(_ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
236
+ ]),
237
+ _: 1
238
+ })
239
+ ]),
240
+ _: 1
241
+ }, 8, ["content"])
209
242
  ]));
210
243
  }
211
- var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
244
+ var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$k]]);
212
245
 
213
246
  const toString = (v, language) => {
214
247
  let value = "";
@@ -225,7 +258,7 @@ const toString = (v, language) => {
225
258
  }
226
259
  return value;
227
260
  };
228
- const _sfc_main$i = defineComponent({
261
+ const _sfc_main$j = defineComponent({
229
262
  name: "magic-code-editor",
230
263
  props: {
231
264
  initValues: {
@@ -235,12 +268,16 @@ const _sfc_main$i = defineComponent({
235
268
  type: [String, Object]
236
269
  },
237
270
  type: {
238
- type: [String],
271
+ type: String,
239
272
  default: () => ""
240
273
  },
241
274
  language: {
242
- type: [String],
275
+ type: String,
243
276
  default: () => "javascript"
277
+ },
278
+ options: {
279
+ type: Object,
280
+ default: () => ({})
244
281
  }
245
282
  },
246
283
  emits: ["initd", "save"],
@@ -250,6 +287,10 @@ const _sfc_main$i = defineComponent({
250
287
  const values = ref("");
251
288
  const loading = ref(false);
252
289
  const codeEditor = ref();
290
+ const resizeObserver = new globalThis.ResizeObserver(throttle(() => {
291
+ vsEditor?.layout();
292
+ vsDiffEditor?.layout();
293
+ }, 300));
253
294
  const setEditorValue = (v, m) => {
254
295
  values.value = toString(v, props.language);
255
296
  if (props.type === "diff") {
@@ -262,10 +303,6 @@ const _sfc_main$i = defineComponent({
262
303
  }
263
304
  return vsEditor?.setValue(values.value);
264
305
  };
265
- const resizeHandler = () => {
266
- vsEditor?.layout();
267
- vsDiffEditor?.layout();
268
- };
269
306
  const getEditorValue = () => props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue();
270
307
  const init = async () => {
271
308
  if (!codeEditor.value)
@@ -276,8 +313,9 @@ const _sfc_main$i = defineComponent({
276
313
  tabSize: 2,
277
314
  theme: "vs-dark",
278
315
  fontFamily: 'dm, Menlo, Monaco, "Courier New", monospace',
279
- fontSize: 15,
280
- formatOnPaste: true
316
+ fontSize: 14,
317
+ formatOnPaste: true,
318
+ ...props.options
281
319
  };
282
320
  if (props.type === "diff") {
283
321
  vsDiffEditor = monaco.editor.createDiffEditor(codeEditor.value, options);
@@ -298,7 +336,7 @@ const _sfc_main$i = defineComponent({
298
336
  emit("save", getEditorValue());
299
337
  });
300
338
  }
301
- globalThis.addEventListener("resize", resizeHandler);
339
+ resizeObserver.observe(codeEditor.value);
302
340
  };
303
341
  watch(() => props.initValues, (v, preV) => {
304
342
  if (v !== preV) {
@@ -313,7 +351,7 @@ const _sfc_main$i = defineComponent({
313
351
  init();
314
352
  });
315
353
  onUnmounted(() => {
316
- globalThis.removeEventListener("resize", resizeHandler);
354
+ resizeObserver.disconnect();
317
355
  });
318
356
  return {
319
357
  values,
@@ -334,10 +372,10 @@ const _hoisted_1$b = {
334
372
  ref: "codeEditor",
335
373
  class: "magic-code-editor"
336
374
  };
337
- function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
375
+ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
338
376
  return openBlock(), createElementBlock("div", _hoisted_1$b, null, 512);
339
377
  }
340
- var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
378
+ var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
341
379
 
342
380
  let $TMAGIC_EDITOR = {};
343
381
  const setConfig = (option) => {
@@ -964,7 +1002,7 @@ class Editor$1 extends BaseService {
964
1002
  await stage?.add({ config: cloneDeep(newNode), root: cloneDeep(this.get("root")) });
965
1003
  await this.select(newNode);
966
1004
  this.addModifiedNodeId(newNode.id);
967
- if (type !== NodeType.PAGE) {
1005
+ if (!isPage2) {
968
1006
  this.pushHistoryState();
969
1007
  }
970
1008
  stage?.select(newNode.id);
@@ -1471,7 +1509,7 @@ const getDefaultPropsValue = (type) => ({
1471
1509
  name: type
1472
1510
  });
1473
1511
 
1474
- const _sfc_main$h = defineComponent({
1512
+ const _sfc_main$i = defineComponent({
1475
1513
  components: { Plus },
1476
1514
  setup() {
1477
1515
  const services = inject("services");
@@ -1491,7 +1529,7 @@ const _sfc_main$h = defineComponent({
1491
1529
  const _hoisted_1$a = { class: "m-editor-empty-panel" };
1492
1530
  const _hoisted_2$4 = { class: "m-editor-empty-content" };
1493
1531
  const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1494
- function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1532
+ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1495
1533
  const _component_plus = resolveComponent("plus");
1496
1534
  const _component_el_icon = resolveComponent("el-icon");
1497
1535
  return openBlock(), createElementBlock("div", _hoisted_1$a, [
@@ -1513,7 +1551,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1513
1551
  ])
1514
1552
  ]);
1515
1553
  }
1516
- var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h]]);
1554
+ var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
1517
1555
 
1518
1556
  /*
1519
1557
  Copyright (c) 2018 Daybrush
@@ -2724,7 +2762,7 @@ function (_super) {
2724
2762
 
2725
2763
  var Gesto$1 = Gesto;
2726
2764
 
2727
- const _sfc_main$g = defineComponent({
2765
+ const _sfc_main$h = defineComponent({
2728
2766
  name: "m-editor-resize",
2729
2767
  props: {
2730
2768
  type: {
@@ -2770,14 +2808,14 @@ const _hoisted_1$9 = {
2770
2808
  ref: "target",
2771
2809
  class: "m-editor-resizer"
2772
2810
  };
2773
- function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2811
+ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
2774
2812
  return openBlock(), createElementBlock("span", _hoisted_1$9, [
2775
2813
  renderSlot(_ctx.$slots, "default")
2776
2814
  ], 512);
2777
2815
  }
2778
- var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
2816
+ var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h]]);
2779
2817
 
2780
- const _sfc_main$f = defineComponent({
2818
+ const _sfc_main$g = defineComponent({
2781
2819
  components: {
2782
2820
  AddPageBox,
2783
2821
  Resizer
@@ -2805,7 +2843,7 @@ const _hoisted_2$3 = {
2805
2843
  key: 1,
2806
2844
  class: "m-editor-content"
2807
2845
  };
2808
- function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2846
+ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2809
2847
  const _component_magic_code_editor = resolveComponent("magic-code-editor");
2810
2848
  const _component_resizer = resolveComponent("resizer");
2811
2849
  const _component_el_scrollbar = resolveComponent("el-scrollbar");
@@ -2850,9 +2888,9 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2850
2888
  ]))
2851
2889
  ]);
2852
2890
  }
2853
- var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f]]);
2891
+ var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
2854
2892
 
2855
- const _sfc_main$e = defineComponent({
2893
+ const _sfc_main$f = defineComponent({
2856
2894
  name: "m-icon",
2857
2895
  components: { Edit },
2858
2896
  props: {
@@ -2867,7 +2905,7 @@ const _sfc_main$e = defineComponent({
2867
2905
  }
2868
2906
  });
2869
2907
  const _hoisted_1$7 = ["src"];
2870
- function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
2908
+ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2871
2909
  const _component_edit = resolveComponent("edit");
2872
2910
  const _component_el_icon = resolveComponent("el-icon");
2873
2911
  return !_ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
@@ -2888,9 +2926,9 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
2888
2926
  _: 1
2889
2927
  }));
2890
2928
  }
2891
- var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
2929
+ var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f]]);
2892
2930
 
2893
- const _sfc_main$d = defineComponent({
2931
+ const _sfc_main$e = defineComponent({
2894
2932
  components: { MIcon, ArrowDown },
2895
2933
  props: {
2896
2934
  data: {
@@ -3059,7 +3097,7 @@ const _hoisted_2$2 = {
3059
3097
  style: { "margin": "0 5px" }
3060
3098
  };
3061
3099
  const _hoisted_3$1 = { class: "el-dropdown-link menubar-menu-button" };
3062
- function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3100
+ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
3063
3101
  const _component_el_divider = resolveComponent("el-divider");
3064
3102
  const _component_tool_button = resolveComponent("tool-button", true);
3065
3103
  const _component_m_icon = resolveComponent("m-icon");
@@ -3082,12 +3120,12 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3082
3120
  direction: _ctx.item.direction || "vertical"
3083
3121
  }, null, 8, ["direction"])) : _ctx.item.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$6, toDisplayString(_ctx.item.text), 1)) : _ctx.item.type === "zoom" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
3084
3122
  createVNode(_component_tool_button, {
3085
- data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
3123
+ data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
3086
3124
  "event-type": _ctx.eventType
3087
3125
  }, null, 8, ["data", "event-type"]),
3088
3126
  createElementVNode("span", _hoisted_2$2, toDisplayString(parseInt(`${_ctx.zoom * 100}`, 10)) + "%", 1),
3089
3127
  createVNode(_component_tool_button, {
3090
- data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
3128
+ data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
3091
3129
  "event-type": _ctx.eventType
3092
3130
  }, null, 8, ["data", "event-type"])
3093
3131
  ], 64)) : _ctx.item.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
@@ -3168,9 +3206,9 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3168
3206
  }, 8, ["disabled", "onCommand"])) : _ctx.item.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.item.component), normalizeProps(mergeProps({ key: 5 }, _ctx.item.props || {})), null, 16)) : createCommentVNode("", true)
3169
3207
  ], 34)) : createCommentVNode("", true);
3170
3208
  }
3171
- var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
3209
+ var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
3172
3210
 
3173
- const _sfc_main$c = defineComponent({
3211
+ const _sfc_main$d = defineComponent({
3174
3212
  name: "nav-menu",
3175
3213
  components: { ToolButton },
3176
3214
  props: {
@@ -3190,7 +3228,7 @@ const _sfc_main$c = defineComponent({
3190
3228
  };
3191
3229
  }
3192
3230
  });
3193
- function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3231
+ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3194
3232
  const _component_tool_button = resolveComponent("tool-button");
3195
3233
  return openBlock(), createElementBlock("div", {
3196
3234
  class: "m-editor-nav-menu",
@@ -3212,9 +3250,9 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3212
3250
  }), 128))
3213
3251
  ], 4);
3214
3252
  }
3215
- var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
3253
+ var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
3216
3254
 
3217
- const _sfc_main$b = defineComponent({
3255
+ const _sfc_main$c = defineComponent({
3218
3256
  name: "m-editor-props-panel",
3219
3257
  emits: ["mounted"],
3220
3258
  setup(props, { emit }) {
@@ -3260,7 +3298,7 @@ const _sfc_main$b = defineComponent({
3260
3298
  };
3261
3299
  }
3262
3300
  });
3263
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
3301
+ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3264
3302
  const _component_m_form = resolveComponent("m-form");
3265
3303
  return openBlock(), createBlock(_component_m_form, {
3266
3304
  class: "m-editor-props-panel",
@@ -3272,9 +3310,9 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
3272
3310
  onChange: _ctx.submit
3273
3311
  }, null, 8, ["init-values", "config", "onChange"]);
3274
3312
  }
3275
- var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
3313
+ var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
3276
3314
 
3277
- const _sfc_main$a = defineComponent({
3315
+ const _sfc_main$b = defineComponent({
3278
3316
  name: "ui-component-panel",
3279
3317
  components: { MIcon },
3280
3318
  setup() {
@@ -3311,7 +3349,7 @@ const _sfc_main$a = defineComponent({
3311
3349
  });
3312
3350
  const _hoisted_1$5 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
3313
3351
  const _hoisted_2$1 = ["onClick", "onDragstart"];
3314
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3352
+ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
3315
3353
  const _component_el_input = resolveComponent("el-input");
3316
3354
  const _component_m_icon = resolveComponent("m-icon");
3317
3355
  const _component_el_tooltip = resolveComponent("el-tooltip");
@@ -3380,9 +3418,9 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3380
3418
  _: 1
3381
3419
  });
3382
3420
  }
3383
- var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
3421
+ var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
3384
3422
 
3385
- const _sfc_main$9 = defineComponent({
3423
+ const _sfc_main$a = defineComponent({
3386
3424
  components: { ToolButton },
3387
3425
  props: {
3388
3426
  menuData: {
@@ -3447,7 +3485,7 @@ const _sfc_main$9 = defineComponent({
3447
3485
  };
3448
3486
  }
3449
3487
  });
3450
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
3488
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3451
3489
  const _component_tool_button = resolveComponent("tool-button");
3452
3490
  const _component_content_menu = resolveComponent("content-menu", true);
3453
3491
  return _ctx.menuData.length ? withDirectives((openBlock(), createElementBlock("div", {
@@ -3478,9 +3516,9 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
3478
3516
  [vShow, _ctx.visible]
3479
3517
  ]) : createCommentVNode("", true);
3480
3518
  }
3481
- var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
3519
+ var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
3482
3520
 
3483
- const _sfc_main$8 = defineComponent({
3521
+ const _sfc_main$9 = defineComponent({
3484
3522
  components: { ContentMenu },
3485
3523
  setup() {
3486
3524
  const services = inject("services");
@@ -3561,7 +3599,7 @@ const _sfc_main$8 = defineComponent({
3561
3599
  };
3562
3600
  }
3563
3601
  });
3564
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
3602
+ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
3565
3603
  const _component_content_menu = resolveComponent("content-menu");
3566
3604
  return openBlock(), createBlock(_component_content_menu, {
3567
3605
  "menu-data": _ctx.menuData,
@@ -3569,7 +3607,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
3569
3607
  style: { "overflow": "initial" }
3570
3608
  }, null, 8, ["menu-data"]);
3571
3609
  }
3572
- var LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
3610
+ var LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
3573
3611
 
3574
3612
  const throttleTime = 150;
3575
3613
  const select = async (data, editorService) => {
@@ -3661,7 +3699,7 @@ const useFilter = (tree) => ({
3661
3699
  tree.value?.filter(val);
3662
3700
  }
3663
3701
  });
3664
- const _sfc_main$7 = defineComponent({
3702
+ const _sfc_main$8 = defineComponent({
3665
3703
  name: "magic-editor-layer-panel",
3666
3704
  components: { LayerMenu },
3667
3705
  setup() {
@@ -3709,7 +3747,7 @@ const _sfc_main$7 = defineComponent({
3709
3747
  }
3710
3748
  });
3711
3749
  const _hoisted_1$4 = ["id", "onMouseenter"];
3712
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
3750
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
3713
3751
  const _component_el_input = resolveComponent("el-input");
3714
3752
  const _component_el_tree = resolveComponent("el-tree");
3715
3753
  const _component_layer_menu = resolveComponent("layer-menu");
@@ -3770,29 +3808,22 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
3770
3808
  _: 3
3771
3809
  });
3772
3810
  }
3773
- var LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
3811
+ var LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
3774
3812
 
3775
- const _sfc_main$6 = defineComponent({
3776
- name: "m-sidebar",
3813
+ const _sfc_main$7 = defineComponent({
3777
3814
  components: { MIcon },
3778
3815
  props: {
3779
3816
  data: {
3780
- type: Object,
3781
- default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer"] })
3817
+ type: Object
3782
3818
  }
3783
3819
  },
3784
3820
  setup(props) {
3785
- const activeTabName = ref(props.data?.status);
3786
- watch(() => props.data?.status, (status) => {
3787
- activeTabName.value = status || "0";
3788
- });
3789
3821
  return {
3790
- activeTabName,
3791
- items: computed(() => props.data?.items.map((item) => {
3792
- if (typeof item !== "string") {
3793
- return item;
3822
+ config: computed(() => {
3823
+ if (typeof props.data !== "string") {
3824
+ return props.data;
3794
3825
  }
3795
- switch (item) {
3826
+ switch (props.data) {
3796
3827
  case "component-list":
3797
3828
  return {
3798
3829
  type: "component",
@@ -3810,9 +3841,9 @@ const _sfc_main$6 = defineComponent({
3810
3841
  slots: {}
3811
3842
  };
3812
3843
  default:
3813
- return {};
3844
+ return void 0;
3814
3845
  }
3815
- }))
3846
+ })
3816
3847
  };
3817
3848
  }
3818
3849
  });
@@ -3820,11 +3851,65 @@ const _hoisted_1$3 = {
3820
3851
  key: 1,
3821
3852
  class: "magic-editor-tab-panel-title"
3822
3853
  };
3823
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3854
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
3824
3855
  const _component_m_icon = resolveComponent("m-icon");
3825
3856
  const _component_el_tab_pane = resolveComponent("el-tab-pane");
3857
+ return _ctx.config ? (openBlock(), createBlock(_component_el_tab_pane, {
3858
+ key: 0,
3859
+ name: _ctx.config.text
3860
+ }, {
3861
+ label: withCtx(() => [
3862
+ (openBlock(), createElementBlock("div", {
3863
+ key: _ctx.config.text
3864
+ }, [
3865
+ _ctx.config.icon ? (openBlock(), createBlock(_component_m_icon, {
3866
+ key: 0,
3867
+ icon: _ctx.config.icon
3868
+ }, null, 8, ["icon"])) : createCommentVNode("", true),
3869
+ _ctx.config.text ? (openBlock(), createElementBlock("div", _hoisted_1$3, toDisplayString(_ctx.config.text), 1)) : createCommentVNode("", true)
3870
+ ]))
3871
+ ]),
3872
+ default: withCtx(() => [
3873
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.component), mergeProps(_ctx.config.props || {}, toHandlers(_ctx.config?.listeners || {})), createSlots({ _: 2 }, [
3874
+ _ctx.config.slots?.layerNodeContent ? {
3875
+ name: "layer-node-content",
3876
+ fn: withCtx(({ data, node }) => [
3877
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots?.layerNodeContent), {
3878
+ data,
3879
+ node
3880
+ }, null, 8, ["data", "node"]))
3881
+ ])
3882
+ } : void 0
3883
+ ]), 1040))
3884
+ ]),
3885
+ _: 1
3886
+ }, 8, ["name"])) : createCommentVNode("", true);
3887
+ }
3888
+ var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
3889
+
3890
+ const _sfc_main$6 = defineComponent({
3891
+ components: { TabPane },
3892
+ name: "m-sidebar",
3893
+ props: {
3894
+ data: {
3895
+ type: Object,
3896
+ default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer"] })
3897
+ }
3898
+ },
3899
+ setup(props) {
3900
+ const activeTabName = ref(props.data?.status);
3901
+ watch(() => props.data?.status, (status) => {
3902
+ activeTabName.value = status || "0";
3903
+ });
3904
+ return {
3905
+ activeTabName
3906
+ };
3907
+ }
3908
+ });
3909
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3910
+ const _component_tab_pane = resolveComponent("tab-pane");
3826
3911
  const _component_el_tabs = resolveComponent("el-tabs");
3827
- return _ctx.data.type === "tabs" ? (openBlock(), createBlock(_component_el_tabs, {
3912
+ return _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createBlock(_component_el_tabs, {
3828
3913
  key: 0,
3829
3914
  class: "m-editor-sidebar",
3830
3915
  modelValue: _ctx.activeTabName,
@@ -3833,35 +3918,11 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3833
3918
  "tab-position": "left"
3834
3919
  }, {
3835
3920
  default: withCtx(() => [
3836
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item) => {
3837
- return openBlock(), createBlock(_component_el_tab_pane, {
3838
- key: item.text,
3839
- name: item.text
3840
- }, {
3841
- label: withCtx(() => [
3842
- createElementVNode("span", null, [
3843
- item.icon ? (openBlock(), createBlock(_component_m_icon, {
3844
- key: 0,
3845
- icon: item.icon
3846
- }, null, 8, ["icon"])) : createCommentVNode("", true),
3847
- item.text ? (openBlock(), createElementBlock("div", _hoisted_1$3, toDisplayString(item.text), 1)) : createCommentVNode("", true)
3848
- ])
3849
- ]),
3850
- default: withCtx(() => [
3851
- (openBlock(), createBlock(resolveDynamicComponent(item.component), mergeProps(item.props || {}, toHandlers(item.listeners || {})), createSlots({ _: 2 }, [
3852
- item.slots?.layerNodeContent ? {
3853
- name: "layer-node-content",
3854
- fn: withCtx(({ data, node }) => [
3855
- (openBlock(), createBlock(resolveDynamicComponent(item.slots.layerNodeContent), {
3856
- data,
3857
- node
3858
- }, null, 8, ["data", "node"]))
3859
- ])
3860
- } : void 0
3861
- ]), 1040))
3862
- ]),
3863
- _: 2
3864
- }, 1032, ["name"]);
3921
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item, index) => {
3922
+ return openBlock(), createBlock(_component_tab_pane, {
3923
+ key: index,
3924
+ data: item
3925
+ }, null, 8, ["data"]);
3865
3926
  }), 128))
3866
3927
  ]),
3867
3928
  _: 1