@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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('monaco-editor'), require('@element-plus/icons'), require('@tmagic/schema'), require('lodash-es'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('element-plus'), require('keycon'), require('@tmagic/stage')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'monaco-editor', '@element-plus/icons', '@tmagic/schema', 'lodash-es', '@tmagic/utils', 'events', '@tmagic/core', 'element-plus', 'keycon', '@tmagic/stage'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.vue, global.serialize, global.monaco, global.icons, global.schema, global.lodashEs, global.utils, global.events, global.core, global.elementPlus, global.KeyController, global.StageCore));
5
- })(this, (function (exports, vue, serialize, monaco, icons, schema, lodashEs, utils, events, core, elementPlus, KeyController, StageCore) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('@element-plus/icons'), require('lodash-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('element-plus'), require('keycon'), require('@tmagic/stage')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', '@element-plus/icons', 'lodash-es', 'monaco-editor', '@tmagic/schema', '@tmagic/utils', 'events', '@tmagic/core', 'element-plus', 'keycon', '@tmagic/stage'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.vue, global.serialize, global.icons, global.lodashEs, global.monaco, global.schema, global.utils, global.events, global.core, global.elementPlus, global.KeyController, global.StageCore));
5
+ })(this, (function (exports, vue, serialize, icons, lodashEs, monaco, schema, utils, events, core, elementPlus, KeyController, StageCore) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -41,7 +41,7 @@
41
41
  return target;
42
42
  };
43
43
 
44
- const _sfc_main$l = vue.defineComponent({
44
+ const _sfc_main$m = vue.defineComponent({
45
45
  name: "m-fields-vs-code",
46
46
  props: ["model", "name", "config", "prop"],
47
47
  emits: ["change"],
@@ -58,7 +58,7 @@
58
58
  };
59
59
  }
60
60
  });
61
- function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
61
+ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
62
62
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
63
63
  return vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
64
64
  style: vue.normalizeStyle(`height: ${_ctx.height}`),
@@ -67,9 +67,9 @@
67
67
  onSave: _ctx.save
68
68
  }, null, 8, ["style", "init-values", "language", "onSave"]);
69
69
  }
70
- var Code = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
70
+ var Code = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$m]]);
71
71
 
72
- const _sfc_main$k = vue.defineComponent({
72
+ const _sfc_main$l = vue.defineComponent({
73
73
  name: "m-fields-code-link",
74
74
  props: {
75
75
  config: {
@@ -124,7 +124,7 @@
124
124
  };
125
125
  }
126
126
  });
127
- function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
127
+ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
128
128
  const _component_m_fields_link = vue.resolveComponent("m-fields-link");
129
129
  return vue.openBlock(), vue.createBlock(_component_m_fields_link, {
130
130
  config: _ctx.formConfig,
@@ -133,11 +133,11 @@
133
133
  onChange: _ctx.changeHandler
134
134
  }, null, 8, ["config", "model", "onChange"]);
135
135
  }
136
- var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$k]]);
136
+ var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
137
137
 
138
138
  var UISelect_vue_vue_type_style_index_0_lang = '';
139
139
 
