@tmagic/editor 1.0.2 → 1.0.5

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 (30) hide show
  1. package/dist/tmagic-editor.es.js +76 -32
  2. package/dist/tmagic-editor.es.js.map +1 -1
  3. package/dist/tmagic-editor.umd.js +76 -32
  4. package/dist/tmagic-editor.umd.js.map +1 -1
  5. package/dist/types/src/Editor.vue.d.ts +2 -1
  6. package/dist/types/src/components/Icon.vue.d.ts +2 -1
  7. package/dist/types/src/components/ScrollViewer.vue.d.ts +2 -1
  8. package/dist/types/src/fields/Code.vue.d.ts +2 -1
  9. package/dist/types/src/fields/CodeLink.vue.d.ts +3 -1
  10. package/dist/types/src/layouts/AddPageBox.vue.d.ts +1 -1
  11. package/dist/types/src/layouts/CodeEditor.vue.d.ts +2 -1
  12. package/dist/types/src/layouts/Framework.vue.d.ts +2 -1
  13. package/dist/types/src/layouts/NavMenu.vue.d.ts +3 -1
  14. package/dist/types/src/layouts/PropsPanel.vue.d.ts +2 -1
  15. package/dist/types/src/layouts/Resizer.vue.d.ts +2 -1
  16. package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +2 -1
  17. package/dist/types/src/layouts/sidebar/Sidebar.vue.d.ts +3 -1
  18. package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +3 -1
  19. package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +2 -1
  20. package/dist/types/src/services/history.d.ts +1 -1
  21. package/package.json +13 -14
  22. package/src/Editor.vue +16 -4
  23. package/src/layouts/AddPageBox.vue +1 -1
  24. package/src/layouts/Framework.vue +1 -1
  25. package/src/layouts/PropsPanel.vue +12 -9
  26. package/src/layouts/sidebar/ComponentListPanel.vue +2 -0
  27. package/src/layouts/sidebar/LayerPanel.vue +2 -0
  28. package/src/layouts/sidebar/Sidebar.vue +9 -1
  29. package/src/layouts/sidebar/TabPane.vue +10 -0
  30. package/src/services/history.ts +1 -1
@@ -188,7 +188,7 @@ const _sfc_main$k = defineComponent({
188
188
  };
189
189
  }
190
190
  });
191
- const _hoisted_1$c = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
191
+ const _hoisted_1$d = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
192
192
  function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
193
193
  const _component_el_button = resolveComponent("el-button");
194
194
  const _component_el_tooltip = resolveComponent("el-tooltip");
@@ -204,7 +204,7 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
204
204
  style: { "padding": "0" }
205
205
  }, {
206
206
  default: withCtx(() => [
207
- _hoisted_1$c
207
+ _hoisted_1$d
208
208
  ]),
209
209
  _: 1
210
210
  }, 8, ["icon"])
@@ -369,12 +369,12 @@ const _sfc_main$j = defineComponent({
369
369
  };
370
370
  }
371
371
  });
372
- const _hoisted_1$b = {
372
+ const _hoisted_1$c = {
373
373
  ref: "codeEditor",
374
374
  class: "magic-code-editor"
375
375
  };
376
376
  function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
377
- return openBlock(), createElementBlock("div", _hoisted_1$b, null, 512);
377
+ return openBlock(), createElementBlock("div", _hoisted_1$c, null, 512);
378
378
  }
379
379
  var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
380
380
 
@@ -1595,13 +1595,13 @@ const _sfc_main$i = defineComponent({
1595
1595
  };
1596
1596
  }
1597
1597
  });
1598
- const _hoisted_1$a = { class: "m-editor-empty-panel" };
1598
+ const _hoisted_1$b = { class: "m-editor-empty-panel" };
1599
1599
  const _hoisted_2$4 = { class: "m-editor-empty-content" };
1600
1600
  const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1601
1601
  function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1602
1602
  const _component_plus = resolveComponent("plus");
1603
1603
  const _component_el_icon = resolveComponent("el-icon");
