@tmagic/editor 1.0.0-rc.1 → 1.0.0-rc.2
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.
- package/coverage/clover.xml +94 -98
- package/coverage/coverage-final.json +4 -4
- package/coverage/lcov-report/index.html +35 -35
- package/coverage/lcov-report/src/Editor.vue.html +24 -9
- package/coverage/lcov-report/src/components/ContentMenu.vue.html +1 -1
- package/coverage/lcov-report/src/components/Icon.vue.html +1 -1
- package/coverage/lcov-report/src/components/ScrollViewer.vue.html +1 -1
- package/coverage/lcov-report/src/components/ToolButton.vue.html +1 -1
- package/coverage/lcov-report/src/components/index.html +1 -1
- package/coverage/lcov-report/src/index.html +14 -14
- package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/Framework.vue.html +48 -9
- package/coverage/lcov-report/src/layouts/NavMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +2 -2
- package/coverage/lcov-report/src/layouts/Resizer.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/index.html +15 -15
- package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/TabPane.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/index.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +7 -4
- package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +68 -56
- package/coverage/lcov-report/src/layouts/workspace/index.html +21 -21
- package/coverage/lcov-report/src/services/BaseService.ts.html +1 -1
- package/coverage/lcov-report/src/services/componentList.ts.html +1 -1
- package/coverage/lcov-report/src/services/editor.ts.html +1 -1
- package/coverage/lcov-report/src/services/events.ts.html +1 -1
- package/coverage/lcov-report/src/services/history.ts.html +1 -1
- package/coverage/lcov-report/src/services/index.html +1 -1
- package/coverage/lcov-report/src/services/props.ts.html +1 -1
- package/coverage/lcov-report/src/services/ui.ts.html +1 -1
- package/coverage/lcov-report/src/type.ts.html +1 -1
- package/coverage/lcov-report/src/utils/compose.ts.html +1 -1
- package/coverage/lcov-report/src/utils/config.ts.html +1 -1
- package/coverage/lcov-report/src/utils/editor.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov-report/src/utils/index.ts.html +1 -1
- package/coverage/lcov-report/src/utils/logger.ts.html +1 -1
- package/coverage/lcov-report/src/utils/props.ts.html +1 -1
- package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +1 -1
- package/coverage/lcov-report/src/utils/undo-redo.ts.html +1 -1
- package/coverage/lcov.info +314 -275
- package/dist/style.css +3 -3
- package/dist/tmagic-editor.es.js +60 -1256
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +62 -1258
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/Editor.vue.d.ts +9 -0
- package/dist/types/src/layouts/Framework.vue.d.ts +15 -3
- package/package.json +16 -8
- package/src/Editor.vue +6 -1
- package/src/layouts/CodeEditor.vue +1 -4
- package/src/layouts/Framework.vue +14 -1
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/workspace/Stage.vue +1 -0
- package/src/layouts/workspace/Workspace.vue +37 -33
- package/src/theme/props-panel.scss +6 -4
- package/src/utils/polyfills.ts +5 -19
|
@@ -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
|
|
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;
|
|
@@ -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
|
});
|
|
@@ -1571,1215 +1572,6 @@
|
|
|
1571
1572
|
}
|
|
1572
1573
|
var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
|
|
1573
1574
|
|
|
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
|
-
};
|
|
2436
|
-
|
|
2437
|
-
_this.onBlur = function () {
|
|
2438
|
-
_this.onDragEnd();
|
|
2439
|
-
};
|
|
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
|
-
}
|
|
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;
|
|
2782
|
-
|
|
2783
1575
|
const _sfc_main$h = vue.defineComponent({
|
|
2784
1576
|
name: "m-editor-resize",
|
|
2785
1577
|
props: {
|
|
@@ -2794,7 +1586,7 @@
|
|
|
2794
1586
|
vue.onMounted(() => {
|
|
2795
1587
|
if (!target.value)
|
|
2796
1588
|
return;
|
|
2797
|
-
getso = new
|
|
1589
|
+
getso = new Gesto__default["default"](target.value, {
|
|
2798
1590
|
container: window,
|
|
2799
1591
|
pinchOutside: true
|
|
2800
1592
|
}).on("drag", (e) => {
|
|
@@ -2838,6 +1630,12 @@
|
|
|
2838
1630
|
AddPageBox,
|
|
2839
1631
|
Resizer
|
|
2840
1632
|
},
|
|
1633
|
+
props: {
|
|
1634
|
+
codeOptions: {
|
|
1635
|
+
type: Object,
|
|
1636
|
+
default: () => ({})
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
2841
1639
|
setup() {
|
|
2842
1640
|
const { editorService, uiService } = vue.inject("services") || {};
|
|
2843
1641
|
const root = vue.computed(() => editorService?.get("root"));
|
|
@@ -2872,8 +1670,9 @@
|
|
|
2872
1670
|
key: 0,
|
|
2873
1671
|
class: "m-editor-content",
|
|
2874
1672
|
"init-values": _ctx.root,
|
|
1673
|
+
options: _ctx.codeOptions,
|
|
2875
1674
|
onSave: _ctx.saveCode
|
|
2876
|
-
}, null, 8, ["init-values", "onSave"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
|
|
1675
|
+
}, null, 8, ["init-values", "options", "onSave"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
|
|
2877
1676
|
vue.createElementVNode("div", {
|
|
2878
1677
|
class: "m-editor-framework-left",
|
|
2879
1678
|
style: vue.normalizeStyle(`width: ${_ctx.columnWidth?.left}px`)
|
|
@@ -3321,13 +2120,13 @@
|
|
|
3321
2120
|
const _component_m_form = vue.resolveComponent("m-form");
|
|
3322
2121
|
return vue.openBlock(), vue.createBlock(_component_m_form, {
|
|
3323
2122
|
class: vue.normalizeClass(`m-editor-props-panel ${_ctx.propsPanelSize}`),
|
|
3324
|
-
"popper-class":
|
|
2123
|
+
"popper-class": `m-editor-props-panel-popper ${_ctx.propsPanelSize}`,
|
|
3325
2124
|
ref: "configForm",
|
|
3326
2125
|
size: _ctx.propsPanelSize,
|
|
3327
2126
|
"init-values": _ctx.values,
|
|
3328
2127
|
config: _ctx.curFormConfig,
|
|
3329
2128
|
onChange: _ctx.submit
|
|
3330
|
-
}, null, 8, ["class", "size", "init-values", "config", "onChange"]);
|
|
2129
|
+
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"]);
|
|
3331
2130
|
}
|
|
3332
2131
|
var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
|
|
3333
2132
|
|
|
@@ -4656,6 +3455,7 @@
|
|
|
4656
3455
|
const { scrollTop, scrollLeft } = stage.mask;
|
|
4657
3456
|
if (layout === Layout.ABSOLUTE) {
|
|
4658
3457
|
config.style = {
|
|
3458
|
+
...config.style || {},
|
|
4659
3459
|
position: "absolute",
|
|
4660
3460
|
top: e.clientY - containerRect.top + scrollTop,
|
|
4661
3461
|
left: e.clientX - containerRect.left + scrollLeft
|
|
@@ -4721,74 +3521,74 @@
|
|
|
4721
3521
|
const mouseenterHandler = () => {
|
|
4722
3522
|
workspace.value?.focus();
|
|
4723
3523
|
};
|
|
3524
|
+
const mouseleaveHandler = () => {
|
|
3525
|
+
workspace.value?.blur();
|
|
3526
|
+
};
|
|
4724
3527
|
vue.onMounted(() => {
|
|
4725
3528
|
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
3529
|
+
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
4726
3530
|
keycon = new KeyController__default["default"](workspace.value);
|
|
4727
3531
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4728
3532
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4729
|
-
keycon.
|
|
3533
|
+
keycon.keydown((e) => {
|
|
3534
|
+
console.log(e);
|
|
3535
|
+
e.inputEvent.preventDefault();
|
|
3536
|
+
}).keyup("delete", (e) => {
|
|
4730
3537
|
e.inputEvent.preventDefault();
|
|
4731
3538
|
if (!node.value || utils.isPage(node.value))
|
|
4732
3539
|
return;
|
|
4733
3540
|
services?.editorService.remove(node.value);
|
|
4734
|
-
}).
|
|
3541
|
+
}).keyup("backspace", (e) => {
|
|
4735
3542
|
e.inputEvent.preventDefault();
|
|
3543
|
+
if (!node.value || utils.isPage(node.value))
|
|
3544
|
+
return;
|
|
3545
|
+
services?.editorService.remove(node.value);
|
|
3546
|
+
}).keydown([ctrl, "c"], () => {
|
|
4736
3547
|
node.value && services?.editorService.copy(node.value);
|
|
4737
|
-
}).keydown([ctrl, "v"], (
|
|
4738
|
-
e.inputEvent.preventDefault();
|
|
3548
|
+
}).keydown([ctrl, "v"], () => {
|
|
4739
3549
|
node.value && services?.editorService.paste();
|
|
4740
|
-
}).keydown([ctrl, "x"], (
|
|
4741
|
-
e.inputEvent.preventDefault();
|
|
3550
|
+
}).keydown([ctrl, "x"], () => {
|
|
4742
3551
|
if (!node.value || utils.isPage(node.value))
|
|
4743
3552
|
return;
|
|
4744
3553
|
services?.editorService.copy(node.value);
|
|
4745
3554
|
services?.editorService.remove(node.value);
|
|
4746
|
-
}).keydown([ctrl, "z"], (
|
|
4747
|
-
e.inputEvent.preventDefault();
|
|
3555
|
+
}).keydown([ctrl, "z"], () => {
|
|
4748
3556
|
services?.editorService.undo();
|
|
4749
|
-
}).keydown([ctrl, "shift", "z"], (
|
|
4750
|
-
e.inputEvent.preventDefault();
|
|
3557
|
+
}).keydown([ctrl, "shift", "z"], () => {
|
|
4751
3558
|
services?.editorService.redo();
|
|
4752
|
-
}).keydown("up", (
|
|
4753
|
-
e.inputEvent.preventDefault();
|
|
3559
|
+
}).keydown("up", () => {
|
|
4754
3560
|
services?.editorService.move(0, -1);
|
|
4755
|
-
}).keydown("down", (
|
|
4756
|
-
e.inputEvent.preventDefault();
|
|
3561
|
+
}).keydown("down", () => {
|
|
4757
3562
|
services?.editorService.move(0, 1);
|
|
4758
|
-
}).keydown("left", (
|
|
4759
|
-
e.inputEvent.preventDefault();
|
|
3563
|
+
}).keydown("left", () => {
|
|
4760
3564
|
services?.editorService.move(-1, 0);
|
|
4761
|
-
}).keydown("right", (
|
|
4762
|
-
e.inputEvent.preventDefault();
|
|
3565
|
+
}).keydown("right", () => {
|
|
4763
3566
|
services?.editorService.move(1, 0);
|
|
4764
|
-
}).keydown([ctrl, "up"], (
|
|
4765
|
-
e.inputEvent.preventDefault();
|
|
3567
|
+
}).keydown([ctrl, "up"], () => {
|
|
4766
3568
|
services?.editorService.move(0, -10);
|
|
4767
|
-
}).keydown([ctrl, "down"], (
|
|
4768
|
-
e.inputEvent.preventDefault();
|
|
3569
|
+
}).keydown([ctrl, "down"], () => {
|
|
4769
3570
|
services?.editorService.move(0, 10);
|
|
4770
|
-
}).keydown([ctrl, "left"], (
|
|
4771
|
-
e.inputEvent.preventDefault();
|
|
3571
|
+
}).keydown([ctrl, "left"], () => {
|
|
4772
3572
|
services?.editorService.move(-10, 0);
|
|
4773
|
-
}).keydown([ctrl, "right"], (
|
|
4774
|
-
e.inputEvent.preventDefault();
|
|
3573
|
+
}).keydown([ctrl, "right"], () => {
|
|
4775
3574
|
services?.editorService.move(10, 0);
|
|
4776
|
-
}).keydown("tab", (
|
|
4777
|
-
e.inputEvent.preventDefault();
|
|
3575
|
+
}).keydown("tab", () => {
|
|
4778
3576
|
services?.editorService.selectNextNode();
|
|
4779
|
-
}).keydown([ctrl, "tab"], (
|
|
4780
|
-
e.inputEvent.preventDefault();
|
|
3577
|
+
}).keydown([ctrl, "tab"], () => {
|
|
4781
3578
|
services?.editorService.selectNextPage();
|
|
4782
|
-
}).keydown([ctrl, "="], (
|
|
4783
|
-
e.inputEvent.preventDefault();
|
|
3579
|
+
}).keydown([ctrl, "="], () => {
|
|
4784
3580
|
services?.uiService.zoom(0.1);
|
|
4785
|
-
}).keydown([ctrl, "
|
|
4786
|
-
|
|
3581
|
+
}).keydown([ctrl, "numpadplus"], () => {
|
|
3582
|
+
services?.uiService.zoom(0.1);
|
|
3583
|
+
}).keydown([ctrl, "-"], () => {
|
|
3584
|
+
services?.uiService.zoom(-0.1);
|
|
3585
|
+
}).keydown([ctrl, "numpad-"], () => {
|
|
4787
3586
|
services?.uiService.zoom(-0.1);
|
|
4788
3587
|
});
|
|
4789
3588
|
});
|
|
4790
3589
|
vue.onUnmounted(() => {
|
|
4791
3590
|
workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
3591
|
+
workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
4792
3592
|
keycon.destroy();
|
|
4793
3593
|
});
|
|
4794
3594
|
return {
|
|
@@ -5012,6 +3812,10 @@
|
|
|
5012
3812
|
},
|
|
5013
3813
|
stageRect: {
|
|
5014
3814
|
type: [String, Object]
|
|
3815
|
+
},
|
|
3816
|
+
codeOptions: {
|
|
3817
|
+
type: Object,
|
|
3818
|
+
default: () => ({})
|
|
5015
3819
|
}
|
|
5016
3820
|
},
|
|
5017
3821
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -5070,7 +3874,7 @@
|
|
|
5070
3874
|
const _component_workspace = vue.resolveComponent("workspace");
|
|
5071
3875
|
const _component_props_panel = vue.resolveComponent("props-panel");
|
|
5072
3876
|
const _component_framework = vue.resolveComponent("framework");
|
|
5073
|
-
return vue.openBlock(), vue.createBlock(_component_framework,
|
|
3877
|
+
return vue.openBlock(), vue.createBlock(_component_framework, { "code-options": _ctx.codeOptions }, {
|
|
5074
3878
|
nav: vue.withCtx(() => [
|
|
5075
3879
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
5076
3880
|
vue.createVNode(_component_nav_menu, { data: _ctx.menu }, null, 8, ["data"])
|
|
@@ -5114,7 +3918,7 @@
|
|
|
5114
3918
|
vue.renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
|
|
5115
3919
|
]),
|
|
5116
3920
|
_: 3
|
|
5117
|
-
});
|
|
3921
|
+
}, 8, ["code-options"]);
|
|
5118
3922
|
}
|
|
5119
3923
|
var Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
5120
3924
|
|