@opensumi/ide-core-browser 3.1.3-next-1719223783.0 → 3.1.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/lib/bootstrap/app.d.ts +1 -0
- package/lib/bootstrap/app.d.ts.map +1 -1
- package/lib/bootstrap/app.js +14 -3
- package/lib/bootstrap/app.js.map +1 -1
- package/lib/bootstrap/connection.d.ts.map +1 -1
- package/lib/bootstrap/connection.js +0 -3
- package/lib/bootstrap/connection.js.map +1 -1
- package/lib/bootstrap/inner-providers.d.ts.map +1 -1
- package/lib/bootstrap/inner-providers.js +0 -4
- package/lib/bootstrap/inner-providers.js.map +1 -1
- package/lib/common/common.command.d.ts +0 -4
- package/lib/common/common.command.d.ts.map +1 -1
- package/lib/common/common.command.js +0 -5
- package/lib/common/common.command.js.map +1 -1
- package/lib/components/actions/index.d.ts.map +1 -1
- package/lib/components/actions/index.js +32 -0
- package/lib/components/actions/index.js.map +1 -1
- package/lib/components/ai-native/ai-action/index.d.ts +2 -2
- package/lib/components/ai-native/ai-action/index.d.ts.map +1 -1
- package/lib/components/ai-native/ai-action/index.js +3 -3
- package/lib/components/ai-native/ai-action/index.js.map +1 -1
- package/lib/components/ai-native/enhanceIcon/index.d.ts +0 -1
- package/lib/components/ai-native/enhanceIcon/index.d.ts.map +1 -1
- package/lib/components/ai-native/enhanceIcon/index.js +7 -14
- package/lib/components/ai-native/enhanceIcon/index.js.map +1 -1
- package/lib/components/ai-native/interactive-input/index.d.ts.map +1 -1
- package/lib/components/ai-native/interactive-input/index.js +1 -6
- package/lib/components/ai-native/interactive-input/index.js.map +1 -1
- package/lib/components/ai-native/interactive-input/index.module.less +10 -10
- package/lib/components/layout/split-panel.d.ts +0 -1
- package/lib/components/layout/split-panel.d.ts.map +1 -1
- package/lib/components/layout/split-panel.js +2 -2
- package/lib/components/layout/split-panel.js.map +1 -1
- package/lib/components/layout/split-panel.service.d.ts +1 -0
- package/lib/components/layout/split-panel.service.d.ts.map +1 -1
- package/lib/components/layout/split-panel.service.js +8 -17
- package/lib/components/layout/split-panel.service.js.map +1 -1
- package/lib/contextkey/ai-native.d.ts +0 -2
- package/lib/contextkey/ai-native.d.ts.map +1 -1
- package/lib/contextkey/ai-native.js +1 -3
- package/lib/contextkey/ai-native.js.map +1 -1
- package/lib/logger/browser-logger.d.ts +6 -10
- package/lib/logger/browser-logger.d.ts.map +1 -1
- package/lib/logger/browser-logger.js +5 -15
- package/lib/logger/browser-logger.js.map +1 -1
- package/package.json +5 -5
- package/src/bootstrap/app.ts +16 -2
- package/src/bootstrap/connection.ts +0 -6
- package/src/bootstrap/inner-providers.ts +0 -4
- package/src/common/common.command.ts +0 -7
- package/src/components/actions/index.tsx +35 -1
- package/src/components/ai-native/ai-action/index.tsx +5 -5
- package/src/components/ai-native/enhanceIcon/index.tsx +8 -15
- package/src/components/ai-native/interactive-input/index.module.less +10 -10
- package/src/components/ai-native/interactive-input/index.tsx +0 -7
- package/src/components/layout/split-panel.service.ts +5 -16
- package/src/components/layout/split-panel.tsx +1 -4
- package/src/contextkey/ai-native.ts +0 -2
- package/src/logger/browser-logger.ts +9 -21
|
@@ -3,7 +3,8 @@ import React, { useMemo, useState } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { Button, CheckBox, Icon } from '@opensumi/ide-components';
|
|
5
5
|
import { ClickParam, Menu } from '@opensumi/ide-components/lib/menu';
|
|
6
|
-
import { isBoolean, strings } from '@opensumi/ide-core-common';
|
|
6
|
+
import { CommandRegistry, IDisposable, isBoolean, strings } from '@opensumi/ide-core-common';
|
|
7
|
+
import { GitCommands } from '@opensumi/ide-core-common/lib/commands/git';
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
AbstractMenuService,
|
|
@@ -232,6 +233,7 @@ const InlineActionWidget: React.FC<
|
|
|
232
233
|
> = React.memo(({ iconService, type = 'icon', data, context = [], className, afterClick, ...restProps }) => {
|
|
233
234
|
const styles_iconAction = useDesignStyles(styles.iconAction, 'iconAction');
|
|
234
235
|
const styles_btnAction = useDesignStyles(styles.btnAction, 'btnAction');
|
|
236
|
+
const commandRegistry = useInjectable<CommandRegistry>(CommandRegistry);
|
|
235
237
|
|
|
236
238
|
const [loading, setLoading] = useState(false);
|
|
237
239
|
const handleClick = React.useCallback(
|
|
@@ -258,6 +260,38 @@ const InlineActionWidget: React.FC<
|
|
|
258
260
|
[data, context],
|
|
259
261
|
);
|
|
260
262
|
|
|
263
|
+
React.useEffect(() => {
|
|
264
|
+
let dispose: IDisposable | undefined;
|
|
265
|
+
switch (data.id) {
|
|
266
|
+
case GitCommands.Stage:
|
|
267
|
+
{
|
|
268
|
+
const firstArg = context[0];
|
|
269
|
+
if (!firstArg) {
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
if (!firstArg.sourceUri) {
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
dispose = commandRegistry.registerHandler(`${data.id}-${firstArg.sourceUri.toString()}`, {
|
|
276
|
+
execute: async () => {
|
|
277
|
+
if (typeof data.execute === 'function') {
|
|
278
|
+
await data.execute([...context]);
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
default:
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return () => {
|
|
289
|
+
if (dispose) {
|
|
290
|
+
dispose.dispose();
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}, [data.id]);
|
|
294
|
+
|
|
261
295
|
const [title, label] = React.useMemo(() => {
|
|
262
296
|
let title = data.tooltip || data.label;
|
|
263
297
|
const label = data.label;
|
|
@@ -50,10 +50,10 @@ export interface AIActionItem {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface AIActionProps {
|
|
53
|
-
operationList
|
|
53
|
+
operationList: AIActionItem[];
|
|
54
54
|
moreOperation?: MenuNode[];
|
|
55
55
|
showClose?: boolean;
|
|
56
|
-
onClickItem
|
|
56
|
+
onClickItem: (id: string) => void;
|
|
57
57
|
onClose?: () => void;
|
|
58
58
|
loading?: boolean;
|
|
59
59
|
customOperationRender?: React.ReactNode;
|
|
@@ -109,15 +109,15 @@ export const AIAction = (props: AIActionProps) => {
|
|
|
109
109
|
|
|
110
110
|
const defaultOperationList = (
|
|
111
111
|
<React.Fragment>
|
|
112
|
-
{operationList
|
|
112
|
+
{operationList.map(({ name, title, id }, i) =>
|
|
113
113
|
title ? (
|
|
114
114
|
<EnhancePopover id={id} title={title} key={`popover_${i}`}>
|
|
115
|
-
<EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem
|
|
115
|
+
<EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem(id)}>
|
|
116
116
|
<span key={i}>{name}</span>
|
|
117
117
|
</EnhanceIcon>
|
|
118
118
|
</EnhancePopover>
|
|
119
119
|
) : (
|
|
120
|
-
<EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem
|
|
120
|
+
<EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem(id)} key={i}>
|
|
121
121
|
<span>{name}</span>
|
|
122
122
|
</EnhanceIcon>
|
|
123
123
|
),
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import cls from 'classnames';
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
|
|
4
|
-
import { CommandService } from '@opensumi/ide-core-common';
|
|
5
|
-
|
|
6
4
|
import { Icon } from '../../../components';
|
|
7
5
|
import { MenuNode } from '../../../menu/next/base';
|
|
8
6
|
import { IBrowserCtxMenu } from '../../../menu/next/renderer/ctxmenu/browser';
|
|
@@ -42,7 +40,6 @@ export const EnhanceIcon = React.forwardRef<HTMLDivElement | null, IEnhanceIconP
|
|
|
42
40
|
);
|
|
43
41
|
|
|
44
42
|
interface IEnhanceIconWithCtxMenuProps extends IEnhanceIconProps {
|
|
45
|
-
id?: string;
|
|
46
43
|
menuNodes: MenuNode[];
|
|
47
44
|
skew?: { x: number; y: number };
|
|
48
45
|
}
|
|
@@ -51,8 +48,7 @@ interface IEnhanceIconWithCtxMenuProps extends IEnhanceIconProps {
|
|
|
51
48
|
* 包含下拉菜单的 icon 组件,可以自定义下拉菜单位置
|
|
52
49
|
*/
|
|
53
50
|
export const EnhanceIconWithCtxMenu = (props: IEnhanceIconWithCtxMenuProps) => {
|
|
54
|
-
const { children, menuNodes, skew,
|
|
55
|
-
const commandService = useInjectable<CommandService>(CommandService);
|
|
51
|
+
const { children, menuNodes, skew, ...restProps } = props;
|
|
56
52
|
|
|
57
53
|
const ctxMenuRenderer = useInjectable<IBrowserCtxMenu>(IBrowserCtxMenu);
|
|
58
54
|
const [anchor, setAnchor] = React.useState<{ x: number; y: number } | undefined>(undefined);
|
|
@@ -93,17 +89,14 @@ export const EnhanceIconWithCtxMenu = (props: IEnhanceIconWithCtxMenuProps) => {
|
|
|
93
89
|
if (!anchor) {
|
|
94
90
|
return;
|
|
95
91
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
92
|
+
|
|
93
|
+
handleRefRect((_anchor) => {
|
|
94
|
+
ctxMenuRenderer.show({
|
|
95
|
+
anchor: _anchor,
|
|
96
|
+
menuNodes,
|
|
102
97
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
}, [iconRef.current, menuNodes, anchor, commandId]);
|
|
98
|
+
});
|
|
99
|
+
}, [iconRef.current, menuNodes, anchor]);
|
|
107
100
|
|
|
108
101
|
return (
|
|
109
102
|
<EnhanceIcon ref={iconRef} onClick={handleClick} {...restProps}>
|
|
@@ -6,6 +6,16 @@
|
|
|
6
6
|
position: relative;
|
|
7
7
|
background-color: transparent;
|
|
8
8
|
|
|
9
|
+
:global {
|
|
10
|
+
.kt-input-addon-after {
|
|
11
|
+
align-items: flex-end;
|
|
12
|
+
margin: 4px 4px 0 0;
|
|
13
|
+
}
|
|
14
|
+
.kt-input-disabled {
|
|
15
|
+
background-color: var(--kt-input-disableBackground) !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
&.active {
|
|
10
20
|
border-color: var(--design-inputOption-activeForeground) !important;
|
|
11
21
|
}
|
|
@@ -42,13 +52,3 @@
|
|
|
42
52
|
}
|
|
43
53
|
}
|
|
44
54
|
}
|
|
45
|
-
|
|
46
|
-
:global {
|
|
47
|
-
.kt-input-addon-after {
|
|
48
|
-
align-items: flex-end;
|
|
49
|
-
margin: 4px 4px 0 0;
|
|
50
|
-
}
|
|
51
|
-
.kt-input-disabled {
|
|
52
|
-
background-color: var(--kt-input-disableBackground) !important;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -38,7 +38,6 @@ export const InteractiveInput = React.forwardRef(
|
|
|
38
38
|
width,
|
|
39
39
|
sendBtnClassName,
|
|
40
40
|
popoverPosition,
|
|
41
|
-
autoFocus,
|
|
42
41
|
} = props;
|
|
43
42
|
|
|
44
43
|
const internalRef = useRef<HTMLTextAreaElement>(null);
|
|
@@ -49,12 +48,6 @@ export const InteractiveInput = React.forwardRef(
|
|
|
49
48
|
|
|
50
49
|
useImperativeHandle(ref, () => internalRef.current as HTMLTextAreaElement);
|
|
51
50
|
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (internalRef && internalRef.current && autoFocus) {
|
|
54
|
-
internalRef.current.focus();
|
|
55
|
-
}
|
|
56
|
-
}, [internalRef]);
|
|
57
|
-
|
|
58
51
|
useEffect(() => {
|
|
59
52
|
const value = props.value;
|
|
60
53
|
if (isUndefined(value)) {
|
|
@@ -3,8 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
|
|
4
4
|
import { Deferred, Disposable, IDisposable } from '@opensumi/ide-core-common';
|
|
5
5
|
|
|
6
|
-
import { RESIZE_LOCK } from '../resize/resize';
|
|
7
|
-
|
|
8
6
|
import { SplitPanelProps } from './split-panel';
|
|
9
7
|
|
|
10
8
|
export const ISplitPanelService = Symbol('ISplitPanelService');
|
|
@@ -25,6 +23,7 @@ export interface ISplitPanelService extends IDisposable {
|
|
|
25
23
|
|
|
26
24
|
@Injectable({ multiple: true })
|
|
27
25
|
export class SplitPanelService extends Disposable implements ISplitPanelService {
|
|
26
|
+
private static MIN_SIZE = 120;
|
|
28
27
|
constructor(protected readonly panelId: string) {
|
|
29
28
|
super();
|
|
30
29
|
}
|
|
@@ -51,30 +50,20 @@ export class SplitPanelService extends Disposable implements ISplitPanelService
|
|
|
51
50
|
getFirstResizablePanel(index: number, direction: boolean, isPrev?: boolean): HTMLElement | undefined {
|
|
52
51
|
if (isPrev) {
|
|
53
52
|
if (direction) {
|
|
54
|
-
|
|
55
|
-
if (!this.panels[i].classList.contains(RESIZE_LOCK)) {
|
|
56
|
-
// 跳过无法调整的面板
|
|
57
|
-
return this.panels[i];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
53
|
+
return this.panels[index];
|
|
60
54
|
} else {
|
|
61
55
|
for (let i = index; i >= 0; i--) {
|
|
62
|
-
if (
|
|
56
|
+
if (this.panels[i].clientHeight > SplitPanelService.MIN_SIZE) {
|
|
63
57
|
return this.panels[i];
|
|
64
58
|
}
|
|
65
59
|
}
|
|
66
60
|
}
|
|
67
61
|
} else {
|
|
68
62
|
if (!direction) {
|
|
69
|
-
|
|
70
|
-
if (!this.panels[i].classList.contains(RESIZE_LOCK)) {
|
|
71
|
-
// 跳过无法调整的面板
|
|
72
|
-
return this.panels[i];
|
|
73
|
-
}
|
|
74
|
-
}
|
|
63
|
+
return this.panels[index + 1];
|
|
75
64
|
} else {
|
|
76
65
|
for (let i = index + 1; i < this.panels.length; i++) {
|
|
77
|
-
if (
|
|
66
|
+
if (this.panels[i].clientHeight > SplitPanelService.MIN_SIZE) {
|
|
78
67
|
return this.panels[i];
|
|
79
68
|
}
|
|
80
69
|
}
|
|
@@ -5,7 +5,7 @@ import { IEventBus } from '@opensumi/ide-core-common';
|
|
|
5
5
|
|
|
6
6
|
import { ResizeEvent } from '../../layout';
|
|
7
7
|
import { useInjectable } from '../../react-hooks';
|
|
8
|
-
import { IResizeHandleDelegate,
|
|
8
|
+
import { IResizeHandleDelegate, ResizeFlexMode } from '../resize/resize';
|
|
9
9
|
|
|
10
10
|
import { Layout } from './layout';
|
|
11
11
|
import { SplitPanelManager } from './split-panel.service';
|
|
@@ -64,7 +64,6 @@ export interface SplitPanelProps extends SplitChildProps {
|
|
|
64
64
|
className?: string;
|
|
65
65
|
style?: React.CSSProperties;
|
|
66
66
|
direction?: Layout.direction;
|
|
67
|
-
headerSize?: number;
|
|
68
67
|
id: string;
|
|
69
68
|
// setAbsoluteSize 时保证相邻节点总宽度不变
|
|
70
69
|
resizeKeep?: boolean;
|
|
@@ -96,7 +95,6 @@ export const SplitPanel: React.FC<SplitPanelProps> = (props) => {
|
|
|
96
95
|
const {
|
|
97
96
|
id,
|
|
98
97
|
className,
|
|
99
|
-
headerSize,
|
|
100
98
|
resizeHandleClassName,
|
|
101
99
|
style,
|
|
102
100
|
children = [],
|
|
@@ -300,7 +298,6 @@ export const SplitPanel: React.FC<SplitPanelProps> = (props) => {
|
|
|
300
298
|
splitPanelService.panels.push(ele);
|
|
301
299
|
}
|
|
302
300
|
}}
|
|
303
|
-
className={getElementSize(element, totalFlexNum) === `${headerSize}px` ? RESIZE_LOCK : ''}
|
|
304
301
|
id={getProp(element, 'id') /* @deprecated: query by data-view-id */}
|
|
305
302
|
style={{
|
|
306
303
|
// 手风琴场景,固定尺寸和 flex 尺寸混合布局;需要在 Resize Flex 模式下禁用
|
|
@@ -2,5 +2,3 @@ import { RawContextKey } from '../raw-context-key';
|
|
|
2
2
|
|
|
3
3
|
export const InlineChatIsVisible = new RawContextKey('ai.native.inlineChatIsVisible', false);
|
|
4
4
|
export const InlineCompletionIsTrigger = new RawContextKey('ai.native.inlineCompletionIsTrigger', false);
|
|
5
|
-
export const InlineHintWidgetIsVisible = new RawContextKey('ai.native.inlineHintWidgetIsVisible', false);
|
|
6
|
-
export const InlineInputWidgetIsVisible = new RawContextKey('ai.native.inlineInputWidgetIsVisible', false);
|
|
@@ -3,15 +3,19 @@ import { ILogServiceClient, ILoggerManagerClient, LogLevel, SupportLogNamespace
|
|
|
3
3
|
|
|
4
4
|
export { ILogger } from '@opensumi/ide-core-common';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class Logger implements ILogServiceClient {
|
|
8
|
+
@Autowired(ILoggerManagerClient)
|
|
9
|
+
private LoggerManager: ILoggerManagerClient;
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
private logger: ILogServiceClient;
|
|
12
|
+
|
|
13
|
+
constructor() {
|
|
14
|
+
this.logger = this.LoggerManager.getLogger(SupportLogNamespace.Browser);
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
public getLevel() {
|
|
14
|
-
return this.
|
|
18
|
+
return this.getLevel();
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
public setLevel(level: LogLevel) {
|
|
@@ -45,19 +49,3 @@ class LoggerWrapper implements ILogServiceClient {
|
|
|
45
49
|
return this.logger.dispose();
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
|
-
|
|
49
|
-
@Injectable()
|
|
50
|
-
export class Logger extends LoggerWrapper implements ILogServiceClient {
|
|
51
|
-
@Autowired(ILoggerManagerClient)
|
|
52
|
-
protected loggerManager: ILoggerManagerClient;
|
|
53
|
-
|
|
54
|
-
constructor() {
|
|
55
|
-
super();
|
|
56
|
-
this.logger = this.loggerManager.getBrowserLogger(SupportLogNamespace.Browser);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public reportToServer() {
|
|
60
|
-
this.logger.dispose();
|
|
61
|
-
this.logger = this.loggerManager.getLogger(SupportLogNamespace.Browser);
|
|
62
|
-
}
|
|
63
|
-
}
|