@withmarfa/inkkit 0.8.0-alpha.0 → 0.8.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 +1 -1
- package/README.md +4 -4
- package/dist/THIRD-PARTY-NOTICES-FULL.txt +1 -1
- package/dist/THIRD-PARTY-NOTICES.txt +1 -1
- package/dist/chunks/{core-CntI6pRW.js → core-DZmgpf9J.js} +29265 -62655
- package/dist/chunks/front-matter-yaml-Bh_a5HA2.js +5834 -0
- package/dist/chunks/{highlight-B__AKLId.js → highlight-C_1DEhlN.js} +2 -1
- package/dist/chunks/lib-CO2Iv0U3.js +28347 -0
- package/dist/core.js +1 -1
- package/dist/editor.d.ts +55 -13
- package/dist/index.js +1 -1
- package/dist/style.css +42 -26
- package/dist/types.d.ts +26 -9
- package/package.json +3 -8
- package/dist/formats/convert.d.ts +0 -17
- package/dist/formats/index.d.ts +0 -8
- package/dist/formats/markdown.d.ts +0 -4
- package/dist/formats/rich-text-import.d.ts +0 -11
- package/dist/formats/rich-text-model.d.ts +0 -56
- package/dist/formats/rich-text-prose.d.ts +0 -23
- package/dist/formats/rich-text.d.ts +0 -5
- package/dist/formats/text.d.ts +0 -4
- package/dist/formats/types.d.ts +0 -120
package/dist/formats/types.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import type { Ctx } from '@milkdown/kit/ctx';
|
|
2
|
-
import type { Fragment, Node as ProseNode, Slice } from '@milkdown/kit/prose/model';
|
|
3
|
-
import type { EditorState, Transaction } from '@milkdown/kit/prose/state';
|
|
4
|
-
import type { DiagramStore } from '../mermaid';
|
|
5
|
-
import type { ClipboardInput, ClipboardOutput, DocumentContext, DocumentFormat, DocumentVersion, EditorLabels, FileAdapter, FormatPromise, ImageAdapter, PrintableDocument } from '../types';
|
|
6
|
-
/** The current document as the editor holds it: its text, which for RTF is the canonical JSON of
|
|
7
|
-
* its `RichTextDocument`. */
|
|
8
|
-
export interface SavedText extends DocumentVersion {
|
|
9
|
-
readonly format: DocumentFormat;
|
|
10
|
-
readonly text: string;
|
|
11
|
-
readonly dirty: boolean;
|
|
12
|
-
}
|
|
13
|
-
/** What a format whose document is not source text adds to formatted editing. */
|
|
14
|
-
export interface RichTextBehaviour {
|
|
15
|
-
/** Whether the document that `tr` reaches from `before` holds only what the format can. */
|
|
16
|
-
allows(tr: Transaction, before: EditorState): boolean;
|
|
17
|
-
/** Runs in `from` to `to` that hold both a link and underline, which the format cannot keep. */
|
|
18
|
-
linkedUnderlines(doc: ProseNode, from: number, to: number): {
|
|
19
|
-
from: number;
|
|
20
|
-
to: number;
|
|
21
|
-
}[];
|
|
22
|
-
/** Whether the selection is all link text, where underline does nothing. */
|
|
23
|
-
inLink(state: EditorState): boolean;
|
|
24
|
-
/** The slice a formatted paste inserts. */
|
|
25
|
-
paste(input: ClipboardInput, state: EditorState, linkSchemes: ReadonlySet<string>): Slice;
|
|
26
|
-
/** What copying the selection writes. */
|
|
27
|
-
copy(state: EditorState, linkSchemes: ReadonlySet<string>): {
|
|
28
|
-
text: string;
|
|
29
|
-
html: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/** What a format keeps from reading a text, to save edits to the document it read. */
|
|
33
|
-
export interface FormatSource {
|
|
34
|
-
/** The document read from the text. */
|
|
35
|
-
readonly baseline: ProseNode;
|
|
36
|
-
/** The text to save for `doc`, which is `baseline` after edits. `carried` holds nodes that block
|
|
37
|
-
* moves carried. Absent for a format that saves its literal surface's text. */
|
|
38
|
-
serialize?(doc: ProseNode, carried?: WeakSet<ProseNode>): string;
|
|
39
|
-
}
|
|
40
|
-
/** What a format's output reads from the editor. Each call reads the current value, and
|
|
41
|
-
* `context()` names a new operation, so call it only when an adapter needs it. */
|
|
42
|
-
export interface FormatOutput {
|
|
43
|
-
ctx(): Ctx;
|
|
44
|
-
element(): HTMLTextAreaElement;
|
|
45
|
-
sourceMode(): boolean;
|
|
46
|
-
exportDocument(text: string): ProseNode;
|
|
47
|
-
images(): ImageAdapter | undefined;
|
|
48
|
-
files(): FileAdapter | undefined;
|
|
49
|
-
linkSchemes(): ReadonlySet<string>;
|
|
50
|
-
context(): DocumentContext;
|
|
51
|
-
diagrams(): DiagramStore;
|
|
52
|
-
root(): HTMLElement;
|
|
53
|
-
/** Markdown for rich content copied from a document that is not Markdown. A copy may lose what
|
|
54
|
-
* Markdown can't hold, such as alignment. */
|
|
55
|
-
richTextMarkdown(content: Slice): string;
|
|
56
|
-
remember<T extends {
|
|
57
|
-
text: string;
|
|
58
|
-
html: string;
|
|
59
|
-
}>(output: T, markdown: string, content: Fragment, privateSource?: boolean): T;
|
|
60
|
-
}
|
|
61
|
-
export type PrintableContent = Pick<PrintableDocument, 'html' | 'styles' | 'assets' | 'warnings'>;
|
|
62
|
-
export interface PrintRequest {
|
|
63
|
-
/** The current text. */
|
|
64
|
-
readonly text: string;
|
|
65
|
-
/** The document to print, which holds source typed but not yet settled. */
|
|
66
|
-
readonly doc: ProseNode;
|
|
67
|
-
readonly signal: AbortSignal;
|
|
68
|
-
readonly output: FormatOutput;
|
|
69
|
-
}
|
|
70
|
-
export interface ClipboardRequest {
|
|
71
|
-
readonly snapshot: SavedText;
|
|
72
|
-
/** The whole document, rather than the selection. */
|
|
73
|
-
readonly all: boolean;
|
|
74
|
-
readonly version: DocumentVersion;
|
|
75
|
-
readonly output: FormatOutput;
|
|
76
|
-
/** Runs asynchronous output work, and throws `stale-document` when the document, its revision or
|
|
77
|
-
* the editing mode changed meanwhile. */
|
|
78
|
-
run<T>(operation: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
79
|
-
/** Throws unless the captured document is still current. */
|
|
80
|
-
assertCurrent(): void;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Everything that differs between document formats. The editor sets one handler on each load and
|
|
84
|
-
* reads its fields directly, so a keystroke does no lookup.
|
|
85
|
-
*/
|
|
86
|
-
export interface FormatHandler {
|
|
87
|
-
readonly format: DocumentFormat;
|
|
88
|
-
readonly promise: FormatPromise;
|
|
89
|
-
/** The person edits only the literal surface: there is no formatted mode, and no format, table
|
|
90
|
-
* or block commands. */
|
|
91
|
-
readonly literalOnly: boolean;
|
|
92
|
-
/** A source mode exists beside formatted mode. */
|
|
93
|
-
readonly sourceMode: boolean;
|
|
94
|
-
/** The label that names the formatted surface. */
|
|
95
|
-
readonly formattedLabel: keyof Pick<EditorLabels, 'formattedEditor' | 'richTextEditor'>;
|
|
96
|
-
/** The label that names the literal surface. */
|
|
97
|
-
readonly literalLabel: keyof Pick<EditorLabels, 'plainTextEditor' | 'sourceEditor'>;
|
|
98
|
-
/** `headings` lists the document's headings. */
|
|
99
|
-
readonly headings: boolean;
|
|
100
|
-
/** Copying from the literal surface is left to the browser. */
|
|
101
|
-
readonly nativeCopy: boolean;
|
|
102
|
-
/** Text inserted on the literal surface keeps its own line endings, rather than taking the
|
|
103
|
-
* document's. */
|
|
104
|
-
readonly keepsInsertedLineEndings: boolean;
|
|
105
|
-
/** Markdown input rules and bare-address links apply while typing in formatted mode. */
|
|
106
|
-
readonly markdownInput: boolean;
|
|
107
|
-
/** Present for a format that is not Markdown source but edits in formatted mode. */
|
|
108
|
-
readonly richText?: RichTextBehaviour;
|
|
109
|
-
/** Reads loaded text into the formatted document. Throws when it cannot be shown. */
|
|
110
|
-
load(ctx: Ctx, text: string): FormatSource;
|
|
111
|
-
/** Reads text from the literal surface into the formatted document. */
|
|
112
|
-
parse(ctx: Ctx, text: string): FormatSource;
|
|
113
|
-
/** The document that output reads while text from the literal surface has not reached the
|
|
114
|
-
* formatted document, or `undefined` to read the formatted document. */
|
|
115
|
-
pendingExport(ctx: Ctx, text: string): ProseNode | undefined;
|
|
116
|
-
/** The text that a paste on the literal surface inserts. */
|
|
117
|
-
literalPaste(input: ClipboardInput): string;
|
|
118
|
-
print(request: PrintRequest): Promise<PrintableContent>;
|
|
119
|
-
clipboard(request: ClipboardRequest): Promise<ClipboardOutput>;
|
|
120
|
-
}
|