@quillmark/wasm 0.123.1 → 0.124.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.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 body import's `parse::dropped_construct` warnings, anchored
30
+ * at the placed card's body.
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
  }
@@ -228,14 +233,40 @@ export class Document {
228
233
  wasm.__wbindgen_add_to_stack_pointer(16);
229
234
  }
230
235
  }
236
+ /**
237
+ * The ABI under `writer.reviseDocument`: a whole-document revise, then
238
+ * conform against `quill`. Throws when `markdown` declares a `$quill` this quill
239
+ * does not answer to, before any mutation.
240
+ * @param {Quill} quill
241
+ * @param {string} markdown
242
+ * @returns {DocumentRevised}
243
+ */
244
+ _reviseDocument(quill, markdown) {
245
+ try {
246
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
247
+ _assertClass(quill, Quill);
248
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
249
+ const len0 = WASM_VECTOR_LEN;
250
+ wasm.document__reviseDocument(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0);
251
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
252
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
253
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
254
+ if (r2) {
255
+ throw takeObject(r1);
256
+ }
257
+ return takeObject(r0);
258
+ } finally {
259
+ wasm.__wbindgen_add_to_stack_pointer(16);
260
+ }
261
+ }
231
262
  /**
232
263
  * Revise the content field at `addr` from authored text, typed *and*
233
264
  * anchor-preserving: the ABI under `writer.reviseField`. Surviving anchors
234
265
  * rebase as in [`revise`](Self::revise), then the diffed result is
235
266
  * 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.
267
+ * result with `edit::field_not_inline`. Returns the `Revised` receipt, its
268
+ * warnings anchored at the field. The codec is the declared type's:
269
+ * `richtext` diffs markdown, `plaintext` literal text, which drops nothing.
239
270
  *
240
271
  * `addr` must name a field; a body address throws, since a body carries no
241
272
  * field schema (use [`revise`](Self::revise)). An undeclared name throws
@@ -243,7 +274,7 @@ export class Document {
243
274
  * @param {Quill} quill
244
275
  * @param {Addr | string} addr
245
276
  * @param {string} text
246
- * @returns {Delta}
277
+ * @returns {Revised}
247
278
  */
