Skip to content

Commit c9c6154

Browse files
authored
fix: fix editor tabbar style (#132)
1 parent ea4e023 commit c9c6154

14 files changed

Lines changed: 526 additions & 518 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"description": "codeblitzjs",
99
"main": "index.js",
1010
"engines": {
11-
"opensumi": "3.2.4-next-1723531705.0"
11+
"opensumi": "3.2.5-next-1724135016.0"
1212
},
1313
"scripts": {
1414
"prepare": "husky install",

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
"opensumi codeblitzjs"
1111
],
1212
"engines": {
13-
"opensumi": "3.2.4-next-1723531705.0",
13+
"opensumi": "3.2.5-next-1724135016.0",
1414
"node": ">=10.0.0"
1515
},
1616
"dependencies": {
1717
"@codeblitzjs/ide-common": "workspace:*",
1818
"@opensumi/extension-installer": "^0.0.1",
19-
"@opensumi/ide-extension": "3.2.4-next-1723531705.0",
19+
"@opensumi/ide-extension": "3.2.5-next-1724135016.0",
2020
"commander": "^7.2.0",
2121
"fs-extra": "^9.0.1",
2222
"lodash.pick": "^4.4.0",

packages/core/package.json

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,48 +33,48 @@
3333
"@codeblitzjs/ide-plugin": "workspace:*",
3434
"@codeblitzjs/ide-registry": "workspace:*",
3535
"@codeblitzjs/ide-sumi-core": "workspace:*",
36-
"@opensumi/ide-addons": "3.2.4-next-1723531705.0",
37-
"@opensumi/ide-ai-native": "3.2.4-next-1723531705.0",
38-
"@opensumi/ide-comments": "3.2.4-next-1723531705.0",
39-
"@opensumi/ide-core-browser": "3.2.4-next-1723531705.0",
40-
"@opensumi/ide-core-common": "3.2.4-next-1723531705.0",
41-
"@opensumi/ide-debug": "3.2.4-next-1723531705.0",
42-
"@opensumi/ide-decoration": "3.2.4-next-1723531705.0",
43-
"@opensumi/ide-design": "3.2.4-next-1723531705.0",
44-
"@opensumi/ide-editor": "3.2.4-next-1723531705.0",
45-
"@opensumi/ide-explorer": "3.2.4-next-1723531705.0",
46-
"@opensumi/ide-express-file-server": "3.2.4-next-1723531705.0",
47-
"@opensumi/ide-extension": "3.2.4-next-1723531705.0",
48-
"@opensumi/ide-extension-storage": "3.2.4-next-1723531705.0",
49-
"@opensumi/ide-file-scheme": "3.2.4-next-1723531705.0",
50-
"@opensumi/ide-file-service": "3.2.4-next-1723531705.0",
51-
"@opensumi/ide-file-tree-next": "3.2.4-next-1723531705.0",
52-
"@opensumi/ide-i18n": "3.2.4-next-1723531705.0",
53-
"@opensumi/ide-keymaps": "3.2.4-next-1723531705.0",
54-
"@opensumi/ide-logs": "3.2.4-next-1723531705.0",
55-
"@opensumi/ide-main-layout": "3.2.4-next-1723531705.0",
56-
"@opensumi/ide-markdown": "3.2.4-next-1723531705.0",
57-
"@opensumi/ide-markers": "3.2.4-next-1723531705.0",
58-
"@opensumi/ide-menu-bar": "3.2.4-next-1723531705.0",
59-
"@opensumi/ide-monaco": "3.2.4-next-1723531705.0",
60-
"@opensumi/ide-monaco-enhance": "3.2.4-next-1723531705.0",
61-
"@opensumi/ide-opened-editor": "3.2.4-next-1723531705.0",
62-
"@opensumi/ide-outline": "3.2.4-next-1723531705.0",
63-
"@opensumi/ide-output": "3.2.4-next-1723531705.0",
64-
"@opensumi/ide-overlay": "3.2.4-next-1723531705.0",
65-
"@opensumi/ide-preferences": "3.2.4-next-1723531705.0",
66-
"@opensumi/ide-quick-open": "3.2.4-next-1723531705.0",
67-
"@opensumi/ide-scm": "3.2.4-next-1723531705.0",
68-
"@opensumi/ide-search": "3.2.4-next-1723531705.0",
69-
"@opensumi/ide-status-bar": "3.2.4-next-1723531705.0",
70-
"@opensumi/ide-storage": "3.2.4-next-1723531705.0",
71-
"@opensumi/ide-testing": "3.2.4-next-1723531705.0",
72-
"@opensumi/ide-theme": "3.2.4-next-1723531705.0",
73-
"@opensumi/ide-toolbar": "3.2.4-next-1723531705.0",
74-
"@opensumi/ide-variable": "3.2.4-next-1723531705.0",
75-
"@opensumi/ide-webview": "3.2.4-next-1723531705.0",
76-
"@opensumi/ide-workspace": "3.2.4-next-1723531705.0",
77-
"@opensumi/ide-workspace-edit": "3.2.4-next-1723531705.0",
36+
"@opensumi/ide-addons": "3.2.5-next-1724135016.0",
37+
"@opensumi/ide-ai-native": "3.2.5-next-1724135016.0",
38+
"@opensumi/ide-comments": "3.2.5-next-1724135016.0",
39+
"@opensumi/ide-core-browser": "3.2.5-next-1724135016.0",
40+
"@opensumi/ide-core-common": "3.2.5-next-1724135016.0",
41+
"@opensumi/ide-debug": "3.2.5-next-1724135016.0",
42+
"@opensumi/ide-decoration": "3.2.5-next-1724135016.0",
43+
"@opensumi/ide-design": "3.2.5-next-1724135016.0",
44+
"@opensumi/ide-editor": "3.2.5-next-1724135016.0",
45+
"@opensumi/ide-explorer": "3.2.5-next-1724135016.0",
46+
"@opensumi/ide-express-file-server": "3.2.5-next-1724135016.0",
47+
"@opensumi/ide-extension": "3.2.5-next-1724135016.0",
48+
"@opensumi/ide-extension-storage": "3.2.5-next-1724135016.0",
49+
"@opensumi/ide-file-scheme": "3.2.5-next-1724135016.0",
50+
"@opensumi/ide-file-service": "3.2.5-next-1724135016.0",
51+
"@opensumi/ide-file-tree-next": "3.2.5-next-1724135016.0",
52+
"@opensumi/ide-i18n": "3.2.5-next-1724135016.0",
53+
"@opensumi/ide-keymaps": "3.2.5-next-1724135016.0",
54+
"@opensumi/ide-logs": "3.2.5-next-1724135016.0",
55+
"@opensumi/ide-main-layout": "3.2.5-next-1724135016.0",
56+
"@opensumi/ide-markdown": "3.2.5-next-1724135016.0",
57+
"@opensumi/ide-markers": "3.2.5-next-1724135016.0",
58+
"@opensumi/ide-menu-bar": "3.2.5-next-1724135016.0",
59+
"@opensumi/ide-monaco": "3.2.5-next-1724135016.0",
60+
"@opensumi/ide-monaco-enhance": "3.2.5-next-1724135016.0",
61+
"@opensumi/ide-opened-editor": "3.2.5-next-1724135016.0",
62+
"@opensumi/ide-outline": "3.2.5-next-1724135016.0",
63+
"@opensumi/ide-output": "3.2.5-next-1724135016.0",
64+
"@opensumi/ide-overlay": "3.2.5-next-1724135016.0",
65+
"@opensumi/ide-preferences": "3.2.5-next-1724135016.0",
66+
"@opensumi/ide-quick-open": "3.2.5-next-1724135016.0",
67+
"@opensumi/ide-scm": "3.2.5-next-1724135016.0",
68+
"@opensumi/ide-search": "3.2.5-next-1724135016.0",
69+
"@opensumi/ide-status-bar": "3.2.5-next-1724135016.0",
70+
"@opensumi/ide-storage": "3.2.5-next-1724135016.0",
71+
"@opensumi/ide-testing": "3.2.5-next-1724135016.0",
72+
"@opensumi/ide-theme": "3.2.5-next-1724135016.0",
73+
"@opensumi/ide-toolbar": "3.2.5-next-1724135016.0",
74+
"@opensumi/ide-variable": "3.2.5-next-1724135016.0",
75+
"@opensumi/ide-webview": "3.2.5-next-1724135016.0",
76+
"@opensumi/ide-workspace": "3.2.5-next-1724135016.0",
77+
"@opensumi/ide-workspace-edit": "3.2.5-next-1724135016.0",
7878
"@opensumi/textmate-languages": "^2.7.0",
7979
"tslib": "^2.2.0"
8080
},
Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
// @opensumi/ide-core-browser/lib/style/normilize.less
1+
@scrollbarwidth: 10px;
2+
23
codeblitz-root {
34
margin: 0;
45
padding: 0;
5-
// 使用该字体获取与vscode一致的图标表现
6-
// 仅mac下可用,windows待区分
7-
// https://stackoverflow.com/questions/32660748/how-to-use-apples-new-san-francisco-font-on-a-webpage
8-
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
6+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
97
// 全局默认字体颜色
108
color: var(--foreground);
119
background-color: var(--editor-background);
12-
font-size: var(--base-font-size);
13-
// 设置 antialiased 会导致整体清晰度降低
14-
-webkit-font-smoothing: antialiased;
10+
}
1511

12+
codeblitz-root {
1613
/* 防止 overlay/modal 撑开页面元素 */
1714
overflow: hidden;
18-
/* 防止mac上的回退手势 */
15+
/* 防止 mac 上的回退手势 */
1916
overscroll-behavior-x: none;
2017

2118
input::placeholder,
@@ -25,16 +22,22 @@ codeblitz-root {
2522

2623
// 全局设置滚动条样式
2724
::-webkit-scrollbar {
25+
-webkit-appearance: none;
26+
2827
background: transparent;
29-
width: 10px;
30-
height: 10px;
28+
width: @scrollbarwidth;
29+
height: @scrollbarwidth;
3130
}
3231

3332
::-webkit-scrollbar:hover {
3433
background: transparent;
34+
width: @scrollbarwidth;
35+
height: @scrollbarwidth;
3536
}
3637

3738
::-webkit-scrollbar-thumb {
39+
transition: all 1s;
40+
3841
background: var(--scrollbarSlider-background);
3942
}
4043

@@ -52,6 +55,7 @@ codeblitz-root {
5255

5356
a {
5457
color: var(--textLink-foreground);
58+
5559
&:hover,
5660
&:active,
5761
&:focus {
@@ -63,26 +67,33 @@ codeblitz-root {
6367
background-color: var(--textBlockQuote-background);
6468
border-color: var(--textBlockQuote-border);
6569
}
66-
6770
code {
6871
background-color: var(--textCodeBlock-background);
6972
}
7073

7174
li {
7275
list-style: none;
7376
}
74-
/* ---- 该样式主要用于让带 tabindex='-1' 的元素焦点态时拥有高亮边框,以便于实现如Tree,List组件焦点态时的自动高亮边框效果 ---- */
75-
[tabindex='-1'] {
76-
&:focus {
77-
outline-width: 1px;
78-
outline-style: solid;
79-
outline-offset: -1px;
80-
}
77+
}
78+
79+
/* ---- 该样式主要用于让带 tabindex='-1' 的元素焦点态时拥有高亮边框,以便于实现如Tree,List组件焦点态时的自动高亮边框效果 ---- */
80+
[tabindex='-1'] {
81+
&:focus {
82+
outline-width: 1px;
83+
outline-style: solid;
84+
outline-offset: -1px;
8185
}
82-
/* -------- */
86+
}
87+
/* -------- */
88+
89+
::selection {
90+
color: inherit;
91+
background-color: var(--selection-background);
8392
}
8493

8594
:root {
8695
--base-font-size: 13px;
8796
--tabBar-height: 35px;
97+
overflow-x: overlay;
98+
overflow-y: overlay;
8899
}

packages/core/src/api/renderDiffViewer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ import React from 'react';
1111
import { IDiffViewerProps } from '../core/diff-viewer';
1212
import { DiffViewerModule } from '../core/diff-viewer/module';
1313
import { BoxPanel, SplitPanel } from '../editor';
14-
import { Injector } from '../modules/opensumi__common-di';
14+
import { Injector } from '@opensumi/di';
1515
import { AppRenderer, IAppRendererProps } from './renderApp';
1616
import '../core/diff-viewer/languages-patch';
1717
import { extensionMetadata } from '../core/diff-viewer/extension-patch';
1818

1919
export {
20-
IDiffViewerHandle,
2120
IDiffViewerProps,
21+
} from '../core/diff-viewer/common';
22+
export type {
23+
IDiffViewerHandle,
2224
IDiffViewerTab,
2325
IExtendPartialEditEvent,
2426
} from '../core/diff-viewer/common';

packages/core/src/core/diff-viewer/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { IPluginConfig } from '@codeblitzjs/ide-plugin';
22
import { IAppOpts, RuntimeConfig } from '@codeblitzjs/ide-sumi-core';
3-
import { IPartialEditEvent } from '@opensumi/ide-ai-native/lib/browser/widget/inline-stream-diff/live-preview.decoration';
3+
import { IPartialEditEvent } from '@opensumi/ide-ai-native/lib/browser/widget/inline-stream-diff/live-preview.component';
44
import { Event, URI } from '@opensumi/ide-core-common';
55
import { IResourceOpenOptions } from '@opensumi/ide-editor';
66
import { ITheme } from '@opensumi/ide-theme';

packages/core/src/core/diff-viewer/internal/base.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isFilesystemReady } from '@codeblitzjs/ide-sumi-core';
1+
import { fsExtra, isFilesystemReady } from '@codeblitzjs/ide-sumi-core';
22
import { InlineChatHandler } from '@opensumi/ide-ai-native/lib/browser/widget/inline-chat/inline-chat.handler';
33
import { AppConfig, ClientAppContribution, EDITOR_COMMANDS, IClientApp } from '@opensumi/ide-core-browser';
44
import {
@@ -15,19 +15,16 @@ import {
1515
import { IResourceOpenOptions, WorkbenchEditorService } from '@opensumi/ide-editor';
1616
import { Selection, SelectionDirection } from '@opensumi/ide-monaco';
1717

18+
import { Autowired } from '@opensumi/di';
1819
import { LiveInlineDiffPreviewer } from '@opensumi/ide-ai-native/lib/browser/widget/inline-diff/inline-diff-previewer';
1920
import { InlineDiffHandler } from '@opensumi/ide-ai-native/lib/browser/widget/inline-diff/inline-diff.handler';
2021
import { EResultKind } from '@opensumi/ide-ai-native/lib/common';
22+
import { IMenuRegistry, MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next';
2123
import { IEditor, IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser';
22-
import { requireModule } from '../../../api/require';
23-
import { Autowired, Injectable } from '../../../modules/opensumi__common-di';
24-
import { IMenuRegistry, MenuContribution } from '../../../modules/opensumi__ide-core-browser';
24+
import path from 'path';
2525
import { IDiffViewerProps, IDiffViewerTab, IExtendPartialEditEvent, ITabChangedEvent } from '../common';
2626
import { removeStart } from '../utils';
2727

28-
const fse = requireModule('fs-extra');
29-
const path = requireModule('path');
30-
3128
@Domain(CommandContribution, ClientAppContribution, MenuContribution)
3229
export class DiffViewerContribution implements CommandContribution, ClientAppContribution, MenuContribution {
3330
private _disposables = new DisposableStore();
@@ -78,9 +75,9 @@ export class DiffViewerContribution implements CommandContribution, ClientAppCon
7875

7976
const openFileInTab = async (filePath: string, content: string, options?: IResourceOpenOptions) => {
8077
const fullPath = this.getFullPath(filePath);
81-
if (!fse.pathExistsSync(fullPath)) {
82-
fse.ensureFileSync(fullPath);
83-
fse.writeFileSync(fullPath, content);
78+
if (!fsExtra.pathExistsSync(fullPath)) {
79+
fsExtra.ensureFileSync(fullPath);
80+
fsExtra.writeFileSync(fullPath, content);
8481
}
8582

8683
const uri = URI.file(fullPath);
@@ -108,7 +105,7 @@ export class DiffViewerContribution implements CommandContribution, ClientAppCon
108105
const editor = openResourceResult.group.codeEditor;
109106

110107
if (oldContent === newContent) {
111-
this.inlineDiffHandler.hidePreviewer(editor.monacoEditor);
108+
this.inlineDiffHandler.destroyPreviewer();
112109
return;
113110
}
114111

@@ -129,7 +126,7 @@ export class DiffViewerContribution implements CommandContribution, ClientAppCon
129126
disposeWhenEditorClosed: false,
130127
},
131128
) as LiveInlineDiffPreviewer;
132-
const whenReady = Event.toPromise(previewer.getNode().onDidEditChange);
129+
const whenReady = Event.toPromise(previewer.getNode()!.onDidEditChange);
133130

134131
previewer.setValue(newContent);
135132

@@ -206,20 +203,18 @@ export class DiffViewerContribution implements CommandContribution, ClientAppCon
206203
},
207204
getFileContent: async (filePath: string) => {
208205
const fullPath = this.getFullPath(filePath);
209-
return await fse.readFile(fullPath, 'utf-8');
206+
return await fsExtra.readFile(fullPath, 'utf-8');
210207
},
211208
acceptAllPartialEdit: async () => {
212209
if (this.inlineDiffHandler) {
213210
this.inlineDiffHandler.handleAction(
214-
this.workbenchEditorService.currentEditor!.monacoEditor,
215211
EResultKind.ACCEPT,
216212
);
217213
}
218214
},
219215
rejectAllPartialEdit: async () => {
220216
if (this.inlineDiffHandler) {
221217
this.inlineDiffHandler.handleAction(
222-
this.workbenchEditorService.currentEditor!.monacoEditor,
223218
EResultKind.DISCARD,
224219
);
225220
}

packages/core/src/core/diff-viewer/internal/theme.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { Autowired } from '@opensumi/di';
12
import { PreferenceProvider } from '@opensumi/ide-core-browser';
23
import { Domain, GeneralSettingsId, PreferenceScope } from '@opensumi/ide-core-common';
34
import { ITheme, ThemeContributionProvider } from '@opensumi/ide-theme';
45
import { IThemeService } from '@opensumi/ide-theme';
5-
import { Autowired } from '../../../modules/opensumi__common-di';
66
import { IDiffViewerProps } from '../common';
77

88
@Domain(ThemeContributionProvider)

packages/core/src/core/diff-viewer/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BrowserModule } from '@opensumi/ide-core-browser';
22

3-
import { Injectable } from '../../modules/opensumi__common-di';
3+
import { Injectable } from '@opensumi/di';
44
import { DiffViewerContribution } from './internal/base';
55
import { DiffViewerComponentContribution } from './internal/component.provider';
66
import { DiffViewerThemeProvider } from './internal/theme.provider';

packages/startup/src/diff-viewer/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { IPartialEditEvent } from '@opensumi/ide-ai-native/lib/browser/widget/inline-stream-diff/live-preview.decoration';
21
import React, { useMemo, useRef } from 'react';
32
import { createRoot } from 'react-dom/client';
43

0 commit comments

Comments
 (0)