Mark most webview message properties are readonly

This commit is contained in:
Matt Bierner 2021-06-08 12:22:11 -07:00
parent f3f1b226c5
commit 0db94f5278
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -11,62 +11,62 @@ interface BaseToWebviewMessage {
}
export interface WebviewIntialized extends BaseToWebviewMessage {
type: 'initialized';
readonly type: 'initialized';
}
export interface DimensionUpdate {
id: string;
init?: boolean;
height: number;
isOutput?: boolean;
readonly id: string;
readonly init?: boolean;
readonly height: number;
readonly isOutput?: boolean;
}
export interface IDimensionMessage extends BaseToWebviewMessage {
type: 'dimension';
updates: readonly DimensionUpdate[];
readonly type: 'dimension';
readonly updates: readonly DimensionUpdate[];
}
export interface IMouseEnterMessage extends BaseToWebviewMessage {
type: 'mouseenter';
id: string;
readonly type: 'mouseenter';
readonly id: string;
}
export interface IMouseLeaveMessage extends BaseToWebviewMessage {
type: 'mouseleave';
id: string;
readonly type: 'mouseleave';
readonly id: string;
}
export interface IOutputFocusMessage extends BaseToWebviewMessage {
type: 'outputFocus';
id: string;
readonly type: 'outputFocus';
readonly id: string;
}
export interface IOutputBlurMessage extends BaseToWebviewMessage {
type: 'outputBlur';
id: string;
readonly type: 'outputBlur';
readonly id: string;
}
export interface IWheelMessage extends BaseToWebviewMessage {
type: 'did-scroll-wheel';
payload: any;
readonly type: 'did-scroll-wheel';
readonly payload: any;
}
export interface IScrollAckMessage extends BaseToWebviewMessage {
type: 'scroll-ack';
data: { top: number; };
version: number;
readonly type: 'scroll-ack';
readonly data: { top: number; };
readonly version: number;
}
export interface IBlurOutputMessage extends BaseToWebviewMessage {
type: 'focus-editor';
id: string;
focusNext?: boolean;
readonly type: 'focus-editor';
readonly id: string;
readonly focusNext?: boolean;
}
export interface IClickedDataUrlMessage extends BaseToWebviewMessage {
type: 'clicked-data-url';
data: string | ArrayBuffer | null;
downloadName?: string;
readonly type: 'clicked-data-url';
readonly data: string | ArrayBuffer | null;
readonly downloadName?: string;
}
export interface IClickMarkdownPreviewMessage extends BaseToWebviewMessage {
@ -86,28 +86,28 @@ export interface IContextMenuMarkdownPreviewMessage extends BaseToWebviewMessage
}
export interface IMouseEnterMarkdownPreviewMessage extends BaseToWebviewMessage {
type: 'mouseEnterMarkdownPreview';
cellId: string;
readonly type: 'mouseEnterMarkdownPreview';
readonly cellId: string;
}
export interface IMouseLeaveMarkdownPreviewMessage extends BaseToWebviewMessage {
type: 'mouseLeaveMarkdownPreview';
cellId: string;
readonly type: 'mouseLeaveMarkdownPreview';
readonly cellId: string;
}
export interface IToggleMarkdownPreviewMessage extends BaseToWebviewMessage {
type: 'toggleMarkdownPreview';
cellId: string;
readonly type: 'toggleMarkdownPreview';
readonly cellId: string;
}
export interface ICellDragStartMessage extends BaseToWebviewMessage {
type: 'cell-drag-start';
readonly type: 'cell-drag-start';
readonly cellId: string;
readonly dragOffsetY: number;
}
export interface ICellDragMessage extends BaseToWebviewMessage {
type: 'cell-drag';
readonly type: 'cell-drag';
readonly cellId: string;
readonly dragOffsetY: number;
}
@ -139,150 +139,149 @@ export interface ITelemetryFoundUnrenderedMarkdownMath extends BaseToWebviewMess
}
export interface IClearMessage {
type: 'clear';
readonly type: 'clear';
}
export interface IOutputRequestMetadata {
/**
* Additional attributes of a cell metadata.
*/
custom?: { [key: string]: unknown; };
readonly custom?: { [key: string]: unknown; };
}
export interface IOutputRequestDto {
/**
* { mime_type: value }
*/
data: { [key: string]: unknown; };
readonly data: { [key: string]: unknown; };
metadata?: IOutputRequestMetadata;
outputId: string;
readonly metadata?: IOutputRequestMetadata;
readonly outputId: string;
}
export interface ICreationRequestMessage {
type: 'html';
content: { type: RenderOutputType.Html; htmlContent: string; } |
readonly type: 'html';
readonly content: { type: RenderOutputType.Html; htmlContent: string; } |
{ type: RenderOutputType.Extension; outputId: string; valueBytes: Uint8Array; metadata: unknown; metadata2: unknown; mimeType: string; };
cellId: string;
outputId: string;
readonly cellId: string;
readonly outputId: string;
cellTop: number;
outputOffset: number;
left: number;
requiredPreloads: ReadonlyArray<IControllerPreload>;
readonly left: number;
readonly requiredPreloads: ReadonlyArray<IControllerPreload>;
readonly initiallyHidden?: boolean;
rendererId?: string | undefined;
readonly rendererId?: string | undefined;
}
export interface IContentWidgetTopRequest {
outputId: string;
cellTop: number;
outputOffset: number;
forceDisplay: boolean;
readonly outputId: string;
readonly cellTop: number;
readonly outputOffset: number;
readonly forceDisplay: boolean;
}
export interface IViewScrollTopRequestMessage {
type: 'view-scroll';
widgets: IContentWidgetTopRequest[];
markdownPreviews: { id: string; top: number; }[];
readonly type: 'view-scroll';
readonly widgets: IContentWidgetTopRequest[];
readonly markdownPreviews: { id: string; top: number; }[];
}
export interface IScrollRequestMessage {
type: 'scroll';
id: string;
top: number;
widgetTop?: number;
version: number;
readonly type: 'scroll';
readonly id: string;
readonly top: number;
readonly widgetTop?: number;
readonly version: number;
}
export interface IClearOutputRequestMessage {
type: 'clearOutput';
cellId: string;
outputId: string;
cellUri: string;
rendererId: string | undefined;
readonly type: 'clearOutput';
readonly cellId: string;
readonly outputId: string;
readonly cellUri: string;
readonly rendererId: string | undefined;
}
export interface IHideOutputMessage {
type: 'hideOutput';
outputId: string;
cellId: string;
readonly type: 'hideOutput';
readonly outputId: string;
readonly cellId: string;
}
export interface IShowOutputMessage {
type: 'showOutput';
cellId: string;
outputId: string;
cellTop: number;
outputOffset: number;
readonly type: 'showOutput';
readonly cellId: string;
readonly outputId: string;
readonly cellTop: number;
readonly outputOffset: number;
}
export interface IFocusOutputMessage {
type: 'focus-output';
cellId: string;
readonly type: 'focus-output';
readonly cellId: string;
}
export interface IAckOutputHeightMessage {
type: 'ack-dimension';
cellId: string;
outputId: string;
height: number;
readonly type: 'ack-dimension';
readonly cellId: string;
readonly outputId: string;
readonly height: number;
}
export interface IControllerPreload {
originalUri: string;
uri: string;
readonly originalUri: string;
readonly uri: string;
}
export interface IUpdateControllerPreloadsMessage {
type: 'preload';
resources: IControllerPreload[];
readonly type: 'preload';
readonly resources: IControllerPreload[];
}
export interface IUpdateDecorationsMessage {
type: 'decorations';
cellId: string;
addedClassNames: string[];
removedClassNames: string[];
readonly type: 'decorations';
readonly cellId: string;
readonly addedClassNames: string[];
readonly removedClassNames: string[];
}
export interface ICustomKernelMessage extends BaseToWebviewMessage {
type: 'customKernelMessage';
message: unknown;
readonly type: 'customKernelMessage';
readonly message: unknown;
}
export interface ICustomRendererMessage extends BaseToWebviewMessage {
type: 'customRendererMessage';
rendererId: string;
message: unknown;
readonly type: 'customRendererMessage';
readonly rendererId: string;
readonly message: unknown;
}
export interface ICreateMarkupCellMessage {
type: 'createMarkupCell';
cell: IMarkdownCellInitialization;
readonly type: 'createMarkupCell';
readonly cell: IMarkdownCellInitialization;
}
export interface IDeleteMarkupCellMessage {
type: 'deleteMarkupCell';
ids: readonly string[];
readonly type: 'deleteMarkupCell';
readonly ids: readonly string[];
}
export interface IHideMarkupCellMessage {
type: 'hideMarkupCells';
ids: readonly string[];
readonly type: 'hideMarkupCells';
readonly ids: readonly string[];
}
export interface IUnhideMarkupCellMessage {
type: 'unhideMarkupCells';
ids: readonly string[];
readonly type: 'unhideMarkupCells';
readonly ids: readonly string[];
}
export interface IShowMarkupCellMessage {
type: 'showMarkupCell';
id: string;
handle: number;
content: string | undefined;
top: number;
readonly type: 'showMarkupCell';
readonly id: string;
readonly handle: number;
readonly content: string | undefined;
readonly top: number;
}
export interface IUpdateSelectedMarkupCellsMessage {
@ -299,20 +298,20 @@ export interface IMarkdownCellInitialization {
}
export interface IInitializeMarkupCells {
type: 'initializeMarkup';
cells: ReadonlyArray<IMarkdownCellInitialization>;
readonly type: 'initializeMarkup';
readonly cells: ReadonlyArray<IMarkdownCellInitialization>;
}
export interface INotebookStylesMessage {
type: 'notebookStyles';
styles: {
readonly type: 'notebookStyles';
readonly styles: {
[key: string]: string;
};
}
export interface INotebookOptionsMessage {
type: 'notebookOptions';
options: PreloadOptions;
readonly type: 'notebookOptions';
readonly options: PreloadOptions;
}
export type FromWebviewMessage = WebviewIntialized |