@vscode/markdown-editor 0.0.2-73 → 0.0.2-75

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,47 @@ 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 changes?: LinkPresentationChanges;
2222
+ readonly tooltip?: string;
2223
+ readonly ariaLabel?: string;
2224
+ }
2225
+
2226
+ declare interface LinkPresentationChanges {
2227
+ readonly insertions: number;
2228
+ readonly deletions: number;
2229
+ }
2230
+
2231
+ export declare type LinkPresentationKind = 'resource' | 'issue' | 'pullRequest' | 'commit' | 'file' | 'folder' | 'session' | 'repository' | 'branch';
2232
+
2233
+ export declare interface LinkPresentationStatus {
2234
+ readonly kind: LinkPresentationStatusKind;
2235
+ readonly label: string;
2236
+ }
2237
+
2238
+ export declare type LinkPresentationStatusKind = 'neutral' | 'pending' | 'success' | 'warning' | 'error' | 'open' | 'closed' | 'merged' | 'draft' | 'notPlanned';
2239
+
2190
2240
  declare class LinkViewData {
2191
2241
  readonly ast: LinkAstNode;
2242
+ /** Active: render the Markdown source; inactive: allow a rich presentation. */
2243
+ readonly showMarkup: boolean;
2192
2244
  readonly content: readonly AnyViewData[];
2193
2245
  readonly kind = "link";
2194
- constructor(ast: LinkAstNode, content: readonly AnyViewData[]);
2246
+ constructor(ast: LinkAstNode,
2247
+ /** Active: render the Markdown source; inactive: allow a rich presentation. */
2248
+ showMarkup: boolean, content: readonly AnyViewData[]);
2195
2249
  }
2196
2250
 
2197
2251
  export declare class ListAstNode extends BlockAstNodeBase {
@@ -2700,6 +2754,31 @@ declare interface ReplacedItem {
2700
2754
  readonly deletedLocal: readonly AnnotatedRange[];
2701
2755
  }
2702
2756
 
2757
+ export declare class RichLink {
2758
+ static create(options: RichLinkOptions): RichLink;
2759
+ static mount(element: HTMLElement, authoredLabel: HTMLSpanElement): RichLink;
2760
+ static clear(element: HTMLElement): void;
2761
+ readonly element: HTMLElement;
2762
+ readonly authoredLabel: HTMLSpanElement;
2763
+ private readonly _icon;
2764
+ private readonly _title;
2765
+ private readonly _detail;
2766
+ private readonly _reference;
2767
+ private readonly _changes;
2768
+ private readonly _status;
2769
+ private readonly _secondaryStatus;
2770
+ private constructor();
2771
+ update(presentation: LinkPresentation | undefined): void;
2772
+ private _renderUnavailable;
2773
+ private _setDefaultOrder;
2774
+ }
2775
+
2776
+ export declare interface RichLinkOptions {
2777
+ readonly href: string;
2778
+ readonly authoredLabel: string;
2779
+ readonly presentation?: LinkPresentation;
2780
+ }
2781
+
2703
2782
  export declare const selectAll: SelectionCommand;
2704
2783
 
2705
2784
  export declare function selectBlock(ctx: CursorCommandContext, blockRange: OffsetRange): Selection_2;