@aicayzer/inkkit 0.3.0 → 0.3.2

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-DrVCeBzK.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-DTew7k7c.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-DrVCeBzK.js";
1
+ import { r as InkKitError, t as InkKitEditor } from "./chunks/core-DTew7k7c.js";
2
2
  export { InkKitEditor, InkKitError };
package/dist/editor.d.ts CHANGED
@@ -50,9 +50,9 @@ export interface ImageInsertion {
50
50
  alt: string;
51
51
  title?: string;
52
52
  }
53
- /** A name in `Keymap`: every format command except `link`, history, block moves, and every table
54
- * command. */
55
- export type ShortcutName = Exclude<FormatCommand, 'link'> | 'undo' | 'redo' | 'moveBlockUp' | 'moveBlockDown' | `table${Capitalize<TableCommand>}`;
53
+ /** A name in `Keymap`: every format command except `link`, history, block moves, list indentation,
54
+ * and every table command. */
55
+ export type ShortcutName = Exclude<FormatCommand, 'link'> | 'undo' | 'redo' | 'moveBlockUp' | 'moveBlockDown' | 'indent' | 'outdent' | `table${Capitalize<TableCommand>}`;
56
56
  /** Host bindings in ProseMirror key notation, by shortcut name. */
57
57
  export type Keymap = Partial<Record<ShortcutName, readonly string[]>>;
58
58
  /** Every `ShortcutName`. */
@@ -65,7 +65,7 @@ export interface TextInputPreferences {
65
65
  /** Typing a quote or `--` gives a curly quote or a dash, in formatted mode. Off unless true. */
66
66
  smartPunctuation?: boolean;
67
67
  }
