@quillmark/wasm 0.97.0 → 0.99.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/core/wasm.d.ts CHANGED
@@ -44,7 +44,7 @@ export interface Card {
44
44
  seed?: Record<string, unknown>;
45
45
  payloadItems: PayloadItem[];
46
46
  /**
47
- * The card body as canonical `Content` the source-of-truth content model.
47
+ * The card body as canonical `Content`: the source-of-truth content model.
48
48
  * Always this content shape on read, never a markdown string. For the markdown
49
49
  * projection call the codec `exportMarkdown(card.body)`. Write a body back
50
50
  * with `doc.install(addr, rt)` / `doc.revise(addr, md)`, or via `CardInput.body`.
@@ -53,10 +53,10 @@ export interface Card {
53
53
  }
54
54
 
55
55
  /**
56
- * A card written *into* a document the input twin of `Card`, accepted by
56
+ * A card written *into* a document: the input twin of `Card`, accepted by
57
57
  * `Document.insertCard`. Like `Card` but `body` also
58
58
  * 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
59
+ * needn't build the `Content` shape), and every field but `kind` is optional:
60
60
  * an absent field defaults (no payload items, an empty body). Write one inline
61
61
  * (`{ kind, body }`) or build it with `Document.makeCard`.
62
62
  */
@@ -71,7 +71,7 @@ export interface CardInput {
71
71
  }
72
72
 
73
73
  /**
74
- * Canonical richtext content the content model for a card body (and richtext
74
+ * Canonical richtext content: the content model for a card body (and richtext
75
75
  * fields). One text sequence over a single coordinate space (Unicode scalar
76
76
  * values): `text` plus line attributes, anchored `marks`, and embedded
77
77
  * `islands`. Every edit is a splice; markdown is a projection, not the model.
@@ -84,27 +84,38 @@ export interface Content {
84
84
  islands: ContentIsland[];
85
85
  }
86
86
 
87
- /** One `\n`-separated segment of `Content.text`, in order. */
87
+ /** One `\n`-separated segment of `Content.text`, in order. `kind` is an open set
88
+ * (as on `ContentIsland` and `ContentMark`): a role this build does not know
89
+ * round-trips with opaque `attrs` and renders as a paragraph, so a document
90
+ * carrying a future block construct still opens. The open arm blocks discriminant
91
+ * narrowing, so read `level`/`lang` behind a check of the arm you want. */
88
92
  export type ContentLine = {
89
93
  containers: ContentContainer[];
90
94
  /** A within-block hard line break rather than a new block. Omitted (false) in the common case. */
91
95
  continues?: boolean;
92
- } & (
96
+ } & ContentLineKind;
97
+
98
+ /** A line's block role, declared once for `ContentLine` and the `setKind` op:
99
+ * a new role is one edit here, as for `ContentContainer`. */
100
+ export type ContentLineKind =
93
101
  | { kind: "para" }
94
102
  | { kind: "heading"; level: number }
95
103
  | { kind: "code"; lang?: string }
96
104
  | { kind: "island" }
97
105
  | { kind: "rule" }
98
- );
106
+ | { kind: string; attrs: unknown };
99
107
 
100
- /** An ancestor block a line nests inside, outermost first. */
108
+ /** An ancestor block a line nests inside, outermost first. Open like
109
+ * `ContentLine.kind`: an unrecognized container round-trips with opaque `attrs`
110
+ * and renders transparently (its lines sit at the enclosing level). */
101
111
  export type ContentContainer =
102
112
  | { container: "list_item"; ordered: boolean; start: number; ordinal: number }
103
- | { container: "quote" };
113
+ | { container: "quote" }
114
+ | { container: string; attrs: unknown };
104
115
 
105
116
  /** A mark over char range `[start, end)` into `Content.text`. The open `type`
106
117
  * arm blocks discriminant narrowing (as on `ContentIsland`), so read a
107
- * payload-carrying arm behind its guard `isLinkMark` (`url`) / `isAnchorMark`
118
+ * payload-carrying arm behind its guard: `isLinkMark` (`url`) / `isAnchorMark`
108
119
  * (`id`), from `@quillmark/wasm/runtime`; the bare arms carry no payload. An
109
120
  * `anchor`'s `id` is a caller-supplied, opaque handle, unique per `Content` and
110
121
  * invariant while the mark lives (positions rebase, the id never does); it has no
@@ -117,7 +128,7 @@ export type ContentMark = { start: number; end: number } & (
117
128
  | { type: string; attrs: unknown }
118
129
  );
119
130
 
120
- /** A cell in a `TableProps` its plain `text` plus the `marks` over it. `marks`
131
+ /** A cell in a `TableProps`: its plain `text` plus the `marks` over it. `marks`
121
132
  * rides the same wire shape as prose `ContentMark`, but each mark's `start`/`end`
122
133
  * are USV offsets into this cell's `text` (`0..text.length`), not into
123
134
  * `Content.text`. */
