@quillmark/wasm 0.133.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 +344 -0
- package/README.md +19 -76
- package/THIRD_PARTY_LICENSES.md +443 -103
- package/core/wasm.d.ts +467 -390
- package/core/wasm.js +612 -226
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +25 -12
- package/package.json +1 -1
- package/render/wasm.d.ts +480 -406
- package/render/wasm.js +620 -252
- package/render/wasm_bg.wasm +0 -0
- package/render/wasm_bg.wasm.d.ts +25 -13
- package/runtime/runtime.d.ts +80 -120
- package/runtime/runtime.js +52 -136
- package/sbom.cdx.json +337 -542
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,28 +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
|
|
44
|
-
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;
|
|
45
55
|
export const document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
46
56
|
export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
47
57
|
export const document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
48
58
|
export const document_storeExt: (a: number, b: number, c: number, d: number) => void;
|
|
49
59
|
export const document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
50
|
-
export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
51
60
|
export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
52
61
|
export const document_toAnnotatedMarkdown: (a: number, b: number) => void;
|
|
53
62
|
export const document_toMarkdown: (a: number, b: number) => void;
|
|
@@ -62,9 +71,12 @@ export const exportMarkdown: (a: number, b: number) => void;
|
|
|
62
71
|
export const formatDiagnostic: (a: number, b: number) => void;
|
|
63
72
|
export const formatDocPath: (a: number, b: number) => void;
|
|
64
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;
|
|
65
77
|
export const isInline: (a: number, b: number) => void;
|
|
66
78
|
export const isPlain: (a: number, b: number) => void;
|
|
67
|
-
export const
|
|
79
|
+
export const joinBlocks: (a: number, b: number, c: number, d: number) => void;
|
|
68
80
|
export const livesession_coverage: (a: number, b: number) => void;
|
|
69
81
|
export const livesession_fieldAt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
70
82
|
export const livesession_fieldBoxes: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -77,9 +89,9 @@ export const livesession_regions: (a: number, b: number) => void;
|
|
|
77
89
|
export const livesession_render: (a: number, b: number, c: number) => void;
|
|
78
90
|
export const livesession_update: (a: number, b: number, c: number) => void;
|
|
79
91
|
export const livesession_warnings: (a: number, b: number) => void;
|
|
80
|
-
export const mapMarks: (a: number, b: number, c: number) => void;
|
|
81
92
|
export const mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
82
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;
|
|
83
95
|
export const parseDocPath: (a: number, b: number, c: number) => void;
|
|
84
96
|
export const quill__resolve: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
85
97
|
export const quill_authoringSchema: (a: number, b: number) => void;
|
|
@@ -95,14 +107,14 @@ export const quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
|
95
107
|
export const quill_schema: (a: number, b: number) => void;
|
|
96
108
|
export const quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
97
109
|
export const quill_seedDocument: (a: number) => number;
|
|
98
|
-
export const quill_seedMain: (a: number, b: number) => void;
|
|
99
110
|
export const quill_toAuthoring: (a: number, b: number, c: number) => void;
|
|
100
111
|
export const quill_toBundle: (a: number, b: number) => void;
|
|
101
112
|
export const quill_toTree: (a: number) => number;
|
|
102
113
|
export const quill_validate: (a: number, b: number, c: number) => void;
|
|
103
114
|
export const quill_warnings: (a: number, b: number) => void;
|
|
104
|
-
export const
|
|
115
|
+
export const splitBlock: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
105
116
|
export const start: () => void;
|
|
117
|
+
export const wrap: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
106
118
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
107
119
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
108
120
|
export const __wbindgen_export3: (a: number) => void;
|
package/runtime/runtime.d.ts
CHANGED
|
@@ -19,9 +19,16 @@ import type {
|
|
|
19
19
|
importMarkdown,
|
|
20
20
|
exportMarkdown,
|
|
21
21
|
normalize,
|
|
22
|
-
|
|
22
|
+
invert,
|
|
23
|
+
diff,
|
|
24
|
+
splitBlock,
|
|
25
|
+
joinBlocks,
|
|
26
|
+
deleteRange,
|
|
27
|
+
indent,
|
|
28
|
+
outdent,
|
|
29
|
+
wrap,
|
|
30
|
+
inheritedMarks,
|
|
23
31
|
mapPos,
|
|
24
|
-
mapMarks,
|
|
25
32
|
isInline,
|
|
26
33
|
isPlain,
|
|
27
34
|
parseDocPath,
|
|
@@ -42,9 +49,16 @@ export interface CoreSurface {
|
|
|
42
49
|
importMarkdown: typeof importMarkdown;
|
|
43
50
|
exportMarkdown: typeof exportMarkdown;
|
|
44
51
|
normalize: typeof normalize;
|
|
45
|
-
|
|
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;
|
|
46
61
|
mapPos: typeof mapPos;
|
|
47
|
-
mapMarks: typeof mapMarks;
|
|
48
62
|
isInline: typeof isInline;
|
|
49
63
|
isPlain: typeof isPlain;
|
|
50
64
|
parseDocPath: typeof parseDocPath;
|
|
@@ -120,41 +134,39 @@ export type {
|
|
|
120
134
|
AuthoringCard
|
|
121
135
|
} from '../core/wasm.js';
|
|
122
136
|
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
// `
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
// the op — is the version-proof spelling of the op, and naming the type is what
|
|
129
|
-
// 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.
|
|
130
142
|
export type {
|
|
131
143
|
Content,
|
|
132
|
-
|
|
133
|
-
|
|
144
|
+
ContentBlock,
|
|
145
|
+
ContentBlockKind,
|
|
134
146
|
ContentContainer,
|
|
135
147
|
ContentMark,
|
|
136
148
|
ContentMarkKind,
|
|
149
|
+
ContentAnchor,
|
|
137
150
|
ContentIsland,
|
|
138
151
|
TableProps,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
152
|
+
Change,
|
|
153
|
+
Step,
|
|
154
|
+
Receipt,
|
|
155
|
+
DroppedAnchor,
|
|
156
|
+
WriteOptions,
|
|
143
157
|
CardInput,
|
|
144
158
|
PathStep,
|
|
145
159
|
Addr,
|
|
146
160
|
CardAddr,
|
|
147
161
|
Delta,
|
|
148
162
|
Revised,
|
|
163
|
+
BaseOptions,
|
|
149
164
|
DocumentRevised,
|
|
150
165
|
AnnotatedMarkdown,
|
|
151
166
|
DocumentAnchor,
|
|
167
|
+
AnchorContext,
|
|
168
|
+
Reattached,
|
|
152
169
|
Imported,
|
|
153
|
-
Assoc,
|
|
154
|
-
IslandOp,
|
|
155
|
-
LineOp,
|
|
156
|
-
MarkOp,
|
|
157
|
-
ChangeBundle,
|
|
158
170
|
DocPathSeg
|
|
159
171
|
} from '../core/wasm.js';
|
|
160
172
|
|
|
@@ -197,43 +209,11 @@ export interface QuillmarkError extends Error {
|
|
|
197
209
|
*/
|
|
198
210
|
export declare function isQuillmarkError(e: unknown): e is QuillmarkError;
|
|
199
211
|
|
|
200
|
-
import type { ContentContainer } from '../core/wasm.js';
|
|
201
|
-
|
|
202
212
|
// `ContentIsland.type`, `ContentMark.type`, `ContentLine.kind` and
|
|
203
213
|
// `ContentContainer.container` are closed sets, so a bare discriminant check
|
|
204
214
|
// narrows the payload on its own:
|
|
205
215
|
// `line.kind === 'heading'` reaches `line.attrs.level`, with no guard to call.
|
|
206
216
|
|
|
207
|
-
/**
|
|
208
|
-
* Stamp `instance` across one parent's blocks at one depth, in document order,
|
|
209
|
-
* returning containers ready to write.
|
|
210
|
-
*
|
|
211
|
-
* One entry per container RUN — a list, not a list item — and `null` for a
|
|
212
|
-
* block carrying no container at this depth. A bare paragraph between two lists
|
|
213
|
-
* is such a block, and separates them on its own. Every line of a run then
|
|
214
|
-
* carries that run's returned container, `ordinal` varying per item and
|
|
215
|
-
* `instance` held.
|
|
216
|
-
*
|
|
217
|
-
* The `instance` it stamps is canonical, so a document reads back the value it
|
|
218
|
-
* was written — a `0` as an absent key, which decodes to the same value.
|
|
219
|
-
* `ordinal` stays the caller's, and a write is renumbered to a gapless index
|
|
220
|
-
* within its run.
|
|
221
|
-
*
|
|
222
|
-
* Which fields decide a weld is coarser than equality for a list: CommonMark
|
|
223
|
-
* reads only a list's first number, so `1. a` beside `3. b` welds despite the
|
|
224
|
-
* differing `start`.
|
|
225
|
-
*
|
|
226
|
-
* ```js
|
|
227
|
-
* const [outer, , inner] = assignInstances([listA, null, listB]);
|
|
228
|
-
* // outer.instance === 0, inner.instance === 0 — the paragraph parts them
|
|
229
|
-
* const [a, b] = assignInstances([listA, listB]);
|
|
230
|
-
* // a.instance === 0, b.instance === 1 — adjacent, one shape
|
|
231
|
-
* ```
|
|
232
|
-
*/
|
|
233
|
-
export declare function assignInstances(
|
|
234
|
-
runs: (ContentContainer | null)[]
|
|
235
|
-
): (ContentContainer | null)[];
|
|
236
|
-
|
|
237
217
|
// The backend-neutral render contract, defined here rather than re-exported from
|
|
238
218
|
// one private backend because no single backend owns the canonical API's types.
|
|
239
219
|
// The render build must satisfy these shapes; `runtime.types.test-d.ts` keeps
|
|
@@ -291,7 +271,7 @@ export interface RenderOptions {
|
|
|
291
271
|
*/
|
|
292
272
|
export type HitGranularity = 'cluster' | 'segment';
|
|
293
273
|
|
|
294
|
-
/** A click resolved to a field and
|
|
274
|
+
/** A click resolved to a field and a UTF-16 offset into its Content. */
|
|
295
275
|
export interface ContentHit {
|
|
296
276
|
/**
|
|
297
277
|
* The field's canonical `DocPath` address (`parseDocPath`-routable): the same
|
|
@@ -344,7 +324,7 @@ export interface FieldRegion {
|
|
|
344
324
|
/** `[x0, y0, x1, y1]` in PDF points (1/72″), bottom-left origin. */
|
|
345
325
|
rect: [number, number, number, number];
|
|
346
326
|
/**
|
|
347
|
-
* The content slice this box covers:
|
|
327
|
+
* The content slice this box covers: UTF-16 `[start, end)` into the field's
|
|
348
328
|
* `Content` for content ink (one segment), absent for a scalar's or a
|
|
349
329
|
* date's ink, a claim or a widget. Consumers key segment highlights on it;
|
|
350
330
|
* {@link LiveSession.fieldBoxes} unions same-page segments for the
|
|
@@ -414,7 +394,7 @@ export interface BackendDescriptor {
|
|
|
414
394
|
formats: OutputFormat[];
|
|
415
395
|
}
|
|
416
396
|
|
|
417
|
-
/** 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. */
|
|
418
398
|
export interface EngineOptions {
|
|
419
399
|
/**
|
|
420
400
|
* Extra or overriding backend descriptors, merged over the built-ins. Keys are
|
|
@@ -548,7 +528,6 @@ export declare class Engine {
|
|
|
548
528
|
export declare class LiveSession {
|
|
549
529
|
private constructor();
|
|
550
530
|
readonly pageCount: number;
|
|
551
|
-
readonly backendId: string;
|
|
552
531
|
readonly warnings: Diagnostic[];
|
|
553
532
|
/**
|
|
554
533
|
* Recompile the session against `doc`: the edit verb of a live preview.
|
|
@@ -617,7 +596,8 @@ export declare class LiveSession {
|
|
|
617
596
|
positionAt(page: number, x: number, y: number, tolPt?: number): ContentHit | undefined;
|
|
618
597
|
/**
|
|
619
598
|
* Content position → caret rect: reverse of {@link positionAt}. `field` is a
|
|
620
|
-
* 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.
|
|
621
601
|
*/
|
|
622
602
|
locate(field: string, pos: number): FieldRegion | undefined;
|
|
623
603
|
/** Page geometry in points (1/72″). */
|
|
@@ -673,7 +653,7 @@ declare module '../core/wasm.js' {
|
|
|
673
653
|
}
|
|
674
654
|
}
|
|
675
655
|
|
|
676
|
-
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';
|
|
677
657
|
|
|
678
658
|
/**
|
|
679
659
|
* A `Document` bound to its `Quill` for typed writes, from {@link Quill.writer}.
|
|
@@ -683,14 +663,28 @@ import type { Addr, Content, DocumentRevised, PathStep, Resolved, Revised } from
|
|
|
683
663
|
*
|
|
684
664
|
* Typed commit is the default whenever a quill is in hand: it resolves each
|
|
685
665
|
* field's schema type and strict-commits it, throwing `UnknownField` for an
|
|
686
|
-
* undeclared name rather than falling back. The raw `Document.storeField`
|
|
687
|
-
*
|
|
666
|
+
* undeclared name rather than falling back. The raw `Document.storeField`
|
|
667
|
+
* verb remains the deliberate quill-free primitive (standalone
|
|
688
668
|
* data, storage/migration infra, or not-yet-conforming in-progress input).
|
|
689
669
|
*/
|
|
690
670
|
export declare class DocumentWriter {
|
|
691
671
|
constructor(quill: Quill, doc: Document);
|
|
692
|
-
/**
|
|
693
|
-
|
|
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;
|
|
694
688
|
/**
|
|
695
689
|
* Typed-commit one main-card field (strict coerce, mismatch throws now).
|
|
696
690
|
* Throws `UnknownField` for a name the schema does not declare. Returns a
|
|
@@ -707,11 +701,13 @@ export declare class DocumentWriter {
|
|
|
707
701
|
setAll(fields: Record<string, unknown>): Diagnostic[];
|
|
708
702
|
/**
|
|
709
703
|
* Revise the main body from markdown; anchors rebase. Returns the
|
|
710
|
-
* `Revised` receipt, its warnings at `main.body
|
|
711
|
-
*
|
|
712
|
-
*
|
|
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.
|
|
713
709
|
*/
|
|
714
|
-
reviseBody(markdown: string): Revised;
|
|
710
|
+
reviseBody(markdown: string, opts?: BaseOptions): Revised;
|
|
715
711
|
/**
|
|
716
712
|
* Revise the content main-card field `name` from authored text: typed *and*
|
|
717
713
|
* anchor-preserving. Surviving anchors rebase, then the diffed result is
|
|
@@ -722,19 +718,28 @@ export declare class DocumentWriter {
|
|
|
722
718
|
* The codec comes from the declared type: `richtext` diffs markdown, while
|
|
723
719
|
* `text` diffs the literal text and never imports markdown, so a
|
|
724
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.
|
|
725
724
|
*/
|
|
726
|
-
reviseField(name: string, text: string): Revised;
|
|
725
|
+
reviseField(name: string, text: string, opts?: BaseOptions): Revised;
|
|
727
726
|
/**
|
|
728
727
|
* Replace the bound document with `markdown`, then conform it. Composable
|
|
729
728
|
* cards align to the stored ones by `$kind` and text similarity, an aligned
|
|
730
729
|
* card's body and stored content fields revise, their anchors rebasing as
|
|
731
730
|
* {@link reviseBody}'s do, and every declared content field lands at rest.
|
|
732
|
-
* 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
|
|
733
733
|
* `conform::*` ones, and clears `doc.warnings`. Throws when `markdown`
|
|
734
734
|
* declares a `$quill` this quill does not answer to, or does not parse,
|
|
735
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.
|
|
736
741
|
*/
|
|
737
|
-
reviseDocument(markdown: string): DocumentRevised;
|
|
742
|
+
reviseDocument(markdown: string, opts?: BaseOptions): DocumentRevised;
|
|
738
743
|
/**
|
|
739
744
|
* Build a composable card of `kind`, typed-commit `fields` onto it, set its
|
|
740
745
|
* body from optional markdown, and place it. `at` omitted appends, a number
|
|
@@ -764,25 +769,20 @@ export declare class DocumentWriter {
|
|
|
764
769
|
*/
|
|
765
770
|
export declare class CardWriter {
|
|
766
771
|
constructor(quill: Quill, doc: Document, index: number);
|
|
767
|
-
/** The
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
* The bound card's `$kind`. Throws `IndexOutOfRange` for a bad bound
|
|
771
|
-
* index.
|
|
772
|
-
*/
|
|
773
|
-
readonly kind: string;
|
|
772
|
+
/** The card twin of {@link DocumentWriter.hashAt}; no `field` reads the body. */
|
|
773
|
+
hashAt(field?: string): string;
|
|
774
774
|
set(name: string, value: unknown): Diagnostic[];
|
|
775
775
|
setAll(fields: Record<string, unknown>): Diagnostic[];
|
|
776
776
|
/**
|
|
777
777
|
* Revise this card's body from markdown (edit semantics), returning the
|
|
778
778
|
* `Revised` receipt, its warnings at the card's body.
|
|
779
779
|
*/
|
|
780
|
-
reviseBody(markdown: string): Revised;
|
|
780
|
+
reviseBody(markdown: string, opts?: BaseOptions): Revised;
|
|
781
781
|
/**
|
|
782
782
|
* The card twin of {@link DocumentWriter.reviseField}. Throws `UnknownField`
|
|
783
783
|
* for an undeclared name and `IndexOutOfRange` for a bad bound index.
|
|
784
784
|
*/
|
|
785
|
-
reviseField(name: string, text: string): Revised;
|
|
785
|
+
reviseField(name: string, text: string, opts?: BaseOptions): Revised;
|
|
786
786
|
}
|
|
787
787
|
|
|
788
788
|
/**
|
|
@@ -805,8 +805,6 @@ export declare class CardWriter {
|
|
|
805
805
|
*/
|
|
806
806
|
export declare class DocumentReader {
|
|
807
807
|
constructor(quill: Quill, doc: Document);
|
|
808
|
-
/** The bound document: the instance passed in. */
|
|
809
|
-
readonly document: Document;
|
|
810
808
|
/**
|
|
811
809
|
* Read the value at `addr`, interpreted by its declared type: a richtext field
|
|
812
810
|
* to markdown, every other type verbatim. A bare string is `Addr` shorthand for
|
|
@@ -857,42 +855,4 @@ export declare class DocumentReader {
|
|
|
857
855
|
* pairing it with a session passes the session's opening date.
|
|
858
856
|
*/
|
|
859
857
|
resolve(today?: string): Resolved;
|
|
860
|
-
/**
|
|
861
|
-
* A {@link CardReader} for the composable card at `index`. Index validity is
|
|
862
|
-
* checked lazily at read time, so an out-of-range index does not throw here.
|
|
863
|
-
* The cursor is ephemeral: a `removeCard`/`addCard` between binding and reading
|
|
864
|
-
* silently retargets it.
|
|
865
|
-
*/
|
|
866
|
-
card(index: number): CardReader;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
/**
|
|
870
|
-
* A composable card bound to its `Quill` for interpreted reads, from
|
|
871
|
-
* {@link DocumentReader.card}. Same verbs as {@link DocumentReader}, reading the card
|
|
872
|
-
* at its bound index; each read throws `IndexOutOfRange` if that index is out of
|
|
873
|
-
* range.
|
|
874
|
-
*/
|
|
875
|
-
export declare class CardReader {
|
|
876
|
-
constructor(quill: Quill, doc: Document, index: number);
|
|
877
|
-
/** The bound card index. */
|
|
878
|
-
readonly index: number;
|
|
879
|
-
/**
|
|
880
|
-
* The bound card's `$kind`. Throws `IndexOutOfRange` if the bound index is
|
|
881
|
-
* out of range.
|
|
882
|
-
*/
|
|
883
|
-
readonly kind: string;
|
|
884
|
-
/**
|
|
885
|
-
* Read the field `name` on this card, interpreted by its declared type.
|
|
886
|
-
* `undefined` when absent; throws `UnknownField` for an undeclared name and
|
|
887
|
-
* `IndexOutOfRange` for a bad index.
|
|
888
|
-
*/
|
|
889
|
-
get(name: string): unknown;
|
|
890
|
-
/**
|
|
891
|
-
* The card twin of {@link DocumentReader.getContent}.
|
|
892
|
-
*/
|
|
893
|
-
getContent(name: string): Content | undefined;
|
|
894
|
-
/** The card twin of {@link DocumentReader.getContentAt}. */
|
|
895
|
-
getContentAt(name: string, path: PathStep[]): Content | undefined;
|
|
896
|
-
/** This card's body markdown: the card twin of {@link DocumentReader.bodyMarkdown}. */
|
|
897
|
-
bodyMarkdown(): string;
|
|
898
858
|
}
|