@quillmark/wasm 0.98.0 → 0.100.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 +208 -1
- package/LICENSE +13 -0
- package/README.md +116 -64
- package/backends/pdfform/wasm.d.ts +336 -146
- package/backends/pdfform/wasm_bg.js +223 -122
- package/backends/pdfform/wasm_bg.wasm +0 -0
- package/backends/pdfform/wasm_bg.wasm.d.ts +3 -1
- package/backends/typst/wasm.d.ts +336 -146
- package/backends/typst/wasm_bg.js +223 -122
- package/backends/typst/wasm_bg.wasm +0 -0
- package/backends/typst/wasm_bg.wasm.d.ts +3 -1
- package/core/wasm.d.ts +163 -96
- package/core/wasm_bg.js +206 -102
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +3 -1
- package/package.json +2 -2
- package/runtime/runtime.d.ts +151 -76
- package/runtime/runtime.js +381 -100
package/core/wasm.d.ts
CHANGED
|
@@ -32,19 +32,18 @@ export type PayloadItem =
|
|
|
32
32
|
*
|
|
33
33
|
* `$` system entries are hoisted to named fields: `kind` (the `$kind`, empty
|
|
34
34
|
* string when none), optional `quill` (the `$quill` `name@version`, main card
|
|
35
|
-
* only), optional `
|
|
35
|
+
* only), optional `ext` (`$ext`), and optional `seed`
|
|
36
36
|
* (the `$seed` per-kind overlay map, main card only). `payloadItems` carries
|
|
37
37
|
* user fields and comments in order.
|
|
38
38
|
*/
|
|
39
39
|
export interface Card {
|
|
40
40
|
kind: string;
|
|
41
41
|
quill?: string;
|
|
42
|
-
id?: string;
|
|
43
42
|
ext?: Record<string, unknown>;
|
|
44
43
|
seed?: Record<string, unknown>;
|
|
45
44
|
payloadItems: PayloadItem[];
|
|
46
45
|
/**
|
|
47
|
-
* The card body as canonical `Content
|
|
46
|
+
* The card body as canonical `Content`: the source-of-truth content model.
|
|
48
47
|
* Always this content shape on read, never a markdown string. For the markdown
|
|
49
48
|
* projection call the codec `exportMarkdown(card.body)`. Write a body back
|
|
50
49
|
* with `doc.install(addr, rt)` / `doc.revise(addr, md)`, or via `CardInput.body`.
|
|
@@ -53,17 +52,16 @@ export interface Card {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
|
-
* A card written *into* a document
|
|
55
|
+
* A card written *into* a document: the input twin of `Card`, accepted by
|
|
57
56
|
* `Document.insertCard`. Like `Card` but `body` also
|
|
58
57
|
* takes a markdown `string` (imported to the content, so a markdown / LLM writer
|
|
59
|
-
* needn't build the `Content` shape), and every field but `kind` is optional
|
|
58
|
+
* needn't build the `Content` shape), and every field but `kind` is optional:
|
|
60
59
|
* an absent field defaults (no payload items, an empty body). Write one inline
|
|
61
60
|
* (`{ kind, body }`) or build it with `Document.makeCard`.
|
|
62
61
|
*/
|
|
63
62
|
export interface CardInput {
|
|
64
63
|
kind: string;
|
|
65
64
|
quill?: string;
|
|
66
|
-
id?: string;
|
|
67
65
|
ext?: Record<string, unknown>;
|
|
68
66
|
seed?: Record<string, unknown>;
|
|
69
67
|
payloadItems?: PayloadItem[];
|
|
@@ -71,7 +69,7 @@ export interface CardInput {
|
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
/**
|
|
74
|
-
* Canonical richtext content
|
|
72
|
+
* Canonical richtext content: the content model for a card body (and richtext
|
|
75
73
|
* fields). One text sequence over a single coordinate space (Unicode scalar
|
|
76
74
|
* values): `text` plus line attributes, anchored `marks`, and embedded
|
|
77
75
|
* `islands`. Every edit is a splice; markdown is a projection, not the model.
|
|
@@ -95,7 +93,7 @@ export type ContentLine = {
|
|
|
95
93
|
continues?: boolean;
|
|
96
94
|
} & ContentLineKind;
|
|
97
95
|
|
|
98
|
-
/** A line's block role, declared once for `ContentLine` and the `setKind` op
|
|
96
|
+
/** A line's block role, declared once for `ContentLine` and the `setKind` op:
|
|
99
97
|
* a new role is one edit here, as for `ContentContainer`. */
|
|
100
98
|
export type ContentLineKind =
|
|
101
99
|
| { kind: "para" }
|
|
@@ -115,7 +113,7 @@ export type ContentContainer =
|
|
|
115
113
|
|
|
116
114
|
/** A mark over char range `[start, end)` into `Content.text`. The open `type`
|
|
117
115
|
* arm blocks discriminant narrowing (as on `ContentIsland`), so read a
|
|
118
|
-
* payload-carrying arm behind its guard
|
|
116
|
+
* payload-carrying arm behind its guard: `isLinkMark` (`url`) / `isAnchorMark`
|
|
119
117
|
* (`id`), from `@quillmark/wasm/runtime`; the bare arms carry no payload. An
|
|
120
118
|
* `anchor`'s `id` is a caller-supplied, opaque handle, unique per `Content` and
|
|
121
119
|
* invariant while the mark lives (positions rebase, the id never does); it has no
|
|
@@ -128,7 +126,7 @@ export type ContentMark = { start: number; end: number } & (
|
|
|
128
126
|
| { type: string; attrs: unknown }
|
|
129
127
|
);
|
|
130
128
|
|
|
131
|
-
/** A cell in a `TableProps
|
|
129
|
+
/** A cell in a `TableProps`: its plain `text` plus the `marks` over it. `marks`
|
|
132
130
|
* rides the same wire shape as prose `ContentMark`, but each mark's `start`/`end`
|
|
133
131
|
* are USV offsets into this cell's `text` (`0..text.length`), not into
|
|
134
132
|
* `Content.text`. */
|
|
@@ -156,12 +154,16 @@ export interface ImageProps {
|
|
|
156
154
|
* open set: the engine pins `props` as `TableProps` for `table` and `ImageProps`
|
|
157
155
|
* for `image`; an island of any other type round-trips with opaque `props`. Like
|
|
158
156
|
* `ContentMark`, the open `type` arm means a discriminant check does not itself
|
|
159
|
-
* narrow `props
|
|
157
|
+
* narrow `props`: read `props` as the matching shape behind the `isTableIsland` /
|
|
160
158
|
* `isImageIsland` guards (from `@quillmark/wasm/runtime`), which narrow it. */
|
|
159
|
+
/** How faithfully the markdown projection can carry an island. Open like an
|
|
160
|
+
* island `type`: a class this build does not know round-trips verbatim, and
|
|
161
|
+
* reads as `unrepresentable`. */
|
|
162
|
+
export type ContentLossClass = "lossless" | "degraded" | "unrepresentable" | (string & {});
|
|
163
|
+
|
|
161
164
|
export type ContentIsland = {
|
|
162
165
|
id: string;
|
|
163
|
-
|
|
164
|
-
loss: "lossless" | "degraded" | "unrepresentable";
|
|
166
|
+
loss: ContentLossClass;
|
|
165
167
|
} & (
|
|
166
168
|
| { type: "table"; props: TableProps }
|
|
167
169
|
| { type: "image"; props: ImageProps }
|
|
@@ -169,14 +171,14 @@ export type ContentIsland = {
|
|
|
169
171
|
);
|
|
170
172
|
|
|
171
173
|
/**
|
|
172
|
-
* A write address
|
|
174
|
+
* A write address: one navigation concept for the whole `Document` surface. An
|
|
173
175
|
* absent `field` targets the card body; an absent `card` targets the main card.
|
|
174
176
|
* `{}` is the main-card body; `{ card: 2 }` the body of the composable card at
|
|
175
177
|
* index 2; `{ field: "intro" }` the main card's `intro` field; `{ card: 2,
|
|
176
178
|
* field: "intro" }` a card field.
|
|
177
179
|
*
|
|
178
180
|
* On the `Addr`-taking verbs a **bare string** is shorthand for `{ field: name }`
|
|
179
|
-
*
|
|
181
|
+
* (`doc.storeField("qty", 3)`, `doc.revise("intro", md)`) the one coercion
|
|
180
182
|
* rule. A bare number is *not* an addr (`{ card: 2 }` is the self-documenting
|
|
181
183
|
* spelling), so no third navigation idiom re-fragments the surface.
|
|
182
184
|
*/
|
|
@@ -186,7 +188,7 @@ export interface Addr {
|
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
/**
|
|
189
|
-
* A card-only address
|
|
191
|
+
* A card-only address: the axis the card-scoped verbs (`storeFields`,
|
|
190
192
|
* `storeExt`, `getExt`, `commitFields`, …) take. An absent `card` targets the
|
|
191
193
|
* main card. A present `field` throws: a card address takes only `card`, and a
|
|
192
194
|
* would-be nested write is a bug the error names rather than silently ignores.
|
|
@@ -197,7 +199,7 @@ export interface CardAddr {
|
|
|
197
199
|
|
|
198
200
|
/**
|
|
199
201
|
* A text-splice change set over the USV content (CodeMirror `ChangeSet`
|
|
200
|
-
* semantics)
|
|
202
|
+
* semantics): plain, structured-clone-able data. Returned by `revise` and by
|
|
201
203
|
* the `rebase` codec; map a stored position through it with `mapPos`.
|
|
202
204
|
*/
|
|
203
205
|
export interface Delta {
|
|
@@ -211,7 +213,7 @@ export type Assoc = "before" | "after";
|
|
|
211
213
|
* A mark edit in final-text coordinates (post-delta, post-line-op). `add` /
|
|
212
214
|
* `remove` carry the `ContentMark` vocabulary (`{ type, … }`); `removeAnchor`
|
|
213
215
|
* drops one identity anchor by id. An `add` of an `anchor` requires a non-empty
|
|
214
|
-
* `id` not already live in the field
|
|
216
|
+
* `id` not already live in the field: a collision or the empty id throws
|
|
215
217
|
* (ids are caller-supplied and unique per `Content`; DOCUMENT_STORAGE
|
|
216
218
|
* § Anchor-id identity).
|
|
217
219
|
*/
|
|
@@ -227,7 +229,7 @@ export type MarkOp =
|
|
|
227
229
|
/**
|
|
228
230
|
* A line/block edit. `split`/`join` splice `\n`; `setKind`/`setContainers`/
|
|
229
231
|
* `setContinues` touch metadata. `setContinues` sets/clears a line's within-block
|
|
230
|
-
* hard-break flag (`ContentLine.continues`)
|
|
232
|
+
* hard-break flag (`ContentLine.continues`): the op-grained way to lower a
|
|
231
233
|
* Shift+Enter hard break or a new code-fence interior line; `continues: true` on
|
|
232
234
|
* line 0 is rejected (nothing precedes it to continue).
|
|
233
235
|
*/
|
|
@@ -253,7 +255,7 @@ export interface ChangeBundle {
|
|
|
253
255
|
|
|
254
256
|
/**
|
|
255
257
|
* One segment of a parsed `Diagnostic.path` (see `parseDocPath`). The head
|
|
256
|
-
* carries the document-model root
|
|
258
|
+
* carries the document-model root: `main` (only before `body`), a `card`
|
|
257
259
|
* (`kind: null` is the unknown-kind `cards[i]` form), or a `field`; the tail is
|
|
258
260
|
* `field` / `index` / a terminal `body`.
|
|
259
261
|
*/
|
|
@@ -271,7 +273,7 @@ export type FieldSource = "authored" | "default" | "zero";
|
|
|
271
273
|
|
|
272
274
|
/**
|
|
273
275
|
* One resolved row: its `name`, the value the render projection would use, and
|
|
274
|
-
* the `FieldSource` rung it came from. Rows are an ordered array
|
|
276
|
+
* the `FieldSource` rung it came from. Rows are an ordered array: declaration
|
|
275
277
|
* order is structural, not object-key order. The card body is a `body` sibling
|
|
276
278
|
* on its card, never a row in `fields`. Diagnostics stay `Quill.validate`'s;
|
|
277
279
|
* schema guidance (`example:`, labels) reads from `Quill.schema`.
|
|
@@ -283,7 +285,7 @@ export interface ResolvedField {
|
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
/**
|
|
286
|
-
* The main card's resolved rows in declaration order, plus its body row
|
|
288
|
+
* The main card's resolved rows in declaration order, plus its body row:
|
|
287
289
|
* `null` when the main enables no body.
|
|
288
290
|
*/
|
|
289
291
|
export interface ResolvedMain {
|
|
@@ -294,7 +296,7 @@ export interface ResolvedMain {
|
|
|
294
296
|
/**
|
|
295
297
|
* One composable card's resolved rows in declaration order, with its authored
|
|
296
298
|
* `kind` (`null` for an unknown-kind card), its document-array `index`, and its
|
|
297
|
-
* body row
|
|
299
|
+
* body row: `null` when the kind enables no body.
|
|
298
300
|
*/
|
|
299
301
|
export interface ResolvedCard {
|
|
300
302
|
kind: string | null;
|
|
@@ -305,7 +307,7 @@ export interface ResolvedCard {
|
|
|
305
307
|
|
|
306
308
|
/**
|
|
307
309
|
* The resolved-value view (`Quill.resolve`): the main card and every
|
|
308
|
-
* composable card. Value and provenance only
|
|
310
|
+
* composable card. Value and provenance only: completeness and errors stay
|
|
309
311
|
* `Quill.validate`.
|
|
310
312
|
*/
|
|
311
313
|
export interface Resolved {
|
|
@@ -326,7 +328,7 @@ export interface QuillFieldUi {
|
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
/** One entry in a card's `ui.groups` registry: a display-label override for the
|
|
329
|
-
* group id (the map key). An empty object carries no override
|
|
331
|
+
* group id (the map key). An empty object carries no override: the consumer
|
|
330
332
|
* derives the label from the id (`memo_for` → "Memo For"), as it does a field
|
|
331
333
|
* label from its key. */
|
|
332
334
|
export interface QuillGroupUi {
|
|
@@ -338,7 +340,7 @@ export interface QuillCardUi {
|
|
|
338
340
|
title?: string;
|
|
339
341
|
/** The card's group registry: the ordered table of contents naming every
|
|
340
342
|
* group a field's `ui.group` may reference. The map key is the group id, and
|
|
341
|
-
* key order is declaration order
|
|
343
|
+
* key order is declaration order: the display-order contract, the same one
|
|
342
344
|
* `fields` key order carries. Absent when the card declares no groups (or
|
|
343
345
|
* uses the deprecated implicit-group form). */
|
|
344
346
|
groups?: Record<string, QuillGroupUi>;
|
|
@@ -376,7 +378,7 @@ export interface QuillFieldSchema {
|
|
|
376
378
|
properties?: Record<string, QuillFieldSchema>;
|
|
377
379
|
items?: QuillFieldSchema;
|
|
378
380
|
/** Present (and `true`) on a `richtext` or `plaintext` field declared
|
|
379
|
-
* `inline
|
|
381
|
+
* `inline`: the single-paragraph, container-free, island-free constraint.
|
|
380
382
|
* Core serializes `inline: true` into the schema JSON; absent otherwise. */
|
|
381
383
|
inline?: boolean;
|
|
382
384
|
}
|
|
@@ -417,24 +419,49 @@ export interface QuillMetadata {
|
|
|
417
419
|
}
|
|
418
420
|
|
|
419
421
|
|
|
422
|
+
/**
|
|
423
|
+
* Diagnostic message (error or warning)
|
|
424
|
+
*/
|
|
420
425
|
export interface Diagnostic {
|
|
421
426
|
severity: Severity;
|
|
422
427
|
code?: string;
|
|
423
428
|
message: string;
|
|
424
429
|
location?: Location;
|
|
430
|
+
/**
|
|
431
|
+
* Document-model path anchor (e.g. `\"cards.indorsement[0].signature_block\"`).
|
|
432
|
+
*
|
|
433
|
+
* Set on schema validation diagnostics; `undefined` otherwise. See the
|
|
434
|
+
* Rust `quillmark_core::error` module docs for the path grammar.
|
|
435
|
+
*/
|
|
425
436
|
path?: string;
|
|
426
437
|
hint?: string;
|
|
438
|
+
/**
|
|
439
|
+
* The facts `message` interpolates, keyed by name. With `code`, the
|
|
440
|
+
* substitution unit needed to word this diagnostic in another language;
|
|
441
|
+
* `prose/canon/ERROR.md` § \"Diagnostic args\" tabulates the keys per code.
|
|
442
|
+
*
|
|
443
|
+
* Declared optional explicitly because `tsify` does not read
|
|
444
|
+
* `skip_serializing_if`: without this, a field the runtime omits is
|
|
445
|
+
* declared required. `sourceChain` carries that mismatch.
|
|
446
|
+
*/
|
|
447
|
+
args?: Record<string, unknown>;
|
|
427
448
|
sourceChain?: string[];
|
|
428
449
|
}
|
|
429
450
|
|
|
451
|
+
/**
|
|
452
|
+
* Severity levels for diagnostics
|
|
453
|
+
*/
|
|
454
|
+
export type Severity = "error" | "warning";
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Source location for errors and warnings
|
|
458
|
+
*/
|
|
430
459
|
export interface Location {
|
|
431
460
|
file: string;
|
|
432
461
|
line: number;
|
|
433
462
|
column: number;
|
|
434
463
|
}
|
|
435
464
|
|
|
436
|
-
export type Severity = "error" | "warning";
|
|
437
|
-
|
|
438
465
|
|
|
439
466
|
/**
|
|
440
467
|
* Typed in-memory Quillmark document.
|
|
@@ -444,7 +471,7 @@ export class Document {
|
|
|
444
471
|
[Symbol.dispose](): void;
|
|
445
472
|
/**
|
|
446
473
|
* **Apply** a committed content edit `bundle` (`{ delta?, lineOps?, markOps? }`)
|
|
447
|
-
* at `addr
|
|
474
|
+
* at `addr`, the editor splice: text delta first, then line ops, then mark
|
|
448
475
|
* ops (mark ranges in final-text coordinates), each all-or-nothing. An absent
|
|
449
476
|
* `addr.field` targets the body, an absent `addr.card` the main card.
|
|
450
477
|
*
|
|
@@ -461,20 +488,13 @@ export class Document {
|
|
|
461
488
|
*/
|
|
462
489
|
static blueprintInstruction(quill_name: string): string;
|
|
463
490
|
/**
|
|
464
|
-
* A single composable card by index
|
|
491
|
+
* A single composable card by index: the whole `Card`, the card-indexed
|
|
465
492
|
* twin of the [`main`](Self::main) getter, so reading one card need not
|
|
466
493
|
* materialize every card via [`cards`](Self::cards). An out-of-range
|
|
467
494
|
* `index` throws `edit::index_out_of_range`, matching the card write
|
|
468
495
|
* verbs.
|
|
469
496
|
*/
|
|
470
497
|
card(index: number): Card;
|
|
471
|
-
/**
|
|
472
|
-
* The index of the composable card whose `$id` equals `id`, or
|
|
473
|
-
* `undefined` when none carries it. Resolves the durable card handle
|
|
474
|
-
* without a hand-rolled scan over [`cards`](Self::cards); `$id` is
|
|
475
|
-
* unique per document, so at most one card matches.
|
|
476
|
-
*/
|
|
477
|
-
cardIndexById(id: string): number | undefined;
|
|
478
498
|
clone(): Document;
|
|
479
499
|
/**
|
|
480
500
|
* Schema version this build writes via [`toJson`](Document::to_json).
|
|
@@ -516,54 +536,63 @@ export class Document {
|
|
|
516
536
|
static fromMarkdown(markdown: string): Document;
|
|
517
537
|
/**
|
|
518
538
|
* The whole `$ext` map at `addr` (a card address, absent `card` = main), or
|
|
519
|
-
* `undefined` when the card carries none. The fine-grained `$ext` read
|
|
539
|
+
* `undefined` when the card carries none. The fine-grained `$ext` read:
|
|
520
540
|
* your own state without serializing the whole card. Throws on a present
|
|
521
541
|
* `field` (a card address takes only `card`) or an out-of-range card.
|
|
522
542
|
*/
|
|
523
543
|
getExt(addr?: CardAddr): Record<string, unknown> | undefined;
|
|
524
544
|
/**
|
|
525
545
|
* The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
|
|
526
|
-
* = main), or `undefined`. The namespace-scoped `$ext` read
|
|
546
|
+
* = main), or `undefined`. The namespace-scoped `$ext` read: your own slot
|
|
527
547
|
* without a whole-card serialize, and non-destructive (unlike
|
|
528
548
|
* `removeExtNamespace`). Throws on a present `field` or an out-of-range card.
|
|
529
549
|
*/
|
|
530
550
|
getExtNamespace(addr: CardAddr, ns: string): unknown;
|
|
531
551
|
/**
|
|
532
|
-
* The **body** markdown projection
|
|
533
|
-
* body (`{ card }`)
|
|
552
|
+
* The **body** markdown projection (the main body, or a composable card's
|
|
553
|
+
* body (`{ card }`)) the on-demand, lossy export (content-only marks do not
|
|
534
554
|
* survive markdown). A body's type is a format fact, not a schema fact, so
|
|
535
555
|
* this read stays quill-free; a body is never absent.
|
|
536
556
|
*
|
|
537
557
|
* `addr` is an optional **card address** (`{ card }`, absent = main). A
|
|
538
|
-
* present `field` throws
|
|
558
|
+
* present `field` throws: a field's markdown is read through the
|
|
539
559
|
* schema-plane `quill.reader(doc).get(field)`, which interprets by declared
|
|
540
|
-
* type
|
|
560
|
+
* type. An out-of-range `addr.card` throws.
|
|
541
561
|
*/
|
|
542
562
|
getMarkdown(addr?: CardAddr): string;
|
|
543
563
|
/**
|
|
544
|
-
* Read the **verbatim stored value** at `addr
|
|
545
|
-
* field
|
|
546
|
-
* otherwise), or the **body content** when `addr.field` is absent. A bare
|
|
564
|
+
* Read the **verbatim stored value** at `addr`: the raw payload value of a
|
|
565
|
+
* field, or the **body content** when `addr.field` is absent. A bare
|
|
547
566
|
* string is `Addr` shorthand for `{ field }`. Reads are total over the field
|
|
548
567
|
* axis: an absent field is `undefined`; only an out-of-range `addr.card`
|
|
549
568
|
* throws `edit::index_out_of_range`. Needs no schema, so it lives on
|
|
550
|
-
* `Document
|
|
569
|
+
* `Document`: the read echo of the verbatim `store*` write, distinct from
|
|
551
570
|
* the interpreted schema-plane [`reader.get`](Self::reader_get). For the
|
|
552
571
|
* markdown projection use [`getMarkdown`](Self::get_markdown) (body) or
|
|
553
572
|
* `reader.get` (a field's declared type).
|
|
573
|
+
*
|
|
574
|
+
* **A content field at rest has one stored form per codec**: a `richtext`
|
|
575
|
+
* field holds the canonical content object, a `plaintext` field its literal
|
|
576
|
+
* string. A document that came through the bound door (`quill.parse` /
|
|
577
|
+
* `quill.conform`) is at rest, so this read no longer depends on which lane
|
|
578
|
+
* built it. A document that came through the transport door
|
|
579
|
+
* (`Document.fromMarkdown`, a legacy stored row) may rest as authored until
|
|
580
|
+
* it is conformed, and this read reports what is there. For the corpus
|
|
581
|
+
* either way, use the schema-plane `reader.getContent`, which decodes
|
|
582
|
+
* through the codec the field's declared type names.
|
|
554
583
|
*/
|
|
555
584
|
getStored(addr: Addr | string): unknown;
|
|
556
585
|
/**
|
|
557
|
-
* Insert a card
|
|
586
|
+
* Insert a card, the single insertion verb: `at` absent appends, a number
|
|
558
587
|
* inserts at that index (must be in `0..=cards.length`). Accepts a
|
|
559
|
-
* `CardInput
|
|
588
|
+
* `CardInput`: a card read back (`cards` / `removeCard` / `quill.seedCard`),
|
|
560
589
|
* a [`makeCard`](Document::make_card) result, or a bare `{ kind, body }`
|
|
561
590
|
* (every returned `Card` is a valid `CardInput`). Throws if `card.kind` is
|
|
562
591
|
* not a valid kind name, or if `at` is out of range.
|
|
563
592
|
*/
|
|
564
593
|
insertCard(card: CardInput, at?: number): void;
|
|
565
594
|
/**
|
|
566
|
-
* **Install** a richtext value at `addr
|
|
595
|
+
* **Install** a richtext value at `addr`: **value semantics**, content only.
|
|
567
596
|
* Stores exactly `rt` (a canonical `Content` content object); the identity
|
|
568
597
|
* anchors of any previous value are gone. An absent `addr.field` targets the
|
|
569
598
|
* body, an absent `addr.card` the main card. For "here's new markdown," use
|
|
@@ -577,25 +606,25 @@ export class Document {
|
|
|
577
606
|
install(addr: Addr | string, rt: Content): void;
|
|
578
607
|
/**
|
|
579
608
|
* Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
|
|
580
|
-
* shorthand for `{ field }`. `false` for an absent field (truthful
|
|
609
|
+
* shorthand for `{ field }`. `false` for an absent field (truthful: it isn't
|
|
581
610
|
* marked) and for a body address (a body is never a fill). Only an
|
|
582
611
|
* out-of-range `addr.card` throws.
|
|
583
612
|
*/
|
|
584
613
|
isFill(addr: Addr | string): boolean;
|
|
585
614
|
/**
|
|
586
615
|
* Replace this document's contents **in place** from a versioned storage
|
|
587
|
-
* DTO string
|
|
616
|
+
* DTO string: the mutating twin of the static
|
|
588
617
|
* [`fromJson`](Document::from_json) constructor. Parse-time `warnings` are
|
|
589
618
|
* cleared. Throws (leaving the document unchanged) on an invalid DTO.
|
|
590
619
|
*
|
|
591
620
|
* The cross-WASM-memory `Document` bridge: mutate a document on a
|
|
592
621
|
* backend-memory clone, then write the mutated state back into the caller's
|
|
593
|
-
* canonical document with this
|
|
622
|
+
* canonical document with this, the one way to update a live handle across
|
|
594
623
|
* the linear-memory seam without the caller re-binding its variable.
|
|
595
624
|
*/
|
|
596
625
|
loadJson(json: string): void;
|
|
597
626
|
/**
|
|
598
|
-
* Build a fresh `Card` from a kind and a flat field map
|
|
627
|
+
* Build a fresh `Card` from a kind and a flat field map: the ergonomic
|
|
599
628
|
* constructor for `insertCard`. `fields` is an optional
|
|
600
629
|
* `Record<string, unknown>` (each entry becomes a card field, in
|
|
601
630
|
* insertion order); `body` defaults to `""`.
|
|
@@ -605,8 +634,8 @@ export class Document {
|
|
|
605
634
|
* here.
|
|
606
635
|
*
|
|
607
636
|
* Checks only what a detached card can decide alone: field-name grammar
|
|
608
|
-
* and value depth. Kind validity is positional
|
|
609
|
-
* root, reserved for a composable card
|
|
637
|
+
* and value depth. Kind validity is positional (`main` is right for the
|
|
638
|
+
* root, reserved for a composable card) so `insertCard` is its gate, and
|
|
610
639
|
* any kind string is accepted here.
|
|
611
640
|
*/
|
|
612
641
|
static makeCard(kind: string, fields?: Record<string, unknown>, body?: string): Card;
|
|
@@ -615,7 +644,7 @@ export class Document {
|
|
|
615
644
|
*/
|
|
616
645
|
moveCard(from: number, to: number): void;
|
|
617
646
|
/**
|
|
618
|
-
* `new Document(quillRef)
|
|
647
|
+
* `new Document(quillRef)`, a blank document: a main card carrying only
|
|
619
648
|
* `$quill`, an empty body, and no composable cards. The programmatic
|
|
620
649
|
* blank canvas: absent fields resolve at render time (`default`, else
|
|
621
650
|
* type-empty zero), so nothing the caller did not set reaches the
|
|
@@ -626,7 +655,7 @@ export class Document {
|
|
|
626
655
|
/**
|
|
627
656
|
* The canonical `$quill` reference grammar as author-facing text. Core is
|
|
628
657
|
* the single source of truth: drive schema `describe` and validation
|
|
629
|
-
* messages from this instead of re-stating the rule
|
|
658
|
+
* messages from this instead of re-stating the rule; it matches the
|
|
630
659
|
* `hint` on `parse::invalid_quill_reference`. Cache it; the value never
|
|
631
660
|
* changes.
|
|
632
661
|
*/
|
|
@@ -634,7 +663,7 @@ export class Document {
|
|
|
634
663
|
removeCard(index: number): Card | undefined;
|
|
635
664
|
/**
|
|
636
665
|
* Remove the `$ext` map on the card `addr` targets *entirely*, returning the
|
|
637
|
-
* previous map or `undefined
|
|
666
|
+
* previous map or `undefined`: a blunt escape hatch that discards every
|
|
638
667
|
* namespace at once (prefer `removeExtNamespace`). `addr` is a card address
|
|
639
668
|
* (absent = main). Throws on a present `field` or an out-of-range card.
|
|
640
669
|
*/
|
|
@@ -660,7 +689,7 @@ export class Document {
|
|
|
660
689
|
*/
|
|
661
690
|
removeSeedNamespace(card_kind: string): any;
|
|
662
691
|
/**
|
|
663
|
-
* **Revise** the richtext value at `addr` from a markdown string
|
|
692
|
+
* **Revise** the richtext value at `addr` from a markdown string: **edit
|
|
664
693
|
* semantics**, the default write path, returning the text `Delta`. Imports
|
|
665
694
|
* the markdown, diffs it against the current value, rebases surviving
|
|
666
695
|
* identity anchors, and returns the change an editor bridge maps its own
|
|
@@ -673,7 +702,7 @@ export class Document {
|
|
|
673
702
|
revise(addr: Addr | string, markdown: string): Delta;
|
|
674
703
|
/**
|
|
675
704
|
* Read the `schema` version tag from a raw storage DTO string without a
|
|
676
|
-
* full parse, or `undefined`. Returns unknown future versions as-is
|
|
705
|
+
* full parse, or `undefined`. Returns unknown future versions as-is:
|
|
677
706
|
* useful to distinguish "build too old" from "payload corrupt" when
|
|
678
707
|
* `fromJson` throws.
|
|
679
708
|
*/
|
|
@@ -682,7 +711,7 @@ export class Document {
|
|
|
682
711
|
* The main card's `$seed` overlay object for `kind` (the `$seed[kind]`
|
|
683
712
|
* entry), or `undefined` when absent. The cheap read that feeds
|
|
684
713
|
* `quill.seedCard(kind, overlay)` without serializing the whole main card
|
|
685
|
-
* via [`main`](Self::main) to fish out one key
|
|
714
|
+
* via [`main`](Self::main) to fish out one key, and it keeps `seedCard`
|
|
686
715
|
* pure: the quill still never reads the document.
|
|
687
716
|
*/
|
|
688
717
|
seedOverlay(kind: string): Record<string, unknown> | undefined;
|
|
@@ -700,41 +729,41 @@ export class Document {
|
|
|
700
729
|
* Replace the opaque `$ext` map on the card `addr` targets (a card address,
|
|
701
730
|
* absent `card` = main). `value` must be a plain object. `$ext` carries
|
|
702
731
|
* out-of-band consumer state and never reaches the rendered output; pass
|
|
703
|
-
* `{}` for an explicit empty `$ext`. Quill-free and verbatim
|
|
732
|
+
* `{}` for an explicit empty `$ext`. Quill-free and verbatim: an opaque
|
|
704
733
|
* `store` verb. Throws on a present `field` or an out-of-range card.
|
|
705
734
|
*/
|
|
706
735
|
storeExt(addr: CardAddr, value: any): void;
|
|
707
736
|
/**
|
|
708
737
|
* Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
|
|
709
|
-
* sibling namespaces
|
|
710
|
-
* address (absent = main). Quill-free and verbatim
|
|
738
|
+
* sibling namespaces: the recommended `$ext` write. `addr` is a card
|
|
739
|
+
* address (absent = main). Quill-free and verbatim: an opaque `store` verb.
|
|
711
740
|
* Throws on a present `field` or an out-of-range card.
|
|
712
741
|
*/
|
|
713
742
|
storeExtNamespace(addr: CardAddr, ns: string, value: any): void;
|
|
714
743
|
/**
|
|
715
|
-
* Store a field verbatim at `addr
|
|
744
|
+
* Store a field verbatim at `addr`: the opaque store (**store** = verbatim,
|
|
716
745
|
* coercion deferred to render; the typed write is
|
|
717
746
|
* [`commitField`](Document::commit_field)). A bare string is `Addr`
|
|
718
747
|
* shorthand for `{ field }`, so `doc.storeField("qty", 3)` reads as written;
|
|
719
748
|
* `{ card: 2, field: "qty" }` targets a composable card. Clears any
|
|
720
|
-
* `!must_fill` marker. A body address (no `field`) throws
|
|
749
|
+
* `!must_fill` marker. A body address (no `field`) throws: a body is never
|
|
721
750
|
* opaque; write it with `revise` / `install` / `writer.setBody`. Throws on
|
|
722
751
|
* an out-of-range card or a malformed name.
|
|
723
752
|
*/
|
|
724
753
|
storeField(addr: Addr | string, value: any): void;
|
|
725
754
|
/**
|
|
726
|
-
* Store several fields verbatim and atomically on the card `addr` targets
|
|
755
|
+
* Store several fields verbatim and atomically on the card `addr` targets:
|
|
727
756
|
* the opaque store's batch. `addr` is a **card address** (`{ card }`, absent
|
|
728
757
|
* = main); a present `field` throws. The batch verb takes the address first
|
|
729
758
|
* and is never shape-overloaded, because `card` is a legal field name:
|
|
730
759
|
* `storeFields({}, fields)` is the main card, `storeFields({ card: 2 },
|
|
731
|
-
* fields)` a composable one
|
|
760
|
+
* fields)` a composable one, never ambiguous with "set field `card`".
|
|
732
761
|
* Nothing is applied on error; the thrown error's `diagnostics` carry one
|
|
733
762
|
* entry per offending field. Throws on an out-of-range card.
|
|
734
763
|
*/
|
|
735
764
|
storeFields(addr: CardAddr, fields: Record<string, unknown>): void;
|
|
736
765
|
/**
|
|
737
|
-
* Store a field verbatim at `addr` and mark it `!must_fill
|
|
766
|
+
* Store a field verbatim at `addr` and mark it `!must_fill`: the opaque
|
|
738
767
|
* store's fill variant, card-capable (a bare string or `{ field }` for main,
|
|
739
768
|
* `{ card, field }` for a composable card). A body address throws. Same
|
|
740
769
|
* validation as [`storeField`](Document::store_field).
|
|
@@ -742,9 +771,9 @@ export class Document {
|
|
|
742
771
|
storeFill(addr: Addr | string, value: any): void;
|
|
743
772
|
/**
|
|
744
773
|
* Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
|
|
745
|
-
* under `cardKind`, preserving sibling kinds
|
|
774
|
+
* under `cardKind`, preserving sibling kinds: `$seed` lives on the main
|
|
746
775
|
* card by model, so this takes no address. Sets the starting values new
|
|
747
|
-
* cards of that kind spawn with. Quill-free and verbatim
|
|
776
|
+
* cards of that kind spawn with. Quill-free and verbatim: an opaque `store`
|
|
748
777
|
* verb. Throws if `overlay` cannot be serialized or nests too deep.
|
|
749
778
|
*/
|
|
750
779
|
storeSeedNamespace(card_kind: string, overlay: any): void;
|
|
@@ -752,7 +781,7 @@ export class Document {
|
|
|
752
781
|
* Serialize this document to a versioned storage DTO string.
|
|
753
782
|
*
|
|
754
783
|
* Prefer this over `toMarkdown` for persistence across restarts or crate
|
|
755
|
-
* upgrades
|
|
784
|
+
* upgrades: the wire format is frozen per `schema` version. Parse-time
|
|
756
785
|
* `warnings` are excluded from the DTO.
|
|
757
786
|
*
|
|
758
787
|
* Output is **byte-deterministic** within a `schema` version: equal
|
|
@@ -766,7 +795,7 @@ export class Document {
|
|
|
766
795
|
toMarkdown(): string;
|
|
767
796
|
/**
|
|
768
797
|
* Like [`fromJson`](Document::from_json) but returns `undefined` instead
|
|
769
|
-
* of throwing when `json` is not a valid storage DTO
|
|
798
|
+
* of throwing when `json` is not a valid storage DTO: use to
|
|
770
799
|
* discriminate format without exceptions as control flow.
|
|
771
800
|
* `undefined` means "not a storage DTO"; `fromMarkdown` still throws on
|
|
772
801
|
* genuinely malformed markdown.
|
|
@@ -779,10 +808,16 @@ export class Document {
|
|
|
779
808
|
readonly cards: Card[];
|
|
780
809
|
/**
|
|
781
810
|
* The document's main (entry) card. Allocates and serializes on each
|
|
782
|
-
* call
|
|
811
|
+
* call: cache locally if read in a hot loop.
|
|
783
812
|
*/
|
|
784
813
|
readonly main: Card;
|
|
785
814
|
readonly quillRef: string;
|
|
815
|
+
/**
|
|
816
|
+
* The non-fatal diagnostics of the load that produced this document: parse
|
|
817
|
+
* warnings, plus the `conform::*` warnings when it came through
|
|
818
|
+
* `quill.parse`. Session state, not document value: `equals` and the
|
|
819
|
+
* storage DTO exclude it, and `fromJson` / `loadJson` clear it.
|
|
820
|
+
*/
|
|
786
821
|
readonly warnings: Diagnostic[];
|
|
787
822
|
}
|
|
788
823
|
|
|
@@ -791,7 +826,24 @@ export class Quill {
|
|
|
791
826
|
free(): void;
|
|
792
827
|
[Symbol.dispose](): void;
|
|
793
828
|
/**
|
|
794
|
-
*
|
|
829
|
+
* Land `doc`'s declared content fields at their canonical rest **in
|
|
830
|
+
* place**, returning the `conform::*` diagnostics for the values that would
|
|
831
|
+
* not commit (an empty array when everything rested).
|
|
832
|
+
*
|
|
833
|
+
* The read-repair verb: a document that arrived through the transport door
|
|
834
|
+
* (`fromMarkdown`, `fromJson`, a stored row) converges here, and is then
|
|
835
|
+
* eligible for rewrite under its current schema tag. Idempotent, and a
|
|
836
|
+
* no-op on an already-canonical document: an equal value is not rewritten,
|
|
837
|
+
* so YAML comments and stored bytes survive.
|
|
838
|
+
*
|
|
839
|
+
* A `!must_fill` marker anywhere in a field's value skips that field (the
|
|
840
|
+
* marker is the state), and a value the strict write refuses stays as
|
|
841
|
+
* authored with a diagnostic. Throws when `doc` declares a different
|
|
842
|
+
* `$quill`, before any mutation.
|
|
843
|
+
*/
|
|
844
|
+
conform(doc: Document): Diagnostic[];
|
|
845
|
+
/**
|
|
846
|
+
* Build a quill from a file tree. Pure: no backend, no engine; the
|
|
795
847
|
* declared backend is resolved later, at render time.
|
|
796
848
|
*
|
|
797
849
|
* Accepts either a `Map<string, Uint8Array>` or a plain object
|
|
@@ -801,11 +853,26 @@ export class Quill {
|
|
|
801
853
|
*/
|
|
802
854
|
static fromTree(tree: Map<string, Uint8Array>): Quill;
|
|
803
855
|
/**
|
|
804
|
-
*
|
|
856
|
+
* Parse `markdown` and conform it against this quill: the **primary
|
|
857
|
+
* ingestion path**, and the bound twin of the schema-free
|
|
858
|
+
* `Document.fromMarkdown`. The returned document rests at its canonical
|
|
859
|
+
* form (a `richtext` field as a content object, a `plaintext` field as its
|
|
860
|
+
* literal string), so `getStored` no longer answers "corpus or string?"
|
|
861
|
+
* with "depends how this document was built".
|
|
862
|
+
*
|
|
863
|
+
* Parse warnings and the `conform::*` diagnostics both land on
|
|
864
|
+
* `doc.warnings`. Throws on a parse failure, or when `markdown` declares a
|
|
865
|
+
* `$quill` this quill does not answer to: nothing conforms under the wrong
|
|
866
|
+
* schema. To open a document whose `$quill` is stale, use the transport
|
|
867
|
+
* door (`Document.fromMarkdown`, `setQuillRef`, then `quill.conform`).
|
|
868
|
+
*/
|
|
869
|
+
parse(markdown: string): Document;
|
|
870
|
+
/**
|
|
871
|
+
* The resolved-value view of `doc` against this quill's schema: for every
|
|
805
872
|
* declared field the value the render projection would use and the
|
|
806
873
|
* `FieldSource` rung it came from (`"authored" | "default" | "zero"`), in
|
|
807
874
|
* one call. The card body is a `body` sibling on its card (row `name`
|
|
808
|
-
* `"body"`), never a row in `fields
|
|
875
|
+
* `"body"`), never a row in `fields`: `null` when the kind enables no body.
|
|
809
876
|
*
|
|
810
877
|
* Value and provenance only: completeness and errors stay `validate`'s
|
|
811
878
|
* (a consumer merges it with its own diagnostic producers regardless), and
|
|
@@ -822,11 +889,11 @@ export class Quill {
|
|
|
822
889
|
* Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
|
|
823
890
|
* template-derived document inherits its curated starting values; omit it
|
|
824
891
|
* (or pass `undefined` / `null`) for the bare schema seed. `overlay` is a
|
|
825
|
-
* plain object
|
|
892
|
+
* plain object: this reads the document, it does not mutate it.
|
|
826
893
|
*/
|
|
827
894
|
seedCard(card_kind: string, overlay: Record<string, unknown> | undefined): Card | undefined;
|
|
828
895
|
/**
|
|
829
|
-
* Seed a starter `Document` from the schema
|
|
896
|
+
* Seed a starter `Document` from the schema, the main card plus one
|
|
830
897
|
* instance of each composable card kind, each committing its fields'
|
|
831
898
|
* `example:` values and leaving every other field absent (interpolated at
|
|
832
899
|
* render: `default:`, else type-empty zero). Illustration-first: a field
|
|
@@ -835,14 +902,14 @@ export class Quill {
|
|
|
835
902
|
*/
|
|
836
903
|
seedDocument(): Document;
|
|
837
904
|
/**
|
|
838
|
-
* Seed a starter main `Card` (carries `$quill`) from the schema
|
|
905
|
+
* Seed a starter main `Card` (carries `$quill`) from the schema: the
|
|
839
906
|
* `$kind: main` card of [`seedDocument`](Self::seed_document) in
|
|
840
907
|
* isolation, committing each field's `example:` value. Returns the same
|
|
841
908
|
* `Card` shape as the `Document.main` getter.
|
|
842
909
|
*/
|
|
843
910
|
seedMain(): Card;
|
|
844
911
|
/**
|
|
845
|
-
* Flatten this quill back into its canonical file tree
|
|
912
|
+
* Flatten this quill back into its canonical file tree: the inverse of
|
|
846
913
|
* [`fromTree`](Self::from_tree). Round-trips: `Quill.fromTree(q.toTree())`
|
|
847
914
|
* reproduces an equivalent quill.
|
|
848
915
|
*
|
|
@@ -858,8 +925,8 @@ export class Quill {
|
|
|
858
925
|
* Validate `doc` against this quill's schema, returning every diagnostic
|
|
859
926
|
* (an empty array when the document is valid).
|
|
860
927
|
*
|
|
861
|
-
* Forwards the canonical `validation::*` diagnostics
|
|
862
|
-
* `path`, and `hint` the engine emits
|
|
928
|
+
* Forwards the canonical `validation::*` diagnostics (same `code`,
|
|
929
|
+
* `path`, and `hint` the engine emits) including the non-fatal
|
|
863
930
|
* `validation::must_fill` warning for each `!must_fill` marker left in
|
|
864
931
|
* the document. Field values, defaults, and order are not part of this
|
|
865
932
|
* surface: read them from the `Document` payload and `Quill.schema`
|
|
@@ -868,14 +935,14 @@ export class Quill {
|
|
|
868
935
|
validate(doc: Document): Diagnostic[];
|
|
869
936
|
/**
|
|
870
937
|
* The *declared* backend identifier (`config.backend`, e.g. `"typst"`).
|
|
871
|
-
* Intent, not a resolved capability
|
|
938
|
+
* Intent, not a resolved capability: capability (`supportedFormats` /
|
|
872
939
|
* `supportsCanvas`) is read from the engine.
|
|
873
940
|
*/
|
|
874
941
|
readonly backendId: string;
|
|
875
942
|
readonly blueprint: string;
|
|
876
943
|
/**
|
|
877
944
|
* Identity snapshot of the `quill:` section of `Quill.yaml` plus any extra
|
|
878
|
-
* `quill:` keys. Pure config
|
|
945
|
+
* `quill:` keys. Pure config: the backend's output formats are a
|
|
879
946
|
* resolved-backend capability read from the engine
|
|
880
947
|
* (`Quillmark.supportedFormats`), not part of this snapshot.
|
|
881
948
|
*/
|
|
@@ -883,15 +950,15 @@ export class Quill {
|
|
|
883
950
|
/**
|
|
884
951
|
* Document schema for the quill: the user-fillable fields plus their
|
|
885
952
|
* `ui` hints (title / group / compact / multiline). The single
|
|
886
|
-
* field-metadata surface
|
|
887
|
-
* alike. Key order in `fields`/`properties` is declaration order
|
|
953
|
+
* field-metadata surface: drives form editors and LLM/MCP consumers
|
|
954
|
+
* alike. Key order in `fields`/`properties` is declaration order: the
|
|
888
955
|
* ordering contract. Returns the `QuillSchema` shape.
|
|
889
956
|
*/
|
|
890
957
|
readonly schema: QuillSchema;
|
|
891
958
|
}
|
|
892
959
|
|
|
893
960
|
/**
|
|
894
|
-
* Export a canonical `Content` content to its markdown projection
|
|
961
|
+
* Export a canonical `Content` content to its markdown projection: the pure
|
|
895
962
|
* on-demand codec behind `exportMarkdown(card.body)`. Throws if `rt` is not a
|
|
896
963
|
* canonical content.
|
|
897
964
|
*/
|
|
@@ -899,7 +966,7 @@ export function exportMarkdown(rt: Content): string;
|
|
|
899
966
|
|
|
900
967
|
/**
|
|
901
968
|
* Serialize structured [`DocPathSeg`] segments back to the canonical path
|
|
902
|
-
* string
|
|
969
|
+
* string: the inverse of `parseDocPath`, for a consumer that builds a path
|
|
903
970
|
* rather than reads one. Throws on a segment array the deserializer rejects,
|
|
904
971
|
* and on an empty segment array (symmetric with `parseDocPath("")`, which
|
|
905
972
|
* throws "empty path").
|
|
@@ -907,7 +974,7 @@ export function exportMarkdown(rt: Content): string;
|
|
|
907
974
|
export function formatDocPath(segs: DocPathSeg[]): string;
|
|
908
975
|
|
|
909
976
|
/**
|
|
910
|
-
* Import a markdown string to a canonical `Content` content
|
|
977
|
+
* Import a markdown string to a canonical `Content` content: the pure,
|
|
911
978
|
* document-free codec. Pair with `install(addr, importMarkdown(md))` to spell
|
|
912
979
|
* the cold (anchor-losing) write at the call site; prefer `revise` for edit
|
|
913
980
|
* semantics. Throws on an over-nested input.
|
|
@@ -920,8 +987,8 @@ export function importMarkdown(markdown: string): Content;
|
|
|
920
987
|
export function init(): void;
|
|
921
988
|
|
|
922
989
|
/**
|
|
923
|
-
* Map a base content position
|
|
924
|
-
* offset
|
|
990
|
+
* Map a base content position (a USV index into `Content.text`, not a UTF-16
|
|
991
|
+
* offset) through a `delta` to its new USV position: the pure position-mapping
|
|
925
992
|
* codec an editor bridge composes to hold a caret stable across a `revise`.
|
|
926
993
|
* `assoc` decides the side of a same-position insertion (`"after"` moves past
|
|
927
994
|
* it). Throws on a malformed `delta`.
|
|
@@ -931,14 +998,14 @@ export function mapPos(delta: Delta, pos: number, assoc: Assoc): number;
|
|
|
931
998
|
/**
|
|
932
999
|
* Parse a canonical document-model `Diagnostic.path`
|
|
933
1000
|
* (`cards.<kind>[<i>].<field>`, `main.body`, `recipients[0].name`) into its
|
|
934
|
-
* structured [`DocPathSeg`] segments
|
|
1001
|
+
* structured [`DocPathSeg`] segments: the exported inverse of the engine's
|
|
935
1002
|
* one path serializer, so a consumer routes on segments instead of regexing
|
|
936
1003
|
* the string. Throws on a malformed path.
|
|
937
1004
|
*/
|
|
938
1005
|
export function parseDocPath(path: string): DocPathSeg[];
|
|
939
1006
|
|
|
940
1007
|
/**
|
|
941
|
-
* Rebase `markdown` onto a `base` content
|
|
1008
|
+
* Rebase `markdown` onto a `base` content, the pure, document-free twin of
|
|
942
1009
|
* `revise`: cold-import + `diff_import`, returning the new `content` and the
|
|
943
1010
|
* text `delta` (its offsets USV indices into `Content.text`, surviving anchors
|
|
944
1011
|
* rebased). Use it to compute a revise without a document in hand; `revise(addr,
|