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

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 (94) hide show
  1. package/dist/style.css +6 -3
  2. package/dist/tmagic-editor.es.js +292 -1394
  3. package/dist/tmagic-editor.es.js.map +1 -1
  4. package/dist/tmagic-editor.umd.js +292 -1396
  5. package/dist/tmagic-editor.umd.js.map +1 -1
  6. package/dist/types/src/Editor.vue.d.ts +49 -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/history.d.ts +1 -18
  14. package/dist/types/src/services/props.d.ts +8 -2
  15. package/dist/types/src/type.d.ts +9 -0
  16. package/dist/types/src/utils/editor.d.ts +0 -6
  17. package/dist/types/src/utils/props.d.ts +8 -1
  18. package/package.json +17 -18
  19. package/src/Editor.vue +44 -9
  20. package/src/components/ContentMenu.vue +59 -26
  21. package/src/layouts/CodeEditor.vue +1 -4
  22. package/src/layouts/Framework.vue +14 -1
  23. package/src/layouts/PropsPanel.vue +1 -1
  24. package/src/layouts/sidebar/LayerMenu.vue +3 -0
  25. package/src/layouts/sidebar/TabPane.vue +1 -1
  26. package/src/layouts/workspace/Stage.vue +12 -29
  27. package/src/layouts/workspace/ViewerMenu.vue +17 -2
  28. package/src/layouts/workspace/Workspace.vue +21 -26
  29. package/src/services/BaseService.ts +1 -1
  30. package/src/services/editor.ts +34 -5
  31. package/src/services/props.ts +64 -9
  32. package/src/theme/props-panel.scss +6 -4
  33. package/src/theme/workspace.scss +4 -0
  34. package/src/type.ts +10 -0
  35. package/src/utils/editor.ts +7 -52
  36. package/src/utils/polyfills.ts +5 -19
  37. package/src/utils/props.ts +30 -7
  38. package/LICENSE +0 -5432
  39. package/coverage/clover.xml +0 -1560
  40. package/coverage/coverage-final.json +0 -36
  41. package/coverage/lcov-report/base.css +0 -224
  42. package/coverage/lcov-report/block-navigation.js +0 -87
  43. package/coverage/lcov-report/favicon.png +0 -0
  44. package/coverage/lcov-report/index.html +0 -206
  45. package/coverage/lcov-report/prettify.css +0 -1
  46. package/coverage/lcov-report/prettify.js +0 -2
  47. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  48. package/coverage/lcov-report/sorter.js +0 -196
  49. package/coverage/lcov-report/src/Editor.vue.html +0 -787
  50. package/coverage/lcov-report/src/components/ContentMenu.vue.html +0 -406
  51. package/coverage/lcov-report/src/components/Icon.vue.html +0 -172
  52. package/coverage/lcov-report/src/components/ScrollViewer.vue.html +0 -283
  53. package/coverage/lcov-report/src/components/ToolButton.vue.html +0 -772
  54. package/coverage/lcov-report/src/components/index.html +0 -161
  55. package/coverage/lcov-report/src/index.html +0 -131
  56. package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +0 -214
  57. package/coverage/lcov-report/src/layouts/Framework.vue.html +0 -304
  58. package/coverage/lcov-report/src/layouts/NavMenu.vue.html +0 -208
  59. package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +0 -319
  60. package/coverage/lcov-report/src/layouts/Resizer.vue.html +0 -268
  61. package/coverage/lcov-report/src/layouts/index.html +0 -176
  62. package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +0 -358
  63. package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +0 -421
  64. package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +0 -775
  65. package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +0 -226
  66. package/coverage/lcov-report/src/layouts/sidebar/TabPane.vue.html +0 -289
  67. package/coverage/lcov-report/src/layouts/sidebar/index.html +0 -176
  68. package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +0 -718
  69. package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +0 -757
  70. package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +0 -532
  71. package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +0 -586
  72. package/coverage/lcov-report/src/layouts/workspace/index.html +0 -161
  73. package/coverage/lcov-report/src/services/BaseService.ts.html +0 -643
  74. package/coverage/lcov-report/src/services/componentList.ts.html +0 -229
  75. package/coverage/lcov-report/src/services/editor.ts.html +0 -2077
  76. package/coverage/lcov-report/src/services/events.ts.html +0 -331
  77. package/coverage/lcov-report/src/services/history.ts.html +0 -478
  78. package/coverage/lcov-report/src/services/index.html +0 -206
  79. package/coverage/lcov-report/src/services/props.ts.html +0 -415
  80. package/coverage/lcov-report/src/services/ui.ts.html +0 -580
  81. package/coverage/lcov-report/src/type.ts.html +0 -850
  82. package/coverage/lcov-report/src/utils/compose.ts.html +0 -184
  83. package/coverage/lcov-report/src/utils/config.ts.html +0 -172
  84. package/coverage/lcov-report/src/utils/editor.ts.html +0 -838
  85. package/coverage/lcov-report/src/utils/index.html +0 -221
  86. package/coverage/lcov-report/src/utils/index.ts.html +0 -151
  87. package/coverage/lcov-report/src/utils/logger.ts.html +0 -226
  88. package/coverage/lcov-report/src/utils/props.ts.html +0 -796
  89. package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +0 -733
  90. package/coverage/lcov-report/src/utils/undo-redo.ts.html +0 -313
  91. package/coverage/lcov.info +0 -3708
  92. package/dist/types/src/components/ToolButton.vue.d.ts +0 -46
  93. package/dist/types/src/fields/UISelect.vue.d.ts +0 -35
  94. 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;
