@lvce-editor/chat-view 6.22.0 → 6.23.0

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.
@@ -1197,9 +1197,7 @@ const Shift = 1 << 10 >>> 0;
1197
1197
 
1198
1198
  const Chat$1 = 97;
1199
1199
 
1200
- const Separator = 1;
1201
1200
  const None = 0;
1202
- const RestoreFocus = 6;
1203
1201
 
1204
1202
  const ChatNetworkWorker = 6002;
1205
1203
  const ChatToolWorker = 6005;
@@ -1593,7 +1591,7 @@ const chats = () => {
1593
1591
  const newChat = () => {
1594
1592
  return i18nString('New Chat');
1595
1593
  };
1596
- const addProject = () => {
1594
+ const addProject$1 = () => {
1597
1595
  return i18nString('Add Project');
1598
1596
  };
1599
1597
  const debug = () => {
@@ -3079,22 +3077,12 @@ const getKeyBindings = () => {
3079
3077
  };
3080
3078
 
3081
3079
  const Copy = 'Copy';
3082
- const CopyPath = 'Copy Path';
3083
- const CopyRelativePath = 'Copy Relative Path';
3084
3080
  const Cut = 'Cut';
3085
- const Delete = 'Delete';
3086
- const OpenContainingFolder = 'Open Containing Folder';
3087
- const OpenInIntegratedTerminal = 'Open in integrated Terminal';
3088
3081
  const Paste = 'Paste';
3089
3082
  const Rename = 'Rename';
3090
3083
  const Archive = 'Archive';
3084
+ const AddProject = 'Add Project...';
3091
3085
 
3092
- const openContainingFolder = () => {
3093
- return i18nString(OpenContainingFolder);
3094
- };
3095
- const openInIntegratedTerminal = () => {
3096
- return i18nString(OpenInIntegratedTerminal);
3097
- };
3098
3086
  const cut = () => {
3099
3087
  return i18nString(Cut);
3100
3088
  };
@@ -3104,20 +3092,14 @@ const copy = () => {
3104
3092
  const paste = () => {
3105
3093
  return i18nString(Paste);
3106
3094
  };
3107
- const copyPath = () => {
3108
- return i18nString(CopyPath);
3109
- };
3110
- const copyRelativePath = () => {
3111
- return i18nString(CopyRelativePath);
3112
- };
3113
3095
  const rename = () => {
3114
3096
  return i18nString(Rename);
3115
3097
  };
3116
3098
  const archive = () => {
3117
3099
  return i18nString(Archive);
3118
3100
  };
3119
- const deleteItem = () => {
3120
- return i18nString(Delete);
3101
+ const addProject = () => {
3102
+ return i18nString(AddProject);
3121
3103
  };
3122
3104
 
3123
3105
  const getMenuEntriesChatHeader = () => {
@@ -3251,7 +3233,7 @@ const menuEntryAddProject = {
3251
3233
  command: 'Chat.handleClick',
3252
3234
  flags: None,
3253
3235
  id: 'addProject',
3254
- label: addProject()
3236
+ label: addProject$1()
3255
3237
  };
3256
3238
  const getMenuEntriesChatProjectList = (projectId = '') => {
3257
3239
  if (!projectId) {
@@ -3266,84 +3248,25 @@ const getMenuEntriesChatProjectList = (projectId = '') => {
3266
3248
  }, menuEntryAddProject];
3267
3249
  };
3268
3250
 
3251
+ const getMenuEntriesProjectAddButton = () => {
3252
+ return [{
3253
+ args: [CreateProject],
3254
+ command: 'Chat.handleClick',
3255
+ flags: None,
3256
+ id: 'addProject',
3257
+ label: addProject()
3258
+ }];
3259
+ };
3260
+
3269
3261
  const MenuChatList = 2178;
3270
3262
  const MenuChatHeader = 2179;
3271
3263
  const MenuChatInput = 2180;
3272
- const MenuChatProjectList = 2181;
3264
+ const MenuProjectAddButton = 2181;
3265
+ const MenuChatProjectList = 2182;
3273
3266
  const getMenuEntryIds = () => {
3274
- return [Chat$1, MenuChatList, MenuChatHeader, MenuChatInput, MenuChatProjectList];
3267
+ return [Chat$1, MenuChatList, MenuChatHeader, MenuChatInput, MenuProjectAddButton, MenuChatProjectList];
3275
3268
  };
3276
3269
 
3277
- const menuEntrySeparator = {
3278
- command: '',
3279
- flags: Separator,
3280
- id: 'separator',
3281
- label: ''
3282
- };
3283
-
3284
- const menuEntryOpenContainingFolder = {
3285
- command: 'Explorer.openContainingFolder',
3286
- flags: RestoreFocus,
3287
- id: 'openContainingFolder',
3288
- label: openContainingFolder()
3289
- };
3290
- const menuEntryOpenInIntegratedTerminal = {
3291
- command: /* TODO */'-1',
3292
- flags: None,
3293
- id: 'openInIntegratedTerminal',
3294
- label: openInIntegratedTerminal()
3295
- };
3296
- const menuEntryCut = {
3297
- command: 'Explorer.handleCut',
3298
- flags: RestoreFocus,
3299
- id: 'cut',
3300
- label: cut()
3301
- };
3302
- const menuEntryCopy = {
3303
- command: 'Explorer.handleCopy',
3304
- flags: RestoreFocus,
3305
- id: 'copy',
3306
- label: copy()
3307
- };
3308
- const menuEntryPaste = {
3309
- command: 'Explorer.handlePaste',
3310
- flags: None,
3311
- id: 'paste',
3312
- label: paste()
3313
- };
3314
- const menuEntryCopyPath = {
3315
- command: 'Explorer.copyPath',
3316
- flags: RestoreFocus,
3317
- id: 'copyPath',
3318
- label: copyPath()
3319
- };
3320
- const menuEntryCopyAsE2eTest = {
3321
- command: 'Chat.copyAsE2eTest',
3322
- flags: None,
3323
- id: 'copyAsE2eTest',
3324
- label: copyPath()
3325
- };
3326
- const menuEntryCopyRelativePath = {
3327
- command: 'Explorer.copyRelativePath',
3328
- flags: RestoreFocus,
3329
- id: 'copyRelativePath',
3330
- label: copyRelativePath()
3331
- };
3332
- const menuEntryRename = {
3333
- command: 'Explorer.renameDirent',
3334
- flags: None,
3335
- id: 'rename',
3336
- label: rename()
3337
- };
3338
- const menuEntryDelete = {
3339
- command: 'Explorer.removeDirent',
3340
- flags: None,
3341
- id: 'delete',
3342
- label: deleteItem()
3343
- };
3344
- const getMenuEntriesFile = () => {
3345
- return [menuEntryCopyAsE2eTest, menuEntryOpenContainingFolder, menuEntryOpenInIntegratedTerminal, menuEntrySeparator, menuEntryCut, menuEntryCopy, menuEntryPaste, menuEntrySeparator, menuEntryCopyPath, menuEntryCopyRelativePath, menuEntrySeparator, menuEntryRename, menuEntryDelete];
3346
- };
3347
3270
  const getMenuEntries = (menuId, props) => {
3348
3271
  switch (props.menuId) {
3349
3272
  case MenuChatHeader:
@@ -3354,8 +3277,10 @@ const getMenuEntries = (menuId, props) => {
3354
3277
  return getMenuEntriesChatList();
3355
3278
  case MenuChatProjectList:
3356
3279
  return getMenuEntriesChatProjectList(props.projectId);
3280
+ case MenuProjectAddButton:
3281
+ return getMenuEntriesProjectAddButton();
3357
3282
  default:
3358
- return getMenuEntriesFile();
3283
+ return [];
3359
3284
  }
3360
3285
  };
3361
3286
 
@@ -3375,7 +3300,13 @@ const handleChatHeaderContextMenu = async state => {
3375
3300
  return state;
3376
3301
  };
3377
3302
 
3378
- const handleChatInputContextMenu = async state => {
3303
+ const handleChatInputContextMenu = async (state, eventX, eventY) => {
3304
+ const {
3305
+ uid
3306
+ } = state;
3307
+ await showContextMenu2(uid, MenuChatInput, eventX, eventY, {
3308
+ menuId: MenuChatInput
3309
+ });
3379
3310
  return state;
3380
3311
  };
3381
3312
 
@@ -3415,7 +3346,12 @@ const handleChatListContextMenu = async (state, eventX, eventY) => {
3415
3346
  menuId: MenuChatList,
3416
3347
  sessionId: item.id
3417
3348
  });
3418
- return state;
3349
+ return {
3350
+ ...state,
3351
+ focus: 'list',
3352
+ focused: true,
3353
+ listFocusedIndex: index
3354
+ };
3419
3355
  };
3420
3356
 
3421
3357
  const generateSessionId = () => {
@@ -8573,47 +8509,60 @@ const handleNewline = async state => {
8573
8509
  return handleInput(state, Composer, `${composerValue}\n`);
8574
8510
  };
8575
8511
 
8576
- const getProjectRowIds = (projects, sessions, projectExpandedIds) => {
8512
+ const handleProjectAddButtonContextMenu = async (state, button, x, y) => {
8513
+ const {
8514
+ uid
8515
+ } = state;
8516
+ await showContextMenu2(uid, MenuProjectAddButton, x, y, {
8517
+ menuId: MenuProjectAddButton
8518
+ });
8519
+ return state;
8520
+ };
8521
+
8522
+ const getProjectIdAtIndex = (state, index) => {
8523
+ const {
8524
+ projectExpandedIds,
8525
+ projects,
8526
+ sessions
8527
+ } = state;
8577
8528
  const blankProjectId = projects.find(project => project.name === '_blank')?.id || projects[0]?.id || '';
8578
- const projectRowIds = [];
8529
+ let currentIndex = 0;
8579
8530
  for (const project of projects) {
8580
- projectRowIds.push(project.id);
8581
- if (!projectExpandedIds.includes(project.id)) {
8582
- continue;
8583
- }
8584
- for (const session of sessions) {
8585
- const sessionProjectId = session.projectId || blankProjectId;
8586
- if (sessionProjectId === project.id) {
8587
- projectRowIds.push(project.id);
8531
+ if (currentIndex === index) {
8532
+ return project.id;
8533
+ }
8534
+ currentIndex++;
8535
+ if (projectExpandedIds.includes(project.id)) {
8536
+ for (const session of sessions) {
8537
+ const sessionProjectId = session.projectId || blankProjectId;
8538
+ if (sessionProjectId !== project.id) {
8539
+ continue;
8540
+ }
8541
+ if (currentIndex === index) {
8542
+ return project.id;
8543
+ }
8544
+ currentIndex++;
8588
8545
  }
8589
8546
  }
8590
8547
  }
8591
- return projectRowIds;
8548
+ return '';
8592
8549
  };
8593
- const getProjectIdAtPosition = (state, eventY) => {
8550
+ const handleProjectListContextMenu = async (state, button, x, y) => {
8594
8551
  const {
8595
8552
  headerHeight,
8596
8553
  listItemHeight,
8597
- projectExpandedIds,
8598
8554
  projectListScrollTop,
8599
- projects,
8600
- sessions,
8601
- y
8602
- } = state;
8603
- const relativeY = eventY - y - headerHeight + projectListScrollTop;
8604
- if (relativeY < 0) {
8605
- return '';
8606
- }
8607
- const index = Math.floor(relativeY / listItemHeight);
8608
- const projectRowIds = getProjectRowIds(projects, sessions, projectExpandedIds);
8609
- return projectRowIds[index] || '';
8610
- };
8611
- const handleProjectListContextMenu = async (state, button, eventX, eventY) => {
8612
- const {
8613
8555
  uid
8614
8556
  } = state;
8615
- const projectId = getProjectIdAtPosition(state, eventY);
8616
- await showContextMenu2(uid, MenuChatProjectList, eventX, eventY, {
8557
+ const index = Math.floor((y - headerHeight + projectListScrollTop) / listItemHeight);
8558
+ if (index < 0) {
8559
+ return state;
8560
+ }
8561
+ const projectId = getProjectIdAtIndex(state, index);
8562
+ if (!projectId) {
8563
+ return state;
8564
+ }
8565
+ await showContextMenu2(uid, MenuChatProjectList, x, y, {
8617
8566
  menuId: MenuChatProjectList,
8618
8567
  projectId
8619
8568
  });
@@ -9363,13 +9312,19 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
9363
9312
  border-color: darkcyan;
9364
9313
  }
9365
9314
 
9315
+ .ChatModelPicker{
9316
+ border: 1px solid white;
9317
+ }
9318
+
9366
9319
  .ChatListItem{
9367
9320
  display:flex;
9368
9321
  align-items:center;
9322
+ box-shadow: inset 0 0 0 1px transparent;
9369
9323
  }
9370
9324
 
9371
9325
  .ChatListItemFocused{
9372
9326
  background: var(--vscode-list-activeSelectionBackground);
9327
+ box-shadow: inset 0 0 0 1px var(--vscode-focusBorder);
9373
9328
  color: var(--vscode-list-activeSelectionForeground);
9374
9329
  }
9375
9330
 
@@ -9381,6 +9336,10 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
9381
9336
  padding-top: 10px;
9382
9337
  }
9383
9338
 
9339
+ a.Button{
9340
+ text-decoration: none;
9341
+ }
9342
+
9384
9343
  .ChatHeaderLabel{
9385
9344
  margin: 0;
9386
9345
  font-size: 14px;
@@ -9523,6 +9482,14 @@ const ChatTodoListItemCompleted = 'ChatTodoListItemCompleted';
9523
9482
  const Chat = 'Chat';
9524
9483
  const ChatHeader = 'ChatHeader';
9525
9484
  const ChatHeaderLabel = 'ChatHeaderLabel';
9485
+ const MaskIconDebugPause = 'MaskIconDebugPause';
9486
+ const MaskIconAccount = 'MaskIconAccount';
9487
+ const MaskIconAdd = 'MaskIconAdd';
9488
+ const MaskIconClose = 'MaskIconClose';
9489
+ const MaskIconLayoutPanelLeft = 'MaskIconLayoutPanelLeft';
9490
+ const MaskIconSearch = 'MaskIconSearch';
9491
+ const MaskIconSettingsGear = 'MaskIconSettingsGear';
9492
+ const MaskIconSignOut = 'MaskIconSignOut';
9526
9493
  const Button = 'Button';
9527
9494
  const ButtonPrimary = 'ButtonPrimary';
9528
9495
  const ButtonSecondary = 'ButtonSecondary';
@@ -9565,6 +9532,7 @@ const MarkdownQuote = 'MarkdownQuote';
9565
9532
  const MarkdownMathBlock = 'MarkdownMathBlock';
9566
9533
  const MarkdownTable = 'MarkdownTable';
9567
9534
  const ChatTableWrapper = 'ChatTableWrapper';
9535
+ const MaskIcon = 'MaskIcon';
9568
9536
  const Message = 'Message';
9569
9537
  const MissingApiKeyForm = 'MissingApiKeyForm';
9570
9538
  const ChatMessageContent = 'ChatMessageContent';
@@ -9630,7 +9598,6 @@ const HandleDrop = 29;
9630
9598
  const HandleDragEnterChatView = 30;
9631
9599
  const HandleDragOverChatView = 31;
9632
9600
  const HandleProjectListScroll = 32;
9633
- const HandleProjectListContextMenu = 33;
9634
9601
  const HandleClickDictationButton = 34;
9635
9602
  const HandleMissingApiKeySubmit = 35;
9636
9603
  const HandleRunModeChange = 36;
@@ -9639,6 +9606,8 @@ const HandleChatWelcomeContextMenu = 39;
9639
9606
  const HandleChatHeaderContextMenu = 40;
9640
9607
  const HandleChatInputContextMenu = 41;
9641
9608
  const HandleContextMenuChatSendAreaBottom = 42;
9609
+ const HandleProjectAddButtonContextMenu = 43;
9610
+ const HandleProjectListContextMenu = 44;
9642
9611
 
9643
9612
  const getModelLabel = model => {
9644
9613
  if (model.provider === 'openRouter') {
@@ -9681,6 +9650,7 @@ const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen,
9681
9650
  }, {
9682
9651
  childCount: 0,
9683
9652
  className: InputBox,
9653
+ inputType: 'search',
9684
9654
  name: ModelPickerSearch,
9685
9655
  onInput: HandleInput,
9686
9656
  placeholder: 'Search models',
@@ -9700,13 +9670,13 @@ const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen,
9700
9670
  }, {
9701
9671
  childCount: visibleModels.length,
9702
9672
  className: ChatModelPickerList,
9703
- type: Div
9673
+ type: Ul
9704
9674
  }, ...visibleModels.flatMap(model => [{
9705
9675
  childCount: 1,
9706
9676
  className: `${ChatModelPickerItem}${model.id === selectedModelId ? ` ${ChatModelPickerItemSelected}` : ''}`,
9707
9677
  name: getModelPickerItemInputName(model.id),
9708
9678
  onClick: HandleClick,
9709
- type: Button$1
9679
+ type: Li
9710
9680
  }, text(getModelLabel(model))])] : [])];
9711
9681
  };
9712
9682
 
@@ -9781,7 +9751,8 @@ const getSendButtonDom = (isSendDisabled, voiceDictationEnabled) => {
9781
9751
  type: Button$1
9782
9752
  }, {
9783
9753
  childCount: 0,
9784
- className: 'MaskIcon MaskIconSend',
9754
+ className: 'MaskIcon MaskIconArrowUp',
9755
+ role: 'none',
9785
9756
  type: Div
9786
9757
  }];
9787
9758
  };
@@ -9847,20 +9818,20 @@ const getUsageOverviewDom = (tokensUsed, tokensMax) => {
9847
9818
  }, text(usageLabel)];
9848
9819
  };
9849
9820
 
9850
- const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchValue, models, newChatModelPickerEnabled, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false, showBackToChatsButton = false) => {
9821
+ const getTodoItemClassName = status => {
9822
+ if (status === 'completed') {
9823
+ return `${ChatTodoListItem} ${ChatTodoListItemCompleted} completed`;
9824
+ }
9825
+ if (status === 'inProgress') {
9826
+ return `${ChatTodoListItem} ${ChatTodoListItemInProgress} inProgress`;
9827
+ }
9828
+ return `${ChatTodoListItem} ${ChatTodoListItemTodo} todo`;
9829
+ };
9830
+ const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchValue, models, newChatModelPickerEnabled, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false) => {
9851
9831
  const isSendDisabled = composerValue.trim() === '';
9852
- const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0) + (addContextButtonEnabled ? 1 : 0) + (showBackToChatsButton ? 1 : 0);
9832
+ const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0) + (addContextButtonEnabled ? 1 : 0);
9853
9833
  const hasTodoList = todoListToolEnabled && todoListItems.length > 0;
9854
9834
  const todoHeaderText = `Todos (${todoListItems.filter(item => item.status === 'completed').length}/${todoListItems.length})`;
9855
- const getTodoItemClassName = status => {
9856
- if (status === 'completed') {
9857
- return `${ChatTodoListItem} ${ChatTodoListItemCompleted} completed`;
9858
- }
9859
- if (status === 'inProgress') {
9860
- return `${ChatTodoListItem} ${ChatTodoListItemInProgress} inProgress`;
9861
- }
9862
- return `${ChatTodoListItem} ${ChatTodoListItemTodo} todo`;
9863
- };
9864
9835
  return [{
9865
9836
  childCount: 1,
9866
9837
  className: ChatSendArea,
@@ -9903,7 +9874,14 @@ const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchVal
9903
9874
  className: ChatSendAreaBottom,
9904
9875
  onContextMenu: HandleContextMenuChatSendAreaBottom,
9905
9876
  type: Div
9906
- }, ...(newChatModelPickerEnabled ? getChatModelPickerVirtualDom(models, selectedModelId, modelPickerOpen, modelPickerSearchValue) : getChatSelectVirtualDom(models, selectedModelId)), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...(showBackToChatsButton ? getBackToChatsButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
9877
+ }, ...(newChatModelPickerEnabled ? getChatModelPickerVirtualDom(models, selectedModelId, modelPickerOpen, modelPickerSearchValue) : getChatSelectVirtualDom(models, selectedModelId)), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
9878
+ };
9879
+
9880
+ const getBoldInlineNodeDom = (inlineNode, useChatMathWorker, renderInlineNodeDom) => {
9881
+ return [{
9882
+ childCount: inlineNode.children.length,
9883
+ type: Strong
9884
+ }, ...inlineNode.children.flatMap(child => renderInlineNodeDom(child, useChatMathWorker))];
9907
9885
  };
9908
9886
 
9909
9887
  const getImageAltText = alt => {
@@ -9912,55 +9890,37 @@ const getImageAltText = alt => {
9912
9890
  }
9913
9891
  return `${alt} (image could not be loaded)`;
9914
9892
  };
9893
+
9894
+ const getImageInlineNodeDom = inlineNode => {
9895
+ return [{
9896
+ alt: getImageAltText(inlineNode.alt),
9897
+ childCount: 0,
9898
+ className: ImageElement,
9899
+ src: inlineNode.src,
9900
+ type: Img
9901
+ }];
9902
+ };
9903
+
9904
+ const getInlineCodeInlineNodeDom = inlineNode => {
9905
+ return [{
9906
+ childCount: 1,
9907
+ type: Code
9908
+ }, text(inlineNode.text)];
9909
+ };
9910
+
9911
+ const getItalicInlineNodeDom = (inlineNode, useChatMathWorker, renderInlineNodeDom) => {
9912
+ return [{
9913
+ childCount: inlineNode.children.length,
9914
+ type: Em
9915
+ }, ...inlineNode.children.flatMap(child => renderInlineNodeDom(child, useChatMathWorker))];
9916
+ };
9917
+
9915
9918
  const isFileReferenceUri = href => {
9916
9919
  const normalized = href.trim().toLowerCase();
9917
9920
  return normalized.startsWith('file://') || normalized.startsWith('vscode-references://');
9918
9921
  };
9919
- const getInlineNodeDom = (inlineNode, useChatMathWorker = false) => {
9920
- if (inlineNode.type === 'text') {
9921
- return [text(inlineNode.text)];
9922
- }
9923
- if (inlineNode.type === 'image') {
9924
- return [{
9925
- alt: getImageAltText(inlineNode.alt),
9926
- childCount: 0,
9927
- className: ImageElement,
9928
- src: inlineNode.src,
9929
- type: Img
9930
- }];
9931
- }
9932
- if (inlineNode.type === 'bold') {
9933
- return [{
9934
- childCount: inlineNode.children.length,
9935
- type: Strong
9936
- }, ...inlineNode.children.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
9937
- }
9938
- if (inlineNode.type === 'italic') {
9939
- return [{
9940
- childCount: inlineNode.children.length,
9941
- type: Em
9942
- }, ...inlineNode.children.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
9943
- }
9944
- if (inlineNode.type === 'strikethrough') {
9945
- return [{
9946
- childCount: inlineNode.children.length,
9947
- className: StrikeThrough,
9948
- type: Span
9949
- }, ...inlineNode.children.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
9950
- }
9951
- if (inlineNode.type === 'inline-code') {
9952
- return [{
9953
- childCount: 1,
9954
- type: Code
9955
- }, text(inlineNode.text)];
9956
- }
9957
- if (inlineNode.type === 'math-inline') {
9958
- const fallback = inlineNode.displayMode ? `$$${inlineNode.text}$$` : `$${inlineNode.text}$`;
9959
- return [text(fallback)];
9960
- }
9961
- if (inlineNode.type === 'math-inline-dom') {
9962
- return inlineNode.dom;
9963
- }
9922
+
9923
+ const getLinkInlineNodeDom = inlineNode => {
9964
9924
  if (isFileReferenceUri(inlineNode.href)) {
9965
9925
  return [{
9966
9926
  childCount: 1,
@@ -9983,6 +9943,48 @@ const getInlineNodeDom = (inlineNode, useChatMathWorker = false) => {
9983
9943
  }, text(inlineNode.text)];
9984
9944
  };
9985
9945
 
9946
+ const getMathInlineNodeDom = inlineNode => {
9947
+ const fallback = inlineNode.displayMode ? `$$${inlineNode.text}$$` : `$${inlineNode.text}$`;
9948
+ return [text(fallback)];
9949
+ };
9950
+
9951
+ const getStrikethroughInlineNodeDom = (inlineNode, useChatMathWorker, renderInlineNodeDom) => {
9952
+ return [{
9953
+ childCount: inlineNode.children.length,
9954
+ className: StrikeThrough,
9955
+ type: Span
9956
+ }, ...inlineNode.children.flatMap(child => renderInlineNodeDom(child, useChatMathWorker))];
9957
+ };
9958
+
9959
+ const getTextInlineNodeDom = inlineNode => {
9960
+ return [text(inlineNode.text)];
9961
+ };
9962
+
9963
+ const getInlineNodeDom = (inlineNode, useChatMathWorker = false) => {
9964
+ switch (inlineNode.type) {
9965
+ case 'bold':
9966
+ return getBoldInlineNodeDom(inlineNode, useChatMathWorker, getInlineNodeDom);
9967
+ case 'image':
9968
+ return getImageInlineNodeDom(inlineNode);
9969
+ case 'inline-code':
9970
+ return getInlineCodeInlineNodeDom(inlineNode);
9971
+ case 'italic':
9972
+ return getItalicInlineNodeDom(inlineNode, useChatMathWorker, getInlineNodeDom);
9973
+ case 'link':
9974
+ return getLinkInlineNodeDom(inlineNode);
9975
+ case 'math-inline':
9976
+ return getMathInlineNodeDom(inlineNode);
9977
+ case 'math-inline-dom':
9978
+ return inlineNode.dom;
9979
+ case 'strikethrough':
9980
+ return getStrikethroughInlineNodeDom(inlineNode, useChatMathWorker, getInlineNodeDom);
9981
+ case 'text':
9982
+ return getTextInlineNodeDom(inlineNode);
9983
+ }
9984
+ const exhaustiveCheck = inlineNode;
9985
+ return exhaustiveCheck;
9986
+ };
9987
+
9986
9988
  const jsRules = [{
9987
9989
  className: TokenComment,
9988
9990
  regex: /\/\/[^\n]*/
@@ -10309,6 +10311,35 @@ const getMessageContentDom = (nodes, useChatMathWorker = false) => {
10309
10311
  return nodes.flatMap(node => getMessageNodeDom(node, useChatMathWorker));
10310
10312
  };
10311
10313
 
10314
+ const getMissingApiActionsDom = ({
10315
+ getApiKeyText,
10316
+ openSettingsButtonName,
10317
+ openSettingsUrl,
10318
+ saveButtonDisabled = false,
10319
+ saveButtonName,
10320
+ saveButtonText = save()
10321
+ }) => {
10322
+ return [{
10323
+ childCount: 2,
10324
+ className: Actions,
10325
+ type: Div
10326
+ }, {
10327
+ childCount: 1,
10328
+ className: mergeClassNames(Button, ButtonPrimary),
10329
+ disabled: saveButtonDisabled,
10330
+ inputType: 'submit',
10331
+ name: saveButtonName,
10332
+ type: Button$1
10333
+ }, text(saveButtonText), {
10334
+ childCount: 1,
10335
+ className: mergeClassNames(Button, ButtonSecondary),
10336
+ href: openSettingsUrl,
10337
+ name: openSettingsButtonName,
10338
+ rel: 'noopener noreferrer',
10339
+ target: '_blank',
10340
+ type: A
10341
+ }, text(getApiKeyText)];
10342
+ };
10312
10343
  const getMissingApiKeyDom = ({
10313
10344
  getApiKeyText,
10314
10345
  inputName,
@@ -10342,26 +10373,14 @@ const getMissingApiKeyDom = ({
10342
10373
  required: inputRequired,
10343
10374
  spellcheck: false,
10344
10375
  type: Input
10345
- }, {
10346
- childCount: 2,
10347
- className: Actions,
10348
- type: Div
10349
- }, {
10350
- childCount: 1,
10351
- className: mergeClassNames(Button, ButtonPrimary),
10352
- disabled: saveButtonDisabled,
10353
- inputType: 'submit',
10354
- name: saveButtonName,
10355
- type: Button$1
10356
- }, text(saveButtonText), {
10357
- childCount: 1,
10358
- className: mergeClassNames(Button, ButtonSecondary),
10359
- href: openSettingsUrl,
10360
- name: openSettingsButtonName,
10361
- rel: 'noopener noreferrer',
10362
- target: '_blank',
10363
- type: A
10364
- }, text(getApiKeyText)];
10376
+ }, ...getMissingApiActionsDom({
10377
+ getApiKeyText,
10378
+ openSettingsButtonName,
10379
+ openSettingsUrl,
10380
+ saveButtonDisabled,
10381
+ saveButtonName,
10382
+ saveButtonText
10383
+ })];
10365
10384
  };
10366
10385
 
10367
10386
  const getMissingOpenApiApiKeyDom = () => {
@@ -11268,6 +11287,7 @@ const getProjectSessionDom = (session, selectedSessionId) => {
11268
11287
  className: ProjectSessionItemLabel,
11269
11288
  name: getSessionInputName(session.id),
11270
11289
  onClick: HandleClick,
11290
+ onContextMenu: HandleProjectListContextMenu,
11271
11291
  tabIndex: 0,
11272
11292
  type: Div
11273
11293
  }, text(session.title)];
@@ -11288,6 +11308,7 @@ const getProjectGroupDom = (project, sessions, projectExpandedIds, selectedProje
11288
11308
  className: ProjectListItemLabel,
11289
11309
  name: getProjectInputName(project.id),
11290
11310
  onClick: HandleClick,
11311
+ onContextMenu: HandleProjectListContextMenu,
11291
11312
  tabIndex: 0,
11292
11313
  type: Div
11293
11314
  }, {
@@ -11312,7 +11333,7 @@ const getProjectGroupDom = (project, sessions, projectExpandedIds, selectedProje
11312
11333
  type: Button$1
11313
11334
  }, text('+'), ...(expanded ? sessions.flatMap(session => getProjectSessionDom(session, selectedSessionId)) : [])];
11314
11335
  };
11315
- const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop) => {
11336
+ const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop, showBackToChatsButton = false) => {
11316
11337
  const blankProjectId = projects.find(project => project.name === '_blank')?.id || projects[0]?.id || '';
11317
11338
  const projectGroups = projects.map(project => {
11318
11339
  const projectSessions = sessions.filter(session => {
@@ -11322,13 +11343,12 @@ const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProje
11322
11343
  return getProjectGroupDom(project, projectSessions, projectExpandedIds, selectedProjectId, selectedSessionId);
11323
11344
  });
11324
11345
  return [{
11325
- childCount: 2,
11346
+ childCount: 2 + (showBackToChatsButton ? 1 : 0),
11326
11347
  className: ProjectSidebar,
11327
11348
  type: Div
11328
11349
  }, {
11329
11350
  childCount: projects.length,
11330
11351
  className: ProjectList,
11331
- onContextMenu: HandleProjectListContextMenu,
11332
11352
  onScroll: HandleProjectListScroll,
11333
11353
  scrollTop: projectListScrollTop,
11334
11354
  type: Div
@@ -11337,9 +11357,10 @@ const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProje
11337
11357
  className: ProjectAddButton,
11338
11358
  name: CreateProject,
11339
11359
  onClick: HandleClick,
11360
+ onContextMenu: HandleProjectAddButtonContextMenu,
11340
11361
  tabIndex: 0,
11341
11362
  type: Button$1
11342
- }, text('+ Add Project')];
11363
+ }, text('+ Add Project'), ...(showBackToChatsButton ? getBackToChatsButtonDom() : [])];
11343
11364
  };
11344
11365
 
11345
11366
  const getChatModeChatFocusVirtualDom = ({
@@ -11389,7 +11410,7 @@ const getChatModeChatFocusVirtualDom = ({
11389
11410
  onDragEnter: HandleDragEnterChatView,
11390
11411
  onDragOver: HandleDragOverChatView,
11391
11412
  type: Div
11392
- }, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, modelPickerOpen, modelPickerSearchValue, models, newChatModelPickerEnabled, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled, true), ...(isDropOverlayVisible ? [{
11413
+ }, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop, true), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, modelPickerOpen, modelPickerSearchValue, models, newChatModelPickerEnabled, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
11393
11414
  childCount: 1,
11394
11415
  className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
11395
11416
  name: ComposerDropTarget,
@@ -11440,44 +11461,44 @@ const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'si
11440
11461
  const isSigningIn = authStatus === 'signing-in';
11441
11462
  const authAction = authEnabled && authStatus !== 'signed-in' ? {
11442
11463
  disabled: isSigningIn,
11443
- icon: 'MaskIcon MaskIconAccount',
11464
+ icon: mergeClassNames(MaskIcon, MaskIconAccount),
11444
11465
  name: Login,
11445
11466
  onClick: HandleClick,
11446
11467
  title: isSigningIn ? loggingInToBackend() : loginToBackend()
11447
11468
  } : authEnabled ? {
11448
11469
  disabled: false,
11449
- icon: 'MaskIcon MaskIconSignOut',
11470
+ icon: mergeClassNames(MaskIcon, MaskIconSignOut),
11450
11471
  name: Logout,
11451
11472
  onClick: HandleClick,
11452
11473
  title: logoutFromBackend()
11453
11474
  } : undefined;
11454
11475
  const items = [{
11455
- icon: 'MaskIcon MaskIconLayoutPanelLeft',
11476
+ icon: mergeClassNames(MaskIcon, MaskIconLayoutPanelLeft),
11456
11477
  name: ToggleChatFocus,
11457
11478
  onClick: HandleClick,
11458
11479
  title: toggleTitle
11459
11480
  }, ...(searchEnabled ? [{
11460
- icon: 'MaskIcon MaskIconSearch',
11481
+ icon: mergeClassNames(MaskIcon, MaskIconSearch),
11461
11482
  name: ToggleSearch,
11462
11483
  onClick: HandleClick,
11463
11484
  title: search()
11464
11485
  }] : []), {
11465
- icon: 'MaskIcon MaskIconDebugPause',
11486
+ icon: mergeClassNames(MaskIcon, MaskIconDebugPause),
11466
11487
  name: SessionDebug,
11467
11488
  onClick: HandleClickSessionDebug,
11468
11489
  title: debug()
11469
11490
  }, {
11470
- icon: 'MaskIcon MaskIconAdd',
11491
+ icon: mergeClassNames(MaskIcon, MaskIconAdd),
11471
11492
  name: CreateSession,
11472
11493
  onClick: HandleClickNew,
11473
11494
  title: newChat()
11474
11495
  }, {
11475
- icon: 'MaskIcon MaskIconSettingsGear',
11496
+ icon: mergeClassNames(MaskIcon, MaskIconSettingsGear),
11476
11497
  name: Settings,
11477
11498
  onClick: HandleClickSettings,
11478
11499
  title: settings()
11479
11500
  }, ...(authAction ? [authAction] : []), {
11480
- icon: 'MaskIcon MaskIconClose',
11501
+ icon: mergeClassNames(MaskIcon, MaskIconClose),
11481
11502
  name: CloseChat,
11482
11503
  onClick: HandleClickClose,
11483
11504
  title: closeChat()
@@ -12295,6 +12316,10 @@ const renderEventListeners = () => {
12295
12316
  }, {
12296
12317
  name: HandleProjectListScroll,
12297
12318
  params: ['handleProjectListScroll', 'event.target.scrollTop']
12319
+ }, {
12320
+ name: HandleProjectAddButtonContextMenu,
12321
+ params: ['handleProjectAddButtonContextMenu'],
12322
+ preventDefault: true
12298
12323
  }, {
12299
12324
  name: HandleProjectListContextMenu,
12300
12325
  params: ['handleProjectListContextMenu'],
@@ -12360,11 +12385,18 @@ const reset = async state => {
12360
12385
  };
12361
12386
  };
12362
12387
 
12363
- const resize = (state, dimensions) => {
12364
- return {
12388
+ const resize = async (state, dimensions, getComposerHeightFn = getComposerHeight) => {
12389
+ const nextState = {
12365
12390
  ...state,
12366
12391
  ...dimensions
12367
12392
  };
12393
+ if (dimensions.width !== undefined && dimensions.width !== state.width && nextState.composerValue) {
12394
+ return {
12395
+ ...nextState,
12396
+ composerHeight: await getComposerHeightFn(nextState, nextState.composerValue, nextState.width)
12397
+ };
12398
+ }
12399
+ return nextState;
12368
12400
  };
12369
12401
 
12370
12402
  const saveState = state => {
@@ -12614,6 +12646,7 @@ const commandMap = {
12614
12646
  'Chat.handleMessagesScroll': wrapCommand(handleMessagesScroll),
12615
12647
  'Chat.handleMissingApiKeySubmit': wrapCommand(handleMissingApiKeySubmit),
12616
12648
  'Chat.handleModelChange': wrapCommand(handleModelChange),
12649
+ 'Chat.handleProjectAddButtonContextMenu': wrapCommand(handleProjectAddButtonContextMenu),
12617
12650
  'Chat.handleProjectListContextMenu': wrapCommand(handleProjectListContextMenu),
12618
12651
  'Chat.handleProjectListScroll': wrapCommand(handleProjectListScroll),
12619
12652
  'Chat.handleRunModeChange': wrapCommand(handleRunModeChange),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-view",
3
- "version": "6.22.0",
3
+ "version": "6.23.0",
4
4
  "description": "Chat View Worker",
5
5
  "repository": {
6
6
  "type": "git",