import { Emitter } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { FontInfo } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/config/fontInfo"; import * as editorCommon from "@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon"; import { DiffNestedCellViewModel } from "./diffNestedCellViewModel.js"; import { NotebookDiffEditorEventDispatcher } from "./eventDispatcher.js"; import { CellDiffViewModelLayoutChangeEvent, DiffSide, IDiffElementLayoutInfo } from "./notebookDiffEditorBrowser.js"; import { IGenericCellViewModel } from "@codingame/monaco-vscode-9d2c06d1-1f89-51a5-9964-aa01fe50c198-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser"; import { NotebookLayoutInfo } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookViewEvents"; import { NotebookCellTextModel } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel"; import { NotebookTextModel } from "@codingame/monaco-vscode-notebook-service-override/vscode/vs/workbench/contrib/notebook/common/model/notebookTextModel"; import { ICellOutput, INotebookTextModel, IOutputDto, IOutputItemDto } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon"; import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IDiffEditorHeightCalculatorService } from "./editorHeightCalculator.js"; import { NotebookDocumentMetadataTextModel } from "../../common/model/notebookMetadataTextModel.js"; export declare const HeightOfHiddenLinesRegionInDiffEditor = 24; export declare const DefaultLineHeight = 17; export declare enum PropertyFoldingState { Expanded = 0, Collapsed = 1 } export declare const OUTPUT_EDITOR_HEIGHT_MAGIC = 1440; type ILayoutInfoDelta0 = { [K in keyof IDiffElementLayoutInfo]?: number; }; interface ILayoutInfoDelta extends ILayoutInfoDelta0 { rawOutputHeight?: number; recomputeOutput?: boolean; } export type IDiffElementViewModelBase = DiffElementCellViewModelBase | DiffElementPlaceholderViewModel | NotebookDocumentMetadataViewModel; export declare abstract class DiffElementViewModelBase extends Disposable { readonly mainDocumentTextModel: INotebookTextModel; readonly editorEventDispatcher: NotebookDiffEditorEventDispatcher; readonly initData: { metadataStatusHeight: number; outputStatusHeight: number; fontInfo: FontInfo | undefined; }; protected _layoutInfoEmitter: Emitter; onDidLayoutChange: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; abstract renderOutput: boolean; constructor(mainDocumentTextModel: INotebookTextModel, editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: { metadataStatusHeight: number; outputStatusHeight: number; fontInfo: FontInfo | undefined; }); abstract layoutChange(): void; abstract getHeight(lineHeight: number): number; abstract get totalHeight(): number; } export declare class DiffElementPlaceholderViewModel extends DiffElementViewModelBase { readonly type: "placeholder"; hiddenCells: DiffElementCellViewModelBase[]; protected _unfoldHiddenCells: Emitter; onUnfoldHiddenCells: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; renderOutput: boolean; constructor(mainDocumentTextModel: INotebookTextModel, editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: { metadataStatusHeight: number; outputStatusHeight: number; fontInfo: FontInfo | undefined; }); get totalHeight(): number; getHeight(_: number): number; layoutChange(): void; showHiddenCells(): void; } export declare class NotebookDocumentMetadataViewModel extends DiffElementViewModelBase { readonly originalDocumentTextModel: INotebookTextModel; readonly modifiedDocumentTextModel: INotebookTextModel; readonly type: "unchangedMetadata" | "modifiedMetadata"; private readonly editorHeightCalculator; readonly originalMetadata: NotebookDocumentMetadataTextModel; readonly modifiedMetadata: NotebookDocumentMetadataTextModel; cellFoldingState: PropertyFoldingState; protected _layoutInfo: IDiffElementLayoutInfo; renderOutput: boolean; set editorHeight(height: number); get editorHeight(): number; set editorMargin(margin: number); get editorMargin(): number; get layoutInfo(): IDiffElementLayoutInfo; get totalHeight(): number; private _sourceEditorViewState; constructor(originalDocumentTextModel: INotebookTextModel, modifiedDocumentTextModel: INotebookTextModel, type: "unchangedMetadata" | "modifiedMetadata", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: { metadataStatusHeight: number; outputStatusHeight: number; fontInfo: FontInfo | undefined; }, notebookService: INotebookService, editorHeightCalculator: IDiffEditorHeightCalculatorService); computeHeights(): Promise; layoutChange(): void; protected _layout(delta: ILayoutInfoDelta): void; getHeight(lineHeight: number): number; private _computeTotalHeight; computeInputEditorHeight(_lineHeight: number): number; private _fireLayoutChangeEvent; getComputedCellContainerWidth(layoutInfo: NotebookLayoutInfo, diffEditor: boolean, fullWidth: boolean): number; getSourceEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null; saveSpirceEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void; } export declare abstract class DiffElementCellViewModelBase extends DiffElementViewModelBase { readonly type: "unchanged" | "insert" | "delete" | "modified"; readonly index: number; private readonly configurationService; readonly diffEditorHeightCalculator: IDiffEditorHeightCalculatorService; cellFoldingState: PropertyFoldingState; metadataFoldingState: PropertyFoldingState; outputFoldingState: PropertyFoldingState; protected _stateChangeEmitter: Emitter<{ renderOutput: boolean; }>; onDidStateChange: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<{ renderOutput: boolean; }>; protected _layoutInfo: IDiffElementLayoutInfo; displayIconToHideUnmodifiedCells?: boolean; private _hideUnchangedCells; onHideUnchangedCells: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; hideUnchangedCells(): void; set rawOutputHeight(height: number); get rawOutputHeight(): number; set outputStatusHeight(height: number); get outputStatusHeight(): number; set outputMetadataHeight(height: number); get outputMetadataHeight(): number; set editorHeight(height: number); get editorHeight(): number; set editorMargin(margin: number); get editorMargin(): number; set metadataStatusHeight(height: number); get metadataStatusHeight(): number; set metadataHeight(height: number); get metadataHeight(): number; private _renderOutput; set renderOutput(value: boolean); get renderOutput(): boolean; get layoutInfo(): IDiffElementLayoutInfo; get totalHeight(): number; protected get ignoreOutputs(): boolean; protected get ignoreMetadata(): boolean; private _sourceEditorViewState; private _outputEditorViewState; private _metadataEditorViewState; readonly original: DiffNestedCellViewModel | undefined; readonly modified: DiffNestedCellViewModel | undefined; constructor(mainDocumentTextModel: INotebookTextModel, original: NotebookCellTextModel | undefined, modified: NotebookCellTextModel | undefined, type: "unchanged" | "insert" | "delete" | "modified", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: { metadataStatusHeight: number; outputStatusHeight: number; fontInfo: FontInfo | undefined; }, notebookService: INotebookService, index: number, configurationService: IConfigurationService, diffEditorHeightCalculator: IDiffEditorHeightCalculatorService); layoutChange(): void; private _estimateEditorHeight; protected _layout(delta: ILayoutInfoDelta): void; getHeight(lineHeight: number): number; private _computeTotalHeight; computeInputEditorHeight(lineHeight: number): number; private _getOutputTotalHeight; private _fireLayoutChangeEvent; abstract checkIfInputModified(): false | { reason: string | undefined; }; abstract checkIfOutputsModified(): false | { reason: string | undefined; }; abstract checkMetadataIfModified(): false | { reason: string | undefined; }; abstract isOutputEmpty(): boolean; abstract getRichOutputTotalHeight(): number; abstract getCellByUri(cellUri: URI): IGenericCellViewModel; abstract getOutputOffsetInCell(diffSide: DiffSide, index: number): number; abstract getOutputOffsetInContainer(diffSide: DiffSide, index: number): number; abstract updateOutputHeight(diffSide: DiffSide, index: number, height: number): void; abstract getNestedCellViewModel(diffSide: DiffSide): DiffNestedCellViewModel; getComputedCellContainerWidth(layoutInfo: NotebookLayoutInfo, diffEditor: boolean, fullWidth: boolean): number; getOutputEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null; saveOutputEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void; getMetadataEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null; saveMetadataEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void; getSourceEditorViewState(): editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null; saveSpirceEditorViewState(viewState: editorCommon.ICodeEditorViewState | editorCommon.IDiffEditorViewState | null): void; } export declare class SideBySideDiffElementViewModel extends DiffElementCellViewModelBase { readonly otherDocumentTextModel: NotebookTextModel; get originalDocument(): NotebookTextModel; get modifiedDocument(): INotebookTextModel; readonly original: DiffNestedCellViewModel; readonly modified: DiffNestedCellViewModel; readonly type: "unchanged" | "modified"; /** * The height of the editor when the unchanged lines are collapsed. */ private editorHeightWithUnchangedLinesCollapsed?; constructor(mainDocumentTextModel: NotebookTextModel, otherDocumentTextModel: NotebookTextModel, original: NotebookCellTextModel, modified: NotebookCellTextModel, type: "unchanged" | "modified", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: { metadataStatusHeight: number; outputStatusHeight: number; fontInfo: FontInfo | undefined; }, notebookService: INotebookService, configurationService: IConfigurationService, index: number, diffEditorHeightCalculator: IDiffEditorHeightCalculatorService); checkIfInputModified(): false | { reason: string | undefined; }; checkIfOutputsModified(): false | { reason: string | undefined; kind: OutputComparison; }; checkMetadataIfModified(): false | { reason: undefined; }; updateOutputHeight(diffSide: DiffSide, index: number, height: number): void; getOutputOffsetInContainer(diffSide: DiffSide, index: number): number; getOutputOffsetInCell(diffSide: DiffSide, index: number): number; isOutputEmpty(): boolean; getRichOutputTotalHeight(): number; getNestedCellViewModel(diffSide: DiffSide): DiffNestedCellViewModel; getCellByUri(cellUri: URI): IGenericCellViewModel; computeInputEditorHeight(lineHeight: number): number; private computeModifiedInputEditorHeight; private computeModifiedMetadataEditorHeight; computeEditorHeights(): Promise; } export declare class SingleSideDiffElementViewModel extends DiffElementCellViewModelBase { readonly otherDocumentTextModel: NotebookTextModel; get cellViewModel(): DiffNestedCellViewModel; get originalDocument(): NotebookTextModel | INotebookTextModel; get modifiedDocument(): NotebookTextModel | INotebookTextModel; readonly type: "insert" | "delete"; constructor(mainDocumentTextModel: NotebookTextModel, otherDocumentTextModel: NotebookTextModel, original: NotebookCellTextModel | undefined, modified: NotebookCellTextModel | undefined, type: "insert" | "delete", editorEventDispatcher: NotebookDiffEditorEventDispatcher, initData: { metadataStatusHeight: number; outputStatusHeight: number; fontInfo: FontInfo | undefined; }, notebookService: INotebookService, configurationService: IConfigurationService, diffEditorHeightCalculator: IDiffEditorHeightCalculatorService, index: number); checkIfInputModified(): false | { reason: string | undefined; }; getNestedCellViewModel(diffSide: DiffSide): DiffNestedCellViewModel; checkIfOutputsModified(): false | { reason: string | undefined; }; checkMetadataIfModified(): false | { reason: string | undefined; }; updateOutputHeight(diffSide: DiffSide, index: number, height: number): void; getOutputOffsetInContainer(diffSide: DiffSide, index: number): number; getOutputOffsetInCell(diffSide: DiffSide, index: number): number; isOutputEmpty(): boolean; getRichOutputTotalHeight(): number; getCellByUri(cellUri: URI): IGenericCellViewModel; } export declare enum OutputComparison { Unchanged = 0, Metadata = 1, Other = 2 } export declare function outputEqual(a: ICellOutput, b: ICellOutput): OutputComparison; export declare function getStreamOutputData(outputs: IOutputItemDto[]): string | null; export declare function getFormattedOutputJSON(outputs: IOutputDto[]): string; export {};