@@ -962,6 +971,13 @@
962
971
  } else {
963
972
  historyService.empty();
964
973
  }
974
+ if (node?.id) {
975
+ this.get("stage")?.renderer.runtime?.getApp?.()?.emit("editor:select", {
976
+ node,
977
+ page,
978
+ parent
979
+ }, utils.getNodePath(node.id, this.get("root").items));
980
+ }
965
981
  this.emit("select", node);
966
982
  return node;
967
983
  }
@@ -1143,13 +1159,16 @@
1143
1159
  console.error(e);
1144
1160
  return;
1145
1161
  }
1146
- setNewItemId(config, this.get("root"));
1162
+ await propsService.setNewItemId(config, this.get("root"));
1147
1163
  if (config.style) {
1148
1164
  config.style = {
1149
1165
  ...config.style,
1150
1166
  ...position
1151
1167
  };
1152
1168
  }
1169
+ if (utils.isPage(config)) {
1170
+ config.name = generatePageNameByApp(this.get("root"));
1171
+ }
1153
1172
  return await this.add(config);
1154
1173
  }
1155
1174
  async alignCenter(config2) {
@@ -1159,7 +1178,17 @@
1159
1178
  if (layout === Layout.RELATIVE) {
1160
1179
  return;
1161
1180
  }
1162
- if (parent.style?.width && node.style?.width) {
1181
+ if (!node.style)
1182
+ return;
1183
+ const stage = this.get("stage");
1184
+ const doc = stage?.renderer.contentWindow?.document;
1185
+ if (doc) {
1186
+ const parentEl = doc.getElementById(`${parent.id}`);
1187
+ const el = doc.getElementById(`${node.id}`);
1188
+ if (parentEl && el) {
1189
+ node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
1190
+ }
1191
+ } else if (parent.style && utils.isNumber(parent.style?.width) && utils.isNumber(node.style?.width)) {
1163
1192
  node.style.left = (parent.style.width - node.style.width) / 2;
1164
1193
  }
1165
1194
  await this.update(node);
@@ -1173,9 +1202,9 @@
1173
1202
  const node = this.get("node");
1174
1203
  const brothers = parent?.items || [];
1175
1204
  const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
1176
- if (offset === LayerOffset.BOTTOM) {
1205
+ if (offset === LayerOffset.TOP) {
1177
1206
  brothers.splice(brothers.length - 1, 0, brothers.splice(index, 1)[0]);
1178
- } else if (offset === LayerOffset.TOP) {
1207
+ } else if (offset === LayerOffset.BOTTOM) {
1179
1208
  brothers.splice(0, 0, brothers.splice(index, 1)[0]);
1180
1209
  } else {
1181
1210
  brothers.splice(index + parseInt(`${offset}`, 10), 0, brothers.splice(index, 1)[0]);
@@ -1460,6 +1489,21 @@
1460
1489
  text: "\u7C97\u7EC6"
1461
1490
  }
1462
1491
  ]
1492
+ },
1493
+ {
1494
+ type: "fieldset",
1495
+ legend: "\u53D8\u5F62",
1496
+ name: "transform",
1497
+ items: [
1498
+ {
1499
+ name: "rotate",
1500
+ text: "\u65CB\u8F6C\u89D2\u5EA6"
1501
+ },
1502
+ {
1503
+ name: "scale",
1504
+ text: "\u7F29\u653E"
1505
+ }
1506
+ ]
1463
1507
  }
1464
1508
  ]
