@opensumi/ide-core-browser 3.1.2-next-1718957810.0 → 3.1.2

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 (56) 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/layout/split-panel.service.d.ts +1 -0
  30. package/lib/components/layout/split-panel.service.d.ts.map +1 -1
  31. package/lib/components/layout/split-panel.service.js +8 -17
  32. package/lib/components/layout/split-panel.service.js.map +1 -1
  33. package/lib/contextkey/ai-native.d.ts +0 -2
  34. package/lib/contextkey/ai-native.d.ts.map +1 -1
  35. package/lib/contextkey/ai-native.js +1 -3
  36. package/lib/contextkey/ai-native.js.map +1 -1
  37. package/lib/logger/browser-logger.d.ts +6 -10
  38. package/lib/logger/browser-logger.d.ts.map +1 -1
  39. package/lib/logger/browser-logger.js +5 -15
  40. package/lib/logger/browser-logger.js.map +1 -1
  41. package/lib/react-providers/slot.d.ts.map +1 -1
  42. package/lib/react-providers/slot.js +8 -8
  43. package/lib/react-providers/slot.js.map +1 -1
  44. package/package.json +5 -5
  45. package/src/bootstrap/app.ts +16 -2
  46. package/src/bootstrap/connection.ts +0 -6
  47. package/src/bootstrap/inner-providers.ts +0 -4
  48. package/src/common/common.command.ts +0 -7
  49. package/src/components/actions/index.tsx +35 -1
  50. package/src/components/ai-native/ai-action/index.tsx +5 -5
  51. package/src/components/ai-native/enhanceIcon/index.tsx +8 -15
  52. package/src/components/ai-native/interactive-input/index.tsx +0 -7
  53. package/src/components/layout/split-panel.service.ts +5 -16
  54. package/src/contextkey/ai-native.ts +0 -2
  55. package/src/logger/browser-logger.ts +9 -21
  56. package/src/react-providers/slot.tsx +9 -7
@@ -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}>
@@ -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
  }
@@ -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
- }
@@ -198,16 +198,18 @@ export function SlotRenderer({ slot, isTabbar, id, ...props }: SlotProps) {
198
198
  const componentRegistry = useInjectable<ComponentRegistry>(ComponentRegistry);
199
199
  const appConfig = React.useContext(ConfigContext);
200
200
  const clientApp = useInjectable<IClientApp>(IClientApp);
201
- const componentKeys = appConfig.layoutConfig[slot]?.modules ?? [];
202
201
  if (isTabbar) {
203
202
  slotRendererRegistry.addTabbar(slot);
204
203
  }
205
- if (!componentKeys || !componentKeys.length) {
206
- logger.warn(`No ${slot} view declared by location.`);
207
- }
204
+
208
205
  const [componentInfos, setInfos] = React.useState<ComponentRegistryInfo[]>([]);
209
- const updateComponentInfos = React.useCallback(() => {
206
+
207
+ const prepareComponentInfos = () => {
208
+ const componentKeys = appConfig.layoutConfig[slot]?.modules ?? [];
210
209
  const infos: ComponentRegistryInfo[] = [];
210
+ if (!componentKeys || !componentKeys.length) {
211
+ logger.warn(`No ${slot} view declared by location.`);
212
+ }
211
213
  componentKeys.forEach((token) => {
212
214
  const info = componentRegistry.getComponentRegistryInfo(token);
213
215
  if (!info) {
@@ -217,11 +219,11 @@ export function SlotRenderer({ slot, isTabbar, id, ...props }: SlotProps) {
217
219
  }
218
220
  });
219
221
  setInfos(infos);
220
- }, []);
222
+ };
221
223
 
222
224
  React.useEffect(() => {
223
225
  // 对于嵌套在模块视图的SlotRenderer,渲染时应用已启动
224
- clientApp.appInitialized.promise.then(updateComponentInfos);
226
+ clientApp.appInitialized.promise.then(prepareComponentInfos);
225
227
  }, []);
226
228
 
227
229
  const Renderer = slotRendererRegistry.getSlotRenderer(slot);