@opensumi/ide-electron-basic 2.12.1-next-079c1930
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/README.md +23 -0
- package/lib/browser/dialog/index.d.ts +8 -0
- package/lib/browser/dialog/index.d.ts.map +1 -0
- package/lib/browser/dialog/index.js +24 -0
- package/lib/browser/dialog/index.js.map +1 -0
- package/lib/browser/header.d.ts +8 -0
- package/lib/browser/header.d.ts.map +1 -0
- package/lib/browser/header.js +162 -0
- package/lib/browser/header.js.map +1 -0
- package/lib/browser/header.module.less +60 -0
- package/lib/browser/index.d.ts +24 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +312 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/welcome/common.d.ts +5 -0
- package/lib/browser/welcome/common.d.ts.map +1 -0
- package/lib/browser/welcome/common.js +3 -0
- package/lib/browser/welcome/common.js.map +1 -0
- package/lib/browser/welcome/contribution.d.ts +12 -0
- package/lib/browser/welcome/contribution.d.ts.map +1 -0
- package/lib/browser/welcome/contribution.js +66 -0
- package/lib/browser/welcome/contribution.js.map +1 -0
- package/lib/browser/welcome/welcome.d.ts +4 -0
- package/lib/browser/welcome/welcome.d.ts.map +1 -0
- package/lib/browser/welcome/welcome.js +32 -0
- package/lib/browser/welcome/welcome.js.map +1 -0
- package/lib/browser/welcome/welcome.module.less +9 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Electron Basic
|
|
2
|
+
|
|
3
|
+
## 添加 Menu Logo Icon 的方法
|
|
4
|
+
在 ComponentContribution 中添加对应的 containerId ,就会在 Menubar 中显示一个 logoIcon。
|
|
5
|
+
```typescript
|
|
6
|
+
registry.register('@opensumi/ide-menu-bar-logo', {
|
|
7
|
+
id: '@opensumi/ide-menu-bar-logo',
|
|
8
|
+
component: LogoIcon,
|
|
9
|
+
}, {
|
|
10
|
+
containerId: '@opensumi/ide-menu-bar-logo',
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
下面是 logoIcon 的实现, 一般 icon 的宽度是 35px
|
|
15
|
+
```typescript
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import cls from 'classnames';
|
|
18
|
+
import { getIcon } from '@opensumi/ide-core-browser';
|
|
19
|
+
import styles from './logo.module.less';
|
|
20
|
+
|
|
21
|
+
export const LogoIcon = () => <div className={cls(styles.logoIcon, getIcon('logo'))}></div>;
|
|
22
|
+
```
|
|
23
|
+
注意:目前的 font icon 不支持渐变等,所以可以单独使用 svg 创建组件。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IElectronNativeDialogService } from '@opensumi/ide-core-browser';
|
|
2
|
+
import { IElectronMainUIService } from '@opensumi/ide-core-common/lib/electron';
|
|
3
|
+
export declare class ElectronNativeDialogService implements IElectronNativeDialogService {
|
|
4
|
+
electronMainUIService: IElectronMainUIService;
|
|
5
|
+
showOpenDialog(options: Electron.OpenDialogOptions): Promise<string[] | undefined>;
|
|
6
|
+
showSaveDialog(options: Electron.SaveDialogOptions): Promise<string | undefined>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAe,MAAM,4BAA4B,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,qBACa,2BAA4B,YAAW,4BAA4B;IAG9E,qBAAqB,EAAE,sBAAsB,CAAC;IAExC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC;IAIxF,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAIjF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElectronNativeDialogService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
6
|
+
const di_1 = require("@opensumi/di");
|
|
7
|
+
const electron_1 = require("@opensumi/ide-core-common/lib/electron");
|
|
8
|
+
let ElectronNativeDialogService = class ElectronNativeDialogService {
|
|
9
|
+
async showOpenDialog(options) {
|
|
10
|
+
return this.electronMainUIService.showOpenDialog(ide_core_browser_1.electronEnv.currentWindowId, options);
|
|
11
|
+
}
|
|
12
|
+
showSaveDialog(options) {
|
|
13
|
+
return this.electronMainUIService.showSaveDialog(ide_core_browser_1.electronEnv.currentWindowId, options);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
(0, tslib_1.__decorate)([
|
|
17
|
+
(0, di_1.Autowired)(electron_1.IElectronMainUIService),
|
|
18
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
19
|
+
], ElectronNativeDialogService.prototype, "electronMainUIService", void 0);
|
|
20
|
+
ElectronNativeDialogService = (0, tslib_1.__decorate)([
|
|
21
|
+
(0, di_1.Injectable)()
|
|
22
|
+
], ElectronNativeDialogService);
|
|
23
|
+
exports.ElectronNativeDialogService = ElectronNativeDialogService;
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/dialog/index.ts"],"names":[],"mappings":";;;;AAAA,iEAAuF;AACvF,qCAAqD;AACrD,qEAAgF;AAGhF,IAAa,2BAA2B,GAAxC,MAAa,2BAA2B;IAKtC,KAAK,CAAC,cAAc,CAAC,OAAmC;QACtD,OAAO,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,8BAAW,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;IAED,cAAc,CAAC,OAAmC;QAChD,OAAO,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,8BAAW,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;CAEF,CAAA;AAVC;IADC,IAAA,cAAS,EAAC,iCAAsB,CAAC;;0EACY;AAHnC,2BAA2B;IADvC,IAAA,eAAU,GAAE;GACA,2BAA2B,CAavC;AAbY,kEAA2B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ElectronHeaderBar: React.FunctionComponent<{
|
|
3
|
+
Icon?: React.FunctionComponent<{}> | undefined;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const TitleInfo: React.FunctionComponent<{
|
|
6
|
+
hidden?: boolean | undefined;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/browser/header.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AA8D1B,eAAO,MAAM,iBAAiB;;EAoD5B,CAAC;AAIH,eAAO,MAAM,SAAS;;EAkEpB,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TitleInfo = exports.ElectronHeaderBar = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const mobx_react_lite_1 = require("mobx-react-lite");
|
|
6
|
+
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
7
|
+
const react_2 = require("react");
|
|
8
|
+
const classnames_1 = (0, tslib_1.__importDefault)(require("classnames"));
|
|
9
|
+
const header_module_less_1 = (0, tslib_1.__importDefault)(require("./header.module.less"));
|
|
10
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
11
|
+
const electron_1 = require("@opensumi/ide-core-common/lib/electron");
|
|
12
|
+
const ide_editor_1 = require("@opensumi/ide-editor");
|
|
13
|
+
const ide_core_browser_2 = require("@opensumi/ide-core-browser");
|
|
14
|
+
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
15
|
+
const paths_1 = require("@opensumi/ide-core-common/lib/utils/paths");
|
|
16
|
+
const useFullScreen = () => {
|
|
17
|
+
const uiService = (0, ide_core_browser_1.useInjectable)(electron_1.IElectronMainUIService);
|
|
18
|
+
const [isFullScreen, setFullScreen] = (0, react_2.useState)(false);
|
|
19
|
+
(0, react_2.useEffect)(() => {
|
|
20
|
+
uiService.isFullScreen(ide_core_browser_1.electronEnv.currentWindowId).then((fullScreen) => {
|
|
21
|
+
setFullScreen(fullScreen);
|
|
22
|
+
});
|
|
23
|
+
const listener = uiService.on('fullScreenStatusChange', (windowId, fullScreen) => {
|
|
24
|
+
if (windowId === ide_core_browser_1.electronEnv.currentWindowId) {
|
|
25
|
+
setFullScreen(fullScreen);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return () => {
|
|
29
|
+
listener.dispose();
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
return {
|
|
33
|
+
isFullScreen,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const useMaximize = () => {
|
|
37
|
+
const uiService = (0, ide_core_browser_1.useInjectable)(electron_1.IElectronMainUIService);
|
|
38
|
+
const [maximized, setMaximized] = (0, react_2.useState)(false);
|
|
39
|
+
const getMaximized = async () => uiService.isMaximized(ide_core_browser_1.electronEnv.currentWindowId);
|
|
40
|
+
(0, react_2.useEffect)(() => {
|
|
41
|
+
const maximizeListener = uiService.on('maximizeStatusChange', (windowId, isMaximized) => {
|
|
42
|
+
if (windowId === ide_core_browser_1.electronEnv.currentWindowId) {
|
|
43
|
+
setMaximized(isMaximized);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
getMaximized().then((maximized) => {
|
|
47
|
+
setMaximized(maximized);
|
|
48
|
+
});
|
|
49
|
+
return () => {
|
|
50
|
+
maximizeListener.dispose();
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
return {
|
|
54
|
+
maximized,
|
|
55
|
+
getMaximized,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
// Big Sur increases title bar height
|
|
59
|
+
const isNewMacHeaderBar = () => ide_core_browser_1.isOSX && (parseFloat(ide_core_browser_1.electronEnv.osRelease) >= 20);
|
|
60
|
+
exports.ElectronHeaderBar = (0, mobx_react_lite_1.observer)(({ Icon }) => {
|
|
61
|
+
const windowService = (0, ide_core_browser_1.useInjectable)(ide_core_browser_1.IWindowService);
|
|
62
|
+
const componentRegistry = (0, ide_core_browser_1.useInjectable)(ide_core_browser_1.ComponentRegistry);
|
|
63
|
+
const { isFullScreen } = useFullScreen();
|
|
64
|
+
const { maximized, getMaximized } = useMaximize();
|
|
65
|
+
const LeftComponent = () => {
|
|
66
|
+
if (ide_core_browser_1.isOSX) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const initialProps = {
|
|
70
|
+
className: 'menubarWrapper',
|
|
71
|
+
};
|
|
72
|
+
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
73
|
+
react_1.default.createElement(ide_core_browser_1.ComponentRenderer, { Component: componentRegistry.getComponentRegistryInfo('@opensumi/ide-menu-bar').views[0].component, initialProps: initialProps }));
|
|
74
|
+
};
|
|
75
|
+
const RightComponent = () => {
|
|
76
|
+
if (ide_core_browser_1.isOSX) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return react_1.default.createElement("div", { className: header_module_less_1.default.windowActions },
|
|
80
|
+
react_1.default.createElement("div", { className: (0, ide_core_browser_2.getIcon)('min'), onClick: () => windowService.minimize() }),
|
|
81
|
+
maximized ? react_1.default.createElement("div", { className: (0, ide_core_browser_2.getIcon)('max'), onClick: () => windowService.unmaximize() })
|
|
82
|
+
: react_1.default.createElement("div", { className: (0, ide_core_browser_2.getIcon)('unmax'), onClick: () => windowService.maximize() }),
|
|
83
|
+
react_1.default.createElement("div", { className: (0, ide_core_browser_2.getIcon)('close1'), onClick: () => windowService.close() }));
|
|
84
|
+
};
|
|
85
|
+
// 在 Mac 下,如果是全屏状态,隐藏顶部标题栏
|
|
86
|
+
if (ide_core_browser_1.isOSX && isFullScreen) {
|
|
87
|
+
return react_1.default.createElement("div", null,
|
|
88
|
+
react_1.default.createElement(exports.TitleInfo, { hidden: true }));
|
|
89
|
+
}
|
|
90
|
+
return react_1.default.createElement("div", { className: (0, classnames_1.default)(header_module_less_1.default.header, isNewMacHeaderBar() ? header_module_less_1.default.macNewHeader : null), onDoubleClick: async () => {
|
|
91
|
+
if (await getMaximized()) {
|
|
92
|
+
windowService.unmaximize();
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
windowService.maximize();
|
|
96
|
+
}
|
|
97
|
+
} },
|
|
98
|
+
react_1.default.createElement(LeftComponent, null),
|
|
99
|
+
react_1.default.createElement(exports.TitleInfo, null),
|
|
100
|
+
react_1.default.createElement(RightComponent, null));
|
|
101
|
+
});
|
|
102
|
+
exports.TitleInfo = (0, mobx_react_lite_1.observer)(({ hidden }) => {
|
|
103
|
+
const editorService = (0, ide_core_browser_1.useInjectable)(ide_editor_1.WorkbenchEditorService);
|
|
104
|
+
const [currentResource, setCurrentResource] = (0, react_2.useState)(editorService.currentResource);
|
|
105
|
+
const ref = (0, react_2.useRef)();
|
|
106
|
+
const spanRef = (0, react_2.useRef)();
|
|
107
|
+
const appConfig = (0, ide_core_browser_1.useInjectable)(ide_core_browser_1.AppConfig);
|
|
108
|
+
const [appTitle, setAppTile] = (0, react_2.useState)();
|
|
109
|
+
(0, react_2.useEffect)(() => {
|
|
110
|
+
setPosition();
|
|
111
|
+
const disposer = new ide_core_browser_1.Disposable();
|
|
112
|
+
disposer.addDispose(editorService.onActiveResourceChange((resource) => {
|
|
113
|
+
setCurrentResource(resource);
|
|
114
|
+
}));
|
|
115
|
+
disposer.addDispose(new ide_core_browser_1.DomListener(window, 'resize', () => {
|
|
116
|
+
setPosition();
|
|
117
|
+
}));
|
|
118
|
+
if (ref.current && ref.current.previousElementSibling) {
|
|
119
|
+
const resizeObserver = new ResizeObserver(setPosition);
|
|
120
|
+
resizeObserver.observe(ref.current.previousElementSibling);
|
|
121
|
+
disposer.addDispose({
|
|
122
|
+
dispose: () => {
|
|
123
|
+
resizeObserver.disconnect();
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return disposer.dispose.bind(disposer);
|
|
128
|
+
}, [currentResource]);
|
|
129
|
+
function setPosition() {
|
|
130
|
+
// 在下一个 animationFrame 执行,此时 spanRef.current!.offsetWidth 的宽度才是正确的
|
|
131
|
+
window.requestAnimationFrame(() => {
|
|
132
|
+
if (ref.current) {
|
|
133
|
+
const windowWidth = window.innerWidth;
|
|
134
|
+
let prevWidth = 0;
|
|
135
|
+
let node = ref.current.previousElementSibling;
|
|
136
|
+
while (node) {
|
|
137
|
+
prevWidth += node.offsetWidth;
|
|
138
|
+
node = node.previousElementSibling;
|
|
139
|
+
}
|
|
140
|
+
const left = Math.max(0, windowWidth * 0.5 - prevWidth - spanRef.current.offsetWidth * 0.5);
|
|
141
|
+
ref.current.style.paddingLeft = left + 'px';
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const dirname = appConfig.workspaceDir ? (0, paths_1.basename)(appConfig.workspaceDir) : undefined;
|
|
146
|
+
const title = (currentResource ? currentResource.name + ' — ' : '') + (dirname ? dirname + ' — ' : '') + ((0, ide_core_browser_1.replaceLocalizePlaceholder)(appConfig.appName) || 'Electron IDE');
|
|
147
|
+
// 同时更新 Html Title
|
|
148
|
+
(0, react_2.useEffect)(() => {
|
|
149
|
+
let documentTitle = title;
|
|
150
|
+
if (appConfig.extensionDevelopmentHost) {
|
|
151
|
+
documentTitle = `[${(0, ide_core_common_1.localize)('workspace.development.title')}] ${title}`;
|
|
152
|
+
}
|
|
153
|
+
document.title = documentTitle;
|
|
154
|
+
setAppTile(documentTitle);
|
|
155
|
+
}, [title]);
|
|
156
|
+
if (hidden) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return react_1.default.createElement("div", { className: header_module_less_1.default.title_info, ref: ref },
|
|
160
|
+
react_1.default.createElement("span", { ref: spanRef }, appTitle));
|
|
161
|
+
});
|
|
162
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/browser/header.tsx"],"names":[],"mappings":";;;;AAAA,qDAA2C;AAC3C,+DAA0B;AAC1B,iCAAoD;AACpD,yEAA6B;AAC7B,2FAA0C;AAC1C,iEAAgN;AAChN,qEAAgF;AAChF,qDAAyE;AACzE,iEAAqD;AACrD,+DAAqD;AACrD,qEAAqE;AAErE,MAAM,aAAa,GAAG,GAAG,EAAE;IACzB,MAAM,SAAS,GAA2B,IAAA,gCAAa,EAAC,iCAAsB,CAAC,CAAC;IAChF,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAE/D,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,SAAS,CAAC,YAAY,CAAC,8BAAW,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YACtE,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE;YAC/E,IAAI,QAAQ,KAAK,8BAAW,CAAC,eAAe,EAAE;gBAC5C,aAAa,CAAC,UAAU,CAAC,CAAC;aAC3B;QACH,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC,CAAC;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-height: 27px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.header {
|
|
9
|
+
height: var(--header-height);
|
|
10
|
+
background: var(--menu-background);
|
|
11
|
+
color: var(--titlebar-activeForeground);
|
|
12
|
+
display:flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
text-align: center;
|
|
15
|
+
line-height: var(--header-height);
|
|
16
|
+
font-size:12px;
|
|
17
|
+
user-select: none;
|
|
18
|
+
.title_info {
|
|
19
|
+
-webkit-app-region: drag;
|
|
20
|
+
flex-grow: 1;
|
|
21
|
+
text-align: left;
|
|
22
|
+
}
|
|
23
|
+
:global .menu-bar {
|
|
24
|
+
flex-shrink: 0
|
|
25
|
+
};
|
|
26
|
+
:global .menubarWrapper {
|
|
27
|
+
background-color: var(--menu-background);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.macNewHeader {
|
|
32
|
+
height: 28px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.windowActions {
|
|
36
|
+
display: flex;
|
|
37
|
+
height: var(--header-height);
|
|
38
|
+
-webkit-app-region: no-drag;
|
|
39
|
+
user-select: none;
|
|
40
|
+
> div {
|
|
41
|
+
font-size: 16px;
|
|
42
|
+
padding: 0 15px;
|
|
43
|
+
&:hover {
|
|
44
|
+
background-color: hsla(0,0%,100%,.1);
|
|
45
|
+
}
|
|
46
|
+
&:hover:last-child {
|
|
47
|
+
background-color: rgba(232, 17, 35, 0.9);
|
|
48
|
+
color: white;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:global(.vs) {
|
|
54
|
+
.windowActions {
|
|
55
|
+
> div:not(:last-child):hover {
|
|
56
|
+
background-color: rgba(0,0,0,.1);
|
|
57
|
+
color: #696767;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Provider, Injector } from '@opensumi/di';
|
|
2
|
+
import { BrowserModule, AppConfig, ClientAppContribution, CommandContribution, CommandRegistry, KeybindingContribution, KeybindingRegistry, ILogger, IEventBus } from '@opensumi/ide-core-browser';
|
|
3
|
+
import { ComponentContribution, ComponentRegistry } from '@opensumi/ide-core-browser/lib/layout';
|
|
4
|
+
import { IMenuRegistry, MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next';
|
|
5
|
+
export declare class ElectronBasicModule extends BrowserModule {
|
|
6
|
+
providers: Provider[];
|
|
7
|
+
}
|
|
8
|
+
export declare class ElectronBasicContribution implements KeybindingContribution, CommandContribution, ComponentContribution, ClientAppContribution, MenuContribution {
|
|
9
|
+
config: AppConfig;
|
|
10
|
+
injector: Injector;
|
|
11
|
+
eventBus: IEventBus;
|
|
12
|
+
private electronMenuBarService;
|
|
13
|
+
private electronMainMenuService;
|
|
14
|
+
private electronMainLifeCycleService;
|
|
15
|
+
private electronMainUIService;
|
|
16
|
+
private messageService;
|
|
17
|
+
logger: ILogger;
|
|
18
|
+
registerComponent(registry: ComponentRegistry): void;
|
|
19
|
+
registerMenus(menuRegistry: IMenuRegistry): void;
|
|
20
|
+
registerCommands(commands: CommandRegistry): void;
|
|
21
|
+
registerKeybindings(keybindings: KeybindingRegistry): void;
|
|
22
|
+
onStart(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyC,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,aAAa,EAAU,SAAS,EAAS,qBAAqB,EAAkF,mBAAmB,EAAE,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,EAA2D,OAAO,EAAkB,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC3W,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAIjG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAU,MAAM,0CAA0C,CAAC;AAOnG,qBACa,mBAAoB,SAAQ,aAAa;IACpD,SAAS,EAAE,QAAQ,EAAE,CAOnB;CACH;AAyCD,qBACa,yBAA0B,YAAW,sBAAsB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB;IAE3J,MAAM,EAAE,SAAS,CAAC;IAGlB,QAAQ,EAAE,QAAQ,CAAC;IAGnB,QAAQ,EAAE,SAAS,CAAC;IAGpB,OAAO,CAAC,sBAAsB,CAA0B;IAGxD,OAAO,CAAC,uBAAuB,CAA2B;IAG1D,OAAO,CAAC,4BAA4B,CAAgC;IAGpE,OAAO,CAAC,qBAAqB,CAAyB;IAGtD,OAAO,CAAC,cAAc,CAAkB;IAGxC,MAAM,EAAE,OAAO,CAAC;IAEhB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB;IAiB7C,aAAa,CAAC,YAAY,EAAE,aAAa;IAuCzC,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAkGjD,mBAAmB,CAAC,WAAW,EAAE,kBAAkB;IA4BnD,OAAO;CAmCR"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElectronBasicContribution = exports.ElectronBasicModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
7
|
+
const layout_1 = require("@opensumi/ide-core-browser/lib/layout");
|
|
8
|
+
const header_1 = require("./header");
|
|
9
|
+
const contribution_1 = require("./welcome/contribution");
|
|
10
|
+
const dialog_1 = require("./dialog");
|
|
11
|
+
const next_1 = require("@opensumi/ide-core-browser/lib/menu/next");
|
|
12
|
+
const electron_1 = require("@opensumi/ide-core-browser/lib/menu/next/renderer/ctxmenu/electron");
|
|
13
|
+
const electron_2 = require("@opensumi/ide-core-common/lib/electron");
|
|
14
|
+
const common_1 = require("@opensumi/ide-overlay/lib/common");
|
|
15
|
+
const browser_1 = require("@opensumi/ide-editor/lib/browser");
|
|
16
|
+
let ElectronBasicModule = class ElectronBasicModule extends ide_core_browser_1.BrowserModule {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.providers = [
|
|
20
|
+
{
|
|
21
|
+
token: ide_core_browser_1.IElectronNativeDialogService,
|
|
22
|
+
useClass: dialog_1.ElectronNativeDialogService,
|
|
23
|
+
},
|
|
24
|
+
ElectronBasicContribution,
|
|
25
|
+
contribution_1.WelcomeContribution,
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
ElectronBasicModule = (0, tslib_1.__decorate)([
|
|
30
|
+
(0, di_1.Injectable)()
|
|
31
|
+
], ElectronBasicModule);
|
|
32
|
+
exports.ElectronBasicModule = ElectronBasicModule;
|
|
33
|
+
const nativeRoles = [
|
|
34
|
+
{
|
|
35
|
+
name: 'undo',
|
|
36
|
+
key: 'ctrlcmd+z',
|
|
37
|
+
when: '!editorFocus',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'redo',
|
|
41
|
+
key: 'ctrlcmd+shift+z',
|
|
42
|
+
when: '!editorFocus',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'copy',
|
|
46
|
+
key: 'ctrlcmd+c',
|
|
47
|
+
when: '!editorFocus',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'paste',
|
|
51
|
+
key: 'ctrlcmd+v',
|
|
52
|
+
when: '!editorFocus',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'selectAll',
|
|
56
|
+
key: 'ctrlcmd+a',
|
|
57
|
+
when: '!editorFocus',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'cut',
|
|
61
|
+
key: 'ctrlcmd+x',
|
|
62
|
+
when: '!editorFocus',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'toggleDevTools',
|
|
66
|
+
key: 'alt+ctrlcmd+i',
|
|
67
|
+
label: '%window.toggleDevTools%',
|
|
68
|
+
alias: 'Toggle Developer Tools',
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
let ElectronBasicContribution = class ElectronBasicContribution {
|
|
72
|
+
registerComponent(registry) {
|
|
73
|
+
const top = this.config.layoutConfig[ide_core_browser_1.SlotLocation.top];
|
|
74
|
+
if (top && top.modules) {
|
|
75
|
+
const index = top.modules.indexOf('@opensumi/ide-menu-bar');
|
|
76
|
+
if (index !== -1) {
|
|
77
|
+
top.modules.splice(index, 1, 'electron-header');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
registry.register('electron-header', {
|
|
81
|
+
id: 'electron-header',
|
|
82
|
+
component: header_1.ElectronHeaderBar,
|
|
83
|
+
}, {
|
|
84
|
+
size: 27,
|
|
85
|
+
containerId: 'electron-header',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
registerMenus(menuRegistry) {
|
|
89
|
+
const menuId = next_1.MenuId.MenubarAppMenu;
|
|
90
|
+
menuRegistry.registerMenuItem(menuId, {
|
|
91
|
+
command: {
|
|
92
|
+
id: 'electron.about',
|
|
93
|
+
label: (0, ide_core_browser_1.localize)('about'),
|
|
94
|
+
},
|
|
95
|
+
group: '0_about',
|
|
96
|
+
nativeRole: 'about',
|
|
97
|
+
});
|
|
98
|
+
menuRegistry.registerMenuItem(next_1.MenuId.MenubarHelpMenu, {
|
|
99
|
+
command: {
|
|
100
|
+
id: 'electron.toggleDevTools',
|
|
101
|
+
label: (0, ide_core_browser_1.localize)('window.toggleDevTools'),
|
|
102
|
+
},
|
|
103
|
+
nativeRole: 'toggledevtools',
|
|
104
|
+
});
|
|
105
|
+
menuRegistry.registerMenuItem(next_1.MenuId.MenubarHelpMenu, {
|
|
106
|
+
command: {
|
|
107
|
+
id: 'electron.reload',
|
|
108
|
+
label: (0, ide_core_browser_1.localize)('window.reload'),
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
menuRegistry.registerMenuItem(next_1.MenuId.ExplorerContext, {
|
|
112
|
+
command: 'electron.revealInFinder',
|
|
113
|
+
group: '12_electron',
|
|
114
|
+
order: 3,
|
|
115
|
+
});
|
|
116
|
+
menuRegistry.registerMenuItem(next_1.MenuId.EditorTitleContext, {
|
|
117
|
+
command: 'electron.revealInFinderTab',
|
|
118
|
+
group: '2_open',
|
|
119
|
+
order: 3,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
registerCommands(commands) {
|
|
123
|
+
nativeRoles.forEach((role) => {
|
|
124
|
+
commands.registerCommand({
|
|
125
|
+
id: 'electron.' + role.name,
|
|
126
|
+
label: (0, ide_core_browser_1.replaceLocalizePlaceholder)(role.label),
|
|
127
|
+
alias: role.alias,
|
|
128
|
+
}, {
|
|
129
|
+
execute: () => {
|
|
130
|
+
this.electronMainMenuService.runNativeRoleAction(role.name);
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
commands.registerCommand({
|
|
135
|
+
id: 'electron.zoomIn',
|
|
136
|
+
label: (0, ide_core_browser_1.localize)('view.zoomIn'),
|
|
137
|
+
alias: 'View: Zoom In',
|
|
138
|
+
}, {
|
|
139
|
+
execute: () => {
|
|
140
|
+
this.electronMainUIService.setZoomFactor(ide_core_browser_1.electronEnv.currentWebContentsId, {
|
|
141
|
+
delta: 0.1,
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
commands.registerCommand({
|
|
146
|
+
id: 'electron.zoomOut',
|
|
147
|
+
label: (0, ide_core_browser_1.localize)('view.zoomOut'),
|
|
148
|
+
alias: 'View: Zoom Out',
|
|
149
|
+
}, {
|
|
150
|
+
execute: () => {
|
|
151
|
+
this.electronMainUIService.setZoomFactor(ide_core_browser_1.electronEnv.currentWebContentsId, {
|
|
152
|
+
delta: -0.1,
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
commands.registerCommand({
|
|
157
|
+
id: 'electron.zoomReset',
|
|
158
|
+
label: (0, ide_core_browser_1.localize)('view.zoomReset'),
|
|
159
|
+
alias: 'View: Zoom Reset',
|
|
160
|
+
}, {
|
|
161
|
+
execute: () => {
|
|
162
|
+
this.electronMainUIService.setZoomFactor(ide_core_browser_1.electronEnv.currentWebContentsId, {
|
|
163
|
+
value: 1,
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
commands.registerCommand({
|
|
168
|
+
id: 'electron.reload',
|
|
169
|
+
label: (0, ide_core_browser_1.localize)('window.reload'),
|
|
170
|
+
alias: 'Reload Window',
|
|
171
|
+
}, {
|
|
172
|
+
execute: () => {
|
|
173
|
+
this.electronMainLifeCycleService.reloadWindow(ide_core_browser_1.electronEnv.currentWindowId);
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
commands.registerCommand({
|
|
177
|
+
id: 'electron.revealInFinder',
|
|
178
|
+
label: (0, ide_core_browser_1.localize)('explorer.electron.revealInFinder'),
|
|
179
|
+
}, {
|
|
180
|
+
execute: (uri) => {
|
|
181
|
+
if (uri && uri.scheme === 'file') {
|
|
182
|
+
this.electronMainUIService.revealInFinder(uri.codeUri.fsPath);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
commands.registerCommand({
|
|
187
|
+
id: 'electron.revealInFinderTab',
|
|
188
|
+
label: (0, ide_core_browser_1.localize)('explorer.electron.revealInFinder'),
|
|
189
|
+
}, {
|
|
190
|
+
execute: ({ uri } = {}) => {
|
|
191
|
+
if (uri && uri.scheme === 'file') {
|
|
192
|
+
this.electronMainUIService.revealInFinder(uri.codeUri.fsPath);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
commands.registerCommand({
|
|
197
|
+
id: 'electron.openInSystemTerminal',
|
|
198
|
+
label: (0, ide_core_browser_1.localize)('explorer.electron.openInSystemTerminal'),
|
|
199
|
+
}, {
|
|
200
|
+
execute: (uri) => {
|
|
201
|
+
if (uri && uri.scheme === 'file') {
|
|
202
|
+
try {
|
|
203
|
+
this.electronMainUIService.revealInSystemTerminal(uri.codeUri.fsPath);
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
this.logger.error(e);
|
|
207
|
+
this.messageService.error((0, ide_core_browser_1.formatLocalize)('explorer.electron.openInSystemTerminal.error', uri.displayName, e.message));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
registerKeybindings(keybindings) {
|
|
214
|
+
nativeRoles.forEach((role) => {
|
|
215
|
+
if (role.key) {
|
|
216
|
+
keybindings.registerKeybinding({
|
|
217
|
+
command: 'electron.' + role.name,
|
|
218
|
+
keybinding: role.key,
|
|
219
|
+
when: role.when,
|
|
220
|
+
priority: Number.MIN_SAFE_INTEGER, // 永远在最后被命中
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
keybindings.registerKeybinding({
|
|
225
|
+
command: 'electron.reload',
|
|
226
|
+
keybinding: 'shift+ctrlcmd+r',
|
|
227
|
+
});
|
|
228
|
+
keybindings.registerKeybinding({
|
|
229
|
+
command: 'electron.zoomIn',
|
|
230
|
+
keybinding: ide_core_browser_1.isWindows ? 'alt+=' : 'ctrlcmd+=',
|
|
231
|
+
});
|
|
232
|
+
keybindings.registerKeybinding({
|
|
233
|
+
command: 'electron.zoomOut',
|
|
234
|
+
keybinding: ide_core_browser_1.isWindows ? 'alt+-' : 'ctrlcmd+-',
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
onStart() {
|
|
238
|
+
if (ide_core_browser_1.isOSX) {
|
|
239
|
+
this.electronMenuBarService.start();
|
|
240
|
+
}
|
|
241
|
+
// 注册drag drop file的行为
|
|
242
|
+
this.eventBus.on(browser_1.EditorGroupFileDropEvent, async (event) => {
|
|
243
|
+
const payload = event.payload;
|
|
244
|
+
// fileList 只能这样遍历
|
|
245
|
+
// tslint:disable-next-line: prefer-for-of
|
|
246
|
+
for (let i = 0; i < payload.files.length; i++) {
|
|
247
|
+
const file = payload.files[i];
|
|
248
|
+
let group = event.payload.group;
|
|
249
|
+
if (file.path) {
|
|
250
|
+
const fileURI = ide_core_browser_1.URI.file(file.path);
|
|
251
|
+
const options = {
|
|
252
|
+
index: event.payload.tabIndex !== -1 ? event.payload.tabIndex : undefined,
|
|
253
|
+
};
|
|
254
|
+
// 只有第一个才split
|
|
255
|
+
if (i === 0 && event.payload.position && event.payload.position !== browser_1.DragOverPosition.CENTER) {
|
|
256
|
+
options.split = (0, browser_1.getSplitActionFromDragDrop)(event.payload.position);
|
|
257
|
+
}
|
|
258
|
+
// 只有最后一个才可能为 preview
|
|
259
|
+
if (i < payload.files.length - 1) {
|
|
260
|
+
options.preview = false;
|
|
261
|
+
}
|
|
262
|
+
const res = await group.open(fileURI, options);
|
|
263
|
+
if (res) {
|
|
264
|
+
// split后当前group会变动
|
|
265
|
+
group = res.group;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
(0, tslib_1.__decorate)([
|
|
273
|
+
(0, di_1.Autowired)(ide_core_browser_1.AppConfig),
|
|
274
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
275
|
+
], ElectronBasicContribution.prototype, "config", void 0);
|
|
276
|
+
(0, tslib_1.__decorate)([
|
|
277
|
+
(0, di_1.Autowired)(di_1.INJECTOR_TOKEN),
|
|
278
|
+
(0, tslib_1.__metadata)("design:type", di_1.Injector)
|
|
279
|
+
], ElectronBasicContribution.prototype, "injector", void 0);
|
|
280
|
+
(0, tslib_1.__decorate)([
|
|
281
|
+
(0, di_1.Autowired)(ide_core_browser_1.IEventBus),
|
|
282
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
283
|
+
], ElectronBasicContribution.prototype, "eventBus", void 0);
|
|
284
|
+
(0, tslib_1.__decorate)([
|
|
285
|
+
(0, di_1.Autowired)(electron_1.IElectronMenuBarService),
|
|
286
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
287
|
+
], ElectronBasicContribution.prototype, "electronMenuBarService", void 0);
|
|
288
|
+
(0, tslib_1.__decorate)([
|
|
289
|
+
(0, di_1.Autowired)(ide_core_browser_1.IElectronMainMenuService),
|
|
290
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
291
|
+
], ElectronBasicContribution.prototype, "electronMainMenuService", void 0);
|
|
292
|
+
(0, tslib_1.__decorate)([
|
|
293
|
+
(0, di_1.Autowired)(electron_2.IElectronMainLifeCycleService),
|
|
294
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
295
|
+
], ElectronBasicContribution.prototype, "electronMainLifeCycleService", void 0);
|
|
296
|
+
(0, tslib_1.__decorate)([
|
|
297
|
+
(0, di_1.Autowired)(electron_2.IElectronMainUIService),
|
|
298
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
299
|
+
], ElectronBasicContribution.prototype, "electronMainUIService", void 0);
|
|
300
|
+
(0, tslib_1.__decorate)([
|
|
301
|
+
(0, di_1.Autowired)(common_1.IMessageService),
|
|
302
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
303
|
+
], ElectronBasicContribution.prototype, "messageService", void 0);
|
|
304
|
+
(0, tslib_1.__decorate)([
|
|
305
|
+
(0, di_1.Autowired)(ide_core_browser_1.ILogger),
|
|
306
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
307
|
+
], ElectronBasicContribution.prototype, "logger", void 0);
|
|
308
|
+
ElectronBasicContribution = (0, tslib_1.__decorate)([
|
|
309
|
+
(0, ide_core_browser_1.Domain)(layout_1.ComponentContribution, ide_core_browser_1.ClientAppContribution, next_1.MenuContribution, ide_core_browser_1.CommandContribution, ide_core_browser_1.KeybindingContribution)
|
|
310
|
+
], ElectronBasicContribution);
|
|
311
|
+
exports.ElectronBasicContribution = ElectronBasicContribution;
|
|
312
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";;;;AAAA,qCAAyF;AACzF,iEAA2W;AAC3W,kEAAiG;AACjG,qCAA6C;AAC7C,yDAA6D;AAC7D,qCAAuD;AACvD,mEAAmG;AACnG,iGAA6G;AAC7G,qEAA+G;AAC/G,6DAAmE;AACnE,8DAA0H;AAI1H,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,gCAAa;IAAtD;;QACE,cAAS,GAAe;YACtB;gBACE,KAAK,EAAE,+CAA4B;gBACnC,QAAQ,EAAE,oCAA2B;aACtC;YACD,yBAAyB;YACzB,kCAAmB;SACpB,CAAC;IACJ,CAAC;CAAA,CAAA;AATY,mBAAmB;IAD/B,IAAA,eAAU,GAAE;GACA,mBAAmB,CAS/B;AATY,kDAAmB;AAWhC,MAAM,WAAW,GAAG;IAClB;QACE,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,cAAc;KACrB;IACD;QACE,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,iBAAiB;QACtB,IAAI,EAAE,cAAc;KACrB;IACD;QACE,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,cAAc;KACrB;IACD;QACE,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,cAAc;KACrB;IACD;QACE,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,cAAc;KACrB;IACD;QACE,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,cAAc;KACrB;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,eAAe;Q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,CAAC;;yDACH;AA1BL,yBAAyB;IADrC,IAAA,yBAAM,EAAC,8BAAqB,EAAE,wCAAqB,EAAE,uBAAgB,EAAE,sCAAmB,EAAE,yCAAsB,CAAC;GACvG,yBAAyB,CAqPrC;AArPY,8DAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/browser/welcome/common.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/browser/welcome/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ClientAppContribution } from '@opensumi/ide-core-browser';
|
|
2
|
+
import { BrowserEditorContribution, EditorComponentRegistry } from '@opensumi/ide-editor/lib/browser';
|
|
3
|
+
import { ResourceService } from '@opensumi/ide-editor';
|
|
4
|
+
export declare class WelcomeContribution implements BrowserEditorContribution, ClientAppContribution {
|
|
5
|
+
private readonly workspaceService;
|
|
6
|
+
private readonly editorService;
|
|
7
|
+
private readonly recentFilesManager;
|
|
8
|
+
registerEditorComponent(registry: EditorComponentRegistry): void;
|
|
9
|
+
registerResource(service: ResourceService): void;
|
|
10
|
+
onDidStart(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../../src/browser/welcome/contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,qBAAqB,EAAsB,MAAM,4BAA4B,CAAC;AAC9G,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAA6B,MAAM,kCAAkC,CAAC;AACjI,OAAO,EAAE,eAAe,EAAqC,MAAM,sBAAsB,CAAC;AAM1F,qBACa,mBAAoB,YAAW,yBAAyB,EAAE,qBAAqB;IAG1F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;IAGrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;IAGvD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IAExD,uBAAuB,CAAC,QAAQ,EAAE,uBAAuB;IAezD,gBAAgB,CAAC,OAAO,EAAE,eAAe;IAmBzC,UAAU;CAMX"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WelcomeContribution = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
6
|
+
const browser_1 = require("@opensumi/ide-editor/lib/browser");
|
|
7
|
+
const ide_editor_1 = require("@opensumi/ide-editor");
|
|
8
|
+
const welcome_1 = require("./welcome");
|
|
9
|
+
const di_1 = require("@opensumi/di");
|
|
10
|
+
const ide_workspace_1 = require("@opensumi/ide-workspace");
|
|
11
|
+
let WelcomeContribution = class WelcomeContribution {
|
|
12
|
+
registerEditorComponent(registry) {
|
|
13
|
+
registry.registerEditorComponent({
|
|
14
|
+
uid: 'welcome',
|
|
15
|
+
scheme: 'welcome',
|
|
16
|
+
component: welcome_1.EditorWelcomeComponent,
|
|
17
|
+
renderMode: browser_1.EditorComponentRenderMode.ONE_PER_WORKBENCH,
|
|
18
|
+
});
|
|
19
|
+
registry.registerEditorComponentResolver('welcome', (resource, results) => {
|
|
20
|
+
results.push({
|
|
21
|
+
type: 'component',
|
|
22
|
+
componentId: 'welcome',
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
registerResource(service) {
|
|
27
|
+
service.registerResourceProvider({
|
|
28
|
+
scheme: 'welcome',
|
|
29
|
+
provideResource: async (uri) => {
|
|
30
|
+
return Promise.all([this.workspaceService.getMostRecentlyUsedWorkspaces(), this.recentFilesManager.getMostRecentlyOpenedFiles()]).then(([workspaces, files]) => {
|
|
31
|
+
return {
|
|
32
|
+
uri,
|
|
33
|
+
name: (0, ide_core_browser_1.localize)('welcome.title'),
|
|
34
|
+
icon: '',
|
|
35
|
+
metadata: {
|
|
36
|
+
recentWorkspaces: workspaces || [],
|
|
37
|
+
recentFiles: files || [],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
onDidStart() {
|
|
45
|
+
if (!this.workspaceService.workspace) {
|
|
46
|
+
this.editorService.open(new ide_core_browser_1.URI('welcome://'));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
(0, tslib_1.__decorate)([
|
|
51
|
+
(0, di_1.Autowired)(ide_workspace_1.IWorkspaceService),
|
|
52
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
53
|
+
], WelcomeContribution.prototype, "workspaceService", void 0);
|
|
54
|
+
(0, tslib_1.__decorate)([
|
|
55
|
+
(0, di_1.Autowired)(ide_editor_1.WorkbenchEditorService),
|
|
56
|
+
(0, tslib_1.__metadata)("design:type", ide_editor_1.WorkbenchEditorService)
|
|
57
|
+
], WelcomeContribution.prototype, "editorService", void 0);
|
|
58
|
+
(0, tslib_1.__decorate)([
|
|
59
|
+
(0, di_1.Autowired)(ide_core_browser_1.RecentFilesManager),
|
|
60
|
+
(0, tslib_1.__metadata)("design:type", ide_core_browser_1.RecentFilesManager)
|
|
61
|
+
], WelcomeContribution.prototype, "recentFilesManager", void 0);
|
|
62
|
+
WelcomeContribution = (0, tslib_1.__decorate)([
|
|
63
|
+
(0, ide_core_browser_1.Domain)(browser_1.BrowserEditorContribution, ide_core_browser_1.ClientAppContribution)
|
|
64
|
+
], WelcomeContribution);
|
|
65
|
+
exports.WelcomeContribution = WelcomeContribution;
|
|
66
|
+
//# sourceMappingURL=contribution.js.map
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C,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE;YACpC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,sBAAG,CAAC,YAAY,CAAC,CAAC,CAAC;SAChD;IACH,CAAC;CAEF,CAAA;AAhDC;IADC,IAAA,cAAS,EAAC,iCAAiB,CAAC;;6DACwB;AAGrD;IADC,IAAA,cAAS,EAAC,mCAAsB,CAAC;2CACF,mCAAsB;0DAAC;AAGvD;IADC,IAAA,cAAS,EAAC,qCAAkB,CAAC;2CACO,qCAAkB;+DAAC;AAT7C,mBAAmB;IAD/B,IAAA,yBAAM,EAAC,mCAAyB,EAAE,wCAAqB,CAAC;GAC5C,mBAAmB,CAmD/B;AAnDY,kDAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welcome.d.ts","sourceRoot":"","sources":["../../../src/browser/welcome/welcome.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIxE,eAAO,MAAM,sBAAsB,EAAE,oBAAoB,CAAC,gBAAgB,CA4BzE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EditorWelcomeComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
6
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
7
|
+
const welcome_module_less_1 = (0, tslib_1.__importDefault)(require("./welcome.module.less"));
|
|
8
|
+
const EditorWelcomeComponent = ({ resource }) => {
|
|
9
|
+
const commandService = (0, ide_core_browser_1.useInjectable)(ide_core_browser_1.CommandService);
|
|
10
|
+
const windowService = (0, ide_core_browser_1.useInjectable)(ide_core_browser_1.IWindowService);
|
|
11
|
+
return react_1.default.createElement("div", { className: welcome_module_less_1.default.welcome },
|
|
12
|
+
react_1.default.createElement("div", null,
|
|
13
|
+
react_1.default.createElement("h1", null, (0, ide_core_browser_1.localize)('welcome.quckstart')),
|
|
14
|
+
react_1.default.createElement("div", null,
|
|
15
|
+
react_1.default.createElement("a", { onClick: () => {
|
|
16
|
+
commandService.executeCommand(ide_core_browser_1.FILE_COMMANDS.OPEN_FOLDER.id, { newWindow: false });
|
|
17
|
+
} }, (0, ide_core_browser_1.localize)('file.open.folder')))),
|
|
18
|
+
react_1.default.createElement("div", null,
|
|
19
|
+
react_1.default.createElement("h1", null, (0, ide_core_browser_1.localize)('welcome.recent.workspace')),
|
|
20
|
+
resource.metadata.recentWorkspaces.map((workspace) => {
|
|
21
|
+
let workspacePath = workspace;
|
|
22
|
+
if (workspace.startsWith('file://')) {
|
|
23
|
+
workspacePath = ide_core_browser_1.FileUri.fsPath(workspace);
|
|
24
|
+
}
|
|
25
|
+
return react_1.default.createElement("div", { key: workspace },
|
|
26
|
+
react_1.default.createElement("a", { onClick: () => {
|
|
27
|
+
windowService.openWorkspace(new ide_core_browser_1.URI(workspace), { newWindow: false });
|
|
28
|
+
} }, workspacePath));
|
|
29
|
+
})));
|
|
30
|
+
};
|
|
31
|
+
exports.EditorWelcomeComponent = EditorWelcomeComponent;
|
|
32
|
+
//# sourceMappingURL=welcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../../src/browser/welcome/welcome.tsx"],"names":[],"mappings":";;;;AAAA,+DAA0B;AAG1B,iEAAkI;AAClI,6FAA2C;AAEpC,MAAM,sBAAsB,GAA2C,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAE;IAE3F,MAAM,cAAc,GAAmB,IAAA,gCAAa,EAAC,iCAAc,CAAC,CAAC;IACrE,MAAM,aAAa,GAAmB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"typings": "lib/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"prepublishOnly": "npm run build",
|
|
12
|
+
"build": "tsc --build ../../configs/ts/references/tsconfig.electron-basic.json"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git@github.com:opensumi/core.git"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@opensumi/ide-core-common": "2.12.1-next-079c1930",
|
|
20
|
+
"@opensumi/ide-core-node": "2.12.1-next-079c1930",
|
|
21
|
+
"@opensumi/ide-editor": "2.12.1-next-079c1930",
|
|
22
|
+
"@opensumi/ide-workspace": "2.12.1-next-079c1930",
|
|
23
|
+
"@opensumi/ide-overlay": "2.12.1-next-079c1930"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@opensumi/ide-core-browser": "2.12.1-next-079c1930",
|
|
27
|
+
"@opensumi/ide-dev-tool": "^1.3.1"
|
|
28
|
+
}
|
|
29
|
+
}
|