140
- const _sfc_main$j = vue.defineComponent({
140
+ const _sfc_main$k = vue.defineComponent({
141
141
  name: "m-fields-ui-select",
142
142
  props: {
143
143
  labelWidth: String,
@@ -175,6 +175,9 @@
175
175
  }
176
176
  };
177
177
  return {
178
+ Delete: vue.markRaw(icons.Delete),
179
+ Pointer: vue.markRaw(icons.Pointer),
180
+ Close: vue.markRaw(icons.Close),
178
181
  val,
179
182
  uiSelectMode,
180
183
  toName: vue.computed(() => {
@@ -199,34 +202,64 @@
199
202
  };
200
203
  }
201
204
  });
202
- const _hoisted_1$c = /* @__PURE__ */ vue.createElementVNode("i", {
203
- class: "el-icon-delete",
204
- style: { "color": "rgb(221, 75, 57)" }
205
- }, "\u53D6\u6D88", -1);
206
- const _hoisted_2$5 = [
207
- _hoisted_1$c
208
- ];
209
- const _hoisted_3$3 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-thumb" }, null, -1);
210
- function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
205
+ const _hoisted_1$c = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
206
+ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
207
+ const _component_el_button = vue.resolveComponent("el-button");
208
+ const _component_el_tooltip = vue.resolveComponent("el-tooltip");
211
209
  return _ctx.uiSelectMode ? (vue.openBlock(), vue.createElementBlock("div", {
212
210
  key: 0,
213
211
  class: "m-fields-ui-select",
214
212
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelHandler && _ctx.cancelHandler(...args))
215
- }, _hoisted_2$5)) : (vue.openBlock(), vue.createElementBlock("div", {
213
+ }, [
214
+ vue.createVNode(_component_el_button, {
215
+ type: "danger",
216
+ icon: _ctx.Delete,
217
+ text: "",
218
+ style: { "padding": "0" }
219
+ }, {
220
+ default: vue.withCtx(() => [
221
+ _hoisted_1$c
222
+ ]),
223
+ _: 1
224
+ }, 8, ["icon"])
225
+ ])) : (vue.openBlock(), vue.createElementBlock("div", {
216
226
  key: 1,
217
227
  class: "m-fields-ui-select",
218
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.startSelect && _ctx.startSelect(...args))
228
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.startSelect && _ctx.startSelect(...args)),
229
+ style: { "display": "flex" }
219
230
  }, [
220
- _hoisted_3$3,
221
- vue.createElementVNode("span", null, vue.toDisplayString(_ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1),
222
- _ctx.val ? (vue.openBlock(), vue.createElementBlock("i", {
223
- key: 0,
224
- class: "el-icon-delete",
225
- onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.deleteHandler && _ctx.deleteHandler(...args), ["stop"]))
226
- })) : vue.createCommentVNode("", true)
231
+ vue.createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
232
+ default: vue.withCtx(() => [
233
+ _ctx.val ? (vue.openBlock(), vue.createBlock(_component_el_button, {
234
+ key: 0,
235
+ style: { "padding": "0" },
236
+ type: "danger",
237
+ icon: _ctx.Close,
238
+ text: "",
239
+ onClick: vue.withModifiers(_ctx.deleteHandler, ["stop"])
240
+ }, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
241
+ ]),
242
+ _: 1
243
+ }),
244
+ vue.createVNode(_component_el_tooltip, {
245
+ content: _ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
246
+ }, {
247
+ default: vue.withCtx(() => [
248
+ vue.createVNode(_component_el_button, {
249
+ text: "",
250
+ style: { "padding": "0", "margin": "0" }
251
+ }, {
252
+ default: vue.withCtx(() => [
253
+ vue.createTextVNode(vue.toDisplayString(_ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
254
+ ]),
255
+ _: 1
256
+ })
257
+ ]),
258
+ _: 1
259
+ }, 8, ["content"])
227
260
  ]));
228
261
  }
229
- var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
262
+ var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$k]]);
230
263
 
231
264
  const toString = (v, language) => {
232
265
  let value = "";
@@ -243,7 +276,7 @@
243
276
  }
244
277
  return value;
245
278
  };