68
- /** Mount options. Adapters, `labels` and `rendering` are fixed at mount; the rest can change. */
68
+ /** Mount options. Adapters, `labels`, `linkSchemes` and `rendering` are fixed at mount; the rest can change. */
69
69
  export interface EditorOptions {
70
70
  /** Shows, imports and exports images. Without it and `files`, image Markdown stays literal. */
71
71
  images?: ImageAdapter;
@@ -82,6 +82,9 @@ export interface EditorOptions {
82
82
  labels?: Partial<EditorLabels>;
83
83
  /** See `setKeymap`. */
84
84
  keymap?: Keymap;
85
+ /** Schemes beyond `http`, `https`, `mailto` and `tel` that links may use, such as `things`.
86
+ * Fixed at mount. */
87
+ linkSchemes?: readonly string[];
85
88
  rendering?: {
86
89
  /** Defaults to true. */
87
90
  codeHighlighting?: boolean;
@@ -114,6 +117,7 @@ export interface CommandState extends DocumentVersion {
114
117
  replace: boolean;
115
118
  replaceSource: boolean;
116
119
  insertImages: boolean;
120
+ appendImages: boolean;
117
121
  insertPaths: boolean;
118
122
  insertFootnote: boolean;
119
123
  editReferenceDefinition: boolean;
@@ -196,12 +200,15 @@ export declare class InkKitEditor {
196
200
  private inputPreferences;
197
201
  private literalKeys;
198
202
  private configuredKeys;
203
+ private indentKeys;
199
204
  private readOnlyKeys;
200
205
  private suggestions?;
201
206
  private suggestionBase?;
202
207
  private changePlugin;
203
208
  private keys;
204
209
  private readonly events;
210
+ /** The host's extra link schemes, in lower case. */
211
+ private readonly linkSchemes;
205
212
  /** How many of each state event the host has been sent. */
206
213
  private readonly sentEvents;
207
214
  private constructor();
@@ -260,6 +267,8 @@ export declare class InkKitEditor {
260
267
  get editable(): boolean;
261
268
  /** Turns editing on or off for both surfaces. Throws `composition` during text composition. */
262
269
  setEditable(editable: boolean): void;
270
+ /** Supplies native host activation for selection presentation. Null restores browser detection. */
271
+ setHostActive(active: boolean | null): void;
263
272
  /** Replaces the input preferences. A field left out takes its default. Throws `composition`
264
273
  * during text composition. */
265
274
  setTextInputPreferences(preferences: TextInputPreferences): void;
@@ -292,6 +301,7 @@ export declare class InkKitEditor {
292
301
  private deferSource;
293
302
  private rememberTypedStep;
294
303
  private showTypedSource;
304
+ private setSourceValue;
295
305
  /**
296
306
  * Undoes or redoes typed source that the formatted document has not taken
297
307
  * in, on the text alone. Returns whether there was a step to take.
@@ -343,6 +353,7 @@ export declare class InkKitEditor {
343
353
  * throws `destroyed`. */
344
354
  destroy(): Promise<void>;
345
355
  private keymapPlugin;
356
+ private indentPlugin;
346
357
  private copySourceSelection;
347
358
  /** Builds the editor in `root`. It has no document until `loadDocument`. Rejects with
348
359
  * `invalid-argument` for a bad root, handler or option. */
@@ -414,10 +425,18 @@ export declare class InkKitEditor {
414
425
  /** Moves focus off InkKit's text surfaces. Focus anywhere else, such as in a host control or a
415
426
  * control InkKit draws, is left alone. */
416
427
  blur(expectedGeneration?: number): void;
428
+ /**
429
+ * Resolves wiki links and file embeds again, all of them or those whose `target` is named, after
430
+ * something they point to changed. A file keeps its card until the new answer differs. Changes no
431
+ * document state, so it works in a read-only editor and during composition. Source and TXT modes
432
+ * draw no references; named file answers are invalidated and resolved when formatted mode returns.
433
+ */
434
+ refreshReferences(targets?: readonly string[], expectedGeneration?: number): void;
417
435
  /** Replaces every binding. Keys are in ProseMirror's notation. A key given to two shortcuts goes
418
436
  * to the later one, in the order history, formatting, block moves, tables, so it lands the same
419
437
  * way every time. A table binding passes a key it shares with a block move to the move outside
420
- * a table. */
438
+ * a table. List indentation keys apply after all of these, and after the table keys the editor
439
+ * keeps for itself. */
421
440
  setKeymap(keymap: Keymap): void;
422
441
  /** Dropped files land as one paragraph per path at the drop point: in place of an empty block, after
423
442
  * the top-level block otherwise, so a list or quote is not opened up by them. */
@@ -425,6 +444,11 @@ export declare class InkKitEditor {
425
444
  /** Inserts images by reference, at the selection or the drop point `at`. Returns false when it
426
445
  * does nothing. */
427
446
  insertImages(images: ImageInsertion[], at?: ClientPoint, expectedGeneration?: number): boolean;
447
+ /** Adds images as the last blocks of the document and leaves everything else as it is: no focus,
448
+ * no scrolling, and the selection stays on the text it covered. For a host that attaches images
449
+ * to a document the person is not editing at that moment. Returns false when it does nothing. */
450
+ appendImages(images: ImageInsertion[], expectedGeneration?: number): boolean;
451
+ private imageBlocks;
428
452
  private insertInline;
429
453
  private insertBlocks;
430
454
  private withMarkRunSelected;
@@ -447,8 +471,9 @@ export declare class InkKitEditor {
447
471
  /** Returns whether the document or the marks the next typed text takes changed. */
448
472
  format(command: FormatCommand, options?: FormatOptions, expectedGeneration?: number): boolean;
449
473
  /**
450
- * Refuses a link destination that is empty, that opens anything but a web, mail or phone address,
451
- * or that the Markdown writer cannot save so that it reads back the same.
474
+ * Refuses a link destination that is empty, that opens anything but a web, mail or phone address
475
+ * or a scheme the host listed, or that the Markdown writer cannot save so that it reads back the
476
+ * same.
452
477
  */
453
478
  private checkDestination;
454
479
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as registerMermaid, r as InkKitError, t as InkKitEditor } from "./chunks/core-DrVCeBzK.js";
1
+ import { n as registerMermaid, r as InkKitError, t as InkKitEditor } from "./chunks/core-DTew7k7c.js";
2
2
  //#region src/index.ts
3
3
  registerMermaid(async () => (await import("mermaid")).default);
4
4
  //#endregion
package/dist/style.css CHANGED
@@ -1,4 +1,5 @@
1
1
  .inkkit-root {
2
+ --_inkkit-font-size: var(--inkkit-font-size, 15px);
2
3
  box-sizing: border-box;
3
4
  color-scheme: var(--inkkit-color-scheme, light dark);
4
5
  color: var(--inkkit-text-color, CanvasText);
@@ -9,7 +10,7 @@
9
10
  system-ui,
10
11
  sans-serif
11
12
  );
12
- font-size: var(--inkkit-font-size, 15px);
13
+ font-size: var(--_inkkit-font-size);
13
14
  line-height: var(--inkkit-line-height, normal);
14
15
  -webkit-font-smoothing: antialiased;
15
16
  -webkit-text-size-adjust: none;
@@ -60,7 +61,7 @@
60
61
  var(--inkkit-padding-bottom, 48px);
61
62
  background: transparent;
62
63
  color: var(--_inkkit-text);
63
- font: calc(var(--inkkit-font-size, 15px) * 1)/var(--inkkit-line-height, 1.5)
64
+ font: calc(var(--_inkkit-font-size) * 1)/var(--inkkit-line-height, 1.5)
64
65
  var(--_inkkit-mono);
65
66
  }
66
67
 
@@ -75,7 +76,7 @@
75
76
  .inkkit-root .inkkit-table-block {
76
77
  position: relative;
77
78
  margin: 0 0
78
- var(--inkkit-paragraph-spacing, calc(var(--inkkit-font-size, 15px) * 0.667));
79
+ var(--inkkit-paragraph-spacing, calc(var(--_inkkit-font-size) * 0.667));
79
80
  }
80
81
  .inkkit-root .inkkit-table-scroll {
81
82
  overflow-x: auto;
@@ -91,9 +92,9 @@
91
92
  .inkkit-root .ProseMirror th {
92
93
  position: relative;
93
94
  box-sizing: border-box;
94
- min-width: calc(var(--inkkit-font-size, 15px) * 4);
95
- padding: calc(var(--inkkit-font-size, 15px) * 0.4)
96
- calc(var(--inkkit-font-size, 15px) * 0.6);
95
+ min-width: calc(var(--_inkkit-font-size) * 4);
96
+ padding: calc(var(--_inkkit-font-size) * 0.4)
97
+ calc(var(--_inkkit-font-size) * 0.6);
97
98
  border: 0 solid var(--_inkkit-rule);
98
99
  border-width: 0 1px 1px 0;
99
100
  vertical-align: top;
@@ -263,7 +264,7 @@
263
264
  .inkkit-root .ProseMirror .inkkit-image-block {
264
265
  display: block;
265
266
  margin: 0 0
266
- var(--inkkit-paragraph-spacing, calc(var(--inkkit-font-size, 15px) * 0.667));
267
+ var(--inkkit-paragraph-spacing, calc(var(--_inkkit-font-size) * 0.667));
267
268
  line-height: 0;
268
269
  }
269
270
  .inkkit-root .ProseMirror .inkkit-image-block > .inkkit-image {
@@ -301,9 +302,10 @@
301
302
  content: '';
302
303
  display: block;
303
304
  position: absolute;
304
- top: -2px;
305
- width: 20px;
306
- border-top: 2px solid var(--_inkkit-accent);
305
+ top: 0;
306
+ width: 2px;
307
+ height: 1lh;
308
+ background: var(--_inkkit-accent);
307
309
  animation: inkkit-gapcursor-blink 1.1s steps(2, start) infinite;
308
310
  }
309
311
  @keyframes inkkit-gapcursor-blink {
@@ -497,13 +499,26 @@
497
499
  pointer-events: none;
498
500
  }
499
501
 
500
- /* The selection plugin draws the selection over the text alone; the engine's own fills the margins too. */
502
+ /* The selection plugin draws the selection over the text alone; the engine's own fills the margins too.
503
+ The surface needs its own rule: the descendant selector does not reach the surface itself, and WebKit paints that as full-width bars. */
504
+ .inkkit-root .ProseMirror.inkkit-painted-selection::selection,
501
505
  .inkkit-root .ProseMirror.inkkit-painted-selection ::selection {
502
506
  background: transparent;
503
507
  }
504
508
 
505
- .inkkit-root ::highlight(inkkit-selection) {
506
- background-color: color-mix(in srgb, var(--_inkkit-accent) 30%, transparent);
509
+ .inkkit-root ::highlight(inkkit-selection),
510
+ .inkkit-root ::selection {
511
+ background: var(
512
+ --inkkit-inactive-selection-background,
513
+ light-dark(#d4d4d4, #555)
514
+ );
515
+ }
516
+ .inkkit-root.inkkit-selection-active ::highlight(inkkit-selection),
517
+ .inkkit-root.inkkit-selection-active ::selection {
518
+ background: var(
519
+ --inkkit-selection-background,
520
+ color-mix(in srgb, var(--_inkkit-accent) 30%, transparent)
521
+ );
507
522
  }
508
523
 
509
524
  .inkkit-root .ProseMirror > :first-child {
@@ -512,7 +527,7 @@
512
527
 
513
528
  .inkkit-root .ProseMirror p {
514
529
  margin: 0 0
515
- var(--inkkit-paragraph-spacing, calc(var(--inkkit-font-size, 15px) * 0.667));
530
+ var(--inkkit-paragraph-spacing, calc(var(--_inkkit-font-size) * 0.667));
516
531
  }
517
532
 
518
533
  .inkkit-root .ProseMirror h1,
@@ -520,48 +535,61 @@
520
535
  .inkkit-root .ProseMirror h3 {
521
536
  line-height: 1.25;
522
537
  letter-spacing: -0.01em;
523
- margin: calc(var(--inkkit-font-size, 15px) * 1.867) 0
524
- calc(var(--inkkit-font-size, 15px) * 0.533);
538
+ margin: calc(var(--_inkkit-font-size) * 1.867) 0
539
+ calc(var(--_inkkit-font-size) * 0.533);
525
540
  }
526
541
 
527
542
  .inkkit-root .ProseMirror h1 {
528
- font-size: calc(var(--inkkit-font-size, 15px) * 1.733);
543
+ font-size: calc(var(--_inkkit-font-size) * 1.733);
529
544
  font-weight: 700;
530
545
  }
531
546
 
532
547
  .inkkit-root .ProseMirror h2 {
533
- font-size: calc(var(--inkkit-font-size, 15px) * 1.4);
548
+ font-size: calc(var(--_inkkit-font-size) * 1.4);
534
549
  font-weight: 700;
535
550
  }
536
551
 
537
552
  .inkkit-root .ProseMirror h3 {
538
- font-size: calc(var(--inkkit-font-size, 15px) * 1.133);
553
+ font-size: calc(var(--_inkkit-font-size) * 1.133);
539
554
  font-weight: 600;
540
555
  }
541
556
 
542
557
  .inkkit-root .ProseMirror h4,
543
558
  .inkkit-root .ProseMirror h5,
544
559
  .inkkit-root .ProseMirror h6 {
545
- font-size: calc(var(--inkkit-font-size, 15px) * 1);
560
+ font-size: calc(var(--_inkkit-font-size) * 1);
546
561
  font-weight: 600;
547
- margin: calc(var(--inkkit-font-size, 15px) * 1.333) 0
548
- calc(var(--inkkit-font-size, 15px) * 0.4);
562
+ margin: calc(var(--_inkkit-font-size) * 1.333) 0
563
+ calc(var(--_inkkit-font-size) * 0.4);
549
564
  }
550
565
 
551
566
  .inkkit-root .ProseMirror strong {
552
567
  font-weight: 700;
553
568
  }
554
569
 
555
- .inkkit-root .ProseMirror a {
570
+ .inkkit-root .ProseMirror a,
571
+ .inkkit-root .inkkit-wiki-link {
556
572
  color: var(--_inkkit-accent);
557
573
  text-decoration: none;
558
574
  text-underline-offset: 2px;
559
575
  }
560
576
 
561
- .inkkit-root .ProseMirror a:hover {
577
+ .inkkit-root .ProseMirror a:hover,
578
+ .inkkit-root .inkkit-wiki-link:hover {
562
579
  text-decoration: underline;
563
580
  }
564
581
 
582
+ /* A missing target differs by its line, not only its color, which forced colors replace. */
583
+ .inkkit-root .inkkit-wiki-link[data-missing] {
584
+ text-decoration: underline dashed;
585
+ }
586
+
587
+ @media (forced-colors: active) {
588
+ .inkkit-root .inkkit-wiki-link {
589
+ color: LinkText;
590
+ }
591
+ }
592
+
565
593
  /* Held Mod opens a link on click; an empty address opens nothing. */
566
594
  .inkkit-root.inkkit-link-modifier .ProseMirror a[href]:not([href='']),
567
595
  .inkkit-root.inkkit-link-modifier .inkkit-wiki-link {
@@ -573,25 +601,25 @@
573
601
  font-size: 0.88em;
574
602
  background: var(--_inkkit-code-bg);
575
603
  border-radius: 5px;
576
- padding: calc(var(--inkkit-font-size, 15px) * 0.067)
577
- calc(var(--inkkit-font-size, 15px) * 0.333);
604
+ padding: calc(var(--_inkkit-font-size) * 0.067)
605
+ calc(var(--_inkkit-font-size) * 0.333);
578
606
  }
579
607
 
580
608
  .inkkit-root .ProseMirror pre {
581
609
  position: relative;
582
610
  font-family: var(--_inkkit-mono);
583
- font-size: calc(var(--inkkit-font-size, 15px) * 0.867);
611
+ font-size: calc(var(--_inkkit-font-size) * 0.867);
584
612
  line-height: 1.5;
585
613
  background: var(--_inkkit-code-bg);
586
614
  border-radius: 8px;
587
- padding: calc(var(--inkkit-font-size, 15px) * 0.8)
588
- calc(var(--inkkit-font-size, 15px) * 0.933);
589
- margin: 0 0 calc(var(--inkkit-font-size, 15px) * 0.8);
615
+ padding: calc(var(--_inkkit-font-size) * 0.8)
616
+ calc(var(--_inkkit-font-size) * 0.933);
617
+ margin: 0 0 calc(var(--_inkkit-font-size) * 0.8);
590
618
  overflow-x: auto;
591
619
  }
592
620
 
593
621
  .inkkit-root .ProseMirror pre[data-language] {
594
- padding-top: max(calc(var(--inkkit-font-size, 15px) * 2), 30px);
622
+ padding-top: max(calc(var(--_inkkit-font-size) * 2), 30px);
595
623
  }
596
624
 
597
625
  .inkkit-root .ProseMirror pre .inkkit-copy {
@@ -634,8 +662,8 @@
634
662
  }
635
663
 
636
664
  .inkkit-root .ProseMirror blockquote {
637
- margin: 0 0 calc(var(--inkkit-font-size, 15px) * 0.8);
638
- padding: 2px 0 2px calc(var(--inkkit-font-size, 15px) * 0.8);
665
+ margin: 0 0 calc(var(--_inkkit-font-size) * 0.8);
666
+ padding: 2px 0 2px calc(var(--_inkkit-font-size) * 0.8);
639
667
  border-left: 2px solid var(--_inkkit-accent);
640
668
  }
641
669
 
@@ -650,18 +678,18 @@
650
678
  .inkkit-root .ProseMirror hr {
651
679
  border: 0;
652
680
  border-top: 1px solid var(--_inkkit-rule);
653
- margin: calc(var(--inkkit-font-size, 15px) * 1.333) 0;
681
+ margin: calc(var(--_inkkit-font-size) * 1.333) 0;
654
682
  }
655
683
 
656
684
  .inkkit-root .ProseMirror ul,
657
685
  .inkkit-root .ProseMirror ol {
658
686
  margin: 0 0
659
- var(--inkkit-paragraph-spacing, calc(var(--inkkit-font-size, 15px) * 0.667));
660
- padding-left: calc(var(--inkkit-font-size, 15px) * 1.733);
687
+ var(--inkkit-paragraph-spacing, calc(var(--_inkkit-font-size) * 0.667));
688
+ padding-left: calc(var(--_inkkit-font-size) * 1.733);
661
689
  }
662
690
 
663
691
  .inkkit-root .ProseMirror li {
664
- margin: 0 0 calc(var(--inkkit-font-size, 15px) * 0.267);
692
+ margin: 0 0 calc(var(--_inkkit-font-size) * 0.267);
665
693
  }
666
694
 
667
695
  .inkkit-root .ProseMirror li > p {
@@ -670,7 +698,7 @@
670
698
 
671
699
  .inkkit-root .ProseMirror li ul,
672
700
  .inkkit-root .ProseMirror li ol {
673
- margin-top: calc(var(--inkkit-font-size, 15px) * 0.267);
701
+ margin-top: calc(var(--_inkkit-font-size) * 0.267);
674
702
  margin-bottom: 0;
675
703
  }
676
704
 
@@ -685,7 +713,7 @@
685
713
  /* The box is centered on the first line: 1lh is the line height the item's
686
714
  text uses, including when it is normal, and --inkkit-checkbox-offset
687
715
  moves the box down for a font whose lines look off-center. */
688
- --_inkkit-task-size: calc(var(--inkkit-font-size, 15px) * 0.933);
716
+ --_inkkit-task-size: calc(var(--_inkkit-font-size) * 0.933);
689
717
  --_inkkit-task-top: calc(
690
718
  (1lh - var(--_inkkit-task-size)) / 2 + var(--inkkit-checkbox-offset, 0px)
691
719
  );
@@ -694,7 +722,7 @@
694
722
  .inkkit-root .ProseMirror li[data-item-type='task']::before {
695
723
  content: '';
696
724
  position: absolute;
697
- left: calc(var(--inkkit-font-size, 15px) * -1.667);
725
+ left: calc(var(--_inkkit-font-size) * -1.667);
698
726
  top: var(--_inkkit-task-top);
699
727
  width: var(--_inkkit-task-size);
700
728
  height: var(--_inkkit-task-size);
@@ -720,10 +748,10 @@
720
748
  li[data-item-type='task'][data-checked='true']::after {
721
749
  content: '';
722
750
  position: absolute;
723
- left: calc(var(--inkkit-font-size, 15px) * -1.333);
724
- top: calc(var(--_inkkit-task-top) + var(--inkkit-font-size, 15px) * 0.133);
725
- width: calc(var(--inkkit-font-size, 15px) * 0.2);
726
- height: calc(var(--inkkit-font-size, 15px) * 0.467);
751
+ left: calc(var(--_inkkit-font-size) * -1.333);
752
+ top: calc(var(--_inkkit-task-top) + var(--_inkkit-font-size) * 0.133);
753
+ width: calc(var(--_inkkit-font-size) * 0.2);
754
+ height: calc(var(--_inkkit-font-size) * 0.467);
727
755
  border: solid Canvas;
728
756
  border-width: 0 1.5px 1.5px 0;
729
757
  transform: rotate(45deg);
@@ -826,28 +854,28 @@
826
854
  .inkkit-root .ProseMirror .inkkit-literal-markdown {
827
855
  white-space: pre-wrap;
828
856
  font-family: var(--_inkkit-mono);
829
- font-size: calc(var(--inkkit-font-size, 15px) * 0.9);
857
+ font-size: calc(var(--_inkkit-font-size) * 0.9);
830
858
  }
831
859
 
832
860
  .inkkit-root .inkkit-footnote-reference {
833
861
  cursor: pointer;
834
862
  color: var(--_inkkit-accent, currentColor);
835
- font-size: calc(var(--inkkit-font-size, 15px) * 0.75);
863
+ font-size: calc(var(--_inkkit-font-size) * 0.75);
836
864
  }
837
865
 
838
866
  .inkkit-root .inkkit-footnote-definition {
839
867
  border-inline-start: 2px solid var(--_inkkit-muted, currentColor);
840
- padding-inline-start: calc(var(--inkkit-font-size, 15px) * 1);
868
+ padding-inline-start: calc(var(--_inkkit-font-size) * 1);
841
869
  }
842
870
 
843
871
  .inkkit-root .inkkit-footnote-definition::before {
844
872
  content: '[' attr(data-inkkit-label) ']';
845
- font-size: calc(var(--inkkit-font-size, 15px) * 0.8);
873
+ font-size: calc(var(--_inkkit-font-size) * 0.8);
846
874
  }
847
875
 
848
876
  .inkkit-root .inkkit-reference-definition {
849
877
  font-family: var(--_inkkit-mono);
850
- font-size: calc(var(--inkkit-font-size, 15px) * 0.8);
878
+ font-size: calc(var(--_inkkit-font-size) * 0.8);
851
879
  opacity: 0.7;
852
880
  }
853
881
 
@@ -859,8 +887,8 @@
859
887
  .inkkit-root .ProseMirror .inkkit-callout {
860
888
  --_inkkit-callout-color: var(--_inkkit-accent);
861
889
  border-inline-start: 3px solid var(--_inkkit-callout-color);
862
- padding: calc(var(--inkkit-font-size, 15px) * 0.65)
863
- calc(var(--inkkit-font-size, 15px) * 1);
890
+ padding: calc(var(--_inkkit-font-size) * 0.65)
891
+ calc(var(--_inkkit-font-size) * 1);
864
892
  background: color-mix(in srgb, var(--_inkkit-callout-color) 7%, transparent);
865
893
  }
866
894
 
@@ -880,14 +908,14 @@
880
908
  .inkkit-root .inkkit-callout-header {
881
909
  display: flex;
882
910
  align-items: baseline;
883
- gap: calc(var(--inkkit-font-size, 15px) * 0.75);
911
+ gap: calc(var(--_inkkit-font-size) * 0.75);
884
912
  }
885
913
 
886
914
  .inkkit-root [data-inkkit-callout-toggle] {
887
915
  color: var(--_inkkit-muted);
888
916
  background: transparent;
889
917
  border: 0;
890
- padding: calc(var(--inkkit-font-size, 15px) * 0.25);
918
+ padding: calc(var(--_inkkit-font-size) * 0.25);
891
919
  cursor: pointer;
892
920
  }
893
921
 
@@ -909,7 +937,7 @@
909
937
 
910
938
  .inkkit-root [data-inkkit-comments-visible='true'] .inkkit-comment-block {
911
939
  display: block;
912
- padding: calc(var(--inkkit-font-size, 15px) * 0.5);
940
+ padding: calc(var(--_inkkit-font-size) * 0.5);
913
941
  }
914
942
 
915
943
  @media print {
@@ -953,7 +981,7 @@
953
981
  }
954
982
  .inkkit-root .inkkit-mermaid-preview[data-state='error'] {
955
983
  color: var(--inkkit-diagram-error-color, #9b2424);
956
- font-size: calc(var(--inkkit-font-size, 15px) * 0.9);
984
+ font-size: calc(var(--_inkkit-font-size) * 0.9);
957
985
  }
958
986
 
959
987
  /* One ring for every control InkKit draws; the editing surfaces can be set apart. */
@@ -1001,8 +1029,8 @@
1001
1029
  background: var(--inkkit-menu-background, light-dark(#fff, #252529));
1002
1030
  color: var(--inkkit-menu-text, CanvasText);
1003
1031
  box-shadow: var(--inkkit-menu-shadow, 0 4px 18px #0003);
1004
- font: calc(var(--inkkit-font-size, 15px) * 14 / 15) /
1005
- calc(var(--inkkit-font-size, 15px) * 1.6)
1032
+ font: calc(var(--_inkkit-font-size) * 14 / 15) /
1033
+ calc(var(--_inkkit-font-size) * 1.6)
1006
1034
  var(--inkkit-font-family, system-ui, sans-serif);
1007
1035
  }
1008
1036
  .inkkit-root .inkkit-suggestions [role='option'] {
package/dist/types.d.ts CHANGED
@@ -26,7 +26,7 @@ export interface DocumentSnapshot extends DocumentInput, DocumentVersion {
26
26
  dirty: boolean;
27
27
  }
28
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'];
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', 'slash-command-failed', 'internal'];
30
30
  export type EditorErrorCode = (typeof editorErrorCodes)[number];
31
31
  /** Every failure InkKit reports. Hosts branch on `code`; `message` is for logs. When the failure
32
32
  * started elsewhere, such as in an adapter, the host clipboard or the renderer, `cause` holds the
@@ -67,9 +67,13 @@ export interface ImageAdapter {
67
67
  }>;
68
68
  /** The stored bytes and type of `reference`, for portable clipboard and print output. */
69
69
  exportImage(reference: string, context: DocumentContext): Promise<PortableImage>;
70
+ /** Called for a context-menu request on an image. Inkkit selects the image first. */
71
+ contextMenu?(reference: string, point: ClientPoint, context: DocumentContext): void;
70
72
  }
71
73
  /** A wiki link as authored. */
72
74
  export interface WikiLinkReference {
75
+ /** The link's Markdown as the document holds it, such as `[[Plan|Plan]]`. */
76
+ raw: string;
73
77
  /** The note name, with escapes removed. Empty for a link such as `[[#Heading]]`. */
74
78
  target: string;
75
79
  fragment?: string;
@@ -93,6 +97,8 @@ export interface FileReference {
93
97
  reference: string;
94
98
  /** `path` for `![alt](destination)`, `wiki` for `![[name]]`. */
95
99
  kind: 'path' | 'wiki';
100
+ /** The embed's Markdown as the document holds it, such as `![alt](a\_b.png)`. */
101
+ raw: string;
96
102
  /** The reference without its fragment. Use it to find the file. */
97
103
  target: string;
98
104
  /** Everything after the separating `#`, such as `t=10` or `page=3`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicayzer/inkkit",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "A preserving Markdown editor for offline web views and the web",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "packageManager": "pnpm@11.0.9",
40
40
  "engines": {
41
- "node": ">=22.14"
41
+ "node": ">=26"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "node scripts/clean-build.mjs && tsc -p tsconfig.build.json && vite build --config vite.package.config.ts && node scripts/finish-build.mjs",