@vscode/markdown-editor 0.0.2-21 → 0.0.2-22
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/index.d.ts +63 -30
- package/dist/index.js +1420 -1373
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/view/editor.css +11 -39
package/dist/index.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ declare abstract class BlockAstNodeBase extends AstNode {
|
|
|
109
109
|
/**
|
|
110
110
|
* One block's place in the rendered document.
|
|
111
111
|
*
|
|
112
|
-
*
|
|
112
|
+
* Geometry is in editor-local CSS pixels. `height` is either a real DOM measurement
|
|
113
113
|
* (`isMeasured: true`) or an estimate produced when the block is not
|
|
114
114
|
* currently mounted (`isMeasured: false`). Estimates exist so virtual
|
|
115
115
|
* rendering can size the scroll container without mounting every block.
|
|
@@ -124,6 +124,13 @@ export declare interface BlockMeasurement {
|
|
|
124
124
|
readonly block: BlockAstNode;
|
|
125
125
|
readonly absoluteStart: number;
|
|
126
126
|
readonly height: number;
|
|
127
|
+
/** Local border box when mounted and measured. */
|
|
128
|
+
readonly rect: Rect2D | undefined;
|
|
129
|
+
/** Local horizontal padding-box clip when this block scrolls horizontally. */
|
|
130
|
+
readonly viewportClip: {
|
|
131
|
+
readonly left: number;
|
|
132
|
+
readonly right: number;
|
|
133
|
+
} | undefined;
|
|
127
134
|
readonly isMeasured: boolean;
|
|
128
135
|
readonly visualLineMap: VisualLineMap | undefined;
|
|
129
136
|
readonly viewNode: ViewNode | undefined;
|
|
@@ -605,10 +612,9 @@ export declare const cursorUp: VisualCursorCommand;
|
|
|
605
612
|
* derived subscribed.
|
|
606
613
|
*/
|
|
607
614
|
export declare class CursorView extends Disposable {
|
|
608
|
-
private readonly _parent;
|
|
609
615
|
readonly element: HTMLElement;
|
|
610
616
|
readonly rendering: IObservable<CursorViewRendering>;
|
|
611
|
-
constructor(
|
|
617
|
+
constructor(options: CursorViewOptions);
|
|
612
618
|
}
|
|
613
619
|
|
|
614
620
|
export declare interface CursorViewOptions {
|
|
@@ -622,7 +628,7 @@ export declare interface CursorViewOptions {
|
|
|
622
628
|
readonly blocks?: IObservable<readonly SelectionBlock[]>;
|
|
623
629
|
/**
|
|
624
630
|
* When set, the caret is drawn over the transient empty paragraph instead
|
|
625
|
-
* of at {@link offset} — its rect
|
|
631
|
+
* of at {@link offset} — its editor-local rect comes straight
|
|
626
632
|
* from that synthetic element's geometry, since it has no visual-line-map
|
|
627
633
|
* entry. Takes priority over the normal offset-based placement.
|
|
628
634
|
*/
|
|
@@ -886,6 +892,34 @@ export declare interface EditorControllerOptions {
|
|
|
886
892
|
readonly clipboardStrategy?: IClipboardStrategy;
|
|
887
893
|
}
|
|
888
894
|
|
|
895
|
+
/**
|
|
896
|
+
* The editor overlay's local CSS-pixel coordinate space.
|
|
897
|
+
*
|
|
898
|
+
* Browser geometry and pointer APIs expose viewport client coordinates. This
|
|
899
|
+
* boundary converts them immediately into the coordinate system shared by the
|
|
900
|
+
* editor content and its overlays. Range rectangles are axis-aligned, so the
|
|
901
|
+
* current implementation deliberately supports positive axis-aligned scale and
|
|
902
|
+
* translation only.
|
|
903
|
+
*/
|
|
904
|
+
export declare class EditorCoordinateSpace {
|
|
905
|
+
private readonly _getLocalToClientMatrix;
|
|
906
|
+
static forSvgOverlay(overlay: SVGSVGElement): EditorCoordinateSpace;
|
|
907
|
+
private constructor();
|
|
908
|
+
capture(): EditorCoordinateTransform;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/** A stable coordinate conversion captured for one measurement operation. */
|
|
912
|
+
export declare class EditorCoordinateTransform {
|
|
913
|
+
private readonly _localToClient;
|
|
914
|
+
private readonly _clientToLocal;
|
|
915
|
+
constructor(_localToClient: DOMMatrix);
|
|
916
|
+
toLocalPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
|
|
917
|
+
toClientPoint(point: Pick<Point2D, 'x' | 'y'>): Point2D;
|
|
918
|
+
toLocalRect(rect: Pick<DOMRectReadOnly, 'left' | 'top' | 'width' | 'height'>): Rect2D;
|
|
919
|
+
toClientRect(rect: Pick<Rect2D, 'left' | 'top' | 'width' | 'height'>): Rect2D;
|
|
920
|
+
private _convertRect;
|
|
921
|
+
}
|
|
922
|
+
|
|
889
923
|
export declare class EditorModel {
|
|
890
924
|
private readonly _parser;
|
|
891
925
|
/**
|
|
@@ -1041,6 +1075,7 @@ export declare class EditorView extends Disposable {
|
|
|
1041
1075
|
readonly element: HTMLElement;
|
|
1042
1076
|
readonly editContext: EditContext;
|
|
1043
1077
|
readonly measuredLayout: MeasuredLayoutModel;
|
|
1078
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1044
1079
|
/**
|
|
1045
1080
|
* Inner container that holds the rendered document and the cursor/selection
|
|
1046
1081
|
* overlays. The outer {@link element} spans the full width; this container
|
|
@@ -1073,7 +1108,7 @@ export declare class EditorView extends Disposable {
|
|
|
1073
1108
|
private readonly _viewData;
|
|
1074
1109
|
get viewData(): IObservable<DocumentViewData | undefined>;
|
|
1075
1110
|
/**
|
|
1076
|
-
* Caret rect (
|
|
1111
|
+
* Caret rect (editor-local coordinates) for the transient empty paragraph, or
|
|
1077
1112
|
* `undefined` when none is armed. Set each frame from the synthetic
|
|
1078
1113
|
* paragraph element's geometry and fed to the {@link CursorView}, which has
|
|
1079
1114
|
* no visual-line-map entry to place the caret from otherwise.
|
|
@@ -1783,8 +1818,8 @@ export declare class MeasuredLayoutDebugRendering {
|
|
|
1783
1818
|
* Exposes two DOM nodes the caller can place independently:
|
|
1784
1819
|
*
|
|
1785
1820
|
* - {@link overlayElement} — absolutely positioned; the caller mounts it
|
|
1786
|
-
* inside the editor
|
|
1787
|
-
*
|
|
1821
|
+
* inside the editor overlay container so dashed line-bands and run-boxes
|
|
1822
|
+
* share the measured editor-local coordinates.
|
|
1788
1823
|
* - {@link infoElement} — block-flow; the caller mounts it as a sibling
|
|
1789
1824
|
* *below* the editor. Contains the per-block summary table that used
|
|
1790
1825
|
* to live on the overlay.
|
|
@@ -1795,7 +1830,6 @@ export declare class MeasuredLayoutDebugRendering {
|
|
|
1795
1830
|
* the derived subscribed.
|
|
1796
1831
|
*/
|
|
1797
1832
|
export declare class MeasuredLayoutDebugView extends Disposable {
|
|
1798
|
-
private readonly _overlayParent;
|
|
1799
1833
|
readonly overlayElement: HTMLElement;
|
|
1800
1834
|
readonly infoElement: HTMLElement;
|
|
1801
1835
|
readonly rendering: IObservable<MeasuredLayoutDebugRendering>;
|
|
@@ -1808,6 +1842,7 @@ export declare class MeasuredLayoutDebugView extends Disposable {
|
|
|
1808
1842
|
|
|
1809
1843
|
export declare interface MeasuredLayoutDebugViewOptions {
|
|
1810
1844
|
readonly model: MeasuredLayoutModel;
|
|
1845
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
1811
1846
|
/**
|
|
1812
1847
|
* DEBUG ONLY. Maps an absolute source offset to a fill color for that
|
|
1813
1848
|
* character's glyph rect. The fixture passes the same function to the
|
|
@@ -1842,10 +1877,9 @@ export declare interface MeasuredLayoutDebugViewOptions {
|
|
|
1842
1877
|
export declare class MeasuredLayoutModel {
|
|
1843
1878
|
readonly measurements: ISettableObservable<readonly BlockMeasurement[], void>;
|
|
1844
1879
|
/**
|
|
1845
|
-
* Concatenated visual line map across all mounted blocks.
|
|
1846
|
-
*
|
|
1847
|
-
*
|
|
1848
|
-
* concatenation is well-formed without re-sorting.
|
|
1880
|
+
* Concatenated visual line map across all mounted blocks. Every per-block
|
|
1881
|
+
* map uses the same editor-local coordinate space, so concatenation is
|
|
1882
|
+
* well-formed without translation or re-sorting.
|
|
1849
1883
|
*/
|
|
1850
1884
|
readonly visualLineMap: IObservableWithChange<VisualLineMap, void>;
|
|
1851
1885
|
}
|
|
@@ -1988,7 +2022,9 @@ declare class PendingParagraphViewData {
|
|
|
1988
2022
|
}
|
|
1989
2023
|
|
|
1990
2024
|
/**
|
|
1991
|
-
* Immutable point in
|
|
2025
|
+
* Immutable point in a caller-defined 2D CSS-pixel coordinate space.
|
|
2026
|
+
* Coordinate-owning APIs must document whether values are viewport-client or
|
|
2027
|
+
* editor-local; values from different spaces must not be mixed.
|
|
1992
2028
|
*/
|
|
1993
2029
|
export declare class Point2D {
|
|
1994
2030
|
readonly x: number;
|
|
@@ -1999,8 +2035,8 @@ export declare class Point2D {
|
|
|
1999
2035
|
}
|
|
2000
2036
|
|
|
2001
2037
|
/**
|
|
2002
|
-
* Immutable axis-aligned rectangle in
|
|
2003
|
-
*
|
|
2038
|
+
* Immutable axis-aligned rectangle in a caller-defined 2D CSS-pixel coordinate
|
|
2039
|
+
* space. `x`/`y` is the top-left corner, growing right/down.
|
|
2004
2040
|
*
|
|
2005
2041
|
* Half-open in both dimensions: `right` and `bottom` are excluded.
|
|
2006
2042
|
*/
|
|
@@ -2068,17 +2104,13 @@ export { Selection_2 as Selection }
|
|
|
2068
2104
|
export declare interface SelectionBlock {
|
|
2069
2105
|
readonly block: BlockAstNode;
|
|
2070
2106
|
readonly absoluteStart: number;
|
|
2071
|
-
|
|
2072
|
-
readonly
|
|
2073
|
-
/**
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
* {@link blockViewportClip} needs the scroll box; connector/rect geometry
|
|
2079
|
-
* still uses {@link element}.
|
|
2080
|
-
*/
|
|
2081
|
-
readonly scrollElement: HTMLElement;
|
|
2107
|
+
/** Block border box in editor-local coordinates. */
|
|
2108
|
+
readonly rect: Rect2D;
|
|
2109
|
+
/** Visible horizontal padding-box bounds for a scrolling block. */
|
|
2110
|
+
readonly viewportClip: {
|
|
2111
|
+
readonly left: number;
|
|
2112
|
+
readonly right: number;
|
|
2113
|
+
} | undefined;
|
|
2082
2114
|
}
|
|
2083
2115
|
|
|
2084
2116
|
export declare type SelectionCommand = (ctx: CursorCommandContext, offset: SourceOffset) => Selection_2;
|
|
@@ -2110,11 +2142,10 @@ export declare interface SelectionRect {
|
|
|
2110
2142
|
* envelope shape used by IDE selection rendering.
|
|
2111
2143
|
*/
|
|
2112
2144
|
export declare class SelectionView extends Disposable {
|
|
2113
|
-
private readonly _parent;
|
|
2114
2145
|
readonly element: SVGSVGElement;
|
|
2115
2146
|
readonly rendering: IObservable<SelectionViewRendering>;
|
|
2116
2147
|
private readonly _path;
|
|
2117
|
-
constructor(
|
|
2148
|
+
constructor(options: SelectionViewOptions);
|
|
2118
2149
|
}
|
|
2119
2150
|
|
|
2120
2151
|
export declare interface SelectionViewOptions {
|
|
@@ -2584,7 +2615,8 @@ export declare class VisualLine {
|
|
|
2584
2615
|
|
|
2585
2616
|
/**
|
|
2586
2617
|
* Geometry of the rendered document, as a map from source offsets to 2D
|
|
2587
|
-
* positions and back.
|
|
2618
|
+
* positions and back. All geometry is expressed in the editor overlay's local
|
|
2619
|
+
* CSS-pixel coordinate space.
|
|
2588
2620
|
*
|
|
2589
2621
|
* Structure (top to bottom):
|
|
2590
2622
|
*
|
|
@@ -2619,7 +2651,7 @@ export declare class VisualLineMap {
|
|
|
2619
2651
|
static measure(blockViews: readonly {
|
|
2620
2652
|
readonly absoluteStart: number;
|
|
2621
2653
|
readonly viewNode: ViewNode;
|
|
2622
|
-
}[]): VisualLineMap;
|
|
2654
|
+
}[], coordinateSpace: EditorCoordinateSpace, transform?: EditorCoordinateTransform): VisualLineMap;
|
|
2623
2655
|
constructor(lines: readonly VisualLine[]);
|
|
2624
2656
|
get lineCount(): number;
|
|
2625
2657
|
get isEmpty(): boolean;
|
|
@@ -2704,6 +2736,7 @@ declare interface VisualRunSource {
|
|
|
2704
2736
|
readonly textNode: Text;
|
|
2705
2737
|
/** Offset within `textNode.data` corresponding to `sourceRange.start`. */
|
|
2706
2738
|
readonly textNodeStart: number;
|
|
2739
|
+
readonly coordinateSpace: EditorCoordinateSpace;
|
|
2707
2740
|
}
|
|
2708
2741
|
|
|
2709
2742
|
export declare class VscodeStackedCommentsView extends StackedCommentsPresenter {
|