@vscode/markdown-editor 0.0.2-72 → 0.0.2-74

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 CHANGED
@@ -217,6 +217,11 @@ export declare class BlockViewNode<T extends AnyViewData = AnyViewData> extends
217
217
  export declare interface BlockViewOptions {
218
218
  readonly renderCustomCodeBlock?: (language: string, content: string) => HTMLElement | undefined;
219
219
  readonly onToggleCheckbox?: (item: ListItemAstNode, newChecked: boolean) => void;
220
+ /**
221
+ * Supplies live, declarative metadata for recognized links. The editor owns
222
+ * the markup and styling; providers own lookup, caching, and updates.
223
+ */
224
+ readonly linkPresentationProvider?: ILinkPresentationProvider;
220
225
  /**
221
226
  * Opens a link's URL. Called when the user activates a link: a plain click
222
227
  * while the link's block is inactive (rendered), or a Ctrl/Cmd+click while it
@@ -1952,6 +1957,19 @@ export declare interface IHistoryStrategy {
1952
1957
  record?(operation: () => void, edit?: StringEdit): void;
1953
1958
  }
1954
1959
 
1960
+ export declare interface ILinkPresentation extends IDisposable {
1961
+ /** Current presentation, updated without rebuilding the editor. */
1962
+ readonly presentation: IObservable<LinkPresentation | undefined>;
1963
+ }
1964
+
1965
+ export declare interface ILinkPresentationProvider {
1966
+ /**
1967
+ * Returns `undefined` for unsupported links. The caller disposes the returned
1968
+ * reference when the rendered link disappears.
1969
+ */
1970
+ createLinkPresentation(url: string): ILinkPresentation | undefined;
1971
+ }
1972
+
1955
1973
  export declare class ImageAstNode extends AstNode {
1956
1974
  readonly alt: string;
1957
1975
  readonly url: string;
@@ -2187,11 +2205,41 @@ export declare class LinkAstNode extends AstNode {
2187
2205
  protected _localEquals(o: this): boolean;
2188
2206
  }
2189
2207
 
2208
+ /**
2209
+ * Declarative rendering data for one link. `kind` selects the package-owned
2210
+ * visual treatment; providers never supply DOM or CSS.
2211
+ */
2212
+ export declare interface LinkPresentation {
2213
+ readonly kind: LinkPresentationKind;
2214
+ readonly title?: string;
2215
+ readonly detail?: string;
2216
+ readonly reference?: string;
2217
+ /** Primary resource state, such as pull-request lifecycle or session state. */
2218
+ readonly status?: LinkPresentationStatus;
2219
+ /** Secondary state, such as pull-request CI status. */
2220
+ readonly secondaryStatus?: LinkPresentationStatus;
2221
+ readonly tooltip?: string;
2222
+ readonly ariaLabel?: string;
2223
+ }
2224
+
2225
+ export declare type LinkPresentationKind = 'resource' | 'issue' | 'pullRequest' | 'commit' | 'file' | 'folder' | 'session' | 'repository' | 'branch';
2226
+
2227
+ export declare interface LinkPresentationStatus {
2228
+ readonly kind: LinkPresentationStatusKind;
2229
+ readonly label: string;
2230
+ }
2231
+
2232
+ export declare type LinkPresentationStatusKind = 'neutral' | 'pending' | 'success' | 'warning' | 'error' | 'open' | 'closed' | 'merged' | 'draft' | 'notPlanned';
2233
+
2190
2234
  declare class LinkViewData {
2191
2235
  readonly ast: LinkAstNode;
2236
+ /** Active: render the Markdown source; inactive: allow a rich presentation. */
2237
+ readonly showMarkup: boolean;
2192
2238
  readonly content: readonly AnyViewData[];
2193
2239
  readonly kind = "link";
2194
- constructor(ast: LinkAstNode, content: readonly AnyViewData[]);
2240
+ constructor(ast: LinkAstNode,
2241
+ /** Active: render the Markdown source; inactive: allow a rich presentation. */
2242
+ showMarkup: boolean, content: readonly AnyViewData[]);
2195
2243
  }
2196
2244
 
2197
2245
  export declare class ListAstNode extends BlockAstNodeBase {
@@ -2228,12 +2276,26 @@ declare class ListItemViewData {
2228
2276
  readonly content: readonly AnyViewData[];
2229
2277
  /** 1-based list nesting depth, used to size the indentation gutter. */
2230
2278
  readonly level: number;
2279
+ /**
2280
+ * Whether this is an inactive task item whose first paragraph begins
2281
+ * with the `:running:` marker (see {@link TextViewData.hiddenPrefixLength}).
2282
+ * Always `false` while the item is active — an active/editing task
2283
+ * reveals the literal marker instead of the progress affordance.
2284
+ */
2285
+ readonly isRunning: boolean;
2231
2286
  readonly kind = "listItem";
2232
2287
  constructor(ast: ListItemAstNode,
2233
2288
  /** Whether the selection reaches this item (reveals its markers). */
2234
2289
  isActive: boolean, content: readonly AnyViewData[],
2235
2290
  /** 1-based list nesting depth, used to size the indentation gutter. */
2236
- level: number);
2291
+ level: number,
2292
+ /**
2293
+ * Whether this is an inactive task item whose first paragraph begins
2294
+ * with the `:running:` marker (see {@link TextViewData.hiddenPrefixLength}).
2295
+ * Always `false` while the item is active — an active/editing task
2296
+ * reveals the literal marker instead of the progress affordance.
2297
+ */
2298
+ isRunning?: boolean);
2237
2299
  }
2238
2300
 
2239
2301
  declare class ListViewData {
@@ -2686,6 +2748,30 @@ declare interface ReplacedItem {
2686
2748
  readonly deletedLocal: readonly AnnotatedRange[];
2687
2749
  }
2688
2750
 
2751
+ export declare class RichLink {
2752
+ static create(options: RichLinkOptions): RichLink;
2753
+ static mount(element: HTMLElement, authoredLabel: HTMLSpanElement): RichLink;
2754
+ static clear(element: HTMLElement): void;
2755
+ readonly element: HTMLElement;
2756
+ readonly authoredLabel: HTMLSpanElement;
2757
+ private readonly _icon;
2758
+ private readonly _title;
2759
+ private readonly _detail;
2760
+ private readonly _reference;
2761
+ private readonly _status;
2762
+ private readonly _secondaryStatus;
2763
+ private constructor();
2764
+ update(presentation: LinkPresentation | undefined): void;
2765
+ private _renderUnavailable;
2766
+ private _setDefaultOrder;
2767
+ }
2768
+
2769
+ export declare interface RichLinkOptions {
2770
+ readonly href: string;
2771
+ readonly authoredLabel: string;
2772
+ readonly presentation?: LinkPresentation;
2773
+ }
2774
+
2689
2775
  export declare const selectAll: SelectionCommand;
2690
2776
 
2691
2777
  export declare function selectBlock(ctx: CursorCommandContext, blockRange: OffsetRange): Selection_2;
@@ -2990,6 +3076,13 @@ declare class TextViewData {
2990
3076
  readonly showWhitespace: boolean;
2991
3077
  readonly leftWordBoundary: boolean;
2992
3078
  readonly rightWordBoundary: boolean;
3079
+ /**
3080
+ * Number of leading source characters to keep out of the rendered
3081
+ * text (but not out of the source): the `:running:` marker plus its
3082
+ * mandatory leading separator, once
3083
+ * {@link isRunnerMarkerText} has matched this node. Zero otherwise.
3084
+ */
3085
+ readonly hiddenPrefixLength: number;
2993
3086
  readonly kind = "text";
2994
3087
  /**
2995
3088
  * Whether non-obvious whitespace in this text is revealed (block is active).
@@ -2998,7 +3091,14 @@ declare class TextViewData {
2998
3091
  * emphasis); a single space touching such a sibling is obvious and stays
2999
3092
  * undecorated, just like a space between two words within this leaf.
3000
3093
  */
3001
- constructor(ast: TextAstNode, showWhitespace: boolean, leftWordBoundary?: boolean, rightWordBoundary?: boolean);
3094
+ constructor(ast: TextAstNode, showWhitespace: boolean, leftWordBoundary?: boolean, rightWordBoundary?: boolean,
3095
+ /**
3096
+ * Number of leading source characters to keep out of the rendered
3097
+ * text (but not out of the source): the `:running:` marker plus its
3098
+ * mandatory leading separator, once
3099
+ * {@link isRunnerMarkerText} has matched this node. Zero otherwise.
3100
+ */
3101
+ hiddenPrefixLength?: number);
3002
3102
  }
3003
3103
 
3004
3104
  export declare class ThematicBreakAstNode extends BlockAstNodeBase {