1465
1509
  }
@@ -1516,1269 +1560,66 @@
1516
1560
  }
1517
1561
  ]
1518
1562
  }
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);
2412
- }
2413
-
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);
2432
- }
2433
-
2434
- _this.clientStores = [];
2435
- };
1563
+ ]
1564
+ }
1565
+ ];
1566
+ const DEFAULT_CONFIG = fillConfig([]);
1567
+ const getDefaultPropsValue = (type, id) => ["page", "container"].includes(type) ? {
1568
+ type,
1569
+ id,
1570
+ style: {},
1571
+ name: type,
1572
+ items: []
1573
+ } : {
1574
+ type,
1575
+ id,
1576
+ style: {},
1577
+ name: type
1578
+ };
2436
1579
 
2437
- _this.onBlur = function () {
2438
- _this.onDragEnd();
1580
+ const _sfc_main$i = vue.defineComponent({
1581
+ components: { Plus: icons.Plus },
1582
+ setup() {
1583
+ const services = vue.inject("services");
1584
+ return {
1585
+ clickHandler() {
1586
+ const { editorService } = services || {};
1587
+ if (!editorService)
1588
+ return;
1589
+ editorService.add({
1590
+ type: schema.NodeType.PAGE,
1591
+ name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
1592
+ });
1593
+ }
2439
1594
  };
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
1595
  }
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;
1596
+ });
1597
+ const _hoisted_1$a = { class: "m-editor-empty-panel" };
1598
+ const _hoisted_2$4 = { class: "m-editor-empty-content" };
1599
+ const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
1600
+ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1601
+ const _component_plus = vue.resolveComponent("plus");
1602
+ const _component_el_icon = vue.resolveComponent("el-icon");
1603
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
1604
+ vue.createElementVNode("div", _hoisted_2$4, [
1605
+ vue.createElementVNode("div", {
1606
+ class: "m-editor-empty-button",
1607
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
1608
+ }, [
1609
+ vue.createElementVNode("div", null, [
1610
+ vue.createVNode(_component_el_icon, null, {
1611
+ default: vue.withCtx(() => [
1612
+ vue.createVNode(_component_plus)
1613
+ ]),
1614
+ _: 1
1615
+ })
1616
+ ]),
1617
+ _hoisted_3$2
1618
+ ])
1619
+ ])
1620
+ ]);
1621
+ }
1622
+ var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
2782
1623
 
