@punica/editor 1.0.2 → 1.0.4
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/dist/index.bundle.esm.js +2 -0
- package/dist/index.bundle.esm.js.map +1 -0
- package/dist/index.bundle.umd.js +2 -0
- package/dist/index.bundle.umd.js.map +1 -0
- package/package.json +20 -26
- package/types/index.d.ts +5 -8
- package/types/punica.module.activityBar.d.ts +21 -0
- package/types/punica.module.commands.d.ts +10 -7
- package/types/punica.module.extensions.d.ts +122 -4
- package/types/punica.module.history.d.ts +18 -0
- package/types/punica.module.keyboardShortcuts.d.ts +6 -1
- package/types/punica.module.statusbar.d.ts +6 -5
- package/types/punica.module.view.d.ts +1 -1
- package/types/punica.types.d.ts +11 -0
- package/dist/impl/commands.js +0 -72
- package/dist/impl/dragDrop.js +0 -119
- package/dist/impl/extensions.js +0 -45
- package/dist/impl/index.js +0 -7
- package/dist/impl/keyboardShortcuts.js +0 -67
- package/dist/impl/layout.js +0 -59
- package/dist/impl/statusbar.js +0 -75
- package/dist/impl/timeServer.js +0 -57
- package/dist/impl/view.js +0 -7
- package/dist/index.js +0 -13
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punica/editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Punica Editor",
|
|
5
5
|
"private": false,
|
|
6
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.bundle.esm.js",
|
|
8
|
+
"module": "dist/index.bundle.esm.js",
|
|
9
|
+
"browser": "dist/index.bundle.umd.js",
|
|
7
10
|
"types": "types/index.d.ts",
|
|
8
11
|
"publishConfig": {
|
|
9
12
|
"access": "public"
|
|
10
13
|
},
|
|
11
14
|
"scripts": {
|
|
12
|
-
"
|
|
13
|
-
"build": "tsc -p tsconfig.build.json",
|
|
15
|
+
"build": "rollup -c",
|
|
14
16
|
"lint": "eslint . --ext .js,.ts",
|
|
15
17
|
"lint:fix": "eslint . --ext .js,.ts --fix",
|
|
16
18
|
"format": "prettier --write \"./**/*.{ts,js,json,md}\"",
|
|
@@ -30,33 +32,25 @@
|
|
|
30
32
|
"README.md"
|
|
31
33
|
],
|
|
32
34
|
"dependencies": {
|
|
33
|
-
"@punica/common": "^1.0.2"
|
|
35
|
+
"@punica/common": "^1.0.2",
|
|
36
|
+
"classnames": "^2.3.2",
|
|
37
|
+
"yaml": "^2.4.5"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
+
"@eslint/config-array": "^0.17.0",
|
|
41
|
+
"@rollup/plugin-commonjs": "^28.0.9",
|
|
42
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
44
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
45
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
40
46
|
"@types/node": "^20.14.10",
|
|
41
|
-
"@typescript-eslint/eslint-plugin":"",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "",
|
|
42
48
|
"@typescript-eslint/parser": "^7.16.0",
|
|
43
|
-
"@eslint/config-array":"^0.17.0",
|
|
44
|
-
"raw-loader": "^4.0.2",
|
|
45
|
-
"babel-loader": "^9.1.3",
|
|
46
|
-
"copy-webpack-plugin": "^12.0.2",
|
|
47
|
-
"css-loader": "^7.1.2",
|
|
48
49
|
"eslint": "^8.56.0",
|
|
49
|
-
"husky": "^
|
|
50
|
-
"file-loader": "^6.2.0",
|
|
51
|
-
"html-webpack-plugin": "^5.6.0",
|
|
52
|
-
"portfinder-sync": "^0.0.2",
|
|
50
|
+
"husky": "^9.1.1",
|
|
53
51
|
"prettier": "^3.3.2",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"typescript": "^5.5.3"
|
|
57
|
-
"webpack": "^5.92.1",
|
|
58
|
-
"webpack-cli": "^5.1.4",
|
|
59
|
-
"webpack-dev-server": "^5.0.4",
|
|
60
|
-
"webpack-merge": "^6.0.1"
|
|
52
|
+
"rollup": "^4.53.2",
|
|
53
|
+
"tslib": "^2.8.1",
|
|
54
|
+
"typescript": "^5.5.3"
|
|
61
55
|
}
|
|
62
56
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/// <reference path="punica.module.activityBar.d.ts" />
|
|
1
2
|
/// <reference path="punica.module.commands.d.ts" />
|
|
3
|
+
/// <reference path="punica.module.history.d.ts" />
|
|
2
4
|
/// <reference path="punica.module.dragDrop.d.ts" />
|
|
3
5
|
/// <reference path="punica.module.extensions.d.ts" />
|
|
4
6
|
/// <reference path="punica.module.keyboardShortcuts.d.ts" />
|
|
@@ -6,6 +8,7 @@
|
|
|
6
8
|
/// <reference path="punica.module.statusbar.d.ts" />
|
|
7
9
|
/// <reference path="punica.module.timeServer.d.ts" />
|
|
8
10
|
/// <reference path="punica.module.view.d.ts" />
|
|
11
|
+
/// <reference path="punica.types.d.ts" />
|
|
9
12
|
|
|
10
13
|
declare module 'punica' {
|
|
11
14
|
export const version: string;
|
|
@@ -13,16 +16,10 @@ declare module 'punica' {
|
|
|
13
16
|
|
|
14
17
|
declare global {
|
|
15
18
|
interface Window {
|
|
16
|
-
punica:
|
|
19
|
+
punica: any;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
window.punica = punica;
|
|
23
|
-
|
|
24
|
-
export function initialize(): void {
|
|
25
|
-
console.log('Punica initialized');
|
|
26
|
-
}
|
|
23
|
+
export function initialize(): void;
|
|
27
24
|
|
|
28
25
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare module 'punica' {
|
|
2
|
+
export namespace ActivityBar {
|
|
3
|
+
type Alignment = 'primary' | 'secondary';
|
|
4
|
+
type ItemType = 'normal' | 'menu';
|
|
5
|
+
|
|
6
|
+
interface IItem {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
alignment: Alignment;
|
|
10
|
+
title: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface IActivityBarManager {
|
|
15
|
+
addItem(item: IItem): void;
|
|
16
|
+
removeItem(itemId: string): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const manager: IActivityBarManager;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
declare module 'punica' {
|
|
2
2
|
export namespace Commands {
|
|
3
|
+
interface IDisposable {
|
|
4
|
+
dispose(): void;
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
interface ICommand {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
title: string;
|
|
9
|
+
disposable?: Disposable;
|
|
10
|
+
execute(...args: any[]): void;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
interface ICommandManager {
|
|
10
|
-
registerCommand(command: ICommand): void;
|
|
11
|
-
executeCommand(
|
|
12
|
-
|
|
13
|
-
redo(): void;
|
|
14
|
+
registerCommand(commandName: string, command: ICommand): void;
|
|
15
|
+
executeCommand(commandName: string, ...args: any[]): void;
|
|
16
|
+
disposeCommand(commandName: string): void;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
const manager: ICommandManager;
|
|
@@ -1,14 +1,132 @@
|
|
|
1
1
|
declare module 'punica' {
|
|
2
2
|
export namespace Extensions {
|
|
3
|
-
interface
|
|
3
|
+
interface BaseView {
|
|
4
|
+
id: string;
|
|
4
5
|
name: string;
|
|
5
|
-
|
|
6
|
+
title?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
alignment?: 'primary' | 'secondary';
|
|
10
|
+
content?: HTMLElement;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Views {
|
|
14
|
+
primarySidebar?: BaseView;
|
|
15
|
+
secondarySidebar?: BaseView;
|
|
16
|
+
content?: BaseView;
|
|
17
|
+
activityBar?: Pick<BaseView, 'id' | 'name'> &
|
|
18
|
+
Required<Pick<BaseView, 'title' | 'icon' | 'alignment'>>;
|
|
19
|
+
statusBar?: Pick<BaseView, 'id' | 'name'> &
|
|
20
|
+
Required<Pick<BaseView, 'title' | 'label' | 'icon' | 'alignment'>>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface Command {
|
|
24
|
+
command: string;
|
|
25
|
+
title: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface Keybinding {
|
|
29
|
+
command: string;
|
|
30
|
+
key: string;
|
|
31
|
+
when: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface MenuItem {
|
|
35
|
+
command: string;
|
|
36
|
+
when: string;
|
|
37
|
+
group: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface Menu {
|
|
41
|
+
commandPalette: MenuItem;
|
|
42
|
+
context: MenuItem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface BooleanProperty {
|
|
46
|
+
type: 'boolean';
|
|
47
|
+
default: boolean;
|
|
48
|
+
description: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface StringProperty {
|
|
52
|
+
type: 'string';
|
|
53
|
+
default: string;
|
|
54
|
+
description: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface NumberProperty {
|
|
58
|
+
type: 'number';
|
|
59
|
+
default: number;
|
|
60
|
+
description: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface ArrayProperty {
|
|
64
|
+
type: 'array';
|
|
65
|
+
default: any[];
|
|
66
|
+
description: string;
|
|
67
|
+
items: any;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface ObjectProperty {
|
|
71
|
+
type: 'object';
|
|
72
|
+
default: { [key: string]: any };
|
|
73
|
+
description: string;
|
|
74
|
+
properties: { [key: string]: Property };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
type Property =
|
|
78
|
+
| BooleanProperty
|
|
79
|
+
| StringProperty
|
|
80
|
+
| NumberProperty
|
|
81
|
+
| ArrayProperty
|
|
82
|
+
| ObjectProperty;
|
|
83
|
+
|
|
84
|
+
interface Configuration {
|
|
85
|
+
title: string;
|
|
86
|
+
properties: {
|
|
87
|
+
[key: string]: Property;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface Integrations {
|
|
92
|
+
commands?: Command[];
|
|
93
|
+
keybindings?: Keybinding[];
|
|
94
|
+
menus?: Menu;
|
|
95
|
+
views?: Views;
|
|
96
|
+
configuration?: Configuration;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface Extension {
|
|
100
|
+
module: Extensions.IExtension;
|
|
101
|
+
moduleURL: string;
|
|
102
|
+
name: string;
|
|
103
|
+
displayName: string;
|
|
104
|
+
description: string;
|
|
105
|
+
version: string;
|
|
106
|
+
main: string;
|
|
107
|
+
activationEvents?: string[];
|
|
108
|
+
dependOns?: string[];
|
|
109
|
+
integrations: Integrations;
|
|
110
|
+
engines: {
|
|
111
|
+
punica: string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface ExtensionDecorator {
|
|
116
|
+
execute(): Promise<Extension>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface IExtensionContext {}
|
|
120
|
+
|
|
121
|
+
interface IExtension {
|
|
122
|
+
activate: (context: IExtensionContext) => Promise<void>;
|
|
6
123
|
deactivate: () => void;
|
|
7
124
|
}
|
|
8
125
|
|
|
9
126
|
interface IExtensionManager {
|
|
10
|
-
load(extensionPath:
|
|
11
|
-
|
|
127
|
+
load(extensionPath: string, ...args: string[]): Promise<void>;
|
|
128
|
+
activate(extensionName): Promise<void>;
|
|
129
|
+
getExtension(extensionName: string): Extension | undefined;
|
|
12
130
|
}
|
|
13
131
|
|
|
14
132
|
const manager: IExtensionManager;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module 'punica' {
|
|
2
|
+
export namespace History {
|
|
3
|
+
interface ICommand {
|
|
4
|
+
id: string;
|
|
5
|
+
execute(): void;
|
|
6
|
+
undo(): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface IHistoryManager {
|
|
10
|
+
registerCommand(command: ICommand): void;
|
|
11
|
+
executeCommand(commandId: string): void;
|
|
12
|
+
undo(): void;
|
|
13
|
+
redo(): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const manager: IHistoryManager;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
declare module 'punica' {
|
|
2
2
|
export namespace KeyboardShortcuts {
|
|
3
|
+
interface IDisposable {
|
|
4
|
+
dispose(): void;
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
interface IKey {
|
|
4
8
|
key: string;
|
|
5
9
|
ctrlKey?: boolean;
|
|
@@ -9,8 +13,9 @@ declare module 'punica' {
|
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
interface IShortcut {
|
|
16
|
+
command: string;
|
|
12
17
|
keys: IKey[];
|
|
13
|
-
|
|
18
|
+
disposable?: IDisposable;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
interface IShortcutManager {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
declare module 'punica' {
|
|
2
2
|
export namespace Statusbar {
|
|
3
|
-
type Alignment = '
|
|
3
|
+
type Alignment = 'primary' | 'secondary';
|
|
4
4
|
type ItemType = 'progress' | 'warning' | 'error' | 'normal';
|
|
5
5
|
|
|
6
6
|
interface IItem {
|
|
7
7
|
id: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
label: string;
|
|
9
|
+
alignment: Alignment;
|
|
10
|
+
title: string;
|
|
11
|
+
icon: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
interface IStatusbarManager {
|
|
14
|
-
addItem(
|
|
15
|
+
addItem(item: IItem): void;
|
|
15
16
|
removeItem(itemId: string): void;
|
|
16
17
|
}
|
|
17
18
|
|
package/dist/impl/commands.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _CommandManager_commandMap, _CommandManager_history, _CommandManager_undone;
|
|
13
|
-
class CommandManager {
|
|
14
|
-
constructor() {
|
|
15
|
-
_CommandManager_commandMap.set(this, new Map());
|
|
16
|
-
_CommandManager_history.set(this, []);
|
|
17
|
-
_CommandManager_undone.set(this, []);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param command
|
|
22
|
-
*/
|
|
23
|
-
registerCommand(command) {
|
|
24
|
-
__classPrivateFieldGet(this, _CommandManager_commandMap, "f").set(command.id, command);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param commandId
|
|
29
|
-
*/
|
|
30
|
-
executeCommand(commandId) {
|
|
31
|
-
const command = __classPrivateFieldGet(this, _CommandManager_commandMap, "f").get(commandId);
|
|
32
|
-
if (command) {
|
|
33
|
-
command.execute();
|
|
34
|
-
__classPrivateFieldGet(this, _CommandManager_history, "f").push(command);
|
|
35
|
-
__classPrivateFieldSet(this, _CommandManager_undone, [], "f");
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
console.error(`Command with ID ${commandId} not found.`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
undo() {
|
|
45
|
-
const command = __classPrivateFieldGet(this, _CommandManager_history, "f").pop();
|
|
46
|
-
if (command) {
|
|
47
|
-
command.undo();
|
|
48
|
-
__classPrivateFieldGet(this, _CommandManager_undone, "f").push(command);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
console.error('No command to undo.');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
redo() {
|
|
58
|
-
const command = __classPrivateFieldGet(this, _CommandManager_undone, "f").pop();
|
|
59
|
-
if (command) {
|
|
60
|
-
command.execute();
|
|
61
|
-
__classPrivateFieldGet(this, _CommandManager_history, "f").push(command);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
console.error('No command to redo.');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
_CommandManager_commandMap = new WeakMap(), _CommandManager_history = new WeakMap(), _CommandManager_undone = new WeakMap();
|
|
69
|
-
const commands = {
|
|
70
|
-
manager: new CommandManager()
|
|
71
|
-
};
|
|
72
|
-
export default commands;
|
package/dist/impl/dragDrop.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _ServiceDragDrop_element, _ServiceDragDrop_events, _ServiceDragDrop_position;
|
|
13
|
-
import { BaseListener } from '@punica/common';
|
|
14
|
-
const calculateMutation = (point1, point2) => {
|
|
15
|
-
if (!point1 || !point2) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
x: point2.x - point1.x,
|
|
20
|
-
y: point2.y - point1.y
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
const isTouchDevice = () => {
|
|
24
|
-
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
25
|
-
};
|
|
26
|
-
const eventType = () => {
|
|
27
|
-
const touch = isTouchDevice();
|
|
28
|
-
return {
|
|
29
|
-
dragStart: touch ? 'touchstart' : 'mousedown',
|
|
30
|
-
dragging: touch ? 'touchmove' : 'mousemove',
|
|
31
|
-
dragStop: touch ? 'touchend' : 'mouseup'
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
const setEventPosition = (event) => {
|
|
35
|
-
return {
|
|
36
|
-
offsetX: event.offsetX,
|
|
37
|
-
offsetY: event.offsetY,
|
|
38
|
-
pageX: event.pageX,
|
|
39
|
-
pageY: event.pageY,
|
|
40
|
-
clientX: event.clientX,
|
|
41
|
-
clientY: event.clientY
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const getTranslate = (transform) => {
|
|
45
|
-
const detail = transform.match(/([-+]?(?:\d*\.)?\d+)\D*, ([-+]?(?:\d*\.)?\d+)\D*\)/);
|
|
46
|
-
const x = detail[1];
|
|
47
|
-
const y = detail[2];
|
|
48
|
-
return { x: parseFloat(x), y: parseFloat(y) };
|
|
49
|
-
};
|
|
50
|
-
class ServiceDragDrop extends BaseListener {
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param element
|
|
54
|
-
*/
|
|
55
|
-
constructor(element) {
|
|
56
|
-
super();
|
|
57
|
-
_ServiceDragDrop_element.set(this, void 0);
|
|
58
|
-
_ServiceDragDrop_events.set(this, void 0);
|
|
59
|
-
_ServiceDragDrop_position.set(this, void 0);
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
* @param event
|
|
63
|
-
*/
|
|
64
|
-
this.handleDragStart = (event) => {
|
|
65
|
-
const eventPosition = setEventPosition(event);
|
|
66
|
-
__classPrivateFieldSet(this, _ServiceDragDrop_position, {
|
|
67
|
-
x: eventPosition.clientX,
|
|
68
|
-
y: eventPosition.clientY
|
|
69
|
-
}, "f");
|
|
70
|
-
__classPrivateFieldGet(this, _ServiceDragDrop_element, "f").addEventListener(__classPrivateFieldGet(this, _ServiceDragDrop_events, "f").dragging, this.handleDragging);
|
|
71
|
-
__classPrivateFieldGet(this, _ServiceDragDrop_element, "f").addEventListener(__classPrivateFieldGet(this, _ServiceDragDrop_events, "f").dragStop, this.handleDragStop);
|
|
72
|
-
this.trigger('dragStart', {
|
|
73
|
-
startPosition: __classPrivateFieldGet(this, _ServiceDragDrop_position, "f"),
|
|
74
|
-
position: eventPosition,
|
|
75
|
-
mutation: null
|
|
76
|
-
});
|
|
77
|
-
event.stopPropagation();
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* @param event
|
|
82
|
-
*/
|
|
83
|
-
this.handleDragging = (event) => {
|
|
84
|
-
const eventPosition = setEventPosition(event);
|
|
85
|
-
const mutation = calculateMutation(__classPrivateFieldGet(this, _ServiceDragDrop_position, "f"), {
|
|
86
|
-
x: eventPosition.clientX,
|
|
87
|
-
y: eventPosition.clientY
|
|
88
|
-
});
|
|
89
|
-
this.trigger('dragging', {
|
|
90
|
-
startPosition: __classPrivateFieldGet(this, _ServiceDragDrop_position, "f"),
|
|
91
|
-
position: eventPosition,
|
|
92
|
-
mutation
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
* @param event
|
|
98
|
-
*/
|
|
99
|
-
this.handleDragStop = (event) => {
|
|
100
|
-
const eventPosition = setEventPosition(event);
|
|
101
|
-
const mutation = calculateMutation(__classPrivateFieldGet(this, _ServiceDragDrop_position, "f"), {
|
|
102
|
-
x: eventPosition.clientX,
|
|
103
|
-
y: eventPosition.clientY
|
|
104
|
-
});
|
|
105
|
-
this.trigger('dragStop', {
|
|
106
|
-
startPosition: __classPrivateFieldGet(this, _ServiceDragDrop_position, "f"),
|
|
107
|
-
position: eventPosition,
|
|
108
|
-
mutation
|
|
109
|
-
});
|
|
110
|
-
__classPrivateFieldGet(this, _ServiceDragDrop_element, "f").removeEventListener(__classPrivateFieldGet(this, _ServiceDragDrop_events, "f").dragging, this.handleDragging);
|
|
111
|
-
__classPrivateFieldGet(this, _ServiceDragDrop_element, "f").removeEventListener(__classPrivateFieldGet(this, _ServiceDragDrop_events, "f").dragStop, this.handleDragStop);
|
|
112
|
-
};
|
|
113
|
-
__classPrivateFieldSet(this, _ServiceDragDrop_element, element, "f");
|
|
114
|
-
__classPrivateFieldSet(this, _ServiceDragDrop_events, eventType(), "f");
|
|
115
|
-
__classPrivateFieldGet(this, _ServiceDragDrop_element, "f").addEventListener(__classPrivateFieldGet(this, _ServiceDragDrop_events, "f").dragStart, this.handleDragStart);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
_ServiceDragDrop_element = new WeakMap(), _ServiceDragDrop_events = new WeakMap(), _ServiceDragDrop_position = new WeakMap();
|
|
119
|
-
export { ServiceDragDrop, calculateMutation, isTouchDevice, eventType, setEventPosition, getTranslate };
|
package/dist/impl/extensions.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _ExtensionManager_extensions;
|
|
13
|
-
class ExtensionManager {
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
constructor() {
|
|
18
|
-
_ExtensionManager_extensions.set(this, void 0);
|
|
19
|
-
__classPrivateFieldSet(this, _ExtensionManager_extensions, new Map(), "f");
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param extension
|
|
24
|
-
*/
|
|
25
|
-
load(extension) {
|
|
26
|
-
if (__classPrivateFieldGet(this, _ExtensionManager_extensions, "f").has(extension.name)) {
|
|
27
|
-
console.warn(`Extension '${extension.name}' is already loaded.`);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
__classPrivateFieldGet(this, _ExtensionManager_extensions, "f").set(extension.name, extension);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param extensionName
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
getExtension(extensionName) {
|
|
38
|
-
return __classPrivateFieldGet(this, _ExtensionManager_extensions, "f").get(extensionName);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
_ExtensionManager_extensions = new WeakMap();
|
|
42
|
-
const extension = {
|
|
43
|
-
manager: new ExtensionManager()
|
|
44
|
-
};
|
|
45
|
-
export default extension;
|
package/dist/impl/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as View } from './view';
|
|
2
|
-
export { default as Extensions } from './extensions';
|
|
3
|
-
export { default as Commands } from './commands';
|
|
4
|
-
export { default as Layout } from './layout';
|
|
5
|
-
export { default as KeyboardShortcuts } from './keyboardShortcuts';
|
|
6
|
-
export { default as TimeServer } from './timeServer';
|
|
7
|
-
export { default as Statusbar } from './statusbar';
|