248
279
  _reviseField(quill, addr, text) {
249
280
  try {
@@ -861,16 +892,18 @@ export class Document {
861
892
  /**
862
893
  * **Revise** the richtext value at `addr` from a markdown string: the
863
894
  * 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.
895
+ * value, rebases surviving identity anchors, and returns the `Revised`
896
+ * receipt: the text `delta` an editor bridge maps its own positions through
897
+ * (`mapPos`), and a `parse::dropped_construct` warning per construct the
898
+ * import dropped, its `path` the address written. An absent `addr.field`
899
+ * targets the body, an absent `addr.card` the main card; an absent field
900
+ * cold-imports from empty.
868
901
  *
869
902
  * Throws on an out-of-range card, a malformed field name, a present
870
903
  * non-content field value, or an over-nested markdown input.
871
904
  * @param {Addr | string} addr
872
905
  * @param {string} markdown
873
- * @returns {Delta}
906
+ * @returns {Revised}
874
907
  */
875
908
  revise(addr, markdown) {
876
909
  try {
@@ -1051,8 +1084,33 @@ export class Document {
1051
1084
  }
1052
1085
  }
1053
1086
  /**
1054
- * Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
1055
- * result produces a `Document` equal to `self` by value and by type.
1087
+ * `toMarkdown` with each prose anchor of every body and content field
1088
+ * spelled read-only at its start where its line can hold the tag, and
1089
+ * listed with its field's path and line either way. An import drops every
1090
+ * tag, so `writer.reviseDocument` with the markdown keeps the anchors it keeps
1091
+ * with `toMarkdown`'s.
1092
+ * @returns {AnnotatedMarkdown}
1093
+ */
1094
+ toAnnotatedMarkdown() {
1095
+ try {
1096
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1097
+ wasm.document_toAnnotatedMarkdown(retptr, this.__wbg_ptr);
1098
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1099
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1100
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1101
+ if (r2) {
1102
+ throw takeObject(r1);
1103
+ }
1104
+ return takeObject(r0);
1105
+ } finally {
1106
+ wasm.__wbindgen_add_to_stack_pointer(16);
1107
+ }
1108
+ }
1109
+ /**
1110
+ * Emit canonical Quillmark Markdown. Re-parsing the result produces a
1111
+ * `Document` equal to `self` by value and by type, but for content: a body
1112
+ * or content field holds what its markdown spells, so its anchors drop and
1113
+ * its island ids re-mint. `toStored` keeps both.
1056
1114
  * @returns {string}
1057
1115
  */
1058
1116
  toMarkdown() {
@@ -1098,7 +1156,7 @@ export class Document {
1098
1156
  * The non-fatal diagnostics of the load that produced this document: parse
1099
1157
  * warnings, plus `conform::*` warnings when it came through `quill.parse`.
1100
1158
  * Session state, not document value: `equals` and the storage DTO exclude
1101
- * it, and `fromStored` / `loadStored` clear it.
1159
+ * it, and `fromStored` / `loadStored` / `writer.reviseDocument` clear it.
1102
1160
  * @returns {Diagnostic[]}
1103
1161
  */
1104
1162
  get warnings() {
@@ -1441,8 +1499,8 @@ export class Quill {
1441
1499
  return takeObject(ret);
1442
1500
  }
1443
1501
  /**
1444
- * Validate `doc` against this quill's schema, returning every diagnostic
1445
- * (empty when the document is valid). Forwards the canonical
1502
+ * Validate `doc` against this quill's schema, returning every diagnostic:
1503
+ * an error blocks a render, a warning does not. Forwards the canonical
1446
1504
  * `validation::*` diagnostics the engine emits.
1447
1505
  * @param {Document} doc
1448
1506
  * @returns {Diagnostic[]}
@@ -1557,7 +1615,7 @@ export function formatDiagnostic(diagnostic) {
1557
1615
  }
1558
1616
 
1559
1617
  /**
1560
- * Serialize structured [`DocPathSeg`] segments back to the canonical path
1618
+ * Serialize structured `DocPathSeg` segments back to the canonical path
1561
1619
  * string: the inverse of `parseDocPath`. Throws on a segment array the
1562
1620
  * deserializer rejects, and on an empty one.
1563
1621
  * @param {DocPathSeg[]} segs
@@ -1589,11 +1647,13 @@ export function formatDocPath(segs) {
1589
1647
  }
1590
1648
 
1591
1649
  /**
1592
- * Import a markdown string to canonical `Content`: the pure, document-free
1593
- * codec. `overwrite(addr, importMarkdown(md))` spells the cold, anchor-losing
1594
- * write; prefer `revise` for edit semantics. Throws on an over-nested input.
1650
+ * Import a markdown string: the pure, document-free codec. Returns the
1651
+ * canonical `content` and a `parse::dropped_construct` warning per construct
1652
+ * the import dropped, with no `path`. `overwrite(addr, importMarkdown(md).content)`
1653
+ * spells the cold, anchor-losing write; prefer `revise` for edit semantics.
1654
+ * Throws on an over-nested input.
1595
1655
  * @param {string} markdown
1596
- * @returns {Content}
1656
+ * @returns {Imported}
1597
1657
  */
1598
1658
  export function importMarkdown(markdown) {
1599
1659
  try {
@@ -1726,7 +1786,7 @@ export function mapPos(delta, pos, assoc) {
1726
1786
 
1727
1787
  /**
1728
1788
  * Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
1729
- * `main.body`, `recipients[0].name`) into structured [`DocPathSeg`] segments, so
1789
+ * `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
1730
1790
  * a consumer routes on segments instead of regexing the string. Throws on a
1731
1791
  * malformed path.
1732
1792
  * @param {string} path
@@ -1752,12 +1812,13 @@ export function parseDocPath(path) {
1752
1812
 
1753
1813
  /**
1754
1814
  * Rebase `markdown` onto a `base` content: the document-free twin of `revise`,
1755
- * returning the new `content` and the text `delta` (offsets are USV indices into
1756
- * `Content.text`, surviving anchors rebased). Throws on an over-nested markdown
1757
- * input or a non-content `base`.
1815
+ * returning the new `content`, the text `delta` (offsets are USV indices into
1816
+ * `Content.text`, surviving anchors rebased), and the import's
1817
+ * `parse::dropped_construct` warnings, with no `path`. Throws on an
1818
+ * over-nested markdown input or a non-content `base`.
1758
1819
  * @param {Content} base
1759
1820
  * @param {string} markdown
1760
- * @returns {{ content: Content; delta: Delta }}
1821
+ * @returns {{ content: Content; delta: Delta; warnings: Diagnostic[] }}
1761
1822
  */
1762
1823
  export function rebase(base, markdown) {
1763
1824
  try {
@@ -1918,10 +1979,6 @@ function __wbg_get_imports() {
1918
1979
  const ret = getObject(arg0).getMonth();
1919
1980
  return ret;
1920
1981
  },
1921
- __wbg_getOwnPropertyNames_f8299644de14134c: function(arg0) {
1922
- const ret = Object.getOwnPropertyNames(getObject(arg0));
1923
- return addHeapObject(ret);
1924
- },
1925
1982
  __wbg_getPrototypeOf_4e7d85b5bf38d546: function() { return handleError(function (arg0) {
1926
1983
  const ret = Reflect.getPrototypeOf(getObject(arg0));
1927
1984
  return addHeapObject(ret);
@@ -1952,6 +2009,16 @@ function __wbg_get_imports() {
1952
2009
  const ret = result;
1953
2010
  return ret;
1954
2011
  },
2012
+ __wbg_instanceof_Error_80a725f81f2e102d: function(arg0) {
2013
+ let result;
2014
+ try {
2015
+ result = getObject(arg0) instanceof Error;
2016
+ } catch (_) {
2017
+ result = false;
2018
+ }
2019
+ const ret = result;
2020
+ return ret;
2021
+ },
1955
2022
  __wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
1956
2023
  let result;
1957
2024
  try {
@@ -1992,6 +2059,10 @@ function __wbg_get_imports() {
1992
2059
  const ret = getObject(arg0).length;
1993
2060
  return ret;
1994
2061
  },
2062
+ __wbg_message_5f8387f0c32b90a7: function(arg0) {
2063
+ const ret = getObject(arg0).message;
2064
+ return addHeapObject(ret);
2065
+ },
1995
2066
  __wbg_new_0_72d020f0c63443d4: function() {
1996
2067
  const ret = new Date();
1997
2068
  return addHeapObject(ret);
@@ -2032,6 +2103,10 @@ function __wbg_get_imports() {
2032
2103
  const ret = getObject(arg0).next();
2033
2104
  return addHeapObject(ret);
2034
2105
  }, arguments); },
2106
+ __wbg_ownKeys_7f46b96dc7311fe8: function() { return handleError(function (arg0) {
2107
+ const ret = Reflect.ownKeys(getObject(arg0));
2108
+ return addHeapObject(ret);
2109
+ }, arguments); },
2035
2110
  __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
2036
2111
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
2037
2112
  },
package/core/wasm_bg.wasm CHANGED
Binary file
@@ -9,6 +9,7 @@ export const document__commitFields: (a: number, b: number, c: number, d: number
9
9
  export const document__readerGet: (a: number, b: number, c: number, d: number) => void;
10
10
  export const document__readerGetContent: (a: number, b: number, c: number, d: number) => void;
11
11
  export const document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
12
+ export const document__reviseDocument: (a: number, b: number, c: number, d: number, e: number) => void;
12
13
  export const document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
14
  export const document_applyChange: (a: number, b: number, c: number, d: number) => void;
14
15
  export const document_bodyMarkdown: (a: number, b: number, c: number) => void;
@@ -45,6 +46,7 @@ export const document_storeExt: (a: number, b: number, c: number, d: number) =>
45
46
  export const document_storeField: (a: number, b: number, c: number, d: number) => void;
46
47
  export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
47
48
  export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
49
+ export const document_toAnnotatedMarkdown: (a: number, b: number) => void;
48
50
  export const document_toMarkdown: (a: number, b: number) => void;
49
51
  export const document_toStored: (a: number, b: number) => void;
50
52
  export const document_warnings: (a: number, b: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.123.1",
3
+ "version": "0.124.0",
4
4
  "description": "WebAssembly bindings for Quillmark, a schema-driven document engine",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
package/render/wasm.d.ts CHANGED
@@ -105,10 +105,17 @@ export type ContentLineKind =
105
105
  export type ContentContainer =
106
106
  | {
107
107
  container: "list_item";
108
- attrs: { ordered: boolean; start: number; ordinal: number };
108
+ /** `checked` is present on a task item: `true` ticked, `false` open. */
109
+ attrs: { ordered: boolean; start: number; ordinal: number; checked?: boolean };
109
110
  instance?: number;
110
111
  }
111
- | { container: "quote"; instance?: number };
112
+ | { container: "quote"; instance?: number }
113
+ | { container: "element"; attrs: ElementAttrs; instance?: number };
114
+
115
+ /** A carrier element's name and attributes, one bag: `$name` is the part of
116
+ * its `qm-<name>` tag after the prefix, and every other key an attribute as
117
+ * written. */
118
+ export type ElementAttrs = { $name: string; [attr: string]: string };
112
119
 
113
120
  /** A mark over char range `[start, end)` into `Content.text`. `type` is a
114
121
  * closed set, so `type === "link"` narrows `attrs` to `{ url: string }` with no
@@ -131,20 +138,33 @@ export type ContentMarkKind =
131
138
  export interface TableCell {
132
139
  text: string;
133
140
  marks: ContentMark[];
141
+ /** The cell's horizontal alignment; absent is its column's. */
142
+ align?: "left" | "center" | "right";
143
+ /** The cell's vertical alignment; absent is the quill's. */
144
+ valign?: "top" | "middle" | "bottom";
134
145
  }
135
146
 
136
147
  /** `props` of a `type: "table"` island: a pipe table normalized to one column
137
- * count that `header`, every row of `rows`, and `aligns` all share. */
148
+ * count that `header`, every row of `rows`, `aligns` and `widths` all share.
149
+ * A layout key at its default is absent. */
138
150
  export interface TableProps {
139
151
  header: TableCell[];
140
152
  rows: TableCell[][];
141
153
  /** Per-column alignment, one entry per column. */
142
154
  aligns: ("none" | "left" | "center" | "right")[];
155
+ /** Per-column relative weights; `null` is an auto-fit column. Absent when
156
+ * every column is auto-fit. A weight is an integer from 1 to
157
+ * `Number.MAX_SAFE_INTEGER`; any other entry drops the key. */
158
+ widths?: (number | null)[];
159
+ /** The table's placement; absent is the quill's. */
160
+ align?: "left" | "center" | "right";
161
+ /** `true` draws `header` as the first body row; absent is a header row. */
162
+ headless?: true;
143
163
  }
144
164
 
145
165
  /** `props` of a `type: "image"` island. Stores and round-trips; no backend
146
166
  * typesets one, and a render that holds one warns `backend::declined_construct`,
147
- * because what `url` names is undecided. */
167
+ * because no backend resolves `url`. */
148
168
  export interface ImageProps {
149
169
  url: string;
150
170
  alt: string;
@@ -205,6 +225,51 @@ export interface Delta {
205
225
  ops: ({ retain: number } | { insert: string } | { delete: number })[];
206
226
  }
207
227
 
228
+ /**
229
+ * The receipt of a markdown revise (`revise`, `writer.reviseBody`,
230
+ * `writer.reviseField`): the text `delta`, and one `parse::dropped_construct`
231
+ * warning per construct the import dropped, anchored at the revised address.
232
+ */
233
+ export interface Revised {
234
+ delta: Delta;
235
+ warnings: Diagnostic[];
236
+ }
237
+
238
+ /**
239
+ * The receipt of `writer.reviseDocument`. `droppedAnchors` names every prose
240
+ * anchor the write did not carry, at its path in the stored document; a table
241
+ * cell's anchors drop unnamed. `warnings` are the parse's, then each revised
242
+ * content field's `parse::dropped_construct`, then the writer's `conform::*`.
243
+ * A field that lands rather than revises, on an inserted card or over no stored
244
+ * content, reports no drop.
245
+ */
246
+ export interface DocumentRevised {
247
+ droppedAnchors: { path: string; id: string }[];
248
+ warnings: Diagnostic[];
249
+ }
250
+
251
+ /**
252
+ * The read `toAnnotatedMarkdown` returns: `toMarkdown`'s markdown with a
253
+ * read-only `<qm-anchor ref="…"></qm-anchor>` at each prose anchor's
254
+ * start its line can hold, and every prose anchor of every body and content
255
+ * field, spelled or not; a table cell's anchors are neither. Each names the
256
+ * `path` of its body or field and the text of the `line` its start sits on,
257
+ * island slots removed.
258
+ */
259
+ export interface AnnotatedMarkdown {
260
+ markdown: string;
261
+ anchors: { id: string; path: string; line: string }[];
262
+ }
263
+
264
+ /**
265
+ * A markdown import (`importMarkdown`): the canonical `content`, and one
266
+ * `parse::dropped_construct` warning per construct it dropped, with no `path`.
267
+ */
268
+ export interface Imported {
269
+ content: Content;
270
+ warnings: Diagnostic[];
271
+ }
272
+
208
273
  /** Which side of a same-position insertion `mapPos` lands a point on. */
209
274
  export type Assoc = "before" | "after";
210
275
 
@@ -596,8 +661,8 @@ export interface Diagnostic {
596
661
  message: string;
597
662
  location?: Location;
598
663
  /**
599
- * Document-model path anchor (e.g. `"cards.indorsement[0].signature_block"`),
600
- * set on schema validation diagnostics and `undefined` otherwise.
664
+ * Document-model path anchor (e.g. `"cards.indorsement[0].signature_block"`)
665
+ * where the diagnostic has a document address, `undefined` otherwise.
601
666
  */
602
667
  path?: string;
603
668
  hint?: string;
@@ -828,15 +893,17 @@ export class Document {
828
893
  /**
829
894
  * **Revise** the richtext value at `addr` from a markdown string: the
830
895
  * default write path. Imports the markdown, diffs it against the current
831
- * value, rebases surviving identity anchors, and returns the text `Delta` an
832
- * editor bridge maps its own positions through (`mapPos`). An absent
833
- * `addr.field` targets the body, an absent `addr.card` the main card; an
834
- * absent field cold-imports from empty.
896
+ * value, rebases surviving identity anchors, and returns the `Revised`
897
+ * receipt: the text `delta` an editor bridge maps its own positions through
898
+ * (`mapPos`), and a `parse::dropped_construct` warning per construct the
899
+ * import dropped, its `path` the address written. An absent `addr.field`
900
+ * targets the body, an absent `addr.card` the main card; an absent field
901
+ * cold-imports from empty.
835
902
  *
836
903
  * Throws on an out-of-range card, a malformed field name, a present
837
904
  * non-content field value, or an over-nested markdown input.
838
905
  */
839
- revise(addr: Addr | string, markdown: string): Delta;
906
+ revise(addr: Addr | string, markdown: string): Revised;
840
907
  /**
841
908
  * The main card's `$seed[kind]` overlay object, or `undefined`. Feeds
842
909
  * `quill.seedCard(kind, overlay)` without serializing the whole main card,
@@ -889,8 +956,18 @@ export class Document {
889
956
  */
890
957
  storeSeedOverlay(card_kind: string, overlay: any): void;
891
958
  /**
892
- * Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
893
- * result produces a `Document` equal to `self` by value and by type.
959
+ * `toMarkdown` with each prose anchor of every body and content field
960
+ * spelled read-only at its start where its line can hold the tag, and
961
+ * listed with its field's path and line either way. An import drops every
962
+ * tag, so `writer.reviseDocument` with the markdown keeps the anchors it keeps
963
+ * with `toMarkdown`'s.
964
+ */
965
+ toAnnotatedMarkdown(): AnnotatedMarkdown;
966
+ /**
967
+ * Emit canonical Quillmark Markdown. Re-parsing the result produces a
968
+ * `Document` equal to `self` by value and by type, but for content: a body
969
+ * or content field holds what its markdown spells, so its anchors drop and
970
+ * its island ids re-mint. `toStored` keeps both.
894
971
  */
895
972
  toMarkdown(): string;
896
973
  /**
@@ -914,7 +991,7 @@ export class Document {
914
991
  * The non-fatal diagnostics of the load that produced this document: parse
915
992
  * warnings, plus `conform::*` warnings when it came through `quill.parse`.
916
993
  * Session state, not document value: `equals` and the storage DTO exclude
917
- * it, and `fromStored` / `loadStored` clear it.
994
+ * it, and `fromStored` / `loadStored` / `writer.reviseDocument` clear it.
918
995
  */
919
996
  readonly warnings: Diagnostic[];
920
997
  }
@@ -1119,8 +1196,8 @@ export class Quill {
1119
1196
  */
1120
1197
  toTree(): Map<string, Uint8Array>;
1121
1198
  /**
1122
- * Validate `doc` against this quill's schema, returning every diagnostic
1123
- * (empty when the document is valid). Forwards the canonical
1199
+ * Validate `doc` against this quill's schema, returning every diagnostic:
1200
+ * an error blocks a render, a warning does not. Forwards the canonical
1124
1201
  * `validation::*` diagnostics the engine emits.
1125
1202
  */
1126
1203
  validate(doc: Document): Diagnostic[];
@@ -1165,9 +1242,11 @@ export class Quillmark {
1165
1242
  open(quill: Quill, doc: Document, today?: string | null): LiveSession;
1166
1243
  /**
1167
1244
  * Render `doc` against `quill` in one shot: `open` + `LiveSession.render`,
1168
- * with `doc.warnings`, then every `quill.validate` warning, ahead of the
1169
- * compile's in `warnings`. An unset `output_format` falls back to the
1170
- * backend's first supported format. `today` reads as on `open`.
1245
+ * with every `quill.validate` warning but `validation::declined_construct`,
1246
+ * which the compile raises as `backend::declined_construct`, ahead of the
1247
+ * compile's in `warnings`; the load's stay on `doc.warnings`. An unset
1248
+ * `output_format` falls back to the backend's first supported format.
1249
+ * `today` reads as on `open`.
1171
1250
  */
1172
1251
  render(quill: Quill, doc: Document, opts?: RenderOptions | null, today?: string | null): RenderResult;
1173
1252
  /**
@@ -1198,18 +1277,20 @@ export function exportMarkdown(rt: Content): string;
1198
1277
  export function formatDiagnostic(diagnostic: Diagnostic): string;
1199
1278
 
1200
1279
  /**
1201
- * Serialize structured [`DocPathSeg`] segments back to the canonical path
1280
+ * Serialize structured `DocPathSeg` segments back to the canonical path
1202
1281
  * string: the inverse of `parseDocPath`. Throws on a segment array the
1203
1282
  * deserializer rejects, and on an empty one.
1204
1283
  */
1205
1284
  export function formatDocPath(segs: DocPathSeg[]): string;
1206
1285
 
1207
1286
  /**
1208
- * Import a markdown string to canonical `Content`: the pure, document-free
1209
- * codec. `overwrite(addr, importMarkdown(md))` spells the cold, anchor-losing
1210
- * write; prefer `revise` for edit semantics. Throws on an over-nested input.
1287
+ * Import a markdown string: the pure, document-free codec. Returns the
1288
+ * canonical `content` and a `parse::dropped_construct` warning per construct
1289
+ * the import dropped, with no `path`. `overwrite(addr, importMarkdown(md).content)`
1290
+ * spells the cold, anchor-losing write; prefer `revise` for edit semantics.
1291
+ * Throws on an over-nested input.
1211
1292
  */
1212
- export function importMarkdown(markdown: string): Content;
1293
+ export function importMarkdown(markdown: string): Imported;
1213
1294
 
1214
1295
  /**
1215
1296
  * Whether `content` satisfies the `inline` constraint of `richtext` and
@@ -1257,7 +1338,7 @@ export function mapPos(delta: Delta, pos: number, assoc: Assoc): number;
1257
1338
 
1258
1339
  /**
1259
1340
  * Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
1260
- * `main.body`, `recipients[0].name`) into structured [`DocPathSeg`] segments, so
1341
+ * `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
1261
1342
  * a consumer routes on segments instead of regexing the string. Throws on a
1262
1343
  * malformed path.
1263
1344
  */
@@ -1265,11 +1346,12 @@ export function parseDocPath(path: string): DocPathSeg[];
1265
1346
 
1266
1347
  /**
1267
1348
  * Rebase `markdown` onto a `base` content: the document-free twin of `revise`,
1268
- * returning the new `content` and the text `delta` (offsets are USV indices into
1269
- * `Content.text`, surviving anchors rebased). Throws on an over-nested markdown
1270
- * input or a non-content `base`.
1349
+ * returning the new `content`, the text `delta` (offsets are USV indices into
1350
+ * `Content.text`, surviving anchors rebased), and the import's
1351
+ * `parse::dropped_construct` warnings, with no `path`. Throws on an
1352
+ * over-nested markdown input or a non-content `base`.
1271
1353
  */
1272
- export function rebase(base: Content, markdown: string): { content: Content; delta: Delta };
1354
+ export function rebase(base: Content, markdown: string): { content: Content; delta: Delta; warnings: Diagnostic[] };
1273
1355
 
1274
1356
  /**
1275
1357
  * Runs at instantiation, so a Rust panic reaches the console as a stack trace
@@ -1292,6 +1374,7 @@ export interface InitOutput {
1292
1374
  readonly document__readerGet: (a: number, b: number, c: number, d: number) => void;
1293
1375
  readonly document__readerGetContent: (a: number, b: number, c: number, d: number) => void;
1294
1376
  readonly document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
1377
+ readonly document__reviseDocument: (a: number, b: number, c: number, d: number, e: number) => void;
1295
1378
  readonly document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1296
1379
  readonly document_applyChange: (a: number, b: number, c: number, d: number) => void;
1297
1380
  readonly document_bodyMarkdown: (a: number, b: number, c: number) => void;
@@ -1328,6 +1411,7 @@ export interface InitOutput {
1328
1411
  readonly document_storeField: (a: number, b: number, c: number, d: number) => void;
1329
1412
  readonly document_storeFields: (a: number, b: number, c: number, d: number) => void;
1330
1413
  readonly document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
1414
+ readonly document_toAnnotatedMarkdown: (a: number, b: number) => void;
1331
1415
  readonly document_toMarkdown: (a: number, b: number) => void;
1332
1416
  readonly document_toStored: (a: number, b: number) => void;
1333
1417
  readonly document_warnings: (a: number, b: number) => void;