markdown-komponents 0.2.0 → 0.3.0
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.
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
// base are silently dropped from the declaration. Patching that generator output turned out to be
|
|
9
9
|
// more fragile than just declaring the (small, stable) consumer-facing surface directly.
|
|
10
10
|
//
|
|
11
|
+
// Plain `.d.ts`, not `.d.mts`: the `.d.mts` extension didn't exist before TypeScript 4.7 (2022), so
|
|
12
|
+
// older TypeScript (e.g. 3.9, confirmed against a real consumer) can't find it via package.json's
|
|
13
|
+
// "types" field at all. This file has no ESM-specific syntax in it, so a plain `.d.ts` describes the
|
|
14
|
+
// same shape and works everywhere.
|
|
15
|
+
//
|
|
11
16
|
// Keep this in sync with the real Kotlin source under src/jsMain/kotlin — it is NOT derived from it
|
|
12
17
|
// automatically. `@JsExport` in the Kotlin source is what makes these actually exist as runtime
|
|
13
18
|
// bindings; this file only describes their shape to TypeScript.
|
|
@@ -79,7 +84,9 @@ export class MarkdownComponentsRenderer implements MarkdownRenderer {
|
|
|
79
84
|
*/
|
|
80
85
|
export class TsStackMarkdownRenderer {
|
|
81
86
|
constructor(delegate?: MarkdownRenderer);
|
|
82
|
-
|
|
87
|
+
// `encode` optional to match the real `@ts-stack/markdown` type
|
|
88
|
+
// (node_modules/@ts-stack/markdown/src/interfaces.d.ts) it's meant to reflect.
|
|
89
|
+
protected readonly options: { escape?: (html: string, encode?: boolean) => string };
|
|
83
90
|
/** Also called directly by this library's fenced-code-with-explicit-id block rule. */
|
|
84
91
|
codeWithAnchor(code: string, lang: string | null | undefined, id: string | null | undefined, escaped?: boolean | null): string;
|
|
85
92
|
code(code: string, lang: string | null | undefined, escaped: boolean | null | undefined, meta: string | null | undefined): string;
|
|
@@ -121,7 +128,9 @@ export abstract class BaseMarkdownDocument extends HTMLElement {
|
|
|
121
128
|
parser: (markdown: string) => string;
|
|
122
129
|
markdown: string;
|
|
123
130
|
toolbar: Element | null;
|
|
124
|
-
|
|
131
|
+
// Document | ShadowRoot: a consumer setting this from inside a shadow-DOM component (the intended
|
|
132
|
+
// use — see getSelection() below) has a real ShadowRoot here, not a Document.
|
|
133
|
+
selectionRoot: Document | ShadowRoot;
|
|
125
134
|
onLinkClick: ((url: string) => void) | null;
|
|
126
135
|
autoNormalize: boolean;
|
|
127
136
|
readonly currentSelection: Selection | null;
|
|
@@ -198,3 +207,14 @@ export class MarkdownParagraph extends HTMLElement {
|
|
|
198
207
|
getMarkdown(): string;
|
|
199
208
|
isEmpty(): boolean;
|
|
200
209
|
}
|
|
210
|
+
|
|
211
|
+
declare global {
|
|
212
|
+
interface HTMLElementTagNameMap {
|
|
213
|
+
'markdown-document': MarkdownDocument;
|
|
214
|
+
'markdown-editor': MarkdownEditor;
|
|
215
|
+
'markdown-toolbar': MarkdownToolbar;
|
|
216
|
+
'markdown-toc': MarkdownToc;
|
|
217
|
+
'markdown-image': MarkdownImage;
|
|
218
|
+
'markdown-paragraph': MarkdownParagraph;
|
|
219
|
+
}
|
|
220
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-komponents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"main": "markdown-komponents.mjs",
|
|
5
|
-
"types": "markdown-komponents.d.
|
|
5
|
+
"types": "markdown-komponents.d.ts",
|
|
6
6
|
"devDependencies": {},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"highlight.js": "10.5.0",
|