@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.
Files changed (59) hide show
  1. package/lib/bootstrap/app.d.ts +1 -0
  2. package/lib/bootstrap/app.d.ts.map +1 -1
  3. package/lib/bootstrap/app.js +14 -3
  4. package/lib/bootstrap/app.js.map +1 -1
  5. package/lib/bootstrap/connection.d.ts.map +1 -1
  6. package/lib/bootstrap/connection.js +0 -3
  7. package/lib/bootstrap/connection.js.map +1 -1
  8. package/lib/bootstrap/inner-providers.d.ts.map +1 -1
  9. package/lib/bootstrap/inner-providers.js +0 -4
  10. package/lib/bootstrap/inner-providers.js.map +1 -1
  11. package/lib/common/common.command.d.ts +0 -4
  12. package/lib/common/common.command.d.ts.map +1 -1
  13. package/lib/common/common.command.js +0 -5
  14. package/lib/common/common.command.js.map +1 -1
  15. package/lib/components/actions/index.d.ts.map +1 -1
  16. package/lib/components/actions/index.js +32 -0
  17. package/lib/components/actions/index.js.map +1 -1
  18. package/lib/components/ai-native/ai-action/index.d.ts +2 -2
  19. package/lib/components/ai-native/ai-action/index.d.ts.map +1 -1
  20. package/lib/components/ai-native/ai-action/index.js +3 -3
  21. package/lib/components/ai-native/ai-action/index.js.map +1 -1
  22. package/lib/components/ai-native/enhanceIcon/index.d.ts +0 -1
  23. package/lib/components/ai-native/enhanceIcon/index.d.ts.map +1 -1
  24. package/lib/components/ai-native/enhanceIcon/index.js +7 -14
  25. package/lib/components/ai-native/enhanceIcon/index.js.map +1 -1
  26. package/lib/components/ai-native/interactive-input/index.d.ts.map +1 -1
  27. package/lib/components/ai-native/interactive-input/index.js +1 -6
  28. package/lib/components/ai-native/interactive-input/index.js.map +1 -1
  29. package/lib/components/ai-native/interactive-input/index.module.less +10 -10
  30. package/lib/components/layout/split-panel.d.ts +0 -1
  31. package/lib/components/layout/split-panel.d.ts.map +1 -1
  32. package/lib/components/layout/split-panel.js +2 -2
  33. package/lib/components/layout/split-panel.js.map +1 -1
  34. package/lib/components/layout/split-panel.service.d.ts +1 -0
  35. package/lib/components/layout/split-panel.service.d.ts.map +1 -1
  36. package/lib/components/layout/split-panel.service.js +8 -17
  37. package/lib/components/layout/split-panel.service.js.map +1 -1
  38. package/lib/contextkey/ai-native.d.ts +0 -2
  39. package/lib/contextkey/ai-native.d.ts.map +1 -1
  40. package/lib/contextkey/ai-native.js +1 -3
  41. package/lib/contextkey/ai-native.js.map +1 -1
  42. package/lib/logger/browser-logger.d.ts +6 -10
  43. package/lib/logger/browser-logger.d.ts.map +1 -1
  44. package/lib/logger/browser-logger.js +5 -15
  45. package/lib/logger/browser-logger.js.map +1 -1
  46. package/package.json +5 -5
  47. package/src/bootstrap/app.ts +16 -2
  48. package/src/bootstrap/connection.ts +0 -6
  49. package/src/bootstrap/inner-providers.ts +0 -4
  50. package/src/common/common.command.ts +0 -7
  51. package/src/components/actions/index.tsx +35 -1
  52. package/src/components/ai-native/ai-action/index.tsx +5 -5
  53. package/src/components/ai-native/enhanceIcon/index.tsx +8 -15
  54. package/src/components/ai-native/interactive-input/index.module.less +10 -10
  55. package/src/components/ai-native/interactive-input/index.tsx +0 -7
  56. package/src/components/layout/split-panel.service.ts +5 -16
  57. package/src/components/layout/split-panel.tsx +1 -4
  58. package/src/contextkey/ai-native.ts +0 -2
  59. 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?: AIActionItem[];
53
+ operationList: AIActionItem[];
54
54
  moreOperation?: MenuNode[];
55
55
  showClose?: boolean;
56
- onClickItem?: (id: string) => void;
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?.map(({ name, title, id }, i) =>
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?.(id)}>
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?.(id)} key={i}>
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, id: commandId, ...restProps } = props;
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
- if (menuNodes) {
97
- handleRefRect((_anchor) => {
98
- ctxMenuRenderer.show({
99
- anchor: _anchor,
100
- menuNodes,
101
- });
92
+
93
+ handleRefRect((_anchor) => {
94
+ ctxMenuRenderer.show({
95
+ anchor: _anchor,
96
+ menuNodes,
102
97
  });
103
- } else if (commandId) {
104
- commandService.executeCommand(commandId);
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
- for (let i = index; i >= 0; i--) {
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 (!this.panels[i].classList.contains(RESIZE_LOCK)) {
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
- for (let i = index + 1; i < this.panels.length; i++) {
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 (!this.panels[i].classList.contains(RESIZE_LOCK)) {
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, RESIZE_LOCK, ResizeFlexMode } from '../resize/resize';
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
- class LoggerWrapper implements ILogServiceClient {
7
- protected logger: ILogServiceClient;
6
+ @Injectable()
7
+ export class Logger implements ILogServiceClient {
8
+ @Autowired(ILoggerManagerClient)
9
+ private LoggerManager: ILoggerManagerClient;
8
10
 
9
- setup(logger: ILogServiceClient) {
10
- this.logger = logger;
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.logger.getLevel();
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
- }