246
- const _sfc_main$i = vue.defineComponent({
279
+ const _sfc_main$j = vue.defineComponent({
247
280
  name: "magic-code-editor",
248
281
  props: {
249
282
  initValues: {
@@ -253,12 +286,16 @@
253
286
  type: [String, Object]
254
287
  },
255
288
  type: {
256
- type: [String],
289
+ type: String,
257
290
  default: () => ""
258
291
  },
259
292
  language: {
260
- type: [String],
293
+ type: String,
261
294
  default: () => "javascript"
295
+ },
296
+ options: {
297
+ type: Object,
298
+ default: () => ({})
262
299
  }
263
300
  },
264
301
  emits: ["initd", "save"],
@@ -268,6 +305,10 @@
268
305
  const values = vue.ref("");
269
306
  const loading = vue.ref(false);
270
307
  const codeEditor = vue.ref();
308
+ const resizeObserver = new globalThis.ResizeObserver(lodashEs.throttle(() => {
309
+ vsEditor?.layout();
310
+ vsDiffEditor?.layout();
311
+ }, 300));
271
312
  const setEditorValue = (v, m) => {
272
313
  values.value = toString(v, props.language);
273
314
  if (props.type === "diff") {
@@ -280,10 +321,6 @@
280
321
  }
281
322
  return vsEditor?.setValue(values.value);
282
323
  };
283
- const resizeHandler = () => {
284
- vsEditor?.layout();
285
- vsDiffEditor?.layout();
286
- };
287
324
  const getEditorValue = () => props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue();
288
325
  const init = async () => {
289
326
  if (!codeEditor.value)
@@ -294,8 +331,9 @@
294
331
  tabSize: 2,
295
332
  theme: "vs-dark",
296
333
  fontFamily: 'dm, Menlo, Monaco, "Courier New", monospace',
297
- fontSize: 15,
298
- formatOnPaste: true
334
+ fontSize: 14,
335
+ formatOnPaste: true,
336
+ ...props.options
299
337
  };
300
338
  if (props.type === "diff") {
301
339
  vsDiffEditor = monaco__namespace.editor.createDiffEditor(codeEditor.value, options);
@@ -316,7 +354,7 @@
316
354
  emit("save", getEditorValue());
317
355
  });
318
356
  }
319
- globalThis.addEventListener("resize", resizeHandler);
357
+ resizeObserver.observe(codeEditor.value);
320
358
  };
321
359
  vue.watch(() => props.initValues, (v, preV) => {
322
360
  if (v !== preV) {
@@ -331,7 +369,7 @@
331
369
  init();
332
370
  });
333
371
  vue.onUnmounted(() => {
334
- globalThis.removeEventListener("resize", resizeHandler);
372
+ resizeObserver.disconnect();
335
373
  });
336
374
  return {
337
375
  values,
@@ -352,10 +390,10 @@
352
390
  ref: "codeEditor",
353
391
  class: "magic-code-editor"
354
392
  };
355
- function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
393
+ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
356
394
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, null, 512);
357
395
  }
358
- var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
396
+ var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
359
397
 
360
398
  let $TMAGIC_EDITOR = {};
361
399
  const setConfig = (option) => {
@@ -982,7 +1020,7 @@
982
1020
  await stage?.add({ config: lodashEs.cloneDeep(newNode), root: lodashEs.cloneDeep(this.get("root")) });
983
1021
  await this.select(newNode);
984
1022
  this.addModifiedNodeId(newNode.id);
985
- if (type !== schema.NodeType.PAGE) {
1023
+ if (!isPage2) {
986
1024
  this.pushHistoryState();
987
1025
  }
988
1026
  stage?.select(newNode.id);
@@ -1489,7 +1527,7 @@
1489
1527
  name: type
1490
1528
  });
1491
1529
 
1492
- const _sfc_main$h = vue.defineComponent({
1530
+ const _sfc_main$i = vue.defineComponent({
1493
1531
  components: { Plus: icons.Plus },
1494
1532
  setup() {
1495
1533
  const services = vue.inject("services");
@@ -1509,7 +1547,7 @@
1509
1547
  const _hoisted_1$a = { class: "m-editor-empty-panel" };
1510
1548
  const _hoisted_2$4 = { class: "m-editor-empty-content" };
1511
1549
  const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1512
- function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1550
+ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1513
1551
  const _component_plus = vue.resolveComponent("plus");
1514
1552
  const _component_el_icon = vue.resolveComponent("el-icon");
1515
1553
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
@@ -1531,7 +1569,7 @@
1531
1569
  ])
1532
1570
  ]);
1533
1571
  }
1534
- var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h]]);
1572
+ var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
1535
1573
 
