@quillmark/wasm 0.123.1 → 0.125.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/render/wasm.js CHANGED
@@ -26,11 +26,14 @@ export class Document {
26
26
  * leaves the document untouched. Field errors throw the same per-field
27
27
  * bundle as [`commitFields`](Self::commit_fields); an invalid kind or body,
28
28
  * or a bad position, throws a single-entry bundle keyed `$kind` / `$body`.
29
+ * Returns the fields' `parse::dropped_construct` warnings, then the body
30
+ * import's, anchored under the placed card.
29
31
  * @param {Quill} quill
30
32
  * @param {string} kind
31
33
  * @param {Record<string, unknown>} [fields]
32
34
  * @param {string} [body]
33
35
  * @param {number} [at]
36
+ * @returns {Diagnostic[]}
34
37
  */
35
38
  _addCard(quill, kind, fields, body, at) {
36
39
  try {
@@ -43,9 +46,11 @@ export class Document {
43
46
  wasm.document__addCard(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0, isLikeNone(fields) ? 0 : addHeapObject(fields), ptr1, len1, isLikeNone(at) ? Number.MAX_SAFE_INTEGER : (at) >>> 0);
44
47
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
45
48
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
46
- if (r1) {
47
- throw takeObject(r0);
49
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
50
+ if (r2) {
51
+ throw takeObject(r1);
48
52
  }
53
+ return takeObject(r0);
49
54
  } finally {
50
55
  wasm.__wbindgen_add_to_stack_pointer(16);
51
56
  }
@@ -68,9 +73,13 @@ export class Document {
68
73
  *
69
74
  * The `quill` handle is passed per call because a `Document` carries only a
70
75
  * `$quill` reference, not the resolved schema.
76
+ *
77
+ * Returns a `parse::dropped_construct` warning per construct a `richtext`
78
+ * markdown string in the value dropped, at the string's path.
71
79
  * @param {Quill} quill
72
80
  * @param {Addr | string} addr
73
81
  * @param {any} value
82
+ * @returns {Diagnostic[]}
74
83
  */
75
84
  _commitField(quill, addr, value) {
76
85
  try {
@@ -79,9 +88,11 @@ export class Document {
79
88
  wasm.document__commitField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
80
89
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
81
90
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
82
- if (r1) {
83
- throw takeObject(r0);
91
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
92
+ if (r2) {
93
+ throw takeObject(r1);
84
94
  }
95
+ return takeObject(r0);
85
96
  } finally {
86
97
  wasm.__wbindgen_add_to_stack_pointer(16);
87
98
  }
@@ -93,10 +104,12 @@ export class Document {
93
104
  * diagnostic contract as [`storeFields`](Document::store_fields) — nothing
94
105
  * applied on error, one `diagnostics` entry per offending field, including
95
106
  * `edit::unknown_field` for undeclared names. Throws on an out-of-range
96
- * card.
107
+ * card. Returns [`commitField`](Document::commit_field)'s warnings for
108
+ * every field, in batch order.
97
109
  * @param {Quill} quill
98
110
  * @param {CardAddr} addr
99
111
  * @param {Record<string, unknown>} fields
112
+ * @returns {Diagnostic[]}
100
113
  */
101
114
  _commitFields(quill, addr, fields) {
102
115
  try {
@@ -105,9 +118,11 @@ export class Document {
105
118
  wasm.document__commitFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
106
119
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
107
120
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
108
- if (r1) {
109
- throw takeObject(r0);
121
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
122
+ if (r2) {
123
+ throw takeObject(r1);
110
124
  }
125
+ return takeObject(r0);
111
126
  } finally {
112
127
  wasm.__wbindgen_add_to_stack_pointer(16);
113
128
  }
@@ -228,14 +243,40 @@ export class Document {
228
243
  wasm.__wbindgen_add_to_stack_pointer(16);
229
244
  }
230
245
  }
246
+ /**
247
+ * The ABI under `writer.reviseDocument`: a whole-document revise, then
248
+ * conform against `quill`. Throws when `markdown` declares a `$quill` this quill
249
+ * does not answer to, before any mutation.
250
+ * @param {Quill} quill
251
+ * @param {string} markdown
252
+ * @returns {DocumentRevised}
253
+ */
254
+ _reviseDocument(quill, markdown) {
255
+ try {
256
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
257
+ _assertClass(quill, Quill);
258
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ wasm.document__reviseDocument(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0);
261
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
262
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
263
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
264
+ if (r2) {
265
+ throw takeObject(r1);
266
+ }
267
+ return takeObject(r0);
268
+ } finally {
269
+ wasm.__wbindgen_add_to_stack_pointer(16);
270
+ }
271
+ }
231
272
  /**
232
273
  * Revise the content field at `addr` from authored text, typed *and*
233
274
  * anchor-preserving: the ABI under `writer.reviseField`. Surviving anchors
234
275
  * rebase as in [`revise`](Self::revise), then the diffed result is
235
276
  * schema-conformed, so a `richtext(inline)` field rejects a multi-block
236
- * result with `edit::field_not_inline`. Returns the text `Delta`. The codec
237
- * is the declared type's: `richtext` diffs markdown, `plaintext` literal
238
- * text.
277
+ * result with `edit::field_not_inline`. Returns the `Revised` receipt, its
278
+ * warnings anchored at the field. The codec is the declared type's:
279
+ * `richtext` diffs markdown, `plaintext` literal text, which drops nothing.
239
280
  *
240
281
  * `addr` must name a field; a body address throws, since a body carries no
241
282
  * field schema (use [`revise`](Self::revise)). An undeclared name throws
@@ -243,7 +284,7 @@ export class Document {
243
284
  * @param {Quill} quill
244
285
  * @param {Addr | string} addr
245
286
  * @param {string} text
246
- * @returns {Delta}
287
+ * @returns {Revised}
247
288
  */
248
289
  _reviseField(quill, addr, text) {
249
290
  try {
@@ -861,16 +902,18 @@ export class Document {
861
902
  /**
862
903
  * **Revise** the richtext value at `addr` from a markdown string: the
863
904
  * default write path. Imports the markdown, diffs it against the current
864
- * value, rebases surviving identity anchors, and returns the text `Delta` an
865
- * editor bridge maps its own positions through (`mapPos`). An absent
866
- * `addr.field` targets the body, an absent `addr.card` the main card; an
867
- * absent field cold-imports from empty.
905
+ * value, rebases surviving identity anchors, and returns the `Revised`
906
+ * receipt: the text `delta` an editor bridge maps its own positions through
907
+ * (`mapPos`), and a `parse::dropped_construct` warning per construct the
908
+ * import dropped, its `path` the address written. An absent `addr.field`
909
+ * targets the body, an absent `addr.card` the main card; an absent field
910
+ * cold-imports from empty.
868
911
  *
869
912
  * Throws on an out-of-range card, a malformed field name, a present
870
913
  * non-content field value, or an over-nested markdown input.
871
914
  * @param {Addr | string} addr
872
915
  * @param {string} markdown
873
- * @returns {Delta}
916
+ * @returns {Revised}
874
917
  */
875
918
  revise(addr, markdown) {
876
919
  try {
@@ -1051,8 +1094,33 @@ export class Document {
1051
1094
  }
1052
1095
  }
1053
1096
  /**
1054
- * Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
1055
- * result produces a `Document` equal to `self` by value and by type.
1097
+ * `toMarkdown` with each prose anchor of every body and content field
1098
+ * spelled read-only at its start where its line can hold the tag, and
1099
+ * listed with its field's path and line either way. An import drops every
1100
+ * tag, so `writer.reviseDocument` with the markdown keeps the anchors it keeps
1101
+ * with `toMarkdown`'s.
1102
+ * @returns {AnnotatedMarkdown}
1103
+ */
1104
+ toAnnotatedMarkdown() {
1105
+ try {
1106
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1107
+ wasm.document_toAnnotatedMarkdown(retptr, this.__wbg_ptr);
1108
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1109
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1110
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1111
+ if (r2) {
1112
+ throw takeObject(r1);
1113
+ }
1114
+ return takeObject(r0);
1115
+ } finally {
1116
+ wasm.__wbindgen_add_to_stack_pointer(16);
1117
+ }
1118
+ }
1119
+ /**
1120
+ * Emit canonical Quillmark Markdown. Re-parsing the result produces a
1121
+ * `Document` equal to `self` by value and by type, but for content: a body
1122
+ * or content field holds what its markdown spells, so its anchors drop and
1123
+ * its island ids re-mint. `toStored` keeps both.
1056
1124
  * @returns {string}
1057
1125
  */
1058
1126
  toMarkdown() {
@@ -1098,7 +1166,7 @@ export class Document {
1098
1166
  * The non-fatal diagnostics of the load that produced this document: parse
1099
1167
  * warnings, plus `conform::*` warnings when it came through `quill.parse`.
1100
1168
  * Session state, not document value: `equals` and the storage DTO exclude
1101
- * it, and `fromStored` / `loadStored` clear it.
1169
+ * it, and `fromStored` / `loadStored` / `writer.reviseDocument` clear it.
1102
1170
  * @returns {Diagnostic[]}
1103
1171
  */
1104
1172
  get warnings() {
@@ -1166,6 +1234,28 @@ export class LiveSession {
1166
1234
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1167
1235
  }
1168
1236
  }
1237
+ /**
1238
+ * Each address the current compile fills that a reader could want to
1239
+ * click, and the `DocPath` of the region reaching it: the address itself,
1240
+ * the nearest enclosing one a region carries (a row claim reaching its
1241
+ * cells), or `undefined` where no click does. Reflects the current compile.
1242
+ * @returns {FieldCoverage[]}
1243
+ */
1244
+ coverage() {
1245
+ try {
1246
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1247
+ wasm.livesession_coverage(retptr, this.__wbg_ptr);
1248
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1249
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1250
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1251
+ if (r2) {
1252
+ throw takeObject(r1);
1253
+ }
1254
+ return takeObject(r0);
1255
+ } finally {
1256
+ wasm.__wbindgen_add_to_stack_pointer(16);
1257
+ }
1258
+ }
1169
1259
  /**
1170
1260
  * The schema field whose content is under a point on `page`: the `DocPath`
1171
1261
  * address to focus in the editor, or `undefined` off any field's ink.
@@ -1206,9 +1296,9 @@ export class LiveSession {
1206
1296
  /**
1207
1297
  * The whole-field highlight boxes for `field`: one union rect per page over
1208
1298
  * the field's `span`-bearing content segments, the union `regions()` leaves
1209
- * derived. **Content only**: a field placed solely as a scalar reference or
1210
- * a bound widget carries no `span` and returns `[]`, its box being a single
1211
- * `regions()` rect. Reflects the current compile.
1299
+ * derived. **Content only**: a field placed solely as a scalar's ink, a
1300
+ * claim or a bound widget carries no `span` and returns `[]`, its box being
1301
+ * a single `regions()` rect. Reflects the current compile.
1212
1302
  * @param {string} field
1213
1303
  * @returns {FieldRegion[]}
1214
1304
  */
@@ -1347,9 +1437,9 @@ export class LiveSession {
1347
1437
  }
1348
1438
  }
1349
1439
  /**
1350
- * Schema-field geometry for this compiled session: each content field's
1351
- * **first placement** (one region per page it touches) plus widget and
1352
- * scalar-reference-site regions, keyed on the canonical `DocPath` address. A
1440
+ * Schema-field geometry for this compiled session: each piece of generated
1441
+ * ink's **first placement** (one region per page it touches) plus claim and
1442
+ * widget regions, keyed on the canonical `DocPath` address. A
1353
1443
  * field may appear more than once, so group by `field` (see `FieldRegion`).
1354
1444
  * A session-level query: no render, no byte artifact. The click direction is
1355
1445
  * `fieldAt`. Empty for backends that place no schema fields.
@@ -1763,9 +1853,10 @@ export class Quill {
1763
1853
  return takeObject(ret);
1764
1854
  }
1765
1855
  /**
1766
- * Validate `doc` against this quill's schema, returning every diagnostic
1767
- * (empty when the document is valid). Forwards the canonical
1768
- * `validation::*` diagnostics the engine emits.
1856
+ * Validate `doc` against this quill's schema, returning every diagnostic:
1857
+ * an error blocks a render, a warning does not. Forwards the engine's
1858
+ * `validation::*`, a markdown string's `parse::dropped_construct` and the
1859
+ * backend's `backend::declined_construct`.
1769
1860
  * @param {Document} doc
1770
1861
  * @returns {Diagnostic[]}
1771
1862
  */
@@ -1859,9 +1950,10 @@ export class Quillmark {
1859
1950
  }
1860
1951
  /**
1861
1952
  * Render `doc` against `quill` in one shot: `open` + `LiveSession.render`,
1862
- * with `doc.warnings`, then every `quill.validate` warning, ahead of the
1863
- * compile's in `warnings`. An unset `output_format` falls back to the
1864
- * backend's first supported format. `today` reads as on `open`.
1953
+ * with every `quill.validate` warning in `warnings`, a decline among the
1954
+ * compile's and the rest ahead of them; the load's stay on `doc.warnings`.
1955
+ * An unset `output_format` falls back to the backend's first supported
1956
+ * format. `today` reads as on `open`.
1865
1957
  * @param {Quill} quill
1866
1958
  * @param {Document} doc
1867
1959
  * @param {RenderOptions | null} [opts]
@@ -1983,7 +2075,7 @@ export function formatDiagnostic(diagnostic) {
1983
2075
  }
1984
2076
 
1985
2077
  /**
1986
- * Serialize structured [`DocPathSeg`] segments back to the canonical path
2078
+ * Serialize structured `DocPathSeg` segments back to the canonical path
1987
2079
  * string: the inverse of `parseDocPath`. Throws on a segment array the
1988
2080
  * deserializer rejects, and on an empty one.
1989
2081
  * @param {DocPathSeg[]} segs
@@ -2015,11 +2107,13 @@ export function formatDocPath(segs) {
2015
2107
  }
2016
2108
 
2017
2109
  /**
2018
- * Import a markdown string to canonical `Content`: the pure, document-free
2019
- * codec. `overwrite(addr, importMarkdown(md))` spells the cold, anchor-losing
2020
- * write; prefer `revise` for edit semantics. Throws on an over-nested input.
2110
+ * Import a markdown string: the pure, document-free codec. Returns the
2111
+ * canonical `content` and a `parse::dropped_construct` warning per construct
2112
+ * the import dropped, with no `path`. `overwrite(addr, importMarkdown(md).content)`
2113
+ * spells the cold, anchor-losing write; prefer `revise` for edit semantics.
2114
+ * Throws on an over-nested input.
2021
2115
  * @param {string} markdown
2022
- * @returns {Content}
2116
+ * @returns {Imported}
2023
2117
  */
2024
2118
  export function importMarkdown(markdown) {
2025
2119
  try {
@@ -2152,7 +2246,7 @@ export function mapPos(delta, pos, assoc) {
2152
2246
 
2153
2247
  /**
2154
2248
  * Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
2155
- * `main.body`, `recipients[0].name`) into structured [`DocPathSeg`] segments, so
2249
+ * `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
2156
2250
  * a consumer routes on segments instead of regexing the string. Throws on a
2157
2251
  * malformed path.
2158
2252
  * @param {string} path
@@ -2178,12 +2272,13 @@ export function parseDocPath(path) {
2178
2272
 
2179
2273
  /**
2180
2274
  * Rebase `markdown` onto a `base` content: the document-free twin of `revise`,
2181
- * returning the new `content` and the text `delta` (offsets are USV indices into
2182
- * `Content.text`, surviving anchors rebased). Throws on an over-nested markdown
2183
- * input or a non-content `base`.
2275
+ * returning the new `content`, the text `delta` (offsets are USV indices into
2276
+ * `Content.text`, surviving anchors rebased), and the import's
2277
+ * `parse::dropped_construct` warnings, with no `path`. Throws on an
2278
+ * over-nested markdown input or a non-content `base`.
2184
2279
  * @param {Content} base
2185
2280
  * @param {string} markdown
2186
- * @returns {{ content: Content; delta: Delta }}
2281
+ * @returns {{ content: Content; delta: Delta; warnings: Diagnostic[] }}
2187
2282
  */
2188
2283
  export function rebase(base, markdown) {
2189
2284
  try {
@@ -2352,10 +2447,6 @@ function __wbg_get_imports() {
2352
2447
  const ret = getObject(arg0).getMonth();
2353
2448
  return ret;
2354
2449
  },
2355
- __wbg_getOwnPropertyNames_f8299644de14134c: function(arg0) {
2356
- const ret = Object.getOwnPropertyNames(getObject(arg0));
2357
- return addHeapObject(ret);
2358
- },
2359
2450
  __wbg_getPrototypeOf_4e7d85b5bf38d546: function() { return handleError(function (arg0) {
2360
2451
  const ret = Reflect.getPrototypeOf(getObject(arg0));
2361
2452
  return addHeapObject(ret);
@@ -2396,6 +2487,16 @@ function __wbg_get_imports() {
2396
2487
  const ret = result;
2397
2488
  return ret;
2398
2489
  },
2490
+ __wbg_instanceof_Error_80a725f81f2e102d: function(arg0) {
2491
+ let result;
2492
+ try {
2493
+ result = getObject(arg0) instanceof Error;
2494
+ } catch (_) {
2495
+ result = false;
2496
+ }
2497
+ const ret = result;
2498
+ return ret;
2499
+ },
2399
2500
  __wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
2400
2501
  let result;
2401
2502
  try {
@@ -2446,6 +2547,10 @@ function __wbg_get_imports() {
2446
2547
  const ret = getObject(arg0).length;
2447
2548
  return ret;
2448
2549
  },
2550
+ __wbg_message_5f8387f0c32b90a7: function(arg0) {
2551
+ const ret = getObject(arg0).message;
2552
+ return addHeapObject(ret);
2553
+ },
2449
2554
  __wbg_new_0_72d020f0c63443d4: function() {
2450
2555
  const ret = new Date();
2451
2556
  return addHeapObject(ret);
@@ -2490,6 +2595,10 @@ function __wbg_get_imports() {
2490
2595
  const ret = getObject(arg0).next();
2491
2596
  return addHeapObject(ret);
2492
2597
  }, arguments); },
2598
+ __wbg_ownKeys_7f46b96dc7311fe8: function() { return handleError(function (arg0) {
2599
+ const ret = Reflect.ownKeys(getObject(arg0));
2600
+ return addHeapObject(ret);
2601
+ }, arguments); },
2493
2602
  __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
2494
2603
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
2495
2604
  },
Binary file
@@ -11,6 +11,7 @@ export const document__commitFields: (a: number, b: number, c: number, d: number
11
11
  export const document__readerGet: (a: number, b: number, c: number, d: number) => void;
12
12
  export const document__readerGetContent: (a: number, b: number, c: number, d: number) => void;
13
13
  export const document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
14
+ export const document__reviseDocument: (a: number, b: number, c: number, d: number, e: number) => void;
14
15
  export const document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
15
16
  export const document_applyChange: (a: number, b: number, c: number, d: number) => void;
16
17
  export const document_bodyMarkdown: (a: number, b: number, c: number) => void;
@@ -47,6 +48,7 @@ export const document_storeExt: (a: number, b: number, c: number, d: number) =>
47
48
  export const document_storeField: (a: number, b: number, c: number, d: number) => void;
48
49
  export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
49
50
  export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
51
+ export const document_toAnnotatedMarkdown: (a: number, b: number) => void;
50
52
  export const document_toMarkdown: (a: number, b: number) => void;
51
53
  export const document_toStored: (a: number, b: number) => void;
52
54
  export const document_warnings: (a: number, b: number) => void;
@@ -57,6 +59,7 @@ export const importMarkdown: (a: number, b: number, c: number) => void;
57
59
  export const isInline: (a: number, b: number) => void;
58
60
  export const isPlain: (a: number, b: number) => void;
59
61
  export const livesession_backendId: (a: number, b: number) => void;
62
+ export const livesession_coverage: (a: number, b: number) => void;
60
63
  export const livesession_fieldAt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
61
64
  export const livesession_fieldBoxes: (a: number, b: number, c: number, d: number) => void;
62
65
  export const livesession_locate: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -117,7 +117,7 @@ export type {
117
117
  } from '../core/wasm.js';
118
118
 
119
119
  // Content edit vocabulary: the op-grained content model `Document`'s methods
120
- // speak (`applyChange(addr, bundle)`, `overwrite(addr, rt)`, `revise(…) => Delta`).
120
+ // speak (`applyChange(addr, bundle)`, `overwrite(addr, rt)`, `revise(…) => Revised`).
121
121
  // `ContentLineKind` is the shared half of `ContentLine` and `setKind`, and
122
122
  // `ContentMarkKind` of `ContentMark` and a mark op's `add` / `remove`: lifting a
123
123
  // read value's kind whole — destructure off the envelope, spread the rest into
@@ -139,6 +139,11 @@ export type {
139
139
  Addr,
140
140
  CardAddr,
141
141
  Delta,
142
+ Revised,
143
+ DocumentRevised,
144
+ AnnotatedMarkdown,
145
+ DocumentAnchor,
146
+ Imported,
142
147
  Assoc,
143
148
  IslandOp,
144
149
  LineOp,
@@ -328,14 +333,30 @@ export interface FieldRegion {
328
333
  rect: [number, number, number, number];
329
334
  /**
330
335
  * The content slice this box covers: USV `[start, end)` into the field's
331
- * `Content` for content ink (one segment), absent for a scalar reference
332
- * site or widget. Consumers key segment highlights on it;
336
+ * `Content` for content ink (one segment), absent for a scalar's or a
337
+ * date's ink, a claim or a widget. Consumers key segment highlights on it;
333
338
  * {@link LiveSession.fieldBoxes} unions same-page segments for the
334
339
  * whole-field box.
335
340
  */
336
341
  span?: [number, number];
337
342
  }
338
343
 
344
+ /**
345
+ * One address a compiled document fills, and the region address a click
346
+ * reaches it through. A report, not a gate: a field a quill never prints is
347
+ * legitimately unreachable.
348
+ */
349
+ export interface FieldCoverage {
350
+ /** The field's canonical `DocPath` address, as {@link FieldRegion.field}. */
351
+ field: string;
352
+ /**
353
+ * The `DocPath` of the region reaching `field`: `field` itself, or the
354
+ * nearest enclosing address a region carries (a row claim reaching its
355
+ * cells, a whole array its elements). Absent where no click reaches it.
356
+ */
357
+ coveredBy?: string;
358
+ }
359
+
339
360
  /** Result of one render. */
340
361
  export interface RenderResult {
341
362
  artifacts: Artifact[];
@@ -410,11 +431,12 @@ export declare class Engine {
410
431
  * synchronously before the first await, so the caller may `free()` them as
411
432
  * soon as this call returns.
412
433
  *
413
- * {@link RenderResult.warnings} carries the whole pipeline's, in order:
414
- * `doc.warnings` (parse and `conform::*`), every `quill.validate(doc)`
415
- * warning, then the compile's own. A {@link LiveSession} outlives the
416
- * document it opened from, so {@link LiveSession.render} carries the
417
- * compile's alone: read `doc.warnings` and `quill.validate(doc)` beside it.
434
+ * {@link RenderResult.warnings} carries every `quill.validate(doc)` warning
435
+ * but `backend::declined_construct`, then the compile's own, a decline among
436
+ * them. The load's (parse
437
+ * and `conform::*`) stay on `doc.warnings`, and a revise's on its receipt.
438
+ * A {@link LiveSession} carries the compile's alone: read
439
+ * `quill.validate(doc)` beside it.
418
440
  *
419
441
  * `today` reads as on {@link open}. An `options` key outside
420
442
  * {@link RenderOptions} rejects, `today` among them.
@@ -489,22 +511,27 @@ export declare class LiveSession {
489
511
  * Empty for backends that place no schema fields.
490
512
  *
491
513
  * `field` is **not** unique: a content field surfaces its **first placement**
492
- * as one {@link FieldRegion} per page that placement touches, a scalar
493
- * referenced at several plate sites surfaces each site, and tracked content
494
- * plus a `field:`-bound widget yields both, widget first. Group by `field`.
495
- * Later placements of one content value are not enumerated; {@link fieldAt}
496
- * still resolves clicks on them.
514
+ * as one {@link FieldRegion} per page that placement touches, each claim on
515
+ * a field surfaces its own, and tracked content plus a `field:`-bound widget
516
+ * yields both, widget first. Group by `field`. Later placements of one value
517
+ * are not enumerated; {@link fieldAt} still resolves clicks on them.
497
518
  */
498
519
  regions(): FieldRegion[];
499
520
  /**
500
521
  * The whole-field highlight boxes for `field` (a canonical `DocPath` address,
501
522
  * as {@link regions} keys): one union rect per page over the field's
502
523
  * `span`-bearing content segments, the union {@link regions} leaves derived.
503
- * **Content only**: a field placed solely as a scalar reference or a bound
504
- * widget carries no `span` and returns `[]`, its box being a single
524
+ * **Content only**: a field placed solely as a scalar's ink, a claim or a
525
+ * bound widget carries no `span` and returns `[]`, its box being a single
505
526
  * {@link regions} rect. Reflects the current compile.
506
527
  */
507
528
  fieldBoxes(field: string): FieldRegion[];
529
+ /**
530
+ * Every address the current compile fills that a reader could want to
531
+ * click — each non-blank declared leaf, every roster member held or not —
532
+ * with the region reaching it. Reflects the current compile.
533
+ */
534
+ coverage(): FieldCoverage[];
508
535
  /**
509
536
  * The schema field whose content is under a point on `page`: the canonical
510
537
  * `DocPath` address to focus in the editor, or `undefined` off any field's
@@ -591,7 +618,7 @@ declare module '../core/wasm.js' {
591
618
  }
592
619
  }
593
620
 
594
- import type { Addr, Content, Delta, PathStep, Resolved } from '../core/wasm.js';
621
+ import type { Addr, Content, DocumentRevised, PathStep, Resolved, Revised } from '../core/wasm.js';
595
622
 
596
623
  /**
597
624
  * A `Document` bound to its `Quill` for typed writes, from {@link Quill.writer}.
@@ -611,40 +638,57 @@ export declare class DocumentWriter {
611
638
  readonly document: Document;
612
639
  /**
613
640
  * Typed-commit one main-card field (strict coerce, mismatch throws now).
614
- * Throws `UnknownField` for a name the schema does not declare.
641
+ * Throws `UnknownField` for a name the schema does not declare. Returns a
642
+ * `parse::dropped_construct` warning per construct a `richtext` markdown
643
+ * string in the value dropped, at the string's path.
615
644
  */
616
- set(name: string, value: unknown): void;
645
+ set(name: string, value: unknown): Diagnostic[];
617
646
  /**
618
647
  * Typed-commit several main-card fields atomically: nothing is applied on
619
648
  * error (throws a {@link QuillmarkError} carrying one diagnostic per
620
649
  * offending field, including an `UnknownField` for each undeclared name).
650
+ * Returns `set`'s warnings for every field, in batch order.
621
651
  */
622
- setAll(fields: Record<string, unknown>): void;
652
+ setAll(fields: Record<string, unknown>): Diagnostic[];
623
653
  /**
624
- * Revise the main body from markdown; anchors rebase. Returns the text
625
- * `Delta`: a body carries no field schema to type against, so this is the
626
- * content lane's `revise` reached through the writer.
654
+ * Revise the main body from markdown; anchors rebase. Returns the
655
+ * `Revised` receipt, its warnings at `main.body`: a body carries no field
656
+ * schema to type against, so this is the content lane's `revise` reached
657
+ * through the writer.
627
658
  */
628
- reviseBody(markdown: string): Delta;
659
+ reviseBody(markdown: string): Revised;
629
660
  /**
630
661
  * Revise the content main-card field `name` from authored text: typed *and*
631
662
  * anchor-preserving. Surviving anchors rebase, then the diffed result is
632
663
  * schema-conformed (`richtext(inline)` rejects a multi-block result). Throws
633
- * `UnknownField` for a name the schema does not declare. Returns the `Delta`.
664
+ * `UnknownField` for a name the schema does not declare. Returns the
665
+ * `Revised` receipt, its warnings at the field.
634
666
  *
635
667
  * The codec comes from the declared type: `richtext` diffs markdown, while
636
668
  * `plaintext` diffs the literal text and never imports markdown, so a
637
669
  * byte-identical revise of a value carrying escapes is a byte no-op.
638
670
  */
639
- reviseField(name: string, text: string): Delta;
671
+ reviseField(name: string, text: string): Revised;
672
+ /**
673
+ * Replace the bound document with `markdown`, then conform it. Composable
674
+ * cards align to the stored ones by `$kind` and text similarity, an aligned
675
+ * card's body and stored content fields revise, their anchors rebasing as
676
+ * {@link reviseBody}'s do, and every declared content field lands at rest.
677
+ * Returns the `DocumentRevised` receipt, its `warnings` ending with the
678
+ * `conform::*` ones, and clears `doc.warnings`. Throws when `markdown`
679
+ * declares a `$quill` this quill does not answer to, or does not parse,
680
+ * leaving the document unchanged.
681
+ */
682
+ reviseDocument(markdown: string): DocumentRevised;
640
683
  /**
641
684
  * Build a composable card of `kind`, typed-commit `fields` onto it, set its
642
685
  * body from optional markdown, and place it. `at` omitted appends, a number
643
686
  * inserts at that index. Transactional: a rejected field (throwing a per-field
644
687
  * diagnostic bundle) or an invalid kind, body, or position leaves the document
645
- * untouched.
688
+ * untouched. Returns the fields' `parse::dropped_construct` warnings, then
689
+ * the body import's, anchored under the placed card.
646
690
  */
647
- addCard(kind: string, fields?: Record<string, unknown>, body?: string, at?: number): void;
691
+ addCard(kind: string, fields?: Record<string, unknown>, body?: string, at?: number): Diagnostic[];
648
692
  /** Remove the composable card at `index`, returning it (or `undefined`). */
649
693
  removeCard(index: number): Card | undefined;
650
694
  /**
@@ -672,15 +716,18 @@ export declare class CardWriter {
672
716
  * index.
673
717
  */
674
718
  readonly kind: string;
675
- set(name: string, value: unknown): void;
676
- setAll(fields: Record<string, unknown>): void;
677
- /** Revise this card's body from markdown (edit semantics), returning the text `Delta`. */
678
- reviseBody(markdown: string): Delta;
719
+ set(name: string, value: unknown): Diagnostic[];
720
+ setAll(fields: Record<string, unknown>): Diagnostic[];
721
+ /**
722
+ * Revise this card's body from markdown (edit semantics), returning the
723
+ * `Revised` receipt, its warnings at the card's body.
724
+ */
725
+ reviseBody(markdown: string): Revised;
679
726
  /**
680
727
  * The card twin of {@link DocumentWriter.reviseField}. Throws `UnknownField`
681
728
  * for an undeclared name and `IndexOutOfRange` for a bad bound index.
682
729
  */
683
- reviseField(name: string, text: string): Delta;
730
+ reviseField(name: string, text: string): Revised;
684
731
  }
685
732
 
686
733
  /**