@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
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { MathRenderRequest, MathRendering } from './blockView.js';
|
|
2
|
-
/**
|
|
3
|
-
* EXPERIMENTAL — a {@link import('./blockView.js').BlockViewOptions.renderMath}
|
|
4
|
-
* renderer that makes individual *identifiers* in rendered math map back to
|
|
5
|
-
* their LaTeX source, so the caret can land inside them (the first step towards
|
|
6
|
-
* editing identifiers in place without switching the block to its source form).
|
|
7
|
-
*
|
|
8
|
-
* Approach — `\htmlData` injection (order-independent, exact):
|
|
9
|
-
*
|
|
10
|
-
* 1. Parse the LaTeX with the internal `katex.__parse` to get the parse tree,
|
|
11
|
-
* whose `mathord` atoms (single variables like `x`, `\alpha`) each carry a
|
|
12
|
-
* `loc: { start, end }` offset range into the source.
|
|
13
|
-
* 2. Rewrite the source, wrapping each identifier slice in
|
|
14
|
-
* `\htmlData{s=<start>,e=<end>}{<slice>}`. `\htmlData` emits a
|
|
15
|
-
* `<span data-s="…" data-e="…">` around exactly that glyph, so the rendered
|
|
16
|
-
* span *self-describes* its source range.
|
|
17
|
-
* 3. Render the rewritten source and read the `[data-s][data-e]` spans back.
|
|
18
|
-
* Because each span carries its own range, the mapping is exact regardless
|
|
19
|
-
* of how KaTeX reorders the DOM relative to source (fractions render
|
|
20
|
-
* numerator→denominator, sub/superscripts move, matrices, …) — unlike a
|
|
21
|
-
* positional zip of glyphs against atoms, which misaligns on those
|
|
22
|
-
* constructs.
|
|
23
|
-
*
|
|
24
|
-
* Security — trust/strict are scoped to the single harmless command:
|
|
25
|
-
*
|
|
26
|
-
* - `trust: (ctx) => ctx.command === '\\htmlData'` allows ONLY `\htmlData`.
|
|
27
|
-
* It emits `data-*` attributes only — no script, URL, or inline style — so
|
|
28
|
-
* there is no XSS surface (`\href`, `\includegraphics`, `\htmlStyle`, … all
|
|
29
|
-
* stay forbidden).
|
|
30
|
-
* - `strict` only silences the `htmlExtension` warning for `\htmlData`; every
|
|
31
|
-
* other strictness rule keeps its default (`warn`) behaviour.
|
|
32
|
-
*
|
|
33
|
-
* The user's own `\htmlData` in their LaTeX would also pass, but that is
|
|
34
|
-
* harmless (arbitrary `data-*` only).
|
|
35
|
-
*/
|
|
36
|
-
export declare function createKatexEditableIdentifiersRenderer(): (request: MathRenderRequest) => MathRendering | undefined;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Disposable } from '@vscode/observables';
|
|
2
|
-
import { AstNode } from '../../parser/ast.js';
|
|
3
|
-
import { OffsetRange } from '../../core/offsetRange.js';
|
|
4
|
-
import { DomPosition } from './dom.js';
|
|
5
|
-
export type { DomPosition } from './dom.js';
|
|
6
|
-
/**
|
|
7
|
-
* Immutable view of an AST node. Pairs `ast` with its rendered `dom` and a
|
|
8
|
-
* mirror of `ast.children` as ViewNode children. Source offsets are NEVER
|
|
9
|
-
* stored — they are recomputed by walking and summing `ast.length` of
|
|
10
|
-
* preceding siblings, just like the AST itself.
|
|
11
|
-
*
|
|
12
|
-
* Leaves are ViewNodes with no children. A leaf whose `dom` is a Text node
|
|
13
|
-
* participates in source mapping; a leaf whose `dom` is an Element does not
|
|
14
|
-
* (e.g. KaTeX-rendered math, or `<hr>` for a thematic break).
|
|
15
|
-
*/
|
|
16
|
-
export declare class ViewNode extends Disposable {
|
|
17
|
-
readonly ast: AstNode;
|
|
18
|
-
readonly dom: globalThis.Node;
|
|
19
|
-
private _children;
|
|
20
|
-
constructor(ast: AstNode, dom: globalThis.Node, children?: readonly ViewNode[]);
|
|
21
|
-
/** This node's view children (a mirror of `ast.children`). */
|
|
22
|
-
get children(): readonly ViewNode[];
|
|
23
|
-
/**
|
|
24
|
-
* Replace this node's children in place, disposing the old ones and
|
|
25
|
-
* re-pointing the new ones' parent to this node. The node value is still
|
|
26
|
-
* conceptually immutable with respect to its `ast`/`dom` *identity*; this
|
|
27
|
-
* is used only when a node patches its own DOM subtree in place (a code
|
|
28
|
-
* block re-tokenising on a highlighter recolour), where the source-mapping
|
|
29
|
-
* leaves must follow the new DOM text nodes without rebuilding the node
|
|
30
|
-
* itself.
|
|
31
|
-
*/
|
|
32
|
-
protected _replaceChildren(children: readonly ViewNode[]): void;
|
|
33
|
-
dispose(): void;
|
|
34
|
-
/**
|
|
35
|
-
* The number of source characters this node spans. Defaults to the length
|
|
36
|
-
* of its {@link ast}; a synthetic leaf that subdivides one ast node (a
|
|
37
|
-
* decorated-whitespace character, a code-block token span) shares that ast
|
|
38
|
-
* for identity but overrides this with the length of its own slice, so the
|
|
39
|
-
* renderer never has to fabricate an AST node just to carry a length.
|
|
40
|
-
*/
|
|
41
|
-
get sourceLength(): number;
|
|
42
|
-
/**
|
|
43
|
-
* The DOM node a parent mounts for this child. It is {@link dom} for almost
|
|
44
|
-
* everything; a marker is the exception — its `dom` is the inner Text node
|
|
45
|
-
* (so source ↔ DOM mapping lands on it) while the node it mounts is the
|
|
46
|
-
* wrapping `<span>`.
|
|
47
|
-
*/
|
|
48
|
-
get mountNode(): globalThis.Node;
|
|
49
|
-
/** The view node that rendered this node's parent, or `undefined` for a root. */
|
|
50
|
-
get parent(): ViewNode | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Closest view node owning `domNode`: the node itself if registered, else
|
|
53
|
-
* the nearest registered ancestor. Returns `undefined` if the DOM node is
|
|
54
|
-
* outside any view tree.
|
|
55
|
-
*/
|
|
56
|
-
static forDom(domNode: globalThis.Node | null): ViewNode | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* This node's start offset within its parent's local source space: the sum
|
|
59
|
-
* of the `ast.length` of the siblings before it. Polymorphic via
|
|
60
|
-
* {@link _localOffsetOfChild} so a parent whose children do not map
|
|
61
|
-
* linearly (e.g. it hides or reorders some) can override how its children
|
|
62
|
-
* are placed.
|
|
63
|
-
*/
|
|
64
|
-
localOffsetInParent(): number;
|
|
65
|
-
/** Start offset of `child` within this node's local source space. */
|
|
66
|
-
protected _localOffsetOfChild(child: ViewNode): number;
|
|
67
|
-
/**
|
|
68
|
-
* Map a DOM hit that lands on THIS node's own representation into a source
|
|
69
|
-
* range in this node's local space `[0, ast.length)`. Polymorphic: a text
|
|
70
|
-
* leaf maps the caret offset 1:1; an element-only node (KaTeX math, `<hr>`,
|
|
71
|
-
* an image, a hidden marker) has no internal text mapping and snaps to its
|
|
72
|
-
* start by default — subclasses may override (e.g. to snap to the nearer
|
|
73
|
-
* edge by x).
|
|
74
|
-
*/
|
|
75
|
-
getLocalSourceRange(pos: DomPosition): OffsetRange;
|
|
76
|
-
/**
|
|
77
|
-
* DOM hit (any node + offset within it) → source offset relative to THIS
|
|
78
|
-
* node, or `undefined` when the hit is outside this node's subtree. Enters
|
|
79
|
-
* the tree at the closest owning view node ({@link forDom}), maps the hit
|
|
80
|
-
* into that node's local space ({@link getLocalSourceRange}), then lifts the
|
|
81
|
-
* range up the parent chain — adding each node's {@link localOffsetInParent} —
|
|
82
|
-
* until it reaches this node.
|
|
83
|
-
*/
|
|
84
|
-
resolveSource(pos: DomPosition): number | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* Source offset → DOM position. `nodeOffset` is the absolute source
|
|
87
|
-
* offset of THIS node's start. Returns a position into a DOM Text node,
|
|
88
|
-
* descending into children based on accumulated lengths.
|
|
89
|
-
*/
|
|
90
|
-
sourceToDom(localSourceOffset: number, nodeSourceOffset?: number): DomPosition | undefined;
|
|
91
|
-
/** Visit every text-bearing leaf in this subtree with its absolute offset. */
|
|
92
|
-
forEachTextLeaf(nodeOffset: number, visitor: (leaf: ViewNode, leafOffset: number) => void): void;
|
|
93
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Disposable } from '@vscode/observables';
|
|
2
|
-
import { EditorModel } from '../model/editorModel.js';
|
|
3
|
-
import { EditorView } from './editorView.js';
|
|
4
|
-
/**
|
|
5
|
-
* Translates raw browser input (mouse, keyboard, EditContext) into model
|
|
6
|
-
* mutations. Knows about DOM event types but never reads/writes the DOM
|
|
7
|
-
* directly — it asks the {@link EditorView} to broker DOM↔source-offset
|
|
8
|
-
* conversions so the model stays free of view types.
|
|
9
|
-
*
|
|
10
|
-
* Owns the only non-derivable controller state:
|
|
11
|
-
* - `_desiredColumn` — sticky column for up/down navigation
|
|
12
|
-
*/
|
|
13
|
-
export declare class EditorController extends Disposable {
|
|
14
|
-
private readonly _model;
|
|
15
|
-
private readonly _view;
|
|
16
|
-
private _desiredColumn;
|
|
17
|
-
constructor(_model: EditorModel, _view: EditorView);
|
|
18
|
-
private readonly _handleTextUpdate;
|
|
19
|
-
private readonly _handleMouseDown;
|
|
20
|
-
private _makeCursorContext;
|
|
21
|
-
private _makeVisualCursorContext;
|
|
22
|
-
private _executeCursorCommand;
|
|
23
|
-
private _executeEditCommand;
|
|
24
|
-
private _executeVisualCursorCommand;
|
|
25
|
-
/** Move the cursor down one visual line (Arrow Down). */
|
|
26
|
-
cursorDown(extend?: boolean): void;
|
|
27
|
-
/** Move the cursor up one visual line (Arrow Up). */
|
|
28
|
-
cursorUp(extend?: boolean): void;
|
|
29
|
-
private readonly _handleCopy;
|
|
30
|
-
private readonly _handleCut;
|
|
31
|
-
private readonly _handlePaste;
|
|
32
|
-
private _selectedText;
|
|
33
|
-
private readonly _handleKeyDown;
|
|
34
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Disposable, IObservable } from '@vscode/observables';
|
|
2
|
-
import { Point2D } from '../core/geometry.js';
|
|
3
|
-
import { SourceOffset } from '../core/sourceOffset.js';
|
|
4
|
-
import { EditorModel } from '../model/editorModel.js';
|
|
5
|
-
import { MeasuredLayoutModel } from '../model/measuredLayoutModel.js';
|
|
6
|
-
import { BlockViewOptions } from './content/blockView.js';
|
|
7
|
-
import { DocumentViewNode } from './content/documentView.js';
|
|
8
|
-
import { DocumentViewData } from './viewData.js';
|
|
9
|
-
export interface EditorViewOptions extends BlockViewOptions {
|
|
10
|
-
/**
|
|
11
|
-
* Extra class names added to the editor root element, e.g. a theme class
|
|
12
|
-
* such as `'md-theme-default'` or `'github-markdown-theme'`. Theme styles
|
|
13
|
-
* are scoped under these classes, so the editor is unstyled (base chrome
|
|
14
|
-
* only) unless a theme class is supplied.
|
|
15
|
-
*/
|
|
16
|
-
readonly classNames?: readonly string[];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Pure-render view of an {@link EditorModel}.
|
|
20
|
-
*
|
|
21
|
-
* Invariant (the whole point of this file):
|
|
22
|
-
*
|
|
23
|
-
* view(model + Δ) = view(model) + Δ
|
|
24
|
-
*
|
|
25
|
-
* The DOM the view produces is a function of the model. The only state the
|
|
26
|
-
* view holds is *DOM management*: the cached `BlockViewNode` instances and the
|
|
27
|
-
* `EditContext`. Anything that influences correctness but is not derivable
|
|
28
|
-
* from the model lives elsewhere:
|
|
29
|
-
*
|
|
30
|
-
* - measured heights and per-block visual line maps → {@link MeasuredLayoutModel}
|
|
31
|
-
* - desired column, drag-time freeze → EditorController
|
|
32
|
-
*
|
|
33
|
-
* The view does not own a controller — callers construct an
|
|
34
|
-
* `EditorController` separately and pass it the view, so input handling is
|
|
35
|
-
* explicit and the view stays a pure renderer.
|
|
36
|
-
*
|
|
37
|
-
* The view writes into the measured-layout model as a side effect of
|
|
38
|
-
* rendering. It never reads its own measurements during rendering, so
|
|
39
|
-
* there is no feedback loop.
|
|
40
|
-
*/
|
|
41
|
-
export declare class EditorView extends Disposable {
|
|
42
|
-
private readonly _model;
|
|
43
|
-
private readonly _options?;
|
|
44
|
-
readonly element: HTMLElement;
|
|
45
|
-
readonly editContext: EditContext;
|
|
46
|
-
readonly measuredLayout: MeasuredLayoutModel;
|
|
47
|
-
private readonly _cursorView;
|
|
48
|
-
private readonly _selectionView;
|
|
49
|
-
/**
|
|
50
|
-
* The mounted block sequence, in source order. Rebuilt (not mutated) each
|
|
51
|
-
* frame by {@link DocumentViewNode.create}; the view just swaps one
|
|
52
|
-
* immutable node for the next. Never used for source-of-truth lookups
|
|
53
|
-
* (those go through the measured-layout model).
|
|
54
|
-
*/
|
|
55
|
-
private readonly _document;
|
|
56
|
-
/** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
|
|
57
|
-
get documentViewNode(): IObservable<DocumentViewNode | undefined>;
|
|
58
|
-
/**
|
|
59
|
-
* Last frame's view-data overlay, threaded back into
|
|
60
|
-
* {@link buildDocumentViewData} so any subtree whose ast and selection flags
|
|
61
|
-
* are unchanged keeps its view-data object — which lets the renderer reuse
|
|
62
|
-
* its DOM by identity.
|
|
63
|
-
*/
|
|
64
|
-
private _previousViewData;
|
|
65
|
-
/** The current view-data tree (AST overlaid with selection flags), for debugging. */
|
|
66
|
-
private readonly _viewData;
|
|
67
|
-
get viewData(): IObservable<DocumentViewData | undefined>;
|
|
68
|
-
/**
|
|
69
|
-
* The block cache projected for views (selection painting) that need to
|
|
70
|
-
* react to mount/unmount. Derived from {@link _document}, so it stays in
|
|
71
|
-
* lock-step without any manual bookkeeping.
|
|
72
|
-
*/
|
|
73
|
-
private readonly _selectionBlocksObs;
|
|
74
|
-
constructor(_model: EditorModel, _options?: EditorViewOptions | undefined);
|
|
75
|
-
focus(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Client coordinates → absolute source offset (any block). Used during
|
|
78
|
-
* drag to keep extending the selection even when the pointer leaves the
|
|
79
|
-
* original block.
|
|
80
|
-
*/
|
|
81
|
-
resolveOffsetFromPoint(point: Point2D): SourceOffset | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Whether a client point falls on the rendered document content, as
|
|
84
|
-
* opposed to the surrounding editor padding (the green area). Uses DOM
|
|
85
|
-
* containment rather than the content node's bounding box so that markers
|
|
86
|
-
* which overflow into the padding (e.g. a heading's `##`, which renders in
|
|
87
|
-
* the left margin) still count as content. Overlays (cursor, selection)
|
|
88
|
-
* have `pointer-events: none`, so the hit-test sees through them.
|
|
89
|
-
*/
|
|
90
|
-
isPointInContent(point: Point2D): boolean;
|
|
91
|
-
private readonly _renderAutorun;
|
|
92
|
-
/** Current mounted blocks, or empty before the first render. */
|
|
93
|
-
private get _blocks();
|
|
94
|
-
/**
|
|
95
|
-
* Measure each mounted block's rect and per-block visual line map, then
|
|
96
|
-
* publish the result into the {@link MeasuredLayoutModel}. The model
|
|
97
|
-
* is not read here, so there is no feedback loop into the render autorun.
|
|
98
|
-
*/
|
|
99
|
-
private _publishMeasurements;
|
|
100
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IObservable } from '@vscode/observables';
|
|
2
|
-
import { AstVisualization } from '../../parser/visualizeAst.js';
|
|
3
|
-
/** One gated viewer panel: a labelled checkbox and the visualization it shows. */
|
|
4
|
-
export interface AstViewerPanel {
|
|
5
|
-
readonly label: string;
|
|
6
|
-
/** localStorage key persisting this panel's checked state (off by default). */
|
|
7
|
-
readonly storageKey: string;
|
|
8
|
-
readonly visualization: IObservable<AstVisualization>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A row of "show …" checkboxes (each persisted in localStorage, off by default)
|
|
12
|
-
* over a row of the iframes they gate. Each panel's iframe is only created while
|
|
13
|
-
* its box is checked; multiple panels can be shown at once, laid out side by
|
|
14
|
-
* side (each filling an equal share of the width).
|
|
15
|
-
*
|
|
16
|
-
* Returns the container element and a `whenReady` promise that the fixture can
|
|
17
|
-
* `await`: it resolves once every initially-checked viewer has completed its
|
|
18
|
-
* handshake and received its first content (or immediately, if none are
|
|
19
|
-
* checked). Awaiting it lets the Component Explorer hold the screenshot until
|
|
20
|
-
* the viewers have content instead of capturing blank iframes.
|
|
21
|
-
*/
|
|
22
|
-
export declare function createAstViewerView(panels: readonly AstViewerPanel[], addDisposable: <T extends {
|
|
23
|
-
dispose(): void;
|
|
24
|
-
}>(d: T) => T): {
|
|
25
|
-
readonly element: HTMLElement;
|
|
26
|
-
readonly whenReady: Promise<void>;
|
|
27
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ISyntaxHighlighter, ISyntaxHighlighterDocument } from '../../highlighter/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* A toy {@link ISyntaxHighlighter} for fixtures: it ignores the language and
|
|
4
|
-
* always emits the same hardcoded token layout for the demo snippet, but each
|
|
5
|
-
* document's {@link ISyntaxHighlighterDocument.snapshot snapshot} ticks once
|
|
6
|
-
* per `intervalMs`, swapping in a new snapshot whose keyword run cycles through
|
|
7
|
-
* {@link KEYWORD_CLASSES}. The change reason is a same-length {@link LengthEdit}
|
|
8
|
-
* over the keyword run — a pure recolour. Everything is driven through the
|
|
9
|
-
* snapshot observable, so this tests that the view re-renders when that
|
|
10
|
-
* observable changes (no other signal is exposed).
|
|
11
|
-
*/
|
|
12
|
-
export declare class CyclingTsHighlighter implements ISyntaxHighlighter {
|
|
13
|
-
private readonly _intervalMs;
|
|
14
|
-
constructor(_intervalMs?: number);
|
|
15
|
-
create(_language: string, initialText: string): ISyntaxHighlighterDocument;
|
|
16
|
-
dispose(): void;
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DEBUG / FIXTURE ONLY — coloring helper for the layout debug view.
|
|
3
|
-
*
|
|
4
|
-
* Assigns every source offset a color so the same offset is painted
|
|
5
|
-
* identically in the editor overlay and in the raw-source view. A mismatch
|
|
6
|
-
* therefore exposes a source ↔ DOM mapping bug at a glance.
|
|
7
|
-
*
|
|
8
|
-
* The source is partitioned into maximal *sequences*:
|
|
9
|
-
* - a **word** is a run of letters (`\p{L}`),
|
|
10
|
-
* - a **non-word** is a run of everything else (digits, punctuation,
|
|
11
|
-
* whitespace).
|
|
12
|
-
*
|
|
13
|
-
* `"1. Plan"` → `"1. "` (non-word) + `"Plan"` (word).
|
|
14
|
-
*
|
|
15
|
-
* Within one sequence a single gradient advances `start → end` across the
|
|
16
|
-
* sequence's characters. So for `"Plan"`: `P = [1/4]`, `l = [2/4]`,
|
|
17
|
-
* `a = [3/4]`, `n = [4/4]`.
|
|
18
|
-
*
|
|
19
|
-
* Inefficiency is fine here: this is never shipped in the product.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Returns one rgba color per source offset (`result.length === source.length`).
|
|
23
|
-
* The same alpha is used everywhere so the editor overlay rect and the
|
|
24
|
-
* source-view character share the exact color.
|
|
25
|
-
*/
|
|
26
|
-
export declare function computeSequenceColors(source: string, alpha?: number): string[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { EditorModel } from '../../model/editorModel.js';
|
|
2
|
-
/**
|
|
3
|
-
* Wraps `container` into a side-by-side layout with a toggleable Monaco source
|
|
4
|
-
* editor on the left and the existing `editorPane` on the right. Returns a
|
|
5
|
-
* disposer that tears down the panel, button and bindings.
|
|
6
|
-
*/
|
|
7
|
-
export declare function attachMonacoDebugPanel(container: HTMLElement, editorPane: HTMLElement, model: EditorModel): () => void;
|
package/dist/view/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { ViewNode, type DomPosition } from './content/viewNode.js';
|
|
2
|
-
export { BlockViewNode, CodeBlockViewNode, type BlockViewOptions, type MathRenderRequest, type MathRendering, type MathSourceSegment } from './content/blockView.js';
|
|
3
|
-
export { DocumentViewNode, type DocumentBlock } from './content/documentView.js';
|
|
4
|
-
export { EditorView, type EditorViewOptions } from './editorView.js';
|
|
5
|
-
export { EditorController } from './editorController.js';
|
|
6
|
-
export { CursorView, CursorViewRendering, type CursorViewOptions } from './parts/cursorView.js';
|
|
7
|
-
export { SelectionView, SelectionViewRendering, type SelectionBlock, type SelectionViewOptions, type SelectionRect } from './parts/selectionView.js';
|
|
8
|
-
export { MeasuredLayoutDebugView, MeasuredLayoutDebugRendering, type MeasuredLayoutDebugViewOptions } from './measuredLayoutDebugView.js';
|
|
9
|
-
export { VisualLineMap, VisualLine, VisualRun } from './visualLineMap.js';
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Disposable, IObservable, ISettableObservable } from '@vscode/observables';
|
|
2
|
-
import { MeasuredLayoutModel } from '../model/measuredLayoutModel.js';
|
|
3
|
-
export interface MeasuredLayoutDebugViewOptions {
|
|
4
|
-
readonly model: MeasuredLayoutModel;
|
|
5
|
-
/**
|
|
6
|
-
* DEBUG ONLY. Maps an absolute source offset to a fill color for that
|
|
7
|
-
* character's glyph rect. The fixture passes the same function to the
|
|
8
|
-
* raw-source view so a character and its rect share one color — a
|
|
9
|
-
* mismatch exposes a source ↔ DOM mapping bug.
|
|
10
|
-
*/
|
|
11
|
-
readonly colorForOffset?: (offset: number) => string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* DEBUG ONLY. Shared "currently hovered source offset". When set, the
|
|
14
|
-
* overlay isolates the matching glyph rect; the fixture passes the same
|
|
15
|
-
* observable to the raw-source view so hovering either side highlights the
|
|
16
|
-
* same character in both. Hovering a rect writes this; `undefined` clears.
|
|
17
|
-
*/
|
|
18
|
-
readonly hoveredOffset?: ISettableObservable<number | undefined>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Debug view for a {@link MeasuredLayoutModel}.
|
|
22
|
-
*
|
|
23
|
-
* Exposes two DOM nodes the caller can place independently:
|
|
24
|
-
*
|
|
25
|
-
* - {@link overlayElement} — absolutely positioned; the caller mounts it
|
|
26
|
-
* inside the editor element so dashed line-bands and run-boxes line up
|
|
27
|
-
* with the editor's client coordinates.
|
|
28
|
-
* - {@link infoElement} — block-flow; the caller mounts it as a sibling
|
|
29
|
-
* *below* the editor. Contains the per-block summary table that used
|
|
30
|
-
* to live on the overlay.
|
|
31
|
-
*
|
|
32
|
-
* Same pattern as `CursorView` / `SelectionView`: the rendering pipeline
|
|
33
|
-
* is a single `derived` whose compute callback writes the DOM and returns
|
|
34
|
-
* a {@link MeasuredLayoutDebugRendering} value as proof. An autorun keeps
|
|
35
|
-
* the derived subscribed.
|
|
36
|
-
*/
|
|
37
|
-
export declare class MeasuredLayoutDebugView extends Disposable {
|
|
38
|
-
private readonly _overlayParent;
|
|
39
|
-
readonly overlayElement: HTMLElement;
|
|
40
|
-
readonly infoElement: HTMLElement;
|
|
41
|
-
readonly rendering: IObservable<MeasuredLayoutDebugRendering>;
|
|
42
|
-
/** Absolute source offsets that map to a rendered DOM character. */
|
|
43
|
-
readonly mappedOffsets: IObservable<ReadonlySet<number>>;
|
|
44
|
-
/** Whether the dashed line-bands and run boxes are drawn (persisted). */
|
|
45
|
-
private readonly _showLineRects;
|
|
46
|
-
constructor(_overlayParent: HTMLElement, options: MeasuredLayoutDebugViewOptions);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Immutable record of one rendered debug frame.
|
|
50
|
-
*/
|
|
51
|
-
export declare class MeasuredLayoutDebugRendering {
|
|
52
|
-
readonly blockCount: number;
|
|
53
|
-
readonly mountedCount: number;
|
|
54
|
-
readonly lineCount: number;
|
|
55
|
-
/** Absolute source offsets that map to a rendered DOM character. */
|
|
56
|
-
readonly mappedOffsets: ReadonlySet<number>;
|
|
57
|
-
constructor(blockCount: number, mountedCount: number, lineCount: number,
|
|
58
|
-
/** Absolute source offsets that map to a rendered DOM character. */
|
|
59
|
-
mappedOffsets: ReadonlySet<number>);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Show only the element whose `data-offset` equals `hovered`, hiding every
|
|
63
|
-
* other child (and all children lacking a `data-offset`, e.g. line bands).
|
|
64
|
-
* When `hovered` is `undefined` everything is restored. `visibility: hidden`
|
|
65
|
-
* preserves layout so the source view's text never reflows.
|
|
66
|
-
*
|
|
67
|
-
* Used identically for the editor overlay and the raw-source view, so a hover
|
|
68
|
-
* on either side highlights the same character in both. Debug-only.
|
|
69
|
-
*/
|
|
70
|
-
export declare function applyHoverIsolation(container: HTMLElement, hovered: number | undefined): void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Disposable, IObservable } from '@vscode/observables';
|
|
2
|
-
import { Rect2D } from '../../core/geometry.js';
|
|
3
|
-
import { SourceOffset } from '../../core/sourceOffset.js';
|
|
4
|
-
import { VisualLineMap } from '../visualLineMap.js';
|
|
5
|
-
export interface CursorViewOptions {
|
|
6
|
-
readonly offset: IObservable<SourceOffset | undefined>;
|
|
7
|
-
readonly visualLineMap: IObservable<VisualLineMap>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Owns the blinking cursor DOM element.
|
|
11
|
-
*
|
|
12
|
-
* The rendering pipeline is a single `derived` whose compute callback
|
|
13
|
-
* asks the {@link VisualLineMap} for the caret rect at the current
|
|
14
|
-
* offset, writes it to {@link element}, and returns a
|
|
15
|
-
* {@link CursorViewRendering} value as proof. An autorun keeps the
|
|
16
|
-
* derived subscribed.
|
|
17
|
-
*/
|
|
18
|
-
export declare class CursorView extends Disposable {
|
|
19
|
-
private readonly _parent;
|
|
20
|
-
readonly element: HTMLElement;
|
|
21
|
-
readonly rendering: IObservable<CursorViewRendering>;
|
|
22
|
-
constructor(_parent: HTMLElement, options: CursorViewOptions);
|
|
23
|
-
}
|
|
24
|
-
export declare class CursorViewRendering {
|
|
25
|
-
readonly offset: SourceOffset;
|
|
26
|
-
readonly visible: boolean;
|
|
27
|
-
readonly rect: Rect2D;
|
|
28
|
-
constructor(offset: SourceOffset, visible: boolean, rect: Rect2D);
|
|
29
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Disposable, IObservable } from '@vscode/observables';
|
|
2
|
-
import { Selection } from '../../core/selection.js';
|
|
3
|
-
import { BlockAstNode } from '../../parser/ast.js';
|
|
4
|
-
import { ViewNode } from '../content/viewNode.js';
|
|
5
|
-
import { VisualLineMap } from '../visualLineMap.js';
|
|
6
|
-
/**
|
|
7
|
-
* One mounted block, as far as selection painting is concerned. The view
|
|
8
|
-
* supplies its block cache in this shape so the selection layer never has
|
|
9
|
-
* to reach back into private view state.
|
|
10
|
-
*/
|
|
11
|
-
export interface SelectionBlock {
|
|
12
|
-
readonly block: BlockAstNode;
|
|
13
|
-
readonly absoluteStart: number;
|
|
14
|
-
readonly viewNode: ViewNode;
|
|
15
|
-
readonly element: HTMLElement;
|
|
16
|
-
}
|
|
17
|
-
export interface SelectionViewOptions {
|
|
18
|
-
readonly selection: IObservable<Selection | undefined>;
|
|
19
|
-
readonly visualLineMap: IObservable<VisualLineMap>;
|
|
20
|
-
readonly blocks: IObservable<readonly SelectionBlock[]>;
|
|
21
|
-
}
|
|
22
|
-
export interface SelectionRect {
|
|
23
|
-
readonly x: number;
|
|
24
|
-
readonly y: number;
|
|
25
|
-
readonly width: number;
|
|
26
|
-
readonly height: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Owns the SVG overlay that paints the selection.
|
|
30
|
-
*
|
|
31
|
-
* Rendering is *line-based*, not glyph-based:
|
|
32
|
-
*
|
|
33
|
-
* 1. Each {@link VisualLine} overlapping the selection produces one rect
|
|
34
|
-
* using the full line-box height (so the selection has even, line-
|
|
35
|
-
* height bands instead of jagged glyph rects).
|
|
36
|
-
* 2. Inter-block gaps fully inside the selection become connector rects.
|
|
37
|
-
* 3. All rects are grouped into vertically-adjacent clusters and each
|
|
38
|
-
* cluster is rendered as a single connected polygon with rounded
|
|
39
|
-
* corners.
|
|
40
|
-
*
|
|
41
|
-
* To keep the polygon connected without gaps, "middle" lines (any line
|
|
42
|
-
* that is neither the first nor the last selected line in the document)
|
|
43
|
-
* are extended to their full line extent, while the first and last lines
|
|
44
|
-
* are clipped to the actual selection start/end. This is the standard
|
|
45
|
-
* envelope shape used by IDE selection rendering.
|
|
46
|
-
*/
|
|
47
|
-
export declare class SelectionView extends Disposable {
|
|
48
|
-
private readonly _parent;
|
|
49
|
-
readonly element: SVGSVGElement;
|
|
50
|
-
readonly rendering: IObservable<SelectionViewRendering>;
|
|
51
|
-
private readonly _path;
|
|
52
|
-
constructor(_parent: HTMLElement, options: SelectionViewOptions);
|
|
53
|
-
}
|
|
54
|
-
export declare class SelectionViewRendering {
|
|
55
|
-
readonly rects: readonly SelectionRect[];
|
|
56
|
-
constructor(rects: readonly SelectionRect[]);
|
|
57
|
-
}
|