Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { FontInfo } from '../../../../editor/common/config/fontInfo.js';
7
import { NotebookCellTextModel } from '../common/model/notebookCellTextModel.js';
8
import { NotebookDocumentMetadata } from '../common/notebookCommon.js';
9
10
export interface NotebookLayoutInfo {
11
width: number;
12
height: number;
13
scrollHeight: number;
14
fontInfo: FontInfo;
15
stickyHeight: number;
16
listViewOffsetTop: number;
17
}
18
19
export interface CellViewModelStateChangeEvent {
20
readonly metadataChanged?: boolean;
21
readonly internalMetadataChanged?: boolean;
22
readonly selectionChanged?: boolean;
23
readonly focusModeChanged?: boolean;
24
readonly editStateChanged?: boolean;
25
readonly languageChanged?: boolean;
26
readonly foldingStateChanged?: boolean;
27
readonly contentChanged?: boolean;
28
readonly outputIsHoveredChanged?: boolean;
29
readonly outputIsFocusedChanged?: boolean;
30
readonly cellIsHoveredChanged?: boolean;
31
readonly cellLineNumberChanged?: boolean;
32
readonly inputCollapsedChanged?: boolean;
33
readonly outputCollapsedChanged?: boolean;
34
readonly dragStateChanged?: boolean;
35
}
36
37
export interface NotebookLayoutChangeEvent {
38
width?: boolean;
39
height?: boolean;
40
fontInfo?: boolean;
41
}
42
43
export enum NotebookViewEventType {
44
LayoutChanged = 1,
45
MetadataChanged = 2,
46
CellStateChanged = 3
47
}
48
49
export class NotebookLayoutChangedEvent {
50
public readonly type = NotebookViewEventType.LayoutChanged;
51
52
constructor(readonly source: NotebookLayoutChangeEvent, readonly value: NotebookLayoutInfo) {
53
54
}
55
}
56
57
58
export class NotebookMetadataChangedEvent {
59
public readonly type = NotebookViewEventType.MetadataChanged;
60
61
constructor(readonly source: NotebookDocumentMetadata) {
62
63
}
64
}
65
66
export class NotebookCellStateChangedEvent {
67
public readonly type = NotebookViewEventType.CellStateChanged;
68
69
constructor(readonly source: CellViewModelStateChangeEvent, readonly cell: NotebookCellTextModel) {
70
71
}
72
}
73
74
export type NotebookViewEvent = NotebookLayoutChangedEvent | NotebookMetadataChangedEvent | NotebookCellStateChangedEvent;
75
76