1536
1574
  /*
1537
1575
  Copyright (c) 2018 Daybrush
@@ -2742,7 +2780,7 @@
2742
2780
 
2743
2781
  var Gesto$1 = Gesto;
2744
2782
 
2745
- const _sfc_main$g = vue.defineComponent({
2783
+ const _sfc_main$h = vue.defineComponent({
2746
2784
  name: "m-editor-resize",
2747
2785
  props: {
2748
2786
  type: {
@@ -2788,14 +2826,14 @@
2788
2826
  ref: "target",
2789
2827
  class: "m-editor-resizer"
2790
2828
  };
2791
- function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2829
+ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
2792
2830
  return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$9, [
2793
2831
  vue.renderSlot(_ctx.$slots, "default")
2794
2832
  ], 512);
2795
2833
  }
2796
- var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
2834
+ var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h]]);
2797
2835
 
2798
- const _sfc_main$f = vue.defineComponent({
2836
+ const _sfc_main$g = vue.defineComponent({
2799
2837
  components: {
2800
2838
  AddPageBox,
2801
2839
  Resizer
@@ -2823,7 +2861,7 @@
2823
2861
  key: 1,
2824
2862
  class: "m-editor-content"
2825
2863
  };
2826
- function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2864
+ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2827
2865
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
2828
2866
  const _component_resizer = vue.resolveComponent("resizer");
2829
2867
  const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
@@ -2868,9 +2906,9 @@
2868
2906
  ]))
2869
2907
  ]);
2870
2908
  }
2871
- var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f]]);
2909
+ var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
2872
2910
 
2873
- const _sfc_main$e = vue.defineComponent({
2911
+ const _sfc_main$f = vue.defineComponent({
2874
2912
  name: "m-icon",
2875
2913
  components: { Edit: icons.Edit },
2876
2914
  props: {
@@ -2885,7 +2923,7 @@
2885
2923
  }
2886
2924
  });
2887
2925
  const _hoisted_1$7 = ["src"];
2888
- function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
2926
+ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2889
2927
  const _component_edit = vue.resolveComponent("edit");
2890
2928
  const _component_el_icon = vue.resolveComponent("el-icon");
2891
2929
  return !_ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
@@ -2906,9 +2944,9 @@
2906
2944
  _: 1
2907
2945
  }));
2908
2946
  }
2909
- var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
2947
+ var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f]]);
2910
2948
 
2911
- const _sfc_main$d = vue.defineComponent({
2949
+ const _sfc_main$e = vue.defineComponent({
2912
2950
  components: { MIcon, ArrowDown: icons.ArrowDown },
2913
2951
  props: {
2914
2952
  data: {
@@ -3077,7 +3115,7 @@
3077
3115
  style: { "margin": "0 5px" }
3078
3116
  };
3079
3117
  const _hoisted_3$1 = { class: "el-dropdown-link menubar-menu-button" };
3080
- function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3118
+ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
3081
3119
  const _component_el_divider = vue.resolveComponent("el-divider");
3082
3120
  const _component_tool_button = vue.resolveComponent("tool-button", true);
3083
3121
  const _component_m_icon = vue.resolveComponent("m-icon");
@@ -3100,12 +3138,12 @@
3100
3138
  direction: _ctx.item.direction || "vertical"
3101
3139
  }, null, 8, ["direction"])) : _ctx.item.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, vue.toDisplayString(_ctx.item.text), 1)) : _ctx.item.type === "zoom" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3102
3140
  vue.createVNode(_component_tool_button, {
3103
- data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
3141
+ data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
3104
3142
  "event-type": _ctx.eventType
3105
3143
  }, null, 8, ["data", "event-type"]),
3106
3144
  vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(parseInt(`${_ctx.zoom * 100}`, 10)) + "%", 1),
3107
3145
  vue.createVNode(_component_tool_button, {
3108
- data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
3146
+ data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
3109
3147
  "event-type": _ctx.eventType
3110
3148
  }, null, 8, ["data", "event-type"])
3111
3149
  ], 64)) : _ctx.item.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
@@ -3186,9 +3224,9 @@
3186
3224
  }, 8, ["disabled", "onCommand"])) : _ctx.item.type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.item.component), vue.normalizeProps(vue.mergeProps({ key: 5 }, _ctx.item.props || {})), null, 16)) : vue.createCommentVNode("", true)
3187
3225
  ], 34)) : vue.createCommentVNode("", true);
3188
3226
  }
3189
- var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
3227
+ var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
3190
3228
 
3191
- const _sfc_main$c = vue.defineComponent({
3229
+ const _sfc_main$d = vue.defineComponent({
3192
3230
  name: "nav-menu",
3193
3231
  components: { ToolButton },
3194
3232
  props: {
@@ -3208,7 +3246,7 @@
3208
3246
  };
3209
3247
  }
3210
3248
  });
3211
- function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3249
+ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3212
3250
  const _component_tool_button = vue.resolveComponent("tool-button");
3213
3251
  return vue.openBlock(), vue.createElementBlock("div", {
3214
3252
  class: "m-editor-nav-menu",
@@ -3230,9 +3268,9 @@
3230
3268
  }), 128))
3231
3269
  ], 4);
3232
3270
  }
3233
- var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
3271
+ var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
3234
3272
 
3235
- const _sfc_main$b = vue.defineComponent({
3273
+ const _sfc_main$c = vue.defineComponent({
3236
3274
  name: "m-editor-props-panel",
3237
3275
  emits: ["mounted"],
3238
3276
  setup(props, { emit }) {
@@ -3278,7 +3316,7 @@
3278
3316
  };
3279
3317
  }
3280
3318
  });
3281
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
3319
+ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3282
3320
  const _component_m_form = vue.resolveComponent("m-form");
3283
3321
  return vue.openBlock(), vue.createBlock(_component_m_form, {
3284
3322
  class: "m-editor-props-panel",
@@ -3290,9 +3328,9 @@
3290
3328
  onChange: _ctx.submit
3291
3329
  }, null, 8, ["init-values", "config", "onChange"]);
3292
3330
  }
3293
- var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
3331
+ var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
3294
3332
 
3295
- const _sfc_main$a = vue.defineComponent({
3333
+ const _sfc_main$b = vue.defineComponent({
3296
3334
  name: "ui-component-panel",
3297
3335
  components: { MIcon },
3298
3336
  setup() {
@@ -3329,7 +3367,7 @@
3329
3367
  });
3330
3368
  const _hoisted_1$5 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
3331
3369
  const _hoisted_2$1 = ["onClick", "onDragstart"];
3332
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3370
+ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
3333
3371
  const _component_el_input = vue.resolveComponent("el-input");
3334
3372
  const _component_m_icon = vue.resolveComponent("m-icon");
3335
3373
  const _component_el_tooltip = vue.resolveComponent("el-tooltip");
@@ -3398,9 +3436,9 @@
3398
3436
  _: 1
3399
3437
  });
3400
3438
  }
3401
- var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
3439
+ var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
3402
3440
 
3403
- const _sfc_main$9 = vue.defineComponent({
3441
+ const _sfc_main$a = vue.defineComponent({
3404
3442
  components: { ToolButton },
3405
3443
  props: {
3406
3444
  menuData: {
@@ -3465,7 +3503,7 @@
3465
3503
  };
3466
3504
  }
3467
3505
  });
3468
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
3506
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3469
3507
  const _component_tool_button = vue.resolveComponent("tool-button");
3470
3508
  const _component_content_menu = vue.resolveComponent("content-menu", true);
3471
3509
  return _ctx.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
@@ -3496,9 +3534,9 @@
3496
3534
  [vue.vShow, _ctx.visible]
3497
3535
  ]) : vue.createCommentVNode("", true);
3498
3536
  }
3499
- var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
3537
+ var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
3500
3538
 
3501
- const _sfc_main$8 = vue.defineComponent({
3539
+ const _sfc_main$9 = vue.defineComponent({
3502
3540
  components: { ContentMenu },
3503
3541
  setup() {
3504
3542
  const services = vue.inject("services");
@@ -3579,7 +3617,7 @@
3579
3617
  };
3580
3618
  }
3581
3619
  });
3582
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
3620
+ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
3583
3621
  const _component_content_menu = vue.resolveComponent("content-menu");
3584
3622
  return vue.openBlock(), vue.createBlock(_component_content_menu, {
3585
3623
  "menu-data": _ctx.menuData,
@@ -3587,7 +3625,7 @@
3587
3625
  style: { "overflow": "initial" }
3588
3626
  }, null, 8, ["menu-data"]);
3589
3627
  }
3590
- var LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
3628
+ var LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
3591
3629
 
3592
3630
  const throttleTime = 150;
3593
3631
  const select = async (data, editorService) => {
@@ -3679,7 +3717,7 @@
3679
3717
  tree.value?.filter(val);
3680
3718
  }
3681
3719
  });
3682
- const _sfc_main$7 = vue.defineComponent({
3720
+ const _sfc_main$8 = vue.defineComponent({
3683
3721
  name: "magic-editor-layer-panel",
3684
3722
  components: { LayerMenu },
3685
3723
  setup() {
@@ -3727,7 +3765,7 @@
3727
3765
  }
3728
3766
  });
3729
3767
  const _hoisted_1$4 = ["id", "onMouseenter"];
3730
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
3768
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
3731
3769
  const _component_el_input = vue.resolveComponent("el-input");
3732
3770
  const _component_el_tree = vue.resolveComponent("el-tree");
3733
3771
  const _component_layer_menu = vue.resolveComponent("layer-menu");
@@ -3788,29 +3826,22 @@
3788
3826
  _: 3
3789
3827
  });
3790
3828
  }
3791
- var LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
3829
+ var LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
3792
3830
 
3793
- const _sfc_main$6 = vue.defineComponent({
3794
- name: "m-sidebar",
3831
+ const _sfc_main$7 = vue.defineComponent({
3795
3832
  components: { MIcon },
3796
3833
  props: {
3797
3834
  data: {
3798
- type: Object,
3799
- default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer"] })
3835
+ type: Object
3800
3836
  }
3801
3837
  },
3802
3838
  setup(props) {
3803
- const activeTabName = vue.ref(props.data?.status);
3804
- vue.watch(() => props.data?.status, (status) => {
3805
- activeTabName.value = status || "0";
3806
- });
3807
3839
  return {
3808
- activeTabName,
3809
- items: vue.computed(() => props.data?.items.map((item) => {
3810
- if (typeof item !== "string") {
3811
- return item;
3840
+ config: vue.computed(() => {
3841
+ if (typeof props.data !== "string") {
3842
+ return props.data;
3812
3843
  }
3813
- switch (item) {
3844
+ switch (props.data) {
3814
3845
  case "component-list":
3815
3846
  return {
3816
3847
  type: "component",
@@ -3828,9 +3859,9 @@
3828
3859
  slots: {}
3829
3860
  };
3830
3861
  default:
3831
- return {};
3862
+ return void 0;
3832
3863
  }
3833
- }))
3864
+ })
3834
3865
  };
3835
3866
  }
3836
3867
  });
@@ -3838,11 +3869,65 @@
3838
3869
  key: 1,
3839
3870
  class: "magic-editor-tab-panel-title"
3840
3871
  };
3841
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3872
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
3842
3873
  const _component_m_icon = vue.resolveComponent("m-icon");
3843
3874
  const _component_el_tab_pane = vue.resolveComponent("el-tab-pane");
3875
+ return _ctx.config ? (vue.openBlock(), vue.createBlock(_component_el_tab_pane, {
3876
+ key: 0,
3877
+ name: _ctx.config.text
3878
+ }, {
3879
+ label: vue.withCtx(() => [
3880
+ (vue.openBlock(), vue.createElementBlock("div", {
3881
+ key: _ctx.config.text
3882
+ }, [
3883
+ _ctx.config.icon ? (vue.openBlock(), vue.createBlock(_component_m_icon, {
3884
+ key: 0,
3885
+ icon: _ctx.config.icon
3886
+ }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
3887
+ _ctx.config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(_ctx.config.text), 1)) : vue.createCommentVNode("", true)
3888
+ ]))
3889
+ ]),
3890
+ default: vue.withCtx(() => [
3891
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.component), vue.mergeProps(_ctx.config.props || {}, vue.toHandlers(_ctx.config?.listeners || {})), vue.createSlots({ _: 2 }, [
3892
+ _ctx.config.slots?.layerNodeContent ? {
3893
+ name: "layer-node-content",
3894
+ fn: vue.withCtx(({ data, node }) => [
3895
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots?.layerNodeContent), {
3896
+ data,
3897
+ node
3898
+ }, null, 8, ["data", "node"]))
3899
+ ])
3900
+ } : void 0
3901
+ ]), 1040))
3902
+ ]),
3903
+ _: 1
3904
+ }, 8, ["name"])) : vue.createCommentVNode("", true);
3905
+ }
3906
+ var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
3907
+
3908
+ const _sfc_main$6 = vue.defineComponent({
3909
+ components: { TabPane },
3910
+ name: "m-sidebar",
3911
+ props: {
3912
+ data: {
3913
+ type: Object,
3914
+ default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer"] })
3915
+ }
3916
+ },
3917
+ setup(props) {
3918
+ const activeTabName = vue.ref(props.data?.status);
3919
+ vue.watch(() => props.data?.status, (status) => {
3920
+ activeTabName.value = status || "0";
3921
+ });
3922
+ return {
3923
+ activeTabName
3924
+ };
3925
+ }
3926
+ });
3927
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3928
+ const _component_tab_pane = vue.resolveComponent("tab-pane");
3844
3929
  const _component_el_tabs = vue.resolveComponent("el-tabs");
3845
- return _ctx.data.type === "tabs" ? (vue.openBlock(), vue.createBlock(_component_el_tabs, {
3930
+ return _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createBlock(_component_el_tabs, {
3846
3931
  key: 0,
3847
3932
  class: "m-editor-sidebar",
3848
3933
  modelValue: _ctx.activeTabName,
@@ -3851,35 +3936,11 @@
3851
3936
  "tab-position": "left"
3852
3937
  }, {
3853
3938
  default: vue.withCtx(() => [
3854
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.items, (item) => {
3855
- return vue.openBlock(), vue.createBlock(_component_el_tab_pane, {
3856
- key: item.text,
3857
- name: item.text
3858
- }, {
3859
- label: vue.withCtx(() => [
3860
- vue.createElementVNode("span", null, [
3861
- item.icon ? (vue.openBlock(), vue.createBlock(_component_m_icon, {
3862
- key: 0,
3863
- icon: item.icon
3864
- }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
3865
- item.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(item.text), 1)) : vue.createCommentVNode("", true)
3866
- ])
3867
- ]),
3868
- default: vue.withCtx(() => [
3869
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.component), vue.mergeProps(item.props || {}, vue.toHandlers(item.listeners || {})), vue.createSlots({ _: 2 }, [
3870
- item.slots?.layerNodeContent ? {
3871
- name: "layer-node-content",
3872
- fn: vue.withCtx(({ data, node }) => [
3873
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.slots.layerNodeContent), {
3874
- data,
3875
- node
3876
- }, null, 8, ["data", "node"]))
3877
- ])
3878
- } : void 0
3879
- ]), 1040))
3880
- ]),
3881
- _: 2
3882
- }, 1032, ["name"]);
3939
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.data.items, (item, index) => {
3940
+ return vue.openBlock(), vue.createBlock(_component_tab_pane, {
3941
+ key: index,
3942
+ data: item
3943
+ }, null, 8, ["data"]);
3883
3944
  }), 128))
3884
3945
  ]),
3885
3946
  _: 1