@vscode/markdown-editor 0.0.2-2 → 0.0.2-21

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.
Files changed (29) hide show
  1. package/dist/_observables/observableInternal/index.d.ts +1 -1
  2. package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +1 -1
  3. package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +1 -1
  4. package/dist/_observables/observableInternal/logging/logging.d.ts +1 -1
  5. package/dist/_observables/observableInternal/reactions/{autorun.d.ts → createEffect.d.ts} +11 -3
  6. package/dist/index.d.ts +1000 -52
  7. package/dist/index.js +4005 -2074
  8. package/dist/index.js.map +1 -1
  9. package/dist/markdown-editor.css +1 -0
  10. package/dist/observables.js +79 -101
  11. package/dist/observables.js.map +1 -1
  12. package/dist/{runOnChange-owE1SMC0.js → runOnChange-CkxK2gSn.js} +191 -163
  13. package/dist/runOnChange-CkxK2gSn.js.map +1 -0
  14. package/dist/stringEdit-DzLs4E1d.js +177 -0
  15. package/dist/stringEdit-DzLs4E1d.js.map +1 -0
  16. package/dist/web-editors.d.ts +125 -0
  17. package/dist/web-editors.js +5185 -0
  18. package/dist/web-editors.js.map +1 -0
  19. package/package.json +36 -9
  20. package/src/contrib/comments/commentInput.css +150 -0
  21. package/src/contrib/comments/comments.css +129 -0
  22. package/src/contrib/commentsVscode/vscodeCommentWidgetV2.css +166 -0
  23. package/src/view/editor.css +526 -32
  24. package/src/view/themes/default.css +11 -3
  25. package/src/view/themes/github.css +12 -9
  26. package/src/view/themes/vscode-default.css +347 -0
  27. package/src/view/themes/vscode-github.css +349 -0
  28. package/dist/runOnChange-owE1SMC0.js.map +0 -1
  29. /package/dist/_observables/observableInternal/reactions/{autorunImpl.d.ts → createEffectImpl.d.ts} +0 -0
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Build an {@link IEmbeddedCodeEditorFactory} that renders matching code blocks
3
+ * with the sample web editor embedded in an iframe.
4
+ */
5
+ export declare function createIframeEmbeddedEditorFactory(options: IframeEmbeddedEditorOptions): IEmbeddedCodeEditorFactory;
6
+
7
+ /**
8
+ * A live editor embedded in place of a fenced code block's *rendered* form.
9
+ *
10
+ * This is the internal seam between the block view and a concrete embedded
11
+ * editor (e.g. an `<iframe>` speaking the web-editor protocol). The block view
12
+ * only speaks string edits: it pushes the block's content down via
13
+ * {@link setContent} and receives the editor's own changes back through
14
+ * {@link onEdit} (set by the block view on each (re)construction, so it always
15
+ * routes to the current AST node). The concrete implementation owns its DOM,
16
+ * transport, and lifecycle.
17
+ *
18
+ * A single instance is adopted across re-renders (like the highlighter session)
19
+ * so the underlying editor keeps its state across edits — see
20
+ * {@link CodeBlockViewNode}.
21
+ */
22
+ declare interface IEmbeddedCodeEditor {
23
+ /** The element mounted as the block's rendered form. */
24
+ readonly element: HTMLElement;
25
+ /**
26
+ * Document → editor. The block's content changed (from any source). Must be
27
+ * idempotent: pushing the content the editor already holds is a no-op, which
28
+ * is how edits the editor itself originated are prevented from echoing back.
29
+ */
30
+ setContent(content: string): void;
31
+ /**
32
+ * Optional synchronous height (px) to reserve for `content` *before* the
33
+ * editor has laid out. Return `undefined` to let the editor size itself
34
+ * (the implementation may report its real height later). Lets a registration
35
+ * avoid a layout jump when it can cheaply estimate the size from content.
36
+ */
37
+ estimateHeight?(content: string): number | undefined;
38
+ /**
39
+ * Editor → document. Set by the block view on every (re)construction to
40
+ * route the editor's own edits, expressed in the block's *content*
41
+ * coordinates, to the current AST node.
42
+ */
43
+ onEdit?: (edit: StringEdit) => void;
44
+ dispose(): void;
45
+ }
46
+
47
+ /** Creates an {@link IEmbeddedCodeEditor} for a fenced block, or opts out. */
48
+ declare interface IEmbeddedCodeEditorFactory {
49
+ /**
50
+ * Return an editor for a fenced block of `language`, or `undefined` to fall
51
+ * back to the default (highlighting / {@link BlockViewOptions.renderCustomCodeBlock}).
52
+ */
53
+ create(language: string, initialContent: string): IEmbeddedCodeEditor | undefined;
54
+ }
55
+
56
+ export declare interface IframeEmbeddedEditorOptions {
57
+ /** The guest bundle source (an IIFE/ESM string), inlined into the iframe. */
58
+ readonly bundleJs: string;
59
+ /** Decide whether this factory handles `language`. */
60
+ readonly handlesLanguage: (language: string) => boolean;
61
+ /** Theme CSS injected into the iframe `<head>` (e.g. `--vscode-*` variables). */
62
+ readonly themeCss?: string;
63
+ /**
64
+ * Optional synchronous height (px) reserved from content before the guest
65
+ * measures itself. Return `undefined` to let the guest size the frame.
66
+ */
67
+ readonly estimateHeight?: (content: string) => number | undefined;
68
+ }
69
+
70
+ declare class OffsetRange {
71
+ readonly start: number;
72
+ readonly endExclusive: number;
73
+ static fromTo(start: number, endExclusive: number): OffsetRange;
74
+ static ofLength(length: number): OffsetRange;
75
+ static ofStartAndLength(start: number, length: number): OffsetRange;
76
+ static emptyAt(offset: number): OffsetRange;
77
+ constructor(start: number, endExclusive: number);
78
+ get isEmpty(): boolean;
79
+ get length(): number;
80
+ delta(offset: number): OffsetRange;
81
+ deltaStart(offset: number): OffsetRange;
82
+ deltaEnd(offset: number): OffsetRange;
83
+ contains(offset: number): boolean;
84
+ containsRange(other: OffsetRange): boolean;
85
+ intersects(other: OffsetRange): boolean;
86
+ intersectsOrTouches(other: OffsetRange): boolean;
87
+ intersect(other: OffsetRange): OffsetRange | undefined;
88
+ join(other: OffsetRange): OffsetRange;
89
+ isBefore(other: OffsetRange): boolean;
90
+ isAfter(other: OffsetRange): boolean;
91
+ substring(str: string): string;
92
+ slice<T>(arr: readonly T[]): T[];
93
+ equals(other: OffsetRange): boolean;
94
+ toString(): string;
95
+ }
96
+
97
+ declare class StringEdit {
98
+ static readonly empty: StringEdit;
99
+ static single(replacement: StringReplacement): StringEdit;
100
+ static replace(range: OffsetRange, text: string): StringEdit;
101
+ static insert(offset: number, text: string): StringEdit;
102
+ static delete(range: OffsetRange): StringEdit;
103
+ readonly replacements: readonly StringReplacement[];
104
+ constructor(replacements: readonly StringReplacement[]);
105
+ get isEmpty(): boolean;
106
+ apply(base: string): string;
107
+ inverse(original: string): StringEdit;
108
+ equals(other: StringEdit): boolean;
109
+ mapOffset(offset: number): number;
110
+ toString(): string;
111
+ }
112
+
113
+ declare class StringReplacement {
114
+ readonly replaceRange: OffsetRange;
115
+ readonly newText: string;
116
+ static insert(offset: number, text: string): StringReplacement;
117
+ static replace(range: OffsetRange, text: string): StringReplacement;
118
+ static delete(range: OffsetRange): StringReplacement;
119
+ constructor(replaceRange: OffsetRange, newText: string);
120
+ get isEmpty(): boolean;
121
+ equals(other: StringReplacement): boolean;
122
+ toString(): string;
123
+ }
124
+
125
+ export { }