2783
1624
  const _sfc_main$h = vue.defineComponent({
2784
1625
  name: "m-editor-resize",
@@ -2794,7 +1635,7 @@
2794
1635
  vue.onMounted(() => {
2795
1636
  if (!target.value)
2796
1637
  return;
2797
- getso = new Gesto$1(target.value, {
1638
+ getso = new Gesto__default["default"](target.value, {
2798
1639
  container: window,
2799
1640
  pinchOutside: true
2800
1641
  }).on("drag", (e) => {
@@ -2838,6 +1679,12 @@
2838
1679
  AddPageBox,
2839
1680
  Resizer
2840
1681
  },
1682
+ props: {
1683
+ codeOptions: {
1684
+ type: Object,
1685
+ default: () => ({})
1686
+ }
1687
+ },
2841
1688
  setup() {
2842
1689
  const { editorService, uiService } = vue.inject("services") || {};
2843
1690
  const root = vue.computed(() => editorService?.get("root"));
@@ -2872,8 +1719,9 @@
2872
1719
  key: 0,
2873
1720
  class: "m-editor-content",
2874
1721
  "init-values": _ctx.root,
1722
+ options: _ctx.codeOptions,
2875
1723
  onSave: _ctx.saveCode
2876
- }, null, 8, ["init-values", "onSave"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
1724
+ }, null, 8, ["init-values", "options", "onSave"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
2877
1725
  vue.createElementVNode("div", {
2878
1726
  class: "m-editor-framework-left",
2879
1727
  style: vue.normalizeStyle(`width: ${_ctx.columnWidth?.left}px`)
@@ -3321,13 +2169,13 @@
3321
2169
  const _component_m_form = vue.resolveComponent("m-form");
3322
2170
  return vue.openBlock(), vue.createBlock(_component_m_form, {
3323
2171
  class: vue.normalizeClass(`m-editor-props-panel ${_ctx.propsPanelSize}`),
3324
- "popper-class": "m-editor-props-panel-popper",
2172
+ "popper-class": `m-editor-props-panel-popper ${_ctx.propsPanelSize}`,
3325
2173
  ref: "configForm",
3326
2174
  size: _ctx.propsPanelSize,
3327
2175
  "init-values": _ctx.values,
3328
2176
  config: _ctx.curFormConfig,
3329
2177
  onChange: _ctx.submit
3330
- }, null, 8, ["class", "size", "init-values", "config", "onChange"]);
2178
+ }, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"]);
3331
2179
  }
3332
2180
  var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
3333
2181
 
@@ -3445,9 +2293,14 @@
3445
2293
  menuData: {
3446
2294
  type: Array,
3447
2295
  default: () => []
2296
+ },
2297
+ isSubMenu: {
2298
+ type: Boolean,
2299
+ default: false
3448
2300
  }
3449
2301
  },
3450
- setup() {
2302
+ emits: ["hide", "show"],
2303
+ setup(props, { emit }) {
3451
2304
  const menu = vue.ref();
3452
2305
  const subMenu = vue.ref();
3453
2306
  const visible = vue.ref(false);
@@ -3457,15 +2310,31 @@
3457
2310
  top: "0"
3458
2311
  });
3459
2312
  const hide = () => {
2313
+ if (!visible.value)
2314
+ return;
3460
2315
  visible.value = false;
2316
+ subMenu.value?.hide();
2317
+ emit("hide");
2318
+ };
2319
+ const hideHandler = (e) => {
2320
+ const target = e.target;
2321
+ if (!visible.value || !target) {
2322
+ return;
2323
+ }
2324
+ if (menu.value?.contains(target) || subMenu.value?.$el?.contains(target)) {
2325
+ return;
2326
+ }
2327
+ hide();
3461
2328
  };
3462
2329
  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);
2330
+ if (props.isSubMenu)
2331
+ return;
2332
+ globalThis.addEventListener("mousedown", hideHandler, true);
2333
+ });
2334
+ vue.onUnmounted(() => {
2335
+ if (props.isSubMenu)
2336
+ return;
2337
+ globalThis.removeEventListener("mousedown", hideHandler, true);
3469
2338
  });
3470
2339
  return {
3471
2340
  menu,
@@ -3475,18 +2344,21 @@
3475
2344
  subMenuData,
3476
2345
  hide,
3477
2346
  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
- });
2347
+ setTimeout(() => {
2348
+ visible.value = true;
2349
+ vue.nextTick(() => {
2350
+ const menuHeight = menu.value?.clientHeight || 0;
2351
+ let top = e.clientY;
2352
+ if (menuHeight + e.clientY > document.body.clientHeight) {
2353
+ top = document.body.clientHeight - menuHeight;
2354
+ }
2355
+ menuStyle.value = {
2356
+ top: `${top}px`,
2357
+ left: `${e.clientX}px`
2358
+ };
2359
+ emit("show");
2360
+ });
2361
+ }, 300);
3490
2362
  },
3491
2363
  showSubMenu(item) {
3492
2364
  const menuItem = item;
@@ -3507,7 +2379,7 @@
3507
2379
  function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
3508
2380
  const _component_tool_button = vue.resolveComponent("tool-button");
3509
2381
  const _component_content_menu = vue.resolveComponent("content-menu", true);
3510
- return _ctx.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
2382
+ return _ctx.menuData.length && _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
3511
2383
  key: 0,
3512
2384
  class: "magic-editor-content-menu",
3513
2385
  ref: "menu",
@@ -3528,12 +2400,12 @@
3528
2400
  vue.createVNode(_component_content_menu, {
3529
2401
  class: "sub-menu",
3530
2402
  ref: "subMenu",
3531
- "menu-data": _ctx.subMenuData
3532
- }, null, 8, ["menu-data"])
2403
+ "menu-data": _ctx.subMenuData,
2404
+ "is-sub-menu": true,
2405
+ onHide: _ctx.hide
2406
+ }, null, 8, ["menu-data", "onHide"])
3533
2407
  ]))
