@vscode/markdown-editor 0.0.2-0 → 0.0.2-2
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.
- package/dist/_observables/assert.d.ts +2 -0
- package/dist/_observables/deps.d.ts +28 -0
- package/dist/_observables/disposables.d.ts +19 -0
- package/dist/_observables/equals.d.ts +32 -0
- package/dist/_observables/index.d.ts +2 -0
- package/dist/_observables/observableInternal/base.d.ts +172 -0
- package/dist/_observables/observableInternal/changeTracker.d.ts +44 -0
- package/dist/_observables/observableInternal/commonFacade/cancellation.d.ts +24 -0
- package/dist/_observables/observableInternal/commonFacade/deps.d.ts +24 -0
- package/dist/_observables/observableInternal/debugLocation.d.ts +21 -0
- package/dist/_observables/observableInternal/debugName.d.ts +33 -0
- package/dist/_observables/observableInternal/experimental/deferUnobserve.d.ts +16 -0
- package/dist/_observables/observableInternal/experimental/reducer.d.ts +37 -0
- package/dist/_observables/observableInternal/experimental/utils.d.ts +15 -0
- package/dist/_observables/observableInternal/index.d.ts +25 -0
- package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +40 -0
- package/dist/_observables/observableInternal/logging/debugGetDependencyGraph.d.ts +4 -0
- package/dist/_observables/observableInternal/logging/debugger/debuggerRpc.d.ts +4 -0
- package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +43 -0
- package/dist/_observables/observableInternal/logging/debugger/rpc.d.ts +41 -0
- package/dist/_observables/observableInternal/logging/debugger/utils.d.ts +13 -0
- package/dist/_observables/observableInternal/logging/logging.d.ts +30 -0
- package/dist/_observables/observableInternal/map.d.ts +18 -0
- package/dist/_observables/observableInternal/observables/baseObservable.d.ts +58 -0
- package/dist/_observables/observableInternal/observables/constObservable.d.ts +5 -0
- package/dist/_observables/observableInternal/observables/derived.d.ts +46 -0
- package/dist/_observables/observableInternal/observables/derivedImpl.d.ts +83 -0
- package/dist/_observables/observableInternal/observables/lazyObservableValue.d.ts +27 -0
- package/dist/_observables/observableInternal/observables/observableFromEvent.d.ts +37 -0
- package/dist/_observables/observableInternal/observables/observableSignal.d.ts +11 -0
- package/dist/_observables/observableInternal/observables/observableSignalFromEvent.d.ts +5 -0
- package/dist/_observables/observableInternal/observables/observableValue.d.ts +37 -0
- package/dist/_observables/observableInternal/observables/observableValueOpts.d.ts +8 -0
- package/dist/_observables/observableInternal/reactions/autorun.d.ts +56 -0
- package/dist/_observables/observableInternal/reactions/autorunImpl.d.ts +53 -0
- package/dist/_observables/observableInternal/set.d.ts +17 -0
- package/dist/_observables/observableInternal/transaction.d.ts +27 -0
- package/dist/_observables/observableInternal/utils/promise.d.ts +75 -0
- package/dist/_observables/observableInternal/utils/runOnChange.d.ts +7 -0
- package/dist/_observables/observableInternal/utils/utils.d.ts +43 -0
- package/dist/_observables/observableInternal/utils/utilsCancellation.d.ts +10 -0
- package/dist/_observables/observableInternal/utils/valueWithChangeEvent.d.ts +10 -0
- package/dist/_observables/utils.d.ts +15 -0
- package/dist/index.d.ts +1769 -6
- package/dist/observables.d.ts +4 -1
- package/package.json +1 -1
- package/dist/commands/cursorCommands.d.ts +0 -13
- package/dist/commands/editCommands.d.ts +0 -14
- package/dist/commands/index.d.ts +0 -4
- package/dist/commands/selectionCommands.d.ts +0 -6
- package/dist/commands/types.d.ts +0 -26
- package/dist/core/geometry.d.ts +0 -37
- package/dist/core/index.d.ts +0 -8
- package/dist/core/lengthEdit.d.ts +0 -38
- package/dist/core/offsetRange.d.ts +0 -26
- package/dist/core/selection.d.ts +0 -13
- package/dist/core/sourceOffset.d.ts +0 -1
- package/dist/core/stringEdit.d.ts +0 -27
- package/dist/core/stringValue.d.ts +0 -8
- package/dist/core/wordUtils.d.ts +0 -6
- package/dist/highlighter/defaultMonacoSyntaxHighlighter.d.ts +0 -20
- package/dist/highlighter/index.d.ts +0 -3
- package/dist/highlighter/monacoSyntaxHighlighter.d.ts +0 -38
- package/dist/highlighter/syntaxHighlighter.d.ts +0 -67
- package/dist/model/cursorNavigation.d.ts +0 -7
- package/dist/model/editorModel.d.ts +0 -54
- package/dist/model/index.d.ts +0 -4
- package/dist/model/measuredLayoutModel.d.ts +0 -50
- package/dist/parser/_micromarkAdapter.d.ts +0 -7
- package/dist/parser/ast.d.ts +0 -274
- package/dist/parser/index.d.ts +0 -4
- package/dist/parser/parse.d.ts +0 -2
- package/dist/parser/parser.d.ts +0 -14
- package/dist/parser/reconcile.d.ts +0 -33
- package/dist/parser/test/getAnnotatedSource.d.ts +0 -2
- package/dist/parser/test/snapshot.d.ts +0 -9
- package/dist/parser/visualizeAst.d.ts +0 -33
- package/dist/test/random.d.ts +0 -16
- package/dist/view/content/blockView.d.ts +0 -179
- package/dist/view/content/documentView.d.ts +0 -41
- package/dist/view/content/dom.d.ts +0 -16
- package/dist/view/content/katexEditableIdentifiers.d.ts +0 -36
- package/dist/view/content/viewNode.d.ts +0 -93
- package/dist/view/editorController.d.ts +0 -34
- package/dist/view/editorView.d.ts +0 -100
- package/dist/view/fixture/astViewerView.d.ts +0 -27
- package/dist/view/fixture/cyclingTsHighlighter.d.ts +0 -17
- package/dist/view/fixture/debugColors.d.ts +0 -26
- package/dist/view/fixture/monacoDebugPanel.d.ts +0 -7
- package/dist/view/index.d.ts +0 -9
- package/dist/view/measuredLayoutDebugView.d.ts +0 -70
- package/dist/view/parts/cursorView.d.ts +0 -29
- package/dist/view/parts/selectionView.d.ts +0 -57
- package/dist/view/viewData.d.ts +0 -251
- package/dist/view/visualLineMap.d.ts +0 -157
- package/dist/view/visualizeViewTree.d.ts +0 -5
package/dist/parser/ast.d.ts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { OffsetRange } from '../core/offsetRange.js';
|
|
2
|
-
import { StringEdit } from '../core/stringEdit.js';
|
|
3
|
-
export declare function _resetNodeIds(): void;
|
|
4
|
-
export declare abstract class AstNode {
|
|
5
|
-
abstract readonly kind: string;
|
|
6
|
-
abstract get children(): readonly AstNode[];
|
|
7
|
-
/**
|
|
8
|
-
* A stable identity. Every node has one: it is minted on construction and
|
|
9
|
-
* carried across edits by reconciliation, so a node that survives an edit
|
|
10
|
-
* (even with changed content) keeps the same id.
|
|
11
|
-
*/
|
|
12
|
-
readonly id: number;
|
|
13
|
-
/** Rebuild this node with each child replaced by `map.get(child) ?? child`. */
|
|
14
|
-
abstract mapChildren(map: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
15
|
-
private _length;
|
|
16
|
-
get length(): number;
|
|
17
|
-
/**
|
|
18
|
-
* True when `other` has the same content. Containers compare children *by
|
|
19
|
-
* identity* (`===`): bottom-up reconciliation substitutes reused old
|
|
20
|
-
* instances into the fresh tree first, so equal children already share
|
|
21
|
-
* instances — keeping this O(children), not O(subtree). Leaves have no
|
|
22
|
-
* children, so {@link _localEquals} is their whole comparison.
|
|
23
|
-
*/
|
|
24
|
-
structurallyEqual(other: AstNode): boolean;
|
|
25
|
-
/** Compares only this node's own scalar fields (kind/length already match). */
|
|
26
|
-
protected _localEquals(_other: this): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* A copy of this node that adopts `id`. Reconciliation uses this to carry an
|
|
29
|
-
* old identity onto a node whose content changed. Nodes are immutable value
|
|
30
|
-
* holders, so a shallow prototype copy with `id` overridden is sound.
|
|
31
|
-
*/
|
|
32
|
-
cloneWithId(id: number): this;
|
|
33
|
-
}
|
|
34
|
-
declare abstract class LeafAstNode extends AstNode {
|
|
35
|
-
abstract readonly content: string;
|
|
36
|
-
get children(): readonly AstNode[];
|
|
37
|
-
get length(): number;
|
|
38
|
-
mapChildren(): AstNode;
|
|
39
|
-
}
|
|
40
|
-
/** Real document text (an {@link InlineAstNode}). */
|
|
41
|
-
export declare class TextAstNode extends LeafAstNode {
|
|
42
|
-
readonly content: string;
|
|
43
|
-
readonly kind = "text";
|
|
44
|
-
constructor(content: string);
|
|
45
|
-
protected _localEquals(o: this): boolean;
|
|
46
|
-
}
|
|
47
|
-
/** A semantic syntax marker (heading `#`, fences, brackets, list bullet, …). */
|
|
48
|
-
export declare class MarkerAstNode extends LeafAstNode {
|
|
49
|
-
readonly markerKind: string;
|
|
50
|
-
readonly content: string;
|
|
51
|
-
readonly kind = "marker";
|
|
52
|
-
constructor(markerKind: string, content: string);
|
|
53
|
-
protected _localEquals(o: this): boolean;
|
|
54
|
-
}
|
|
55
|
-
/** Non-semantic syntactic glue: whitespace, padding, table pipes. */
|
|
56
|
-
export declare class GlueAstNode extends LeafAstNode {
|
|
57
|
-
readonly content: string;
|
|
58
|
-
readonly glueKind?: string | undefined;
|
|
59
|
-
readonly kind = "glue";
|
|
60
|
-
constructor(content: string, glueKind?: string | undefined);
|
|
61
|
-
protected _localEquals(o: this): boolean;
|
|
62
|
-
}
|
|
63
|
-
export declare class ThematicBreakAstNode extends AstNode {
|
|
64
|
-
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
65
|
-
readonly kind = "thematicBreak";
|
|
66
|
-
constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
|
|
67
|
-
get children(): readonly AstNode[];
|
|
68
|
-
get marker(): MarkerAstNode | undefined;
|
|
69
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
70
|
-
}
|
|
71
|
-
export type InlineAstNode = TextAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode;
|
|
72
|
-
export declare class StrongAstNode extends AstNode {
|
|
73
|
-
readonly openMarker: MarkerAstNode;
|
|
74
|
-
readonly content: readonly (InlineAstNode | GlueAstNode)[];
|
|
75
|
-
readonly closeMarker: MarkerAstNode;
|
|
76
|
-
readonly kind = "strong";
|
|
77
|
-
constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
|
|
78
|
-
get children(): readonly AstNode[];
|
|
79
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
80
|
-
}
|
|
81
|
-
export declare class EmphasisAstNode extends AstNode {
|
|
82
|
-
readonly openMarker: MarkerAstNode;
|
|
83
|
-
readonly content: readonly (InlineAstNode | GlueAstNode)[];
|
|
84
|
-
readonly closeMarker: MarkerAstNode;
|
|
85
|
-
readonly kind = "emphasis";
|
|
86
|
-
constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
|
|
87
|
-
get children(): readonly AstNode[];
|
|
88
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
89
|
-
}
|
|
90
|
-
export declare class StrikethroughAstNode extends AstNode {
|
|
91
|
-
readonly openMarker: MarkerAstNode;
|
|
92
|
-
readonly content: readonly (InlineAstNode | GlueAstNode)[];
|
|
93
|
-
readonly closeMarker: MarkerAstNode;
|
|
94
|
-
readonly kind = "strikethrough";
|
|
95
|
-
constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
|
|
96
|
-
get children(): readonly AstNode[];
|
|
97
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
98
|
-
}
|
|
99
|
-
export declare class InlineCodeAstNode extends AstNode {
|
|
100
|
-
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
101
|
-
readonly kind = "inlineCode";
|
|
102
|
-
constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
|
|
103
|
-
get children(): readonly AstNode[];
|
|
104
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
105
|
-
}
|
|
106
|
-
export declare class InlineMathAstNode extends AstNode {
|
|
107
|
-
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
108
|
-
readonly kind = "inlineMath";
|
|
109
|
-
constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
|
|
110
|
-
get children(): readonly AstNode[];
|
|
111
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
112
|
-
}
|
|
113
|
-
export declare class LinkAstNode extends AstNode {
|
|
114
|
-
readonly url: string;
|
|
115
|
-
readonly content: readonly (MarkerAstNode | InlineAstNode | GlueAstNode)[];
|
|
116
|
-
readonly kind = "link";
|
|
117
|
-
constructor(url: string, content: readonly (MarkerAstNode | InlineAstNode | GlueAstNode)[]);
|
|
118
|
-
get children(): readonly AstNode[];
|
|
119
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
120
|
-
protected _localEquals(o: this): boolean;
|
|
121
|
-
}
|
|
122
|
-
export declare class ImageAstNode extends AstNode {
|
|
123
|
-
readonly alt: string;
|
|
124
|
-
readonly url: string;
|
|
125
|
-
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
126
|
-
readonly kind = "image";
|
|
127
|
-
constructor(alt: string, url: string, content: readonly (MarkerAstNode | GlueAstNode)[]);
|
|
128
|
-
get children(): readonly AstNode[];
|
|
129
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
130
|
-
protected _localEquals(o: this): boolean;
|
|
131
|
-
}
|
|
132
|
-
export type BlockAstNode = HeadingAstNode | ParagraphAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode;
|
|
133
|
-
export declare class HeadingAstNode extends AstNode {
|
|
134
|
-
readonly level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
135
|
-
readonly marker: MarkerAstNode;
|
|
136
|
-
readonly content: readonly (InlineAstNode | GlueAstNode)[];
|
|
137
|
-
readonly kind = "heading";
|
|
138
|
-
constructor(level: 1 | 2 | 3 | 4 | 5 | 6, marker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[]);
|
|
139
|
-
get children(): readonly AstNode[];
|
|
140
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
141
|
-
protected _localEquals(o: this): boolean;
|
|
142
|
-
}
|
|
143
|
-
export declare class ParagraphAstNode extends AstNode {
|
|
144
|
-
readonly content: readonly (InlineAstNode | GlueAstNode)[];
|
|
145
|
-
readonly kind = "paragraph";
|
|
146
|
-
constructor(content: readonly (InlineAstNode | GlueAstNode)[]);
|
|
147
|
-
get children(): readonly AstNode[];
|
|
148
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
149
|
-
}
|
|
150
|
-
export declare class CodeBlockAstNode extends AstNode {
|
|
151
|
-
readonly language: string;
|
|
152
|
-
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
153
|
-
readonly kind = "codeBlock";
|
|
154
|
-
private _previous?;
|
|
155
|
-
private _contentEdit?;
|
|
156
|
-
constructor(language: string, content: readonly (MarkerAstNode | GlueAstNode)[]);
|
|
157
|
-
get children(): readonly AstNode[];
|
|
158
|
-
get openFence(): MarkerAstNode | undefined;
|
|
159
|
-
get closeFence(): MarkerAstNode | undefined;
|
|
160
|
-
get code(): MarkerAstNode | undefined;
|
|
161
|
-
/** Relative start offset of the {@link code} marker within this block. */
|
|
162
|
-
get codeOffset(): number;
|
|
163
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
164
|
-
protected _localEquals(o: this): boolean;
|
|
165
|
-
/**
|
|
166
|
-
* A copy of this block carrying an incremental link to `previous`:
|
|
167
|
-
* `contentEdit` (in the block's *content* coordinates) turns `previous`'s
|
|
168
|
-
* content into this one. Uses a weak reference so the previous tree can be
|
|
169
|
-
* garbage-collected.
|
|
170
|
-
*/
|
|
171
|
-
withCodeDiff(previous: CodeBlockAstNode, contentEdit: StringEdit): CodeBlockAstNode;
|
|
172
|
-
/**
|
|
173
|
-
* When this block was incrementally derived from `previous` (same
|
|
174
|
-
* fences/language, edit entirely within the content), returns the
|
|
175
|
-
* content-coordinate edit; otherwise `undefined`.
|
|
176
|
-
*/
|
|
177
|
-
getDiff(previous: CodeBlockAstNode): CodeBlockDiff | undefined;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Describes how a {@link CodeBlockAstNode} was incrementally derived from a previous
|
|
181
|
-
* one: {@link stringEdit} (in the block's *content* coordinates) turns the
|
|
182
|
-
* previous content into this one.
|
|
183
|
-
*/
|
|
184
|
-
export interface CodeBlockDiff {
|
|
185
|
-
readonly stringEdit: StringEdit;
|
|
186
|
-
}
|
|
187
|
-
export declare class MathBlockAstNode extends AstNode {
|
|
188
|
-
readonly content: readonly (MarkerAstNode | GlueAstNode)[];
|
|
189
|
-
readonly kind = "mathBlock";
|
|
190
|
-
constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
|
|
191
|
-
get children(): readonly AstNode[];
|
|
192
|
-
get code(): MarkerAstNode | undefined;
|
|
193
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
194
|
-
}
|
|
195
|
-
export declare class BlockQuoteAstNode extends AstNode {
|
|
196
|
-
readonly content: readonly (MarkerAstNode | BlockAstNode | GlueAstNode)[];
|
|
197
|
-
readonly kind = "blockQuote";
|
|
198
|
-
constructor(content: readonly (MarkerAstNode | BlockAstNode | GlueAstNode)[]);
|
|
199
|
-
get children(): readonly AstNode[];
|
|
200
|
-
get blocks(): readonly BlockAstNode[];
|
|
201
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
202
|
-
}
|
|
203
|
-
export declare class ListAstNode extends AstNode {
|
|
204
|
-
readonly ordered: boolean;
|
|
205
|
-
readonly content: readonly (ListItemAstNode | GlueAstNode)[];
|
|
206
|
-
readonly kind = "list";
|
|
207
|
-
constructor(ordered: boolean, content: readonly (ListItemAstNode | GlueAstNode)[]);
|
|
208
|
-
get children(): readonly AstNode[];
|
|
209
|
-
get items(): readonly ListItemAstNode[];
|
|
210
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
211
|
-
protected _localEquals(o: this): boolean;
|
|
212
|
-
}
|
|
213
|
-
export declare class ListItemAstNode extends AstNode {
|
|
214
|
-
readonly marker: MarkerAstNode;
|
|
215
|
-
readonly content: readonly (BlockAstNode | GlueAstNode)[];
|
|
216
|
-
readonly checked?: boolean | undefined;
|
|
217
|
-
readonly leadingTrivia?: GlueAstNode | undefined;
|
|
218
|
-
readonly kind = "listItem";
|
|
219
|
-
constructor(marker: MarkerAstNode, content: readonly (BlockAstNode | GlueAstNode)[], checked?: boolean | undefined, leadingTrivia?: GlueAstNode | undefined);
|
|
220
|
-
get children(): readonly AstNode[];
|
|
221
|
-
get blocks(): readonly BlockAstNode[];
|
|
222
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
223
|
-
protected _localEquals(o: this): boolean;
|
|
224
|
-
}
|
|
225
|
-
export declare class TableAstNode extends AstNode {
|
|
226
|
-
readonly content: readonly (TableRowAstNode | GlueAstNode)[];
|
|
227
|
-
readonly kind = "table";
|
|
228
|
-
constructor(content: readonly (TableRowAstNode | GlueAstNode)[]);
|
|
229
|
-
get children(): readonly AstNode[];
|
|
230
|
-
private get _rows();
|
|
231
|
-
get headerRow(): TableRowAstNode | undefined;
|
|
232
|
-
get delimiterRow(): TableRowAstNode | undefined;
|
|
233
|
-
get bodyRows(): readonly TableRowAstNode[];
|
|
234
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
235
|
-
}
|
|
236
|
-
export declare class TableRowAstNode extends AstNode {
|
|
237
|
-
readonly content: readonly (TableCellAstNode | GlueAstNode)[];
|
|
238
|
-
readonly kind = "tableRow";
|
|
239
|
-
constructor(content: readonly (TableCellAstNode | GlueAstNode)[]);
|
|
240
|
-
get children(): readonly AstNode[];
|
|
241
|
-
get cells(): readonly TableCellAstNode[];
|
|
242
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
243
|
-
}
|
|
244
|
-
export declare class TableCellAstNode extends AstNode {
|
|
245
|
-
readonly content: readonly (InlineAstNode | MarkerAstNode | GlueAstNode)[];
|
|
246
|
-
readonly kind = "tableCell";
|
|
247
|
-
constructor(content: readonly (InlineAstNode | MarkerAstNode | GlueAstNode)[]);
|
|
248
|
-
get children(): readonly AstNode[];
|
|
249
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
250
|
-
}
|
|
251
|
-
export declare class DocumentAstNode extends AstNode {
|
|
252
|
-
readonly content: readonly (BlockAstNode | GlueAstNode)[];
|
|
253
|
-
readonly kind = "document";
|
|
254
|
-
constructor(content: readonly (BlockAstNode | GlueAstNode)[]);
|
|
255
|
-
get children(): readonly AstNode[];
|
|
256
|
-
get blocks(): readonly BlockAstNode[];
|
|
257
|
-
mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
|
|
258
|
-
}
|
|
259
|
-
/** Every concrete node kind, for exhaustive consumer-side dispatch. */
|
|
260
|
-
export type AnyAstNode = TextAstNode | MarkerAstNode | GlueAstNode | ThematicBreakAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode | HeadingAstNode | ParagraphAstNode | CodeBlockAstNode | MathBlockAstNode | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode;
|
|
261
|
-
/**
|
|
262
|
-
* Source offset (relative to `root`) of the node with `target`'s id, or
|
|
263
|
-
* `undefined` when it is not in the tree. Ids are stable across edits, so this
|
|
264
|
-
* locates a node even after reconciliation has rebuilt the tree around it.
|
|
265
|
-
*/
|
|
266
|
-
export declare function findNodeOffsetById(root: AstNode, target: AstNode): number | undefined;
|
|
267
|
-
/**
|
|
268
|
-
* Source range (relative to `item`) of a task list item's `[x]`/`[ ]`
|
|
269
|
-
* checkbox, or `undefined` when the item is not a task item. The checkbox is
|
|
270
|
-
* plain glue in the AST, so a host that wants to toggle it locates the literal
|
|
271
|
-
* `[x]`/`[ ]` token here.
|
|
272
|
-
*/
|
|
273
|
-
export declare function taskCheckboxRange(item: ListItemAstNode): OffsetRange | undefined;
|
|
274
|
-
export {};
|
package/dist/parser/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { MarkdownParser } from './parser.js';
|
|
2
|
-
export { getAnnotatedSource } from './test/getAnnotatedSource.js';
|
|
3
|
-
export { visualizeAst, type AstVisualization } from './visualizeAst.js';
|
|
4
|
-
export { BlockQuoteAstNode, CodeBlockAstNode, DocumentAstNode, EmphasisAstNode, GlueAstNode, HeadingAstNode, ImageAstNode, InlineCodeAstNode, InlineMathAstNode, LinkAstNode, ListAstNode, ListItemAstNode, MarkerAstNode, MathBlockAstNode, AstNode, findNodeOffsetById, taskCheckboxRange, ParagraphAstNode, StrikethroughAstNode, StrongAstNode, TableAstNode, TableCellAstNode, TableRowAstNode, TextAstNode, ThematicBreakAstNode, type AnyAstNode, type BlockAstNode, type InlineAstNode, } from './ast.js';
|
package/dist/parser/parse.d.ts
DELETED
package/dist/parser/parser.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StringValue } from '../core/stringValue.js';
|
|
2
|
-
import { StringEdit } from '../core/stringEdit.js';
|
|
3
|
-
import { DocumentAstNode } from './ast.js';
|
|
4
|
-
/**
|
|
5
|
-
* Parses markdown into a {@link DocumentAstNode}.
|
|
6
|
-
*
|
|
7
|
-
* When given the `previous` document and the `edit` that produced the new
|
|
8
|
-
* text, it reuses unchanged subtrees and carries node identities across the
|
|
9
|
-
* edit (see {@link parseIncremental}), so views can diff cheaply and code
|
|
10
|
-
* blocks keep their incremental highlighting sessions.
|
|
11
|
-
*/
|
|
12
|
-
export declare class MarkdownParser {
|
|
13
|
-
parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit): DocumentAstNode;
|
|
14
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { OffsetRange } from '../core/offsetRange.js';
|
|
2
|
-
import { StringEdit } from '../core/stringEdit.js';
|
|
3
|
-
import { DocumentAstNode, AstNode } from './ast.js';
|
|
4
|
-
/** Maps offsets/ranges from modified (new) coordinates back to original (previous). */
|
|
5
|
-
export declare class EditMapper {
|
|
6
|
-
private readonly _edit;
|
|
7
|
-
constructor(_edit: StringEdit);
|
|
8
|
-
/**
|
|
9
|
-
* The original range corresponding to `mod`, or `undefined` if `mod`
|
|
10
|
-
* overlaps any replaced/inserted text (i.e. is not provably unchanged).
|
|
11
|
-
*/
|
|
12
|
-
getOriginalRange(mod: OffsetRange): OffsetRange | undefined;
|
|
13
|
-
/** The original offset for `mod`, or `undefined` if it falls inside inserted text. */
|
|
14
|
-
getOriginalOffset(mod: number): number | undefined;
|
|
15
|
-
}
|
|
16
|
-
/** Indexes the previous tree for O(1) lookup by exact range or by stable id. */
|
|
17
|
-
export declare class OldTreeIndex {
|
|
18
|
-
private readonly _byRange;
|
|
19
|
-
private readonly _byId;
|
|
20
|
-
constructor(root: AstNode);
|
|
21
|
-
private _walk;
|
|
22
|
-
/** The old node spanning exactly `range` with the given `kind`, if any. */
|
|
23
|
-
lookupExact(range: OffsetRange, kind: string): AstNode | undefined;
|
|
24
|
-
/** The old node that began at `originalStart` with the given `kind`. */
|
|
25
|
-
lookupId(originalStart: number, kind: string): AstNode | undefined;
|
|
26
|
-
}
|
|
27
|
-
export declare function reconcile(fresh: AstNode, previous: AstNode, edit: StringEdit): AstNode;
|
|
28
|
-
/**
|
|
29
|
-
* Parses `text`; when `previous` and `edit` are given, reconciles the fresh
|
|
30
|
-
* tree against `previous` so unchanged subtrees keep their old instances and
|
|
31
|
-
* edited id-bearing nodes keep their old ids.
|
|
32
|
-
*/
|
|
33
|
-
export declare function parseIncremental(text: string, previous?: DocumentAstNode, edit?: StringEdit): DocumentAstNode;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DocumentAstNode, AstNode } from '../ast.js';
|
|
2
|
-
/** Assigns a small stable number to each distinct object instance, in first-seen order. */
|
|
3
|
-
export declare class InstanceIds {
|
|
4
|
-
private readonly _map;
|
|
5
|
-
private _next;
|
|
6
|
-
get(n: AstNode): number;
|
|
7
|
-
}
|
|
8
|
-
export declare function snapshot(root: AstNode, ids: InstanceIds): string;
|
|
9
|
-
export declare function snapshotDoc(doc: DocumentAstNode, ids: InstanceIds): string;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AstNode } from './ast.js';
|
|
2
|
-
export interface AstVisualizationNode {
|
|
3
|
-
label: string;
|
|
4
|
-
range: [start: number, endExclusive: number];
|
|
5
|
-
children?: AstVisualizationNode[];
|
|
6
|
-
}
|
|
7
|
-
export interface AstVisualization {
|
|
8
|
-
$fileExtension: 'ast.w';
|
|
9
|
-
source: string;
|
|
10
|
-
root: AstVisualizationNode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Globally-stable per-object-instance id, assigned in first-seen order across
|
|
14
|
-
* every visualization (AST, view-data, view-node). A single registry — not one
|
|
15
|
-
* per tree — is the whole point: the same object always renders the same `#N`,
|
|
16
|
-
* so you can correlate instances across the different trees and across edits.
|
|
17
|
-
*/
|
|
18
|
-
export declare function objectInstanceId(n: object): number;
|
|
19
|
-
export declare function visualizeAst(root: AstNode, source: string): AstVisualization;
|
|
20
|
-
/**
|
|
21
|
-
* Adapts the raw micromark token stream into the same `ast.w` visualization
|
|
22
|
-
* payload, as a flat list (no nesting): one child per event, in document order.
|
|
23
|
-
* This is the input the {@link visualizeAst} tree is built from, so showing both
|
|
24
|
-
* side by side makes the parser's tokens → AST step inspectable.
|
|
25
|
-
*
|
|
26
|
-
* Both `enter` and `exit` events are emitted — the open/close structure is the
|
|
27
|
-
* one piece of micromark's information that is NOT derivable from a flat list of
|
|
28
|
-
* ranges (tokens can share a range, and ranges alone don't disambiguate nesting
|
|
29
|
-
* order). Everything else a token carries is here too: its type, its
|
|
30
|
-
* `[start, end)` range, and the source slice that range covers (so the length,
|
|
31
|
-
* which the AST view derives, is visible directly).
|
|
32
|
-
*/
|
|
33
|
-
export declare function visualizeTokens(source: string): AstVisualization;
|
package/dist/test/random.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OffsetRange } from '../core/offsetRange.js';
|
|
2
|
-
import { StringEdit } from '../core/stringEdit.js';
|
|
3
|
-
/**
|
|
4
|
-
* Seeded RNG for deterministic fuzz tests. A small port of the `Random` helper
|
|
5
|
-
* used by VS Code's editor tests (`src/vs/editor/test/common/core/random.ts`),
|
|
6
|
-
* backed by a Mersenne Twister so a given seed always replays the same run.
|
|
7
|
-
*/
|
|
8
|
-
export declare abstract class Random {
|
|
9
|
-
static readonly basicAlphabetMultiline = " \n\nabcdefghijklmnopqrstuvwxyz0123456789";
|
|
10
|
-
static create(seed: number): Random;
|
|
11
|
-
abstract nextIntRange(start: number, endExclusive: number): number;
|
|
12
|
-
nextString(length: number, alphabet?: string): string;
|
|
13
|
-
nextMultiLineString(lineCount: number, lineLength: OffsetRange, alphabet?: string): string;
|
|
14
|
-
/** A single random replacement over `target` (insert, delete or replace). */
|
|
15
|
-
nextSingleStringEdit(target: string, newTextAlphabet?: string): StringEdit;
|
|
16
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { BlockAstNode, ListItemAstNode } from '../../parser/ast.js';
|
|
2
|
-
import { AnyViewData, CodeBlockViewData } from '../viewData.js';
|
|
3
|
-
import { ISyntaxHighlighter } from '../../highlighter/syntaxHighlighter.js';
|
|
4
|
-
import { ViewNode } from './viewNode.js';
|
|
5
|
-
export interface BlockViewOptions {
|
|
6
|
-
readonly renderCustomCodeBlock?: (language: string, content: string) => HTMLElement | undefined;
|
|
7
|
-
readonly onToggleCheckbox?: (item: ListItemAstNode, newChecked: boolean) => void;
|
|
8
|
-
/**
|
|
9
|
-
* Opens a link's URL. Called when the user activates a link: a plain click
|
|
10
|
-
* while the link's block is inactive (rendered), or a Ctrl/Cmd+click while it
|
|
11
|
-
* is active (source shown). Defaults to `window.open(url, '_blank')`.
|
|
12
|
-
*/
|
|
13
|
-
readonly onOpenLink?: (url: string, event: MouseEvent) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Colours fenced code blocks. When set, a code block's content is rendered
|
|
16
|
-
* as a sequence of token spans instead of one plain text node. This is the
|
|
17
|
-
* non-incremental path: the snapshot is read once at render time.
|
|
18
|
-
*/
|
|
19
|
-
readonly syntaxHighlighter?: ISyntaxHighlighter;
|
|
20
|
-
/**
|
|
21
|
-
* Pluggable renderer for the *inactive* (rendered) form of a math node —
|
|
22
|
-
* both `$$…$$` blocks and inline `$…$`. When set and it returns a result,
|
|
23
|
-
* its {@link MathRendering.dom} replaces the default opaque `katex.render`
|
|
24
|
-
* output, and its {@link MathRendering.segments} let parts of the rendered
|
|
25
|
-
* math (e.g. individual identifier glyphs) map back to source ranges so the
|
|
26
|
-
* caret can land inside them. Returning `undefined` falls back to the
|
|
27
|
-
* default whole-node KaTeX leaf. The active (source) form is unaffected.
|
|
28
|
-
*
|
|
29
|
-
* This is the seam used to explore in-place editing of rendered math (see
|
|
30
|
-
* `katexEditableIdentifiers.ts`).
|
|
31
|
-
*/
|
|
32
|
-
readonly renderMath?: (request: MathRenderRequest) => MathRendering | undefined;
|
|
33
|
-
}
|
|
34
|
-
/** Input to a {@link BlockViewOptions.renderMath} renderer. */
|
|
35
|
-
export interface MathRenderRequest {
|
|
36
|
-
/** The LaTeX source of the math content (without the `$$`/`$` fences). */
|
|
37
|
-
readonly latex: string;
|
|
38
|
-
/** `true` for a `$$…$$` block, `false` for inline `$…$`. */
|
|
39
|
-
readonly displayMode: boolean;
|
|
40
|
-
/** CSS class the host element must carry (editor styling/measurement hooks). */
|
|
41
|
-
readonly className: string;
|
|
42
|
-
/** Full source length of the math node (fences/`$` included). */
|
|
43
|
-
readonly nodeLength: number;
|
|
44
|
-
/** Offset of {@link latex} within the node (i.e. after the opening fence/`$`). */
|
|
45
|
-
readonly contentStart: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A span of the rendered math output that maps to a slice of source. The
|
|
49
|
-
* renderer reports these for the parts it can map (e.g. identifier glyphs);
|
|
50
|
-
* the editor tiles the gaps between them so the whole math node stays mapped.
|
|
51
|
-
*/
|
|
52
|
-
export interface MathSourceSegment {
|
|
53
|
-
/** A DOM node (ideally a Text node) within the rendered output. */
|
|
54
|
-
readonly dom: globalThis.Node;
|
|
55
|
-
/** Start offset of the mapped slice, relative to the math node's start. */
|
|
56
|
-
readonly start: number;
|
|
57
|
-
/** Source length of the mapped slice. */
|
|
58
|
-
readonly length: number;
|
|
59
|
-
}
|
|
60
|
-
/** Result of a {@link BlockViewOptions.renderMath} renderer. */
|
|
61
|
-
export interface MathRendering {
|
|
62
|
-
/** Host element to mount (the rendered math output). */
|
|
63
|
-
readonly dom: HTMLElement;
|
|
64
|
-
/** Source-mapped spans within {@link dom} (need not tile the whole node). */
|
|
65
|
-
readonly segments: readonly MathSourceSegment[];
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Base view node for everything the editor renders, generic over the
|
|
69
|
-
* {@link AnyViewData view-data} it renders so subclasses get a precisely-typed
|
|
70
|
-
* {@link data} (e.g. `BlockViewNode<HeadingViewData>`). Every view-data kind has
|
|
71
|
-
* a subclass whose constructor builds the node's DOM and, recursively,
|
|
72
|
-
* constructs its child view nodes — so *constructing a node is rendering it*.
|
|
73
|
-
* There is no separate render pass: the view tree is the result of construction,
|
|
74
|
-
* and {@link createViewNode} is the single entry point that turns a `ViewData`
|
|
75
|
-
* into a node (reusing a `previous` node untouched when it still matches).
|
|
76
|
-
*
|
|
77
|
-
* The name is historical — it is the base for inline and leaf nodes too — but
|
|
78
|
-
* top-level blocks are always instances of it, and {@link element}/{@link block}
|
|
79
|
-
* are the conveniences {@link EditorView} uses for those.
|
|
80
|
-
*/
|
|
81
|
-
export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends ViewNode {
|
|
82
|
-
readonly data: T;
|
|
83
|
-
constructor(data: T, dom: globalThis.Node, children: readonly ViewNode[]);
|
|
84
|
-
get block(): BlockAstNode;
|
|
85
|
-
get element(): HTMLElement;
|
|
86
|
-
/**
|
|
87
|
-
* Whether this already-built node can stand in for `data` unchanged. The
|
|
88
|
-
* builder preserves view-data identity for any subtree whose ast and
|
|
89
|
-
* selection-derived flags are unchanged (see `buildDocumentViewData`), so a
|
|
90
|
-
* single identity check captures "nothing in my subtree changed" — and its
|
|
91
|
-
* whole subtree, and any session it owns, are kept as-is.
|
|
92
|
-
*/
|
|
93
|
-
canReuse(data: AnyViewData): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Called by the view after this block is mounted and measured, with the
|
|
96
|
-
* block's rendered height in px. The default is a no-op; subclasses whose
|
|
97
|
-
* active/inactive renderings have different intrinsic heights (e.g. a math
|
|
98
|
-
* block) override this to remember a height to reserve across the toggle.
|
|
99
|
-
*/
|
|
100
|
-
recordMeasuredHeight(_height: number): void;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Turn a {@link AnyViewData view-data} node into its view node, reusing
|
|
104
|
-
* `previous` when it still renders the very same view-data object (see
|
|
105
|
-
* {@link BlockViewNode.canReuse}). Otherwise the matching subclass is
|
|
106
|
-
* constructed, which renders it and recursively constructs its children —
|
|
107
|
-
* threading `previous` down so an edited node can adopt its predecessor's DOM
|
|
108
|
-
* (and, for an edited {@link CodeBlockAstNode}, the highlighting session of the
|
|
109
|
-
* node it was derived from).
|
|
110
|
-
*
|
|
111
|
-
* On a rebuild `previous` is the view node {@link pairNodes} paired by stable id:
|
|
112
|
-
* identity-matched nodes (same view-data) short-circuit above, an edited node is
|
|
113
|
-
* paired with the node carrying its previous id, and any previous node whose id
|
|
114
|
-
* is gone is dropped (disposed by its container's reconcile) so its replacement
|
|
115
|
-
* is built with `previous === undefined`.
|
|
116
|
-
*/
|
|
117
|
-
export declare function createViewNode(data: AnyViewData, options: BlockViewOptions | undefined, previous?: ViewNode): ViewNode;
|
|
118
|
-
/**
|
|
119
|
-
* Build the view children for `childData` and patch `parentDom`'s child DOM in
|
|
120
|
-
* place to match, in one step. Each new child-data is paired with the previous
|
|
121
|
-
* view child that should render it ({@link pairNodes}) — by stable node id, which
|
|
122
|
-
* covers both unchanged subtrees and edited nodes — so DOM and session adoption
|
|
123
|
-
* carry over; the
|
|
124
|
-
* `build` callback turns `(childData, prev)` into its view node (usually via
|
|
125
|
-
* {@link createViewNode}). Previous children left unpaired are disposed, then
|
|
126
|
-
* {@link _patchDomChildren} reorders/inserts/removes `parentDom`'s children so
|
|
127
|
-
* the DOM matches the new view nodes — moving reused child DOM into place
|
|
128
|
-
* rather than re-creating it. The returned array mirrors `childData` 1:1,
|
|
129
|
-
* preserving the source ↔ DOM mapping invariant.
|
|
130
|
-
*/
|
|
131
|
-
export declare function reconcileDomChildren(parentDom: globalThis.Node, childData: readonly AnyViewData[], previousChildren: readonly ViewNode[] | undefined, build: (childData: AnyViewData, prev: ViewNode | undefined) => ViewNode): ViewNode[];
|
|
132
|
-
/**
|
|
133
|
-
* Like {@link _patchDomChildren} but over raw mount nodes, so a caller can mount
|
|
134
|
-
* a mix of view-node DOM and synthetic wrappers (e.g. a list item's gutter
|
|
135
|
-
* span) in place without detaching the nodes that stay put.
|
|
136
|
-
*/
|
|
137
|
-
export declare function _patchDomNodes(parent: globalThis.Node, nodes: readonly globalThis.Node[]): void;
|
|
138
|
-
/**
|
|
139
|
-
* A fenced code block. It owns its incremental
|
|
140
|
-
* {@link ISyntaxHighlighterDocument} session: constructing the node creates (or
|
|
141
|
-
* adopts from `previous`) the session, and disposing the node disposes it, so
|
|
142
|
-
* colouring stays incremental across edits — the session is reused and
|
|
143
|
-
* `update`d rather than rebuilt. A node at any depth owns a session; the only
|
|
144
|
-
* difference today is that the parser links `getDiff` for top-level code blocks
|
|
145
|
-
* only, so a nested block currently builds a fresh session on each rebuild.
|
|
146
|
-
*/
|
|
147
|
-
export declare class CodeBlockViewNode extends BlockViewNode<CodeBlockViewData> {
|
|
148
|
-
private _session;
|
|
149
|
-
/**
|
|
150
|
-
* Subscription that re-tokenises the rendered `<code>` in place whenever the
|
|
151
|
-
* session advances its {@link ISyntaxHighlighterDocument.snapshot} *without*
|
|
152
|
-
* a source edit (an async grammar finishing, a live recolour). It is tied to
|
|
153
|
-
* this node's lifetime, but like {@link _session} it must be disposed
|
|
154
|
-
* manually: a node reused as `previous` for a rebuild is never `dispose`d
|
|
155
|
-
* (see {@link reconcileDomChildren}), so the rebuilding constructor disposes
|
|
156
|
-
* its predecessor's subscription explicitly.
|
|
157
|
-
*/
|
|
158
|
-
private _snapshotSub;
|
|
159
|
-
constructor(data: CodeBlockViewData, options: BlockViewOptions | undefined, previous: ViewNode | undefined);
|
|
160
|
-
dispose(): void;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Pair each new node with the previous view node that should render it, then
|
|
164
|
-
* report the previous nodes left over. Pairing is by {@link AstNode.id} — the
|
|
165
|
-
* stable identity the parser mints on construction and carries across edits (see
|
|
166
|
-
* `reconcile`). One key covers both reuse cases uniformly: an unchanged subtree
|
|
167
|
-
* keeps its node object (so, trivially, its id), and an edited node — e.g. a
|
|
168
|
-
* code block whose content changed — is rebuilt as a fresh object cloned with
|
|
169
|
-
* its previous id. So the previous view node (which owns any DOM and, for a code
|
|
170
|
-
* block, the highlighting session) is paired with the new view-data derived from
|
|
171
|
-
* it, and that DOM/session is adopted rather than rebuilt.
|
|
172
|
-
*
|
|
173
|
-
* Previous nodes whose id no longer appears are returned in `unused`; the caller
|
|
174
|
-
* disposes them (freeing any session they still own).
|
|
175
|
-
*/
|
|
176
|
-
export declare function pairNodes(newData: readonly AnyViewData[], prevNodes: readonly ViewNode[]): {
|
|
177
|
-
paired: Map<AnyViewData, ViewNode>;
|
|
178
|
-
unused: ViewNode[];
|
|
179
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { DocumentViewData } from '../viewData.js';
|
|
2
|
-
import { BlockViewNode, BlockViewOptions } from './blockView.js';
|
|
3
|
-
import { ViewNode } from './viewNode.js';
|
|
4
|
-
/** A mounted block: its view node paired with where it starts in the source. */
|
|
5
|
-
export interface DocumentBlock {
|
|
6
|
-
readonly node: BlockViewNode;
|
|
7
|
-
readonly absoluteStart: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Immutable view of the document's block sequence — the document-level
|
|
11
|
-
* analogue of {@link BlockViewNode}. Each {@link create} maps the
|
|
12
|
-
* {@link DocumentViewData} (the AST overlaid with selection-derived flags) to
|
|
13
|
-
* the block sequence, reusing the previous node's blocks by view-data identity,
|
|
14
|
-
* rebuilding only what changed, and patching its {@link contentDomNode}'s
|
|
15
|
-
* children to match.
|
|
16
|
-
*
|
|
17
|
-
* Like a {@link BlockViewNode}, it owns its DOM: the first `create` allocates
|
|
18
|
-
* the content element, and every later `create` keeps the previous node's
|
|
19
|
-
* element rather than making a new one. The element is therefore stable
|
|
20
|
-
* across rebuilds:
|
|
21
|
-
*
|
|
22
|
-
* create(viewData, …, old).contentDomNode === old.contentDomNode
|
|
23
|
-
*
|
|
24
|
-
* so a parent can mount it once and never re-parent it.
|
|
25
|
-
*
|
|
26
|
-
* Because it is rebuilt rather than mutated, {@link EditorView} can hold the
|
|
27
|
-
* whole block cache as one value and simply swap it each frame, instead of
|
|
28
|
-
* carrying a mutable entry array and the reconcile bookkeeping itself.
|
|
29
|
-
*
|
|
30
|
-
* It is itself a {@link ViewNode} (the root of the view-node tree), so DOM ↔
|
|
31
|
-
* source mapping such as {@link ViewNode.resolveSource} is inherited: a hit on
|
|
32
|
-
* any descendant lifts up the parent chain to here, yielding an absolute
|
|
33
|
-
* document offset.
|
|
34
|
-
*/
|
|
35
|
-
export declare class DocumentViewNode extends ViewNode {
|
|
36
|
-
readonly blocks: readonly DocumentBlock[];
|
|
37
|
-
static create(viewData: DocumentViewData, options: BlockViewOptions | undefined, previous: DocumentViewNode | undefined): DocumentViewNode;
|
|
38
|
-
private constructor();
|
|
39
|
-
/** The stable content element this document mounts its children into. */
|
|
40
|
-
get contentDomNode(): HTMLElement;
|
|
41
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Point2D } from '../../core/geometry.js';
|
|
2
|
-
/**
|
|
3
|
-
* A DOM node paired with a caret offset inside it. The node is an arbitrary
|
|
4
|
-
* {@link globalThis.Node} (a Text node for a caret inside text, an Element for
|
|
5
|
-
* a hit on element-only content), and `offset` is the caret offset within it.
|
|
6
|
-
*/
|
|
7
|
-
export interface DomPosition {
|
|
8
|
-
readonly node: globalThis.Node;
|
|
9
|
-
readonly offset: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Client-coordinate point → the DOM caret position under it, using the
|
|
13
|
-
* platform hit-test API (`caretPositionFromPoint`, with a `caretRangeFromPoint`
|
|
14
|
-
* fallback). Returns `undefined` when the point hits nothing.
|
|
15
|
-
*/
|
|
16
|
-
export declare function caretDomPositionFromPoint(point: Point2D): DomPosition | undefined;
|