@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,19 +1,23 @@
1
- import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, markRaw, createElementBlock, createVNode, withCtx, withModifiers, createCommentVNode, createTextVNode, toDisplayString, watch, onMounted, onUnmounted, reactive, toRaw, createElementVNode, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, renderList, normalizeProps, mergeProps, getCurrentInstance, nextTick, withDirectives, Teleport, vShow, toHandlers, createSlots, provide } from 'vue';
1
+ import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, markRaw, createElementBlock, createVNode, withCtx, withModifiers, createCommentVNode, createTextVNode, toDisplayString, watch, onMounted, onUnmounted, reactive, toRaw, createElementVNode, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, renderList, normalizeProps, mergeProps, getCurrentInstance, nextTick, Teleport, toHandlers, createSlots, provide } from 'vue';
2
2
  import serialize from 'serialize-javascript';
3
3
  import { Delete, Pointer, Close, Plus, Edit, ArrowDown, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Files, DocumentCopy, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons';
4
4
  import { throttle, cloneDeep, mergeWith, random } from 'lodash-es';
5
5
  import * as monaco from 'monaco-editor';
6
6
  import { NodeType } from '@tmagic/schema';
7
7
  import { toLine, isPop, getNodePath, isNumber, isPage } from '@tmagic/utils';
8
- import { EventEmitter as EventEmitter$2 } from 'events';
8
+ import { EventEmitter } from 'events';
9
9
  import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
10
+ import Gesto from 'gesto';
10
11
  import { ElMessage } from 'element-plus';
11
12
  import KeyController from 'keycon';
12
13
  import StageCore from '@tmagic/stage';
13
14
 
14
- if (typeof window.global === "undefined") {
15
+ if (typeof global === "undefined") {
15
16
  window.global = window;
16
17
  }
18
+ if (typeof globalThis === "undefined") {
19
+ window.globalThis = window;
20
+ }
17
21
 
18
22
  var _export_sfc = (sfc, props) => {
19
23
  const target = sfc.__vccOpts || sfc;
@@ -117,7 +121,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
117
121
  }
118
122
  var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
119
123
 
120
- var UISelect_vue_vue_type_style_index_0_lang = '';
124
+ var UISelect_vue_vue_type_style_index_0_lang = /* #__PURE__ */ (() => ".m-fields-ui-select {\n cursor: pointer;\n}\n.m-fields-ui-select i {\n margin-right: 3px;\n}\n.m-fields-ui-select span {\n color: #2882e0;\n}")();
121
125
 
122
126
  const _sfc_main$k = defineComponent({
123
127
  name: "m-fields-ui-select",
@@ -310,11 +314,7 @@ const _sfc_main$j = defineComponent({
310
314
  const options = {
311
315
  value: values.value,
312
316
  language: props.language,
313
- tabSize: 2,
314
317
  theme: "vs-dark",
315
- fontFamily: 'dm, Menlo, Monaco, "Courier New", monospace',
316
- fontSize: 14,
317
- formatOnPaste: true,
318
318
  ...props.options
319
319
  };
320
320
  if (props.type === "diff") {
@@ -328,6 +328,7 @@ const _sfc_main$j = defineComponent({
328
328
  codeEditor.value.addEventListener("keydown", (e) => {
329
329
  if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
330
330
  e.preventDefault();
331
+ e.stopPropagation();
331
332
  emit("save", getEditorValue());
332
333
  }
333
334
  });
@@ -483,7 +484,7 @@ const doAction = async (args, scope, sourceMethod, beforeMethodName, afterMethod
483
484
  throw error;
484
485
  }
485
486
  };
486
- class BaseService extends EventEmitter$2 {
487
+ class BaseService extends EventEmitter {
487
488
  constructor(methods = [], serialMethods = []) {
488
489
  super();
489
490
  this.pluginOptionsList = {};
@@ -626,7 +627,7 @@ var historyService = new History();
626
627
 
627
628
  class Props extends BaseService {
628
629
  constructor() {
629
- super(["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue"]);
630
+ super(["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue", "createId", "setNewItemId"]);
630
631
  this.state = reactive({
631
632
  propsConfigMap: {},
632
633
  propsValueMap: {}
@@ -665,12 +666,44 @@ class Props extends BaseService {
665
666
  }
666
667
  return value;
667
668
  }
668
- return cloneDeep({
669
- ...getDefaultPropsValue(type),
670
- ...mergeWith(this.state.propsValueMap[type] || {}, defaultValue)
671
- });
669
+ const data = cloneDeep(defaultValue);
670
+ await this.setNewItemId(data);
671
+ return {
672
+ ...getDefaultPropsValue(type, await this.createId(type)),
673
+ ...mergeWith(cloneDeep(this.state.propsValueMap[type] || {}), data)
674
+ };
675
+ }
676
+ async createId(type) {
677
+ return `${type}_${random(1e4, false)}`;
678
+ }
679
+ async setNewItemId(config, parent) {
680
+ const oldId = config.id;
681
+ config.id = await this.createId(config.type || "component");
682
+ if (isPop(config) && parent?.type === NodeType.PAGE) {
683
+ updatePopId(oldId, config.id, parent);
684
+ }
685
+ if (config.items && Array.isArray(config.items)) {
686
+ for (const item of config.items) {
687
+ await this.setNewItemId(item, config);
688
+ }
689
+ }
672
690
  }
673
691
  }
692
+ const updatePopId = (oldId, popId, pageConfig) => {
693
+ pageConfig.items?.forEach((config) => {
694
+ if (config.pop === oldId) {
695
+ config.pop = popId;
696
+ return;
697
+ }
698
+ if (config.popId === oldId) {
699
+ config.popId = popId;
700
+ return;
701
+ }
702
+ if (Array.isArray(config.items)) {
703
+ updatePopId(oldId, popId, config);
704
+ }
705
+ });
706
+ };
674
707
  var propsService = new Props();
675
708
 
676
709
  var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
@@ -691,7 +724,6 @@ var Keys = /* @__PURE__ */ ((Keys2) => {
691
724
  })(Keys || {});
692
725
 
693
726
  const COPY_STORAGE_KEY = "$MagicEditorCopyData";
694
- const generateId = (type) => `${type}_${random(1e4, false)}`;
695
727
  const getPageList = (app) => {
696
728
  if (app.items && Array.isArray(app.items)) {
697
729
  return app.items.filter((item) => item.type === NodeType.PAGE);
@@ -711,32 +743,6 @@ const generatePageName = (pageNameList) => {
711
743
  return pageName;
712
744
  };
713
745
  const generatePageNameByApp = (app) => generatePageName(getPageNameList(getPageList(app)));
714
- const updatePopId = (oldId, popId, pageConfig) => {
715
- pageConfig.items?.forEach((config) => {
716
- if (config.pop === oldId) {
717
- config.pop = popId;
718
- return;
719
- }
720
- if (config.popId === oldId) {
721
- config.popId = popId;
722
- return;
723
- }
724
- if (Array.isArray(config.items)) {
725
- updatePopId(oldId, popId, config);
726
- }
727
- });
728
- };
729
- const setNewItemId = (config, parent) => {
730
- const oldId = config.id;
731
- config.id = generateId(config.type || "component");
732
- config.name = `${config.name?.replace(/_(\d+)$/, "")}_${config.id}`;
733
- if (isPop(config) && parent?.type === NodeType.PAGE) {
734
- updatePopId(oldId, config.id, parent);
735
- }
736
- if (config.items && Array.isArray(config.items)) {
737
- config.items.forEach((item) => setNewItemId(item, config));
738
- }
739
- };
740
746
  const isFixed = (node) => node.style?.position === "fixed";
741
747
  const getNodeIndex = (node, parent) => {
742
748
  const items = parent?.items || [];
@@ -753,9 +759,12 @@ const toRelative = (node) => {
753
759
  };
754
760
  const setTop2Middle = (node, parentNode, stage) => {
755
761
  const style = node.style || {};
756
- const height = style.height || 0;
757
- if (!stage || typeof style.top !== "undefined" || !parentNode.style || !isNumber(height))
762
+ let height = style.height || 0;
763
+ if (!stage || typeof style.top !== "undefined" || !parentNode.style)
758
764
  return style;
765
+ if (!isNumber(height)) {
766
+ height = 0;
767
+ }
759
768
  const { height: parentHeight } = parentNode.style;
760
769
  if (isPage(parentNode)) {
761
770
  const { scrollTop = 0, wrapperHeight } = stage.mask;
@@ -891,8 +900,11 @@ class Editor$1 extends BaseService {
891
900
  get(name) {
892
901
  return this.state[name];
893
902
  }
894
- getNodeInfo(id) {
895
- const root = toRaw(this.get("root"));
903
+ getNodeInfo(id, raw = true) {
904
+ let root = this.get("root");
905
+ if (raw) {
906
+ root = toRaw(root);
907
+ }
896
908
  if (!root)
897
909
  return {};
898
910
  if (id === root.id) {
@@ -913,14 +925,14 @@ class Editor$1 extends BaseService {
913
925
  });
914
926
  return info;
915
927
  }
916
- getNodeById(id) {
917
- const { node } = this.getNodeInfo(id);
928
+ getNodeById(id, raw = true) {
929
+ const { node } = this.getNodeInfo(id, raw);
918
930
  return node;
919
931
  }
920
- getParentById(id) {
932
+ getParentById(id, raw = true) {
921
933
  if (!this.get("root"))
922
934
  return;
923
- const { parent } = this.getNodeInfo(id);
935
+ const { parent } = this.getNodeInfo(id, raw);
924
936
  return parent;
925
937
  }
926
938
  async getLayout(parent, node) {
@@ -944,6 +956,13 @@ class Editor$1 extends BaseService {
944
956
  } else {
945
957
  historyService.empty();
946
958
  }
959
+ if (node?.id) {
960
+ this.get("stage")?.renderer.runtime?.getApp?.()?.emit("editor:select", {
961
+ node,
962
+ page,
963
+ parent
964
+ }, getNodePath(node.id, this.get("root").items));
965
+ }
947
966
  this.emit("select", node);
948
967
  return node;
949
968
  }
@@ -988,7 +1007,7 @@ class Editor$1 extends BaseService {
988
1007
  } else if (curNode.items) {
989
1008
  parentNode = curNode;
990
1009
  } else {
991
- parentNode = this.getParentById(curNode.id);
1010
+ parentNode = this.getParentById(curNode.id, false);
992
1011
  }
993
1012
  if (!parentNode)
994
1013
  throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
@@ -1018,7 +1037,7 @@ class Editor$1 extends BaseService {
1018
1037
  const root = this.get("root");
1019
1038
  if (!root)
1020
1039
  throw new Error("\u6CA1\u6709root");
1021
- const { parent, node: curNode } = this.getNodeInfo(node.id);
1040
+ const { parent, node: curNode } = this.getNodeInfo(node.id, false);
1022
1041
  if (!parent || !curNode)
1023
1042
  throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
1024
1043
  const index = getNodeIndex(curNode, parent);
@@ -1055,7 +1074,7 @@ class Editor$1 extends BaseService {
1055
1074
  async update(config2) {
1056
1075
  if (!config2?.id)
1057
1076
  throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
1058
- const info = this.getNodeInfo(config2.id);
1077
+ const info = this.getNodeInfo(config2.id, false);
1059
1078
  if (!info.node)
1060
1079
  throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config2.id}\u7684\u8282\u70B9`);
1061
1080
  const node = cloneDeep(toRaw(info.node));
@@ -1125,13 +1144,16 @@ class Editor$1 extends BaseService {
1125
1144
  console.error(e);
1126
1145
  return;
1127
1146
  }
1128
- setNewItemId(config, this.get("root"));
1147
+ await propsService.setNewItemId(config, this.get("root"));
1129
1148
  if (config.style) {
1130
1149
  config.style = {
1131
1150
  ...config.style,
1132
1151
  ...position
1133
1152
  };
1134
1153
  }
1154
+ if (isPage(config)) {
1155
+ config.name = generatePageNameByApp(this.get("root"));
1156
+ }
1135
1157
  return await this.add(config);
1136
1158
  }
1137
1159
  async alignCenter(config2) {
@@ -1141,7 +1163,17 @@ class Editor$1 extends BaseService {
1141
1163
  if (layout === Layout.RELATIVE) {
1142
1164
  return;
1143
1165
  }
1144
- if (parent.style?.width && node.style?.width) {
1166
+ if (!node.style)
1167
+ return;
1168
+ const stage = this.get("stage");
1169
+ const doc = stage?.renderer.contentWindow?.document;
1170
+ if (doc) {
1171
+ const parentEl = doc.getElementById(`${parent.id}`);
1172
+ const el = doc.getElementById(`${node.id}`);
1173
+ if (parentEl && el) {
1174
+ node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
1175
+ }
1176
+ } else if (parent.style && isNumber(parent.style?.width) && isNumber(node.style?.width)) {
1145
1177
  node.style.left = (parent.style.width - node.style.width) / 2;
1146
1178
  }
1147
1179
  await this.update(node);
@@ -1155,9 +1187,9 @@ class Editor$1 extends BaseService {
1155
1187
  const node = this.get("node");
1156
1188
  const brothers = parent?.items || [];
1157
1189
  const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
1158
- if (offset === LayerOffset.BOTTOM) {
1190
+ if (offset === LayerOffset.TOP) {
1159
1191
  brothers.splice(brothers.length - 1, 0, brothers.splice(index, 1)[0]);
1160
- } else if (offset === LayerOffset.TOP) {
1192
+ } else if (offset === LayerOffset.BOTTOM) {
1161
1193
  brothers.splice(0, 0, brothers.splice(index, 1)[0]);
1162
1194
  } else {
1163
1195
  brothers.splice(index + parseInt(`${offset}`, 10), 0, brothers.splice(index, 1)[0]);
@@ -1442,6 +1474,21 @@ const fillConfig = (config = []) => [
1442
1474
  text: "\u7C97\u7EC6"
1443
1475
  }
1444
1476
  ]
1477
+ },
1478
+ {
1479
+ type: "fieldset",
1480
+ legend: "\u53D8\u5F62",
1481
+ name: "transform",
1482
+ items: [
1483
+ {
1484
+ name: "rotate",
1485
+ text: "\u65CB\u8F6C\u89D2\u5EA6"
1486
+ },
1487
+ {
1488
+ name: "scale",
1489
+ text: "\u7F29\u653E"
1490
+ }
1491
+ ]
1445
1492
  }
1446
1493
  ]
1447
1494
  }
@@ -1495,1272 +1542,70 @@ const fillConfig = (config = []) => [
1495
1542
  name: "created",
1496
1543
  text: "created",
1497
1544
  formTitle: "created"
1498
- }
1499
- ]
1500
- }
1501
- ]
1502
- }
1503
- ];
1504
- const DEFAULT_CONFIG = fillConfig([]);
1505
- const getDefaultPropsValue = (type) => ({
1506
- type,
1507
- id: generateId(type),
1508
- style: {},
1509
- name: type
1510
- });
1511
-
1512
- const _sfc_main$i = defineComponent({
1513
- components: { Plus },
1514
- setup() {
1515
- const services = inject("services");
1516
- return {
1517
- clickHandler() {
1518
- const { editorService } = services || {};
1519
- if (!editorService)
1520
- return;
1521
- editorService.add({
1522
- type: NodeType.PAGE,
1523
- name: generatePageNameByApp(toRaw(editorService.get("root")))
1524
- });
1525
- }
1526
- };
1527
- }
1528
- });
1529
- const _hoisted_1$a = { class: "m-editor-empty-panel" };
1530
- const _hoisted_2$4 = { class: "m-editor-empty-content" };
1531
- const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1532
- function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1533
- const _component_plus = resolveComponent("plus");
1534
- const _component_el_icon = resolveComponent("el-icon");
1535
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
1536
- createElementVNode("div", _hoisted_2$4, [
1537
- createElementVNode("div", {
1538
- class: "m-editor-empty-button",
1539
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
1540
- }, [
1541
- createElementVNode("div", null, [
1542
- createVNode(_component_el_icon, null, {
1543
- default: withCtx(() => [
1544
- createVNode(_component_plus)
1545
- ]),
1546
- _: 1
1547
- })
1548
- ]),
1549
- _hoisted_3$2
1550
- ])
1551
- ])
1552
- ]);
1553
- }
1554
- var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
1555
-
1556
- /*
1557
- Copyright (c) 2018 Daybrush
1558
- @name: @daybrush/utils
1559
- license: MIT
1560
- author: Daybrush
1561
- repository: https://github.com/daybrush/utils
1562
- @version 1.6.0
1563
- */
1564
- /**
1565
- * get string "object"
1566
- * @memberof Consts
1567
- * @example
1568
- import {OBJECT} from "@daybrush/utils";
1569
-
1570
- console.log(OBJECT); // "object"
1571
- */
1572
-
1573
- var OBJECT = "object";
1574
- /**
1575
- * Check the type that the value is object.
1576
- * @memberof Utils
1577
- * @param {string} value - Value to check the type
1578
- * @return {} true if the type is correct, false otherwise
1579
- * @example
1580
- import {isObject} from "@daybrush/utils";
1581
-
1582
- console.log(isObject({})); // true
1583
- console.log(isObject(undefined)); // false
1584
- console.log(isObject("")); // false
1585
- console.log(isObject(null)); // false
1586
- */
1587
-
1588
- function isObject(value) {
1589
- return value && typeof value === OBJECT;
1590
- }
1591
- /**
1592
- * Date.now() method
1593
- * @memberof CrossBrowser
1594
- * @return {number} milliseconds
1595
- * @example
1596
- import {now} from "@daybrush/utils";
1597
-
1598
- console.log(now()); // 12121324241(milliseconds)
1599
- */
1600
-
1601
- function now() {
1602
- return Date.now ? Date.now() : new Date().getTime();
1603
- }
1604
- /**
1605
- * Returns the index of the first element in the array that satisfies the provided testing function.
1606
- * @function
1607
- * @memberof CrossBrowser
1608
- * @param - The array `findIndex` was called upon.
1609
- * @param - A function to execute on each value in the array until the function returns true, indicating that the satisfying element was found.
1610
- * @param - Returns defaultIndex if not found by the function.
1611
- * @example
1612
- import { findIndex } from "@daybrush/utils";
1613
-
1614
- findIndex([{a: 1}, {a: 2}, {a: 3}, {a: 4}], ({ a }) => a === 2); // 1
1615
- */
1616
-
1617
- function findIndex(arr, callback, defaultIndex) {
1618
- if (defaultIndex === void 0) {
1619
- defaultIndex = -1;
1620
- }
1621
-
1622
- var length = arr.length;
1623
-
1624
- for (var i = 0; i < length; ++i) {
1625
- if (callback(arr[i], i, arr)) {
1626
- return i;
1627
- }
1628
- }
1629
-
1630
- return defaultIndex;
1631
- }
1632
- /**
1633
- * Sets up a function that will be called whenever the specified event is delivered to the target
1634
- * @memberof DOM
1635
- * @param - event target
1636
- * @param - A case-sensitive string representing the event type to listen for.
1637
- * @param - The object which receives a notification (an object that implements the Event interface) when an event of the specified type occurs
1638
- * @param - An options object that specifies characteristics about the event listener.
1639
- * @example
1640
- import {addEvent} from "@daybrush/utils";
1641
-
1642
- addEvent(el, "click", e => {
1643
- console.log(e);
1644
- });
1645
- */
1646
-
1647
- function addEvent(el, type, listener, options) {
1648
- el.addEventListener(type, listener, options);
1649
- }
1650
- /**
1651
- * removes from the EventTarget an event listener previously registered with EventTarget.addEventListener()
1652
- * @memberof DOM
1653
- * @param - event target
1654
- * @param - A case-sensitive string representing the event type to listen for.
1655
- * @param - The EventListener function of the event handler to remove from the event target.
1656
- * @param - An options object that specifies characteristics about the event listener.
1657
- * @example
1658
- import {addEvent, removeEvent} from "@daybrush/utils";
1659
- const listener = e => {
1660
- console.log(e);
1661
- };
1662
- addEvent(el, "click", listener);
1663
- removeEvent(el, "click", listener);
1664
- */
1665
-
1666
- function removeEvent(el, type, listener, options) {
1667
- el.removeEventListener(type, listener, options);
1668
- }
1669
-
1670
- /*
1671
- Copyright (c) 2019 Daybrush
1672
- name: @scena/event-emitter
1673
- license: MIT
1674
- author: Daybrush
1675
- repository: git+https://github.com/daybrush/gesture.git
1676
- version: 1.0.5
1677
- */
1678
-
1679
- /*! *****************************************************************************
1680
- Copyright (c) Microsoft Corporation.
1681
-
1682
- Permission to use, copy, modify, and/or distribute this software for any
1683
- purpose with or without fee is hereby granted.
1684
-
1685
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1686
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1687
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1688
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1689
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1690
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1691
- PERFORMANCE OF THIS SOFTWARE.
1692
- ***************************************************************************** */
1693
- var __assign$1 = function () {
1694
- __assign$1 = Object.assign || function __assign(t) {
1695
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1696
- s = arguments[i];
1697
-
1698
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1699
- }
1700
-
1701
- return t;
1702
- };
1703
-
1704
- return __assign$1.apply(this, arguments);
1705
- };
1706
- function __spreadArrays() {
1707
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1708
-
1709
- 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];
1710
-
1711
- return r;
1712
- }
1713
-
1714
- /**
1715
- * Implement EventEmitter on object or component.
1716
- */
1717
-
1718
- var EventEmitter =
1719
- /*#__PURE__*/
1720
- function () {
1721
- function EventEmitter() {
1722
- this._events = {};
1723
- }
1724
- /**
1725
- * Add a listener to the registered event.
1726
- * @param - Name of the event to be added
1727
- * @param - listener function of the event to be added
1728
- * @example
1729
- * import EventEmitter from "@scena/event-emitter";
1730
- * cosnt emitter = new EventEmitter();
1731
- *
1732
- * // Add listener in "a" event
1733
- * emitter.on("a", () => {
1734
- * });
1735
- * // Add listeners
1736
- * emitter.on({
1737
- * a: () => {},
1738
- * b: () => {},
1739
- * });
1740
- */
1741
-
1742
-
1743
- var __proto = EventEmitter.prototype;
1744
-
1745
- __proto.on = function (eventName, listener) {
1746
- if (isObject(eventName)) {
1747
- for (var name in eventName) {
1748
- this.on(name, eventName[name]);
1749
- }
1750
- } else {
1751
- this._addEvent(eventName, listener, {});
1752
- }
1753
-
1754
- return this;
1755
- };
1756
- /**
1757
- * Remove listeners registered in the event target.
1758
- * @param - Name of the event to be removed
1759
- * @param - listener function of the event to be removed
1760
- * @example
1761
- * import EventEmitter from "@scena/event-emitter";
1762
- * cosnt emitter = new EventEmitter();
1763
- *
1764
- * // Remove all listeners.
1765
- * emitter.off();
1766
- *
1767
- * // Remove all listeners in "A" event.
1768
- * emitter.off("a");
1769
- *
1770
- *
1771
- * // Remove "listener" listener in "a" event.
1772
- * emitter.off("a", listener);
1773
- */
1774
-
1775
-
1776
- __proto.off = function (eventName, listener) {
1777
- if (!eventName) {
1778
- this._events = {};
1779
- } else if (isObject(eventName)) {
1780
- for (var name in eventName) {
1781
- this.off(name);
1782
- }
1783
- } else if (!listener) {
1784
- this._events[eventName] = [];
1785
- } else {
1786
- var events = this._events[eventName];
1787
-
1788
- if (events) {
1789
- var index = findIndex(events, function (e) {
1790
- return e.listener === listener;
1791
- });
1792
-
1793
- if (index > -1) {
1794
- events.splice(index, 1);
1795
- }
1796
- }
1797
- }
1798
-
1799
- return this;
1800
- };
1801
- /**
1802
- * Add a disposable listener and Use promise to the registered event.
1803
- * @param - Name of the event to be added
1804
- * @param - disposable listener function of the event to be added
1805
- * @example
1806
- * import EventEmitter from "@scena/event-emitter";
1807
- * cosnt emitter = new EventEmitter();
1808
- *
1809
- * // Add a disposable listener in "a" event
1810
- * emitter.once("a", () => {
1811
- * });
1812
- *
1813
- * // Use Promise
1814
- * emitter.once("a").then(e => {
1815
- * });
1816
- */
1817
-
1818
-
1819
- __proto.once = function (eventName, listener) {
1820
- var _this = this;
1821
-
1822
- if (listener) {
1823
- this._addEvent(eventName, listener, {
1824
- once: true
1825
- });
1826
- }
1827
-
1828
- return new Promise(function (resolve) {
1829
- _this._addEvent(eventName, resolve, {
1830
- once: true
1831
- });
1832
- });
1833
- };
1834
- /**
1835
- * Fires an event to call listeners.
1836
- * @param - Event name
1837
- * @param - Event parameter
1838
- * @return If false, stop the event.
1839
- * @example
1840
- *
1841
- * import EventEmitter from "@scena/event-emitter";
1842
- *
1843
- *
1844
- * const emitter = new EventEmitter();
1845
- *
1846
- * emitter.on("a", e => {
1847
- * });
1848
- *
1849
- *
1850
- * emitter.emit("a", {
1851
- * a: 1,
1852
- * });
1853
- */
1854
-
1855
-
1856
- __proto.emit = function (eventName, param) {
1857
- var _this = this;
1858
-
1859
- if (param === void 0) {
1860
- param = {};
1861
- }
1862
-
1863
- var events = this._events[eventName];
1864
-
1865
- if (!eventName || !events) {
1866
- return true;
1867
- }
1868
-
1869
- var isStop = false;
1870
- param.eventType = eventName;
1871
-
1872
- param.stop = function () {
1873
- isStop = true;
1874
- };
1875
-
1876
- param.currentTarget = this;
1877
-
1878
- __spreadArrays(events).forEach(function (info) {
1879
- info.listener(param);
1880
-
1881
- if (info.once) {
1882
- _this.off(eventName, info.listener);
1883
- }
1884
- });
1885
-
1886
- return !isStop;
1887
- };
1888
- /**
1889
- * Fires an event to call listeners.
1890
- * @param - Event name
1891
- * @param - Event parameter
1892
- * @return If false, stop the event.
1893
- * @example
1894
- *
1895
- * import EventEmitter from "@scena/event-emitter";
1896
- *
1897
- *
1898
- * const emitter = new EventEmitter();
1899
- *
1900
- * emitter.on("a", e => {
1901
- * });
1902
- *
1903
- *
1904
- * emitter.emit("a", {
1905
- * a: 1,
1906
- * });
1907
- */
1908
-
1909
- /**
1910
- * Fires an event to call listeners.
1911
- * @param - Event name
1912
- * @param - Event parameter
1913
- * @return If false, stop the event.
1914
- * @example
1915
- *
1916
- * import EventEmitter from "@scena/event-emitter";
1917
- *
1918
- *
1919
- * const emitter = new EventEmitter();
1920
- *
1921
- * emitter.on("a", e => {
1922
- * });
1923
- *
1924
- * // emit
1925
- * emitter.trigger("a", {
1926
- * a: 1,
1927
- * });
1928
- */
1929
-
1930
-
1931
- __proto.trigger = function (eventName, param) {
1932
- if (param === void 0) {
1933
- param = {};
1934
- }
1935
-
1936
- return this.emit(eventName, param);
1937
- };
1938
-
1939
- __proto._addEvent = function (eventName, listener, options) {
1940
- var events = this._events;
1941
- events[eventName] = events[eventName] || [];
1942
- var listeners = events[eventName];
1943
- listeners.push(__assign$1({
1944
- listener: listener
1945
- }, options));
1946
- };
1947
-
1948
- return EventEmitter;
1949
- }();
1950
-
1951
- var EventEmitter$1 = EventEmitter;
1952
-
1953
- /*
1954
- Copyright (c) 2019 Daybrush
1955
- name: gesto
1956
- license: MIT
1957
- author: Daybrush
1958
- repository: git+https://github.com/daybrush/gesto.git
1959
- version: 1.7.0
1960
- */
1961
-
1962
- /*! *****************************************************************************
1963
- Copyright (c) Microsoft Corporation. All rights reserved.
1964
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
1965
- this file except in compliance with the License. You may obtain a copy of the
1966
- License at http://www.apache.org/licenses/LICENSE-2.0
1967
-
1968
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1969
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
1970
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
1971
- MERCHANTABLITY OR NON-INFRINGEMENT.
1972
-
1973
- See the Apache Version 2.0 License for specific language governing permissions
1974
- and limitations under the License.
1975
- ***************************************************************************** */
1976
-
1977
- /* global Reflect, Promise */
1978
- var extendStatics = function (d, b) {
1979
- extendStatics = Object.setPrototypeOf || {
1980
- __proto__: []
1981
- } instanceof Array && function (d, b) {
1982
- d.__proto__ = b;
1983
- } || function (d, b) {
1984
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
1985
- };
1986
-
1987
- return extendStatics(d, b);
1988
- };
1989
-
1990
- function __extends(d, b) {
1991
- extendStatics(d, b);
1992
-
1993
- function __() {
1994
- this.constructor = d;
1995
- }
1996
-
1997
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1998
- }
1999
- var __assign = function () {
2000
- __assign = Object.assign || function __assign(t) {
2001
- for (var s, i = 1, n = arguments.length; i < n; i++) {
2002
- s = arguments[i];
2003
-
2004
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2005
- }
2006
-
2007
- return t;
2008
- };
2009
-
2010
- return __assign.apply(this, arguments);
2011
- };
2012
-
2013
- function getRad(pos1, pos2) {
2014
- var distX = pos2[0] - pos1[0];
2015
- var distY = pos2[1] - pos1[1];
2016
- var rad = Math.atan2(distY, distX);
2017
- return rad >= 0 ? rad : rad + Math.PI * 2;
2018
- }
2019
- function getRotatiion(touches) {
2020
- return getRad([touches[0].clientX, touches[0].clientY], [touches[1].clientX, touches[1].clientY]) / Math.PI * 180;
2021
- }
2022
- function isMultiTouch(e) {
2023
- return e.touches && e.touches.length >= 2;
2024
- }
2025
- function getEventClients(e) {
2026
- if (e.touches) {
2027
- return getClients(e.touches);
2028
- } else {
2029
- return [getClient(e)];
2030
- }
2031
- }
2032
- function getPosition(clients, prevClients, startClients) {
2033
- var length = startClients.length;
2034
-
2035
- var _a = getAverageClient(clients, length),
2036
- clientX = _a.clientX,
2037
- clientY = _a.clientY,
2038
- originalClientX = _a.originalClientX,
2039
- originalClientY = _a.originalClientY;
2040
-
2041
- var _b = getAverageClient(prevClients, length),
2042
- prevX = _b.clientX,
2043
- prevY = _b.clientY;
2044
-
2045
- var _c = getAverageClient(startClients, length),
2046
- startX = _c.clientX,
2047
- startY = _c.clientY;
2048
-
2049
- var deltaX = clientX - prevX;
2050
- var deltaY = clientY - prevY;
2051
- var distX = clientX - startX;
2052
- var distY = clientY - startY;
2053
- return {
2054
- clientX: originalClientX,
2055
- clientY: originalClientY,
2056
- deltaX: deltaX,
2057
- deltaY: deltaY,
2058
- distX: distX,
2059
- distY: distY
2060
- };
2061
- }
2062
- function getDist(clients) {
2063
- return Math.sqrt(Math.pow(clients[0].clientX - clients[1].clientX, 2) + Math.pow(clients[0].clientY - clients[1].clientY, 2));
2064
- }
2065
- function getClients(touches) {
2066
- var length = Math.min(touches.length, 2);
2067
- var clients = [];
2068
-
2069
- for (var i = 0; i < length; ++i) {
2070
- clients.push(getClient(touches[i]));
2071
- }
2072
-
2073
- return clients;
2074
- }
2075
- function getClient(e) {
2076
- return {
2077
- clientX: e.clientX,
2078
- clientY: e.clientY
2079
- };
2080
- }
2081
- function getAverageClient(clients, length) {
2082
- if (length === void 0) {
2083
- length = clients.length;
2084
- }
2085
-
2086
- var sumClient = {
2087
- clientX: 0,
2088
- clientY: 0,
2089
- originalClientX: 0,
2090
- originalClientY: 0
2091
- };
2092
-
2093
- for (var i = 0; i < length; ++i) {
2094
- var client = clients[i];
2095
- sumClient.originalClientX += "originalClientX" in client ? client.originalClientX : client.clientX;
2096
- sumClient.originalClientY += "originalClientY" in client ? client.originalClientY : client.clientY;
2097
- sumClient.clientX += client.clientX;
2098
- sumClient.clientY += client.clientY;
2099
- }
2100
-
2101
- if (!length) {
2102
- return sumClient;
2103
- }
2104
-
2105
- return {
2106
- clientX: sumClient.clientX / length,
2107
- clientY: sumClient.clientY / length,
2108
- originalClientX: sumClient.originalClientX / length,
2109
- originalClientY: sumClient.originalClientY / length
2110
- };
2111
- }
2112
-
2113
- var ClientStore =
2114
- /*#__PURE__*/
2115
- function () {
2116
- function ClientStore(clients) {
2117
- this.prevClients = [];
2118
- this.startClients = [];
2119
- this.movement = 0;
2120
- this.length = 0;
2121
- this.startClients = clients;
2122
- this.prevClients = clients;
2123
- this.length = clients.length;
2124
- }
2125
-
2126
- var __proto = ClientStore.prototype;
2127
-
2128
- __proto.getAngle = function (clients) {
2129
- if (clients === void 0) {
2130
- clients = this.prevClients;
2131
- }
2132
-
2133
- return getRotatiion(clients);
2134
- };
2135
-
2136
- __proto.getRotation = function (clients) {
2137
- if (clients === void 0) {
2138
- clients = this.prevClients;
2139
- }
2140
-
2141
- return getRotatiion(clients) - getRotatiion(this.startClients);
2142
- };
2143
-
2144
- __proto.getPosition = function (clients, isAdd) {
2145
- if (clients === void 0) {
2146
- clients = this.prevClients;
2147
- }
2148
-
2149
- var position = getPosition(clients || this.prevClients, this.prevClients, this.startClients);
2150
- var deltaX = position.deltaX,
2151
- deltaY = position.deltaY;
2152
- this.movement += Math.sqrt(deltaX * deltaX + deltaY * deltaY);
2153
- this.prevClients = clients;
2154
- return position;
2155
- };
2156
-
2157
- __proto.getPositions = function (clients) {
2158
- if (clients === void 0) {
2159
- clients = this.prevClients;
2160
- }
2161
-
2162
- var prevClients = this.prevClients;
2163
- return this.startClients.map(function (startClient, i) {
2164
- return getPosition([clients[i]], [prevClients[i]], [startClient]);
2165
- });
2166
- };
2167
-
2168
- __proto.getMovement = function (clients) {
2169
- var movement = this.movement;
2170
-
2171
- if (!clients) {
2172
- return movement;
2173
- }
2174
-
2175
- var currentClient = getAverageClient(clients, this.length);
2176
- var prevClient = getAverageClient(this.prevClients, this.length);
2177
- var deltaX = currentClient.clientX - prevClient.clientX;
2178
- var deltaY = currentClient.clientY - prevClient.clientY;
2179
- return Math.sqrt(deltaX * deltaX + deltaY * deltaY) + movement;
2180
- };
2181
-
2182
- __proto.getDistance = function (clients) {
2183
- if (clients === void 0) {
2184
- clients = this.prevClients;
2185
- }
2186
-
2187
- return getDist(clients);
2188
- };
2189
-
2190
- __proto.getScale = function (clients) {
2191
- if (clients === void 0) {
2192
- clients = this.prevClients;
2193
- }
2194
-
2195
- return getDist(clients) / getDist(this.startClients);
2196
- };
2197
-
2198
- __proto.move = function (deltaX, deltaY) {
2199
- this.startClients.forEach(function (client) {
2200
- client.clientX -= deltaX;
2201
- client.clientY -= deltaY;
2202
- });
2203
- };
2204
-
2205
- return ClientStore;
2206
- }();
2207
-
2208
- var INPUT_TAGNAMES = ["textarea", "input"];
2209
- /**
2210
- * You can set up drag, pinch events in any browser.
2211
- */
2212
-
2213
- var Gesto =
2214
- /*#__PURE__*/
2215
- function (_super) {
2216
- __extends(Gesto, _super);
2217
- /**
2218
- *
2219
- */
2220
-
2221
-
2222
- function Gesto(targets, options) {
2223
- if (options === void 0) {
2224
- options = {};
2225
- }
2226
-
2227
- var _this = _super.call(this) || this;
2228
-
2229
- _this.options = {};
2230
- _this.flag = false;
2231
- _this.pinchFlag = false;
2232
- _this.datas = {};
2233
- _this.isDrag = false;
2234
- _this.isPinch = false;
2235
- _this.isMouse = false;
2236
- _this.isTouch = false;
2237
- _this.clientStores = [];
2238
- _this.targets = [];
2239
- _this.prevTime = 0;
2240
- _this.doubleFlag = false;
2241
- _this._dragFlag = false;
2242
-
2243
- _this.onDragStart = function (e, isTrusted) {
2244
- if (isTrusted === void 0) {
2245
- isTrusted = true;
2246
- }
2247
-
2248
- if (!_this.flag && e.cancelable === false) {
2249
- return;
2250
- }
2251
-
2252
- var _a = _this.options,
2253
- container = _a.container,
2254
- pinchOutside = _a.pinchOutside,
2255
- preventRightClick = _a.preventRightClick,
2256
- preventDefault = _a.preventDefault,
2257
- checkInput = _a.checkInput;
2258
- var isTouch = _this.isTouch;
2259
- var isDragStart = !_this.flag;
2260
-
2261
- if (isDragStart) {
2262
- var activeElement = document.activeElement;
2263
- var target = e.target;
2264
- var tagName = target.tagName.toLowerCase();
2265
- var hasInput = INPUT_TAGNAMES.indexOf(tagName) > -1;
2266
- var hasContentEditable = target.isContentEditable;
2267
-
2268
- if (hasInput || hasContentEditable) {
2269
- if (checkInput || activeElement === target) {
2270
- // force false or already focused.
2271
- return false;
2272
- } // no focus
2273
-
2274
-
2275
- if (activeElement && hasContentEditable && activeElement.isContentEditable && activeElement.contains(target)) {
2276
- return false;
2277
- }
2278
- } else if ((preventDefault || e.type === "touchstart") && activeElement) {
2279
- var activeTagName = activeElement.tagName;
2280
-
2281
- if (activeElement.isContentEditable || INPUT_TAGNAMES.indexOf(activeTagName) > -1) {
2282
- activeElement.blur();
2283
- }
2284
- }
2285
-
2286
- _this.clientStores = [new ClientStore(getEventClients(e))];
2287
- _this.flag = true;
2288
- _this.isDrag = false;
2289
- _this._dragFlag = true;
2290
- _this.datas = {};
2291
-
2292
- if (preventRightClick && (e.which === 3 || e.button === 2)) {
2293
- _this.initDrag();
2294
-
2295
- return false;
2296
- }
2297
-
2298
- _this.doubleFlag = now() - _this.prevTime < 200;
2299
-
2300
- var result = _this.emit("dragStart", __assign({
2301
- datas: _this.datas,
2302
- inputEvent: e,
2303
- isTrusted: isTrusted,
2304
- isDouble: _this.doubleFlag
2305
- }, _this.getCurrentStore().getPosition(), {
2306
- preventDefault: function () {
2307
- e.preventDefault();
2308
- },
2309
- preventDrag: function () {
2310
- _this._dragFlag = false;
2311
- }
2312
- }));
2313
-
2314
- if (result === false) {
2315
- _this.initDrag();
2316
- }
2317
-
2318
- _this.flag && preventDefault && e.preventDefault();
2319
- }
2320
-
2321
- if (!_this.flag) {
2322
- return false;
2323
- }
2324
-
2325
- var timer = 0;
2326
-
2327
- if (isDragStart && isTouch && pinchOutside) {
2328
- timer = setTimeout(function () {
2329
- addEvent(container, "touchstart", _this.onDragStart, {
2330
- passive: false
2331
- });
2332
- });
2333
- }
2334
-
2335
- if (!isDragStart && isTouch && pinchOutside) {
2336
- removeEvent(container, "touchstart", _this.onDragStart);
2337
- }
2338
-
2339
- if (_this.flag && isMultiTouch(e)) {
2340
- clearTimeout(timer);
2341
-
2342
- if (isDragStart && e.touches.length !== e.changedTouches.length) {
2343
- return;
2344
- }
2345
-
2346
- if (!_this.pinchFlag) {
2347
- _this.onPinchStart(e);
2348
- }
2349
- }
2350
- };
2351
-
2352
- _this.onDrag = function (e, isScroll) {
2353
- if (!_this.flag) {
2354
- return;
2355
- }
2356
-
2357
- var clients = getEventClients(e);
2358
-
2359
- var result = _this.moveClients(clients, e, false);
2360
-
2361
- if (_this._dragFlag) {
2362
- if (_this.pinchFlag || result.deltaX || result.deltaY) {
2363
- var dragResult = _this.emit("drag", __assign({}, result, {
2364
- isScroll: !!isScroll,
2365
- inputEvent: e
2366
- }));
2367
-
2368
- if (dragResult === false) {
2369
- _this.stop();
2370
-
2371
- return;
2372
- }
2373
- }
2374
-
2375
- if (_this.pinchFlag) {
2376
- _this.onPinch(e, clients);
2377
- }
2378
- }
2379
-
2380
- _this.getCurrentStore().getPosition(clients, true);
2381
- };
2382
-
2383
- _this.onDragEnd = function (e) {
2384
- if (!_this.flag) {
2385
- return;
2386
- }
2387
-
2388
- var _a = _this.options,
2389
- pinchOutside = _a.pinchOutside,
2390
- container = _a.container;
2391
-
2392
- if (_this.isTouch && pinchOutside) {
2393
- removeEvent(container, "touchstart", _this.onDragStart);
1545
+ }
1546
+ ]
2394
1547
  }
1548
+ ]
1549
+ }
1550
+ ];
1551
+ const DEFAULT_CONFIG = fillConfig([]);
1552
+ const getDefaultPropsValue = (type, id) => ["page", "container"].includes(type) ? {
1553
+ type,
1554
+ id,
1555
+ layout: "absolute",
1556
+ style: {},
1557
+ name: type,
1558
+ items: []
1559
+ } : {
1560
+ type,
1561
+ id,
1562
+ style: {},
1563
+ name: type
1564
+ };
2395
1565
 
2396
- _this.flag = false;
2397
-
2398
- var position = _this._getPosition();
2399
-
2400
- var currentTime = now();
2401
- var isDouble = !_this.isDrag && _this.doubleFlag;
2402
- _this.prevTime = _this.isDrag || isDouble ? 0 : currentTime;
2403
-
2404
- _this.emit("dragEnd", __assign({
2405
- datas: _this.datas,
2406
- isDouble: isDouble,
2407
- isDrag: _this.isDrag,
2408
- isClick: !_this.isDrag,
2409
- inputEvent: e
2410
- }, position));
2411
-
2412
- if (_this.pinchFlag) {
2413
- _this.onPinchEnd(e);
1566
+ const _sfc_main$i = defineComponent({
1567
+ components: { Plus },
1568
+ setup() {
1569
+ const services = inject("services");
1570
+ return {
1571
+ clickHandler() {
1572
+ const { editorService } = services || {};
1573
+ if (!editorService)
1574
+ return;
1575
+ editorService.add({
1576
+ type: NodeType.PAGE,
1577
+ name: generatePageNameByApp(toRaw(editorService.get("root")))
1578
+ });
2414
1579
  }
2415
-
2416
- _this.clientStores = [];
2417
- };
2418
-
2419
- _this.onBlur = function () {
2420
- _this.onDragEnd();
2421
1580
  };
2422
-
2423
- var elements = [].concat(targets);
2424
- _this.options = __assign({
2425
- checkInput: false,
2426
- container: elements.length > 1 ? window : elements[0],
2427
- preventRightClick: true,
2428
- preventDefault: true,
2429
- checkWindowBlur: false,
2430
- pinchThreshold: 0,
2431
- events: ["touch", "mouse"]
2432
- }, options);
2433
- var _a = _this.options,
2434
- container = _a.container,
2435
- events = _a.events,
2436
- checkWindowBlur = _a.checkWindowBlur;
2437
- _this.isTouch = events.indexOf("touch") > -1;
2438
- _this.isMouse = events.indexOf("mouse") > -1;
2439
- _this.targets = elements;
2440
-
2441
- if (_this.isMouse) {
2442
- elements.forEach(function (el) {
2443
- addEvent(el, "mousedown", _this.onDragStart);
2444
- });
2445
- addEvent(container, "mousemove", _this.onDrag);
2446
- addEvent(container, "mouseup", _this.onDragEnd);
2447
- addEvent(container, "contextmenu", _this.onDragEnd);
2448
- }
2449
-
2450
- if (checkWindowBlur) {
2451
- addEvent(window, "blur", _this.onBlur);
2452
- }
2453
-
2454
- if (_this.isTouch) {
2455
- var passive_1 = {
2456
- passive: false
2457
- };
2458
- elements.forEach(function (el) {
2459
- addEvent(el, "touchstart", _this.onDragStart, passive_1);
2460
- });
2461
- addEvent(container, "touchmove", _this.onDrag, passive_1);
2462
- addEvent(container, "touchend", _this.onDragEnd, passive_1);
2463
- addEvent(container, "touchcancel", _this.onDragEnd, passive_1);
2464
- }
2465
-
2466
- return _this;
2467
1581
  }
2468
- /**
2469
- * Stop Gesto's drag events.
2470
- */
2471
-
2472
-
2473
- var __proto = Gesto.prototype;
2474
-
2475
- __proto.stop = function () {
2476
- this.isDrag = false;
2477
- this.flag = false;
2478
- this.clientStores = [];
2479
- this.datas = {};
2480
- };
2481
- /**
2482
- * The total moved distance
2483
- */
2484
-
2485
-
2486
- __proto.getMovement = function (clients) {
2487
- return this.getCurrentStore().getMovement(clients) + this.clientStores.slice(1).reduce(function (prev, cur) {
2488
- return prev + cur.movement;
2489
- }, 0);
2490
- };
2491
- /**
2492
- * Whether to drag
2493
- */
2494
-
2495
-
2496
- __proto.isDragging = function () {
2497
- return this.isDrag;
2498
- };
2499
- /**
2500
- * Whether to start drag
2501
- */
2502
-
2503
-
2504
- __proto.isFlag = function () {
2505
- return this.flag;
2506
- };
2507
- /**
2508
- * Whether to start pinch
2509
- */
2510
-
2511
-
2512
- __proto.isPinchFlag = function () {
2513
- return this.pinchFlag;
2514
- };
2515
- /**
2516
- * Whether to start double click
2517
- */
2518
-
2519
-
2520
- __proto.isDoubleFlag = function () {
2521
- return this.doubleFlag;
2522
- };
2523
- /**
2524
- * Whether to pinch
2525
- */
2526
-
2527
-
2528
- __proto.isPinching = function () {
2529
- return this.isPinch;
2530
- };
2531
- /**
2532
- * If a scroll event occurs, it is corrected by the scroll distance.
2533
- */
2534
-
2535
-
2536
- __proto.scrollBy = function (deltaX, deltaY, e, isCallDrag) {
2537
- if (isCallDrag === void 0) {
2538
- isCallDrag = true;
2539
- }
2540
-
2541
- if (!this.flag) {
2542
- return;
2543
- }
2544
-
2545
- this.clientStores[0].move(deltaX, deltaY);
2546
- isCallDrag && this.onDrag(e, true);
2547
- };
2548
- /**
2549
- * Create a virtual drag event.
2550
- */
2551
-
2552
-
2553
- __proto.move = function (_a, inputEvent) {
2554
- var deltaX = _a[0],
2555
- deltaY = _a[1];
2556
- var store = this.getCurrentStore();
2557
- var nextClients = store.prevClients;
2558
- return this.moveClients(nextClients.map(function (_a) {
2559
- var clientX = _a.clientX,
2560
- clientY = _a.clientY;
2561
- return {
2562
- clientX: clientX + deltaX,
2563
- clientY: clientY + deltaY,
2564
- originalClientX: clientX,
2565
- originalClientY: clientY
2566
- };
2567
- }), inputEvent, true);
2568
- };
2569
- /**
2570
- * The dragStart event is triggered by an external event.
2571
- */
2572
-
2573
-
2574
- __proto.triggerDragStart = function (e) {
2575
- this.onDragStart(e, false);
2576
- };
2577
- /**
2578
- * Set the event data while dragging.
2579
- */
2580
-
2581
-
2582
- __proto.setEventDatas = function (datas) {
2583
- var currentDatas = this.datas;
2584
-
2585
- for (var name in datas) {
2586
- currentDatas[name] = datas[name];
2587
- }
2588
-
2589
- return this;
2590
- };
2591
- /**
2592
- * Get the current event state while dragging.
2593
- */
2594
-
2595
-
2596
- __proto.getCurrentEvent = function (inputEvent) {
2597
- return __assign({
2598
- datas: this.datas
2599
- }, this._getPosition(), {
2600
- movement: this.getMovement(),
2601
- isDrag: this.isDrag,
2602
- isPinch: this.isPinch,
2603
- isScroll: false,
2604
- inputEvent: inputEvent
2605
- });
2606
- };
2607
- /**
2608
- * Get & Set the event data while dragging.
2609
- */
2610
-
2611
-
2612
- __proto.getEventDatas = function () {
2613
- return this.datas;
2614
- };
2615
- /**
2616
- * Unset Gesto
2617
- */
2618
-
2619
-
2620
- __proto.unset = function () {
2621
- var _this = this;
2622
-
2623
- var targets = this.targets;
2624
- var container = this.options.container;
2625
- this.off();
2626
- removeEvent(window, "blur", this.onBlur);
2627
-
2628
- if (this.isMouse) {
2629
- targets.forEach(function (target) {
2630
- removeEvent(target, "mousedown", _this.onDragStart);
2631
- });
2632
- removeEvent(container, "mousemove", this.onDrag);
2633
- removeEvent(container, "mouseup", this.onDragEnd);
2634
- removeEvent(container, "contextmenu", this.onDragEnd);
2635
- }
2636
-
2637
- if (this.isTouch) {
2638
- targets.forEach(function (target) {
2639
- removeEvent(target, "touchstart", _this.onDragStart);
2640
- });
2641
- removeEvent(container, "touchstart", this.onDragStart);
2642
- removeEvent(container, "touchmove", this.onDrag);
2643
- removeEvent(container, "touchend", this.onDragEnd);
2644
- removeEvent(container, "touchcancel", this.onDragEnd);
2645
- }
2646
- };
2647
-
2648
- __proto.onPinchStart = function (e) {
2649
- var pinchThreshold = this.options.pinchThreshold;
2650
-
2651
- if (this.isDrag && this.getMovement() > pinchThreshold) {
2652
- return;
2653
- }
2654
-
2655
- var store = new ClientStore(getEventClients(e));
2656
- this.pinchFlag = true;
2657
- this.clientStores.splice(0, 0, store);
2658
- var result = this.emit("pinchStart", __assign({
2659
- datas: this.datas,
2660
- angle: store.getAngle(),
2661
- touches: this.getCurrentStore().getPositions()
2662
- }, store.getPosition(), {
2663
- inputEvent: e
2664
- }));
2665
-
2666
- if (result === false) {
2667
- this.pinchFlag = false;
2668
- }
2669
- };
2670
-
2671
- __proto.onPinch = function (e, clients) {
2672
- if (!this.flag || !this.pinchFlag || clients.length < 2) {
2673
- return;
2674
- }
2675
-
2676
- var store = this.getCurrentStore();
2677
- this.isPinch = true;
2678
- this.emit("pinch", __assign({
2679
- datas: this.datas,
2680
- movement: this.getMovement(clients),
2681
- angle: store.getAngle(clients),
2682
- rotation: store.getRotation(clients),
2683
- touches: store.getPositions(clients),
2684
- scale: store.getScale(clients),
2685
- distance: store.getDistance(clients)
2686
- }, store.getPosition(clients), {
2687
- inputEvent: e
2688
- }));
2689
- };
2690
-
2691
- __proto.onPinchEnd = function (e) {
2692
- if (!this.pinchFlag) {
2693
- return;
2694
- }
2695
-
2696
- var isPinch = this.isPinch;
2697
- this.isPinch = false;
2698
- this.pinchFlag = false;
2699
- var store = this.getCurrentStore();
2700
- this.emit("pinchEnd", __assign({
2701
- datas: this.datas,
2702
- isPinch: isPinch,
2703
- touches: store.getPositions()
2704
- }, store.getPosition(), {
2705
- inputEvent: e
2706
- }));
2707
- this.isPinch = false;
2708
- this.pinchFlag = false;
2709
- };
2710
-
2711
- __proto.initDrag = function () {
2712
- this.clientStores = [];
2713
- this.pinchFlag = false;
2714
- this.doubleFlag = false;
2715
- this.prevTime = 0;
2716
- this.flag = false;
2717
- };
2718
-
2719
- __proto.getCurrentStore = function () {
2720
- return this.clientStores[0];
2721
- };
2722
-
2723
- __proto.moveClients = function (clients, inputEvent, isAdd) {
2724
- var position = this._getPosition(clients, isAdd);
2725
-
2726
- if (position.deltaX || position.deltaY) {
2727
- this.isDrag = true;
2728
- }
2729
-
2730
- return __assign({
2731
- datas: this.datas
2732
- }, position, {
2733
- movement: this.getMovement(clients),
2734
- isDrag: this.isDrag,
2735
- isPinch: this.isPinch,
2736
- isScroll: false,
2737
- inputEvent: inputEvent
2738
- });
2739
- };
2740
-
2741
- __proto._getPosition = function (clients, isAdd) {
2742
- var store = this.getCurrentStore();
2743
- var position = store.getPosition(clients, isAdd);
2744
-
2745
- var _a = this.clientStores.slice(1).reduce(function (prev, cur) {
2746
- var storePosition = cur.getPosition();
2747
- prev.distX += storePosition.distX;
2748
- prev.distY += storePosition.distY;
2749
- return prev;
2750
- }, position),
2751
- distX = _a.distX,
2752
- distY = _a.distY;
2753
-
2754
- return __assign({}, position, {
2755
- distX: distX,
2756
- distY: distY
2757
- });
2758
- };
2759
-
2760
- return Gesto;
2761
- }(EventEmitter$1);
2762
-
2763
- var Gesto$1 = Gesto;
1582
+ });
1583
+ const _hoisted_1$a = { class: "m-editor-empty-panel" };
1584
+ const _hoisted_2$4 = { class: "m-editor-empty-content" };
1585
+ const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1586
+ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1587
+ const _component_plus = resolveComponent("plus");
1588
+ const _component_el_icon = resolveComponent("el-icon");
1589
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
1590
+ createElementVNode("div", _hoisted_2$4, [
1591
+ createElementVNode("div", {
1592
+ class: "m-editor-empty-button",
1593
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
1594
+ }, [
1595
+ createElementVNode("div", null, [
1596
+ createVNode(_component_el_icon, null, {
1597
+ default: withCtx(() => [
1598
+ createVNode(_component_plus)
1599
+ ]),
1600
+ _: 1
1601
+ })
1602
+ ]),
1603
+ _hoisted_3$2
1604
+ ])
1605
+ ])
1606
+ ]);
1607
+ }
1608
+ var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
2764
1609
 
2765
1610
  const _sfc_main$h = defineComponent({
2766
1611
  name: "m-editor-resize",
@@ -2776,7 +1621,7 @@ const _sfc_main$h = defineComponent({
2776
1621
  onMounted(() => {
2777
1622
  if (!target.value)
2778
1623
  return;
2779
- getso = new Gesto$1(target.value, {
1624
+ getso = new Gesto(target.value, {
2780
1625
  container: window,
2781
1626
  pinchOutside: true
2782
1627
  }).on("drag", (e) => {
@@ -2820,6 +1665,12 @@ const _sfc_main$g = defineComponent({
2820
1665
  AddPageBox,
2821
1666
  Resizer
2822
1667
  },
1668
+ props: {
1669
+ codeOptions: {
1670
+ type: Object,
1671
+ default: () => ({})
1672
+ }
1673
+ },
2823
1674
  setup() {
2824
1675
  const { editorService, uiService } = inject("services") || {};
2825
1676
  const root = computed(() => editorService?.get("root"));
@@ -2854,8 +1705,9 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2854
1705
  key: 0,
2855
1706
  class: "m-editor-content",
2856
1707
  "init-values": _ctx.root,
1708
+ options: _ctx.codeOptions,
2857
1709
  onSave: _ctx.saveCode
2858
- }, null, 8, ["init-values", "onSave"])) : (openBlock(), createElementBlock("div", _hoisted_2$3, [
1710
+ }, null, 8, ["init-values", "options", "onSave"])) : (openBlock(), createElementBlock("div", _hoisted_2$3, [
2859
1711
  createElementVNode("div", {
2860
1712
  class: "m-editor-framework-left",
2861
1713
  style: normalizeStyle(`width: ${_ctx.columnWidth?.left}px`)
@@ -3303,13 +2155,13 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3303
2155
  const _component_m_form = resolveComponent("m-form");
3304
2156
  return openBlock(), createBlock(_component_m_form, {
3305
2157
  class: normalizeClass(`m-editor-props-panel ${_ctx.propsPanelSize}`),
3306
- "popper-class": "m-editor-props-panel-popper",
2158
+ "popper-class": `m-editor-props-panel-popper ${_ctx.propsPanelSize}`,
3307
2159
  ref: "configForm",
3308
2160
  size: _ctx.propsPanelSize,
3309
2161
  "init-values": _ctx.values,
3310
2162
  config: _ctx.curFormConfig,
3311
2163
  onChange: _ctx.submit
3312
- }, null, 8, ["class", "size", "init-values", "config", "onChange"]);
2164
+ }, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"]);
3313
2165
  }
3314
2166
  var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
3315
2167
 
@@ -3427,9 +2279,14 @@ const _sfc_main$a = defineComponent({
3427
2279
  menuData: {
3428
2280
  type: Array,
3429
2281
  default: () => []
2282
+ },
2283
+ isSubMenu: {
2284
+ type: Boolean,
2285
+ default: false
3430
2286
  }
3431
2287
  },
3432
- setup() {
2288
+ emits: ["hide", "show"],
2289
+ setup(props, { emit }) {
3433
2290
  const menu = ref();
3434
2291
  const subMenu = ref();
3435
2292
  const visible = ref(false);
@@ -3439,15 +2296,31 @@ const _sfc_main$a = defineComponent({
3439
2296
  top: "0"
3440
2297
  });
3441
2298
  const hide = () => {
2299
+ if (!visible.value)
2300
+ return;
3442
2301
  visible.value = false;
2302
+ subMenu.value?.hide();
2303
+ emit("hide");
2304
+ };
2305
+ const hideHandler = (e) => {
2306
+ const target = e.target;
2307
+ if (!visible.value || !target) {
2308
+ return;
2309
+ }
2310
+ if (menu.value?.contains(target) || subMenu.value?.$el?.contains(target)) {
2311
+ return;
2312
+ }
2313
+ hide();
3443
2314
  };
3444
2315
  onMounted(() => {
3445
- globalThis.addEventListener("mousedown", (e) => {
3446
- if (!visible.value || e.target && menu.value?.contains(e.target)) {
3447
- return;
3448
- }
3449
- hide();
3450
- }, true);
2316
+ if (props.isSubMenu)
2317
+ return;
2318
+ globalThis.addEventListener("mousedown", hideHandler, true);
2319
+ });
2320
+ onUnmounted(() => {
2321
+ if (props.isSubMenu)
2322
+ return;
2323
+ globalThis.removeEventListener("mousedown", hideHandler, true);
3451
2324
  });
3452
2325
  return {
3453
2326
  menu,
@@ -3457,18 +2330,21 @@ const _sfc_main$a = defineComponent({
3457
2330
  subMenuData,
3458
2331
  hide,
3459
2332
  show(e) {
3460
- visible.value = true;
3461
- nextTick(() => {
3462
- const menuHeight = menu.value?.clientHeight || 0;
3463
- let top = e.clientY;
3464
- if (menuHeight + e.clientY > document.body.clientHeight) {
3465
- top = document.body.clientHeight - menuHeight;
3466
- }
3467
- menuStyle.value = {
3468
- top: `${top}px`,
3469
- left: `${e.clientX}px`
3470
- };
3471
- });
2333
+ setTimeout(() => {
2334
+ visible.value = true;
2335
+ nextTick(() => {
2336
+ const menuHeight = menu.value?.clientHeight || 0;
2337
+ let top = e.clientY;
2338
+ if (menuHeight + e.clientY > document.body.clientHeight) {
2339
+ top = document.body.clientHeight - menuHeight;
2340
+ }
2341
+ menuStyle.value = {
2342
+ top: `${top}px`,
2343
+ left: `${e.clientX}px`
2344
+ };
2345
+ emit("show");
2346
+ });
2347
+ }, 300);
3472
2348
  },
3473
2349
  showSubMenu(item) {
3474
2350
  const menuItem = item;
@@ -3489,7 +2365,7 @@ const _sfc_main$a = defineComponent({
3489
2365
  function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3490
2366
  const _component_tool_button = resolveComponent("tool-button");
3491
2367
  const _component_content_menu = resolveComponent("content-menu", true);
3492
- return _ctx.menuData.length ? withDirectives((openBlock(), createElementBlock("div", {
2368
+ return _ctx.menuData.length && _ctx.visible ? (openBlock(), createElementBlock("div", {
3493
2369
  key: 0,
3494
2370
  class: "magic-editor-content-menu",
3495
2371
  ref: "menu",
@@ -3510,12 +2386,12 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3510
2386
  createVNode(_component_content_menu, {
3511
2387
  class: "sub-menu",
3512
2388
  ref: "subMenu",
3513
- "menu-data": _ctx.subMenuData
3514
- }, null, 8, ["menu-data"])
2389
+ "menu-data": _ctx.subMenuData,
2390
+ "is-sub-menu": true,
2391
+ onHide: _ctx.hide
2392
+ }, null, 8, ["menu-data", "onHide"])
3515
2393
  ]))
3516
- ], 4)), [
3517
- [vShow, _ctx.visible]
3518
- ]) : createCommentVNode("", true);
2394
+ ], 4)) : createCommentVNode("", true);
3519
2395
  }
3520
2396
  var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
3521
2397
 
@@ -3528,6 +2404,7 @@ const _sfc_main$9 = defineComponent({
3528
2404
  const isRoot = computed(() => node.value?.type === NodeType.ROOT);
3529
2405
  const isPage = computed(() => node.value?.type === NodeType.PAGE);
3530
2406
  const componentList = computed(() => services?.componentListService.getList() || []);
2407
+ const layerContentMenu = inject("layerContentMenu", []);
3531
2408
  const createMenuItems = (group) => group.items.map((component) => ({
3532
2409
  text: component.text,
3533
2410
  type: "button",
@@ -3592,7 +2469,8 @@ const _sfc_main$9 = defineComponent({
3592
2469
  handler: () => {
3593
2470
  node.value && services?.editorService.remove(node.value);
3594
2471
  }
3595
- }
2472
+ },
2473
+ ...layerContentMenu
3596
2474
  ]),
3597
2475
  show(e) {
3598
2476
  menu.value?.show(e);
@@ -3815,7 +2693,7 @@ const _sfc_main$7 = defineComponent({
3815
2693
  components: { MIcon },
3816
2694
  props: {
3817
2695
  data: {
3818
- type: Object
2696
+ type: [Object, String]
3819
2697
  }
3820
2698
  },
3821
2699
  setup(props) {
@@ -4383,6 +3261,7 @@ const _sfc_main$3 = defineComponent({
4383
3261
  const node = computed(() => editorService?.get("node"));
4384
3262
  const parent = computed(() => editorService?.get("parent"));
4385
3263
  const isPage = computed(() => node.value?.type === NodeType.PAGE);
3264
+ const stageContentMenu = inject("stageContentMenu", []);
4386
3265
  onMounted(() => {
4387
3266
  const data = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
4388
3267
  canPaste.value = data !== "undefined" && !!data;
@@ -4418,8 +3297,17 @@ const _sfc_main$3 = defineComponent({
4418
3297
  text: "\u7C98\u8D34",
4419
3298
  display: () => canPaste.value,
4420
3299
  handler: () => {
4421
- const top = menu.value?.$el.offsetTop || 0;
4422
- const left = menu.value?.$el.offsetLeft || 0;
3300
+ const stage = editorService?.get("stage");
3301
+ const rect = menu.value?.$el.getBoundingClientRect();
3302
+ const parentRect = stage?.container?.getBoundingClientRect();
3303
+ let left = (rect?.left || 0) - (parentRect?.left || 0);
3304
+ let top = (rect?.top || 0) - (parentRect?.top || 0);
3305
+ if (node.value?.items && stage) {
3306
+ const parentEl = stage.renderer.contentWindow?.document.getElementById(`${node.value.id}`);
3307
+ const parentElRect = parentEl?.getBoundingClientRect();
3308
+ left = left - (parentElRect?.left || 0);
3309
+ top = top - (parentElRect?.top || 0);
3310
+ }
4423
3311
  editorService?.paste({ left, top });
4424
3312
  }
4425
3313
  },
@@ -4486,7 +3374,8 @@ const _sfc_main$3 = defineComponent({
4486
3374
  handler: () => {
4487
3375
  editorService?.get("stage").clearGuides();
4488
3376
  }
4489
- }
3377
+ },
3378
+ ...stageContentMenu
4490
3379
  ]),
4491
3380
  show(e) {
4492
3381
  menu.value?.show(e);
@@ -4509,24 +3398,9 @@ const _sfc_main$2 = defineComponent({
4509
3398
  ViewerMenu,
4510
3399
  ScrollViewer
4511
3400
  },
4512
- props: {
4513
- render: {
4514
- type: Function
4515
- },
4516
- runtimeUrl: String,
4517
- canSelect: {
4518
- type: Function,
4519
- default: (el) => Boolean(el.id)
4520
- },
4521
- moveableOptions: {
4522
- type: [Object, Function],
4523
- default: () => (core) => ({
4524
- container: core?.renderer?.contentWindow?.document.getElementById("app")
4525
- })
4526
- }
4527
- },
4528
- setup(props) {
3401
+ setup() {
4529
3402
  const services = inject("services");
3403
+ const stageOptions = inject("stageOptions");
4530
3404
  const stageWrap = ref();
4531
3405
  const stageContainer = ref();
4532
3406
  const menu = ref();
@@ -4543,21 +3417,23 @@ const _sfc_main$2 = defineComponent({
4543
3417
  return;
4544
3418
  if (!stageContainer.value)
4545
3419
  return;
4546
- if (!(props.runtimeUrl || props.render) || !root.value)
3420
+ if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value)
4547
3421
  return;
4548
3422
  stage = new StageCore({
4549
- render: props.render,
4550
- runtimeUrl: props.runtimeUrl,
3423
+ render: stageOptions.render,
3424
+ runtimeUrl: stageOptions.runtimeUrl,
4551
3425
  zoom: zoom.value,
3426
+ autoScrollIntoView: stageOptions.autoScrollIntoView,
4552
3427
  canSelect: (el, event, stop) => {
4553
- const elCanSelect = props.canSelect(el);
3428
+ const elCanSelect = stageOptions.canSelect(el);
4554
3429
  if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
4555
3430
  document.dispatchEvent(new CustomEvent("ui-select", { detail: el }));
4556
3431
  return stop();
4557
3432
  }
4558
3433
  return elCanSelect;
4559
3434
  },
4560
- moveableOptions: props.moveableOptions
3435
+ moveableOptions: stageOptions.moveableOptions,
3436
+ updateDragEl: stageOptions.updateDragEl
4561
3437
  });
4562
3438
  services?.editorService.set("stage", markRaw(stage));
4563
3439
  stage?.mount(stageContainer.value);
@@ -4580,7 +3456,7 @@ const _sfc_main$2 = defineComponent({
4580
3456
  return;
4581
3457
  stage?.on("runtime-ready", (rt) => {
4582
3458
  runtime = rt;
4583
- root.value && runtime?.updateRootConfig(cloneDeep(toRaw(root.value)));
3459
+ root.value && runtime?.updateRootConfig?.(cloneDeep(toRaw(root.value)));
4584
3460
  page.value?.id && runtime?.updatePageId?.(page.value.id);
4585
3461
  setTimeout(() => {
4586
3462
  node.value && stage?.select(toRaw(node.value.id));
@@ -4594,7 +3470,7 @@ const _sfc_main$2 = defineComponent({
4594
3470
  });
4595
3471
  watch(root, (root2) => {
4596
3472
  if (runtime && root2) {
4597
- runtime.updateRootConfig(cloneDeep(toRaw(root2)));
3473
+ runtime.updateRootConfig?.(cloneDeep(toRaw(root2)));
4598
3474
  }
4599
3475
  });
4600
3476
  const resizeObserver = new ResizeObserver((entries) => {
@@ -4638,6 +3514,7 @@ const _sfc_main$2 = defineComponent({
4638
3514
  const { scrollTop, scrollLeft } = stage.mask;
4639
3515
  if (layout === Layout.ABSOLUTE) {
4640
3516
  config.style = {
3517
+ ...config.style || {},
4641
3518
  position: "absolute",
4642
3519
  top: e.clientY - containerRect.top + scrollTop,
4643
3520
  left: e.clientX - containerRect.left + scrollLeft
@@ -4683,18 +3560,6 @@ const _sfc_main$1 = defineComponent({
4683
3560
  PageBar,
4684
3561
  MagicStage
4685
3562
  },
4686
- props: {
4687
- runtimeUrl: String,
4688
- render: {
4689
- type: Function
4690
- },
4691
- moveableOptions: {
4692
- type: [Object, Function]
4693
- },
4694
- canSelect: {
4695
- type: Function
4696
- }
4697
- },
4698
3563
  setup() {
4699
3564
  const services = inject("services");
4700
3565
  const workspace = ref();
@@ -4703,8 +3568,12 @@ const _sfc_main$1 = defineComponent({
4703
3568
  const mouseenterHandler = () => {
4704
3569
  workspace.value?.focus();
4705
3570
  };
3571
+ const mouseleaveHandler = () => {
3572
+ workspace.value?.blur();
3573
+ };
4706
3574
  onMounted(() => {
4707
3575
  workspace.value?.addEventListener("mouseenter", mouseenterHandler);
3576
+ workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
4708
3577
  keycon = new KeyController(workspace.value);
4709
3578
  const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
4710
3579
  const ctrl = isMac ? "meta" : "ctrl";
@@ -4713,6 +3582,11 @@ const _sfc_main$1 = defineComponent({
4713
3582
  if (!node.value || isPage(node.value))
4714
3583
  return;
4715
3584
  services?.editorService.remove(node.value);
3585
+ }).keyup("backspace", (e) => {
3586
+ e.inputEvent.preventDefault();
3587
+ if (!node.value || isPage(node.value))
3588
+ return;
3589
+ services?.editorService.remove(node.value);
4716
3590
  }).keydown([ctrl, "c"], (e) => {
4717
3591
  e.inputEvent.preventDefault();
4718
3592
  node.value && services?.editorService.copy(node.value);
@@ -4764,13 +3638,20 @@ const _sfc_main$1 = defineComponent({
4764
3638
  }).keydown([ctrl, "="], (e) => {
4765
3639
  e.inputEvent.preventDefault();
4766
3640
  services?.uiService.zoom(0.1);
3641
+ }).keydown([ctrl, "numpadplus"], (e) => {
3642
+ e.inputEvent.preventDefault();
3643
+ services?.uiService.zoom(0.1);
4767
3644
  }).keydown([ctrl, "-"], (e) => {
4768
3645
  e.inputEvent.preventDefault();
4769
3646
  services?.uiService.zoom(-0.1);
3647
+ }).keydown([ctrl, "numpad-"], (e) => {
3648
+ e.inputEvent.preventDefault();
3649
+ services?.uiService.zoom(-0.1);
4770
3650
  });
4771
3651
  });
4772
3652
  onUnmounted(() => {
4773
3653
  workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
3654
+ workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
4774
3655
  keycon.destroy();
4775
3656
  });
4776
3657
  return {
@@ -4789,12 +3670,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
4789
3670
  const _component_page_bar = resolveComponent("page-bar");
4790
3671
  return openBlock(), createElementBlock("div", _hoisted_1, [
4791
3672
  (openBlock(), createBlock(_component_magic_stage, {
4792
- key: _ctx.page?.id,
4793
- "runtime-url": _ctx.runtimeUrl,
4794
- render: _ctx.render,
4795
- "moveable-options": _ctx.moveableOptions,
4796
- "can-select": _ctx.canSelect
4797
- }, null, 8, ["runtime-url", "render", "moveable-options", "can-select"])),
3673
+ key: _ctx.page?.id
3674
+ })),
4798
3675
  renderSlot(_ctx.$slots, "workspace-content"),
4799
3676
  createVNode(_component_page_bar, null, {
4800
3677
  "page-bar-title": withCtx(({ page }) => [
@@ -4963,6 +3840,14 @@ const _sfc_main = defineComponent({
4963
3840
  sidebar: {
4964
3841
  type: Object
4965
3842
  },
3843
+ layerContentMenu: {
3844
+ type: Array,
3845
+ default: () => []
3846
+ },
3847
+ stageContentMenu: {
3848
+ type: Array,
3849
+ default: () => []
3850
+ },
4966
3851
  menu: {
4967
3852
  type: Object,
4968
3853
  default: () => ({ left: [], right: [] })
@@ -4971,6 +3856,7 @@ const _sfc_main = defineComponent({
4971
3856
  type: Function
4972
3857
  },
4973
3858
  runtimeUrl: String,
3859
+ autoScrollIntoView: Boolean,
4974
3860
  propsConfigs: {
4975
3861
  type: Object,
4976
3862
  default: () => ({})
@@ -4990,10 +3876,18 @@ const _sfc_main = defineComponent({
4990
3876
  type: [Number, String]
4991
3877
  },
4992
3878
  canSelect: {
4993
- type: Function
3879
+ type: Function,
3880
+ default: (el) => Boolean(el.id)
4994
3881
  },
4995
3882
  stageRect: {
4996
3883
  type: [String, Object]
3884
+ },
3885
+ codeOptions: {
3886
+ type: Object,
3887
+ default: () => ({})
3888
+ },
3889
+ updateDragEl: {
3890
+ type: Function
4997
3891
  }
4998
3892
  },
4999
3893
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -5043,6 +3937,16 @@ const _sfc_main = defineComponent({
5043
3937
  uiService
5044
3938
  };
5045
3939
  provide("services", services);
3940
+ provide("layerContentMenu", props.layerContentMenu);
3941
+ provide("stageContentMenu", props.stageContentMenu);
3942
+ provide("stageOptions", reactive({
3943
+ runtimeUrl: props.runtimeUrl,
3944
+ autoScrollIntoView: props.autoScrollIntoView,
3945
+ render: props.render,
3946
+ moveableOptions: props.moveableOptions,
3947
+ canSelect: props.canSelect,
3948
+ updateDragEl: props.updateDragEl
3949
+ }));
5046
3950
  return services;
5047
3951
  }
5048
3952
  });
@@ -5052,7 +3956,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
5052
3956
  const _component_workspace = resolveComponent("workspace");
5053
3957
  const _component_props_panel = resolveComponent("props-panel");
5054
3958
  const _component_framework = resolveComponent("framework");
5055
- return openBlock(), createBlock(_component_framework, null, {
3959
+ return openBlock(), createBlock(_component_framework, { "code-options": _ctx.codeOptions }, {
5056
3960
  nav: withCtx(() => [
5057
3961
  renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
5058
3962
  createVNode(_component_nav_menu, { data: _ctx.menu }, null, 8, ["data"])
@@ -5065,12 +3969,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
5065
3969
  ]),
5066
3970
  workspace: withCtx(() => [
5067
3971
  renderSlot(_ctx.$slots, "workspace", {}, () => [
5068
- createVNode(_component_workspace, {
5069
- "runtime-url": _ctx.runtimeUrl,
5070
- render: _ctx.render,
5071
- "moveable-options": _ctx.moveableOptions,
5072
- "can-select": _ctx.canSelect
5073
- }, {
3972
+ createVNode(_component_workspace, null, {
5074
3973
  "workspace-content": withCtx(() => [
5075
3974
  renderSlot(_ctx.$slots, "workspace-content", { editorService: _ctx.editorService })
5076
3975
  ]),
@@ -5081,7 +3980,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
5081
3980
  renderSlot(_ctx.$slots, "page-bar-popover", { page })
5082
3981
  ]),
5083
3982
  _: 3
5084
- }, 8, ["runtime-url", "render", "moveable-options", "can-select"])
3983
+ })
5085
3984
  ])
5086
3985
  ]),
5087
3986
  propsPanel: withCtx(() => [
@@ -5096,11 +3995,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
5096
3995
  renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
5097
3996
  ]),
5098
3997
  _: 3
5099
- });
3998
+ }, 8, ["code-options"]);
5100
3999
  }
5101
4000
  var Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
5102
4001
 
5103
- var index$1 = '';
4002
+ 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}")();
5104
4003
 
5105
4004
  const defaultInstallOpt = {};
5106
4005
  var index = {
@@ -5116,5 +4015,5 @@ var index = {
5116
4015
  }
5117
4016
  };
5118
4017
 
5119
- export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, ToolButton, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, generateId, generatePageName, generatePageNameByApp, getConfig, getDefaultPropsValue, getNodeIndex, getPageList, getPageNameList, historyService, info, initPosition, isFixed, log, propsService, setConfig, setLayout, setNewItemId, toRelative, uiService, warn };
4018
+ export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, ToolButton, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, generatePageName, generatePageNameByApp, getConfig, getDefaultPropsValue, getNodeIndex, getPageList, getPageNameList, historyService, info, initPosition, isFixed, log, propsService, setConfig, setLayout, toRelative, uiService, warn };
5120
4019
  //# sourceMappingURL=tmagic-editor.es.js.map