@quillmark/wasm 0.132.0 → 0.134.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/CHANGELOG.md +418 -0
- package/README.md +30 -79
- package/THIRD_PARTY_LICENSES.md +446 -106
- package/core/wasm.d.ts +537 -378
- package/core/wasm.js +698 -212
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +30 -13
- package/package.json +1 -1
- package/render/wasm.d.ts +550 -394
- package/render/wasm.js +716 -248
- package/render/wasm_bg.wasm +0 -0
- package/render/wasm_bg.wasm.d.ts +30 -14
- package/runtime/runtime.d.ts +85 -121
- package/runtime/runtime.js +54 -137
- package/sbom.cdx.json +408 -573
package/render/wasm_bg.wasm
CHANGED
|
Binary file
|
package/render/wasm_bg.wasm.d.ts
CHANGED
|
@@ -5,15 +5,24 @@ export const __wbg_document_free: (a: number, b: number) => void;
|
|
|
5
5
|
export const __wbg_engine_free: (a: number, b: number) => void;
|
|
6
6
|
export const __wbg_livesession_free: (a: number, b: number) => void;
|
|
7
7
|
export const __wbg_quill_free: (a: number, b: number) => void;
|
|
8
|
+
export const deleteRange: (a: number, b: number, c: number, d: number) => void;
|
|
9
|
+
export const diff: (a: number, b: number, c: number) => void;
|
|
8
10
|
export const document__addCard: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
9
11
|
export const document__commitField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
10
12
|
export const document__commitFields: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
13
|
+
export const document__hash: (a: number, b: number, c: number) => void;
|
|
14
|
+
export const document__hashAt: (a: number, b: number, c: number, d: number) => void;
|
|
11
15
|
export const document__readerGet: (a: number, b: number, c: number, d: number) => void;
|
|
12
16
|
export const document__readerGetContent: (a: number, b: number, c: number, d: number) => void;
|
|
13
17
|
export const document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
18
|
+
export const document__revise: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
19
|
+
export const document__reviseDocument: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
20
|
+
export const document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
21
|
+
export const document_anchorContext: (a: number, b: number, c: number, d: number) => void;
|
|
22
|
+
export const document_anchorContexts: (a: number, b: number) => void;
|
|
23
|
+
export const document_annotated: (a: number, b: number, c: number) => void;
|
|
24
|
+
export const document_annotatedAt: (a: number, b: number, c: number) => void;
|
|
25
|
+
export const document_apply: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
17
26
|
export const document_bodyMarkdown: (a: number, b: number, c: number) => void;
|
|
18
27
|
export const document_card: (a: number, b: number, c: number) => void;
|
|
19
28
|
export const document_cardCount: (a: number) => number;
|
|
@@ -26,27 +35,28 @@ export const document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
|
26
35
|
export const document_fromStored: (a: number, b: number, c: number) => void;
|
|
27
36
|
export const document_getExt: (a: number, b: number, c: number) => void;
|
|
28
37
|
export const document_getStored: (a: number, b: number, c: number) => void;
|
|
38
|
+
export const document_hash: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const document_hashAt: (a: number, b: number, c: number) => void;
|
|
29
40
|
export const document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
30
|
-
export const document_loadStored: (a: number, b: number, c: number, d: number) => void;
|
|
31
41
|
export const document_main: (a: number, b: number) => void;
|
|
32
|
-
export const document_markdownRules: (a: number) => void;
|
|
33
42
|
export const document_moveCard: (a: number, b: number, c: number, d: number) => void;
|
|
34
43
|
export const document_new: (a: number, b: number, c: number) => void;
|
|
35
|
-
export const document_overwrite: (a: number, b: number, c: number, d: number) => void;
|
|
36
44
|
export const document_pathFor: (a: number, b: number, c: number) => void;
|
|
37
45
|
export const document_quillRef: (a: number, b: number) => void;
|
|
38
46
|
export const document_quillRefHint: (a: number) => void;
|
|
47
|
+
export const document_read: (a: number, b: number, c: number) => void;
|
|
48
|
+
export const document_reattach: (a: number, b: number, c: number, d: number) => void;
|
|
39
49
|
export const document_removeCard: (a: number, b: number, c: number) => void;
|
|
40
50
|
export const document_removeExt: (a: number, b: number, c: number) => void;
|
|
41
51
|
export const document_removeField: (a: number, b: number, c: number) => void;
|
|
42
52
|
export const document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
43
|
-
export const
|
|
53
|
+
export const document_replace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
54
|
+
export const document_revise: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
44
55
|
export const document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
45
56
|
export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
46
57
|
export const document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
47
58
|
export const document_storeExt: (a: number, b: number, c: number, d: number) => void;
|
|
48
59
|
export const document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
49
|
-
export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
50
60
|
export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
51
61
|
export const document_toAnnotatedMarkdown: (a: number, b: number) => void;
|
|
52
62
|
export const document_toMarkdown: (a: number, b: number) => void;
|
|
@@ -61,9 +71,12 @@ export const exportMarkdown: (a: number, b: number) => void;
|
|
|
61
71
|
export const formatDiagnostic: (a: number, b: number) => void;
|
|
62
72
|
export const formatDocPath: (a: number, b: number) => void;
|
|
63
73
|
export const importMarkdown: (a: number, b: number, c: number) => void;
|
|
74
|
+
export const indent: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
75
|
+
export const inheritedMarks: (a: number, b: number, c: number) => void;
|
|
76
|
+
export const invert: (a: number, b: number, c: number) => void;
|
|
64
77
|
export const isInline: (a: number, b: number) => void;
|
|
65
78
|
export const isPlain: (a: number, b: number) => void;
|
|
66
|
-
export const
|
|
79
|
+
export const joinBlocks: (a: number, b: number, c: number, d: number) => void;
|
|
67
80
|
export const livesession_coverage: (a: number, b: number) => void;
|
|
68
81
|
export const livesession_fieldAt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
69
82
|
export const livesession_fieldBoxes: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -76,15 +89,17 @@ export const livesession_regions: (a: number, b: number) => void;
|
|
|
76
89
|
export const livesession_render: (a: number, b: number, c: number) => void;
|
|
77
90
|
export const livesession_update: (a: number, b: number, c: number) => void;
|
|
78
91
|
export const livesession_warnings: (a: number, b: number) => void;
|
|
79
|
-
export const mapMarks: (a: number, b: number, c: number) => void;
|
|
80
92
|
export const mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
93
|
+
export const normalize: (a: number, b: number) => void;
|
|
94
|
+
export const outdent: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
81
95
|
export const parseDocPath: (a: number, b: number, c: number) => void;
|
|
82
96
|
export const quill__resolve: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
97
|
+
export const quill_authoringSchema: (a: number, b: number) => void;
|
|
83
98
|
export const quill_backendId: (a: number, b: number) => void;
|
|
84
|
-
export const quill_blueprint: (a: number, b: number) => void;
|
|
85
99
|
export const quill_conform: (a: number, b: number, c: number) => void;
|
|
86
100
|
export const quill_emptyDocument: (a: number) => number;
|
|
87
|
-
export const quill_exampleDocument: (a: number
|
|
101
|
+
export const quill_exampleDocument: (a: number) => number;
|
|
102
|
+
export const quill_fromAuthoring: (a: number, b: number, c: number) => void;
|
|
88
103
|
export const quill_fromBundle: (a: number, b: number, c: number) => void;
|
|
89
104
|
export const quill_fromTree: (a: number, b: number) => void;
|
|
90
105
|
export const quill_metadata: (a: number, b: number) => void;
|
|
@@ -92,13 +107,14 @@ export const quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
|
92
107
|
export const quill_schema: (a: number, b: number) => void;
|
|
93
108
|
export const quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
94
109
|
export const quill_seedDocument: (a: number) => number;
|
|
95
|
-
export const
|
|
110
|
+
export const quill_toAuthoring: (a: number, b: number, c: number) => void;
|
|
96
111
|
export const quill_toBundle: (a: number, b: number) => void;
|
|
97
112
|
export const quill_toTree: (a: number) => number;
|
|
98
113
|
export const quill_validate: (a: number, b: number, c: number) => void;
|
|
99
114
|
export const quill_warnings: (a: number, b: number) => void;
|
|
100
|
-
export const
|
|
115
|
+
export const splitBlock: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
101
116
|
export const start: () => void;
|
|
117
|
+
export const wrap: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
102
118
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
103
119
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
104
120
|
export const __wbindgen_export3: (a: number) => void;
|
package/runtime/runtime.d.ts
CHANGED
|
@@ -18,9 +18,17 @@ import type {
|
|
|
18
18
|
Document as CoreDocument,
|
|
19
19
|
importMarkdown,
|
|
20
20
|
exportMarkdown,
|
|
21
|
-
|
|
21
|
+
normalize,
|
|
22
|
+
invert,
|
|
23
|
+
diff,
|
|
24
|
+
splitBlock,
|
|
25
|
+
joinBlocks,
|
|
26
|
+
deleteRange,
|
|
27
|
+
indent,
|
|
28
|
+
outdent,
|
|
29
|
+
wrap,
|
|
30
|
+
inheritedMarks,
|
|
22
31
|
mapPos,
|
|
23
|
-
mapMarks,
|
|
24
32
|
isInline,
|
|
25
33
|
isPlain,
|
|
26
34
|
parseDocPath,
|
|
@@ -40,9 +48,17 @@ export interface CoreSurface {
|
|
|
40
48
|
Document: typeof CoreDocument;
|
|
41
49
|
importMarkdown: typeof importMarkdown;
|
|
42
50
|
exportMarkdown: typeof exportMarkdown;
|
|
43
|
-
|
|
51
|
+
normalize: typeof normalize;
|
|
52
|
+
invert: typeof invert;
|
|
53
|
+
diff: typeof diff;
|
|
54
|
+
splitBlock: typeof splitBlock;
|
|
55
|
+
joinBlocks: typeof joinBlocks;
|
|
56
|
+
deleteRange: typeof deleteRange;
|
|
57
|
+
indent: typeof indent;
|
|
58
|
+
outdent: typeof outdent;
|
|
59
|
+
wrap: typeof wrap;
|
|
60
|
+
inheritedMarks: typeof inheritedMarks;
|
|
44
61
|
mapPos: typeof mapPos;
|
|
45
|
-
mapMarks: typeof mapMarks;
|
|
46
62
|
isInline: typeof isInline;
|
|
47
63
|
isPlain: typeof isPlain;
|
|
48
64
|
parseDocPath: typeof parseDocPath;
|
|
@@ -113,44 +129,44 @@ export type {
|
|
|
113
129
|
QuillFieldUi,
|
|
114
130
|
QuillCardUi,
|
|
115
131
|
QuillGroupUi,
|
|
116
|
-
QuillMetadata
|
|
132
|
+
QuillMetadata,
|
|
133
|
+
AuthoringDocument,
|
|
134
|
+
AuthoringCard
|
|
117
135
|
} from '../core/wasm.js';
|
|
118
136
|
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
// `
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
// the op — is the version-proof spelling of the op, and naming the type is what
|
|
125
|
-
// makes that spelling type-check without a cast.
|
|
137
|
+
// The content model `Document`'s write primitive and readers speak
|
|
138
|
+
// (`apply(addr, change)`, `revise(addr, md)`, `replace(addr, content)`,
|
|
139
|
+
// `read(addr)`), offsets in UTF-16 code units. `ContentBlockKind` and `ContentMarkKind` are the shared halves of a
|
|
140
|
+
// read value and a step: destructure the kind off the envelope and spread it
|
|
141
|
+
// into the step.
|
|
126
142
|
export type {
|
|
127
143
|
Content,
|
|
128
|
-
|
|
129
|
-
|
|
144
|
+
ContentBlock,
|
|
145
|
+
ContentBlockKind,
|
|
130
146
|
ContentContainer,
|
|
131
147
|
ContentMark,
|
|
132
148
|
ContentMarkKind,
|
|
149
|
+
ContentAnchor,
|
|
133
150
|
ContentIsland,
|
|
134
151
|
TableProps,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
152
|
+
Change,
|
|
153
|
+
Step,
|
|
154
|
+
Receipt,
|
|
155
|
+
DroppedAnchor,
|
|
156
|
+
WriteOptions,
|
|
139
157
|
CardInput,
|
|
140
158
|
PathStep,
|
|
141
159
|
Addr,
|
|
142
160
|
CardAddr,
|
|
143
161
|
Delta,
|
|
144
162
|
Revised,
|
|
163
|
+
BaseOptions,
|
|
145
164
|
DocumentRevised,
|
|
146
165
|
AnnotatedMarkdown,
|
|
147
166
|
DocumentAnchor,
|
|
167
|
+
AnchorContext,
|
|
168
|
+
Reattached,
|
|
148
169
|
Imported,
|
|
149
|
-
Assoc,
|
|
150
|
-
IslandOp,
|
|
151
|
-
LineOp,
|
|
152
|
-
MarkOp,
|
|
153
|
-
ChangeBundle,
|
|
154
170
|
DocPathSeg
|
|
155
171
|
} from '../core/wasm.js';
|
|
156
172
|
|
|
@@ -193,43 +209,11 @@ export interface QuillmarkError extends Error {
|
|
|
193
209
|
*/
|
|
194
210
|
export declare function isQuillmarkError(e: unknown): e is QuillmarkError;
|
|
195
211
|
|
|
196
|
-
import type { ContentContainer } from '../core/wasm.js';
|
|
197
|
-
|
|
198
212
|
// `ContentIsland.type`, `ContentMark.type`, `ContentLine.kind` and
|
|
199
213
|
// `ContentContainer.container` are closed sets, so a bare discriminant check
|
|
200
214
|
// narrows the payload on its own:
|
|
201
215
|
// `line.kind === 'heading'` reaches `line.attrs.level`, with no guard to call.
|
|
202
216
|
|
|
203
|
-
/**
|
|
204
|
-
* Stamp `instance` across one parent's blocks at one depth, in document order,
|
|
205
|
-
* returning containers ready to write.
|
|
206
|
-
*
|
|
207
|
-
* One entry per container RUN — a list, not a list item — and `null` for a
|
|
208
|
-
* block carrying no container at this depth. A bare paragraph between two lists
|
|
209
|
-
* is such a block, and separates them on its own. Every line of a run then
|
|
210
|
-
* carries that run's returned container, `ordinal` varying per item and
|
|
211
|
-
* `instance` held.
|
|
212
|
-
*
|
|
213
|
-
* The `instance` it stamps is canonical, so a document reads back the value it
|
|
214
|
-
* was written — a `0` as an absent key, which decodes to the same value.
|
|
215
|
-
* `ordinal` stays the caller's, and a write is renumbered to a gapless index
|
|
216
|
-
* within its run.
|
|
217
|
-
*
|
|
218
|
-
* Which fields decide a weld is coarser than equality for a list: CommonMark
|
|
219
|
-
* reads only a list's first number, so `1. a` beside `3. b` welds despite the
|
|
220
|
-
* differing `start`.
|
|
221
|
-
*
|
|
222
|
-
* ```js
|
|
223
|
-
* const [outer, , inner] = assignInstances([listA, null, listB]);
|
|
224
|
-
* // outer.instance === 0, inner.instance === 0 — the paragraph parts them
|
|
225
|
-
* const [a, b] = assignInstances([listA, listB]);
|
|
226
|
-
* // a.instance === 0, b.instance === 1 — adjacent, one shape
|
|
227
|
-
* ```
|
|
228
|
-
*/
|
|
229
|
-
export declare function assignInstances(
|
|
230
|
-
runs: (ContentContainer | null)[]
|
|
231
|
-
): (ContentContainer | null)[];
|
|
232
|
-
|
|
233
217
|
// The backend-neutral render contract, defined here rather than re-exported from
|
|
234
218
|
// one private backend because no single backend owns the canonical API's types.
|
|
235
219
|
// The render build must satisfy these shapes; `runtime.types.test-d.ts` keeps
|
|
@@ -287,7 +271,7 @@ export interface RenderOptions {
|
|
|
287
271
|
*/
|
|
288
272
|
export type HitGranularity = 'cluster' | 'segment';
|
|
289
273
|
|
|
290
|
-
/** A click resolved to a field and
|
|
274
|
+
/** A click resolved to a field and a UTF-16 offset into its Content. */
|
|
291
275
|
export interface ContentHit {
|
|
292
276
|
/**
|
|
293
277
|
* The field's canonical `DocPath` address (`parseDocPath`-routable): the same
|
|
@@ -340,7 +324,7 @@ export interface FieldRegion {
|
|
|
340
324
|
/** `[x0, y0, x1, y1]` in PDF points (1/72″), bottom-left origin. */
|
|
341
325
|
rect: [number, number, number, number];
|
|
342
326
|
/**
|
|
343
|
-
* The content slice this box covers:
|
|
327
|
+
* The content slice this box covers: UTF-16 `[start, end)` into the field's
|
|
344
328
|
* `Content` for content ink (one segment), absent for a scalar's or a
|
|
345
329
|
* date's ink, a claim or a widget. Consumers key segment highlights on it;
|
|
346
330
|
* {@link LiveSession.fieldBoxes} unions same-page segments for the
|
|
@@ -410,7 +394,7 @@ export interface BackendDescriptor {
|
|
|
410
394
|
formats: OutputFormat[];
|
|
411
395
|
}
|
|
412
396
|
|
|
413
|
-
/** Options for `new Engine(...)`, as a plain object. A key other than `backends` throws. */
|
|
397
|
+
/** Options for `new Engine(...)`, as a plain object. A key other than `backends` or `fonts` throws. */
|
|
414
398
|
export interface EngineOptions {
|
|
415
399
|
/**
|
|
416
400
|
* Extra or overriding backend descriptors, merged over the built-ins. Keys are
|
|
@@ -544,7 +528,6 @@ export declare class Engine {
|
|
|
544
528
|
export declare class LiveSession {
|
|
545
529
|
private constructor();
|
|
546
530
|
readonly pageCount: number;
|
|
547
|
-
readonly backendId: string;
|
|
548
531
|
readonly warnings: Diagnostic[];
|
|
549
532
|
/**
|
|
550
533
|
* Recompile the session against `doc`: the edit verb of a live preview.
|
|
@@ -613,7 +596,8 @@ export declare class LiveSession {
|
|
|
613
596
|
positionAt(page: number, x: number, y: number, tolPt?: number): ContentHit | undefined;
|
|
614
597
|
/**
|
|
615
598
|
* Content position → caret rect: reverse of {@link positionAt}. `field` is a
|
|
616
|
-
* canonical `DocPath` address (`parseDocPath`-routable), as {@link regions} keys
|
|
599
|
+
* canonical `DocPath` address (`parseDocPath`-routable), as {@link regions} keys;
|
|
600
|
+
* `pos` a UTF-16 offset into its `Content`, `undefined` inside a character.
|
|
617
601
|
*/
|
|
618
602
|
locate(field: string, pos: number): FieldRegion | undefined;
|
|
619
603
|
/** Page geometry in points (1/72″). */
|
|
@@ -669,7 +653,7 @@ declare module '../core/wasm.js' {
|
|
|
669
653
|
}
|
|
670
654
|
}
|
|
671
655
|
|
|
672
|
-
import type { Addr, Content, DocumentRevised, PathStep, Resolved, Revised } from '../core/wasm.js';
|
|
656
|
+
import type { Addr, BaseOptions, Content, DocumentRevised, PathStep, Resolved, Revised } from '../core/wasm.js';
|
|
673
657
|
|
|
674
658
|
/**
|
|
675
659
|
* A `Document` bound to its `Quill` for typed writes, from {@link Quill.writer}.
|
|
@@ -679,14 +663,28 @@ import type { Addr, Content, DocumentRevised, PathStep, Resolved, Revised } from
|
|
|
679
663
|
*
|
|
680
664
|
* Typed commit is the default whenever a quill is in hand: it resolves each
|
|
681
665
|
* field's schema type and strict-commits it, throwing `UnknownField` for an
|
|
682
|
-
* undeclared name rather than falling back. The raw `Document.storeField`
|
|
683
|
-
*
|
|
666
|
+
* undeclared name rather than falling back. The raw `Document.storeField`
|
|
667
|
+
* verb remains the deliberate quill-free primitive (standalone
|
|
684
668
|
* data, storage/migration infra, or not-yet-conforming in-progress input).
|
|
685
669
|
*/
|
|
686
670
|
export declare class DocumentWriter {
|
|
687
671
|
constructor(quill: Quill, doc: Document);
|
|
688
|
-
/**
|
|
689
|
-
|
|
672
|
+
/**
|
|
673
|
+
* The hash of the document as this quill conforms it: the `baseHash`
|
|
674
|
+
* {@link reviseDocument} checks. A document loaded without its quill
|
|
675
|
+
* hashes as its conformed self, so a conform between the read and the
|
|
676
|
+
* write does not stale the base. Throws when the document declares a
|
|
677
|
+
* `$quill` this quill does not answer to.
|
|
678
|
+
*/
|
|
679
|
+
hash(): string;
|
|
680
|
+
/**
|
|
681
|
+
* The hash of the body or field at `addr` through its schema: the
|
|
682
|
+
* `baseHash` {@link reviseBody} and {@link reviseField} check. A
|
|
683
|
+
* `richtext` field hashes its content however it rests, a `text` field its
|
|
684
|
+
* literal text, any other type its stored value, an absent field as
|
|
685
|
+
* `null`. Throws `UnknownField` for an undeclared name.
|
|
686
|
+
*/
|
|
687
|
+
hashAt(addr: Addr | string): string;
|
|
690
688
|
/**
|
|
691
689
|
* Typed-commit one main-card field (strict coerce, mismatch throws now).
|
|
692
690
|
* Throws `UnknownField` for a name the schema does not declare. Returns a
|
|
@@ -703,11 +701,13 @@ export declare class DocumentWriter {
|
|
|
703
701
|
setAll(fields: Record<string, unknown>): Diagnostic[];
|
|
704
702
|
/**
|
|
705
703
|
* Revise the main body from markdown; anchors rebase. Returns the
|
|
706
|
-
* `Revised` receipt, its warnings at `main.body
|
|
707
|
-
*
|
|
708
|
-
*
|
|
704
|
+
* `Revised` receipt, its warnings at `main.body` and `droppedAnchors`
|
|
705
|
+
* naming each anchor the diff dropped: a body carries no field schema to
|
|
706
|
+
* type against. `opts` names what the writer read: a stale
|
|
707
|
+
* `baseHash` (from {@link hashAt}) throws `edit::stale_base`, and a
|
|
708
|
+
* `baseMarkdown` merges.
|
|
709
709
|
*/
|
|
710
|
-
reviseBody(markdown: string): Revised;
|
|
710
|
+
reviseBody(markdown: string, opts?: BaseOptions): Revised;
|
|
711
711
|
/**
|
|
712
712
|
* Revise the content main-card field `name` from authored text: typed *and*
|
|
713
713
|
* anchor-preserving. Surviving anchors rebase, then the diffed result is
|
|
@@ -718,19 +718,28 @@ export declare class DocumentWriter {
|
|
|
718
718
|
* The codec comes from the declared type: `richtext` diffs markdown, while
|
|
719
719
|
* `text` diffs the literal text and never imports markdown, so a
|
|
720
720
|
* byte-identical revise of a value carrying escapes is a byte no-op.
|
|
721
|
+
*
|
|
722
|
+
* `opts` names what the writer read, as on {@link reviseBody}; a `text`
|
|
723
|
+
* field's `baseMarkdown` is the literal text it read.
|
|
721
724
|
*/
|
|
722
|
-
reviseField(name: string, text: string): Revised;
|
|
725
|
+
reviseField(name: string, text: string, opts?: BaseOptions): Revised;
|
|
723
726
|
/**
|
|
724
727
|
* Replace the bound document with `markdown`, then conform it. Composable
|
|
725
728
|
* cards align to the stored ones by `$kind` and text similarity, an aligned
|
|
726
729
|
* card's body and stored content fields revise, their anchors rebasing as
|
|
727
730
|
* {@link reviseBody}'s do, and every declared content field lands at rest.
|
|
728
|
-
* Returns the `DocumentRevised` receipt, its `
|
|
731
|
+
* Returns the `DocumentRevised` receipt, its `from` naming the stored card
|
|
732
|
+
* each composable card revises and its `warnings` ending with the
|
|
729
733
|
* `conform::*` ones, and clears `doc.warnings`. Throws when `markdown`
|
|
730
734
|
* declares a `$quill` this quill does not answer to, or does not parse,
|
|
731
735
|
* leaving the document unchanged.
|
|
736
|
+
*
|
|
737
|
+
* `opts` names what the writer read: `baseHash` is {@link hash}, and
|
|
738
|
+
* `baseMarkdown` the whole document's markdown (`toMarkdown` or
|
|
739
|
+
* `toAnnotatedMarkdown`), merged by line onto what changed since. A stale
|
|
740
|
+
* or conflicting write throws before any mutation.
|
|
732
741
|
*/
|
|
733
|
-
reviseDocument(markdown: string): DocumentRevised;
|
|
742
|
+
reviseDocument(markdown: string, opts?: BaseOptions): DocumentRevised;
|
|
734
743
|
/**
|
|
735
744
|
* Build a composable card of `kind`, typed-commit `fields` onto it, set its
|
|
736
745
|
* body from optional markdown, and place it. `at` omitted appends, a number
|
|
@@ -760,25 +769,20 @@ export declare class DocumentWriter {
|
|
|
760
769
|
*/
|
|
761
770
|
export declare class CardWriter {
|
|
762
771
|
constructor(quill: Quill, doc: Document, index: number);
|
|
763
|
-
/** The
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* The bound card's `$kind`. Throws `IndexOutOfRange` for a bad bound
|
|
767
|
-
* index.
|
|
768
|
-
*/
|
|
769
|
-
readonly kind: string;
|
|
772
|
+
/** The card twin of {@link DocumentWriter.hashAt}; no `field` reads the body. */
|
|
773
|
+
hashAt(field?: string): string;
|
|
770
774
|
set(name: string, value: unknown): Diagnostic[];
|
|
771
775
|
setAll(fields: Record<string, unknown>): Diagnostic[];
|
|
772
776
|
/**
|
|
773
777
|
* Revise this card's body from markdown (edit semantics), returning the
|
|
774
778
|
* `Revised` receipt, its warnings at the card's body.
|
|
775
779
|
*/
|
|
776
|
-
reviseBody(markdown: string): Revised;
|
|
780
|
+
reviseBody(markdown: string, opts?: BaseOptions): Revised;
|
|
777
781
|
/**
|
|
778
782
|
* The card twin of {@link DocumentWriter.reviseField}. Throws `UnknownField`
|
|
779
783
|
* for an undeclared name and `IndexOutOfRange` for a bad bound index.
|
|
780
784
|
*/
|
|
781
|
-
reviseField(name: string, text: string): Revised;
|
|
785
|
+
reviseField(name: string, text: string, opts?: BaseOptions): Revised;
|
|
782
786
|
}
|
|
783
787
|
|
|
784
788
|
/**
|
|
@@ -801,8 +805,6 @@ export declare class CardWriter {
|
|
|
801
805
|
*/
|
|
802
806
|
export declare class DocumentReader {
|
|
803
807
|
constructor(quill: Quill, doc: Document);
|
|
804
|
-
/** The bound document: the instance passed in. */
|
|
805
|
-
readonly document: Document;
|
|
806
808
|
/**
|
|
807
809
|
* Read the value at `addr`, interpreted by its declared type: a richtext field
|
|
808
810
|
* to markdown, every other type verbatim. A bare string is `Addr` shorthand for
|
|
@@ -853,42 +855,4 @@ export declare class DocumentReader {
|
|
|
853
855
|
* pairing it with a session passes the session's opening date.
|
|
854
856
|
*/
|
|
855
857
|
resolve(today?: string): Resolved;
|
|
856
|
-
/**
|
|
857
|
-
* A {@link CardReader} for the composable card at `index`. Index validity is
|
|
858
|
-
* checked lazily at read time, so an out-of-range index does not throw here.
|
|
859
|
-
* The cursor is ephemeral: a `removeCard`/`addCard` between binding and reading
|
|
860
|
-
* silently retargets it.
|
|
861
|
-
*/
|
|
862
|
-
card(index: number): CardReader;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
* A composable card bound to its `Quill` for interpreted reads, from
|
|
867
|
-
* {@link DocumentReader.card}. Same verbs as {@link DocumentReader}, reading the card
|
|
868
|
-
* at its bound index; each read throws `IndexOutOfRange` if that index is out of
|
|
869
|
-
* range.
|
|
870
|
-
*/
|
|
871
|
-
export declare class CardReader {
|
|
872
|
-
constructor(quill: Quill, doc: Document, index: number);
|
|
873
|
-
/** The bound card index. */
|
|
874
|
-
readonly index: number;
|
|
875
|
-
/**
|
|
876
|
-
* The bound card's `$kind`. Throws `IndexOutOfRange` if the bound index is
|
|
877
|
-
* out of range.
|
|
878
|
-
*/
|
|
879
|
-
readonly kind: string;
|
|
880
|
-
/**
|
|
881
|
-
* Read the field `name` on this card, interpreted by its declared type.
|
|
882
|
-
* `undefined` when absent; throws `UnknownField` for an undeclared name and
|
|
883
|
-
* `IndexOutOfRange` for a bad index.
|
|
884
|
-
*/
|
|
885
|
-
get(name: string): unknown;
|
|
886
|
-
/**
|
|
887
|
-
* The card twin of {@link DocumentReader.getContent}.
|
|
888
|
-
*/
|
|
889
|
-
getContent(name: string): Content | undefined;
|
|
890
|
-
/** The card twin of {@link DocumentReader.getContentAt}. */
|
|
891
|
-
getContentAt(name: string, path: PathStep[]): Content | undefined;
|
|
892
|
-
/** This card's body markdown: the card twin of {@link DocumentReader.bodyMarkdown}. */
|
|
893
|
-
bodyMarkdown(): string;
|
|
894
858
|
}
|