@codingame/monaco-vscode-api 33.0.3 → 33.0.5

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 (52) hide show
  1. package/package.json +9 -9
  2. package/services.js +3 -3
  3. package/vscode/src/vs/platform/product/common/product.js +1 -1
  4. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +0 -26
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +0 -746
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -300
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +0 -8
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -55
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +0 -273
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1963
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +0 -50
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -314
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +0 -258
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -886
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +0 -41
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -118
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +0 -17
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +0 -71
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +0 -27
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -40
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +0 -23
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +0 -313
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +0 -51
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +0 -265
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +0 -24
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +0 -185
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +0 -28
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +0 -104
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +0 -10
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +0 -43
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +0 -21
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +0 -41
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +0 -25
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +0 -69
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +0 -469
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +0 -149
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -933
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +0 -180
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -32
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +0 -102
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -643
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +0 -30
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -197
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +0 -75
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +0 -539
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +0 -13
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +0 -39
  49. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +0 -19
  50. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +0 -90
  51. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +0 -26
  52. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +0 -92
@@ -1,50 +0,0 @@
1
- import { Disposable, DisposableStore } from "../../../../../base/common/lifecycle.js";
2
- import { DiffElementCellViewModelBase } from "./diffElementViewModel.js";
3
- import { DiffSide, INotebookTextDiffEditor } from "./notebookDiffEditorBrowser.js";
4
- import { ICellOutputViewModel, IInsetRenderOutput } from "../notebookBrowser.js";
5
- import { NotebookTextModel } from "@codingame/monaco-vscode-notebook-service-override/vscode/vs/workbench/contrib/notebook/common/model/notebookTextModel";
6
- import { INotebookService } from "../../common/notebookService.service.js";
7
- import { DiffNestedCellViewModel } from "./diffNestedCellViewModel.js";
8
- import { IQuickInputService } from "../../../../../platform/quickinput/common/quickInput.service.js";
9
- export declare class OutputElement extends Disposable {
10
- private _notebookEditor;
11
- private _notebookTextModel;
12
- private _notebookService;
13
- private _quickInputService;
14
- private _diffElementViewModel;
15
- private _diffSide;
16
- private _nestedCell;
17
- private _outputContainer;
18
- readonly output: ICellOutputViewModel;
19
- readonly resizeListener: DisposableStore;
20
- domNode: HTMLElement;
21
- renderResult?: IInsetRenderOutput;
22
- constructor(_notebookEditor: INotebookTextDiffEditor, _notebookTextModel: NotebookTextModel, _notebookService: INotebookService, _quickInputService: IQuickInputService, _diffElementViewModel: DiffElementCellViewModelBase, _diffSide: DiffSide, _nestedCell: DiffNestedCellViewModel, _outputContainer: HTMLElement, output: ICellOutputViewModel);
23
- render(index: number, beforeElement?: HTMLElement): void;
24
- private _renderMissingRenderer;
25
- private _renderSearchForMimetype;
26
- private _renderMessage;
27
- private pickActiveMimeTypeRenderer;
28
- private generateRendererInfo;
29
- getCellOutputCurrentIndex(): number;
30
- updateHeight(index: number, height: number): void;
31
- getOutputOffsetInContainer(index: number): number;
32
- getOutputOffsetInCell(index: number): number;
33
- }
34
- export declare class OutputContainer extends Disposable {
35
- private _editor;
36
- private _notebookTextModel;
37
- private _diffElementViewModel;
38
- private _nestedCellViewModel;
39
- private _diffSide;
40
- private _outputContainer;
41
- private _notebookService;
42
- private readonly _quickInputService;
43
- private _outputEntries;
44
- constructor(_editor: INotebookTextDiffEditor, _notebookTextModel: NotebookTextModel, _diffElementViewModel: DiffElementCellViewModelBase, _nestedCellViewModel: DiffNestedCellViewModel, _diffSide: DiffSide, _outputContainer: HTMLElement, _notebookService: INotebookService, _quickInputService: IQuickInputService);
45
- private _updateOutputs;
46
- render(): void;
47
- showOutputs(): void;
48
- hideOutputs(): void;
49
- private _renderOutput;
50
- }
@@ -1,314 +0,0 @@
1
-
2
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
3
- import { createElement, $, addStandardDisposableListener, addDisposableListener, EventType, append } from '../../../../../base/browser/dom.js';
4
- import { localize } from '../../../../../nls.js';
5
- import { Disposable, DisposableStore } from '../../../../../base/common/lifecycle.js';
6
- import { SideBySideDiffElementViewModel } from './diffElementViewModel.js';
7
- import { DiffSide } from './notebookDiffEditorBrowser.js';
8
- import { RenderOutputType } from '../notebookBrowser.js';
9
- import { INotebookService } from '../../common/notebookService.service.js';
10
- import { ThemeIcon } from '../../../../../base/common/themables.js';
11
- import { mimetypeIcon } from '../notebookIcons.js';
12
- import { StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';
13
- import { KeyCode } from '../../../../../base/common/keyCodes.js';
14
- import { IQuickInputService } from '../../../../../platform/quickinput/common/quickInput.service.js';
15
-
16
- class OutputElement extends Disposable {
17
- constructor(
18
- _notebookEditor,
19
- _notebookTextModel,
20
- _notebookService,
21
- _quickInputService,
22
- _diffElementViewModel,
23
- _diffSide,
24
- _nestedCell,
25
- _outputContainer,
26
- output
27
- ) {
28
- super();
29
- this._notebookEditor = _notebookEditor;
30
- this._notebookTextModel = _notebookTextModel;
31
- this._notebookService = _notebookService;
32
- this._quickInputService = _quickInputService;
33
- this._diffElementViewModel = _diffElementViewModel;
34
- this._diffSide = _diffSide;
35
- this._nestedCell = _nestedCell;
36
- this._outputContainer = _outputContainer;
37
- this.output = output;
38
- this.resizeListener = this._register(( new DisposableStore()));
39
- }
40
- render(index, beforeElement) {
41
- const outputItemDiv = createElement("div");
42
- let result = undefined;
43
- const [mimeTypes, pick] = this.output.resolveMimeTypes(this._notebookTextModel, undefined);
44
- const pickedMimeTypeRenderer = this.output.pickedMimeType || mimeTypes[pick];
45
- if (mimeTypes.length > 1) {
46
- outputItemDiv.style.position = "relative";
47
- const mimeTypePicker = $(".multi-mimetype-output");
48
- mimeTypePicker.classList.add(...ThemeIcon.asClassNameArray(mimetypeIcon));
49
- mimeTypePicker.tabIndex = 0;
50
- mimeTypePicker.title = ( localize(
51
- 11792,
52
- "Choose a different output mimetype, available mimetypes: {0}",
53
- ( mimeTypes.map(mimeType => mimeType.mimeType)).join(", ")
54
- ));
55
- outputItemDiv.appendChild(mimeTypePicker);
56
- this.resizeListener.add(
57
- addStandardDisposableListener(mimeTypePicker, "mousedown", async e => {
58
- if (e.leftButton) {
59
- e.preventDefault();
60
- e.stopPropagation();
61
- await this.pickActiveMimeTypeRenderer(this._notebookTextModel, this.output);
62
- }
63
- })
64
- );
65
- this.resizeListener.add(
66
- (addDisposableListener(mimeTypePicker, EventType.KEY_DOWN, async e => {
67
- const event = ( new StandardKeyboardEvent(e));
68
- if ((event.equals(KeyCode.Enter) || event.equals(KeyCode.Space))) {
69
- e.preventDefault();
70
- e.stopPropagation();
71
- await this.pickActiveMimeTypeRenderer(this._notebookTextModel, this.output);
72
- }
73
- }))
74
- );
75
- }
76
- const innerContainer = $(".output-inner-container");
77
- append(outputItemDiv, innerContainer);
78
- if (mimeTypes.length !== 0) {
79
- const renderer = this._notebookService.getRendererInfo(pickedMimeTypeRenderer.rendererId);
80
- result = renderer ? {
81
- type: RenderOutputType.Extension,
82
- renderer,
83
- source: this.output,
84
- mimeType: pickedMimeTypeRenderer.mimeType
85
- } : this._renderMissingRenderer(this.output, pickedMimeTypeRenderer.mimeType);
86
- this.output.pickedMimeType = pickedMimeTypeRenderer;
87
- }
88
- this.domNode = outputItemDiv;
89
- this.renderResult = result;
90
- if (!result) {
91
- return;
92
- }
93
- if (beforeElement) {
94
- this._outputContainer.insertBefore(outputItemDiv, beforeElement);
95
- } else {
96
- this._outputContainer.appendChild(outputItemDiv);
97
- }
98
- this._notebookEditor.createOutput(
99
- this._diffElementViewModel,
100
- this._nestedCell,
101
- result,
102
- () => this.getOutputOffsetInCell(index),
103
- this._diffElementViewModel instanceof SideBySideDiffElementViewModel ? this._diffSide : this._diffElementViewModel.type === "insert" ? DiffSide.Modified : DiffSide.Original
104
- );
105
- }
106
- _renderMissingRenderer(viewModel, preferredMimeType) {
107
- if (!viewModel.model.outputs.length) {
108
- return this._renderMessage(viewModel, ( localize(11793, "Cell has no output")));
109
- }
110
- if (!preferredMimeType) {
111
- const mimeTypes = ( viewModel.model.outputs.map(op => op.mime));
112
- const mimeTypesMessage = mimeTypes.join(", ");
113
- return this._renderMessage(viewModel, ( localize(
114
- 11794,
115
- "No renderer could be found for output. It has the following mimetypes: {0}",
116
- mimeTypesMessage
117
- )));
118
- }
119
- return this._renderSearchForMimetype(viewModel, preferredMimeType);
120
- }
121
- _renderSearchForMimetype(viewModel, mimeType) {
122
- const query = `@tag:notebookRenderer ${mimeType}`;
123
- const p = $(
124
- "p",
125
- undefined,
126
- `No renderer could be found for mimetype "${mimeType}", but one might be available on the Marketplace.`
127
- );
128
- const a = $("a", {
129
- href: `command:workbench.extensions.search?%22${query}%22`,
130
- class: "monaco-button monaco-text-button",
131
- tabindex: 0,
132
- role: "button",
133
- style: "padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"
134
- }, `Search Marketplace`);
135
- return {
136
- type: RenderOutputType.Html,
137
- source: viewModel,
138
- htmlContent: p.outerHTML + a.outerHTML
139
- };
140
- }
141
- _renderMessage(viewModel, message) {
142
- const el = $("p", undefined, message);
143
- return {
144
- type: RenderOutputType.Html,
145
- source: viewModel,
146
- htmlContent: el.outerHTML
147
- };
148
- }
149
- async pickActiveMimeTypeRenderer(notebookTextModel, viewModel) {
150
- const [mimeTypes, currIndex] = viewModel.resolveMimeTypes(notebookTextModel, undefined);
151
- const items = ( mimeTypes.filter(mimeType => mimeType.isTrusted).map((mimeType, index) => ({
152
- label: mimeType.mimeType,
153
- id: mimeType.mimeType,
154
- index: index,
155
- picked: index === currIndex,
156
- detail: this.generateRendererInfo(mimeType.rendererId),
157
- description: index === currIndex ? ( localize(11795, "Currently Active")) : undefined
158
- })));
159
- const disposables = ( new DisposableStore());
160
- const picker = disposables.add(this._quickInputService.createQuickPick());
161
- picker.items = items;
162
- picker.activeItems = items.filter(item => !!item.picked);
163
- picker.placeholder = items.length !== mimeTypes.length ? ( localize(
164
- 11796,
165
- "Select mimetype to render for current output. Rich mimetypes are available only when the notebook is trusted"
166
- )) : ( localize(11797, "Select mimetype to render for current output"));
167
- const pick = await ( new Promise(resolve => {
168
- disposables.add(picker.onDidAccept(() => {
169
- resolve(
170
- picker.selectedItems.length === 1 ? picker.selectedItems[0].index : undefined
171
- );
172
- disposables.dispose();
173
- }));
174
- picker.show();
175
- }));
176
- if (pick === undefined) {
177
- return;
178
- }
179
- if (pick !== currIndex) {
180
- const index = this._nestedCell.outputsViewModels.indexOf(viewModel);
181
- const nextElement = this.domNode.nextElementSibling;
182
- this.resizeListener.clear();
183
- const element = this.domNode;
184
- if (element) {
185
- element.remove();
186
- this._notebookEditor.removeInset(this._diffElementViewModel, this._nestedCell, viewModel, this._diffSide);
187
- }
188
- viewModel.pickedMimeType = mimeTypes[pick];
189
- this.render(index, nextElement);
190
- }
191
- }
192
- generateRendererInfo(renderId) {
193
- const renderInfo = this._notebookService.getRendererInfo(renderId);
194
- if (renderInfo) {
195
- const displayName = renderInfo.displayName !== "" ? renderInfo.displayName : renderInfo.id;
196
- return `${displayName} (${renderInfo.extensionId.value})`;
197
- }
198
- return localize(11798, "built-in");
199
- }
200
- getCellOutputCurrentIndex() {
201
- return this._diffElementViewModel.getNestedCellViewModel(this._diffSide).outputs.indexOf(this.output.model);
202
- }
203
- updateHeight(index, height) {
204
- this._diffElementViewModel.updateOutputHeight(this._diffSide, index, height);
205
- }
206
- getOutputOffsetInContainer(index) {
207
- return this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide, index);
208
- }
209
- getOutputOffsetInCell(index) {
210
- return this._diffElementViewModel.getOutputOffsetInCell(this._diffSide, index);
211
- }
212
- }
213
- let OutputContainer = class OutputContainer extends Disposable {
214
- constructor(
215
- _editor,
216
- _notebookTextModel,
217
- _diffElementViewModel,
218
- _nestedCellViewModel,
219
- _diffSide,
220
- _outputContainer,
221
- _notebookService,
222
- _quickInputService
223
- ) {
224
- super();
225
- this._editor = _editor;
226
- this._notebookTextModel = _notebookTextModel;
227
- this._diffElementViewModel = _diffElementViewModel;
228
- this._nestedCellViewModel = _nestedCellViewModel;
229
- this._diffSide = _diffSide;
230
- this._outputContainer = _outputContainer;
231
- this._notebookService = _notebookService;
232
- this._quickInputService = _quickInputService;
233
- this._outputEntries = ( new Map());
234
- this._register(this._diffElementViewModel.onDidLayoutChange(() => {
235
- this._outputEntries.forEach((value, key) => {
236
- const index = _nestedCellViewModel.outputs.indexOf(key.model);
237
- if (index >= 0) {
238
- const top = this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide, index);
239
- value.domNode.style.top = `${top}px`;
240
- }
241
- });
242
- }));
243
- this._register(this._nestedCellViewModel.textModel.onDidChangeOutputs(splice => {
244
- this._updateOutputs(splice);
245
- }));
246
- }
247
- _updateOutputs(splice) {
248
- const removedKeys = [];
249
- this._outputEntries.forEach((value, key) => {
250
- if (this._nestedCellViewModel.outputsViewModels.indexOf(key) < 0) {
251
- removedKeys.push(key);
252
- value.domNode.remove();
253
- this._editor.removeInset(this._diffElementViewModel, this._nestedCellViewModel, key, this._diffSide);
254
- }
255
- });
256
- removedKeys.forEach(key => {
257
- this._outputEntries.get(key)?.dispose();
258
- this._outputEntries.delete(key);
259
- });
260
- let prevElement = undefined;
261
- const outputsToRender = this._nestedCellViewModel.outputsViewModels;
262
- outputsToRender.reverse().forEach(output => {
263
- if (( this._outputEntries.has(output))) {
264
- prevElement = this._outputEntries.get(output).domNode;
265
- return;
266
- }
267
- const currIndex = this._nestedCellViewModel.outputsViewModels.indexOf(output);
268
- this._renderOutput(output, currIndex, prevElement);
269
- prevElement = this._outputEntries.get(output)?.domNode;
270
- });
271
- }
272
- render() {
273
- for (let index = 0; index < this._nestedCellViewModel.outputsViewModels.length; index++) {
274
- const currOutput = this._nestedCellViewModel.outputsViewModels[index];
275
- this._renderOutput(currOutput, index, undefined);
276
- }
277
- }
278
- showOutputs() {
279
- for (let index = 0; index < this._nestedCellViewModel.outputsViewModels.length; index++) {
280
- const currOutput = this._nestedCellViewModel.outputsViewModels[index];
281
- this._editor.showInset(
282
- this._diffElementViewModel,
283
- currOutput.cellViewModel,
284
- currOutput,
285
- this._diffSide
286
- );
287
- }
288
- }
289
- hideOutputs() {
290
- this._outputEntries.forEach((outputElement, cellOutputViewModel) => {
291
- this._editor.hideInset(this._diffElementViewModel, this._nestedCellViewModel, cellOutputViewModel);
292
- });
293
- }
294
- _renderOutput(currOutput, index, beforeElement) {
295
- if (!( this._outputEntries.has(currOutput))) {
296
- this._outputEntries.set(currOutput, ( new OutputElement(
297
- this._editor,
298
- this._notebookTextModel,
299
- this._notebookService,
300
- this._quickInputService,
301
- this._diffElementViewModel,
302
- this._diffSide,
303
- this._nestedCellViewModel,
304
- this._outputContainer,
305
- currOutput
306
- )));
307
- }
308
- const renderElement = this._outputEntries.get(currOutput);
309
- renderElement.render(index, beforeElement);
310
- }
311
- };
312
- OutputContainer = ( __decorate([( __param(6, INotebookService)), ( __param(7, IQuickInputService))], OutputContainer));
313
-
314
- export { OutputContainer, OutputElement };
@@ -1,258 +0,0 @@
1
- import { Emitter } from "../../../../../base/common/event.js";
2
- import { Disposable } from "../../../../../base/common/lifecycle.js";
3
- import { URI } from "../../../../../base/common/uri.js";
4
- import { FontInfo } from "../../../../../editor/common/config/fontInfo.js";
5
- import * as editorCommon from "../../../../../editor/common/editorCommon.js";
6
- import { DiffNestedCellViewModel } from "./diffNestedCellViewModel.js";
7
- import { NotebookDiffEditorEventDispatcher } from "./eventDispatcher.js";
8
- import { CellDiffViewModelLayoutChangeEvent, DiffSide, IDiffElementLayoutInfo } from "./notebookDiffEditorBrowser.js";
9
- import { IGenericCellViewModel } from "../notebookBrowser.js";
10
- import { NotebookLayoutInfo } from "../notebookViewEvents.js";
11
- import { NotebookCellTextModel } from "../../common/model/notebookCellTextModel.js";
12
- import { NotebookTextModel } from "@codingame/monaco-vscode-notebook-service-override/vscode/vs/workbench/contrib/notebook/common/model/notebookTextModel";
13
- import { ICellOutput, INotebookTextModel, IOutputDto, IOutputItemDto } from "../../common/notebookCommon.js";
14
- import { INotebookService } from "../../common/notebookService.service.js";
15
- import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js";
16
- import { IDiffEditorHeightCalculatorService } from "./editorHeightCalculator.js";
17
- import { NotebookDocumentMetadataTextModel } from "../../common/model/notebookMetadataTextModel.js";
18
- export declare const HeightOfHiddenLinesRegionInDiffEditor = 24;
19
- export declare const DefaultLineHeight = 17;
20
- export declare enum PropertyFoldingState {
21
- Expanded = 0,
22
- Collapsed = 1
23
- }
24
- export declare const OUTPUT_EDITOR_HEIGHT_MAGIC = 1440;
25
- type ILayoutInfoDelta0 = {
26
- [K in keyof IDiffElementLayoutInfo]?: number;
27
- };
28
- interface ILayoutInfoDelta extends ILayoutInfoDelta0 {
29
- rawOutputHeight?: number;
30
- recomputeOutput?: boolean;
31
- }
32
- export type IDiffElementViewModelBase = DiffElementCellViewModelBase | DiffElementPlaceholderViewModel | NotebookDocumentMetadataViewModel;
33
- export declare abstract class DiffElementViewModelBase extends Disposable {
34
- readonly mainDocumentTextModel: INotebookTextModel;
35
- readonly editorEventDispatcher: NotebookDiffEditorEventDispatcher;
36
- readonly initData: {
37
- metadataStatusHeight: number;
38
- outputStatusHeight: number;
39
- fontInfo: FontInfo | undefined;
40
- };
41
- protected _layoutInfoEmitter: Emitter<CellDiffViewModelLayoutChangeEvent>;
42
- onDidLayoutChange: import("../../../../../base/common/event.js").Event<CellDiffViewModelLayoutChangeEvent>;
43
- abstract renderOutput: boolean;
44
- constructor(mainDocumentTextModel: INotebookTextModel, editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: {
45
- metadataStatusHeight: number;
46
- outputStatusHeight: number;
47
- fontInfo: FontInfo | undefined;
48
- });
49
- abstract layoutChange(): void;
50
- abstract getHeight(lineHeight: number): number;
51
- abstract get totalHeight(): number;
52
- }
53
- export declare class DiffElementPlaceholderViewModel extends DiffElementViewModelBase {
54
- readonly type: "placeholder";
55
- hiddenCells: DiffElementCellViewModelBase[];
56
- protected _unfoldHiddenCells: Emitter<void>;
57
- onUnfoldHiddenCells: import("../../../../../base/common/event.js").Event<void>;
58
- renderOutput: boolean;
59
- constructor(mainDocumentTextModel: INotebookTextModel, editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: {
60
- metadataStatusHeight: number;
61
- outputStatusHeight: number;
62
- fontInfo: FontInfo | undefined;
63
- });
64
- get totalHeight(): number;
65
- getHeight(_: number): number;
66
- layoutChange(): void;
67
- showHiddenCells(): void;
68
- }
69
- export declare class NotebookDocumentMetadataViewModel extends DiffElementViewModelBase {
70
- readonly originalDocumentTextModel: INotebookTextModel;
71
- readonly modifiedDocumentTextModel: INotebookTextModel;
72
- readonly type: "unchangedMetadata" | "modifiedMetadata";
73
- private readonly editorHeightCalculator;
74
- readonly originalMetadata: NotebookDocumentMetadataTextModel;
75
- readonly modifiedMetadata: NotebookDocumentMetadataTextModel;
76
- cellFoldingState: PropertyFoldingState;
77
- protected _layoutInfo: IDiffElementLayoutInfo;
78
- renderOutput: boolean;
79
- set editorHeight(height: number);
80
- get editorHeight(): number;
81
- set editorMargin(margin: number);
82
- get editorMargin(): number;
83
- get layoutInfo(): IDiffElementLayoutInfo;
84
- get totalHeight(): number;
85
- private _sourceEditorViewState;
86
- constructor(originalDocumentTextModel: INotebookTextModel, modifiedDocumentTextModel: INotebookTextModel, type: "unchangedMetadata" | "modifiedMetadata", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: {
87
- metadataStatusHeight: number;
88
- outputStatusHeight: number;
89
- fontInfo: FontInfo | undefined;
90
- }, notebookService: INotebookService, editorHeightCalculator: IDiffEditorHeightCalculatorService);
91
- computeHeights(): Promise<void>;
92
- layoutChange(): void;
93
- protected _layout(delta: ILayoutInfoDelta): void;
94
- getHeight(lineHeight: number): number;
95
- private _computeTotalHeight;
96
- computeInputEditorHeight(_lineHeight: number): number;
97
- private _fireLayoutChangeEvent;
98
- getComputedCellContainerWidth(layoutInfo: NotebookLayoutInfo, diffEditor: boolean, fullWidth: boolean): number;
99
- getSourceEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null;
100
- saveSpirceEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void;
101
- }
102
- export declare abstract class DiffElementCellViewModelBase extends DiffElementViewModelBase {
103
- readonly type: "unchanged" | "insert" | "delete" | "modified";
104
- readonly index: number;
105
- private readonly configurationService;
106
- readonly diffEditorHeightCalculator: IDiffEditorHeightCalculatorService;
107
- cellFoldingState: PropertyFoldingState;
108
- metadataFoldingState: PropertyFoldingState;
109
- outputFoldingState: PropertyFoldingState;
110
- protected _stateChangeEmitter: Emitter<{
111
- renderOutput: boolean;
112
- }>;
113
- onDidStateChange: import("../../../../../base/common/event.js").Event<{
114
- renderOutput: boolean;
115
- }>;
116
- protected _layoutInfo: IDiffElementLayoutInfo;
117
- displayIconToHideUnmodifiedCells?: boolean;
118
- private _hideUnchangedCells;
119
- onHideUnchangedCells: import("../../../../../base/common/event.js").Event<void>;
120
- hideUnchangedCells(): void;
121
- set rawOutputHeight(height: number);
122
- get rawOutputHeight(): number;
123
- set outputStatusHeight(height: number);
124
- get outputStatusHeight(): number;
125
- set outputMetadataHeight(height: number);
126
- get outputMetadataHeight(): number;
127
- set editorHeight(height: number);
128
- get editorHeight(): number;
129
- set editorMargin(margin: number);
130
- get editorMargin(): number;
131
- set metadataStatusHeight(height: number);
132
- get metadataStatusHeight(): number;
133
- set metadataHeight(height: number);
134
- get metadataHeight(): number;
135
- private _renderOutput;
136
- set renderOutput(value: boolean);
137
- get renderOutput(): boolean;
138
- get layoutInfo(): IDiffElementLayoutInfo;
139
- get totalHeight(): number;
140
- protected get ignoreOutputs(): boolean;
141
- protected get ignoreMetadata(): boolean;
142
- private _sourceEditorViewState;
143
- private _outputEditorViewState;
144
- private _metadataEditorViewState;
145
- readonly original: DiffNestedCellViewModel | undefined;
146
- readonly modified: DiffNestedCellViewModel | undefined;
147
- constructor(mainDocumentTextModel: INotebookTextModel, original: NotebookCellTextModel | undefined, modified: NotebookCellTextModel | undefined, type: "unchanged" | "insert" | "delete" | "modified", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: {
148
- metadataStatusHeight: number;
149
- outputStatusHeight: number;
150
- fontInfo: FontInfo | undefined;
151
- }, notebookService: INotebookService, index: number, configurationService: IConfigurationService, diffEditorHeightCalculator: IDiffEditorHeightCalculatorService);
152
- layoutChange(): void;
153
- private _estimateEditorHeight;
154
- protected _layout(delta: ILayoutInfoDelta): void;
155
- getHeight(lineHeight: number): number;
156
- private _computeTotalHeight;
157
- computeInputEditorHeight(lineHeight: number): number;
158
- private _getOutputTotalHeight;
159
- private _fireLayoutChangeEvent;
160
- abstract checkIfInputModified(): false | {
161
- reason: string | undefined;
162
- };
163
- abstract checkIfOutputsModified(): false | {
164
- reason: string | undefined;
165
- };
166
- abstract checkMetadataIfModified(): false | {
167
- reason: string | undefined;
168
- };
169
- abstract isOutputEmpty(): boolean;
170
- abstract getRichOutputTotalHeight(): number;
171
- abstract getCellByUri(cellUri: URI): IGenericCellViewModel;
172
- abstract getOutputOffsetInCell(diffSide: DiffSide, index: number): number;
173
- abstract getOutputOffsetInContainer(diffSide: DiffSide, index: number): number;
174
- abstract updateOutputHeight(diffSide: DiffSide, index: number, height: number): void;
175
- abstract getNestedCellViewModel(diffSide: DiffSide): DiffNestedCellViewModel;
176
- getComputedCellContainerWidth(layoutInfo: NotebookLayoutInfo, diffEditor: boolean, fullWidth: boolean): number;
177
- getOutputEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null;
178
- saveOutputEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void;
179
- getMetadataEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null;
180
- saveMetadataEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void;
181
- getSourceEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null;
182
- saveSpirceEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void;
183
- }
184
- export declare class SideBySideDiffElementViewModel extends DiffElementCellViewModelBase {
185
- readonly otherDocumentTextModel: NotebookTextModel;
186
- get originalDocument(): NotebookTextModel;
187
- get modifiedDocument(): INotebookTextModel;
188
- readonly original: DiffNestedCellViewModel;
189
- readonly modified: DiffNestedCellViewModel;
190
- readonly type: "unchanged" | "modified";
191
- /**
192
- * The height of the editor when the unchanged lines are collapsed.
193
- */
194
- private editorHeightWithUnchangedLinesCollapsed?;
195
- constructor(mainDocumentTextModel: NotebookTextModel, otherDocumentTextModel: NotebookTextModel, original: NotebookCellTextModel, modified: NotebookCellTextModel, type: "unchanged" | "modified", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: {
196
- metadataStatusHeight: number;
197
- outputStatusHeight: number;
198
- fontInfo: FontInfo | undefined;
199
- }, notebookService: INotebookService, configurationService: IConfigurationService, index: number, diffEditorHeightCalculator: IDiffEditorHeightCalculatorService);
200
- checkIfInputModified(): false | {
201
- reason: string | undefined;
202
- };
203
- checkIfOutputsModified(): false | {
204
- reason: string | undefined;
205
- kind: OutputComparison;
206
- };
207
- checkMetadataIfModified(): false | {
208
- reason: undefined;
209
- };
210
- updateOutputHeight(diffSide: DiffSide, index: number, height: number): void;
211
- getOutputOffsetInContainer(diffSide: DiffSide, index: number): number;
212
- getOutputOffsetInCell(diffSide: DiffSide, index: number): number;
213
- isOutputEmpty(): boolean;
214
- getRichOutputTotalHeight(): number;
215
- getNestedCellViewModel(diffSide: DiffSide): DiffNestedCellViewModel;
216
- getCellByUri(cellUri: URI): IGenericCellViewModel;
217
- computeInputEditorHeight(lineHeight: number): number;
218
- private computeModifiedInputEditorHeight;
219
- private computeModifiedMetadataEditorHeight;
220
- computeEditorHeights(): Promise<void>;
221
- }
222
- export declare class SingleSideDiffElementViewModel extends DiffElementCellViewModelBase {
223
- readonly otherDocumentTextModel: NotebookTextModel;
224
- get cellViewModel(): DiffNestedCellViewModel;
225
- get originalDocument(): NotebookTextModel | INotebookTextModel;
226
- get modifiedDocument(): NotebookTextModel | INotebookTextModel;
227
- readonly type: "insert" | "delete";
228
- constructor(mainDocumentTextModel: NotebookTextModel, otherDocumentTextModel: NotebookTextModel, original: NotebookCellTextModel | undefined, modified: NotebookCellTextModel | undefined, type: "insert" | "delete", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: {
229
- metadataStatusHeight: number;
230
- outputStatusHeight: number;
231
- fontInfo: FontInfo | undefined;
232
- }, notebookService: INotebookService, configurationService: IConfigurationService, diffEditorHeightCalculator: IDiffEditorHeightCalculatorService, index: number);
233
- checkIfInputModified(): false | {
234
- reason: string | undefined;
235
- };
236
- getNestedCellViewModel(diffSide: DiffSide): DiffNestedCellViewModel;
237
- checkIfOutputsModified(): false | {
238
- reason: string | undefined;
239
- };
240
- checkMetadataIfModified(): false | {
241
- reason: string | undefined;
242
- };
243
- updateOutputHeight(diffSide: DiffSide, index: number, height: number): void;
244
- getOutputOffsetInContainer(diffSide: DiffSide, index: number): number;
245
- getOutputOffsetInCell(diffSide: DiffSide, index: number): number;
246
- isOutputEmpty(): boolean;
247
- getRichOutputTotalHeight(): number;
248
- getCellByUri(cellUri: URI): IGenericCellViewModel;
249
- }
250
- export declare enum OutputComparison {
251
- Unchanged = 0,
252
- Metadata = 1,
253
- Other = 2
254
- }
255
- export declare function outputEqual(a: ICellOutput, b: ICellOutput): OutputComparison;
256
- export declare function getStreamOutputData(outputs: IOutputItemDto[]): string | null;
257
- export declare function getFormattedOutputJSON(outputs: IOutputDto[]): string;
258
- export {};