3534
- ], 4)), [
3535
- [vue.vShow, _ctx.visible]
3536
- ]) : vue.createCommentVNode("", true);
2408
+ ], 4)) : vue.createCommentVNode("", true);
3537
2409
  }
3538
2410
  var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
3539
2411
 
@@ -3546,6 +2418,7 @@
3546
2418
  const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
3547
2419
  const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
3548
2420
  const componentList = vue.computed(() => services?.componentListService.getList() || []);
2421
+ const layerContentMenu = vue.inject("layerContentMenu", []);
3549
2422
  const createMenuItems = (group) => group.items.map((component) => ({
3550
2423
  text: component.text,
3551
2424
  type: "button",
@@ -3610,7 +2483,8 @@
3610
2483
  handler: () => {
3611
2484
  node.value && services?.editorService.remove(node.value);
3612
2485
  }
3613
- }
2486
+ },
2487
+ ...layerContentMenu
3614
2488
  ]),
3615
2489
  show(e) {
3616
2490
  menu.value?.show(e);
@@ -3833,7 +2707,7 @@
3833
2707
  components: { MIcon },
3834
2708
  props: {
3835
2709
  data: {
3836
- type: Object
2710
+ type: [Object, String]
3837
2711
  }
3838
2712
  },
3839
2713
  setup(props) {
@@ -4401,6 +3275,7 @@
4401
3275
  const node = vue.computed(() => editorService?.get("node"));
4402
3276
  const parent = vue.computed(() => editorService?.get("parent"));
4403
3277
  const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
3278
+ const stageContentMenu = vue.inject("stageContentMenu", []);
4404
3279
  vue.onMounted(() => {
4405
3280
  const data = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
4406
3281
  canPaste.value = data !== "undefined" && !!data;
@@ -4436,8 +3311,17 @@
4436
3311
  text: "\u7C98\u8D34",
4437
3312
  display: () => canPaste.value,
4438
3313
  handler: () => {
4439
- const top = menu.value?.$el.offsetTop || 0;
4440
- const left = menu.value?.$el.offsetLeft || 0;
3314
+ const stage = editorService?.get("stage");
3315
+ const rect = menu.value?.$el.getBoundingClientRect();
3316
+ const parentRect = stage?.container?.getBoundingClientRect();
3317
+ let left = (rect?.left || 0) - (parentRect?.left || 0);
3318
+ let top = (rect?.top || 0) - (parentRect?.top || 0);
3319
+ if (node.value?.items && stage) {
3320
+ const parentEl = stage.renderer.contentWindow?.document.getElementById(`${node.value.id}`);
3321
+ const parentElRect = parentEl?.getBoundingClientRect();
3322
+ left = left - (parentElRect?.left || 0);
3323
+ top = top - (parentElRect?.top || 0);
3324
+ }
4441
3325
  editorService?.paste({ left, top });
4442
3326
  }
4443
3327
  },
@@ -4504,7 +3388,8 @@
4504
3388
  handler: () => {
4505
3389
  editorService?.get("stage").clearGuides();
4506
3390
  }
4507
- }
3391
+ },
3392
+ ...stageContentMenu
4508
3393
  ]),
