@aicayzer/inkkit 0.3.3 → 0.3.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Decoration, c as PluginKey, d as __toESM, i as $prose, o as DecorationSet, s as Plugin, u as __commonJSMin } from "./core-
|
|
1
|
+
import { a as Decoration, c as PluginKey, d as __toESM, i as $prose, o as DecorationSet, s as Plugin, u as __commonJSMin } from "./core-BRAgrHC7.js";
|
|
2
2
|
//#region node_modules/.pnpm/highlight.js@11.11.2/node_modules/highlight.js/es/languages/arduino.js
|
|
3
3
|
/** @type LanguageFn */
|
|
4
4
|
function cPlusPlus(hljs) {
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as InkKitError, t as InkKitEditor } from "./chunks/core-
|
|
1
|
+
import { r as InkKitError, t as InkKitEditor } from "./chunks/core-BRAgrHC7.js";
|
|
2
2
|
export { InkKitEditor, InkKitError };
|
package/dist/editor.d.ts
CHANGED
|
@@ -152,59 +152,35 @@ export declare const editorEvents: readonly ["changed", "commandStateChanged", "
|
|
|
152
152
|
export declare class InkKitEditor {
|
|
153
153
|
private readonly options;
|
|
154
154
|
private editor;
|
|
155
|
+
private readonly document;
|
|
156
|
+
private readonly history;
|
|
157
|
+
private readonly text;
|
|
158
|
+
private readonly geometry;
|
|
159
|
+
private readonly search;
|
|
160
|
+
private readonly output;
|
|
161
|
+
private readonly clipboard;
|
|
155
162
|
private lastMarkdown;
|
|
156
|
-
private formatType;
|
|
157
163
|
private readonly session;
|
|
158
|
-
private exportControllers;
|
|
159
|
-
private plainComposing;
|
|
160
|
-
private plainSearch;
|
|
161
|
-
private literalMatch?;
|
|
162
|
-
private beforePlainInput?;
|
|
163
|
-
private pendingSource?;
|
|
164
|
-
private typedSteps;
|
|
165
|
-
private undoneSteps;
|
|
166
|
-
private formattedUndone;
|
|
167
|
-
private formattedRedoLimit?;
|
|
168
|
-
private historyDirection?;
|
|
169
|
-
private lastSourceInput;
|
|
170
|
-
private syncingSource;
|
|
171
164
|
private mode;
|
|
172
|
-
private sourcePreservations;
|
|
173
|
-
private sourceTexts;
|
|
174
165
|
private ready;
|
|
175
166
|
private destroyed;
|
|
176
|
-
private preservation?;
|
|
177
|
-
private carried?;
|
|
178
167
|
private pasteController;
|
|
179
|
-
private
|
|
168
|
+
private source;
|
|
180
169
|
private root;
|
|
181
170
|
private ownsRootClass;
|
|
182
|
-
private
|
|
183
|
-
private auxClickHandler?;
|
|
184
|
-
private untrackLinkModifier?;
|
|
185
|
-
private footnoteKeyHandler?;
|
|
186
|
-
private readonly localCopies;
|
|
187
|
-
private rememberCopy;
|
|
188
|
-
private retainCopy;
|
|
189
|
-
private restoreCopy;
|
|
190
|
-
private copyHandler?;
|
|
191
|
-
private originalSource;
|
|
171
|
+
private activation;
|
|
192
172
|
private reportingSuppressed;
|
|
193
173
|
private loading;
|
|
194
|
-
private readonly textIdentity;
|
|
195
174
|
private call?;
|
|
196
|
-
private textScope?;
|
|
197
|
-
private viewportContainer?;
|
|
198
|
-
private viewportInsets;
|
|
199
175
|
private writable;
|
|
200
176
|
private inputPreferences;
|
|
201
177
|
private literalKeys;
|
|
202
|
-
private configuredKeys;
|
|
203
178
|
private indentKeys;
|
|
204
179
|
private readOnlyKeys;
|
|
205
180
|
private suggestions?;
|
|
206
181
|
private suggestionBase?;
|
|
207
182
|
private changePlugin;
|
|
183
|
+
private documentChanged;
|
|
208
184
|
private keys;
|
|
209
185
|
private readingKeys;
|
|
210
186
|
private readonly events;
|
|
@@ -218,10 +194,6 @@ export declare class InkKitEditor {
|
|
|
218
194
|
private get generation();
|
|
219
195
|
/** What `changed` reports for the document's new text. */
|
|
220
196
|
private changeSnapshot;
|
|
221
|
-
private cancelExports;
|
|
222
|
-
/** Runs asynchronous output work for the document `captured` describes, and throws
|
|
223
|
-
* `stale-document` when the document, its revision or the editing mode changed meanwhile. */
|
|
224
|
-
private exportContent;
|
|
225
197
|
/** Throws unless the document `captured` describes is still current, alive, not composing and
|
|
226
198
|
* has no import pending. */
|
|
227
199
|
private assertCaptured;
|
|
@@ -280,55 +252,27 @@ export declare class InkKitEditor {
|
|
|
280
252
|
commandState(expectedGeneration?: number): CommandState;
|
|
281
253
|
/** An image adapter shows and exports an inserted reference, and so does a file adapter. */
|
|
282
254
|
private get canInsertImages();
|
|
283
|
-
private canQuote;
|
|
284
255
|
private historyInputPlugin;
|
|
285
256
|
private policyPlugin;
|
|
286
257
|
private get literalSurface();
|
|
287
258
|
/** `formatted` or `source`. A TXT document is always `source`. */
|
|
288
259
|
get editingMode(): EditingMode;
|
|
289
|
-
private currentText;
|
|
290
260
|
/** Switches between formatted and source editing. Returns false when the mode is already set, and
|
|
291
261
|
* for TXT. */
|
|
292
262
|
setEditingMode(mode: EditingMode, expectedGeneration?: number): boolean;
|
|
293
263
|
private updateSurface;
|
|
294
264
|
/** Replaces the complete source as one undo step. Returns false for identical source. */
|
|
295
265
|
replaceSource(text: string, expectedGeneration?: number): boolean;
|
|
296
|
-
private applySource;
|
|
297
|
-
/**
|
|
298
|
-
* Takes typed source without parsing it. Parsing, preservation and replacing
|
|
299
|
-
* the formatted document cost as much as a document load, so they wait for
|
|
300
|
-
* the next thing that needs them.
|
|
301
|
-
*/
|
|
302
|
-
private deferSource;
|
|
303
|
-
private rememberTypedStep;
|
|
304
|
-
private showTypedSource;
|
|
305
|
-
private setSourceValue;
|
|
306
|
-
/**
|
|
307
|
-
* Undoes or redoes typed source that the formatted document has not taken
|
|
308
|
-
* in, on the text alone. Returns whether there was a step to take.
|
|
309
|
-
*/
|
|
310
|
-
private stepTypedSource;
|
|
311
|
-
/** Brings the formatted document up to the source that was typed. */
|
|
312
|
-
private settleSource;
|
|
313
|
-
private commitSource;
|
|
314
266
|
/** Returns whether a history step applied. */
|
|
315
267
|
undo(expectedGeneration?: number): boolean;
|
|
316
268
|
/** Returns whether a history step applied. */
|
|
317
269
|
redo(expectedGeneration?: number): boolean;
|
|
318
|
-
private stepFormattedHistory;
|
|
319
|
-
private replaceLiteralSelection;
|
|
320
270
|
/** The complete current text, which is what a host saves. It throws rather than return partial
|
|
321
271
|
* text. */
|
|
322
272
|
snapshot(expectedGeneration?: number): DocumentSnapshot;
|
|
323
273
|
/** The whole document as standalone HTML for printing. Rejects rather than return partial
|
|
324
274
|
* output. */
|
|
325
275
|
printableSnapshot(expectedGeneration?: number): Promise<PrintableDocument>;
|
|
326
|
-
/**
|
|
327
|
-
* The document to export. Source typed in the source editor has not reached
|
|
328
|
-
* the formatted document, which would merge its undo steps, so a document
|
|
329
|
-
* read from the text stands in without touching history.
|
|
330
|
-
*/
|
|
331
|
-
private exportDocument;
|
|
332
276
|
/** Prepares the document or the selection for the native clipboard. Rejects with `stale-document`
|
|
333
277
|
* if the document changes first. */
|
|
334
278
|
clipboardSnapshot(scope?: ClipboardScope, expectedGeneration?: number): Promise<ClipboardOutput>;
|
|
@@ -355,7 +299,7 @@ export declare class InkKitEditor {
|
|
|
355
299
|
destroy(): Promise<void>;
|
|
356
300
|
private keymapPlugin;
|
|
357
301
|
private indentPlugin;
|
|
358
|
-
private
|
|
302
|
+
private dispatchTransaction;
|
|
359
303
|
/** Builds the editor in `root`. It has no document until `loadDocument`. Rejects with
|
|
360
304
|
* `invalid-argument` for a bad root, handler or option. */
|
|
361
305
|
static mount(root: HTMLElement, events: EditorEvents, options?: EditorOptions): Promise<InkKitEditor>;
|
|
@@ -373,7 +317,6 @@ export declare class InkKitEditor {
|
|
|
373
317
|
setViewport(options: ViewportOptions): void;
|
|
374
318
|
/** The visible rectangle, the insets and the scroll offsets. */
|
|
375
319
|
viewport(): ViewportSnapshot;
|
|
376
|
-
private readableScope;
|
|
377
320
|
/** The readable text and selection. Ranges from it go stale when the document, its revision or
|
|
378
321
|
* the mode changes. */
|
|
379
322
|
textSnapshot(expectedGeneration?: number): ReadableTextSnapshot;
|
|
@@ -382,14 +325,6 @@ export declare class InkKitEditor {
|
|
|
382
325
|
focus?: boolean;
|
|
383
326
|
reveal?: boolean;
|
|
384
327
|
}): void;
|
|
385
|
-
/** Whether two documents are the same note. A move of blocks that read alike, such as a setext
|
|
386
|
-
* heading and the same heading written with `#`, gives an equal document with other source. */
|
|
387
|
-
private sameDocument;
|
|
388
|
-
/** Throws when a document reached by an edit, after every appended normalisation, cannot be
|
|
389
|
-
* saved as preserved Markdown. Dispatch and the replacement commands share this check.
|
|
390
|
-
* `written` is false for history steps and source replacement, which restore or supply a
|
|
391
|
-
* document that may hold comment text the formatted editor would refuse to accept typed. */
|
|
392
|
-
private assertPreserved;
|
|
393
328
|
/** Replaces `range` with literal text as one undo step. Returns whether the text changed. */
|
|
394
329
|
replaceTextRange(range: TextRange, text: string): boolean;
|
|
395
330
|
/** Measures ranges in client coordinates, with one array of rectangles for each. It measures only
|
|
@@ -399,7 +334,6 @@ export declare class InkKitEditor {
|
|
|
399
334
|
visibleTextRanges(snapshotId: string): readonly TextRange[];
|
|
400
335
|
/** Scrolls `range` into the viewport, unfolding a callout that holds it. */
|
|
401
336
|
revealTextRange(range: TextRange): void;
|
|
402
|
-
private revealRects;
|
|
403
337
|
private revealCurrentSelection;
|
|
404
338
|
private revealLiteralSelection;
|
|
405
339
|
private load;
|
|
@@ -409,7 +343,6 @@ export declare class InkKitEditor {
|
|
|
409
343
|
replace(search: string, replacement: string, expectedGeneration?: number): boolean;
|
|
410
344
|
/** Replaces every non-overlapping match once and returns how many. */
|
|
411
345
|
replaceAll(search: string, replacement: string, expectedGeneration?: number): number;
|
|
412
|
-
private replaceMatches;
|
|
413
346
|
private outlineContext;
|
|
414
347
|
/** The outline in document order. Entries go stale when the document changes. */
|
|
415
348
|
headings(expectedGeneration?: number): readonly Heading[];
|
|
@@ -433,6 +366,7 @@ export declare class InkKitEditor {
|
|
|
433
366
|
* draw no references; named file answers are invalidated and resolved when formatted mode returns.
|
|
434
367
|
*/
|
|
435
368
|
refreshReferences(targets?: readonly string[], expectedGeneration?: number): void;
|
|
369
|
+
private openSelectedLink;
|
|
436
370
|
/** Replaces every binding. Keys are in ProseMirror's notation. A key given to two shortcuts goes
|
|
437
371
|
* to the later one, in the order history, link opening, formatting, block moves, tables, so it lands the same
|
|
438
372
|
* way every time. A table binding passes a key it shares with a block move to the move outside
|
|
@@ -449,24 +383,6 @@ export declare class InkKitEditor {
|
|
|
449
383
|
* no scrolling, and the selection stays on the text it covered. For a host that attaches images
|
|
450
384
|
* to a document the person is not editing at that moment. Returns false when it does nothing. */
|
|
451
385
|
appendImages(images: ImageInsertion[], expectedGeneration?: number): boolean;
|
|
452
|
-
private imageBlocks;
|
|
453
|
-
private insertInline;
|
|
454
|
-
private insertBlocks;
|
|
455
|
-
private withMarkRunSelected;
|
|
456
|
-
private toggleInlineCode;
|
|
457
|
-
private list;
|
|
458
|
-
private quote;
|
|
459
|
-
private unquote;
|
|
460
|
-
/** Changes the selected textblocks' type, keeping everything they hold. */
|
|
461
|
-
private textblockType;
|
|
462
|
-
/**
|
|
463
|
-
* The authored Markdown of the textblocks at `positions`, found by saving
|
|
464
|
-
* the document once with each block's content replaced by a numbered mark
|
|
465
|
-
* no one writes. The saved text between the marks is the current text
|
|
466
|
-
* between those blocks, so what lies between the same pieces of the current
|
|
467
|
-
* text is each block's source.
|
|
468
|
-
*/
|
|
469
|
-
private authoredSources;
|
|
470
386
|
private chooseWiki;
|
|
471
387
|
private chooseSlash;
|
|
472
388
|
/** Returns whether the document or the marks the next typed text takes changed. */
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as registerMermaid, r as InkKitError, t as InkKitEditor } from "./chunks/core-
|
|
1
|
+
import { n as registerMermaid, r as InkKitError, t as InkKitEditor } from "./chunks/core-BRAgrHC7.js";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
registerMermaid(async () => (await import("mermaid")).default);
|
|
4
4
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aicayzer/inkkit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "A preserving Markdown editor for offline web views and the web",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"format:check": "prettier --check .",
|
|
49
49
|
"dev": "vite playground",
|
|
50
50
|
"build:playground": "vite build playground --config vite.config.ts",
|
|
51
|
-
"test:docs": "node scripts/check-api-docs.mjs",
|
|
51
|
+
"test:docs": "node --test scripts/api-docs/*.test.mjs && node scripts/check-api-docs.mjs",
|
|
52
52
|
"test:package": "node scripts/test-package.mjs",
|
|
53
53
|
"check": "pnpm typecheck && pnpm test && pnpm build && pnpm test:docs && pnpm test:package",
|
|
54
54
|
"test:browser": "playwright test --project=chromium",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"mdast-util-gfm-table": "^2.0.0",
|
|
75
75
|
"mdast-util-gfm-task-list-item": "^2.0.0",
|
|
76
76
|
"mdast-util-highlight-mark": "1.2.2",
|
|
77
|
+
"mdast-util-mdx": "3.0.0",
|
|
77
78
|
"mdast-util-to-markdown": "2.2.0",
|
|
78
79
|
"micromark-extension-gfm-autolink-literal": "^2.1.0",
|
|
79
80
|
"micromark-extension-gfm-footnote": "^2.1.0",
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
"micromark-extension-gfm-table": "^2.1.1",
|
|
82
83
|
"micromark-extension-gfm-task-list-item": "^2.1.0",
|
|
83
84
|
"micromark-extension-highlight-mark": "1.2.0",
|
|
85
|
+
"micromark-extension-mdxjs": "3.0.0",
|
|
84
86
|
"micromark-util-normalize-identifier": "^2.0.1",
|
|
85
87
|
"micromark-util-types": "^2.0.3",
|
|
86
88
|
"prettier": "^3.9.8",
|