@punica/editor 1.0.2 → 1.0.3
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/impl/activityBar/index.js +75 -0
- package/dist/impl/commands/index.js +52 -0
- package/dist/impl/extensions/active/decorators/base.js +19 -0
- package/dist/impl/extensions/active/decorators/configuration/index.js +20 -0
- package/dist/impl/extensions/active/decorators/index.js +3 -0
- package/dist/impl/extensions/active/decorators/moduleLoader/index.js +29 -0
- package/dist/impl/extensions/active/decorators/views/index.js +34 -0
- package/dist/impl/extensions/active/getter/index.js +28 -0
- package/dist/impl/extensions/active/index.js +14 -0
- package/dist/impl/extensions/analysis/decorators/activationEvents/commands/base.js +2 -0
- package/dist/impl/extensions/analysis/decorators/activationEvents/commands/index.js +2 -0
- package/dist/impl/extensions/analysis/decorators/activationEvents/commands/onCommand.js +16 -0
- package/dist/impl/extensions/analysis/decorators/activationEvents/commands/onExtension.js +16 -0
- package/dist/impl/extensions/analysis/decorators/activationEvents/handler/index.js +32 -0
- package/dist/impl/extensions/analysis/decorators/activationEvents/index.js +29 -0
- package/dist/impl/extensions/analysis/decorators/base.js +19 -0
- package/dist/impl/extensions/analysis/decorators/commands/index.js +37 -0
- package/dist/impl/extensions/analysis/decorators/index.js +4 -0
- package/dist/impl/extensions/analysis/decorators/keybindings/index.js +65 -0
- package/dist/impl/extensions/analysis/decorators/menus/index.js +20 -0
- package/dist/impl/extensions/analysis/index.js +15 -0
- package/dist/impl/extensions/analysis/reader/index.js +31 -0
- package/dist/impl/extensions/index.js +76 -0
- package/dist/impl/history/index.js +57 -0
- package/dist/impl/index.js +6 -4
- package/dist/impl/keyboardShortcuts/index.js +67 -0
- package/dist/impl/layout/index.js +50 -0
- package/dist/impl/statusbar/index.js +81 -0
- package/dist/impl/timeServer/index.js +49 -0
- package/dist/index.js +8 -6
- package/package.json +8 -24
- package/types/index.d.ts +4 -13
- 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/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 → view/index.js} +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
class HistoryManager {
|
|
2
|
+
#commandMap = new Map();
|
|
3
|
+
#history = [];
|
|
4
|
+
#undone = [];
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param command
|
|
8
|
+
*/
|
|
9
|
+
registerCommand(command) {
|
|
10
|
+
this.#commandMap.set(command.id, command);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param commandId
|
|
15
|
+
*/
|
|
16
|
+
executeCommand(commandId) {
|
|
17
|
+
const command = this.#commandMap.get(commandId);
|
|
18
|
+
if (command) {
|
|
19
|
+
command.execute();
|
|
20
|
+
this.#history.push(command);
|
|
21
|
+
this.#undone = [];
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.error(`Command with ID ${commandId} not found.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
undo() {
|
|
31
|
+
const command = this.#history.pop();
|
|
32
|
+
if (command) {
|
|
33
|
+
command.undo();
|
|
34
|
+
this.#undone.push(command);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.error('No command to undo.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
redo() {
|
|
44
|
+
const command = this.#undone.pop();
|
|
45
|
+
if (command) {
|
|
46
|
+
command.execute();
|
|
47
|
+
this.#history.push(command);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.error('No command to redo.');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const history = {
|
|
55
|
+
manager: new HistoryManager()
|
|
56
|
+
};
|
|
57
|
+
export default history;
|
package/dist/impl/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as Extensions } from './extensions';
|
|
1
|
+
export { default as ActivityBar } from './activityBar';
|
|
3
2
|
export { default as Commands } from './commands';
|
|
4
|
-
export { default as
|
|
3
|
+
export { default as History } from './history';
|
|
4
|
+
export { default as Extensions } from './extensions';
|
|
5
5
|
export { default as KeyboardShortcuts } from './keyboardShortcuts';
|
|
6
|
-
export { default as
|
|
6
|
+
export { default as Layout } from './layout';
|
|
7
7
|
export { default as Statusbar } from './statusbar';
|
|
8
|
+
export { default as TimeServer } from './timeServer';
|
|
9
|
+
export { default as View } from './view';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
class KeyboardShortcutsManager {
|
|
2
|
+
#shortcuts = [];
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param keys1
|
|
6
|
+
* @param keys2
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
#areKeysEqual(keys1, keys2) {
|
|
10
|
+
if (keys1.length !== keys2.length)
|
|
11
|
+
return false;
|
|
12
|
+
return keys1.every((key1, index) => key1.key.toLowerCase() === keys2[index].key.toLowerCase() &&
|
|
13
|
+
key1.ctrlKey === keys2[index].ctrlKey &&
|
|
14
|
+
key1.shiftKey === keys2[index].shiftKey &&
|
|
15
|
+
key1.altKey === keys2[index].altKey &&
|
|
16
|
+
key1.metaKey === keys2[index].metaKey);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param event
|
|
21
|
+
* @param keys
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
#areKeysPressed(event, keys) {
|
|
25
|
+
return keys.every((key) => (key.ctrlKey ? event.ctrlKey : true) &&
|
|
26
|
+
(key.shiftKey ? event.shiftKey : true) &&
|
|
27
|
+
(key.altKey ? event.altKey : true) &&
|
|
28
|
+
(key.metaKey ? event.metaKey : true) &&
|
|
29
|
+
event.key.toLowerCase() === key.key.toLowerCase());
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
constructor() {
|
|
35
|
+
document.addEventListener('keydown', this.handleKeyEvent.bind(this));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param shortcut
|
|
40
|
+
*/
|
|
41
|
+
registerShortcut(shortcut) {
|
|
42
|
+
this.#shortcuts.push(shortcut);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param keys
|
|
47
|
+
*/
|
|
48
|
+
unregisterShortcut(keys) {
|
|
49
|
+
this.#shortcuts = this.#shortcuts.filter((shortcut) => this.#areKeysEqual(shortcut.keys, keys));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param event
|
|
54
|
+
*/
|
|
55
|
+
handleKeyEvent(event) {
|
|
56
|
+
const matchedShortcut = this.#shortcuts.find((shortcut) => this.#areKeysPressed(event, shortcut.keys));
|
|
57
|
+
if (matchedShortcut) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
const commandsManager = window.punica.Commands.manager;
|
|
60
|
+
commandsManager.executeCommand(matchedShortcut.command);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const keyboardShortcuts = {
|
|
65
|
+
manager: new KeyboardShortcutsManager()
|
|
66
|
+
};
|
|
67
|
+
export default keyboardShortcuts;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
class LayoutManager {
|
|
2
|
+
#item = new Map();
|
|
3
|
+
#layoutElement;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param type
|
|
7
|
+
*/
|
|
8
|
+
#addItem(type) {
|
|
9
|
+
const content = document.createElement('div');
|
|
10
|
+
content.id = type;
|
|
11
|
+
this.#layoutElement.appendChild(content);
|
|
12
|
+
this.#item.set(type, { type, content });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
constructor() {
|
|
18
|
+
this.#layoutElement = document.createElement('div');
|
|
19
|
+
this.#layoutElement.id = 'punica-editor';
|
|
20
|
+
this.#addItem('appBar');
|
|
21
|
+
this.#addItem('activityBar');
|
|
22
|
+
this.#addItem('content');
|
|
23
|
+
this.#addItem('statusbar');
|
|
24
|
+
this.#addItem('primarySidebar');
|
|
25
|
+
this.#addItem('secondarySidebar');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param type
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
getItem(type) {
|
|
33
|
+
const item = this.#item.get(type);
|
|
34
|
+
if (item === undefined) {
|
|
35
|
+
throw new Error(`Item of type '${type}' not found`);
|
|
36
|
+
}
|
|
37
|
+
return item;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param container
|
|
42
|
+
*/
|
|
43
|
+
render(container) {
|
|
44
|
+
container.appendChild(this.#layoutElement);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const layout = {
|
|
48
|
+
manager: new LayoutManager()
|
|
49
|
+
};
|
|
50
|
+
export default layout;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
class StatusbarManager {
|
|
2
|
+
#primaryItems = new Map();
|
|
3
|
+
#secondaryItems = new Map();
|
|
4
|
+
#content;
|
|
5
|
+
#primaryContent;
|
|
6
|
+
#secondaryContent;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
#initiliazeContent() {
|
|
11
|
+
const layoutManager = window.punica.Layout.manager;
|
|
12
|
+
const statusbarContent = layoutManager.getItem('statusbar').content;
|
|
13
|
+
this.#content = document.createElement('punica-row');
|
|
14
|
+
this.#primaryContent = document.createElement('punica-col');
|
|
15
|
+
this.#secondaryContent = document.createElement('punica-col');
|
|
16
|
+
this.#content.setAttribute('alignItems', 'center');
|
|
17
|
+
this.#content.setAttribute('justifyContent', 'space-between');
|
|
18
|
+
this.#content.appendChild(this.#primaryContent);
|
|
19
|
+
this.#content.appendChild(this.#secondaryContent);
|
|
20
|
+
statusbarContent?.appendChild(this.#content);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
constructor() { }
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param alignment
|
|
29
|
+
* @param item
|
|
30
|
+
*/
|
|
31
|
+
addItem(item) {
|
|
32
|
+
if (!this.#content) {
|
|
33
|
+
this.#initiliazeContent();
|
|
34
|
+
}
|
|
35
|
+
const button = document.createElement('punica-button');
|
|
36
|
+
button.setAttribute('id', item.id);
|
|
37
|
+
button.setAttribute('disabled', 'false');
|
|
38
|
+
button.setAttribute('size', 'dd');
|
|
39
|
+
button.setAttribute('title', item.title);
|
|
40
|
+
button.onclick = () => { };
|
|
41
|
+
button.className = 'status-bar-action';
|
|
42
|
+
if (item.icon) {
|
|
43
|
+
button.innerHTML = `<punica-icon size="xlarge">${item.icon}</punica-icon>`;
|
|
44
|
+
}
|
|
45
|
+
else if (item.label) {
|
|
46
|
+
button.innerHTML = item.label;
|
|
47
|
+
}
|
|
48
|
+
if (item.alignment === 'primary') {
|
|
49
|
+
this.#primaryItems.set(item.id, item);
|
|
50
|
+
this.#primaryContent.appendChild(button);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.#secondaryItems.set(item.id, item);
|
|
54
|
+
this.#secondaryContent.appendChild(button);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param itemId
|
|
60
|
+
*/
|
|
61
|
+
removeItem(itemId) {
|
|
62
|
+
if (this.#primaryItems.has(itemId)) {
|
|
63
|
+
const itemElement = this.#primaryContent.querySelector('#' + itemId);
|
|
64
|
+
if (itemElement) {
|
|
65
|
+
this.#primaryContent.removeChild(itemElement);
|
|
66
|
+
this.#primaryItems.delete(itemId);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (this.#secondaryItems.has(itemId)) {
|
|
70
|
+
const itemElement = this.#secondaryContent.querySelector('#' + itemId);
|
|
71
|
+
if (itemElement) {
|
|
72
|
+
this.#secondaryContent.removeChild(itemElement);
|
|
73
|
+
this.#secondaryItems.delete(itemId);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const statusbar = {
|
|
79
|
+
manager: new StatusbarManager()
|
|
80
|
+
};
|
|
81
|
+
export default statusbar;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
class TimeServerManager {
|
|
2
|
+
#subscribers = [];
|
|
3
|
+
#intervalId = null;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
#start() {
|
|
8
|
+
if (this.#intervalId === null) {
|
|
9
|
+
this.#intervalId = window.setInterval(() => {
|
|
10
|
+
const currentTime = new Date();
|
|
11
|
+
this.#subscribers.forEach((subscriber) => subscriber.update(currentTime));
|
|
12
|
+
}, 1000);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
#stop() {
|
|
19
|
+
if (this.#intervalId !== null) {
|
|
20
|
+
window.clearInterval(this.#intervalId);
|
|
21
|
+
this.#intervalId = null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param subscriber
|
|
27
|
+
*/
|
|
28
|
+
subscribe(subscriber) {
|
|
29
|
+
this.#subscribers.push(subscriber);
|
|
30
|
+
if (this.#subscribers.length == 1) {
|
|
31
|
+
this.#start();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param subscriber
|
|
37
|
+
*/
|
|
38
|
+
unsubscribe(subscriber) {
|
|
39
|
+
this.#subscribers = this.#subscribers.filter((sub) => sub !== subscriber);
|
|
40
|
+
if (this.#subscribers.length == 0) {
|
|
41
|
+
this.#stop();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const timeServerManager = {
|
|
46
|
+
manager: new TimeServerManager()
|
|
47
|
+
};
|
|
48
|
+
//timeServerManager.manager.start();
|
|
49
|
+
export default timeServerManager;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function
|
|
1
|
+
import { ActivityBar, Commands, History, Extensions, KeyboardShortcuts, Layout, Statusbar, TimeServer, View } from './impl';
|
|
2
|
+
export function initialize() {
|
|
3
3
|
window.punica = {
|
|
4
4
|
version: '1.0.0',
|
|
5
|
-
|
|
6
|
-
View,
|
|
7
|
-
Extensions,
|
|
5
|
+
ActivityBar,
|
|
8
6
|
Commands,
|
|
7
|
+
History,
|
|
8
|
+
Extensions,
|
|
9
9
|
KeyboardShortcuts,
|
|
10
|
+
Layout,
|
|
11
|
+
Statusbar,
|
|
10
12
|
TimeServer,
|
|
11
|
-
|
|
13
|
+
View
|
|
12
14
|
};
|
|
13
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punica/editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Punica Editor",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"start": "webpack-dev-server --config webpack.config.dev.js",
|
|
13
12
|
"build": "tsc -p tsconfig.build.json",
|
|
14
13
|
"lint": "eslint . --ext .js,.ts",
|
|
15
14
|
"lint:fix": "eslint . --ext .js,.ts --fix",
|
|
@@ -30,33 +29,18 @@
|
|
|
30
29
|
"README.md"
|
|
31
30
|
],
|
|
32
31
|
"dependencies": {
|
|
33
|
-
"@punica/common": "^1.0.2"
|
|
32
|
+
"@punica/common": "^1.0.2",
|
|
33
|
+
"yaml":"^2.4.5",
|
|
34
|
+
"classnames": "^2.3.2"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@babel/core": "^7.24.7",
|
|
37
|
-
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
38
|
-
"@babel/preset-env": "^7.24.7",
|
|
39
|
-
"@babel/preset-typescript": "^7.24.7",
|
|
40
37
|
"@types/node": "^20.14.10",
|
|
41
|
-
"@typescript-eslint/eslint-plugin":"",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "",
|
|
42
39
|
"@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",
|
|
40
|
+
"@eslint/config-array": "^0.17.0",
|
|
48
41
|
"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",
|
|
42
|
+
"husky": "^9.1.1",
|
|
53
43
|
"prettier": "^3.3.2",
|
|
54
|
-
"
|
|
55
|
-
"ts-loader": "^9.5.1",
|
|
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"
|
|
44
|
+
"typescript": "^5.5.3"
|
|
61
45
|
}
|
|
62
46
|
}
|
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,23 +8,12 @@
|
|
|
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;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
interface Window {
|
|
16
|
-
punica: typeof punica;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
import * as punica from 'punica';
|
|
21
|
-
|
|
22
|
-
window.punica = punica;
|
|
23
|
-
|
|
24
|
-
export function initialize(): void {
|
|
25
|
-
console.log('Punica initialized');
|
|
26
|
-
}
|
|
17
|
+
export function initialize(): void;
|
|
27
18
|
|
|
28
19
|
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
|
|