1604
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
1604
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
1605
1605
  createElementVNode("div", _hoisted_2$4, [
1606
1606
  createElementVNode("div", {
1607
1607
  class: "m-editor-empty-button",
@@ -1664,12 +1664,12 @@ const _sfc_main$h = defineComponent({
1664
1664
  };
1665
1665
  }
1666
1666
  });
1667
- const _hoisted_1$9 = {
1667
+ const _hoisted_1$a = {
1668
1668
  ref: "target",
1669
1669
  class: "m-editor-resizer"
1670
1670
  };
1671
1671
  function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1672
- return openBlock(), createElementBlock("span", _hoisted_1$9, [
1672
+ return openBlock(), createElementBlock("span", _hoisted_1$a, [
1673
1673
  renderSlot(_ctx.$slots, "default")
1674
1674
  ], 512);
1675
1675
  }
@@ -1704,7 +1704,7 @@ const _sfc_main$g = defineComponent({
1704
1704
  };
1705
1705
  }
1706
1706
  });
1707
- const _hoisted_1$8 = { class: "m-editor" };
1707
+ const _hoisted_1$9 = { class: "m-editor" };
1708
1708
  const _hoisted_2$3 = {
1709
1709
  key: 1,
1710
1710
  class: "m-editor-content"
@@ -1714,7 +1714,7 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
1714
1714
  const _component_resizer = resolveComponent("resizer");
1715
1715
  const _component_el_scrollbar = resolveComponent("el-scrollbar");
1716
1716
  const _component_add_page_box = resolveComponent("add-page-box");
1717
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
1717
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
1718
1718
  renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
1719
1719
  _ctx.showSrc ? (openBlock(), createBlock(_component_magic_code_editor, {
1720
1720
  key: 0,
@@ -1744,7 +1744,7 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
1744
1744
  }, [
1745
1745
  createVNode(_component_el_scrollbar, null, {
1746
1746
  default: withCtx(() => [
1747
- renderSlot(_ctx.$slots, "propsPanel")
1747
+ renderSlot(_ctx.$slots, "props-panel")
1748
1748
  ]),
1749
1749
  _: 3
1750
1750
  })
@@ -1771,7 +1771,7 @@ const _sfc_main$f = defineComponent({
1771
1771
  };
1772
1772
  }
1773
1773
  });
1774
- const _hoisted_1$7 = ["src"];
1774
+ const _hoisted_1$8 = ["src"];
1775
1775
  function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
1776
1776
  const _component_edit = resolveComponent("edit");
1777
1777
  const _component_el_icon = resolveComponent("el-icon");
@@ -1783,7 +1783,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
1783
1783
  })) : typeof _ctx.icon === "string" && _ctx.icon.startsWith("http") ? (openBlock(), createElementBlock("img", {
1784
1784
  key: 1,
1785
1785
  src: _ctx.icon
1786
- }, null, 8, _hoisted_1$7)) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
1786
+ }, null, 8, _hoisted_1$8)) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
1787
1787
  key: 2,
1788
1788
  class: normalizeClass(_ctx.icon)
1789
1789
  }, null, 2)) : (openBlock(), createBlock(_component_el_icon, { key: 3 }, {
@@ -1955,7 +1955,7 @@ const _sfc_main$e = defineComponent({
1955
1955
  };
1956
1956
  }
1957
1957
  });
1958
- const _hoisted_1$6 = {
1958
+ const _hoisted_1$7 = {
1959
1959
  key: 1,
1960
1960
  class: "menu-item-text"
1961
1961
  };
@@ -1985,7 +1985,7 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
1985
1985
  _ctx.item.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
1986
1986
  key: 0,
1987
1987
  direction: _ctx.item.direction || "vertical"
1988
- }, 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 }, [
1988
+ }, 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 }, [
1989
1989
  createVNode(_component_tool_button, {
1990
1990
  data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
1991
1991
  "event-type": _ctx.eventType
@@ -2166,17 +2166,21 @@ const _sfc_main$c = defineComponent({
2166
2166
  };
2167
2167
  }
2168
2168
  });
2169
+ const _hoisted_1$6 = { class: "`m-editor-props-panel" };
2169
2170
  function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
2170
2171
  const _component_m_form = resolveComponent("m-form");
2171
- return openBlock(), createBlock(_component_m_form, {
2172
- class: normalizeClass(`m-editor-props-panel ${_ctx.propsPanelSize}`),
2173
- "popper-class": `m-editor-props-panel-popper ${_ctx.propsPanelSize}`,
2174
- ref: "configForm",
2175
- size: _ctx.propsPanelSize,
2176
- "init-values": _ctx.values,
2177
- config: _ctx.curFormConfig,
2178
- onChange: _ctx.submit
2179
- }, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"]);
2172
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
2173
+ renderSlot(_ctx.$slots, "props-panel-header"),
2174
+ createVNode(_component_m_form, {
2175
+ class: normalizeClass(`m-editor-props-panel ${_ctx.propsPanelSize}`),
2176
+ "popper-class": `m-editor-props-panel-popper ${_ctx.propsPanelSize}`,
2177
+ ref: "configForm",
2178
+ size: _ctx.propsPanelSize,
2179
+ "init-values": _ctx.values,
2180
+ config: _ctx.curFormConfig,
2181
+ onChange: _ctx.submit
2182
+ }, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"])
2183
+ ]);
2180
2184
  }
2181
2185
  var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
2182
2186
 
@@ -2226,6 +2230,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2226
2230
  const _component_el_scrollbar = resolveComponent("el-scrollbar");
2227
2231
  return openBlock(), createBlock(_component_el_scrollbar, null, {
2228
2232
  default: withCtx(() => [
2233
+ renderSlot(_ctx.$slots, "component-list-panel-header"),
2229
2234
  createVNode(_component_el_collapse, {
2230
2235
  class: "ui-component-panel",
2231
2236
  "model-value": _ctx.collapseValue
@@ -2283,7 +2288,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2283
2288
  _: 1
2284
2289
  }, 8, ["model-value"])
2285
2290
  ]),
2286
- _: 1
2291
+ _: 3
2287
2292
  });