@@ -145,12 +156,16 @@ export interface ImageProps {
145
156
  * open set: the engine pins `props` as `TableProps` for `table` and `ImageProps`
146
157
  * for `image`; an island of any other type round-trips with opaque `props`. Like
147
158
  * `ContentMark`, the open `type` arm means a discriminant check does not itself
148
- * narrow `props` read `props` as the matching shape behind the `isTableIsland` /
159
+ * narrow `props`: read `props` as the matching shape behind the `isTableIsland` /
149
160
  * `isImageIsland` guards (from `@quillmark/wasm/runtime`), which narrow it. */
161
+ /** How faithfully the markdown projection can carry an island. Open like an
162
+ * island `type`: a class this build does not know round-trips verbatim, and
163
+ * reads as `unrepresentable`. */
164
+ export type ContentLossClass = "lossless" | "degraded" | "unrepresentable" | (string & {});
165
+
150
166
  export type ContentIsland = {
151
167
  id: string;
152
- /** How faithfully the markdown projection can carry this island. */
153
- loss: "lossless" | "degraded" | "unrepresentable";
168
+ loss: ContentLossClass;
154
169
  } & (
155
170
  | { type: "table"; props: TableProps }
156
171
  | { type: "image"; props: ImageProps }
@@ -158,14 +173,14 @@ export type ContentIsland = {
158
173
  );
159
174
 
160
175
  /**
161
- * A write address one navigation concept for the whole `Document` surface. An
176
+ * A write address: one navigation concept for the whole `Document` surface. An
162
177
  * absent `field` targets the card body; an absent `card` targets the main card.
163
178
  * `{}` is the main-card body; `{ card: 2 }` the body of the composable card at
164
179
  * index 2; `{ field: "intro" }` the main card's `intro` field; `{ card: 2,
165
180
  * field: "intro" }` a card field.
166
181
  *
167
182
  * On the `Addr`-taking verbs a **bare string** is shorthand for `{ field: name }`
168
- * `doc.storeField("qty", 3)`, `doc.revise("intro", md)` the one coercion
183
+ * (`doc.storeField("qty", 3)`, `doc.revise("intro", md)`) the one coercion
169
184
  * rule. A bare number is *not* an addr (`{ card: 2 }` is the self-documenting
170
185
  * spelling), so no third navigation idiom re-fragments the surface.
171
186
  */
@@ -175,7 +190,7 @@ export interface Addr {
175
190
  }
176
191
 
177
192
  /**
178
- * A card-only address the axis the card-scoped verbs (`storeFields`,
193
+ * A card-only address: the axis the card-scoped verbs (`storeFields`,
179
194
  * `storeExt`, `getExt`, `commitFields`, …) take. An absent `card` targets the
180
195
  * main card. A present `field` throws: a card address takes only `card`, and a
181
196
  * would-be nested write is a bug the error names rather than silently ignores.
@@ -186,7 +201,7 @@ export interface CardAddr {
186
201
 
187
202
  /**
188
203
  * A text-splice change set over the USV content (CodeMirror `ChangeSet`
189
- * semantics) plain, structured-clone-able data. Returned by `revise` and by
204
+ * semantics): plain, structured-clone-able data. Returned by `revise` and by
190
205
  * the `rebase` codec; map a stored position through it with `mapPos`.
191
206
  */
192
207
  export interface Delta {
@@ -200,7 +215,7 @@ export type Assoc = "before" | "after";
200
215
  * A mark edit in final-text coordinates (post-delta, post-line-op). `add` /
201
216
  * `remove` carry the `ContentMark` vocabulary (`{ type, … }`); `removeAnchor`
202
217
  * drops one identity anchor by id. An `add` of an `anchor` requires a non-empty
203
- * `id` not already live in the field a collision or the empty id throws
218
+ * `id` not already live in the field: a collision or the empty id throws
204
219
  * (ids are caller-supplied and unique per `Content`; DOCUMENT_STORAGE
205
220
  * § Anchor-id identity).
206
221
  */
@@ -216,18 +231,14 @@ export type MarkOp =
216
231
  /**
217
232
  * A line/block edit. `split`/`join` splice `\n`; `setKind`/`setContainers`/
218
233
  * `setContinues` touch metadata. `setContinues` sets/clears a line's within-block
219
- * hard-break flag (`ContentLine.continues`) the op-grained way to lower a
234
+ * hard-break flag (`ContentLine.continues`): the op-grained way to lower a
220
235
  * Shift+Enter hard break or a new code-fence interior line; `continues: true` on
221
236
  * line 0 is rejected (nothing precedes it to continue).
222
237
  */
223
238
  export type LineOp =
224
239
  | { op: "split"; at: number }
225
240
  | { op: "join"; line: number }
226
- | ({ op: "setKind"; line: number } & (
227
- | { kind: "para" | "island" | "rule" }
228
- | { kind: "heading"; level: number }
229
- | { kind: "code"; lang?: string }
230
- ))
241
+ | ({ op: "setKind"; line: number } & ContentLineKind)
231
242
  | { op: "setContainers"; line: number; containers: ContentContainer[] }
232
243
  | { op: "setContinues"; line: number; continues: boolean };
233
244
 
@@ -246,7 +257,7 @@ export interface ChangeBundle {
246
257
 
247
258
  /**
248
259
  * One segment of a parsed `Diagnostic.path` (see `parseDocPath`). The head
249
- * carries the document-model root `main` (only before `body`), a `card`
260
+ * carries the document-model root: `main` (only before `body`), a `card`
250
261
  * (`kind: null` is the unknown-kind `cards[i]` form), or a `field`; the tail is
251
262
  * `field` / `index` / a terminal `body`.
252
263
  */
@@ -264,7 +275,7 @@ export type FieldSource = "authored" | "default" | "zero";
264
275
 
265
276
  /**
266
277
  * One resolved row: its `name`, the value the render projection would use, and
267
- * the `FieldSource` rung it came from. Rows are an ordered array declaration
278
+ * the `FieldSource` rung it came from. Rows are an ordered array: declaration
268
279
  * order is structural, not object-key order. The card body is a `body` sibling
269
280
  * on its card, never a row in `fields`. Diagnostics stay `Quill.validate`'s;
270
281
  * schema guidance (`example:`, labels) reads from `Quill.schema`.
@@ -276,7 +287,7 @@ export interface ResolvedField {
276
287
  }
277
288
 
278
289
  /**
279
- * The main card's resolved rows in declaration order, plus its body row
290
+ * The main card's resolved rows in declaration order, plus its body row:
280
291
  * `null` when the main enables no body.
281
292
  */
282
293
  export interface ResolvedMain {
@@ -287,7 +298,7 @@ export interface ResolvedMain {
287
298
  /**
288
299
  * One composable card's resolved rows in declaration order, with its authored
289
300
  * `kind` (`null` for an unknown-kind card), its document-array `index`, and its
290
- * body row `null` when the kind enables no body.
301
+ * body row: `null` when the kind enables no body.
291
302
  */
292
303
  export interface ResolvedCard {
293
304
  kind: string | null;
@@ -298,7 +309,7 @@ export interface ResolvedCard {
298
309
 
299
310
  /**
300
311
  * The resolved-value view (`Quill.resolve`): the main card and every
301
- * composable card. Value and provenance only completeness and errors stay
312
+ * composable card. Value and provenance only: completeness and errors stay
302
313
  * `Quill.validate`.
303
314
  */
304
315
  export interface Resolved {
@@ -319,7 +330,7 @@ export interface QuillFieldUi {
319
330
  }
320
331
 
321
332
  /** One entry in a card's `ui.groups` registry: a display-label override for the
322
- * group id (the map key). An empty object carries no override the consumer
333
+ * group id (the map key). An empty object carries no override: the consumer
323
334
  * derives the label from the id (`memo_for` → "Memo For"), as it does a field
324
335
  * label from its key. */
325
336
  export interface QuillGroupUi {
@@ -331,7 +342,7 @@ export interface QuillCardUi {
331
342
  title?: string;
332
343
  /** The card's group registry: the ordered table of contents naming every
333
344
  * group a field's `ui.group` may reference. The map key is the group id, and
334
- * key order is declaration order the display-order contract, the same one
345
+ * key order is declaration order: the display-order contract, the same one
335
346
  * `fields` key order carries. Absent when the card declares no groups (or
336
347
  * uses the deprecated implicit-group form). */
337
348
  groups?: Record<string, QuillGroupUi>;
@@ -369,7 +380,7 @@ export interface QuillFieldSchema {
369
380
  properties?: Record<string, QuillFieldSchema>;
370
381
  items?: QuillFieldSchema;
371
382
  /** Present (and `true`) on a `richtext` or `plaintext` field declared
372
- * `inline` the single-paragraph, container-free, island-free constraint.
383
+ * `inline`: the single-paragraph, container-free, island-free constraint.
373
384
  * Core serializes `inline: true` into the schema JSON; absent otherwise. */
374
385
  inline?: boolean;
375
386
  }
@@ -410,24 +421,39 @@ export interface QuillMetadata {
410
421
  }
411
422
 
412
423
 
424
+ /**
425
+ * Diagnostic message (error or warning)
426
+ */
413
427
  export interface Diagnostic {
414
428
  severity: Severity;
415
429
  code?: string;
416
430
  message: string;
417
431
  location?: Location;
432
+ /**
433
+ * Document-model path anchor (e.g. `\"cards.indorsement[0].signature_block\"`).
434
+ *
435
+ * Set on schema validation diagnostics; `undefined` otherwise. See the
436
+ * Rust `quillmark_core::error` module docs for the path grammar.
437
+ */
418
438
  path?: string;
419
439
  hint?: string;
420
440
  sourceChain?: string[];
421
441
  }
422
442
 
443
+ /**
444
+ * Severity levels for diagnostics
445
+ */
446
+ export type Severity = "error" | "warning";
447
+
448
+ /**
449
+ * Source location for errors and warnings
450
+ */
423
451
  export interface Location {
424
452
  file: string;
425
453
  line: number;
426
454
  column: number;
427
455
  }
428
456
 
429
- export type Severity = "error" | "warning";
430
-
431
457
 
432
458
  /**
433
459
  * Typed in-memory Quillmark document.
@@ -437,7 +463,7 @@ export class Document {
437
463
  [Symbol.dispose](): void;
438
464
  /**
439
465
  * **Apply** a committed content edit `bundle` (`{ delta?, lineOps?, markOps? }`)
440
- * at `addr` the editor splice: text delta first, then line ops, then mark
466
+ * at `addr`, the editor splice: text delta first, then line ops, then mark
441
467
  * ops (mark ranges in final-text coordinates), each all-or-nothing. An absent
442
468
  * `addr.field` targets the body, an absent `addr.card` the main card.
443
469
  *
@@ -454,7 +480,7 @@ export class Document {
454
480
  */
455
481
  static blueprintInstruction(quill_name: string): string;
456
482
  /**
457
- * A single composable card by index the whole `Card`, the card-indexed
483
+ * A single composable card by index: the whole `Card`, the card-indexed
458
484
  * twin of the [`main`](Self::main) getter, so reading one card need not
459
485
  * materialize every card via [`cards`](Self::cards). An out-of-range
460
486
  * `index` throws `edit::index_out_of_range`, matching the card write
@@ -509,54 +535,54 @@ export class Document {
509
535
  static fromMarkdown(markdown: string): Document;
510
536
  /**
511
537
  * The whole `$ext` map at `addr` (a card address, absent `card` = main), or
512
- * `undefined` when the card carries none. The fine-grained `$ext` read
538
+ * `undefined` when the card carries none. The fine-grained `$ext` read:
513
539
  * your own state without serializing the whole card. Throws on a present
514
540
  * `field` (a card address takes only `card`) or an out-of-range card.
515
541
  */
516
542
  getExt(addr?: CardAddr): Record<string, unknown> | undefined;
517
543
  /**
518
544
  * The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
519
- * = main), or `undefined`. The namespace-scoped `$ext` read your own slot
545
+ * = main), or `undefined`. The namespace-scoped `$ext` read: your own slot
520
546
  * without a whole-card serialize, and non-destructive (unlike
521
547
  * `removeExtNamespace`). Throws on a present `field` or an out-of-range card.
522
548
  */
523
549
  getExtNamespace(addr: CardAddr, ns: string): unknown;
524
550
  /**
525
- * The **body** markdown projection the main body, or a composable card's
526
- * body (`{ card }`) the on-demand, lossy export (content-only marks do not
551
+ * The **body** markdown projection (the main body, or a composable card's
552
+ * body (`{ card }`)) the on-demand, lossy export (content-only marks do not
527
553
  * survive markdown). A body's type is a format fact, not a schema fact, so
528
554
  * this read stays quill-free; a body is never absent.
529
555
  *
530
556
  * `addr` is an optional **card address** (`{ card }`, absent = main). A
531
- * present `field` throws a field's markdown is read through the
557
+ * present `field` throws: a field's markdown is read through the
532
558
  * schema-plane `quill.reader(doc).get(field)`, which interprets by declared
533
- * type (#978). An out-of-range `addr.card` throws.
559
+ * type. An out-of-range `addr.card` throws.
534
560
  */
535
561
  getMarkdown(addr?: CardAddr): string;
536
562
  /**
537
- * Read the **verbatim stored value** at `addr` the raw payload value of a
563
+ * Read the **verbatim stored value** at `addr`: the raw payload value of a
538
564
  * field (a content object for a richtext field, a scalar/array/object
539
565
  * otherwise), or the **body content** when `addr.field` is absent. A bare
540
566
  * string is `Addr` shorthand for `{ field }`. Reads are total over the field
541
567
  * axis: an absent field is `undefined`; only an out-of-range `addr.card`
542
568
  * throws `edit::index_out_of_range`. Needs no schema, so it lives on
543
- * `Document` the read echo of the verbatim `store*` write, distinct from
569
+ * `Document`: the read echo of the verbatim `store*` write, distinct from
544
570
  * the interpreted schema-plane [`reader.get`](Self::reader_get). For the
545
571
  * markdown projection use [`getMarkdown`](Self::get_markdown) (body) or
546
572
  * `reader.get` (a field's declared type).
547
573
  */
548
574
  getStored(addr: Addr | string): unknown;
549
575
  /**
550
- * Insert a card the single insertion verb: `at` absent appends, a number
576
+ * Insert a card, the single insertion verb: `at` absent appends, a number
551
577
  * inserts at that index (must be in `0..=cards.length`). Accepts a
552
- * `CardInput` a card read back (`cards` / `removeCard` / `quill.seedCard`),
578
+ * `CardInput`: a card read back (`cards` / `removeCard` / `quill.seedCard`),
553
579
  * a [`makeCard`](Document::make_card) result, or a bare `{ kind, body }`
554
580
  * (every returned `Card` is a valid `CardInput`). Throws if `card.kind` is
555
581
  * not a valid kind name, or if `at` is out of range.
556
582
  */
557
583
  insertCard(card: CardInput, at?: number): void;
558
584
  /**
559
- * **Install** a richtext value at `addr` **value semantics**, content only.
585
+ * **Install** a richtext value at `addr`: **value semantics**, content only.
560
586
  * Stores exactly `rt` (a canonical `Content` content object); the identity
561
587
  * anchors of any previous value are gone. An absent `addr.field` targets the
562
588
  * body, an absent `addr.card` the main card. For "here's new markdown," use
@@ -570,29 +596,37 @@ export class Document {
570
596
  install(addr: Addr | string, rt: Content): void;
571
597
  /**
572
598
  * Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
573
- * shorthand for `{ field }`. `false` for an absent field (truthful it isn't
599
+ * shorthand for `{ field }`. `false` for an absent field (truthful: it isn't
574
600
  * marked) and for a body address (a body is never a fill). Only an
575
601
  * out-of-range `addr.card` throws.
576
602
  */
577
603
  isFill(addr: Addr | string): boolean;
578
604
  /**
579
605
  * Replace this document's contents **in place** from a versioned storage
580
- * DTO string the mutating twin of the static
606
+ * DTO string: the mutating twin of the static
581
607
  * [`fromJson`](Document::from_json) constructor. Parse-time `warnings` are
582
608
  * cleared. Throws (leaving the document unchanged) on an invalid DTO.
583
609
  *
584
610
  * The cross-WASM-memory `Document` bridge: mutate a document on a
585
611
  * backend-memory clone, then write the mutated state back into the caller's
586
- * canonical document with this the one way to update a live handle across
612
+ * canonical document with this, the one way to update a live handle across
587
613
  * the linear-memory seam without the caller re-binding its variable.
588
614
  */
589
615
  loadJson(json: string): void;
590
616
  /**
591
- * Build a fresh `Card` from a kind and a flat field map the ergonomic
617
+ * Build a fresh `Card` from a kind and a flat field map: the ergonomic
592
618
  * constructor for `insertCard`. `fields` is an optional
593
619
  * `Record<string, unknown>` (each entry becomes a card field, in
594
- * insertion order); `body` defaults to `""`. Kind validity is checked by
595
- * `insertCard`, not here.
620
+ * insertion order); `body` defaults to `""`.
621
+ *
622
+ * Sugar, not a required step: `insertCard` takes any `Card` object, and
623
+ * `removeCard` returns one, so a card round-trips without passing through
624
+ * here.
625
+ *
626
+ * Checks only what a detached card can decide alone: field-name grammar
627
+ * and value depth. Kind validity is positional (`main` is right for the
628
+ * root, reserved for a composable card) so `insertCard` is its gate, and
629
+ * any kind string is accepted here.
596
630
  */
597
631
  static makeCard(kind: string, fields?: Record<string, unknown>, body?: string): Card;
598
632
  /**
@@ -600,7 +634,7 @@ export class Document {
600
634
  */
601
635
  moveCard(from: number, to: number): void;
602
636
  /**
603
- * `new Document(quillRef)` a blank document: a main card carrying only
637
+ * `new Document(quillRef)`, a blank document: a main card carrying only
604
638
  * `$quill`, an empty body, and no composable cards. The programmatic
605
639
  * blank canvas: absent fields resolve at render time (`default`, else
606
640
  * type-empty zero), so nothing the caller did not set reaches the
@@ -611,7 +645,7 @@ export class Document {
611
645
  /**
612
646
  * The canonical `$quill` reference grammar as author-facing text. Core is
613
647
  * the single source of truth: drive schema `describe` and validation
614
- * messages from this instead of re-stating the rule it matches the
648
+ * messages from this instead of re-stating the rule; it matches the
615
649
  * `hint` on `parse::invalid_quill_reference`. Cache it; the value never
616
650
  * changes.
617
651
  */
@@ -619,7 +653,7 @@ export class Document {
619
653
  removeCard(index: number): Card | undefined;
620
654
  /**
621
655
  * Remove the `$ext` map on the card `addr` targets *entirely*, returning the
622
- * previous map or `undefined` a blunt escape hatch that discards every
656
+ * previous map or `undefined`: a blunt escape hatch that discards every
623
657
  * namespace at once (prefer `removeExtNamespace`). `addr` is a card address
624
658
  * (absent = main). Throws on a present `field` or an out-of-range card.
625
659
  */
@@ -645,7 +679,7 @@ export class Document {
645
679
  */
646
680
  removeSeedNamespace(card_kind: string): any;
647
681
  /**
648
- * **Revise** the richtext value at `addr` from a markdown string **edit
682
+ * **Revise** the richtext value at `addr` from a markdown string: **edit
649
683
  * semantics**, the default write path, returning the text `Delta`. Imports
650
684
  * the markdown, diffs it against the current value, rebases surviving
651
685
  * identity anchors, and returns the change an editor bridge maps its own
@@ -658,7 +692,7 @@ export class Document {
658
692
  revise(addr: Addr | string, markdown: string): Delta;
659
693
  /**
660
694
  * Read the `schema` version tag from a raw storage DTO string without a
661
- * full parse, or `undefined`. Returns unknown future versions as-is
695
+ * full parse, or `undefined`. Returns unknown future versions as-is:
662
696
  * useful to distinguish "build too old" from "payload corrupt" when
663
697
  * `fromJson` throws.
664
698
  */
@@ -667,7 +701,7 @@ export class Document {
667
701
  * The main card's `$seed` overlay object for `kind` (the `$seed[kind]`
668
702
  * entry), or `undefined` when absent. The cheap read that feeds
669
703
  * `quill.seedCard(kind, overlay)` without serializing the whole main card
670
- * via [`main`](Self::main) to fish out one key and it keeps `seedCard`
704
+ * via [`main`](Self::main) to fish out one key, and it keeps `seedCard`
671
705
  * pure: the quill still never reads the document.
672
706
  */
673
707
  seedOverlay(kind: string): Record<string, unknown> | undefined;
@@ -685,41 +719,41 @@ export class Document {
685
719
  * Replace the opaque `$ext` map on the card `addr` targets (a card address,
686
720
  * absent `card` = main). `value` must be a plain object. `$ext` carries
687
721
  * out-of-band consumer state and never reaches the rendered output; pass
688
- * `{}` for an explicit empty `$ext`. Quill-free and verbatim an opaque
722
+ * `{}` for an explicit empty `$ext`. Quill-free and verbatim: an opaque
689
723
  * `store` verb. Throws on a present `field` or an out-of-range card.
690
724
  */
691
725
  storeExt(addr: CardAddr, value: any): void;
692
726
  /**
693
727
  * Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
694
- * sibling namespaces the recommended `$ext` write. `addr` is a card
695
- * address (absent = main). Quill-free and verbatim an opaque `store` verb.
728
+ * sibling namespaces: the recommended `$ext` write. `addr` is a card
729
+ * address (absent = main). Quill-free and verbatim: an opaque `store` verb.
696
730
  * Throws on a present `field` or an out-of-range card.
697
731
  */
698
732
  storeExtNamespace(addr: CardAddr, ns: string, value: any): void;
699
733
  /**
700
- * Store a field verbatim at `addr` the opaque store (**store** = verbatim,
734
+ * Store a field verbatim at `addr`: the opaque store (**store** = verbatim,
701
735
  * coercion deferred to render; the typed write is
702
736
  * [`commitField`](Document::commit_field)). A bare string is `Addr`
703
737
  * shorthand for `{ field }`, so `doc.storeField("qty", 3)` reads as written;
704
738
  * `{ card: 2, field: "qty" }` targets a composable card. Clears any
705
- * `!must_fill` marker. A body address (no `field`) throws a body is never
739
+ * `!must_fill` marker. A body address (no `field`) throws: a body is never
706
740
  * opaque; write it with `revise` / `install` / `writer.setBody`. Throws on
707
741
  * an out-of-range card or a malformed name.
708
742
  */
709
743
  storeField(addr: Addr | string, value: any): void;
710
744
  /**
711
- * Store several fields verbatim and atomically on the card `addr` targets
745
+ * Store several fields verbatim and atomically on the card `addr` targets:
712
746
  * the opaque store's batch. `addr` is a **card address** (`{ card }`, absent
713
747
  * = main); a present `field` throws. The batch verb takes the address first
714
748
  * and is never shape-overloaded, because `card` is a legal field name:
715
749
  * `storeFields({}, fields)` is the main card, `storeFields({ card: 2 },
716
- * fields)` a composable one never ambiguous with "set field `card`".
750
+ * fields)` a composable one, never ambiguous with "set field `card`".
717
751
  * Nothing is applied on error; the thrown error's `diagnostics` carry one
718
752
  * entry per offending field. Throws on an out-of-range card.
719
753
  */
720
754
  storeFields(addr: CardAddr, fields: Record<string, unknown>): void;
721
755
  /**
722
- * Store a field verbatim at `addr` and mark it `!must_fill` the opaque
756
+ * Store a field verbatim at `addr` and mark it `!must_fill`: the opaque
723
757
  * store's fill variant, card-capable (a bare string or `{ field }` for main,
724
758
  * `{ card, field }` for a composable card). A body address throws. Same
725
759
  * validation as [`storeField`](Document::store_field).
@@ -727,9 +761,9 @@ export class Document {
727
761
  storeFill(addr: Addr | string, value: any): void;
728
762
  /**
729
763
  * Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
730
- * under `cardKind`, preserving sibling kinds `$seed` lives on the main
764
+ * under `cardKind`, preserving sibling kinds: `$seed` lives on the main
731
765
  * card by model, so this takes no address. Sets the starting values new
732
- * cards of that kind spawn with. Quill-free and verbatim an opaque `store`
766
+ * cards of that kind spawn with. Quill-free and verbatim: an opaque `store`
733
767
  * verb. Throws if `overlay` cannot be serialized or nests too deep.
734
768
  */
735
769
  storeSeedNamespace(card_kind: string, overlay: any): void;
@@ -737,7 +771,7 @@ export class Document {
737
771
  * Serialize this document to a versioned storage DTO string.
738
772
  *
739
773
  * Prefer this over `toMarkdown` for persistence across restarts or crate
740
- * upgrades the wire format is frozen per `schema` version. Parse-time
774
+ * upgrades: the wire format is frozen per `schema` version. Parse-time
741
775
  * `warnings` are excluded from the DTO.
742
776
  *
743
777
  * Output is **byte-deterministic** within a `schema` version: equal
@@ -751,7 +785,7 @@ export class Document {
751
785
  toMarkdown(): string;
752
786
  /**
753
787
  * Like [`fromJson`](Document::from_json) but returns `undefined` instead
754
- * of throwing when `json` is not a valid storage DTO use to
788
+ * of throwing when `json` is not a valid storage DTO: use to
755
789
  * discriminate format without exceptions as control flow.
756
790
  * `undefined` means "not a storage DTO"; `fromMarkdown` still throws on
757
791
  * genuinely malformed markdown.
@@ -764,7 +798,7 @@ export class Document {
764
798
  readonly cards: Card[];
765
799
  /**
766
800
  * The document's main (entry) card. Allocates and serializes on each
767
- * call cache locally if read in a hot loop.
801
+ * call: cache locally if read in a hot loop.
768
802
  */
769
803
  readonly main: Card;
770
804
  readonly quillRef: string;
@@ -776,7 +810,7 @@ export class Quill {
776
810
  free(): void;
777
811
  [Symbol.dispose](): void;
778
812
  /**
779
- * Build a quill from a file tree. Pure no backend, no engine; the
813
+ * Build a quill from a file tree. Pure: no backend, no engine; the
780
814
  * declared backend is resolved later, at render time.
781
815
  *
782
816
  * Accepts either a `Map<string, Uint8Array>` or a plain object
@@ -786,11 +820,11 @@ export class Quill {
786
820
  */
787
821
  static fromTree(tree: Map<string, Uint8Array>): Quill;
788
822
  /**
789
- * The resolved-value view of `doc` against this quill's schema for every
823
+ * The resolved-value view of `doc` against this quill's schema: for every
790
824
  * declared field the value the render projection would use and the
791
825
  * `FieldSource` rung it came from (`"authored" | "default" | "zero"`), in
792
826
  * one call. The card body is a `body` sibling on its card (row `name`
793
- * `"body"`), never a row in `fields` `null` when the kind enables no body.
827
+ * `"body"`), never a row in `fields`: `null` when the kind enables no body.
794
828
  *
795
829
  * Value and provenance only: completeness and errors stay `validate`'s
796
830
  * (a consumer merges it with its own diagnostic producers regardless), and
@@ -807,11 +841,11 @@ export class Quill {
807
841
  * Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
808
842
  * template-derived document inherits its curated starting values; omit it
809
843
  * (or pass `undefined` / `null`) for the bare schema seed. `overlay` is a
810
- * plain object this reads the document, it does not mutate it.
844
+ * plain object: this reads the document, it does not mutate it.
811
845
  */
812
846
  seedCard(card_kind: string, overlay: Record<string, unknown> | undefined): Card | undefined;
813
847
  /**
814
- * Seed a starter `Document` from the schema the main card plus one
848
+ * Seed a starter `Document` from the schema, the main card plus one
815
849
  * instance of each composable card kind, each committing its fields'
816
850
  * `example:` values and leaving every other field absent (interpolated at
817
851
  * render: `default:`, else type-empty zero). Illustration-first: a field
@@ -820,14 +854,14 @@ export class Quill {
820
854
  */
821
855
  seedDocument(): Document;
822
856
  /**
823
- * Seed a starter main `Card` (carries `$quill`) from the schema the
857
+ * Seed a starter main `Card` (carries `$quill`) from the schema: the
824
858
  * `$kind: main` card of [`seedDocument`](Self::seed_document) in
825
859
  * isolation, committing each field's `example:` value. Returns the same
826
860
  * `Card` shape as the `Document.main` getter.
827
861
  */
828
862
  seedMain(): Card;
829
863
  /**
830
- * Flatten this quill back into its canonical file tree the inverse of
864
+ * Flatten this quill back into its canonical file tree: the inverse of
831
865
  * [`fromTree`](Self::from_tree). Round-trips: `Quill.fromTree(q.toTree())`
832
866
  * reproduces an equivalent quill.
833
867
  *
@@ -843,8 +877,8 @@ export class Quill {
843
877
  * Validate `doc` against this quill's schema, returning every diagnostic
844
878
  * (an empty array when the document is valid).
845
879
  *
846
- * Forwards the canonical `validation::*` diagnostics same `code`,
847
- * `path`, and `hint` the engine emits including the non-fatal
880
+ * Forwards the canonical `validation::*` diagnostics (same `code`,
881
+ * `path`, and `hint` the engine emits) including the non-fatal
848
882
  * `validation::must_fill` warning for each `!must_fill` marker left in
849
883
  * the document. Field values, defaults, and order are not part of this
850
884
  * surface: read them from the `Document` payload and `Quill.schema`
@@ -853,14 +887,14 @@ export class Quill {
853
887
  validate(doc: Document): Diagnostic[];
854
888
  /**
855
889
  * The *declared* backend identifier (`config.backend`, e.g. `"typst"`).
856
- * Intent, not a resolved capability capability (`supportedFormats` /
890
+ * Intent, not a resolved capability: capability (`supportedFormats` /
857
891
  * `supportsCanvas`) is read from the engine.
858
892
  */
859
893
  readonly backendId: string;
860
894
  readonly blueprint: string;
861
895
  /**
862
896
  * Identity snapshot of the `quill:` section of `Quill.yaml` plus any extra
863
- * `quill:` keys. Pure config the backend's output formats are a
897
+ * `quill:` keys. Pure config: the backend's output formats are a
864
898
  * resolved-backend capability read from the engine
865
899
  * (`Quillmark.supportedFormats`), not part of this snapshot.
866
900
  */
@@ -868,15 +902,15 @@ export class Quill {
868
902
  /**
869
903
  * Document schema for the quill: the user-fillable fields plus their
870
904
  * `ui` hints (title / group / compact / multiline). The single
871
- * field-metadata surface drives form editors and LLM/MCP consumers
872
- * alike. Key order in `fields`/`properties` is declaration order the
905
+ * field-metadata surface: drives form editors and LLM/MCP consumers
906
+ * alike. Key order in `fields`/`properties` is declaration order: the
873
907
  * ordering contract. Returns the `QuillSchema` shape.
874
908
  */
875
909
  readonly schema: QuillSchema;
876
910
  }
877
911
 
878
912
  /**
879
- * Export a canonical `Content` content to its markdown projection the pure
913
+ * Export a canonical `Content` content to its markdown projection: the pure
880
914
  * on-demand codec behind `exportMarkdown(card.body)`. Throws if `rt` is not a
881
915
  * canonical content.
882
916
  */
@@ -884,7 +918,7 @@ export function exportMarkdown(rt: Content): string;
884
918
 
885
919
  /**
886
920
  * Serialize structured [`DocPathSeg`] segments back to the canonical path
887
- * string the inverse of `parseDocPath`, for a consumer that builds a path
921
+ * string: the inverse of `parseDocPath`, for a consumer that builds a path
888
922
  * rather than reads one. Throws on a segment array the deserializer rejects,
889
923
  * and on an empty segment array (symmetric with `parseDocPath("")`, which
890
924
  * throws "empty path").
@@ -892,7 +926,7 @@ export function exportMarkdown(rt: Content): string;
892
926
  export function formatDocPath(segs: DocPathSeg[]): string;
893
927
 
894
928
  /**
895
- * Import a markdown string to a canonical `Content` content the pure,
929
+ * Import a markdown string to a canonical `Content` content: the pure,
896
930
  * document-free codec. Pair with `install(addr, importMarkdown(md))` to spell
897
931
  * the cold (anchor-losing) write at the call site; prefer `revise` for edit
898
932
  * semantics. Throws on an over-nested input.
@@ -905,8 +939,8 @@ export function importMarkdown(markdown: string): Content;
905
939
  export function init(): void;
906
940
 
907
941
  /**
908
- * Map a base content position a USV index into `Content.text`, not a UTF-16
909
- * offset through a `delta` to its new USV position: the pure position-mapping
942
+ * Map a base content position (a USV index into `Content.text`, not a UTF-16
943
+ * offset) through a `delta` to its new USV position: the pure position-mapping
910
944
  * codec an editor bridge composes to hold a caret stable across a `revise`.
911
945
  * `assoc` decides the side of a same-position insertion (`"after"` moves past
912
946
  * it). Throws on a malformed `delta`.
@@ -916,14 +950,14 @@ export function mapPos(delta: Delta, pos: number, assoc: Assoc): number;
916
950
  /**
917
951
  * Parse a canonical document-model `Diagnostic.path`
918
952
  * (`cards.<kind>[<i>].<field>`, `main.body`, `recipients[0].name`) into its
919
- * structured [`DocPathSeg`] segments the exported inverse of the engine's
953
+ * structured [`DocPathSeg`] segments: the exported inverse of the engine's
920
954
  * one path serializer, so a consumer routes on segments instead of regexing
921
955
  * the string. Throws on a malformed path.
922
956
  */
923
957
  export function parseDocPath(path: string): DocPathSeg[];
924
958
 
925
959
  /**
926
- * Rebase `markdown` onto a `base` content the pure, document-free twin of
960
+ * Rebase `markdown` onto a `base` content, the pure, document-free twin of
927
961
  * `revise`: cold-import + `diff_import`, returning the new `content` and the
928
962
  * text `delta` (its offsets USV indices into `Content.text`, surviving anchors
929
963
  * rebased). Use it to compute a revise without a document in hand; `revise(addr,