@aicayzer/inkkit 0.3.3 → 0.3.5

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-BsI6Awlu.js";
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-BjnsFL5-.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-BsI6Awlu.js";
1
+ import { r as InkKitError, t as InkKitEditor } from "./chunks/core-BjnsFL5-.js";
2
2
  export { InkKitEditor, InkKitError };
package/dist/editor.d.ts CHANGED
@@ -152,59 +152,36 @@ 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 diagrams;
161
+ private readonly output;
162
+ private readonly clipboard;
155
163
  private lastMarkdown;
156
- private formatType;
157
164
  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
165
  private mode;
172
- private sourcePreservations;
173
- private sourceTexts;
174
166
  private ready;
175
167
  private destroyed;
176
- private preservation?;
177
- private carried?;
178
168
  private pasteController;
179
- private plain;
169
+ private source;
180
170
  private root;
181
171
  private ownsRootClass;
182
- private clickHandler?;
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;
172
+ private activation;
192
173
  private reportingSuppressed;
193
174
  private loading;
194
- private readonly textIdentity;
195
175
  private call?;
196
- private textScope?;
197
- private viewportContainer?;
198
- private viewportInsets;
199
176
  private writable;
200
177
  private inputPreferences;
201
178
  private literalKeys;
202
- private configuredKeys;
203
179
  private indentKeys;
204
180
  private readOnlyKeys;
205
181
  private suggestions?;
206
182
  private suggestionBase?;
207
183
  private changePlugin;
184
+ private documentChanged;
208
185
  private keys;
209
186
  private readingKeys;
210
187
  private readonly events;
@@ -218,10 +195,6 @@ export declare class InkKitEditor {
218
195
  private get generation();
219
196
  /** What `changed` reports for the document's new text. */
220
197
  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
198
  /** Throws unless the document `captured` describes is still current, alive, not composing and
226
199
  * has no import pending. */
227
200
  private assertCaptured;
@@ -280,55 +253,27 @@ export declare class InkKitEditor {
280
253
  commandState(expectedGeneration?: number): CommandState;
281
254
  /** An image adapter shows and exports an inserted reference, and so does a file adapter. */
282
255
  private get canInsertImages();
283
- private canQuote;
284
256
  private historyInputPlugin;
285
257
  private policyPlugin;
286
258
  private get literalSurface();
287
259
  /** `formatted` or `source`. A TXT document is always `source`. */
288
260
  get editingMode(): EditingMode;
289
- private currentText;
290
261
  /** Switches between formatted and source editing. Returns false when the mode is already set, and
291
262
  * for TXT. */
292
263
  setEditingMode(mode: EditingMode, expectedGeneration?: number): boolean;
293
264
  private updateSurface;
294
265
  /** Replaces the complete source as one undo step. Returns false for identical source. */
295
266
  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
267
  /** Returns whether a history step applied. */
315
268
  undo(expectedGeneration?: number): boolean;
316
269
  /** Returns whether a history step applied. */
317
270
  redo(expectedGeneration?: number): boolean;
318
- private stepFormattedHistory;
319
- private replaceLiteralSelection;
320
271
  /** The complete current text, which is what a host saves. It throws rather than return partial
321
272
  * text. */
322
273
  snapshot(expectedGeneration?: number): DocumentSnapshot;
323
274
  /** The whole document as standalone HTML for printing. Rejects rather than return partial
324
275
  * output. */
325
276
  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
277
  /** Prepares the document or the selection for the native clipboard. Rejects with `stale-document`
333
278
  * if the document changes first. */
334
279
  clipboardSnapshot(scope?: ClipboardScope, expectedGeneration?: number): Promise<ClipboardOutput>;
@@ -355,7 +300,7 @@ export declare class InkKitEditor {
355
300
  destroy(): Promise<void>;
356
301
  private keymapPlugin;
357
302
  private indentPlugin;
358
- private copySourceSelection;
303
+ private dispatchTransaction;
359
304
  /** Builds the editor in `root`. It has no document until `loadDocument`. Rejects with
360
305
  * `invalid-argument` for a bad root, handler or option. */
361
306
  static mount(root: HTMLElement, events: EditorEvents, options?: EditorOptions): Promise<InkKitEditor>;
@@ -373,7 +318,6 @@ export declare class InkKitEditor {
373
318
  setViewport(options: ViewportOptions): void;
374
319
  /** The visible rectangle, the insets and the scroll offsets. */
375
320
  viewport(): ViewportSnapshot;
376
- private readableScope;
377
321
  /** The readable text and selection. Ranges from it go stale when the document, its revision or
378
322
  * the mode changes. */
379
323
  textSnapshot(expectedGeneration?: number): ReadableTextSnapshot;
@@ -382,14 +326,6 @@ export declare class InkKitEditor {
382
326
  focus?: boolean;
383
327
  reveal?: boolean;
384
328
  }): 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
329
  /** Replaces `range` with literal text as one undo step. Returns whether the text changed. */
394
330
  replaceTextRange(range: TextRange, text: string): boolean;
395
331
  /** Measures ranges in client coordinates, with one array of rectangles for each. It measures only
@@ -399,7 +335,6 @@ export declare class InkKitEditor {
399
335
  visibleTextRanges(snapshotId: string): readonly TextRange[];
400
336
  /** Scrolls `range` into the viewport, unfolding a callout that holds it. */
401
337
  revealTextRange(range: TextRange): void;
402
- private revealRects;
403
338
  private revealCurrentSelection;
404
339
  private revealLiteralSelection;
405
340
  private load;
@@ -409,7 +344,6 @@ export declare class InkKitEditor {
409
344
  replace(search: string, replacement: string, expectedGeneration?: number): boolean;
410
345
  /** Replaces every non-overlapping match once and returns how many. */
411
346
  replaceAll(search: string, replacement: string, expectedGeneration?: number): number;
412
- private replaceMatches;
413
347
  private outlineContext;
414
348
  /** The outline in document order. Entries go stale when the document changes. */
415
349
  headings(expectedGeneration?: number): readonly Heading[];
@@ -433,6 +367,7 @@ export declare class InkKitEditor {
433
367
  * draw no references; named file answers are invalidated and resolved when formatted mode returns.
434
368
  */
435
369
  refreshReferences(targets?: readonly string[], expectedGeneration?: number): void;
370
+ private openSelectedLink;
436
371
  /** Replaces every binding. Keys are in ProseMirror's notation. A key given to two shortcuts goes
437
372
  * to the later one, in the order history, link opening, formatting, block moves, tables, so it lands the same
438
373
  * way every time. A table binding passes a key it shares with a block move to the move outside
@@ -449,24 +384,6 @@ export declare class InkKitEditor {
449
384
  * no scrolling, and the selection stays on the text it covered. For a host that attaches images
450
385
  * to a document the person is not editing at that moment. Returns false when it does nothing. */
451
386
  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
387
  private chooseWiki;
471
388
  private chooseSlash;
472
389
  /** Returns whether the document or the marks the next typed text takes changed. */