@aicayzer/inkkit 0.2.0 → 0.3.1
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/dist/chunks/{core-C612uj1Q.js → core-Dx4gTiUo.js} +1109 -263
- package/dist/chunks/{highlight-AI86evan.js → highlight-GlZZ_7st.js} +1 -1
- package/dist/core.js +1 -1
- package/dist/editor.d.ts +29 -7
- package/dist/index.js +1 -1
- package/dist/style.css +88 -16
- package/dist/types.d.ts +7 -1
- package/package.json +1 -1
|
@@ -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-Dx4gTiUo.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-Dx4gTiUo.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,
|
|
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();
|
|
@@ -343,6 +350,7 @@ export declare class InkKitEditor {
|
|
|
343
350
|
* throws `destroyed`. */
|
|
344
351
|
destroy(): Promise<void>;
|
|
345
352
|
private keymapPlugin;
|
|
353
|
+
private indentPlugin;
|
|
346
354
|
private copySourceSelection;
|
|
347
355
|
/** Builds the editor in `root`. It has no document until `loadDocument`. Rejects with
|
|
348
356
|
* `invalid-argument` for a bad root, handler or option. */
|
|
@@ -414,10 +422,18 @@ export declare class InkKitEditor {
|
|
|
414
422
|
/** Moves focus off InkKit's text surfaces. Focus anywhere else, such as in a host control or a
|
|
415
423
|
* control InkKit draws, is left alone. */
|
|
416
424
|
blur(expectedGeneration?: number): void;
|
|
425
|
+
/**
|
|
426
|
+
* Resolves wiki links and file embeds again, all of them or those whose `target` is named, after
|
|
427
|
+
* something they point to changed. A file keeps its card until the new answer differs. Changes no
|
|
428
|
+
* document state, so it works in a read-only editor and during composition. Source and TXT modes
|
|
429
|
+
* draw no references, and they resolve afresh when formatted mode returns.
|
|
430
|
+
*/
|
|
431
|
+
refreshReferences(targets?: readonly string[], expectedGeneration?: number): void;
|
|
417
432
|
/** Replaces every binding. Keys are in ProseMirror's notation. A key given to two shortcuts goes
|
|
418
433
|
* to the later one, in the order history, formatting, block moves, tables, so it lands the same
|
|
419
434
|
* way every time. A table binding passes a key it shares with a block move to the move outside
|
|
420
|
-
* a table.
|
|
435
|
+
* a table. List indentation keys apply after all of these, and after the table keys the editor
|
|
436
|
+
* keeps for itself. */
|
|
421
437
|
setKeymap(keymap: Keymap): void;
|
|
422
438
|
/** Dropped files land as one paragraph per path at the drop point: in place of an empty block, after
|
|
423
439
|
* the top-level block otherwise, so a list or quote is not opened up by them. */
|
|
@@ -425,6 +441,11 @@ export declare class InkKitEditor {
|
|
|
425
441
|
/** Inserts images by reference, at the selection or the drop point `at`. Returns false when it
|
|
426
442
|
* does nothing. */
|
|
427
443
|
insertImages(images: ImageInsertion[], at?: ClientPoint, expectedGeneration?: number): boolean;
|
|
444
|
+
/** Adds images as the last blocks of the document and leaves everything else as it is: no focus,
|
|
445
|
+
* no scrolling, and the selection stays on the text it covered. For a host that attaches images
|
|
446
|
+
* to a document the person is not editing at that moment. Returns false when it does nothing. */
|
|
447
|
+
appendImages(images: ImageInsertion[], expectedGeneration?: number): boolean;
|
|
448
|
+
private imageBlocks;
|
|
428
449
|
private insertInline;
|
|
429
450
|
private insertBlocks;
|
|
430
451
|
private withMarkRunSelected;
|
|
@@ -447,8 +468,9 @@ export declare class InkKitEditor {
|
|
|
447
468
|
/** Returns whether the document or the marks the next typed text takes changed. */
|
|
448
469
|
format(command: FormatCommand, options?: FormatOptions, expectedGeneration?: number): boolean;
|
|
449
470
|
/**
|
|
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
|
|
471
|
+
* Refuses a link destination that is empty, that opens anything but a web, mail or phone address
|
|
472
|
+
* or a scheme the host listed, or that the Markdown writer cannot save so that it reads back the
|
|
473
|
+
* same.
|
|
452
474
|
*/
|
|
453
475
|
private checkDestination;
|
|
454
476
|
/**
|
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-Dx4gTiUo.js";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
registerMermaid(async () => (await import("mermaid")).default);
|
|
4
4
|
//#endregion
|
package/dist/style.css
CHANGED
|
@@ -81,7 +81,10 @@
|
|
|
81
81
|
overflow-x: auto;
|
|
82
82
|
}
|
|
83
83
|
.inkkit-root .ProseMirror table {
|
|
84
|
-
border-collapse:
|
|
84
|
+
border-collapse: separate;
|
|
85
|
+
border-spacing: 0;
|
|
86
|
+
border: 1px solid var(--_inkkit-rule);
|
|
87
|
+
border-radius: var(--inkkit-table-radius, 4px);
|
|
85
88
|
width: 100%;
|
|
86
89
|
}
|
|
87
90
|
.inkkit-root .ProseMirror td,
|
|
@@ -91,9 +94,39 @@
|
|
|
91
94
|
min-width: calc(var(--inkkit-font-size, 15px) * 4);
|
|
92
95
|
padding: calc(var(--inkkit-font-size, 15px) * 0.4)
|
|
93
96
|
calc(var(--inkkit-font-size, 15px) * 0.6);
|
|
94
|
-
border:
|
|
97
|
+
border: 0 solid var(--_inkkit-rule);
|
|
98
|
+
border-width: 0 1px 1px 0;
|
|
95
99
|
vertical-align: top;
|
|
96
100
|
}
|
|
101
|
+
/* Round only the perimeter; keep controls and focus rings outside the table
|
|
102
|
+
unclipped, and leave every internal cell division square. */
|
|
103
|
+
.inkkit-root .ProseMirror tr > :last-child {
|
|
104
|
+
border-right-width: 0;
|
|
105
|
+
}
|
|
106
|
+
.inkkit-root .ProseMirror tr:last-child > * {
|
|
107
|
+
border-bottom-width: 0;
|
|
108
|
+
}
|
|
109
|
+
.inkkit-root .ProseMirror tr:first-child > :first-child {
|
|
110
|
+
border-top-left-radius: max(0px, calc(var(--inkkit-table-radius, 4px) - 1px));
|
|
111
|
+
}
|
|
112
|
+
.inkkit-root .ProseMirror tr:first-child > :last-child {
|
|
113
|
+
border-top-right-radius: max(
|
|
114
|
+
0px,
|
|
115
|
+
calc(var(--inkkit-table-radius, 4px) - 1px)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
.inkkit-root .ProseMirror tr:last-child > :first-child {
|
|
119
|
+
border-bottom-left-radius: max(
|
|
120
|
+
0px,
|
|
121
|
+
calc(var(--inkkit-table-radius, 4px) - 1px)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
.inkkit-root .ProseMirror tr:last-child > :last-child {
|
|
125
|
+
border-bottom-right-radius: max(
|
|
126
|
+
0px,
|
|
127
|
+
calc(var(--inkkit-table-radius, 4px) - 1px)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
97
130
|
.inkkit-root .ProseMirror th {
|
|
98
131
|
background: var(--_inkkit-code-bg);
|
|
99
132
|
font-weight: 600;
|
|
@@ -107,6 +140,7 @@
|
|
|
107
140
|
position: absolute;
|
|
108
141
|
inset: 0;
|
|
109
142
|
z-index: 2;
|
|
143
|
+
border-radius: inherit;
|
|
110
144
|
content: '';
|
|
111
145
|
background: color-mix(in srgb, var(--_inkkit-accent) 25%, transparent);
|
|
112
146
|
pointer-events: none;
|
|
@@ -267,9 +301,10 @@
|
|
|
267
301
|
content: '';
|
|
268
302
|
display: block;
|
|
269
303
|
position: absolute;
|
|
270
|
-
top:
|
|
271
|
-
width:
|
|
272
|
-
|
|
304
|
+
top: 0;
|
|
305
|
+
width: 2px;
|
|
306
|
+
height: 1lh;
|
|
307
|
+
background: var(--_inkkit-accent);
|
|
273
308
|
animation: inkkit-gapcursor-blink 1.1s steps(2, start) infinite;
|
|
274
309
|
}
|
|
275
310
|
@keyframes inkkit-gapcursor-blink {
|
|
@@ -463,13 +498,26 @@
|
|
|
463
498
|
pointer-events: none;
|
|
464
499
|
}
|
|
465
500
|
|
|
466
|
-
/* The selection plugin draws the selection over the text alone; the engine's own fills the margins too.
|
|
501
|
+
/* The selection plugin draws the selection over the text alone; the engine's own fills the margins too.
|
|
502
|
+
The surface needs its own rule: the descendant selector does not reach the surface itself, and WebKit paints that as full-width bars. */
|
|
503
|
+
.inkkit-root .ProseMirror.inkkit-painted-selection::selection,
|
|
467
504
|
.inkkit-root .ProseMirror.inkkit-painted-selection ::selection {
|
|
468
505
|
background: transparent;
|
|
469
506
|
}
|
|
470
507
|
|
|
471
|
-
.inkkit-root ::highlight(inkkit-selection)
|
|
472
|
-
|
|
508
|
+
.inkkit-root ::highlight(inkkit-selection),
|
|
509
|
+
.inkkit-root ::selection {
|
|
510
|
+
background: var(
|
|
511
|
+
--inkkit-inactive-selection-background,
|
|
512
|
+
light-dark(#d4d4d4, #555)
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
.inkkit-root.inkkit-selection-active ::highlight(inkkit-selection),
|
|
516
|
+
.inkkit-root.inkkit-selection-active ::selection {
|
|
517
|
+
background: var(
|
|
518
|
+
--inkkit-selection-background,
|
|
519
|
+
color-mix(in srgb, var(--_inkkit-accent) 30%, transparent)
|
|
520
|
+
);
|
|
473
521
|
}
|
|
474
522
|
|
|
475
523
|
.inkkit-root .ProseMirror > :first-child {
|
|
@@ -518,16 +566,29 @@
|
|
|
518
566
|
font-weight: 700;
|
|
519
567
|
}
|
|
520
568
|
|
|
521
|
-
.inkkit-root .ProseMirror a
|
|
569
|
+
.inkkit-root .ProseMirror a,
|
|
570
|
+
.inkkit-root .inkkit-wiki-link {
|
|
522
571
|
color: var(--_inkkit-accent);
|
|
523
572
|
text-decoration: none;
|
|
524
573
|
text-underline-offset: 2px;
|
|
525
574
|
}
|
|
526
575
|
|
|
527
|
-
.inkkit-root .ProseMirror a:hover
|
|
576
|
+
.inkkit-root .ProseMirror a:hover,
|
|
577
|
+
.inkkit-root .inkkit-wiki-link:hover {
|
|
528
578
|
text-decoration: underline;
|
|
529
579
|
}
|
|
530
580
|
|
|
581
|
+
/* A missing target differs by its line, not only its color, which forced colors replace. */
|
|
582
|
+
.inkkit-root .inkkit-wiki-link[data-missing] {
|
|
583
|
+
text-decoration: underline dashed;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
@media (forced-colors: active) {
|
|
587
|
+
.inkkit-root .inkkit-wiki-link {
|
|
588
|
+
color: LinkText;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
531
592
|
/* Held Mod opens a link on click; an empty address opens nothing. */
|
|
532
593
|
.inkkit-root.inkkit-link-modifier .ProseMirror a[href]:not([href='']),
|
|
533
594
|
.inkkit-root.inkkit-link-modifier .inkkit-wiki-link {
|
|
@@ -665,7 +726,11 @@
|
|
|
665
726
|
width: var(--_inkkit-task-size);
|
|
666
727
|
height: var(--_inkkit-task-size);
|
|
667
728
|
box-sizing: border-box;
|
|
668
|
-
border: 1.5px solid
|
|
729
|
+
border: 1.5px solid
|
|
730
|
+
var(
|
|
731
|
+
--inkkit-checkbox-border-color,
|
|
732
|
+
color-mix(in srgb, CanvasText 35%, transparent)
|
|
733
|
+
);
|
|
669
734
|
border-radius: 4px;
|
|
670
735
|
cursor: pointer;
|
|
671
736
|
}
|
|
@@ -808,7 +873,7 @@
|
|
|
808
873
|
}
|
|
809
874
|
|
|
810
875
|
.inkkit-root .inkkit-reference-definition {
|
|
811
|
-
font-family:
|
|
876
|
+
font-family: var(--_inkkit-mono);
|
|
812
877
|
font-size: calc(var(--inkkit-font-size, 15px) * 0.8);
|
|
813
878
|
opacity: 0.7;
|
|
814
879
|
}
|
|
@@ -963,11 +1028,13 @@
|
|
|
963
1028
|
background: var(--inkkit-menu-background, light-dark(#fff, #252529));
|
|
964
1029
|
color: var(--inkkit-menu-text, CanvasText);
|
|
965
1030
|
box-shadow: var(--inkkit-menu-shadow, 0 4px 18px #0003);
|
|
966
|
-
font:
|
|
1031
|
+
font: calc(var(--inkkit-font-size, 15px) * 14 / 15) /
|
|
1032
|
+
calc(var(--inkkit-font-size, 15px) * 1.6)
|
|
1033
|
+
var(--inkkit-font-family, system-ui, sans-serif);
|
|
967
1034
|
}
|
|
968
1035
|
.inkkit-root .inkkit-suggestions [role='option'] {
|
|
969
1036
|
box-sizing: border-box;
|
|
970
|
-
height: 32px;
|
|
1037
|
+
min-height: 32px;
|
|
971
1038
|
display: flex;
|
|
972
1039
|
align-items: center;
|
|
973
1040
|
gap: 8px;
|
|
@@ -1027,8 +1094,9 @@
|
|
|
1027
1094
|
}
|
|
1028
1095
|
.inkkit-root .inkkit-code-language:focus-visible,
|
|
1029
1096
|
.inkkit-root .inkkit-copy:focus-visible {
|
|
1030
|
-
outline:
|
|
1031
|
-
|
|
1097
|
+
outline: var(--inkkit-focus-width, 2px) solid
|
|
1098
|
+
var(--inkkit-focus-color, var(--_inkkit-accent));
|
|
1099
|
+
outline-offset: var(--inkkit-focus-offset, 1px);
|
|
1032
1100
|
}
|
|
1033
1101
|
.inkkit-root .inkkit-code-language-menu {
|
|
1034
1102
|
position: fixed;
|
|
@@ -1078,3 +1146,7 @@
|
|
|
1078
1146
|
.inkkit-root .inkkit-code-language-list button[aria-pressed='true'] {
|
|
1079
1147
|
background: color-mix(in srgb, CanvasText 8%, transparent);
|
|
1080
1148
|
}
|
|
1149
|
+
|
|
1150
|
+
.inkkit-root .milkdown-drop-indicator {
|
|
1151
|
+
background: var(--inkkit-drop-indicator-color, var(--_inkkit-accent));
|
|
1152
|
+
}
|
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 ``, `wiki` for `![[name]]`. */
|
|
95
99
|
kind: 'path' | 'wiki';
|
|
100
|
+
/** The embed's Markdown as the document holds it, such as ``. */
|
|
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`. */
|