2288
2293
  }
2289
2294
  var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
@@ -2648,6 +2653,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2648
2653
  const _component_el_scrollbar = resolveComponent("el-scrollbar");
2649
2654
  return openBlock(), createBlock(_component_el_scrollbar, { class: "magic-editor-layer-panel" }, {
2650
2655
  default: withCtx(() => [
2656
+ renderSlot(_ctx.$slots, "layer-panel-header"),
2651
2657
  createVNode(_component_el_input, {
2652
2658
  class: "filterInput",
2653
2659
  size: "small",
@@ -2765,6 +2771,18 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2765
2771
  ]),
2766
2772
  default: withCtx(() => [
2767
2773
  (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.component), mergeProps(_ctx.config.props || {}, toHandlers(_ctx.config?.listeners || {})), createSlots({ _: 2 }, [
2774
+ _ctx.data === "component-list" || _ctx.config.slots?.componentListPanelHeader ? {
2775
+ name: "component-list-panel-header",
2776
+ fn: withCtx(() => [
2777
+ _ctx.data === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : _ctx.config.slots?.componentListPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.componentListPanelHeader), { key: 1 })) : createCommentVNode("", true)
2778
+ ])
2779
+ } : void 0,
2780
+ _ctx.data === "layer" || _ctx.config.slots?.layerPanelHeader ? {
2781
+ name: "layer-panel-header",
2782
+ fn: withCtx(() => [
2783
+ _ctx.data === "layer" ? renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : _ctx.config.slots?.layerPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.layerPanelHeader), { key: 1 })) : createCommentVNode("", true)
2784
+ ])
2785
+ } : void 0,
2768
2786
  _ctx.config.slots?.layerNodeContent ? {
2769
2787
  name: "layer-node-content",
2770
2788
  fn: withCtx(({ data, node }) => [
@@ -2776,7 +2794,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2776
2794
  } : void 0
2777
2795
  ]), 1040))
2778
2796
  ]),
2779
- _: 1
2797
+ _: 3
2780
2798
  }, 8, ["name"])) : createCommentVNode("", true);
2781
2799
  }
2782
2800
  var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
@@ -2816,10 +2834,23 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2816
2834
  return openBlock(), createBlock(_component_tab_pane, {
2817
2835
  key: index,
2818
2836
  data: item
2819
- }, null, 8, ["data"]);
2837
+ }, createSlots({ _: 2 }, [
2838
+ item === "layer" ? {
2839
+ name: "layer-panel-header",
2840
+ fn: withCtx(() => [
2841
+ renderSlot(_ctx.$slots, "layer-panel-header")
2842
+ ])
2843
+ } : void 0,
2844
+ item === "component-list" ? {
2845
+ name: "component-list-panel-header",
2846
+ fn: withCtx(() => [
2847
+ renderSlot(_ctx.$slots, "component-list-panel-header")
2848
+ ])
2849
+ } : void 0
2850
+ ]), 1032, ["data"]);
2820
2851
  }), 128))
2821
2852
  ]),
2822
- _: 1
2853
+ _: 3
2823
2854
  }, 8, ["modelValue"])) : createCommentVNode("", true);
2824
2855
  }
2825
2856
  var Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
@@ -3994,7 +4025,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3994
4025
  ]),
3995
4026
  sidebar: withCtx(() => [
3996
4027
  renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
3997
- createVNode(_component_sidebar, { data: _ctx.sidebar }, null, 8, ["data"])
4028
+ createVNode(_component_sidebar, { data: _ctx.sidebar }, {
4029
+ "layer-panel-header": withCtx(() => [
4030
+ renderSlot(_ctx.$slots, "layer-panel-header")
4031
+ ]),
4032
+ "component-list-panel-header": withCtx(() => [
4033
+ renderSlot(_ctx.$slots, "component-list-panel-header")
4034
+ ]),
4035
+ _: 3
4036
+ }, 8, ["data"])
3998
4037
  ])
3999
4038
  ]),
4000
4039
  workspace: withCtx(() => [
@@ -4013,12 +4052,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4013
4052
  })
4014
4053
  ])
4015
4054
  ]),
4016
- propsPanel: withCtx(() => [
4017
- renderSlot(_ctx.$slots, "propsPanel", {}, () => [
4055
+ "props-panel": withCtx(() => [
4056
+ renderSlot(_ctx.$slots, "props-panel", {}, () => [
4018
4057
  createVNode(_component_props_panel, {
4019
4058
  ref: "propsPanel",
4020
4059
  onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
4021
- }, null, 512)
4060
+ }, {
4061
+ "props-panel-header": withCtx(() => [
4062
+ renderSlot(_ctx.$slots, "props-panel-header")
4063
+ ]),
4064
+ _: 3
4065
+ }, 512)
4022
4066
  ])
4023
4067
  ]),
4024
4068
  empty: withCtx(() => [