4509
3394
  show(e) {
4510
3395
  menu.value?.show(e);
@@ -4527,24 +3412,9 @@
4527
3412
  ViewerMenu,
4528
3413
  ScrollViewer
4529
3414
  },
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) {
3415
+ setup() {
4547
3416
  const services = vue.inject("services");
3417
+ const stageOptions = vue.inject("stageOptions");
4548
3418
  const stageWrap = vue.ref();
4549
3419
  const stageContainer = vue.ref();
4550
3420
  const menu = vue.ref();
@@ -4561,21 +3431,23 @@
4561
3431
  return;
4562
3432
  if (!stageContainer.value)
4563
3433
  return;
4564
- if (!(props.runtimeUrl || props.render) || !root.value)
3434
+ if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value)
4565
3435
  return;
4566
3436
  stage = new StageCore__default["default"]({
4567
- render: props.render,
4568
- runtimeUrl: props.runtimeUrl,
3437
+ render: stageOptions.render,
3438
+ runtimeUrl: stageOptions.runtimeUrl,
4569
3439
  zoom: zoom.value,
3440
+ autoScrollIntoView: stageOptions.autoScrollIntoView,
4570
3441
  canSelect: (el, event, stop) => {
4571
- const elCanSelect = props.canSelect(el);
3442
+ const elCanSelect = stageOptions.canSelect(el);
4572
3443
  if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
4573
3444
  document.dispatchEvent(new CustomEvent("ui-select", { detail: el }));
4574
3445
  return stop();
4575
3446
  }
4576
3447
  return elCanSelect;
4577
3448
  },
4578
- moveableOptions: props.moveableOptions
3449
+ moveableOptions: stageOptions.moveableOptions,
3450
+ updateDragEl: stageOptions.updateDragEl
4579
3451
  });
4580
3452
  services?.editorService.set("stage", vue.markRaw(stage));
4581
3453
  stage?.mount(stageContainer.value);
@@ -4656,6 +3528,7 @@
4656
3528
  const { scrollTop, scrollLeft } = stage.mask;
