@withmarfa/inkkit 0.0.0-stage → 0.8.0-alpha.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/LICENSE +21 -0
- package/NOTICE +41 -0
- package/README.md +47 -2
- package/dist/THIRD-PARTY-NOTICES-FULL.txt +3377 -0
- package/dist/THIRD-PARTY-NOTICES.txt +3377 -0
- package/dist/chunks/core-DZmgpf9J.js +38254 -0
- package/dist/chunks/front-matter-yaml-Bh_a5HA2.js +5834 -0
- package/dist/chunks/highlight-C_1DEhlN.js +14069 -0
- package/dist/chunks/lib-CO2Iv0U3.js +28347 -0
- package/dist/core.d.ts +7 -0
- package/dist/core.js +2 -0
- package/dist/diagnostics.d.ts +109 -0
- package/dist/editor.d.ts +592 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32793 -0
- package/dist/link-address.d.ts +11 -0
- package/dist/style.css +2193 -0
- package/dist/themes/calm.css +36 -0
- package/dist/themes/essential.css +36 -0
- package/dist/themes/standard.css +39 -0
- package/dist/types.d.ts +577 -0
- package/package.json +96 -4
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { InkKitEditor } from './editor.js';
|
|
2
|
+
export type { EditorEvents, EditorOptions, TextInputPreferences, PasteRoute, DisplayPreferences, CommandState, EditingMode, CaretState, Mark, Block, FormatCommand, FormatOptions, KeyInput, ImageInsertion, ShortcutName, Keymap, } from './editor.js';
|
|
3
|
+
export { InkKitError } from './types.js';
|
|
4
|
+
export { normalizeLinkAddress, canOpenLink } from './link-address.js';
|
|
5
|
+
export type { DocumentFormat, TextDocumentFormat, TextDocumentInput, RichTextDocumentInput, TextDocumentSnapshot, RichTextDocumentSnapshot, RichTextDocument, RichTextBlock, RichTextListItem, RichTextTableCell, RichTextInline, RichTextMark, FormatLoss, FormatLossCode, ConvertedDocument, FormatPromise, OfferedFormat, EditorLabels, Heading, TableCommand, TableOptions, BlockMoveDirection, DocumentContext, DocumentInput, DocumentSnapshot, DocumentVersion, EditorErrorCode, ImageAdapter, ImageImportContext, WikiLinkPresentation, WikiLinkReference, WikiLinkAdapter, LinkMenuTarget, FileReference, ClientPoint, FileContext, FilePresentation, FileCardAction, FileAdapter, CapturedImage, PortableImage, ClipboardInput, ClipboardOutput, ClipboardScope, ClipboardImage, ClipboardDiagram, PrintableDocument, PrintableWarning, TextRange, FindState, FindSession, ReadableTextSnapshot, TextRect, ViewportInsets, ViewportOptions, ViewportSnapshot, } from './types.js';
|
|
6
|
+
export type { SlashMenuOptions, SlashCommandName, SlashCommand } from './types.js';
|
|
7
|
+
export type { DiagnosticReport, DiagnosticEvent, DiagnosticState, DiagnosticPresentation, } from './diagnostics.js';
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type DocumentFormat, type EditorErrorCode } from './types.js';
|
|
2
|
+
/** Content-free editor counters and input guards. */
|
|
3
|
+
export type DiagnosticState = {
|
|
4
|
+
ready: boolean;
|
|
5
|
+
revision: number;
|
|
6
|
+
generation?: number;
|
|
7
|
+
format: DocumentFormat;
|
|
8
|
+
mode: 'formatted' | 'source';
|
|
9
|
+
editable: boolean;
|
|
10
|
+
composing: boolean;
|
|
11
|
+
pending: boolean;
|
|
12
|
+
selection?: {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/** Closed categories, never raw browser input, method arguments or error messages. */
|
|
18
|
+
export type DiagnosticEvent = {
|
|
19
|
+
sequence: number;
|
|
20
|
+
elapsedMs: number;
|
|
21
|
+
/** Consecutive identical occurrences this event stands for. Absent means one. */
|
|
22
|
+
count?: number;
|
|
23
|
+
kind: 'input' | 'composition' | 'focus' | 'selection' | 'operation' | 'preservation' | 'error' | 'enabled';
|
|
24
|
+
state: DiagnosticState;
|
|
25
|
+
phase?: 'before' | 'after' | 'start' | 'end' | 'in' | 'out' | 'begin' | 'success' | 'refused' | 'handled';
|
|
26
|
+
input?: 'text' | 'composition' | 'delete' | 'paste' | 'drop' | 'history' | 'format' | 'other';
|
|
27
|
+
operation?: 'snapshot' | 'edit' | 'history' | 'load' | 'configuration' | 'output' | 'selection' | 'lifecycle' | 'other';
|
|
28
|
+
code?: EditorErrorCode;
|
|
29
|
+
path?: 'unchanged' | 'local' | 'regions' | 'whole';
|
|
30
|
+
reason?: 'matching-budget' | 'source-location' | 'reopen-mismatch' | 'parse-refusal' | 'unexpected';
|
|
31
|
+
};
|
|
32
|
+
/** Declared CSS configuration and geometry, measured only when a report is requested. */
|
|
33
|
+
export type DiagnosticPresentation = {
|
|
34
|
+
fontFamily: string;
|
|
35
|
+
fontSize: number;
|
|
36
|
+
fontWeight: number;
|
|
37
|
+
fontStyle: 'normal' | 'italic' | 'oblique' | 'other';
|
|
38
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
39
|
+
lineHeight?: number;
|
|
40
|
+
block: 'paragraph' | 'heading' | 'code' | 'other' | 'literal';
|
|
41
|
+
marks: ('strong' | 'emphasis' | 'inlineCode' | 'strike_through' | 'link' | 'highlight' | 'other')[];
|
|
42
|
+
caretColor: string;
|
|
43
|
+
caret?: {
|
|
44
|
+
left: number;
|
|
45
|
+
top: number;
|
|
46
|
+
right: number;
|
|
47
|
+
bottom: number;
|
|
48
|
+
};
|
|
49
|
+
viewport: {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
};
|
|
53
|
+
scroll: {
|
|
54
|
+
left: number;
|
|
55
|
+
top: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/** An opt-in local report. Disabling diagnostics clears all retained events and the incident. */
|
|
59
|
+
export type DiagnosticReport = {
|
|
60
|
+
schemaVersion: 1;
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
sessionId: string;
|
|
63
|
+
state: DiagnosticState;
|
|
64
|
+
events: DiagnosticEvent[];
|
|
65
|
+
incident?: {
|
|
66
|
+
triggerSequence: number;
|
|
67
|
+
events: DiagnosticEvent[];
|
|
68
|
+
tail: DiagnosticEvent[];
|
|
69
|
+
};
|
|
70
|
+
presentation?: DiagnosticPresentation;
|
|
71
|
+
};
|
|
72
|
+
type Detail = Omit<DiagnosticEvent, 'sequence' | 'elapsedMs' | 'state' | 'count'>;
|
|
73
|
+
export declare function observePreservation(ctx: object, observer?: (detail: Detail) => void): void;
|
|
74
|
+
export declare function tracePreservation(ctx: object, detail: Detail): void;
|
|
75
|
+
export declare class Diagnostics {
|
|
76
|
+
private readonly state;
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
private sessionId;
|
|
79
|
+
private started;
|
|
80
|
+
private sequence;
|
|
81
|
+
private events;
|
|
82
|
+
private incident?;
|
|
83
|
+
/** A call's begin event, held until the call is known to need it. */
|
|
84
|
+
private held?;
|
|
85
|
+
private dispose?;
|
|
86
|
+
private latestState;
|
|
87
|
+
private currentState;
|
|
88
|
+
capture(detail: Detail): void;
|
|
89
|
+
/**
|
|
90
|
+
* Holds the begin event of a public call. A synchronous call that succeeds with nothing else
|
|
91
|
+
* recorded meanwhile needs only its outcome, so `settle` drops the held event. Anything recorded
|
|
92
|
+
* during the call, a refusal, an asynchronous result or a report request writes it first, in
|
|
93
|
+
* order, so the events a call caused stay between its begin and its outcome.
|
|
94
|
+
*/
|
|
95
|
+
begin(detail: Detail): object | undefined;
|
|
96
|
+
settle(begin: object | undefined, keep: boolean): void;
|
|
97
|
+
constructor(state: () => DiagnosticState);
|
|
98
|
+
setEnabled(enabled: boolean, root: HTMLElement, ctx: object): void;
|
|
99
|
+
private record;
|
|
100
|
+
private prepare;
|
|
101
|
+
private release;
|
|
102
|
+
private append;
|
|
103
|
+
report(presentation?: DiagnosticPresentation): DiagnosticReport;
|
|
104
|
+
destroy(ctx: object): void;
|
|
105
|
+
}
|
|
106
|
+
export declare function diagnosticOperation(name: string): DiagnosticEvent['operation'];
|
|
107
|
+
export declare const diagnosticNumber: (value: number) => number;
|
|
108
|
+
export declare function diagnosticReason(error: unknown): DiagnosticEvent['reason'];
|
|
109
|
+
export {};
|