import * as React from 'react'; import { IThemeManager } from '@jupyterlab/apputils'; import { Git } from '@jupyterlab/git'; import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; import { Contents } from '@jupyterlab/services'; import type { TranslationBundle } from '@jupyterlab/translation'; import { ReactWidget } from '@jupyterlab/ui-components'; import { ISignal } from '@lumino/signaling'; import { Widget } from '@lumino/widgets'; import type { IAskAgent } from '../askAgent/tokens'; import { DIFF_WIDGET_CSS_CLASS, type DiffStyle, type NotebookDiffViewMode } from './diffSurface'; export { DIFF_WIDGET_CSS_CLASS }; /** * `Git.Diff.IModel` plus optional xtralab-only metadata. */ export interface IXtralabDiffModel extends Git.Diff.IModel { isBinary?: boolean; canDiscard?: boolean; oldFilename?: string; } /** * Application-level services the diff model does not carry. */ export interface IXtralabDiffContext { contentsManager: Contents.IManager; rendermime: IRenderMimeRegistry | null; themeManager: IThemeManager | null; /** * The ask-agent popup; when available, diff line selections get an * "ask an agent about these lines" gutter button. */ askAgent: IAskAgent | null; trans: TranslationBundle; } /** * Shared diff widget used by the launcher and by `jupyterlab-git`. */ export declare class XtralabDiffWidget extends ReactWidget implements Git.Diff.IDiffWidget { constructor(model: Git.Diff.IModel, context: IXtralabDiffContext); get model(): Git.Diff.IModel; /** * Swap the rendered model when the launcher reuses its preview tab. */ setModel(model: IXtralabDiffModel): void; /** * This renderer has no merge editor, so it never blocks mark-as-resolved. */ get isFileResolved(): boolean; /** * Return the content jupyterlab-git should save for mark-as-resolved. */ getResolvedFile(): Promise>; /** * Re-pull both sides of the model and re-render. */ refresh(): Promise; get notebookViewMode(): NotebookDiffViewMode; setNotebookViewMode(mode: NotebookDiffViewMode): void; get notebookViewModeChanged(): ISignal; get hasNotebookView(): boolean; setHasNotebookView(value: boolean): void; get hasNotebookViewChanged(): ISignal; get diffStyle(): DiffStyle; setDiffStyle(style: DiffStyle): void; get diffStyleChanged(): ISignal; /** * Whether the Split/Unified toolbar selector currently applies. */ get fileDiffActive(): boolean; setFileDiffActive(value: boolean): void; get fileDiffActiveChanged(): ISignal; /** * Emitted when a post-discard reload leaves the diff with no hunks. */ get emptied(): ISignal; notifyEmptied(): void; settleRefresh(): void; dispose(): void; get reloadNonce(): number; get context(): IXtralabDiffContext; protected render(): React.ReactElement; private _model; private _context; private _reloadNonce; private _pendingRefresh; private _notebookViewMode; private _notebookViewModeChanged; private _hasNotebookView; private _hasNotebookViewChanged; private _diffStyle; private _diffStyleChanged; private _fileDiffActive; private _fileDiffActiveChanged; private _emptied; } /** * Structural toolbar type shared across host package boundaries. */ interface IDiffToolbar { addItem(name: string, widget: Widget): boolean; } /** * Mount the shared diff toolbar controls into a host-owned toolbar. */ export declare function addDiffToolbarItems(toolbar: IDiffToolbar, widget: XtralabDiffWidget): void;