4657
3529
  if (layout === Layout.ABSOLUTE) {
4658
3530
  config.style = {
3531
+ ...config.style || {},
4659
3532
  position: "absolute",
4660
3533
  top: e.clientY - containerRect.top + scrollTop,
4661
3534
  left: e.clientX - containerRect.left + scrollLeft
@@ -4701,18 +3574,6 @@
4701
3574
  PageBar,
4702
3575
  MagicStage
4703
3576
  },
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
3577
  setup() {
4717
3578
  const services = vue.inject("services");
4718
3579
  const workspace = vue.ref();
@@ -4721,8 +3582,12 @@
4721
3582
  const mouseenterHandler = () => {
4722
3583
  workspace.value?.focus();
4723
3584
  };
3585
+ const mouseleaveHandler = () => {
3586
+ workspace.value?.blur();
3587
+ };
4724
3588
  vue.onMounted(() => {
4725
3589
  workspace.value?.addEventListener("mouseenter", mouseenterHandler);
3590
+ workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
4726
3591
  keycon = new KeyController__default["default"](workspace.value);
4727
3592
  const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
4728
3593
  const ctrl = isMac ? "meta" : "ctrl";
@@ -4731,6 +3596,11 @@
4731
3596
  if (!node.value || utils.isPage(node.value))
4732
3597
  return;
4733
3598
  services?.editorService.remove(node.value);
3599
+ }).keyup("backspace", (e) => {
3600
+ e.inputEvent.preventDefault();
3601
+ if (!node.value || utils.isPage(node.value))
3602
+ return;
3603
+ services?.editorService.remove(node.value);
4734
3604
  }).keydown([ctrl, "c"], (e) => {
4735
3605
  e.inputEvent.preventDefault();
4736
3606
  node.value && services?.editorService.copy(node.value);
@@ -4782,13 +3652,20 @@
4782
3652
  }).keydown([ctrl, "="], (e) => {
4783
3653
  e.inputEvent.preventDefault();
4784
3654
  services?.uiService.zoom(0.1);
3655
+ }).keydown([ctrl, "numpadplus"], (e) => {
3656
+ e.inputEvent.preventDefault();
3657
+ services?.uiService.zoom(0.1);
4785
3658
  }).keydown([ctrl, "-"], (e) => {
4786
3659
  e.inputEvent.preventDefault();
4787
3660
  services?.uiService.zoom(-0.1);
3661
+ }).keydown([ctrl, "numpad-"], (e) => {
3662
+ e.inputEvent.preventDefault();
3663
+ services?.uiService.zoom(-0.1);
4788
3664
  });
4789
3665
  });
4790
3666
  vue.onUnmounted(() => {
4791
3667
  workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
3668
+ workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
4792
3669
  keycon.destroy();
4793
3670
  });
4794
3671
  return {
@@ -4807,12 +3684,8 @@
4807
3684
  const _component_page_bar = vue.resolveComponent("page-bar");
4808
3685
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
4809
3686
  (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"])),
3687
+ key: _ctx.page?.id
3688
+ })),
4816
3689
  vue.renderSlot(_ctx.$slots, "workspace-content"),
4817
3690
  vue.createVNode(_component_page_bar, null, {
4818
3691
  "page-bar-title": vue.withCtx(({ page }) => [
@@ -4981,6 +3854,14 @@
4981
3854
  sidebar: {
4982
3855
  type: Object
4983
3856
  },
3857
+ layerContentMenu: {
3858
+ type: Array,
3859
+ default: () => []
3860
+ },
3861
+ stageContentMenu: {
3862
+ type: Array,
3863
+ default: () => []
3864
+ },
4984
3865
  menu: {
4985
3866
  type: Object,
4986
3867
  default: () => ({ left: [], right: [] })
@@ -4989,6 +3870,7 @@
4989
3870
  type: Function
4990
3871
  },
4991
3872
  runtimeUrl: String,
3873
+ autoScrollIntoView: Boolean,
4992
3874
  propsConfigs: {
4993
3875
  type: Object,
4994
3876
  default: () => ({})
@@ -5002,16 +3884,27 @@
5002
3884
  default: () => ({})
5003
3885
  },
5004
3886
  moveableOptions: {
5005
- type: [Object, Function]
3887
+ type: [Object, Function],
3888
+ default: () => (core) => ({
3889
+ container: core?.renderer?.contentWindow?.document.getElementById("app")
3890
+ })
5006
3891
  },
5007
3892
  defaultSelected: {
5008
3893
  type: [Number, String]
5009
3894
  },
5010
3895
  canSelect: {
5011
- type: Function
3896
+ type: Function,
3897
+ default: (el) => Boolean(el.id)
5012
3898
  },
5013
3899
  stageRect: {
5014
3900
  type: [String, Object]
3901
+ },
3902
+ codeOptions: {
3903
+ type: Object,
3904
+ default: () => ({})
3905
+ },
3906
+ updateDragEl: {
3907
+ type: Function
5015
3908
  }
5016
3909
  },
5017
3910
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -5061,6 +3954,16 @@
5061
3954
  uiService
5062
3955
  };
5063
3956
  vue.provide("services", services);
3957
+ vue.provide("layerContentMenu", props.layerContentMenu);
3958
+ vue.provide("stageContentMenu", props.stageContentMenu);
3959
+ vue.provide("stageOptions", vue.reactive({
3960
+ runtimeUrl: props.runtimeUrl,
3961
+ autoScrollIntoView: props.autoScrollIntoView,
3962
+ render: props.render,
3963
+ moveableOptions: props.moveableOptions,
3964
+ canSelect: props.canSelect,
3965
+ updateDragEl: props.updateDragEl
3966
+ }));
5064
3967
  return services;
5065
3968
  }
5066
3969
  });
