@aicayzer/inkkit 0.0.18 → 0.1.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.
- package/NOTICE +4 -2
- package/README.md +11 -7
- package/dist/THIRD-PARTY-NOTICES.txt +2742 -0
- package/dist/chunks/core-vtCr4MBS.js +56503 -0
- package/dist/chunks/highlight-Daj2fv_u.js +14122 -0
- package/dist/core.d.ts +2 -5
- package/dist/core.js +2 -2
- package/dist/editor.d.ts +229 -47
- package/dist/index.js +5 -3
- package/dist/style.css +231 -202
- package/dist/types.d.ts +143 -18
- package/package.json +16 -13
- package/dist/autolink.d.ts +0 -1
- package/dist/autolink.js +0 -18
- package/dist/callouts.d.ts +0 -25
- package/dist/callouts.js +0 -288
- package/dist/clipboard.d.ts +0 -11
- package/dist/clipboard.js +0 -261
- package/dist/code-fences.d.ts +0 -8
- package/dist/code-fences.js +0 -171
- package/dist/comments.d.ts +0 -76
- package/dist/comments.js +0 -545
- package/dist/cursor.d.ts +0 -2
- package/dist/cursor.js +0 -40
- package/dist/decorations.d.ts +0 -2
- package/dist/decorations.js +0 -67
- package/dist/dialect.d.ts +0 -9
- package/dist/dialect.js +0 -446
- package/dist/drop-placement.d.ts +0 -19
- package/dist/drop-placement.js +0 -47
- package/dist/editor.js +0 -2673
- package/dist/files.d.ts +0 -40
- package/dist/files.js +0 -133
- package/dist/highlight.d.ts +0 -1
- package/dist/highlight.js +0 -136
- package/dist/html-import.d.ts +0 -13
- package/dist/html-import.js +0 -477
- package/dist/image-blocks.d.ts +0 -86
- package/dist/image-blocks.js +0 -329
- package/dist/images.d.ts +0 -51
- package/dist/images.js +0 -398
- package/dist/inline-highlight.d.ts +0 -6
- package/dist/inline-highlight.js +0 -112
- package/dist/labels.d.ts +0 -36
- package/dist/labels.js +0 -34
- package/dist/link-safety.d.ts +0 -17
- package/dist/link-safety.js +0 -29
- package/dist/linked-syntax.d.ts +0 -48
- package/dist/linked-syntax.js +0 -320
- package/dist/literals.d.ts +0 -20
- package/dist/literals.js +0 -216
- package/dist/mermaid.d.ts +0 -28
- package/dist/mermaid.js +0 -404
- package/dist/outline.d.ts +0 -22
- package/dist/outline.js +0 -79
- package/dist/paste-html.d.ts +0 -31
- package/dist/paste-html.js +0 -462
- package/dist/paste.d.ts +0 -33
- package/dist/paste.js +0 -591
- package/dist/portable-files.d.ts +0 -10
- package/dist/portable-files.js +0 -36
- package/dist/preserve.d.ts +0 -38
- package/dist/preserve.js +0 -1396
- package/dist/print.d.ts +0 -7
- package/dist/print.js +0 -406
- package/dist/reference-clipboard.d.ts +0 -8
- package/dist/reference-clipboard.js +0 -201
- package/dist/references.d.ts +0 -16
- package/dist/references.js +0 -418
- package/dist/scroll.d.ts +0 -15
- package/dist/scroll.js +0 -27
- package/dist/search.d.ts +0 -15
- package/dist/search.js +0 -202
- package/dist/selection.d.ts +0 -1
- package/dist/selection.js +0 -59
- package/dist/source.d.ts +0 -16
- package/dist/source.js +0 -57
- package/dist/spreadsheet.d.ts +0 -8
- package/dist/spreadsheet.js +0 -289
- package/dist/table-alignment.d.ts +0 -2
- package/dist/table-alignment.js +0 -46
- package/dist/tables.d.ts +0 -27
- package/dist/tables.js +0 -344
- package/dist/tasks.d.ts +0 -3
- package/dist/tasks.js +0 -51
- package/dist/text-ranges.d.ts +0 -29
- package/dist/text-ranges.js +0 -256
- package/dist/types.js +0 -8
- package/dist/wiki-view.d.ts +0 -21
- package/dist/wiki-view.js +0 -78
package/dist/types.d.ts
CHANGED
|
@@ -1,65 +1,105 @@
|
|
|
1
|
+
/** `md` is Markdown; `txt` is literal text, shown and saved as typed. */
|
|
1
2
|
export type DocumentFormat = 'md' | 'txt';
|
|
3
|
+
/** What every adapter call receives, to tell which document, load and call it belongs to. The
|
|
4
|
+
* operation ID is opaque and differs for each call from one editor. */
|
|
2
5
|
export interface DocumentContext {
|
|
3
6
|
documentId: string;
|
|
4
7
|
generation: number;
|
|
5
8
|
operationId: string;
|
|
6
9
|
}
|
|
10
|
+
/** A document to load. `generation` must be greater than the loaded one. */
|
|
7
11
|
export interface DocumentInput {
|
|
8
12
|
documentId: string;
|
|
9
13
|
generation: number;
|
|
10
14
|
format: DocumentFormat;
|
|
11
15
|
text: string;
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
/** Which document an output describes: the load, named by its generation, and the revision of
|
|
18
|
+
* its content within that load. */
|
|
19
|
+
export interface DocumentVersion {
|
|
20
|
+
documentId: string;
|
|
21
|
+
generation: number;
|
|
14
22
|
revision: number;
|
|
23
|
+
}
|
|
24
|
+
/** The complete current text. `dirty` is true when it differs from the text of the last load. */
|
|
25
|
+
export interface DocumentSnapshot extends DocumentInput, DocumentVersion {
|
|
15
26
|
dirty: boolean;
|
|
16
27
|
}
|
|
17
|
-
|
|
28
|
+
/** The closed list of failure codes. The API reference describes each one. */
|
|
29
|
+
export declare const editorErrorCodes: readonly ['not-ready', 'destroyed', 'stale-document', 'composition', 'operation-pending', 'read-only', 'invalid-argument', 'invalid-range', 'preservation', 'image-unavailable', 'diagram-unavailable', 'file-unavailable', 'clipboard-unavailable', 'internal'];
|
|
30
|
+
export type EditorErrorCode = (typeof editorErrorCodes)[number];
|
|
31
|
+
/** Every failure InkKit reports. Hosts branch on `code`; `message` is for logs. When the failure
|
|
32
|
+
* started elsewhere, such as in an adapter, the host clipboard or the renderer, `cause` holds the
|
|
33
|
+
* original error. */
|
|
18
34
|
export declare class InkKitError extends Error {
|
|
19
35
|
readonly code: EditorErrorCode;
|
|
20
|
-
constructor(code: EditorErrorCode, message: string
|
|
36
|
+
constructor(code: EditorErrorCode, message: string, options?: {
|
|
37
|
+
cause?: unknown;
|
|
38
|
+
});
|
|
21
39
|
}
|
|
40
|
+
/** Image bytes that the editor captured from a paste or drop, for the adapter to store. */
|
|
22
41
|
export interface CapturedImage {
|
|
23
42
|
bytes: Uint8Array;
|
|
24
43
|
mimeType: string;
|
|
25
44
|
filename?: string;
|
|
45
|
+
/** The `src` of the HTML image the bytes belong to, when there is one. */
|
|
26
46
|
source?: string;
|
|
27
47
|
}
|
|
48
|
+
/** Image bytes that leave the editor in clipboard and print output. */
|
|
28
49
|
export interface PortableImage {
|
|
29
50
|
bytes: Uint8Array;
|
|
30
51
|
mimeType: string;
|
|
31
52
|
filename?: string;
|
|
32
53
|
}
|
|
54
|
+
/** Stores, shows and exports the images a host owns. References stay opaque to the editor. */
|
|
33
55
|
export interface ImageAdapter {
|
|
56
|
+
/** The display URL for `reference`, or `undefined` when the image is unavailable. */
|
|
34
57
|
presentation(reference: string): {
|
|
35
58
|
url: string;
|
|
36
59
|
} | undefined;
|
|
60
|
+
/** Stores the bytes and returns the reference to write into the Markdown. */
|
|
37
61
|
importImage(input: CapturedImage, context: DocumentContext): Promise<{
|
|
38
62
|
reference: string;
|
|
39
63
|
}>;
|
|
64
|
+
/** The stored bytes and type of `reference`, for portable clipboard and print output. */
|
|
40
65
|
exportImage(reference: string, context: DocumentContext): Promise<PortableImage>;
|
|
41
66
|
}
|
|
67
|
+
/** A wiki link as authored. */
|
|
42
68
|
export interface WikiLinkReference {
|
|
69
|
+
/** The note name, with escapes removed. Empty for a link such as `[[#Heading]]`. */
|
|
43
70
|
target: string;
|
|
44
71
|
fragment?: string;
|
|
72
|
+
/** The text shown: the alias, or the target and fragment. */
|
|
45
73
|
label: string;
|
|
46
74
|
}
|
|
75
|
+
/** Resolves and opens wiki links. The host owns lookup, permissions and navigation. */
|
|
47
76
|
export interface WikiLinkAdapter {
|
|
77
|
+
/** Whether the target is missing, for presentation only. */
|
|
48
78
|
resolve?(reference: WikiLinkReference, context: DocumentContext): {
|
|
49
79
|
missing?: boolean;
|
|
50
80
|
} | undefined;
|
|
81
|
+
/** Called by Mod-click, and by Enter or Space on the focused link. */
|
|
51
82
|
open(reference: WikiLinkReference, context: DocumentContext): void;
|
|
52
83
|
}
|
|
84
|
+
/** A file the document refers to, as authored. */
|
|
53
85
|
export interface FileReference {
|
|
86
|
+
/** The whole reference, including any fragment. */
|
|
54
87
|
reference: string;
|
|
88
|
+
/** `path` for ``, `wiki` for `![[name]]`. */
|
|
55
89
|
kind: 'path' | 'wiki';
|
|
90
|
+
/** The reference without its fragment. Use it to find the file. */
|
|
91
|
+
target: string;
|
|
92
|
+
/** Everything after the separating `#`, such as `t=10` or `page=3`. */
|
|
56
93
|
fragment?: string;
|
|
57
94
|
label?: string;
|
|
95
|
+
/** The authored width in pixels. */
|
|
58
96
|
width?: number;
|
|
59
97
|
}
|
|
98
|
+
/** The context of a file call. Abandon the work when `signal` aborts. */
|
|
60
99
|
export interface FileContext extends DocumentContext {
|
|
61
100
|
signal: AbortSignal;
|
|
62
101
|
}
|
|
102
|
+
/** How the host shows a file. `url` must be private to the host and usable offline. */
|
|
63
103
|
export type FilePresentation = {
|
|
64
104
|
kind: 'image' | 'audio' | 'video' | 'pdf';
|
|
65
105
|
url: string;
|
|
@@ -73,69 +113,91 @@ export type FilePresentation = {
|
|
|
73
113
|
label?: string;
|
|
74
114
|
message: string;
|
|
75
115
|
};
|
|
116
|
+
/** Resolves, exports and opens files. The host owns storage, permissions and native actions. */
|
|
76
117
|
export interface FileAdapter {
|
|
118
|
+
/** Decides what kind of file `reference` is and how to show it. InkKit never guesses from the
|
|
119
|
+
* extension. */
|
|
77
120
|
resolve(reference: FileReference, context: FileContext): Promise<FilePresentation>;
|
|
121
|
+
/** Portable bytes of an image for copy and print. Named images need it. */
|
|
78
122
|
exportImage?(reference: FileReference, context: FileContext): Promise<PortableImage>;
|
|
123
|
+
/** Adds an Open button to file cards. */
|
|
79
124
|
open?(reference: FileReference, context: DocumentContext): void;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
clientY: number;
|
|
83
|
-
}, context: DocumentContext): void;
|
|
125
|
+
/** Called for a context-menu request on a file card. */
|
|
126
|
+
contextMenu?(reference: FileReference, point: ClientPoint, context: DocumentContext): void;
|
|
84
127
|
}
|
|
128
|
+
/** A position in CSS pixels in the web view's client area, as in DOM pointer events. */
|
|
129
|
+
export interface ClientPoint {
|
|
130
|
+
clientX: number;
|
|
131
|
+
clientY: number;
|
|
132
|
+
}
|
|
133
|
+
/** What the host read from the native clipboard. */
|
|
85
134
|
export interface ClipboardInput {
|
|
86
135
|
text: string;
|
|
136
|
+
/** Explicit Markdown source. It takes precedence over `text` and `html`. */
|
|
87
137
|
markdown?: string;
|
|
88
138
|
html?: string;
|
|
139
|
+
/** Bytes for the images that `html` refers to. */
|
|
89
140
|
images?: CapturedImage[];
|
|
90
|
-
plainText?: boolean;
|
|
91
141
|
}
|
|
142
|
+
/** An image in clipboard output. */
|
|
92
143
|
export interface ClipboardImage {
|
|
144
|
+
/** The authored reference. Empty for the picture of a diagram. */
|
|
93
145
|
reference: string;
|
|
94
146
|
alt: string;
|
|
95
147
|
image?: PortableImage;
|
|
148
|
+
/** Why `image` is missing. */
|
|
96
149
|
error?: string;
|
|
97
150
|
}
|
|
98
|
-
|
|
151
|
+
/** What `clipboardSnapshot` copies: the whole document or the current selection. */
|
|
152
|
+
export type ClipboardScope = 'document' | 'selection';
|
|
153
|
+
/** Clipboard content, with the document version it was copied from. */
|
|
154
|
+
export interface ClipboardOutput extends DocumentVersion {
|
|
99
155
|
text: string;
|
|
100
156
|
html: string;
|
|
101
157
|
markdown: string;
|
|
102
158
|
images: ClipboardImage[];
|
|
103
|
-
diagrams
|
|
159
|
+
diagrams: ClipboardDiagram[];
|
|
104
160
|
}
|
|
161
|
+
/** A complete Mermaid diagram in clipboard output. */
|
|
105
162
|
export interface ClipboardDiagram {
|
|
106
163
|
source: string;
|
|
164
|
+
/** A PNG of the rendered diagram. */
|
|
107
165
|
image?: PortableImage;
|
|
166
|
+
/** Why `image` is missing. The source is still in the output. */
|
|
108
167
|
error?: string;
|
|
109
168
|
}
|
|
169
|
+
/** Output that degraded, such as a diagram printed as code or a file printed as a description. */
|
|
110
170
|
export interface PrintableWarning {
|
|
111
171
|
code: 'diagram-unavailable' | 'attachment-fallback' | 'attachment-unavailable';
|
|
112
172
|
message: string;
|
|
113
173
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
generation: number;
|
|
117
|
-
revision: number;
|
|
174
|
+
/** The whole document, ready to print. The host owns the Print or PDF command. */
|
|
175
|
+
export interface PrintableDocument extends DocumentVersion {
|
|
118
176
|
format: DocumentFormat;
|
|
177
|
+
/** A standalone HTML document with the print CSS embedded and `data:` images only. */
|
|
119
178
|
html: string;
|
|
179
|
+
/** The print CSS on its own. */
|
|
120
180
|
styles: string;
|
|
181
|
+
/** The images, in the order they appear in `html`. */
|
|
121
182
|
assets: readonly PortableImage[];
|
|
122
183
|
warnings: readonly PrintableWarning[];
|
|
123
184
|
}
|
|
185
|
+
/** A range of readable text. Offsets are zero-based UTF-16 code units in the `text` of the
|
|
186
|
+
* snapshot that `snapshotId` names, with `to` exclusive. */
|
|
124
187
|
export interface TextRange {
|
|
125
188
|
snapshotId: string;
|
|
126
189
|
from: number;
|
|
127
190
|
to: number;
|
|
128
191
|
}
|
|
129
|
-
|
|
192
|
+
/** The editor's readable text and selection. Ranges from it go stale when the document changes. */
|
|
193
|
+
export interface ReadableTextSnapshot extends DocumentVersion {
|
|
130
194
|
snapshotId: string;
|
|
131
|
-
documentId: string;
|
|
132
|
-
generation: number;
|
|
133
|
-
revision: number;
|
|
134
195
|
format: DocumentFormat;
|
|
135
196
|
mode: 'source' | 'formatted';
|
|
136
197
|
text: string;
|
|
137
198
|
selection: TextRange;
|
|
138
199
|
}
|
|
200
|
+
/** A rectangle in CSS pixels in the web view's client coordinate space. */
|
|
139
201
|
export interface TextRect {
|
|
140
202
|
left: number;
|
|
141
203
|
top: number;
|
|
@@ -144,6 +206,7 @@ export interface TextRect {
|
|
|
144
206
|
width: number;
|
|
145
207
|
height: number;
|
|
146
208
|
}
|
|
209
|
+
/** How far host chrome covers each edge of the visible area, in non-negative CSS pixels. */
|
|
147
210
|
export interface ViewportInsets {
|
|
148
211
|
top: number;
|
|
149
212
|
right: number;
|
|
@@ -151,12 +214,74 @@ export interface ViewportInsets {
|
|
|
151
214
|
left: number;
|
|
152
215
|
}
|
|
153
216
|
export interface ViewportOptions {
|
|
217
|
+
/** The element that scrolls. It must be the root or an ancestor of it. Defaults to the root. */
|
|
154
218
|
scrollContainer?: HTMLElement;
|
|
155
219
|
insets?: Partial<ViewportInsets>;
|
|
156
220
|
}
|
|
157
221
|
export interface ViewportSnapshot {
|
|
222
|
+
/** The visible area, less the insets. */
|
|
158
223
|
rect: TextRect;
|
|
159
224
|
insets: ViewportInsets;
|
|
225
|
+
/** The combined scroll offsets of the container and, in source and TXT modes, the textarea. */
|
|
160
226
|
scrollTop: number;
|
|
161
227
|
scrollLeft: number;
|
|
162
228
|
}
|
|
229
|
+
/** Built-in editor text. Hosts can override individual labels at mount time. */
|
|
230
|
+
export interface EditorLabels {
|
|
231
|
+
formattedEditor: string;
|
|
232
|
+
plainTextEditor: string;
|
|
233
|
+
sourceEditor: string;
|
|
234
|
+
placeholder: string;
|
|
235
|
+
copyCode: string;
|
|
236
|
+
expandCallout: string;
|
|
237
|
+
collapseCallout: string;
|
|
238
|
+
diagramRendering: string;
|
|
239
|
+
/** Prefix shown before the renderer's diagnostic message. */
|
|
240
|
+
diagramUnavailable: string;
|
|
241
|
+
/** Prefix followed by the authored footnote label. */
|
|
242
|
+
footnote: string;
|
|
243
|
+
tableAddRow: string;
|
|
244
|
+
tableAddColumn: string;
|
|
245
|
+
tableDeleteRow: string;
|
|
246
|
+
tableDeleteColumn: string;
|
|
247
|
+
tableAlignLeft: string;
|
|
248
|
+
tableAlignCenter: string;
|
|
249
|
+
tableAlignRight: string;
|
|
250
|
+
tableMoveColumn: string;
|
|
251
|
+
tableMoveRow: string;
|
|
252
|
+
fileLoading: string;
|
|
253
|
+
fileMissing: string;
|
|
254
|
+
fileError: string;
|
|
255
|
+
fileRetry: string;
|
|
256
|
+
fileOpen: string;
|
|
257
|
+
filePreviewUnavailable: string;
|
|
258
|
+
filePDFPreview: string;
|
|
259
|
+
wikiMissing: string;
|
|
260
|
+
/** Name of an author comment, which stays out of the readable text. */
|
|
261
|
+
comment: string;
|
|
262
|
+
/** Name of a block of Markdown InkKit keeps as authored and does not render. */
|
|
263
|
+
preservedMarkdown: string;
|
|
264
|
+
}
|
|
265
|
+
/** An outline entry. Pass it back to `navigateHeading`; it goes stale when the document changes. */
|
|
266
|
+
export interface Heading extends Readonly<DocumentVersion> {
|
|
267
|
+
/** Opaque. It belongs to the loaded document and editing mode. */
|
|
268
|
+
readonly id: string;
|
|
269
|
+
/** 1 to 6. */
|
|
270
|
+
readonly level: number;
|
|
271
|
+
readonly text: string;
|
|
272
|
+
}
|
|
273
|
+
/** A command for `table`. `insert` makes a table; the others work on the table at the selection. */
|
|
274
|
+
export type TableCommand = 'insert' | 'addRowBefore' | 'addRowAfter' | 'addColumnBefore' | 'addColumnAfter' | 'deleteRow' | 'deleteColumn' | 'deleteTable' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'moveRowUp' | 'moveRowDown' | 'moveColumnLeft' | 'moveColumnRight' | 'sortRows' | 'exit';
|
|
275
|
+
/** Each option belongs to one command; any other combination is refused. */
|
|
276
|
+
export interface TableOptions {
|
|
277
|
+
/** `insert`: 1 to 100, counting the header row. Defaults to 3. */
|
|
278
|
+
rows?: number;
|
|
279
|
+
/** `insert`: 1 to 100. Defaults to 2. */
|
|
280
|
+
columns?: number;
|
|
281
|
+
/** `sortRows`: zero-based. Defaults to the column of the selection. */
|
|
282
|
+
column?: number;
|
|
283
|
+
/** `sortRows`. Defaults to `ascending`. */
|
|
284
|
+
order?: 'ascending' | 'descending';
|
|
285
|
+
/** `sortRows`. Defaults to `text`. */
|
|
286
|
+
comparison?: 'text' | 'number';
|
|
287
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aicayzer/inkkit",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "A preserving Markdown editor for offline web views and the web",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"sideEffects": [
|
|
30
30
|
"**/*.css",
|
|
31
31
|
"./dist/index.js",
|
|
32
|
+
"./dist/chunks/*.js",
|
|
32
33
|
"./src/index.ts"
|
|
33
34
|
],
|
|
34
35
|
"publishConfig": {
|
|
@@ -40,21 +41,31 @@
|
|
|
40
41
|
"node": ">=22.14"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
|
-
"build": "node scripts/clean-build.mjs && tsc -p tsconfig.build.json && node scripts/
|
|
44
|
+
"build": "node scripts/clean-build.mjs && tsc -p tsconfig.build.json && vite build --config vite.package.config.ts && node scripts/finish-build.mjs",
|
|
44
45
|
"typecheck": "tsc --noEmit",
|
|
45
46
|
"test": "vitest run",
|
|
46
47
|
"format": "prettier --write .",
|
|
47
48
|
"format:check": "prettier --check .",
|
|
48
49
|
"dev": "vite playground",
|
|
49
50
|
"build:playground": "vite build playground --config vite.config.ts",
|
|
51
|
+
"test:docs": "node scripts/check-api-docs.mjs",
|
|
50
52
|
"test:package": "node scripts/test-package.mjs",
|
|
51
|
-
"check": "pnpm typecheck && pnpm test && pnpm build && pnpm test:package",
|
|
53
|
+
"check": "pnpm typecheck && pnpm test && pnpm build && pnpm test:docs && pnpm test:package",
|
|
52
54
|
"test:browser": "playwright test --project=chromium",
|
|
53
55
|
"test:built-playground": "playwright test --config playwright.built.config.ts"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
58
|
+
"mermaid": "12.1.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
56
61
|
"@milkdown/kit": "7.22.3",
|
|
62
|
+
"@playwright/test": "^1.64.0",
|
|
63
|
+
"@types/hast": "^3.0.5",
|
|
64
|
+
"@types/mdast": "^4.0.4",
|
|
65
|
+
"@types/node": "^26.6.2",
|
|
66
|
+
"axe-core": "^4.14.0",
|
|
57
67
|
"dompurify": "3.4.16",
|
|
68
|
+
"jsdom": "^30.1.0",
|
|
58
69
|
"lowlight": "^3.3.0",
|
|
59
70
|
"mdast-util-from-markdown": "^2.1.0",
|
|
60
71
|
"mdast-util-gfm-autolink-literal": "^2.0.1",
|
|
@@ -64,7 +75,6 @@
|
|
|
64
75
|
"mdast-util-gfm-task-list-item": "^2.0.0",
|
|
65
76
|
"mdast-util-highlight-mark": "1.2.2",
|
|
66
77
|
"mdast-util-to-markdown": "2.2.0",
|
|
67
|
-
"mermaid": "12.1.0",
|
|
68
78
|
"micromark-extension-gfm-autolink-literal": "^2.1.0",
|
|
69
79
|
"micromark-extension-gfm-footnote": "^2.1.0",
|
|
70
80
|
"micromark-extension-gfm-strikethrough": "^2.1.0",
|
|
@@ -73,16 +83,9 @@
|
|
|
73
83
|
"micromark-extension-highlight-mark": "1.2.0",
|
|
74
84
|
"micromark-util-normalize-identifier": "^2.0.1",
|
|
75
85
|
"micromark-util-types": "^2.0.3",
|
|
76
|
-
"prosemirror-drop-indicator": "0.1.4",
|
|
77
|
-
"prosemirror-search": "^1.1.1"
|
|
78
|
-
},
|
|
79
|
-
"devDependencies": {
|
|
80
|
-
"@playwright/test": "^1.64.0",
|
|
81
|
-
"@types/hast": "^3.0.5",
|
|
82
|
-
"@types/mdast": "^4.0.4",
|
|
83
|
-
"@types/node": "^26.6.2",
|
|
84
|
-
"jsdom": "^30.1.0",
|
|
85
86
|
"prettier": "^3.9.8",
|
|
87
|
+
"prosemirror-drop-indicator": "0.1.4",
|
|
88
|
+
"prosemirror-search": "^1.1.1",
|
|
86
89
|
"typescript": "^7.0.2",
|
|
87
90
|
"unified": "^11.0.5",
|
|
88
91
|
"vite": "^8.3.0",
|
package/dist/autolink.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const autolinkInputRule: import("@milkdown/kit/utils").$InputRule;
|
package/dist/autolink.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { linkSchema } from '@milkdown/kit/preset/commonmark';
|
|
2
|
-
import { InputRule } from '@milkdown/kit/prose/inputrules';
|
|
3
|
-
import { $inputRule } from '@milkdown/kit/utils';
|
|
4
|
-
// A typed URL becomes a link once a space follows it; nothing links it otherwise.
|
|
5
|
-
export const autolinkInputRule = $inputRule((ctx) => {
|
|
6
|
-
return new InputRule(/(?:^|\s)(https?:\/\/[^\s<>]+[^\s<>.,;:!?)\]])\s$/, (state, match, _start, end) => {
|
|
7
|
-
const url = match[1];
|
|
8
|
-
if (!url)
|
|
9
|
-
return null;
|
|
10
|
-
const to = end;
|
|
11
|
-
const from = to - url.length;
|
|
12
|
-
const mark = linkSchema.type(ctx).create({ href: url });
|
|
13
|
-
return state.tr
|
|
14
|
-
.addMark(from, to, mark)
|
|
15
|
-
.insertText(' ', end, end)
|
|
16
|
-
.removeStoredMark(mark);
|
|
17
|
-
});
|
|
18
|
-
});
|
package/dist/callouts.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { EditorView } from '@milkdown/kit/prose/view';
|
|
2
|
-
import type { Parent, RootContent } from 'mdast';
|
|
3
|
-
interface Callout extends Parent {
|
|
4
|
-
type: 'inkkitCallout';
|
|
5
|
-
kind: string;
|
|
6
|
-
marker: string;
|
|
7
|
-
fold: string;
|
|
8
|
-
title: string;
|
|
9
|
-
titleSource: string;
|
|
10
|
-
children: RootContent[];
|
|
11
|
-
}
|
|
12
|
-
declare module 'mdast' {
|
|
13
|
-
interface BlockContentMap {
|
|
14
|
-
inkkitCallout: Callout;
|
|
15
|
-
}
|
|
16
|
-
interface RootContentMap {
|
|
17
|
-
inkkitCallout: Callout;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export declare function revealCalloutAncestors(view: EditorView, position: number): void;
|
|
21
|
-
export declare const remarkCalloutsPlugin: import("@milkdown/kit/utils").$Remark<"inkkitCallouts", unknown>;
|
|
22
|
-
export declare const calloutSchema: import("@milkdown/kit/utils").$Node;
|
|
23
|
-
export declare const calloutView: import("@milkdown/kit/utils").$Prose;
|
|
24
|
-
export declare const callouts: (import("@milkdown/kit/utils").$Node | import("@milkdown/kit/utils").$Prose)[];
|
|
25
|
-
export {};
|