@tmagic/editor 1.0.0-rc.1 → 1.0.0-rc.12

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 (96) hide show
  1. package/dist/style.css +7 -3
  2. package/dist/tmagic-editor.es.js +304 -1405
  3. package/dist/tmagic-editor.es.js.map +1 -1
  4. package/dist/tmagic-editor.umd.js +304 -1407
  5. package/dist/tmagic-editor.umd.js.map +1 -1
  6. package/dist/types/src/Editor.vue.d.ts +42 -1
  7. package/dist/types/src/fields/Code.vue.d.ts +4 -4
  8. package/dist/types/src/fields/CodeLink.vue.d.ts +1 -3
  9. package/dist/types/src/layouts/Framework.vue.d.ts +15 -3
  10. package/dist/types/src/layouts/PropsPanel.vue.d.ts +2 -4
  11. package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +3 -27
  12. package/dist/types/src/services/BaseService.d.ts +1 -1
  13. package/dist/types/src/services/editor.d.ts +6 -3
  14. package/dist/types/src/services/history.d.ts +1 -18
  15. package/dist/types/src/services/props.d.ts +8 -2
  16. package/dist/types/src/type.d.ts +9 -0
  17. package/dist/types/src/utils/editor.d.ts +0 -6
  18. package/dist/types/src/utils/props.d.ts +10 -1
  19. package/package.json +17 -18
  20. package/src/Editor.vue +41 -9
  21. package/src/components/ContentMenu.vue +59 -26
  22. package/src/layouts/CodeEditor.vue +1 -4
  23. package/src/layouts/Framework.vue +14 -1
  24. package/src/layouts/PropsPanel.vue +1 -1
  25. package/src/layouts/sidebar/LayerMenu.vue +3 -0
  26. package/src/layouts/sidebar/TabPane.vue +1 -1
  27. package/src/layouts/workspace/Stage.vue +14 -31
  28. package/src/layouts/workspace/ViewerMenu.vue +17 -2
  29. package/src/layouts/workspace/Workspace.vue +21 -26
  30. package/src/services/BaseService.ts +1 -1
  31. package/src/services/editor.ts +49 -14
  32. package/src/services/props.ts +64 -9
  33. package/src/theme/page-bar.scss +1 -0
  34. package/src/theme/props-panel.scss +6 -4
  35. package/src/theme/workspace.scss +4 -0
  36. package/src/type.ts +10 -0
  37. package/src/utils/editor.ts +7 -52
  38. package/src/utils/polyfills.ts +5 -19
  39. package/src/utils/props.ts +31 -7
  40. package/LICENSE +0 -5432
  41. package/coverage/clover.xml +0 -1560
  42. package/coverage/coverage-final.json +0 -36
  43. package/coverage/lcov-report/base.css +0 -224
  44. package/coverage/lcov-report/block-navigation.js +0 -87
  45. package/coverage/lcov-report/favicon.png +0 -0
  46. package/coverage/lcov-report/index.html +0 -206
  47. package/coverage/lcov-report/prettify.css +0 -1
  48. package/coverage/lcov-report/prettify.js +0 -2
  49. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  50. package/coverage/lcov-report/sorter.js +0 -196
  51. package/coverage/lcov-report/src/Editor.vue.html +0 -787
  52. package/coverage/lcov-report/src/components/ContentMenu.vue.html +0 -406
  53. package/coverage/lcov-report/src/components/Icon.vue.html +0 -172
  54. package/coverage/lcov-report/src/components/ScrollViewer.vue.html +0 -283
  55. package/coverage/lcov-report/src/components/ToolButton.vue.html +0 -772
  56. package/coverage/lcov-report/src/components/index.html +0 -161
  57. package/coverage/lcov-report/src/index.html +0 -131
  58. package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +0 -214
  59. package/coverage/lcov-report/src/layouts/Framework.vue.html +0 -304
  60. package/coverage/lcov-report/src/layouts/NavMenu.vue.html +0 -208
  61. package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +0 -319
  62. package/coverage/lcov-report/src/layouts/Resizer.vue.html +0 -268
  63. package/coverage/lcov-report/src/layouts/index.html +0 -176
  64. package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +0 -358
  65. package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +0 -421
  66. package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +0 -775
  67. package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +0 -226
  68. package/coverage/lcov-report/src/layouts/sidebar/TabPane.vue.html +0 -289
  69. package/coverage/lcov-report/src/layouts/sidebar/index.html +0 -176
  70. package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +0 -718
  71. package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +0 -757
  72. package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +0 -532
  73. package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +0 -586
  74. package/coverage/lcov-report/src/layouts/workspace/index.html +0 -161
  75. package/coverage/lcov-report/src/services/BaseService.ts.html +0 -643
  76. package/coverage/lcov-report/src/services/componentList.ts.html +0 -229
  77. package/coverage/lcov-report/src/services/editor.ts.html +0 -2077
  78. package/coverage/lcov-report/src/services/events.ts.html +0 -331
  79. package/coverage/lcov-report/src/services/history.ts.html +0 -478
  80. package/coverage/lcov-report/src/services/index.html +0 -206
  81. package/coverage/lcov-report/src/services/props.ts.html +0 -415
  82. package/coverage/lcov-report/src/services/ui.ts.html +0 -580
  83. package/coverage/lcov-report/src/type.ts.html +0 -850
  84. package/coverage/lcov-report/src/utils/compose.ts.html +0 -184
  85. package/coverage/lcov-report/src/utils/config.ts.html +0 -172
  86. package/coverage/lcov-report/src/utils/editor.ts.html +0 -838
  87. package/coverage/lcov-report/src/utils/index.html +0 -221
  88. package/coverage/lcov-report/src/utils/index.ts.html +0 -151
  89. package/coverage/lcov-report/src/utils/logger.ts.html +0 -226
  90. package/coverage/lcov-report/src/utils/props.ts.html +0 -796
  91. package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +0 -733
  92. package/coverage/lcov-report/src/utils/undo-redo.ts.html +0 -313
  93. package/coverage/lcov.info +0 -3708
  94. package/dist/types/src/components/ToolButton.vue.d.ts +0 -46
  95. package/dist/types/src/fields/UISelect.vue.d.ts +0 -35
  96. package/dist/types/src/layouts/workspace/PageBar.vue.d.ts +0 -18
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
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';
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('gesto'), 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', 'gesto', '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.Gesto, global.ElementPlus, global.KeyController, global.StageCore));
5
+ })(this, (function (exports, vue, serialize, icons, lodashEs, monaco, schema, utils, events, core, Gesto, 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
 
@@ -26,12 +26,16 @@
26
26
 
27
27
  var serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize);
28
28
  var monaco__namespace = /*#__PURE__*/_interopNamespace(monaco);
29
+ var Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
29
30
  var KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
30
31
  var StageCore__default = /*#__PURE__*/_interopDefaultLegacy(StageCore);
31
32
 
32
- if (typeof window.global === "undefined") {
33
+ if (typeof global === "undefined") {
33
34
  window.global = window;
34
35
  }
36
+ if (typeof globalThis === "undefined") {
37
+ window.globalThis = window;
38
+ }
35
39
 
36
40
  var _export_sfc = (sfc, props) => {
37
41
  const target = sfc.__vccOpts || sfc;
@@ -135,7 +139,7 @@
135
139
  }
136
140
  var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
137
141
 
138
- var UISelect_vue_vue_type_style_index_0_lang = '';
142
+ var UISelect_vue_vue_type_style_index_0_lang = /* #__PURE__ */ (() => ".m-fields-ui-select {\n cursor: pointer;\n}\n.m-fields-ui-select i {\n margin-right: 3px;\n}\n.m-fields-ui-select span {\n color: #2882e0;\n}")();
139
143
 
140
144
  const _sfc_main$k = vue.defineComponent({
141
145
  name: "m-fields-ui-select",
@@ -328,11 +332,7 @@
328
332
  const options = {
329
333
  value: values.value,
330
334
  language: props.language,
331
- tabSize: 2,
332
335
  theme: "vs-dark",
333
- fontFamily: 'dm, Menlo, Monaco, "Courier New", monospace',
334
- fontSize: 14,
335
- formatOnPaste: true,
336
336
  ...props.options
337
337
  };
338
338
  if (props.type === "diff") {
@@ -346,6 +346,7 @@
346
346
  codeEditor.value.addEventListener("keydown", (e) => {
347
347
  if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
348
348
  e.preventDefault();
349
+ e.stopPropagation();
349
350
  emit("save", getEditorValue());
350
351
  }
351
352
  });
@@ -644,7 +645,7 @@
644
645
 
645
646
  class Props extends BaseService {
646
647
  constructor() {
647
- super(["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue"]);
648
+ super(["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue", "createId", "setNewItemId"]);
648
649
  this.state = vue.reactive({
649
650
  propsConfigMap: {},
650
651
  propsValueMap: {}
@@ -683,12 +684,44 @@
683
684
  }
684
685
  return value;
685
686
  }
686
- return lodashEs.cloneDeep({
687
- ...getDefaultPropsValue(type),
688
- ...lodashEs.mergeWith(this.state.propsValueMap[type] || {}, defaultValue)
689
- });
687
+ const data = lodashEs.cloneDeep(defaultValue);
688
+ await this.setNewItemId(data);
689
+ return {
690
+ ...getDefaultPropsValue(type, await this.createId(type)),
691
+ ...lodashEs.mergeWith(lodashEs.cloneDeep(this.state.propsValueMap[type] || {}), data)
692
+ };
693
+ }
694
+ async createId(type) {
695
+ return `${type}_${lodashEs.random(1e4, false)}`;
696
+ }
697
+ async setNewItemId(config, parent) {
698
+ const oldId = config.id;
699
+ config.id = await this.createId(config.type || "component");
700
+ if (utils.isPop(config) && parent?.type === schema.NodeType.PAGE) {
701
+ updatePopId(oldId, config.id, parent);
702
+ }
703
+ if (config.items && Array.isArray(config.items)) {
704
+ for (const item of config.items) {
705
+ await this.setNewItemId(item, config);
706
+ }
707
+ }
690
708
  }
691
709
  }
710
+ const updatePopId = (oldId, popId, pageConfig) => {
711
+ pageConfig.items?.forEach((config) => {
712
+ if (config.pop === oldId) {
713
+ config.pop = popId;
714
+ return;
715
+ }
716
+ if (config.popId === oldId) {
717
+ config.popId = popId;
718
+ return;
719
+ }
720
+ if (Array.isArray(config.items)) {
721
+ updatePopId(oldId, popId, config);
722
+ }
723
+ });
724
+ };
692
725
  var propsService = new Props();
693
726
 
694
727
  var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
@@ -709,7 +742,6 @@
709
742
  })(Keys || {});
710
743
 
711
744
  const COPY_STORAGE_KEY = "$MagicEditorCopyData";
712
- const generateId = (type) => `${type}_${lodashEs.random(1e4, false)}`;
713
745
  const getPageList = (app) => {
714
746
  if (app.items && Array.isArray(app.items)) {
715
747
  return app.items.filter((item) => item.type === schema.NodeType.PAGE);
@@ -729,32 +761,6 @@
729
761
  return pageName;
730
762
  };
731
763
  const generatePageNameByApp = (app) => generatePageName(getPageNameList(getPageList(app)));
732
- const updatePopId = (oldId, popId, pageConfig) => {
733
- pageConfig.items?.forEach((config) => {
734
- if (config.pop === oldId) {
735
- config.pop = popId;
736
- return;
737
- }
738
- if (config.popId === oldId) {
739
- config.popId = popId;
740
- return;
741
- }
742
- if (Array.isArray(config.items)) {
743
- updatePopId(oldId, popId, config);
744
- }
745
- });
746
- };
747
- const setNewItemId = (config, parent) => {
748
- const oldId = config.id;
749
- config.id = generateId(config.type || "component");
750
- config.name = `${config.name?.replace(/_(\d+)$/, "")}_${config.id}`;
751
- if (utils.isPop(config) && parent?.type === schema.NodeType.PAGE) {
752
- updatePopId(oldId, config.id, parent);
753
- }
754
- if (config.items && Array.isArray(config.items)) {
755
- config.items.forEach((item) => setNewItemId(item, config));
756
- }
757
- };
758
764
  const isFixed = (node) => node.style?.position === "fixed";
759
765
  const getNodeIndex = (node, parent) => {
760
766
  const items = parent?.items || [];
@@ -771,9 +777,12 @@
771
777
  };
772
778
  const setTop2Middle = (node, parentNode, stage) => {
773
779
  const style = node.style || {};
774
- const height = style.height || 0;
775
- if (!stage || typeof style.top !== "undefined" || !parentNode.style || !utils.isNumber(height))
780
+ let height = style.height || 0;
781
+ if (!stage || typeof style.top !== "undefined" || !parentNode.style)
776
782
  return style;
783
+ if (!utils.isNumber(height)) {
784
+ height = 0;
785
+ }
777
786
  const { height: parentHeight } = parentNode.style;
778
787
  if (utils.isPage(parentNode)) {
779
788
  const { scrollTop = 0, wrapperHeight } = stage.mask;
@@ -909,8 +918,11 @@
909
918
  get(name) {
910
919
  return this.state[name];
911
920
  }
912
- getNodeInfo(id) {
913
- const root = vue.toRaw(this.get("root"));
921
+ getNodeInfo(id, raw = true) {
922
+ let root = this.get("root");
923
+ if (raw) {
924
+ root = vue.toRaw(root);
925
+ }
914
926
  if (!root)
915
927
  return {};
916
928
  if (id === root.id) {
@@ -931,14 +943,14 @@
931
943
  });
932
944
  return info;
933
945
  }
934
- getNodeById(id) {
935
- const { node } = this.getNodeInfo(id);
946
+ getNodeById(id, raw = true) {
947
+ const { node } = this.getNodeInfo(id, raw);
936
948
  return node;
937
949
  }
938
- getParentById(id) {
950
+ getParentById(id, raw = true) {
939
951
  if (!this.get("root"))
940
952
  return;
941
- const { parent } = this.getNodeInfo(id);
953
+ const { parent } = this.getNodeInfo(id, raw);
942
954
  return parent;
943
955
  }
944
956
  async getLayout(parent, node) {
@@ -962,6 +974,13 @@
962
974
  } else {
963
975
  historyService.empty();
964
976
  }
977
+ if (node?.id) {
978
+ this.get("stage")?.renderer.runtime?.getApp?.()?.emit("editor:select", {
979
+ node,
980
+ page,
981
+ parent
982
+ }, utils.getNodePath(node.id, this.get("root").items));
983
+ }
965
984
  this.emit("select", node);
966
985
  return node;
967
986
  }
@@ -1006,7 +1025,7 @@
1006
1025
  } else if (curNode.items) {
1007
1026
  parentNode = curNode;
1008
1027
  } else {
1009
- parentNode = this.getParentById(curNode.id);
1028
+ parentNode = this.getParentById(curNode.id, false);
1010
1029
  }
1011
1030
  if (!parentNode)
1012
1031
  throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
@@ -1036,7 +1055,7 @@
1036
1055
  const root = this.get("root");
1037
1056
  if (!root)
1038
1057
  throw new Error("\u6CA1\u6709root");
1039
- const { parent, node: curNode } = this.getNodeInfo(node.id);
1058
+ const { parent, node: curNode } = this.getNodeInfo(node.id, false);
1040
1059
  if (!parent || !curNode)
1041
1060
  throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1042
1061
  const index = getNodeIndex(curNode, parent);
@@ -1073,7 +1092,7 @@
1073
1092
  async update(config2) {
1074
1093
  if (!config2?.id)
1075
1094
  throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
1076
- const info = this.getNodeInfo(config2.id);
1095
+ const info = this.getNodeInfo(config2.id, false);
1077
1096
  if (!info.node)
1078
1097
  throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config2.id}\u7684\u8282\u70B9`);
1079
1098
  const node = lodashEs.cloneDeep(vue.toRaw(info.node));
@@ -1143,13 +1162,16 @@
1143
1162
  console.error(e);
1144
1163
  return;
1145
1164
  }
1146
- setNewItemId(config, this.get("root"));
1165
+ await propsService.setNewItemId(config, this.get("root"));
1147
1166
  if (config.style) {
1148
1167
  config.style = {
1149
1168
  ...config.style,
1150
1169
  ...position
1151
1170
  };
1152
1171
  }
1172
+ if (utils.isPage(config)) {
1173
+ config.name = generatePageNameByApp(this.get("root"));
1174
+ }
1153
1175
  return await this.add(config);
1154
1176
  }
1155
1177
  async alignCenter(config2) {
@@ -1159,7 +1181,17 @@
1159
1181
  if (layout === Layout.RELATIVE) {
1160
1182
  return;
1161
1183
  }
1162
- if (parent.style?.width && node.style?.width) {
1184
+ if (!node.style)
1185
+ return;
1186
+ const stage = this.get("stage");
1187
+ const doc = stage?.renderer.contentWindow?.document;
1188
+ if (doc) {
1189
+ const parentEl = doc.getElementById(`${parent.id}`);
1190
+ const el = doc.getElementById(`${node.id}`);
1191
+ if (parentEl && el) {
1192
+ node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
1193
+ }
1194
+ } else if (parent.style && utils.isNumber(parent.style?.width) && utils.isNumber(node.style?.width)) {
1163
1195
  node.style.left = (parent.style.width - node.style.width) / 2;
1164
1196
  }
1165
1197
  await this.update(node);
@@ -1173,9 +1205,9 @@
1173
1205
  const node = this.get("node");
1174
1206
  const brothers = parent?.items || [];
1175
1207
  const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
1176
- if (offset === LayerOffset.BOTTOM) {
1208
+ if (offset === LayerOffset.TOP) {
1177
1209
  brothers.splice(brothers.length - 1, 0, brothers.splice(index, 1)[0]);
1178
- } else if (offset === LayerOffset.TOP) {
1210
+ } else if (offset === LayerOffset.BOTTOM) {
1179
1211
  brothers.splice(0, 0, brothers.splice(index, 1)[0]);
1180
1212
  } else {
1181
1213
  brothers.splice(index + parseInt(`${offset}`, 10), 0, brothers.splice(index, 1)[0]);
@@ -1460,6 +1492,21 @@
1460
1492
  text: "\u7C97\u7EC6"
1461
1493
  }
1462
1494
  ]
1495
+ },
1496
+ {
1497
+ type: "fieldset",
1498
+ legend: "\u53D8\u5F62",
1499
+ name: "transform",
1500
+ items: [
1501
+ {
1502
+ name: "rotate",
1503
+ text: "\u65CB\u8F6C\u89D2\u5EA6"
1504
+ },
1505
+ {
1506
+ name: "scale",
1507
+ text: "\u7F29\u653E"
1508
+ }
1509
+ ]
1463
1510
  }
1464
1511
  ]
1465
1512
  }
@@ -1513,1272 +1560,70 @@
1513
1560
  name: "created",
1514
1561
  text: "created",
1515
1562
  formTitle: "created"
1516
- }
1517
- ]
1518
- }
1519
- ]
1520
- }
1521
- ];
1522
- const DEFAULT_CONFIG = fillConfig([]);
1523
- const getDefaultPropsValue = (type) => ({
1524
- type,
1525
- id: generateId(type),
1526
- style: {},
1527
- name: type
1528
- });
1529
-
1530
- const _sfc_main$i = vue.defineComponent({
1531
- components: { Plus: icons.Plus },
1532
- setup() {
1533
- const services = vue.inject("services");
1534
- return {
1535
- clickHandler() {
1536
- const { editorService } = services || {};
1537
- if (!editorService)
1538
- return;
1539
- editorService.add({
1540
- type: schema.NodeType.PAGE,
1541
- name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
1542
- });
1543
- }
1544
- };
1545
- }
1546
- });
1547
- const _hoisted_1$a = { class: "m-editor-empty-panel" };
1548
- const _hoisted_2$4 = { class: "m-editor-empty-content" };
1549
- const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1550
- function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1551
- const _component_plus = vue.resolveComponent("plus");
1552
- const _component_el_icon = vue.resolveComponent("el-icon");
1553
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
1554
- vue.createElementVNode("div", _hoisted_2$4, [
1555
- vue.createElementVNode("div", {
1556
- class: "m-editor-empty-button",
1557
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
1558
- }, [
1559
- vue.createElementVNode("div", null, [
1560
- vue.createVNode(_component_el_icon, null, {
1561
- default: vue.withCtx(() => [
1562
- vue.createVNode(_component_plus)
1563
- ]),
1564
- _: 1
1565
- })
1566
- ]),
1567
- _hoisted_3$2
1568
- ])
1569
- ])
1570
- ]);
1571
- }
1572
- var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
1573
-
1574
- /*
1575
- Copyright (c) 2018 Daybrush
1576
- @name: @daybrush/utils
1577
- license: MIT
1578
- author: Daybrush
1579
- repository: https://github.com/daybrush/utils
1580
- @version 1.6.0
1581
- */
1582
- /**
1583
- * get string "object"
1584
- * @memberof Consts
1585
- * @example
1586
- import {OBJECT} from "@daybrush/utils";
1587
-
1588
- console.log(OBJECT); // "object"
1589
- */
1590
-
1591
- var OBJECT = "object";
1592
- /**
1593
- * Check the type that the value is object.
1594
- * @memberof Utils
1595
- * @param {string} value - Value to check the type
1596
- * @return {} true if the type is correct, false otherwise
1597
- * @example
1598
- import {isObject} from "@daybrush/utils";
1599
-
1600
- console.log(isObject({})); // true
1601
- console.log(isObject(undefined)); // false
1602
- console.log(isObject("")); // false
1603
- console.log(isObject(null)); // false
1604
- */
1605
-
1606
- function isObject(value) {
1607
- return value && typeof value === OBJECT;
1608
- }
1609
- /**
1610
- * Date.now() method
1611
- * @memberof CrossBrowser
1612
- * @return {number} milliseconds
1613
- * @example
1614
- import {now} from "@daybrush/utils";
1615
-
1616
- console.log(now()); // 12121324241(milliseconds)
1617
- */
1618
-
1619
- function now() {
1620
- return Date.now ? Date.now() : new Date().getTime();
1621
- }
1622
- /**
1623
- * Returns the index of the first element in the array that satisfies the provided testing function.
1624
- * @function
1625
- * @memberof CrossBrowser
1626
- * @param - The array `findIndex` was called upon.
1627
- * @param - A function to execute on each value in the array until the function returns true, indicating that the satisfying element was found.
1628
- * @param - Returns defaultIndex if not found by the function.
1629
- * @example
1630
- import { findIndex } from "@daybrush/utils";
1631
-
1632
- findIndex([{a: 1}, {a: 2}, {a: 3}, {a: 4}], ({ a }) => a === 2); // 1
1633
- */
1634
-
1635
- function findIndex(arr, callback, defaultIndex) {
1636
- if (defaultIndex === void 0) {
1637
- defaultIndex = -1;
1638
- }
1639
-
1640
- var length = arr.length;
1641
-
1642
- for (var i = 0; i < length; ++i) {
1643
- if (callback(arr[i], i, arr)) {
1644
- return i;
1645
- }
1646
- }
1647
-
1648
- return defaultIndex;
1649
- }
1650
- /**
1651
- * Sets up a function that will be called whenever the specified event is delivered to the target
1652
- * @memberof DOM
1653
- * @param - event target
1654
- * @param - A case-sensitive string representing the event type to listen for.
1655
- * @param - The object which receives a notification (an object that implements the Event interface) when an event of the specified type occurs
1656
- * @param - An options object that specifies characteristics about the event listener.
1657
- * @example
1658
- import {addEvent} from "@daybrush/utils";
1659
-
1660
- addEvent(el, "click", e => {
1661
- console.log(e);
1662
- });
1663
- */
1664
-
1665
- function addEvent(el, type, listener, options) {
1666
- el.addEventListener(type, listener, options);
1667
- }
1668
- /**
1669
- * removes from the EventTarget an event listener previously registered with EventTarget.addEventListener()
1670
- * @memberof DOM
1671
- * @param - event target
1672
- * @param - A case-sensitive string representing the event type to listen for.
1673
- * @param - The EventListener function of the event handler to remove from the event target.
1674
- * @param - An options object that specifies characteristics about the event listener.
1675
- * @example
1676
- import {addEvent, removeEvent} from "@daybrush/utils";
1677
- const listener = e => {
1678
- console.log(e);
1679
- };
1680
- addEvent(el, "click", listener);
1681
- removeEvent(el, "click", listener);
1682
- */
1683
-
1684
- function removeEvent(el, type, listener, options) {
1685
- el.removeEventListener(type, listener, options);
1686
- }
1687
-
1688
- /*
1689
- Copyright (c) 2019 Daybrush
1690
- name: @scena/event-emitter
1691
- license: MIT
1692
- author: Daybrush
1693
- repository: git+https://github.com/daybrush/gesture.git
1694
- version: 1.0.5
1695
- */
1696
-
1697
- /*! *****************************************************************************
1698
- Copyright (c) Microsoft Corporation.
1699
-
1700
- Permission to use, copy, modify, and/or distribute this software for any
1701
- purpose with or without fee is hereby granted.
1702
-
1703
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1704
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1705
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1706
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1707
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1708
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1709
- PERFORMANCE OF THIS SOFTWARE.
1710
- ***************************************************************************** */
1711
- var __assign$1 = function () {
1712
- __assign$1 = Object.assign || function __assign(t) {
1713
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1714
- s = arguments[i];
1715
-
1716
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1717
- }
1718
-
1719
- return t;
1720
- };
1721
-
1722
- return __assign$1.apply(this, arguments);
1723
- };
1724
- function __spreadArrays() {
1725
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1726
-
1727
- for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
1728
-
1729
- return r;
1730
- }
1731
-
1732
- /**
1733
- * Implement EventEmitter on object or component.
1734
- */
1735
-
1736
- var EventEmitter =
1737
- /*#__PURE__*/
1738
- function () {
1739
- function EventEmitter() {
1740
- this._events = {};
1741
- }
1742
- /**
1743
- * Add a listener to the registered event.
1744
- * @param - Name of the event to be added
1745
- * @param - listener function of the event to be added
1746
- * @example
1747
- * import EventEmitter from "@scena/event-emitter";
1748
- * cosnt emitter = new EventEmitter();
1749
- *
1750
- * // Add listener in "a" event
1751
- * emitter.on("a", () => {
1752
- * });
1753
- * // Add listeners
1754
- * emitter.on({
1755
- * a: () => {},
1756
- * b: () => {},
1757
- * });
1758
- */
1759
-
1760
-
1761
- var __proto = EventEmitter.prototype;
1762
-
1763
- __proto.on = function (eventName, listener) {
1764
- if (isObject(eventName)) {
1765
- for (var name in eventName) {
1766
- this.on(name, eventName[name]);
1767
- }
1768
- } else {
1769
- this._addEvent(eventName, listener, {});
1770
- }
1771
-
1772
- return this;
1773
- };
1774
- /**
1775
- * Remove listeners registered in the event target.
1776
- * @param - Name of the event to be removed
1777
- * @param - listener function of the event to be removed
1778
- * @example
1779
- * import EventEmitter from "@scena/event-emitter";
1780
- * cosnt emitter = new EventEmitter();
1781
- *
1782
- * // Remove all listeners.
1783
- * emitter.off();
1784
- *
1785
- * // Remove all listeners in "A" event.
1786
- * emitter.off("a");
1787
- *
1788
- *
1789
- * // Remove "listener" listener in "a" event.
1790
- * emitter.off("a", listener);
1791
- */
1792
-
1793
-
1794
- __proto.off = function (eventName, listener) {
1795
- if (!eventName) {
1796
- this._events = {};
1797
- } else if (isObject(eventName)) {
1798
- for (var name in eventName) {
1799
- this.off(name);
1800
- }
1801
- } else if (!listener) {
1802
- this._events[eventName] = [];
1803
- } else {
1804
- var events = this._events[eventName];
1805
-
1806
- if (events) {
1807
- var index = findIndex(events, function (e) {
1808
- return e.listener === listener;
1809
- });
1810
-
1811
- if (index > -1) {
1812
- events.splice(index, 1);
1813
- }
1814
- }
1815
- }
1816
-
1817
- return this;
1818
- };
1819
- /**
1820
- * Add a disposable listener and Use promise to the registered event.
1821
- * @param - Name of the event to be added
1822
- * @param - disposable listener function of the event to be added
1823
- * @example
1824
- * import EventEmitter from "@scena/event-emitter";
1825
- * cosnt emitter = new EventEmitter();
1826
- *
1827
- * // Add a disposable listener in "a" event
1828
- * emitter.once("a", () => {
1829
- * });
1830
- *
1831
- * // Use Promise
1832
- * emitter.once("a").then(e => {
1833
- * });
1834
- */
1835
-
1836
-
1837
- __proto.once = function (eventName, listener) {
1838
- var _this = this;
1839
-
1840
- if (listener) {
1841
- this._addEvent(eventName, listener, {
1842
- once: true
1843
- });
1844
- }
1845
-
1846
- return new Promise(function (resolve) {
1847
- _this._addEvent(eventName, resolve, {
1848
- once: true
1849
- });
1850
- });
1851
- };
1852
- /**
1853
- * Fires an event to call listeners.
1854
- * @param - Event name
1855
- * @param - Event parameter
1856
- * @return If false, stop the event.
1857
- * @example
1858
- *
1859
- * import EventEmitter from "@scena/event-emitter";
1860
- *
1861
- *
1862
- * const emitter = new EventEmitter();
1863
- *
1864
- * emitter.on("a", e => {
1865
- * });
1866
- *
1867
- *
1868
- * emitter.emit("a", {
1869
- * a: 1,
1870
- * });
1871
- */
1872
-
1873
-
1874
- __proto.emit = function (eventName, param) {
1875
- var _this = this;
1876
-
1877
- if (param === void 0) {
1878
- param = {};
1879
- }
1880
-
1881
- var events = this._events[eventName];
1882
-
1883
- if (!eventName || !events) {
1884
- return true;
1885
- }
1886
-
1887
- var isStop = false;
1888
- param.eventType = eventName;
1889
-
1890
- param.stop = function () {
1891
- isStop = true;
1892
- };
1893
-
1894
- param.currentTarget = this;
1895
-
1896
- __spreadArrays(events).forEach(function (info) {
1897
- info.listener(param);
1898
-
1899
- if (info.once) {
1900
- _this.off(eventName, info.listener);
1901
- }
1902
- });
1903
-
1904
- return !isStop;
1905
- };
1906
- /**
1907
- * Fires an event to call listeners.
1908
- * @param - Event name
1909
- * @param - Event parameter
1910
- * @return If false, stop the event.
1911
- * @example
1912
- *
1913
- * import EventEmitter from "@scena/event-emitter";
1914
- *
1915
- *
1916
- * const emitter = new EventEmitter();
1917
- *
1918
- * emitter.on("a", e => {
1919
- * });
1920
- *
1921
- *
1922
- * emitter.emit("a", {
1923
- * a: 1,
1924
- * });
1925
- */
1926
-
1927
- /**
1928
- * Fires an event to call listeners.
1929
- * @param - Event name
1930
- * @param - Event parameter
1931
- * @return If false, stop the event.
1932
- * @example
1933
- *
1934
- * import EventEmitter from "@scena/event-emitter";
1935
- *
1936
- *
1937
- * const emitter = new EventEmitter();
1938
- *
1939
- * emitter.on("a", e => {
1940
- * });
1941
- *
1942
- * // emit
1943
- * emitter.trigger("a", {
1944
- * a: 1,
1945
- * });
1946
- */
1947
-
1948
-
1949
- __proto.trigger = function (eventName, param) {
1950
- if (param === void 0) {
1951
- param = {};
1952
- }
1953
-
1954
- return this.emit(eventName, param);
1955
- };
1956
-
1957
- __proto._addEvent = function (eventName, listener, options) {
1958
- var events = this._events;
1959
- events[eventName] = events[eventName] || [];
1960
- var listeners = events[eventName];
1961
- listeners.push(__assign$1({
1962
- listener: listener
1963
- }, options));
1964
- };
1965
-
1966
- return EventEmitter;
1967
- }();
1968
-
1969
- var EventEmitter$1 = EventEmitter;
1970
-
1971
- /*
1972
- Copyright (c) 2019 Daybrush
1973
- name: gesto
1974
- license: MIT
1975
- author: Daybrush
1976
- repository: git+https://github.com/daybrush/gesto.git
1977
- version: 1.7.0
1978
- */
1979
-
1980
- /*! *****************************************************************************
1981
- Copyright (c) Microsoft Corporation. All rights reserved.
1982
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
1983
- this file except in compliance with the License. You may obtain a copy of the
1984
- License at http://www.apache.org/licenses/LICENSE-2.0
1985
-
1986
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1987
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
1988
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
1989
- MERCHANTABLITY OR NON-INFRINGEMENT.
1990
-
1991
- See the Apache Version 2.0 License for specific language governing permissions
1992
- and limitations under the License.
1993
- ***************************************************************************** */
1994
-
1995
- /* global Reflect, Promise */
1996
- var extendStatics = function (d, b) {
1997
- extendStatics = Object.setPrototypeOf || {
1998
- __proto__: []
1999
- } instanceof Array && function (d, b) {
2000
- d.__proto__ = b;
2001
- } || function (d, b) {
2002
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
2003
- };
2004
-
2005
- return extendStatics(d, b);
2006
- };
2007
-
2008
- function __extends(d, b) {
2009
- extendStatics(d, b);
2010
-
2011
- function __() {
2012
- this.constructor = d;
2013
- }
2014
-
2015
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2016
- }
2017
- var __assign = function () {
2018
- __assign = Object.assign || function __assign(t) {
2019
- for (var s, i = 1, n = arguments.length; i < n; i++) {
2020
- s = arguments[i];
2021
-
2022
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2023
- }
2024
-
2025
- return t;
2026
- };
2027
-
2028
- return __assign.apply(this, arguments);
2029
- };
2030
-
2031
- function getRad(pos1, pos2) {
2032
- var distX = pos2[0] - pos1[0];
2033
- var distY = pos2[1] - pos1[1];
2034
- var rad = Math.atan2(distY, distX);
2035
- return rad >= 0 ? rad : rad + Math.PI * 2;
2036
- }
2037
- function getRotatiion(touches) {
2038
- return getRad([touches[0].clientX, touches[0].clientY], [touches[1].clientX, touches[1].clientY]) / Math.PI * 180;
2039
- }
2040
- function isMultiTouch(e) {
2041
- return e.touches && e.touches.length >= 2;
2042
- }
2043
- function getEventClients(e) {
2044
- if (e.touches) {
2045
- return getClients(e.touches);
2046
- } else {
2047
- return [getClient(e)];
2048
- }
2049
- }
2050
- function getPosition(clients, prevClients, startClients) {
2051
- var length = startClients.length;
2052
-
2053
- var _a = getAverageClient(clients, length),
2054
- clientX = _a.clientX,
2055
- clientY = _a.clientY,
2056
- originalClientX = _a.originalClientX,
2057
- originalClientY = _a.originalClientY;
2058
-
2059
- var _b = getAverageClient(prevClients, length),
2060
- prevX = _b.clientX,
2061
- prevY = _b.clientY;
2062
-
2063
- var _c = getAverageClient(startClients, length),
2064
- startX = _c.clientX,
2065
- startY = _c.clientY;
2066
-
2067
- var deltaX = clientX - prevX;
2068
- var deltaY = clientY - prevY;
2069
- var distX = clientX - startX;
2070
- var distY = clientY - startY;
2071
- return {
2072
- clientX: originalClientX,
2073
- clientY: originalClientY,
2074
- deltaX: deltaX,
2075
- deltaY: deltaY,
2076
- distX: distX,
2077
- distY: distY
2078
- };
2079
- }
2080
- function getDist(clients) {
2081
- return Math.sqrt(Math.pow(clients[0].clientX - clients[1].clientX, 2) + Math.pow(clients[0].clientY - clients[1].clientY, 2));
2082
- }
2083
- function getClients(touches) {
2084
- var length = Math.min(touches.length, 2);
2085
- var clients = [];
2086
-
2087
- for (var i = 0; i < length; ++i) {
2088
- clients.push(getClient(touches[i]));
2089
- }
2090
-
2091
- return clients;
2092
- }
2093
- function getClient(e) {
2094
- return {
2095
- clientX: e.clientX,
2096
- clientY: e.clientY
2097
- };
2098
- }
2099
- function getAverageClient(clients, length) {
2100
- if (length === void 0) {
2101
- length = clients.length;
2102
- }
2103
-
2104
- var sumClient = {
2105
- clientX: 0,
2106
- clientY: 0,
2107
- originalClientX: 0,
2108
- originalClientY: 0
2109
- };
2110
-
2111
- for (var i = 0; i < length; ++i) {
2112
- var client = clients[i];
2113
- sumClient.originalClientX += "originalClientX" in client ? client.originalClientX : client.clientX;
2114
- sumClient.originalClientY += "originalClientY" in client ? client.originalClientY : client.clientY;
2115
- sumClient.clientX += client.clientX;
2116
- sumClient.clientY += client.clientY;
2117
- }
2118
-
2119
- if (!length) {
2120
- return sumClient;
2121
- }
2122
-
2123
- return {
2124
- clientX: sumClient.clientX / length,
2125
- clientY: sumClient.clientY / length,
2126
- originalClientX: sumClient.originalClientX / length,
2127
- originalClientY: sumClient.originalClientY / length
2128
- };
2129
- }
2130
-
2131
- var ClientStore =
2132
- /*#__PURE__*/
2133
- function () {
2134
- function ClientStore(clients) {
2135
- this.prevClients = [];
2136
- this.startClients = [];
2137
- this.movement = 0;
2138
- this.length = 0;
2139
- this.startClients = clients;
2140
- this.prevClients = clients;
2141
- this.length = clients.length;
2142
- }
2143
-
2144
- var __proto = ClientStore.prototype;
2145
-
2146
- __proto.getAngle = function (clients) {
2147
- if (clients === void 0) {
2148
- clients = this.prevClients;
2149
- }
2150
-
2151
- return getRotatiion(clients);
2152
- };
2153
-
2154
- __proto.getRotation = function (clients) {
2155
- if (clients === void 0) {
2156
- clients = this.prevClients;
2157
- }
2158
-
2159
- return getRotatiion(clients) - getRotatiion(this.startClients);
2160
- };
2161
-
2162
- __proto.getPosition = function (clients, isAdd) {
2163
- if (clients === void 0) {
2164
- clients = this.prevClients;
2165
- }
2166
-
2167
- var position = getPosition(clients || this.prevClients, this.prevClients, this.startClients);
2168
- var deltaX = position.deltaX,
2169
- deltaY = position.deltaY;
2170
- this.movement += Math.sqrt(deltaX * deltaX + deltaY * deltaY);
2171
- this.prevClients = clients;
2172
- return position;
2173
- };
2174
-
2175
- __proto.getPositions = function (clients) {
2176
- if (clients === void 0) {
2177
- clients = this.prevClients;
2178
- }
2179
-
2180
- var prevClients = this.prevClients;
2181
- return this.startClients.map(function (startClient, i) {
2182
- return getPosition([clients[i]], [prevClients[i]], [startClient]);
2183
- });
2184
- };
2185
-
2186
- __proto.getMovement = function (clients) {
2187
- var movement = this.movement;
2188
-
2189
- if (!clients) {
2190
- return movement;
2191
- }
2192
-
2193
- var currentClient = getAverageClient(clients, this.length);
2194
- var prevClient = getAverageClient(this.prevClients, this.length);
2195
- var deltaX = currentClient.clientX - prevClient.clientX;
2196
- var deltaY = currentClient.clientY - prevClient.clientY;
2197
- return Math.sqrt(deltaX * deltaX + deltaY * deltaY) + movement;
2198
- };
2199
-
2200
- __proto.getDistance = function (clients) {
2201
- if (clients === void 0) {
2202
- clients = this.prevClients;
2203
- }
2204
-
2205
- return getDist(clients);
2206
- };
2207
-
2208
- __proto.getScale = function (clients) {
2209
- if (clients === void 0) {
2210
- clients = this.prevClients;
2211
- }
2212
-
2213
- return getDist(clients) / getDist(this.startClients);
2214
- };
2215
-
2216
- __proto.move = function (deltaX, deltaY) {
2217
- this.startClients.forEach(function (client) {
2218
- client.clientX -= deltaX;
2219
- client.clientY -= deltaY;
2220
- });
2221
- };
2222
-
2223
- return ClientStore;
2224
- }();
2225
-
2226
- var INPUT_TAGNAMES = ["textarea", "input"];
2227
- /**
2228
- * You can set up drag, pinch events in any browser.
2229
- */
2230
-
2231
- var Gesto =
2232
- /*#__PURE__*/
2233
- function (_super) {
2234
- __extends(Gesto, _super);
2235
- /**
2236
- *
2237
- */
2238
-
2239
-
2240
- function Gesto(targets, options) {
2241
- if (options === void 0) {
2242
- options = {};
2243
- }
2244
-
2245
- var _this = _super.call(this) || this;
2246
-
2247
- _this.options = {};
2248
- _this.flag = false;
2249
- _this.pinchFlag = false;
2250
- _this.datas = {};
2251
- _this.isDrag = false;
2252
- _this.isPinch = false;
2253
- _this.isMouse = false;
2254
- _this.isTouch = false;
2255
- _this.clientStores = [];
2256
- _this.targets = [];
2257
- _this.prevTime = 0;
2258
- _this.doubleFlag = false;
2259
- _this._dragFlag = false;
2260
-
2261
- _this.onDragStart = function (e, isTrusted) {
2262
- if (isTrusted === void 0) {
2263
- isTrusted = true;
2264
- }
2265
-
2266
- if (!_this.flag && e.cancelable === false) {
2267
- return;
2268
- }
2269
-
2270
- var _a = _this.options,
2271
- container = _a.container,
2272
- pinchOutside = _a.pinchOutside,
2273
- preventRightClick = _a.preventRightClick,
2274
- preventDefault = _a.preventDefault,
2275
- checkInput = _a.checkInput;
2276
- var isTouch = _this.isTouch;
2277
- var isDragStart = !_this.flag;
2278
-
2279
- if (isDragStart) {
2280
- var activeElement = document.activeElement;
2281
- var target = e.target;
2282
- var tagName = target.tagName.toLowerCase();
2283
- var hasInput = INPUT_TAGNAMES.indexOf(tagName) > -1;
2284
- var hasContentEditable = target.isContentEditable;
2285
-
2286
- if (hasInput || hasContentEditable) {
2287
- if (checkInput || activeElement === target) {
2288
- // force false or already focused.
2289
- return false;
2290
- } // no focus
2291
-
2292
-
2293
- if (activeElement && hasContentEditable && activeElement.isContentEditable && activeElement.contains(target)) {
2294
- return false;
2295
- }
2296
- } else if ((preventDefault || e.type === "touchstart") && activeElement) {
2297
- var activeTagName = activeElement.tagName;
2298
-
2299
- if (activeElement.isContentEditable || INPUT_TAGNAMES.indexOf(activeTagName) > -1) {
2300
- activeElement.blur();
2301
- }
2302
- }
2303
-
2304
- _this.clientStores = [new ClientStore(getEventClients(e))];
2305
- _this.flag = true;
2306
- _this.isDrag = false;
2307
- _this._dragFlag = true;
2308
- _this.datas = {};
2309
-
2310
- if (preventRightClick && (e.which === 3 || e.button === 2)) {
2311
- _this.initDrag();
2312
-
2313
- return false;
2314
- }
2315
-
2316
- _this.doubleFlag = now() - _this.prevTime < 200;
2317
-
2318
- var result = _this.emit("dragStart", __assign({
2319
- datas: _this.datas,
2320
- inputEvent: e,
2321
- isTrusted: isTrusted,
2322
- isDouble: _this.doubleFlag
2323
- }, _this.getCurrentStore().getPosition(), {
2324
- preventDefault: function () {
2325
- e.preventDefault();
2326
- },
2327
- preventDrag: function () {
2328
- _this._dragFlag = false;
2329
- }
2330
- }));
2331
-
2332
- if (result === false) {
2333
- _this.initDrag();
2334
- }
2335
-
2336
- _this.flag && preventDefault && e.preventDefault();
2337
- }
2338
-
2339
- if (!_this.flag) {
2340
- return false;
2341
- }
2342
-
2343
- var timer = 0;
2344
-
2345
- if (isDragStart && isTouch && pinchOutside) {
2346
- timer = setTimeout(function () {
2347
- addEvent(container, "touchstart", _this.onDragStart, {
2348
- passive: false
2349
- });
2350
- });
2351
- }
2352
-
2353
- if (!isDragStart && isTouch && pinchOutside) {
2354
- removeEvent(container, "touchstart", _this.onDragStart);
2355
- }
2356
-
2357
- if (_this.flag && isMultiTouch(e)) {
2358
- clearTimeout(timer);
2359
-
2360
- if (isDragStart && e.touches.length !== e.changedTouches.length) {
2361
- return;
2362
- }
2363
-
2364
- if (!_this.pinchFlag) {
2365
- _this.onPinchStart(e);
2366
- }
2367
- }
2368
- };
2369
-
2370
- _this.onDrag = function (e, isScroll) {
2371
- if (!_this.flag) {
2372
- return;
2373
- }
2374
-
2375
- var clients = getEventClients(e);
2376
-
2377
- var result = _this.moveClients(clients, e, false);
2378
-
2379
- if (_this._dragFlag) {
2380
- if (_this.pinchFlag || result.deltaX || result.deltaY) {
2381
- var dragResult = _this.emit("drag", __assign({}, result, {
2382
- isScroll: !!isScroll,
2383
- inputEvent: e
2384
- }));
2385
-
2386
- if (dragResult === false) {
2387
- _this.stop();
2388
-
2389
- return;
2390
- }
2391
- }
2392
-
2393
- if (_this.pinchFlag) {
2394
- _this.onPinch(e, clients);
2395
- }
2396
- }
2397
-
2398
- _this.getCurrentStore().getPosition(clients, true);
2399
- };
2400
-
2401
- _this.onDragEnd = function (e) {
2402
- if (!_this.flag) {
2403
- return;
2404
- }
2405
-
2406
- var _a = _this.options,
2407
- pinchOutside = _a.pinchOutside,
2408
- container = _a.container;
2409
-
2410
- if (_this.isTouch && pinchOutside) {
2411
- removeEvent(container, "touchstart", _this.onDragStart);
1563
+ }
1564
+ ]
2412
1565
  }
1566
+ ]
1567
+ }
1568
+ ];
1569
+ const DEFAULT_CONFIG = fillConfig([]);
1570
+ const getDefaultPropsValue = (type, id) => ["page", "container"].includes(type) ? {
1571
+ type,
1572
+ id,
1573
+ layout: "absolute",
1574
+ style: {},
1575
+ name: type,
1576
+ items: []
1577
+ } : {
1578
+ type,
1579
+ id,
1580
+ style: {},
1581
+ name: type
1582
+ };
2413
1583
 
2414
- _this.flag = false;
2415
-
2416
- var position = _this._getPosition();
2417
-
2418
- var currentTime = now();
2419
- var isDouble = !_this.isDrag && _this.doubleFlag;
2420
- _this.prevTime = _this.isDrag || isDouble ? 0 : currentTime;
2421
-
2422
- _this.emit("dragEnd", __assign({
2423
- datas: _this.datas,
2424
- isDouble: isDouble,
2425
- isDrag: _this.isDrag,
2426
- isClick: !_this.isDrag,
2427
- inputEvent: e
2428
- }, position));
2429
-
2430
- if (_this.pinchFlag) {
2431
- _this.onPinchEnd(e);
1584
+ const _sfc_main$i = vue.defineComponent({
1585
+ components: { Plus: icons.Plus },
1586
+ setup() {
1587
+ const services = vue.inject("services");
1588
+ return {
1589
+ clickHandler() {
1590
+ const { editorService } = services || {};
1591
+ if (!editorService)
1592
+ return;
1593
+ editorService.add({
1594
+ type: schema.NodeType.PAGE,
1595
+ name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
1596
+ });
2432
1597
  }
2433
-
2434
- _this.clientStores = [];
2435
- };
2436
-
2437
- _this.onBlur = function () {
2438
- _this.onDragEnd();
2439
1598
  };
2440
-
2441
- var elements = [].concat(targets);
2442
- _this.options = __assign({
2443
- checkInput: false,
2444
- container: elements.length > 1 ? window : elements[0],
2445
- preventRightClick: true,
2446
- preventDefault: true,
2447
- checkWindowBlur: false,
2448
- pinchThreshold: 0,
2449
- events: ["touch", "mouse"]
2450
- }, options);
2451
- var _a = _this.options,
2452
- container = _a.container,
2453
- events = _a.events,
2454
- checkWindowBlur = _a.checkWindowBlur;
2455
- _this.isTouch = events.indexOf("touch") > -1;
2456
- _this.isMouse = events.indexOf("mouse") > -1;
2457
- _this.targets = elements;
2458
-
2459
- if (_this.isMouse) {
2460
- elements.forEach(function (el) {
2461
- addEvent(el, "mousedown", _this.onDragStart);
2462
- });
2463
- addEvent(container, "mousemove", _this.onDrag);
2464
- addEvent(container, "mouseup", _this.onDragEnd);
2465
- addEvent(container, "contextmenu", _this.onDragEnd);
2466
- }
2467
-
2468
- if (checkWindowBlur) {
2469
- addEvent(window, "blur", _this.onBlur);
2470
- }
2471
-
2472
- if (_this.isTouch) {
2473
- var passive_1 = {
2474
- passive: false
2475
- };
2476
- elements.forEach(function (el) {
2477
- addEvent(el, "touchstart", _this.onDragStart, passive_1);
2478
- });
2479
- addEvent(container, "touchmove", _this.onDrag, passive_1);
2480
- addEvent(container, "touchend", _this.onDragEnd, passive_1);
2481
- addEvent(container, "touchcancel", _this.onDragEnd, passive_1);
2482
- }
2483
-
2484
- return _this;
2485
1599
  }
2486
- /**
2487
- * Stop Gesto's drag events.
2488
- */
2489
-
2490
-
2491
- var __proto = Gesto.prototype;
2492
-
2493
- __proto.stop = function () {
2494
- this.isDrag = false;
2495
- this.flag = false;
2496
- this.clientStores = [];
2497
- this.datas = {};
2498
- };
2499
- /**
2500
- * The total moved distance
2501
- */
2502
-
2503
-
2504
- __proto.getMovement = function (clients) {
2505
- return this.getCurrentStore().getMovement(clients) + this.clientStores.slice(1).reduce(function (prev, cur) {
2506
- return prev + cur.movement;
2507
- }, 0);
2508
- };
2509
- /**
2510
- * Whether to drag
2511
- */
2512
-
2513
-
2514
- __proto.isDragging = function () {
2515
- return this.isDrag;
2516
- };
2517
- /**
2518
- * Whether to start drag
2519
- */
2520
-
2521
-
2522
- __proto.isFlag = function () {
2523
- return this.flag;
2524
- };
2525
- /**
2526
- * Whether to start pinch
2527
- */
2528
-
2529
-
2530
- __proto.isPinchFlag = function () {
2531
- return this.pinchFlag;
2532
- };
2533
- /**
2534
- * Whether to start double click
2535
- */
2536
-
2537
-
2538
- __proto.isDoubleFlag = function () {
2539
- return this.doubleFlag;
2540
- };
2541
- /**
2542
- * Whether to pinch
2543
- */
2544
-
2545
-
2546
- __proto.isPinching = function () {
2547
- return this.isPinch;
2548
- };
2549
- /**
2550
- * If a scroll event occurs, it is corrected by the scroll distance.
2551
- */
2552
-
2553
-
2554
- __proto.scrollBy = function (deltaX, deltaY, e, isCallDrag) {
2555
- if (isCallDrag === void 0) {
2556
- isCallDrag = true;
2557
- }
2558
-
2559
- if (!this.flag) {
2560
- return;
2561
- }
2562
-
2563
- this.clientStores[0].move(deltaX, deltaY);
2564
- isCallDrag && this.onDrag(e, true);
2565
- };
2566
- /**
2567
- * Create a virtual drag event.
2568
- */
2569
-
2570
-
2571
- __proto.move = function (_a, inputEvent) {
2572
- var deltaX = _a[0],
2573
- deltaY = _a[1];
2574
- var store = this.getCurrentStore();
2575
- var nextClients = store.prevClients;
2576
- return this.moveClients(nextClients.map(function (_a) {
2577
- var clientX = _a.clientX,
2578
- clientY = _a.clientY;
2579
- return {
2580
- clientX: clientX + deltaX,
2581
- clientY: clientY + deltaY,
2582
- originalClientX: clientX,
2583
- originalClientY: clientY
2584
- };
2585
- }), inputEvent, true);
2586
- };
2587
- /**
2588
- * The dragStart event is triggered by an external event.
2589
- */
2590
-
2591
-
2592
- __proto.triggerDragStart = function (e) {
2593
- this.onDragStart(e, false);
2594
- };
2595
- /**
2596
- * Set the event data while dragging.
2597
- */
2598
-
2599
-
2600
- __proto.setEventDatas = function (datas) {
2601
- var currentDatas = this.datas;
2602
-
2603
- for (var name in datas) {
2604
- currentDatas[name] = datas[name];
2605
- }
2606
-
2607
- return this;
2608
- };
2609
- /**
2610
- * Get the current event state while dragging.
2611
- */
2612
-
2613
-
2614
- __proto.getCurrentEvent = function (inputEvent) {
2615
- return __assign({
2616
- datas: this.datas
2617
- }, this._getPosition(), {
2618
- movement: this.getMovement(),
2619
- isDrag: this.isDrag,
2620
- isPinch: this.isPinch,
2621
- isScroll: false,
2622
- inputEvent: inputEvent
2623
- });
2624
- };
2625
- /**
2626
- * Get & Set the event data while dragging.
2627
- */
2628
-
2629
-
2630
- __proto.getEventDatas = function () {
2631
- return this.datas;
2632
- };
2633
- /**
2634
- * Unset Gesto
2635
- */
2636
-
2637
-
2638
- __proto.unset = function () {
2639
- var _this = this;
2640
-
2641
- var targets = this.targets;
2642
- var container = this.options.container;
2643
- this.off();
2644
- removeEvent(window, "blur", this.onBlur);
2645
-
2646
- if (this.isMouse) {
2647
- targets.forEach(function (target) {
2648
- removeEvent(target, "mousedown", _this.onDragStart);
2649
- });
2650
- removeEvent(container, "mousemove", this.onDrag);
2651
- removeEvent(container, "mouseup", this.onDragEnd);
2652
- removeEvent(container, "contextmenu", this.onDragEnd);
2653
- }
2654
-
2655
- if (this.isTouch) {
2656
- targets.forEach(function (target) {
2657
- removeEvent(target, "touchstart", _this.onDragStart);
2658
- });
2659
- removeEvent(container, "touchstart", this.onDragStart);
2660
- removeEvent(container, "touchmove", this.onDrag);
2661
- removeEvent(container, "touchend", this.onDragEnd);
2662
- removeEvent(container, "touchcancel", this.onDragEnd);
2663
- }
2664
- };
2665
-
2666
- __proto.onPinchStart = function (e) {
2667
- var pinchThreshold = this.options.pinchThreshold;
2668
-
2669
- if (this.isDrag && this.getMovement() > pinchThreshold) {
2670
- return;
2671
- }
2672
-
2673
- var store = new ClientStore(getEventClients(e));
2674
- this.pinchFlag = true;
2675
- this.clientStores.splice(0, 0, store);
2676
- var result = this.emit("pinchStart", __assign({
2677
- datas: this.datas,
2678
- angle: store.getAngle(),
2679
- touches: this.getCurrentStore().getPositions()
2680
- }, store.getPosition(), {
2681
- inputEvent: e
2682
- }));
2683
-
2684
- if (result === false) {
2685
- this.pinchFlag = false;
2686
- }
2687
- };
2688
-
2689
- __proto.onPinch = function (e, clients) {
2690
- if (!this.flag || !this.pinchFlag || clients.length < 2) {
2691
- return;
2692
- }
2693
-
2694
- var store = this.getCurrentStore();
2695
- this.isPinch = true;
2696
- this.emit("pinch", __assign({
2697
- datas: this.datas,
2698
- movement: this.getMovement(clients),
2699
- angle: store.getAngle(clients),
2700
- rotation: store.getRotation(clients),
2701
- touches: store.getPositions(clients),
2702
- scale: store.getScale(clients),
2703
- distance: store.getDistance(clients)
2704
- }, store.getPosition(clients), {
2705
- inputEvent: e
2706
- }));
2707
- };
2708
-
2709
- __proto.onPinchEnd = function (e) {
2710
- if (!this.pinchFlag) {
2711
- return;
2712
- }
2713
-
2714
- var isPinch = this.isPinch;
2715
- this.isPinch = false;
2716
- this.pinchFlag = false;
2717
- var store = this.getCurrentStore();
2718
- this.emit("pinchEnd", __assign({
2719
- datas: this.datas,
2720
- isPinch: isPinch,
2721
- touches: store.getPositions()
2722
- }, store.getPosition(), {
2723
- inputEvent: e
2724
- }));
2725
- this.isPinch = false;
2726
- this.pinchFlag = false;
2727
- };
2728
-
2729
- __proto.initDrag = function () {
2730
- this.clientStores = [];
2731
- this.pinchFlag = false;
2732
- this.doubleFlag = false;
2733
- this.prevTime = 0;
2734
- this.flag = false;
2735
- };
2736
-
2737
- __proto.getCurrentStore = function () {
2738
- return this.clientStores[0];
2739
- };
2740
-
2741
- __proto.moveClients = function (clients, inputEvent, isAdd) {
2742
- var position = this._getPosition(clients, isAdd);
2743
-
2744
- if (position.deltaX || position.deltaY) {
2745
- this.isDrag = true;
2746
- }
2747
-
2748
- return __assign({
2749
- datas: this.datas
2750
- }, position, {
2751
- movement: this.getMovement(clients),
2752
- isDrag: this.isDrag,
2753
- isPinch: this.isPinch,
2754
- isScroll: false,
2755
- inputEvent: inputEvent
2756
- });
2757
- };
2758
-
2759
- __proto._getPosition = function (clients, isAdd) {
2760
- var store = this.getCurrentStore();
2761
- var position = store.getPosition(clients, isAdd);
2762
-
2763
- var _a = this.clientStores.slice(1).reduce(function (prev, cur) {
2764
- var storePosition = cur.getPosition();
2765
- prev.distX += storePosition.distX;
2766
- prev.distY += storePosition.distY;
2767
- return prev;
2768
- }, position),
2769
- distX = _a.distX,
2770
- distY = _a.distY;
2771
-
2772
- return __assign({}, position, {
2773
- distX: distX,
2774
- distY: distY
2775
- });
2776
- };
2777
-
2778
- return Gesto;
2779
- }(EventEmitter$1);
2780
-
2781
- var Gesto$1 = Gesto;
1600
+ });
1601
+ const _hoisted_1$a = { class: "m-editor-empty-panel" };
1602
+ const _hoisted_2$4 = { class: "m-editor-empty-content" };
1603
+ const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1604
+ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1605
+ const _component_plus = vue.resolveComponent("plus");
1606
+ const _component_el_icon = vue.resolveComponent("el-icon");
1607
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
1608
+ vue.createElementVNode("div", _hoisted_2$4, [
1609
+ vue.createElementVNode("div", {
1610
+ class: "m-editor-empty-button",
1611
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
1612
+ }, [
1613
+ vue.createElementVNode("div", null, [
1614
+ vue.createVNode(_component_el_icon, null, {
1615
+ default: vue.withCtx(() => [
1616
+ vue.createVNode(_component_plus)
1617
+ ]),
1618
+ _: 1
1619
+ })
1620
+ ]),
1621
+ _hoisted_3$2
1622
+ ])
1623
+ ])
1624
+ ]);
1625
+ }
1626
+ var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
2782
1627
 
2783
1628
  const _sfc_main$h = vue.defineComponent({
2784
1629
  name: "m-editor-resize",
@@ -2794,7 +1639,7 @@
2794
1639
  vue.onMounted(() => {
2795
1640
  if (!target.value)
2796
1641
  return;
2797
- getso = new Gesto$1(target.value, {
1642
+ getso = new Gesto__default["default"](target.value, {
2798
1643
  container: window,
2799
1644
  pinchOutside: true
2800
1645
  }).on("drag", (e) => {
@@ -2838,6 +1683,12 @@
2838
1683
  AddPageBox,
2839
1684
  Resizer
2840
1685
  },
1686
+ props: {
1687
+ codeOptions: {
1688
+ type: Object,
1689
+ default: () => ({})
1690
+ }
1691
+ },
2841
1692
  setup() {
2842
1693
  const { editorService, uiService } = vue.inject("services") || {};
2843
1694
  const root = vue.computed(() => editorService?.get("root"));
@@ -2872,8 +1723,9 @@
2872
1723
  key: 0,
2873
1724
  class: "m-editor-content",
2874
1725
  "init-values": _ctx.root,
1726
+ options: _ctx.codeOptions,
2875
1727
  onSave: _ctx.saveCode
2876
- }, null, 8, ["init-values", "onSave"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
1728
+ }, null, 8, ["init-values", "options", "onSave"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
2877
1729
  vue.createElementVNode("div", {
2878
1730
  class: "m-editor-framework-left",
2879
1731
  style: vue.normalizeStyle(`width: ${_ctx.columnWidth?.left}px`)
@@ -3321,13 +2173,13 @@
3321
2173
  const _component_m_form = vue.resolveComponent("m-form");
3322
2174
  return vue.openBlock(), vue.createBlock(_component_m_form, {
3323
2175
  class: vue.normalizeClass(`m-editor-props-panel ${_ctx.propsPanelSize}`),
3324
- "popper-class": "m-editor-props-panel-popper",
2176
+ "popper-class": `m-editor-props-panel-popper ${_ctx.propsPanelSize}`,
3325
2177
  ref: "configForm",
3326
2178
  size: _ctx.propsPanelSize,
3327
2179
  "init-values": _ctx.values,
3328
2180
  config: _ctx.curFormConfig,
3329
2181
  onChange: _ctx.submit
3330
- }, null, 8, ["class", "size", "init-values", "config", "onChange"]);
2182
+ }, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"]);
3331
2183
  }
3332
2184
  var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
3333
2185
 
@@ -3445,9 +2297,14 @@
3445
2297
  menuData: {
3446
2298
  type: Array,
3447
2299
  default: () => []
2300
+ },
2301
+ isSubMenu: {
2302
+ type: Boolean,
2303
+ default: false
3448
2304
  }
3449
2305
  },
3450
- setup() {
2306
+ emits: ["hide", "show"],
2307
+ setup(props, { emit }) {
3451
2308
  const menu = vue.ref();
3452
2309
  const subMenu = vue.ref();
3453
2310
  const visible = vue.ref(false);
@@ -3457,15 +2314,31 @@
3457
2314
  top: "0"
3458
2315
  });
3459
2316
  const hide = () => {
2317
+ if (!visible.value)
2318
+ return;
3460
2319
  visible.value = false;
2320
+ subMenu.value?.hide();
2321
+ emit("hide");
2322
+ };
2323
+ const hideHandler = (e) => {
2324
+ const target = e.target;
2325
+ if (!visible.value || !target) {
2326
+ return;
2327
+ }
2328
+ if (menu.value?.contains(target) || subMenu.value?.$el?.contains(target)) {
2329
+ return;
2330
+ }
2331
+ hide();
3461
2332
  };
3462
2333
  vue.onMounted(() => {
3463
- globalThis.addEventListener("mousedown", (e) => {
3464
- if (!visible.value || e.target && menu.value?.contains(e.target)) {
3465
- return;
3466
- }
3467
- hide();
3468
- }, true);
2334
+ if (props.isSubMenu)
2335
+ return;
2336
+ globalThis.addEventListener("mousedown", hideHandler, true);
2337
+ });
2338
+ vue.onUnmounted(() => {
2339
+ if (props.isSubMenu)
2340
+ return;
2341
+ globalThis.removeEventListener("mousedown", hideHandler, true);
3469
2342
  });
3470
2343
  return {
3471
2344
  menu,
@@ -3475,18 +2348,21 @@
3475
2348
  subMenuData,
3476
2349
  hide,
3477
2350
  show(e) {
3478
- visible.value = true;
3479
- vue.nextTick(() => {
3480
- const menuHeight = menu.value?.clientHeight || 0;
3481
- let top = e.clientY;
3482
- if (menuHeight + e.clientY > document.body.clientHeight) {
3483
- top = document.body.clientHeight - menuHeight;
3484
- }
3485
- menuStyle.value = {
3486
- top: `${top}px`,
3487
- left: `${e.clientX}px`
3488
- };
3489
- });
2351
+ setTimeout(() => {
2352
+ visible.value = true;
2353
+ vue.nextTick(() => {
2354
+ const menuHeight = menu.value?.clientHeight || 0;
2355
+ let top = e.clientY;
2356
+ if (menuHeight + e.clientY > document.body.clientHeight) {
2357
+ top = document.body.clientHeight - menuHeight;
2358
+ }
2359
+ menuStyle.value = {
2360
+ top: `${top}px`,
2361
+ left: `${e.clientX}px`
2362
+ };
2363
+ emit("show");
2364
+ });
2365
+ }, 300);
3490
2366
  },
3491
2367
  showSubMenu(item) {
3492
2368
  const menuItem = item;
@@ -3507,7 +2383,7 @@
3507
2383
  function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3508
2384
  const _component_tool_button = vue.resolveComponent("tool-button");
3509
2385
  const _component_content_menu = vue.resolveComponent("content-menu", true);
3510
- return _ctx.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
2386
+ return _ctx.menuData.length && _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
3511
2387
  key: 0,
3512
2388
  class: "magic-editor-content-menu",
3513
2389
  ref: "menu",
@@ -3528,12 +2404,12 @@
3528
2404
  vue.createVNode(_component_content_menu, {
3529
2405
  class: "sub-menu",
3530
2406
  ref: "subMenu",
3531
- "menu-data": _ctx.subMenuData
3532
- }, null, 8, ["menu-data"])
2407
+ "menu-data": _ctx.subMenuData,
2408
+ "is-sub-menu": true,
2409
+ onHide: _ctx.hide
2410
+ }, null, 8, ["menu-data", "onHide"])
3533
2411
  ]))
3534
- ], 4)), [
3535
- [vue.vShow, _ctx.visible]
3536
- ]) : vue.createCommentVNode("", true);
2412
+ ], 4)) : vue.createCommentVNode("", true);
3537
2413
  }
3538
2414
  var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
3539
2415
 
@@ -3546,6 +2422,7 @@
3546
2422
  const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
3547
2423
  const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
3548
2424
  const componentList = vue.computed(() => services?.componentListService.getList() || []);
2425
+ const layerContentMenu = vue.inject("layerContentMenu", []);
3549
2426
  const createMenuItems = (group) => group.items.map((component) => ({
3550
2427
  text: component.text,
3551
2428
  type: "button",
@@ -3610,7 +2487,8 @@
3610
2487
  handler: () => {
3611
2488
  node.value && services?.editorService.remove(node.value);
3612
2489
  }
3613
- }
2490
+ },
2491
+ ...layerContentMenu
3614
2492
  ]),
3615
2493
  show(e) {
3616
2494
  menu.value?.show(e);
@@ -3833,7 +2711,7 @@
3833
2711
  components: { MIcon },
3834
2712
  props: {
3835
2713
  data: {
3836
- type: Object
2714
+ type: [Object, String]
3837
2715
  }
3838
2716
  },
3839
2717
  setup(props) {
@@ -4401,6 +3279,7 @@
4401
3279
  const node = vue.computed(() => editorService?.get("node"));
4402
3280
  const parent = vue.computed(() => editorService?.get("parent"));
4403
3281
  const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
3282
+ const stageContentMenu = vue.inject("stageContentMenu", []);
4404
3283
  vue.onMounted(() => {
4405
3284
  const data = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
4406
3285
  canPaste.value = data !== "undefined" && !!data;
@@ -4436,8 +3315,17 @@
4436
3315
  text: "\u7C98\u8D34",
4437
3316
  display: () => canPaste.value,
4438
3317
  handler: () => {
4439
- const top = menu.value?.$el.offsetTop || 0;
4440
- const left = menu.value?.$el.offsetLeft || 0;
3318
+ const stage = editorService?.get("stage");
3319
+ const rect = menu.value?.$el.getBoundingClientRect();
3320
+ const parentRect = stage?.container?.getBoundingClientRect();
3321
+ let left = (rect?.left || 0) - (parentRect?.left || 0);
3322
+ let top = (rect?.top || 0) - (parentRect?.top || 0);
3323
+ if (node.value?.items && stage) {
3324
+ const parentEl = stage.renderer.contentWindow?.document.getElementById(`${node.value.id}`);
3325
+ const parentElRect = parentEl?.getBoundingClientRect();
3326
+ left = left - (parentElRect?.left || 0);
3327
+ top = top - (parentElRect?.top || 0);
3328
+ }
4441
3329
  editorService?.paste({ left, top });
4442
3330
  }
4443
3331
  },
@@ -4504,7 +3392,8 @@
4504
3392
  handler: () => {
4505
3393
  editorService?.get("stage").clearGuides();
4506
3394
  }
4507
- }
3395
+ },
3396
+ ...stageContentMenu
4508
3397
  ]),
4509
3398
  show(e) {
4510
3399
  menu.value?.show(e);
@@ -4527,24 +3416,9 @@
4527
3416
  ViewerMenu,
4528
3417
  ScrollViewer
4529
3418
  },
4530
- props: {
4531
- render: {
4532
- type: Function
4533
- },
4534
- runtimeUrl: String,
4535
- canSelect: {
4536
- type: Function,
4537
- default: (el) => Boolean(el.id)
4538
- },
4539
- moveableOptions: {
4540
- type: [Object, Function],
4541
- default: () => (core) => ({
4542
- container: core?.renderer?.contentWindow?.document.getElementById("app")
4543
- })
4544
- }
4545
- },
4546
- setup(props) {
3419
+ setup() {
4547
3420
  const services = vue.inject("services");
3421
+ const stageOptions = vue.inject("stageOptions");
4548
3422
  const stageWrap = vue.ref();
4549
3423
  const stageContainer = vue.ref();
4550
3424
  const menu = vue.ref();
@@ -4561,21 +3435,23 @@
4561
3435
  return;
4562
3436
  if (!stageContainer.value)
4563
3437
  return;
4564
- if (!(props.runtimeUrl || props.render) || !root.value)
3438
+ if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value)
4565
3439
  return;
4566
3440
  stage = new StageCore__default["default"]({
4567
- render: props.render,
4568
- runtimeUrl: props.runtimeUrl,
3441
+ render: stageOptions.render,
3442
+ runtimeUrl: stageOptions.runtimeUrl,
4569
3443
  zoom: zoom.value,
3444
+ autoScrollIntoView: stageOptions.autoScrollIntoView,
4570
3445
  canSelect: (el, event, stop) => {
4571
- const elCanSelect = props.canSelect(el);
3446
+ const elCanSelect = stageOptions.canSelect(el);
4572
3447
  if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
4573
3448
  document.dispatchEvent(new CustomEvent("ui-select", { detail: el }));
4574
3449
  return stop();
4575
3450
  }
4576
3451
  return elCanSelect;
4577
3452
  },
4578
- moveableOptions: props.moveableOptions
3453
+ moveableOptions: stageOptions.moveableOptions,
3454
+ updateDragEl: stageOptions.updateDragEl
4579
3455
  });
4580
3456
  services?.editorService.set("stage", vue.markRaw(stage));
4581
3457
  stage?.mount(stageContainer.value);
@@ -4598,7 +3474,7 @@
4598
3474
  return;
4599
3475
  stage?.on("runtime-ready", (rt) => {
4600
3476
  runtime = rt;
4601
- root.value && runtime?.updateRootConfig(lodashEs.cloneDeep(vue.toRaw(root.value)));
3477
+ root.value && runtime?.updateRootConfig?.(lodashEs.cloneDeep(vue.toRaw(root.value)));
4602
3478
  page.value?.id && runtime?.updatePageId?.(page.value.id);
4603
3479
  setTimeout(() => {
4604
3480
  node.value && stage?.select(vue.toRaw(node.value.id));
@@ -4612,7 +3488,7 @@
4612
3488
  });
4613
3489
  vue.watch(root, (root2) => {
4614
3490
  if (runtime && root2) {
4615
- runtime.updateRootConfig(lodashEs.cloneDeep(vue.toRaw(root2)));
3491
+ runtime.updateRootConfig?.(lodashEs.cloneDeep(vue.toRaw(root2)));
4616
3492
  }
4617
3493
  });
4618
3494
  const resizeObserver = new ResizeObserver((entries) => {
@@ -4656,6 +3532,7 @@
4656
3532
  const { scrollTop, scrollLeft } = stage.mask;
4657
3533
  if (layout === Layout.ABSOLUTE) {
4658
3534
  config.style = {
3535
+ ...config.style || {},
4659
3536
  position: "absolute",
4660
3537
  top: e.clientY - containerRect.top + scrollTop,
4661
3538
  left: e.clientX - containerRect.left + scrollLeft
@@ -4701,18 +3578,6 @@
4701
3578
  PageBar,
4702
3579
  MagicStage
4703
3580
  },
4704
- props: {
4705
- runtimeUrl: String,
4706
- render: {
4707
- type: Function
4708
- },
4709
- moveableOptions: {
4710
- type: [Object, Function]
4711
- },
4712
- canSelect: {
4713
- type: Function
4714
- }
4715
- },
4716
3581
  setup() {
4717
3582
  const services = vue.inject("services");
4718
3583
  const workspace = vue.ref();
@@ -4721,8 +3586,12 @@
4721
3586
  const mouseenterHandler = () => {
4722
3587
  workspace.value?.focus();
4723
3588
  };
3589
+ const mouseleaveHandler = () => {
3590
+ workspace.value?.blur();
3591
+ };
4724
3592
  vue.onMounted(() => {
4725
3593
  workspace.value?.addEventListener("mouseenter", mouseenterHandler);
3594
+ workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
4726
3595
  keycon = new KeyController__default["default"](workspace.value);
4727
3596
  const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
4728
3597
  const ctrl = isMac ? "meta" : "ctrl";
@@ -4731,6 +3600,11 @@
4731
3600
  if (!node.value || utils.isPage(node.value))
4732
3601
  return;
4733
3602
  services?.editorService.remove(node.value);
3603
+ }).keyup("backspace", (e) => {
3604
+ e.inputEvent.preventDefault();
3605
+ if (!node.value || utils.isPage(node.value))
3606
+ return;
3607
+ services?.editorService.remove(node.value);
4734
3608
  }).keydown([ctrl, "c"], (e) => {
4735
3609
  e.inputEvent.preventDefault();
4736
3610
  node.value && services?.editorService.copy(node.value);
@@ -4782,13 +3656,20 @@
4782
3656
  }).keydown([ctrl, "="], (e) => {
4783
3657
  e.inputEvent.preventDefault();
4784
3658
  services?.uiService.zoom(0.1);
3659
+ }).keydown([ctrl, "numpadplus"], (e) => {
3660
+ e.inputEvent.preventDefault();
3661
+ services?.uiService.zoom(0.1);
4785
3662
  }).keydown([ctrl, "-"], (e) => {
4786
3663
  e.inputEvent.preventDefault();
4787
3664
  services?.uiService.zoom(-0.1);
3665
+ }).keydown([ctrl, "numpad-"], (e) => {
3666
+ e.inputEvent.preventDefault();
3667
+ services?.uiService.zoom(-0.1);
4788
3668
  });
4789
3669
  });
4790
3670
  vue.onUnmounted(() => {
4791
3671
  workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
3672
+ workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
4792
3673
  keycon.destroy();
4793
3674
  });
4794
3675
  return {
@@ -4807,12 +3688,8 @@
4807
3688
  const _component_page_bar = vue.resolveComponent("page-bar");
4808
3689
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
4809
3690
  (vue.openBlock(), vue.createBlock(_component_magic_stage, {
4810
- key: _ctx.page?.id,
4811
- "runtime-url": _ctx.runtimeUrl,
4812
- render: _ctx.render,
4813
- "moveable-options": _ctx.moveableOptions,
4814
- "can-select": _ctx.canSelect
4815
- }, null, 8, ["runtime-url", "render", "moveable-options", "can-select"])),
3691
+ key: _ctx.page?.id
3692
+ })),
4816
3693
  vue.renderSlot(_ctx.$slots, "workspace-content"),
4817
3694
  vue.createVNode(_component_page_bar, null, {
4818
3695
  "page-bar-title": vue.withCtx(({ page }) => [
@@ -4981,6 +3858,14 @@
4981
3858
  sidebar: {
4982
3859
  type: Object
4983
3860
  },
3861
+ layerContentMenu: {
3862
+ type: Array,
3863
+ default: () => []
3864
+ },
3865
+ stageContentMenu: {
3866
+ type: Array,
3867
+ default: () => []
3868
+ },
4984
3869
  menu: {
4985
3870
  type: Object,
4986
3871
  default: () => ({ left: [], right: [] })
@@ -4989,6 +3874,7 @@
4989
3874
  type: Function
4990
3875
  },
4991
3876
  runtimeUrl: String,
3877
+ autoScrollIntoView: Boolean,
4992
3878
  propsConfigs: {
4993
3879
  type: Object,
4994
3880
  default: () => ({})
@@ -5008,10 +3894,18 @@
5008
3894
  type: [Number, String]
5009
3895
  },
5010
3896
  canSelect: {
5011
- type: Function
3897
+ type: Function,
3898
+ default: (el) => Boolean(el.id)
5012
3899
  },
5013
3900
  stageRect: {
5014
3901
  type: [String, Object]
3902
+ },
3903
+ codeOptions: {
3904
+ type: Object,
3905
+ default: () => ({})
3906
+ },
3907
+ updateDragEl: {
3908
+ type: Function
5015
3909
  }
5016
3910
  },
5017
3911
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -5061,6 +3955,16 @@
5061
3955
  uiService
5062
3956
  };
5063
3957
  vue.provide("services", services);
3958
+ vue.provide("layerContentMenu", props.layerContentMenu);
3959
+ vue.provide("stageContentMenu", props.stageContentMenu);
3960
+ vue.provide("stageOptions", vue.reactive({
3961
+ runtimeUrl: props.runtimeUrl,
3962
+ autoScrollIntoView: props.autoScrollIntoView,
3963
+ render: props.render,
3964
+ moveableOptions: props.moveableOptions,
3965
+ canSelect: props.canSelect,
3966
+ updateDragEl: props.updateDragEl
3967
+ }));
5064
3968
  return services;
5065
3969
  }
5066
3970
  });
@@ -5070,7 +3974,7 @@
5070
3974
  const _component_workspace = vue.resolveComponent("workspace");
5071
3975
  const _component_props_panel = vue.resolveComponent("props-panel");
5072
3976
  const _component_framework = vue.resolveComponent("framework");
5073
- return vue.openBlock(), vue.createBlock(_component_framework, null, {
3977
+ return vue.openBlock(), vue.createBlock(_component_framework, { "code-options": _ctx.codeOptions }, {
5074
3978
  nav: vue.withCtx(() => [
5075
3979
  vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
5076
3980
  vue.createVNode(_component_nav_menu, { data: _ctx.menu }, null, 8, ["data"])
@@ -5083,12 +3987,7 @@
5083
3987
  ]),
5084
3988
  workspace: vue.withCtx(() => [
5085
3989
  vue.renderSlot(_ctx.$slots, "workspace", {}, () => [
5086
- vue.createVNode(_component_workspace, {
5087
- "runtime-url": _ctx.runtimeUrl,
5088
- render: _ctx.render,
5089
- "moveable-options": _ctx.moveableOptions,
5090
- "can-select": _ctx.canSelect
5091
- }, {
3990
+ vue.createVNode(_component_workspace, null, {
5092
3991
  "workspace-content": vue.withCtx(() => [
5093
3992
  vue.renderSlot(_ctx.$slots, "workspace-content", { editorService: _ctx.editorService })
5094
3993
  ]),
@@ -5099,7 +3998,7 @@
5099
3998
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
5100
3999
  ]),
5101
4000
  _: 3
5102
- }, 8, ["runtime-url", "render", "moveable-options", "can-select"])
4001
+ })
5103
4002
  ])
5104
4003
  ]),
5105
4004
  propsPanel: vue.withCtx(() => [
@@ -5114,11 +4013,11 @@
5114
4013
  vue.renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
5115
4014
  ]),
5116
4015
  _: 3
5117
- });
4016
+ }, 8, ["code-options"]);
5118
4017
  }
5119
4018
  var Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
5120
4019
 
5121
- var index$1 = '';
4020
+ 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 border: 1px solid #d9dbdd;\n transition: transform 0.3s;\n box-sizing: content-box;\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}")();
5122
4021
 
5123
4022
  const defaultInstallOpt = {};
5124
4023
  var index = {
@@ -5153,7 +4052,6 @@
5153
4052
  exports.error = error;
5154
4053
  exports.eventsService = eventsService;
5155
4054
  exports.fillConfig = fillConfig;
5156
- exports.generateId = generateId;
5157
4055
  exports.generatePageName = generatePageName;
5158
4056
  exports.generatePageNameByApp = generatePageNameByApp;
5159
4057
  exports.getConfig = getConfig;
@@ -5169,7 +4067,6 @@
5169
4067
  exports.propsService = propsService;
5170
4068
  exports.setConfig = setConfig;
5171
4069
  exports.setLayout = setLayout;
5172
- exports.setNewItemId = setNewItemId;
5173
4070
  exports.toRelative = toRelative;
5174
4071
  exports.uiService = uiService;
5175
4072
  exports.warn = warn;