@codingame/monaco-vscode-katex-common 29.1.1 → 30.0.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.
Files changed (180) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/actions/browser/buttonbar.js +14 -13
  3. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +16 -16
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +9 -9
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +34 -34
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +12 -20
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.d.ts +14 -0
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +208 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.d.ts +22 -0
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +637 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +1 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +1 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
  15. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +9 -1
  16. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +202 -13
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +4 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +17 -8
  19. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +1 -1
  20. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +53 -5
  21. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +296 -63
  22. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +59 -23
  23. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +55 -42
  24. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +12 -12
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +110 -59
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +5 -4
  31. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.d.ts +24 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +384 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
  34. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.d.ts +12 -7
  35. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +220 -61
  36. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +1 -2
  37. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
  38. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
  39. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +6 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +14 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
  42. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
  45. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +5 -4
  47. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +3 -3
  48. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +1 -1
  50. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +5 -0
  51. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +14 -14
  52. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +11 -0
  53. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +40 -12
  54. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -8
  55. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
  56. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +2 -2
  57. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +1 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +97 -54
  59. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +5 -4
  60. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +6 -6
  61. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +5 -5
  62. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +6 -6
  63. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +8 -7
  64. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
  65. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +15 -2
  66. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +155 -22
  67. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +9 -9
  68. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +3 -1
  69. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +36 -19
  70. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +2 -2
  71. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
  72. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
  73. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
  74. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +13 -0
  75. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +1 -1
  76. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
  77. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +1 -1
  78. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +3 -3
  79. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.d.ts +17 -0
  80. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.js +68 -0
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.js +6 -6
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +16 -16
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +33 -25
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +7 -7
  85. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +12 -3
  86. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
  87. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +5 -5
  88. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
  89. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
  90. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +4 -13
  91. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +37 -113
  92. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +1 -1
  93. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +10 -3
  94. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +66 -39
  95. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
  96. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +13 -2
  97. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +103 -61
  98. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +2 -1
  99. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +35 -23
  100. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +4 -4
  101. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +6 -6
  102. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +5 -5
  103. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +1 -0
  104. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +4 -1
  105. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +2 -1
  106. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +39 -24
  107. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +6 -5
  108. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +44 -18
  109. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +3 -3
  110. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +60 -10
  111. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +7 -7
  112. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +2 -2
  113. package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +6 -6
  114. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +15 -15
  115. package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +4 -0
  116. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +4 -4
  117. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +5 -5
  118. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +4 -1
  119. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +5 -2
  120. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +6 -11
  121. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
  122. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +39 -39
  123. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
  124. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
  125. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
  126. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
  127. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +746 -0
  128. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +13 -0
  129. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +300 -0
  130. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
  131. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
  132. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
  133. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1963 -0
  134. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
  135. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +314 -0
  136. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
  137. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +886 -0
  138. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
  139. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +118 -0
  140. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
  141. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +71 -0
  142. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
  143. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
  144. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
  145. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +313 -0
  146. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
  147. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +265 -0
  148. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
  149. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +185 -0
  150. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
  151. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +104 -0
  152. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +43 -0
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
  155. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +41 -0
  156. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
  157. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +69 -0
  158. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
  159. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
  160. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +933 -0
  161. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
  162. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +32 -0
  163. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
  164. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +643 -0
  165. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
  166. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +197 -0
  167. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
  168. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +539 -0
  169. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
  170. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
  171. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
  172. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +90 -0
  173. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
  174. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
  175. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
  176. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
  177. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +0 -152
  178. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +0 -1317
  179. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.d.ts +0 -47
  180. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.js +0 -95