@@ -5070,7 +3973,7 @@
5070
3973
  const _component_workspace = vue.resolveComponent("workspace");
5071
3974
  const _component_props_panel = vue.resolveComponent("props-panel");
5072
3975
  const _component_framework = vue.resolveComponent("framework");
5073
- return vue.openBlock(), vue.createBlock(_component_framework, null, {
3976
+ return vue.openBlock(), vue.createBlock(_component_framework, { "code-options": _ctx.codeOptions }, {
5074
3977
  nav: vue.withCtx(() => [
5075
3978
  vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
5076
3979
  vue.createVNode(_component_nav_menu, { data: _ctx.menu }, null, 8, ["data"])
@@ -5083,12 +3986,7 @@
5083
3986
  ]),
5084
3987
  workspace: vue.withCtx(() => [
5085
3988
  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
- }, {
3989
+ vue.createVNode(_component_workspace, null, {
5092
3990
  "workspace-content": vue.withCtx(() => [
5093
3991
  vue.renderSlot(_ctx.$slots, "workspace-content", { editorService: _ctx.editorService })
5094
3992
  ]),
@@ -5099,7 +3997,7 @@
5099
3997
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
5100
3998
  ]),
5101
3999
  _: 3
5102
- }, 8, ["runtime-url", "render", "moveable-options", "can-select"])
4000
+ })
5103
4001
  ])
5104
4002
  ]),
5105
4003
  propsPanel: vue.withCtx(() => [
@@ -5114,11 +4012,11 @@
5114
4012
  vue.renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
5115
4013
  ]),
5116
4014
  _: 3
5117
- });
4015
+ }, 8, ["code-options"]);
5118
4016
  }
5119
4017
  var Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
5120
4018
 
5121
- var index$1 = '';
4019
+ 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}\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
4020
 
5123
4021
  const defaultInstallOpt = {};
5124
4022
  var index = {
@@ -5153,7 +4051,6 @@
5153
4051
  exports.error = error;
5154
4052
  exports.eventsService = eventsService;
5155
4053
  exports.fillConfig = fillConfig;
5156
- exports.generateId = generateId;
5157
4054
  exports.generatePageName = generatePageName;
5158
4055
  exports.generatePageNameByApp = generatePageNameByApp;
5159
4056
  exports.getConfig = getConfig;
@@ -5169,7 +4066,6 @@
5169
4066
  exports.propsService = propsService;
5170
4067
  exports.setConfig = setConfig;
5171
4068
  exports.setLayout = setLayout;
5172
- exports.setNewItemId = setNewItemId;
5173
4069
  exports.toRelative = toRelative;
5174
4070
  exports.uiService = uiService;
5175
4071
  exports.warn = warn;