@@ -0,0 +1,933 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
4
+ import { $ as $$1, append, createElement, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, scheduleAtNextAnimationFrame } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
5
+ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
6
+ import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
7
+ import { registerThemingParticipant } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService';
8
+ import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
9
+ import { EditorPaneSelectionCompareResult, EditorPaneSelectionChangeReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
10
+ import { getDefaultNotebookCreationOptions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookEditorWidget';
11
+ import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
12
+ import { SideBySideDiffElementViewModel } from './diffElementViewModel.js';
13
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
14
+ import { CellDiffSingleSideRenderer, CellDiffSideBySideRenderer, CellDiffPlaceholderRenderer, NotebookDocumentMetadataDiffRenderer, NotebookTextDiffList, NotebookCellTextDiffListDelegate } from './notebookDiffList.js';
15
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
16
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
17
+ import { foreground, focusBorder } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
18
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
19
+ import { editorBackground, diffDiagonalFill } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
20
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
21
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
22
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
23
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
24
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
25
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
26
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
27
+ import { INotebookEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService.service';
28
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
29
+ import { createBareFontInfoFromRawSettings } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/config/fontInfoFromSettings';
30
+ import { PixelRatio } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/pixelRatio';
31
+ import { DiffSide, DIFF_CELL_MARGIN } from './notebookDiffEditorBrowser.js';
32
+ import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
33
+ import { DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
34
+ import { EditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/editor/editorPane';
35
+ import { NOTEBOOK_DIFF_EDITOR_ID, NotebookSetting, CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
36
+ import { SequencerByKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
37
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
38
+ import { BackLayerWebView } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView';
39
+ import { NotebookDiffEditorEventDispatcher, NotebookDiffLayoutChangedEvent } from './eventDispatcher.js';
40
+ import { FontMeasurements } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/config/fontMeasurements';
41
+ import { NotebookOptions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookOptions';
42
+ import { cellIndexesToRanges, cellRangesToIndexes } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookRange';
43
+ import { NotebookDiffOverviewRuler } from './notebookDiffOverviewRuler.js';
44
+ import { registerZIndex, ZIndex } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/zIndexRegistry';
45
+ import { NotebookDiffViewModel } from './notebookDiffViewModel.js';
46
+ import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
47
+ import { DiffEditorHeightCalculatorService } from './editorHeightCalculator.js';
48
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
49
+ import { NotebookInlineDiffWidget } from './inlineDiff/notebookInlineDiffWidget.js';
50
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
51
+ import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
52
+
53
+ var NotebookTextDiffEditor_1;
54
+ const $ = $$1;
55
+ class NotebookDiffEditorSelection {
56
+ constructor(selections) {
57
+ this.selections = selections;
58
+ }
59
+ compare(other) {
60
+ if (!(other instanceof NotebookDiffEditorSelection)) {
61
+ return EditorPaneSelectionCompareResult.DIFFERENT;
62
+ }
63
+ if (this.selections.length !== other.selections.length) {
64
+ return EditorPaneSelectionCompareResult.DIFFERENT;
65
+ }
66
+ for (let i = 0; i < this.selections.length; i++) {
67
+ if (this.selections[i] !== other.selections[i]) {
68
+ return EditorPaneSelectionCompareResult.DIFFERENT;
69
+ }
70
+ }
71
+ return EditorPaneSelectionCompareResult.IDENTICAL;
72
+ }
73
+ restore(options) {
74
+ const notebookOptions = {
75
+ cellSelections: cellIndexesToRanges(this.selections)
76
+ };
77
+ Object.assign(notebookOptions, options);
78
+ return notebookOptions;
79
+ }
80
+ }
81
+ let NotebookTextDiffEditor = class NotebookTextDiffEditor extends EditorPane {
82
+ static {
83
+ NotebookTextDiffEditor_1 = this;
84
+ }
85
+ static {
86
+ this.ENTIRE_DIFF_OVERVIEW_WIDTH = 30;
87
+ }
88
+ static {
89
+ this.ID = NOTEBOOK_DIFF_EDITOR_ID;
90
+ }
91
+ get textModel() {
92
+ return this._model?.modified.notebook;
93
+ }
94
+ get inlineNotebookEditor() {
95
+ if (this._inlineView) {
96
+ return this.inlineDiffWidget?.editorWidget;
97
+ }
98
+ return undefined;
99
+ }
100
+ get notebookOptions() {
101
+ return this._notebookOptions;
102
+ }
103
+ get isDisposed() {
104
+ return this._isDisposed;
105
+ }
106
+ constructor(
107
+ group,
108
+ instantiationService,
109
+ themeService,
110
+ contextKeyService,
111
+ notebookEditorWorkerService,
112
+ configurationService,
113
+ telemetryService,
114
+ storageService,
115
+ notebookService,
116
+ editorService
117
+ ) {
118
+ super(
119
+ NotebookTextDiffEditor_1.ID,
120
+ group,
121
+ telemetryService,
122
+ themeService,
123
+ storageService
124
+ );
125
+ this.instantiationService = instantiationService;
126
+ this.contextKeyService = contextKeyService;
127
+ this.notebookEditorWorkerService = notebookEditorWorkerService;
128
+ this.configurationService = configurationService;
129
+ this.notebookService = notebookService;
130
+ this.editorService = editorService;
131
+ this.creationOptions = getDefaultNotebookCreationOptions();
132
+ this._dimension = undefined;
133
+ this._modifiedWebview = null;
134
+ this._originalWebview = null;
135
+ this._webviewTransparentCover = null;
136
+ this._inlineView = false;
137
+ this._onMouseUp = this._register(( new Emitter()));
138
+ this.onMouseUp = this._onMouseUp.event;
139
+ this._onDidScroll = this._register(( new Emitter()));
140
+ this.onDidScroll = this._onDidScroll.event;
141
+ this.onDidChangeScroll = this._onDidScroll.event;
142
+ this._model = null;
143
+ this._modifiedResourceDisposableStore = this._register(( new DisposableStore()));
144
+ this._insetModifyQueueByOutputId = ( new SequencerByKey());
145
+ this._onDidDynamicOutputRendered = this._register(( new Emitter()));
146
+ this.onDidDynamicOutputRendered = this._onDidDynamicOutputRendered.event;
147
+ this._localStore = this._register(( new DisposableStore()));
148
+ this._onDidChangeSelection = this._register(( new Emitter()));
149
+ this.onDidChangeSelection = this._onDidChangeSelection.event;
150
+ this._isDisposed = false;
151
+ this._currentChangedIndex = observableValue(this, -1);
152
+ this.currentChangedIndex = this._currentChangedIndex;
153
+ this.pendingLayouts = ( new WeakMap());
154
+ this.diffEditorCalcuator = this.instantiationService.createInstance(DiffEditorHeightCalculatorService, this.fontInfo.lineHeight);
155
+ this._notebookOptions = instantiationService.createInstance(NotebookOptions, this.window, false, undefined);
156
+ this._register(this._notebookOptions);
157
+ this._revealFirst = true;
158
+ }
159
+ get fontInfo() {
160
+ if (!this._fontInfo) {
161
+ this._fontInfo = this.createFontInfo();
162
+ }
163
+ return this._fontInfo;
164
+ }
165
+ createFontInfo() {
166
+ const editorOptions = this.configurationService.getValue("editor");
167
+ return FontMeasurements.readFontInfo(
168
+ this.window,
169
+ createBareFontInfoFromRawSettings(editorOptions, PixelRatio.getInstance(this.window).value)
170
+ );
171
+ }
172
+ isOverviewRulerEnabled() {
173
+ return this.configurationService.getValue(NotebookSetting.diffOverviewRuler) ?? false;
174
+ }
175
+ getSelection() {
176
+ const selections = this._list.getFocus();
177
+ return ( new NotebookDiffEditorSelection(selections));
178
+ }
179
+ toggleNotebookCellSelection(cell) {}
180
+ updatePerformanceMetadata(cellId, executionId, duration, rendererId) {}
181
+ async focusNotebookCell(cell, focus) {}
182
+ async focusNextNotebookCell(cell, focus) {}
183
+ didFocusOutputInputChange(inputFocused) {}
184
+ getScrollTop() {
185
+ return this._list?.scrollTop ?? 0;
186
+ }
187
+ getScrollHeight() {
188
+ return this._list?.scrollHeight ?? 0;
189
+ }
190
+ getScrollPosition() {
191
+ return {
192
+ scrollTop: this.getScrollTop(),
193
+ scrollLeft: this._list?.scrollLeft ?? 0
194
+ };
195
+ }
196
+ setScrollPosition(scrollPosition) {
197
+ if (!this._list) {
198
+ return;
199
+ }
200
+ this._list.scrollTop = scrollPosition.scrollTop;
201
+ if (scrollPosition.scrollLeft !== undefined) {
202
+ this._list.scrollLeft = scrollPosition.scrollLeft;
203
+ }
204
+ }
205
+ delegateVerticalScrollbarPointerDown(browserEvent) {
206
+ this._list?.delegateVerticalScrollbarPointerDown(browserEvent);
207
+ }
208
+ updateOutputHeight(cellInfo, output, outputHeight, isInit) {
209
+ const diffElement = cellInfo.diffElement;
210
+ const cell = this.getCellByInfo(cellInfo);
211
+ const outputIndex = cell.outputsViewModels.indexOf(output);
212
+ if (diffElement instanceof SideBySideDiffElementViewModel) {
213
+ const info = CellUri.parse(cellInfo.cellUri);
214
+ if (!info) {
215
+ return;
216
+ }
217
+ diffElement.updateOutputHeight(( info.notebook.toString()) === this._model?.original.resource.toString() ? DiffSide.Original : DiffSide.Modified, outputIndex, outputHeight);
218
+ } else {
219
+ diffElement.updateOutputHeight(
220
+ diffElement.type === "insert" ? DiffSide.Modified : DiffSide.Original,
221
+ outputIndex,
222
+ outputHeight
223
+ );
224
+ }
225
+ if (isInit) {
226
+ this._onDidDynamicOutputRendered.fire({
227
+ cell,
228
+ output
229
+ });
230
+ }
231
+ }
232
+ setMarkupCellEditState(cellId, editState) {}
233
+ didStartDragMarkupCell(cellId, event) {}
234
+ didDragMarkupCell(cellId, event) {}
235
+ didEndDragMarkupCell(cellId) {}
236
+ didDropMarkupCell(cellId) {}
237
+ didResizeOutput(cellId) {}
238
+ async toggleInlineView() {
239
+ this._layoutCancellationTokenSource?.dispose();
240
+ this._inlineView = !this._inlineView;
241
+ if (!this._lastLayoutProperties) {
242
+ return;
243
+ }
244
+ if (this._inlineView) {
245
+ this.layout(
246
+ this._lastLayoutProperties?.dimension,
247
+ this._lastLayoutProperties?.position
248
+ );
249
+ this.inlineDiffWidget?.show(
250
+ this.input,
251
+ this._model?.modified.notebook,
252
+ this._model?.original.notebook,
253
+ this._options
254
+ );
255
+ } else {
256
+ this.layout(
257
+ this._lastLayoutProperties?.dimension,
258
+ this._lastLayoutProperties?.position
259
+ );
260
+ this.inlineDiffWidget?.hide();
261
+ }
262
+ this._layoutCancellationTokenSource = ( new CancellationTokenSource());
263
+ this.updateLayout(this._layoutCancellationTokenSource.token);
264
+ }
265
+ createEditor(parent) {
266
+ this._rootElement = append(parent, $$1(".notebook-text-diff-editor"));
267
+ this._overflowContainer = createElement("div");
268
+ this._overflowContainer.classList.add("notebook-overflow-widget-container", "monaco-editor");
269
+ append(parent, this._overflowContainer);
270
+ const renderers = [
271
+ this.instantiationService.createInstance(CellDiffSingleSideRenderer, this),
272
+ this.instantiationService.createInstance(CellDiffSideBySideRenderer, this),
273
+ this.instantiationService.createInstance(CellDiffPlaceholderRenderer, this),
274
+ this.instantiationService.createInstance(NotebookDocumentMetadataDiffRenderer, this)
275
+ ];
276
+ this._listViewContainer = append(this._rootElement, $$1(".notebook-diff-list-view"));
277
+ this._list = this.instantiationService.createInstance(
278
+ NotebookTextDiffList,
279
+ "NotebookTextDiff",
280
+ this._listViewContainer,
281
+ this.instantiationService.createInstance(NotebookCellTextDiffListDelegate, this.window),
282
+ renderers,
283
+ this.contextKeyService,
284
+ {
285
+ setRowLineHeight: false,
286
+ setRowHeight: false,
287
+ supportDynamicHeights: true,
288
+ horizontalScrolling: false,
289
+ keyboardSupport: false,
290
+ mouseSupport: true,
291
+ multipleSelectionSupport: false,
292
+ typeNavigationEnabled: true,
293
+ paddingBottom: 0,
294
+ styleController: _suffix => {
295
+ return this._list;
296
+ },
297
+ overrideStyles: {
298
+ listBackground: editorBackground,
299
+ listActiveSelectionBackground: editorBackground,
300
+ listActiveSelectionForeground: foreground,
301
+ listFocusAndSelectionBackground: editorBackground,
302
+ listFocusAndSelectionForeground: foreground,
303
+ listFocusBackground: editorBackground,
304
+ listFocusForeground: foreground,
305
+ listHoverForeground: foreground,
306
+ listHoverBackground: editorBackground,
307
+ listHoverOutline: focusBorder,
308
+ listFocusOutline: focusBorder,
309
+ listInactiveSelectionBackground: editorBackground,
310
+ listInactiveSelectionForeground: foreground,
311
+ listInactiveFocusBackground: editorBackground,
312
+ listInactiveFocusOutline: editorBackground
313
+ },
314
+ accessibilityProvider: {
315
+ getAriaLabel() {
316
+ return null;
317
+ },
318
+ getWidgetAriaLabel() {
319
+ return localize(11233, "Notebook Text Diff");
320
+ }
321
+ }
322
+ }
323
+ );
324
+ this.inlineDiffWidget = this._register(this.instantiationService.createInstance(
325
+ NotebookInlineDiffWidget,
326
+ this._rootElement,
327
+ this.group.id,
328
+ this.window,
329
+ this.notebookOptions,
330
+ this._dimension
331
+ ));
332
+ this._register(this._list);
333
+ this._register(this._list.onMouseUp(e => {
334
+ if (e.element) {
335
+ if (typeof e.index === "number") {
336
+ this._list.setFocus([e.index]);
337
+ }
338
+ this._onMouseUp.fire({
339
+ event: e.browserEvent,
340
+ target: e.element
341
+ });
342
+ }
343
+ }));
344
+ this._register(this._list.onDidScroll(() => {
345
+ this._onDidScroll.fire();
346
+ }));
347
+ this._register(this._list.onDidChangeFocus(() => this._onDidChangeSelection.fire({
348
+ reason: EditorPaneSelectionChangeReason.USER
349
+ })));
350
+ this._overviewRulerContainer = createElement("div");
351
+ this._overviewRulerContainer.classList.add("notebook-overview-ruler-container");
352
+ this._rootElement.appendChild(this._overviewRulerContainer);
353
+ this._registerOverviewRuler();
354
+ this._webviewTransparentCover = append(this._list.rowsContainer, $(".webview-cover"));
355
+ this._webviewTransparentCover.style.display = "none";
356
+ this._register(
357
+ addStandardDisposableGenericMouseDownListener(this._overflowContainer, e => {
358
+ if (e.target.classList.contains("slider") && this._webviewTransparentCover) {
359
+ this._webviewTransparentCover.style.display = "block";
360
+ }
361
+ })
362
+ );
363
+ this._register(
364
+ addStandardDisposableGenericMouseUpListener(this._overflowContainer, () => {
365
+ if (this._webviewTransparentCover) {
366
+ this._webviewTransparentCover.style.display = "none";
367
+ }
368
+ })
369
+ );
370
+ this._register(this._list.onDidScroll(e => {
371
+ this._webviewTransparentCover.style.top = `${e.scrollTop}px`;
372
+ }));
373
+ }
374
+ _registerOverviewRuler() {
375
+ this._overviewRuler = this._register(this.instantiationService.createInstance(
376
+ NotebookDiffOverviewRuler,
377
+ this,
378
+ NotebookTextDiffEditor_1.ENTIRE_DIFF_OVERVIEW_WIDTH,
379
+ this._overviewRulerContainer
380
+ ));
381
+ }
382
+ _updateOutputsOffsetsInWebview(scrollTop, scrollHeight, activeWebview, getActiveNestedCell, diffSide) {
383
+ activeWebview.element.style.height = `${scrollHeight}px`;
384
+ if (activeWebview.insetMapping) {
385
+ const updateItems = [];
386
+ const removedItems = [];
387
+ activeWebview.insetMapping.forEach((value, key) => {
388
+ const cell = getActiveNestedCell(value.cellInfo.diffElement);
389
+ if (!cell) {
390
+ return;
391
+ }
392
+ const viewIndex = this._list.indexOf(value.cellInfo.diffElement);
393
+ if (viewIndex === undefined) {
394
+ return;
395
+ }
396
+ if (cell.outputsViewModels.indexOf(key) < 0) {
397
+ removedItems.push(key);
398
+ } else {
399
+ const cellTop = this._list.getCellViewScrollTop(value.cellInfo.diffElement);
400
+ const outputIndex = cell.outputsViewModels.indexOf(key);
401
+ const outputOffset = value.cellInfo.diffElement.getOutputOffsetInCell(diffSide, outputIndex);
402
+ updateItems.push({
403
+ cell,
404
+ output: key,
405
+ cellTop: cellTop,
406
+ outputOffset: outputOffset,
407
+ forceDisplay: false
408
+ });
409
+ }
410
+ });
411
+ activeWebview.removeInsets(removedItems);
412
+ if (updateItems.length) {
413
+ activeWebview.updateScrollTops(updateItems, []);
414
+ }
415
+ }
416
+ }
417
+ async setInput(input, options, context, token) {
418
+ this.inlineDiffWidget?.hide();
419
+ await super.setInput(input, options, context, token);
420
+ const model = await input.resolve();
421
+ if (this._model !== model) {
422
+ this._detachModel();
423
+ this._attachModel(model);
424
+ }
425
+ this._model = model;
426
+ if (this._model === null) {
427
+ return;
428
+ }
429
+ if (this._inlineView) {
430
+ this._listViewContainer.style.display = "none";
431
+ this.inlineDiffWidget?.show(input, model.modified.notebook, model.original.notebook, options);
432
+ } else {
433
+ this._listViewContainer.style.display = "block";
434
+ this.inlineDiffWidget?.hide();
435
+ }
436
+ this._revealFirst = true;
437
+ this._modifiedResourceDisposableStore.clear();
438
+ this._layoutCancellationTokenSource = ( new CancellationTokenSource());
439
+ this._modifiedResourceDisposableStore.add(Event.any(
440
+ this._model.original.notebook.onDidChangeContent,
441
+ this._model.modified.notebook.onDidChangeContent
442
+ )(e => {
443
+ if (this._model !== null && this.editorService.activeEditor !== input) {
444
+ this._layoutCancellationTokenSource?.dispose();
445
+ this._layoutCancellationTokenSource = ( new CancellationTokenSource());
446
+ this.updateLayout(this._layoutCancellationTokenSource.token);
447
+ }
448
+ }));
449
+ await this._createOriginalWebview(
450
+ generateUuid(),
451
+ this._model.original.viewType,
452
+ this._model.original.resource
453
+ );
454
+ if (this._originalWebview) {
455
+ this._modifiedResourceDisposableStore.add(this._originalWebview);
456
+ }
457
+ await this._createModifiedWebview(
458
+ generateUuid(),
459
+ this._model.modified.viewType,
460
+ this._model.modified.resource
461
+ );
462
+ if (this._modifiedWebview) {
463
+ this._modifiedResourceDisposableStore.add(this._modifiedWebview);
464
+ }
465
+ await this.updateLayout(
466
+ this._layoutCancellationTokenSource.token,
467
+ options?.cellSelections ? cellRangesToIndexes(options.cellSelections) : undefined
468
+ );
469
+ }
470
+ setVisible(visible) {
471
+ super.setVisible(visible);
472
+ if (!visible) {
473
+ this.inlineDiffWidget?.hide();
474
+ }
475
+ }
476
+ _detachModel() {
477
+ this._localStore.clear();
478
+ this._originalWebview?.dispose();
479
+ this._originalWebview?.element.remove();
480
+ this._originalWebview = null;
481
+ this._modifiedWebview?.dispose();
482
+ this._modifiedWebview?.element.remove();
483
+ this._modifiedWebview = null;
484
+ this.notebookDiffViewModel?.dispose();
485
+ this.notebookDiffViewModel = undefined;
486
+ this._modifiedResourceDisposableStore.clear();
487
+ this._list.clear();
488
+ }
489
+ _attachModel(model) {
490
+ this._model = model;
491
+ this._eventDispatcher = ( new NotebookDiffEditorEventDispatcher());
492
+ const updateInsets = () => {
493
+ scheduleAtNextAnimationFrame(this.window, () => {
494
+ if (this._isDisposed) {
495
+ return;
496
+ }
497
+ if (this._modifiedWebview) {
498
+ this._updateOutputsOffsetsInWebview(
499
+ this._list.scrollTop,
500
+ this._list.scrollHeight,
501
+ this._modifiedWebview,
502
+ diffElement => {
503
+ return diffElement.modified;
504
+ },
505
+ DiffSide.Modified
506
+ );
507
+ }
508
+ if (this._originalWebview) {
509
+ this._updateOutputsOffsetsInWebview(
510
+ this._list.scrollTop,
511
+ this._list.scrollHeight,
512
+ this._originalWebview,
513
+ diffElement => {
514
+ return diffElement.original;
515
+ },
516
+ DiffSide.Original
517
+ );
518
+ }
519
+ });
520
+ };
521
+ this._localStore.add(this._list.onDidChangeContentHeight(() => {
522
+ updateInsets();
523
+ }));
524
+ this._localStore.add(this._list.onDidChangeFocus(e => {
525
+ if (e.indexes.length && this.notebookDiffViewModel && e.indexes[0] < this.notebookDiffViewModel.items.length) {
526
+ const selectedItem = this.notebookDiffViewModel.items[e.indexes[0]];
527
+ const changedItems = this.notebookDiffViewModel.items.filter(
528
+ item => item.type !== "unchanged" && item.type !== "unchangedMetadata" && item.type !== "placeholder"
529
+ );
530
+ if (selectedItem && selectedItem?.type !== "placeholder" && selectedItem?.type !== "unchanged" && selectedItem?.type !== "unchangedMetadata") {
531
+ return this._currentChangedIndex.set(changedItems.indexOf(selectedItem), undefined);
532
+ }
533
+ }
534
+ return this._currentChangedIndex.set(-1, undefined);
535
+ }));
536
+ this._localStore.add(this._eventDispatcher.onDidChangeCellLayout(() => {
537
+ updateInsets();
538
+ }));
539
+ const vm = this.notebookDiffViewModel = this._register(( new NotebookDiffViewModel(
540
+ this._model,
541
+ this.notebookEditorWorkerService,
542
+ this.configurationService,
543
+ this._eventDispatcher,
544
+ this.notebookService,
545
+ this.diffEditorCalcuator,
546
+ this.fontInfo,
547
+ undefined
548
+ )));
549
+ this._localStore.add(this.notebookDiffViewModel.onDidChangeItems(e => {
550
+ this._originalWebview?.removeInsets([...this._originalWebview?.insetMapping.keys()]);
551
+ this._modifiedWebview?.removeInsets([...this._modifiedWebview?.insetMapping.keys()]);
552
+ if (this._revealFirst && typeof e.firstChangeIndex === "number" && e.firstChangeIndex > -1 && e.firstChangeIndex < this._list.length) {
553
+ this._revealFirst = false;
554
+ this._list.setFocus([e.firstChangeIndex]);
555
+ this._list.reveal(e.firstChangeIndex, 0.3);
556
+ }
557
+ this._list.splice(e.start, e.deleteCount, e.elements);
558
+ if (this.isOverviewRulerEnabled()) {
559
+ this._overviewRuler.updateViewModels(vm.items, this._eventDispatcher);
560
+ }
561
+ }));
562
+ }
563
+ async _createModifiedWebview(id, viewType, resource) {
564
+ this._modifiedWebview?.dispose();
565
+ this._modifiedWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, viewType, resource, {
566
+ ...this._notebookOptions.computeDiffWebviewOptions(),
567
+ fontFamily: this._generateFontFamily()
568
+ }, undefined);
569
+ this._list.rowsContainer.insertAdjacentElement("afterbegin", this._modifiedWebview.element);
570
+ this._modifiedWebview.createWebview(this.window);
571
+ this._modifiedWebview.element.style.width = `calc(50% - 16px)`;
572
+ this._modifiedWebview.element.style.left = `calc(50%)`;
573
+ }
574
+ _generateFontFamily() {
575
+ return this.fontInfo.fontFamily ?? `"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace`;
576
+ }
577
+ async _createOriginalWebview(id, viewType, resource) {
578
+ this._originalWebview?.dispose();
579
+ this._originalWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, viewType, resource, {
580
+ ...this._notebookOptions.computeDiffWebviewOptions(),
581
+ fontFamily: this._generateFontFamily()
582
+ }, undefined);
583
+ this._list.rowsContainer.insertAdjacentElement("afterbegin", this._originalWebview.element);
584
+ this._originalWebview.createWebview(this.window);
585
+ this._originalWebview.element.style.width = `calc(50% - 16px)`;
586
+ this._originalWebview.element.style.left = `16px`;
587
+ }
588
+ setOptions(options) {
589
+ const selections = options?.cellSelections ? cellRangesToIndexes(options.cellSelections) : undefined;
590
+ if (selections) {
591
+ this._list.setFocus(selections);
592
+ }
593
+ }
594
+ async updateLayout(token, selections) {
595
+ if (!this._model || !this.notebookDiffViewModel) {
596
+ return;
597
+ }
598
+ await this.notebookDiffViewModel.computeDiff(token);
599
+ if (token.isCancellationRequested) {
600
+ return;
601
+ }
602
+ if (selections) {
603
+ this._list.setFocus(selections);
604
+ }
605
+ }
606
+ scheduleOutputHeightAck(cellInfo, outputId, height) {
607
+ const diffElement = cellInfo.diffElement;
608
+ let diffSide = DiffSide.Original;
609
+ if (diffElement instanceof SideBySideDiffElementViewModel) {
610
+ const info = CellUri.parse(cellInfo.cellUri);
611
+ if (!info) {
612
+ return;
613
+ }
614
+ diffSide = ( info.notebook.toString()) === this._model?.original.resource.toString() ? DiffSide.Original : DiffSide.Modified;
615
+ } else {
616
+ diffSide = diffElement.type === "insert" ? DiffSide.Modified : DiffSide.Original;
617
+ }
618
+ const webview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
619
+ scheduleAtNextAnimationFrame(this.window, () => {
620
+ webview?.ackHeight([{
621
+ cellId: cellInfo.cellId,
622
+ outputId,
623
+ height
624
+ }]);
625
+ }, 10);
626
+ }
627
+ layoutNotebookCell(cell, height) {
628
+ const relayout = (cell, height) => {
629
+ this._list.updateElementHeight2(cell, height);
630
+ };
631
+ let disposable = this.pendingLayouts.get(cell);
632
+ if (disposable) {
633
+ this._localStore.delete(disposable);
634
+ }
635
+ let r;
636
+ const layoutDisposable = scheduleAtNextAnimationFrame(this.window, () => {
637
+ this.pendingLayouts.delete(cell);
638
+ relayout(cell, height);
639
+ r();
640
+ });
641
+ disposable = toDisposable(() => {
642
+ layoutDisposable.dispose();
643
+ r();
644
+ });
645
+ this._localStore.add(disposable);
646
+ this.pendingLayouts.set(cell, disposable);
647
+ return ( new Promise(resolve => {
648
+ r = resolve;
649
+ }));
650
+ }
651
+ setScrollTop(scrollTop) {
652
+ this._list.scrollTop = scrollTop;
653
+ }
654
+ triggerScroll(event) {
655
+ this._list.triggerScrollFromMouseWheelEvent(event);
656
+ }
657
+ firstChange() {
658
+ if (!this.notebookDiffViewModel) {
659
+ return;
660
+ }
661
+ const currentViewModels = this.notebookDiffViewModel.items;
662
+ const index = currentViewModels.findIndex(
663
+ vm => vm.type !== "unchanged" && vm.type !== "unchangedMetadata" && vm.type !== "placeholder"
664
+ );
665
+ if (index >= 0) {
666
+ this._list.setFocus([index]);
667
+ this._list.reveal(index);
668
+ }
669
+ }
670
+ lastChange() {
671
+ if (!this.notebookDiffViewModel) {
672
+ return;
673
+ }
674
+ const currentViewModels = this.notebookDiffViewModel.items;
675
+ const item = currentViewModels.slice().reverse().find(
676
+ vm => vm.type !== "unchanged" && vm.type !== "unchangedMetadata" && vm.type !== "placeholder"
677
+ );
678
+ const index = item ? currentViewModels.indexOf(item) : -1;
679
+ if (index >= 0) {
680
+ this._list.setFocus([index]);
681
+ this._list.reveal(index);
682
+ }
683
+ }
684
+ previousChange() {
685
+ if (!this.notebookDiffViewModel) {
686
+ return;
687
+ }
688
+ let currFocus = this._list.getFocus()[0];
689
+ if (isNaN(currFocus) || currFocus < 0) {
690
+ currFocus = 0;
691
+ }
692
+ let prevChangeIndex = currFocus - 1;
693
+ const currentViewModels = this.notebookDiffViewModel.items;
694
+ while (prevChangeIndex >= 0) {
695
+ const vm = currentViewModels[prevChangeIndex];
696
+ if (vm.type !== "unchanged" && vm.type !== "unchangedMetadata" && vm.type !== "placeholder") {
697
+ break;
698
+ }
699
+ prevChangeIndex--;
700
+ }
701
+ if (prevChangeIndex >= 0) {
702
+ this._list.setFocus([prevChangeIndex]);
703
+ this._list.reveal(prevChangeIndex);
704
+ } else {
705
+ const index = currentViewModels.findLastIndex(
706
+ vm => vm.type !== "unchanged" && vm.type !== "unchangedMetadata" && vm.type !== "placeholder"
707
+ );
708
+ if (index >= 0) {
709
+ this._list.setFocus([index]);
710
+ this._list.reveal(index);
711
+ }
712
+ }
713
+ }
714
+ nextChange() {
715
+ if (!this.notebookDiffViewModel) {
716
+ return;
717
+ }
718
+ let currFocus = this._list.getFocus()[0];
719
+ if (isNaN(currFocus) || currFocus < 0) {
720
+ currFocus = 0;
721
+ }
722
+ let nextChangeIndex = currFocus + 1;
723
+ const currentViewModels = this.notebookDiffViewModel.items;
724
+ while (nextChangeIndex < currentViewModels.length) {
725
+ const vm = currentViewModels[nextChangeIndex];
726
+ if (vm.type !== "unchanged" && vm.type !== "unchangedMetadata" && vm.type !== "placeholder") {
727
+ break;
728
+ }
729
+ nextChangeIndex++;
730
+ }
731
+ if (nextChangeIndex < currentViewModels.length) {
732
+ this._list.setFocus([nextChangeIndex]);
733
+ this._list.reveal(nextChangeIndex);
734
+ } else {
735
+ const index = currentViewModels.findIndex(
736
+ vm => vm.type !== "unchanged" && vm.type !== "unchangedMetadata" && vm.type !== "placeholder"
737
+ );
738
+ if (index >= 0) {
739
+ this._list.setFocus([index]);
740
+ this._list.reveal(index);
741
+ }
742
+ }
743
+ }
744
+ createOutput(cellDiffViewModel, cellViewModel, output, getOffset, diffSide) {
745
+ this._insetModifyQueueByOutputId.queue(
746
+ output.source.model.outputId + (diffSide === DiffSide.Modified ? "-right" : "left"),
747
+ async () => {
748
+ const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
749
+ if (!activeWebview) {
750
+ return;
751
+ }
752
+ if (!( activeWebview.insetMapping.has(output.source))) {
753
+ const cellTop = this._list.getCellViewScrollTop(cellDiffViewModel);
754
+ await activeWebview.createOutput({
755
+ diffElement: cellDiffViewModel,
756
+ cellHandle: cellViewModel.handle,
757
+ cellId: cellViewModel.id,
758
+ cellUri: cellViewModel.uri
759
+ }, output, cellTop, getOffset());
760
+ } else {
761
+ const cellTop = this._list.getCellViewScrollTop(cellDiffViewModel);
762
+ const outputIndex = cellViewModel.outputsViewModels.indexOf(output.source);
763
+ const outputOffset = cellDiffViewModel.getOutputOffsetInCell(diffSide, outputIndex);
764
+ activeWebview.updateScrollTops([{
765
+ cell: cellViewModel,
766
+ output: output.source,
767
+ cellTop,
768
+ outputOffset,
769
+ forceDisplay: true
770
+ }], []);
771
+ }
772
+ }
773
+ );
774
+ }
775
+ updateMarkupCellHeight() {}
776
+ getCellByInfo(cellInfo) {
777
+ return cellInfo.diffElement.getCellByUri(cellInfo.cellUri);
778
+ }
779
+ getCellById(cellId) {
780
+ throw ( new Error("Not implemented"));
781
+ }
782
+ removeInset(cellDiffViewModel, cellViewModel, displayOutput, diffSide) {
783
+ this._insetModifyQueueByOutputId.queue(
784
+ displayOutput.model.outputId + (diffSide === DiffSide.Modified ? "-right" : "left"),
785
+ async () => {
786
+ const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
787
+ if (!activeWebview) {
788
+ return;
789
+ }
790
+ if (!( activeWebview.insetMapping.has(displayOutput))) {
791
+ return;
792
+ }
793
+ activeWebview.removeInsets([displayOutput]);
794
+ }
795
+ );
796
+ }
797
+ showInset(cellDiffViewModel, cellViewModel, displayOutput, diffSide) {
798
+ this._insetModifyQueueByOutputId.queue(
799
+ displayOutput.model.outputId + (diffSide === DiffSide.Modified ? "-right" : "left"),
800
+ async () => {
801
+ const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
802
+ if (!activeWebview) {
803
+ return;
804
+ }
805
+ if (!( activeWebview.insetMapping.has(displayOutput))) {
806
+ return;
807
+ }
808
+ const cellTop = this._list.getCellViewScrollTop(cellDiffViewModel);
809
+ const outputIndex = cellViewModel.outputsViewModels.indexOf(displayOutput);
810
+ const outputOffset = cellDiffViewModel.getOutputOffsetInCell(diffSide, outputIndex);
811
+ activeWebview.updateScrollTops([{
812
+ cell: cellViewModel,
813
+ output: displayOutput,
814
+ cellTop,
815
+ outputOffset,
816
+ forceDisplay: true
817
+ }], []);
818
+ }
819
+ );
820
+ }
821
+ hideInset(cellDiffViewModel, cellViewModel, output) {
822
+ this._modifiedWebview?.hideInset(output);
823
+ this._originalWebview?.hideInset(output);
824
+ }
825
+ getDomNode() {
826
+ return this._rootElement;
827
+ }
828
+ getOverflowContainerDomNode() {
829
+ return this._overflowContainer;
830
+ }
831
+ getControl() {
832
+ return this;
833
+ }
834
+ clearInput() {
835
+ this.inlineDiffWidget?.hide();
836
+ super.clearInput();
837
+ this._modifiedResourceDisposableStore.clear();
838
+ this._list?.splice(0, this._list?.length || 0);
839
+ this._model = null;
840
+ this.notebookDiffViewModel?.dispose();
841
+ this.notebookDiffViewModel = undefined;
842
+ }
843
+ deltaCellOutputContainerClassNames(diffSide, cellId, added, removed) {
844
+ if (diffSide === DiffSide.Original) {
845
+ this._originalWebview?.deltaCellOutputContainerClassNames(cellId, added, removed);
846
+ } else {
847
+ this._modifiedWebview?.deltaCellOutputContainerClassNames(cellId, added, removed);
848
+ }
849
+ }
850
+ getLayoutInfo() {
851
+ if (!this._list) {
852
+ throw ( new Error("Editor is not initalized successfully"));
853
+ }
854
+ return {
855
+ width: this._dimension.width,
856
+ height: this._dimension.height,
857
+ fontInfo: this.fontInfo,
858
+ scrollHeight: this._list?.getScrollHeight() ?? 0,
859
+ stickyHeight: 0,
860
+ listViewOffsetTop: 0
861
+ };
862
+ }
863
+ layout(dimension, position) {
864
+ this._rootElement.classList.toggle("mid-width", dimension.width < 1000 && dimension.width >= 600);
865
+ this._rootElement.classList.toggle("narrow-width", dimension.width < 600);
866
+ const overviewRulerEnabled = this.isOverviewRulerEnabled();
867
+ this._dimension = dimension.with(
868
+ dimension.width - (overviewRulerEnabled ? NotebookTextDiffEditor_1.ENTIRE_DIFF_OVERVIEW_WIDTH : 0)
869
+ );
870
+ this._listViewContainer.style.height = `${dimension.height}px`;
871
+ this._listViewContainer.style.width = `${this._dimension.width}px`;
872
+ if (this._inlineView) {
873
+ this._listViewContainer.style.display = "none";
874
+ this.inlineDiffWidget?.setLayout(dimension, position);
875
+ } else {
876
+ this.inlineDiffWidget?.hide();
877
+ this._listViewContainer.style.display = "block";
878
+ this._list?.layout(this._dimension.height, this._dimension.width);
879
+ if (this._modifiedWebview) {
880
+ this._modifiedWebview.element.style.width = `calc(50% - 16px)`;
881
+ this._modifiedWebview.element.style.left = `calc(50%)`;
882
+ }
883
+ if (this._originalWebview) {
884
+ this._originalWebview.element.style.width = `calc(50% - 16px)`;
885
+ this._originalWebview.element.style.left = `16px`;
886
+ }
887
+ if (this._webviewTransparentCover) {
888
+ this._webviewTransparentCover.style.height = `${this._dimension.height}px`;
889
+ this._webviewTransparentCover.style.width = `${this._dimension.width}px`;
890
+ }
891
+ if (overviewRulerEnabled) {
892
+ this._overviewRuler.layout();
893
+ }
894
+ }
895
+ this._lastLayoutProperties = {
896
+ dimension,
897
+ position
898
+ };
899
+ this._eventDispatcher?.emit([( new NotebookDiffLayoutChangedEvent({
900
+ width: true,
901
+ fontInfo: true
902
+ }, this.getLayoutInfo()))]);
903
+ }
904
+ dispose() {
905
+ this._isDisposed = true;
906
+ this._layoutCancellationTokenSource?.dispose();
907
+ this._detachModel();
908
+ super.dispose();
909
+ }
910
+ };
911
+ NotebookTextDiffEditor = NotebookTextDiffEditor_1 = ( __decorate([( __param(1, IInstantiationService)), ( __param(2, IThemeService)), ( __param(3, IContextKeyService)), ( __param(4, INotebookEditorWorkerService)), ( __param(5, IConfigurationService)), ( __param(6, ITelemetryService)), ( __param(7, IStorageService)), ( __param(8, INotebookService)), ( __param(9, IEditorService))], NotebookTextDiffEditor));
912
+ registerZIndex(ZIndex.Base, 10, "notebook-diff-view-viewport-slider");
913
+ registerThemingParticipant((theme, collector) => {
914
+ const diffDiagonalFillColor = theme.getColor(diffDiagonalFill);
915
+ collector.addRule(`
916
+ .notebook-text-diff-editor .diagonal-fill {
917
+ background-image: linear-gradient(
918
+ -45deg,
919
+ ${diffDiagonalFillColor} 12.5%,
920
+ #0000 12.5%, #0000 50%,
921
+ ${diffDiagonalFillColor} 50%, ${diffDiagonalFillColor} 62.5%,
922
+ #0000 62.5%, #0000 100%
923
+ );
924
+ background-size: 8px 8px;
925
+ }
926
+ `);
927
+ collector.addRule(`.notebook-text-diff-editor .cell-body { margin: ${DIFF_CELL_MARGIN}px; }`);
928
+ collector.addRule(
929
+ `.notebook-text-diff-editor .cell-placeholder-body { margin: ${DIFF_CELL_MARGIN}px 0; }`
930
+ );
931
+ });
932
+
933
+ export { NotebookTextDiffEditor };