@quillmark/wasm 0.111.0 → 0.113.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
@@ -17,7 +17,7 @@ export type PayloadItem =
17
17
  /**
18
18
  * Paths to `!must_fill` markers nested *inside* `value` (the `value`
19
19
  * projection itself is fill-free). Absent when the field has no nested
20
- * placeholders. Preserved across `insertCard` / `makeCard`.
20
+ * placeholders. Preserved across `insertCard`.
21
21
  */
22
22
  nestedFills?: PathStep[][];
23
23
  }
@@ -72,10 +72,10 @@ export interface Content {
72
72
  islands: ContentIsland[];
73
73
  }
74
74
 
75
- /** One `\n`-separated segment of `Content.text`, in order. `kind` is an open set:
76
- * an unknown role round-trips with opaque `attrs` and renders as a paragraph.
77
- * The open arm blocks discriminant narrowing, so read `level`/`lang` behind a
78
- * check of the arm you want. */
75
+ /** One `\n`-separated segment of `Content.text`, in order. `kind` is a closed
76
+ * set: a role outside it is refused wherever content is decoded. Every role
77
+ * spells its payload in `attrs`, so `kind === "heading"` narrows `attrs` to
78
+ * `{ level: number }` with no guard. */
79
79
  export type ContentLine = {
80
80
  containers: ContentContainer[];
81
81
  /** A within-block hard line break rather than a new block. Omitted (false) in the common case. */
@@ -85,56 +85,53 @@ export type ContentLine = {
85
85
  /** A line's block role, shared by `ContentLine` and the `setKind` op. */
86
86
  export type ContentLineKind =
87
87
  | { kind: "para" }
88
- | { kind: "heading"; level: number }
89
- | { kind: "code"; lang?: string }
88
+ | { kind: "heading"; attrs: { level: number } }
89
+ | { kind: "code"; attrs?: { lang?: string } }
90
90
  | { kind: "island" }
91
- | { kind: "rule" }
92
- | { kind: string; attrs: unknown };
91
+ | { kind: "rule" };
93
92
 
94
- /** An ancestor block a line nests inside, outermost first. Open like
95
- * `ContentLine.kind`: an unrecognized container round-trips with opaque `attrs`
96
- * and renders transparently (its lines sit at the enclosing level).
93
+ /** An ancestor block a line nests inside, outermost first. Closed like
94
+ * `ContentLine.kind`.
97
95
  *
98
96
  * Two adjacent lines sit in the same container iff their whole path matches, so
99
97
  * `instance` is what tells one container from an adjacent sibling of identical
100
98
  * shape — two consecutive quotes, two consecutive lists — which contiguity
101
99
  * alone reads as one.
102
100
  *
103
- * **A writer owes a distinct value per adjacent sibling run**, not merely a
104
- * value. Runs of one shape sharing one arrive as one: a second list's items come
105
- * back as continuation paragraphs of the first, markers gone. The field is
106
- * required, so a checker reports the omission; it cannot report a `0` stamped on
107
- * both, which is the same write. A codec flattening a tree takes them from
108
- * `assignInstances` in `@quillmark/wasm/runtime` rather than by hand. Any
109
- * distinct pair works; a write is canonicalized to `0`/`1`.
101
+ * **A writer owes a distinct value per adjacent sibling run.** Runs of one shape
102
+ * sharing one arrive as one: a second list's items come back as continuation
103
+ * paragraphs of the first, markers gone. Nothing reports that — an omitted field
104
+ * and a `0` stamped on both are the same write so a codec flattening a tree
105
+ * takes them from `assignInstances` in `@quillmark/wasm` rather than by hand.
106
+ * Any distinct pair works; a write is canonicalized to `0`/`1`.
110
107
  *
111
- * Reading is not the mirror of writing. Every read spells the field, the `0` on
112
- * a container with nothing to be told apart from included. A read also carries a
113
- * discriminator on pairs no writer had to spell: `1.` beside a list starting at
114
- * `3` differs by `start`, so those runs arrive apart with nothing written, and
115
- * the canonical form spends one anyway because Markdown reads only a list's
116
- * first number.
117
- *
118
- * Content parsed from a stored document is the one shape that arrives without
119
- * it — storage omits a zero — and needs a cast. */
108
+ * Absent is `0`, and a read omits it there, so a container with nothing adjacent
109
+ * to be told apart from carries no key. A read does spell one on pairs no writer
110
+ * had to: `1.` beside a list starting at `3` differs by `start`, so those runs
111
+ * arrive apart with nothing written, and the canonical form spends a
112
+ * discriminator anyway because Markdown reads only a list's first number. */
120
113
  export type ContentContainer =
121
- | { container: "list_item"; ordered: boolean; start: number; ordinal: number; instance: number }
122
- | { container: "quote"; instance: number }
123
- | { container: string; attrs: unknown; instance: number };
124
-
125
- /** A mark over char range `[start, end)` into `Content.text`. The open `type`
126
- * arm blocks discriminant narrowing, so read a payload-carrying arm behind its
127
- * guard: `isLinkMark` (`url`) / `isAnchorMark` (`id`), from
128
- * `@quillmark/wasm/runtime`. An `anchor`'s `id` is a caller-supplied opaque
114
+ | {
115
+ container: "list_item";
116
+ attrs: { ordered: boolean; start: number; ordinal: number };
117
+ instance?: number;
118
+ }
119
+ | { container: "quote"; instance?: number };
120
+
121
+ /** A mark over char range `[start, end)` into `Content.text`. `type` is a
122
+ * closed set, so `type === "link"` narrows `attrs` to `{ url: string }` with no
123
+ * guard. An `anchor`'s `id` is a caller-supplied opaque
129
124
  * handle, unique per `Content` and invariant while the mark lives (positions
130
125
  * rebase, the id never does); it has no markdown projection and survives only
131
126
  * through the edit lane. */
132
- export type ContentMark = { start: number; end: number } & (
127
+ export type ContentMark = { start: number; end: number } & ContentMarkKind;
128
+
129
+ /** A mark's type with its payload, shared by `ContentMark` and a `MarkOp`'s
130
+ * `add` / `remove`. */
131
+ export type ContentMarkKind =
133
132
  | { type: "strong" | "emph" | "underline" | "strike" | "code" }
134
- | { type: "link"; url: string }
135
- | { type: "anchor"; id: string }
136
- | { type: string; attrs: unknown }
137
- );
133
+ | { type: "link"; attrs: { url: string } }
134
+ | { type: "anchor"; attrs: { id: string } };
138
135
 
139
136
  /** A cell in a `TableProps`. `marks` rides the prose `ContentMark` shape, but
140
137
  * each mark's `start`/`end` are USV offsets into this cell's `text`, not into
@@ -153,28 +150,25 @@ export interface TableProps {
153
150
  aligns: ("none" | "left" | "center" | "right")[];
154
151
  }
155
152
 
156
- /** `props` of a `type: "image"` island. */
153
+ /** `props` of a `type: "image"` island. Stores and round-trips; no backend
154
+ * typesets one, and a render that holds one warns `backend::declined_construct`,
155
+ * because what `url` names is undecided. */
157
156
  export interface ImageProps {
158
157
  url: string;
159
158
  alt: string;
160
159
  }
161
160
 
162
- /** How faithfully the markdown projection can carry an island. Open: an unknown
163
- * class round-trips verbatim and reads as `unrepresentable`. */
164
- export type ContentLossClass = "lossless" | "degraded" | "unrepresentable" | (string & {});
161
+ /** How faithfully the markdown projection can carry an island. */
162
+ export type ContentLossClass = "lossless" | "degraded" | "unrepresentable";
165
163
 
166
- /** A structured object occupying one island slot in `Content.text`. `type` is an
167
- * open set: `props` is `TableProps` for `table` and `ImageProps` for `image`,
168
- * and any other type round-trips with opaque `props`. The open arm blocks
169
- * narrowing, so read `props` behind the `isTableIsland` / `isImageIsland`
170
- * guards (from `@quillmark/wasm/runtime`). */
164
+ /** A structured object occupying one island slot in `Content.text`. `type` is a
165
+ * closed set, so `type === "table"` narrows `props` to `TableProps`. */
171
166
  export type ContentIsland = {
172
167
  id: string;
173
168
  loss: ContentLossClass;
174
169
  } & (
175
170
  | { type: "table"; props: TableProps }
176
171
  | { type: "image"; props: ImageProps }
177
- | { type: string; props: unknown }
178
172
  );
179
173
 
180
174
  /**
@@ -214,6 +208,10 @@ export interface CardAddr {
214
208
  * A text-splice change set over the USV content (CodeMirror `ChangeSet`
215
209
  * semantics), returned by `revise` and by the `rebase` codec. Map a stored
216
210
  * position through it with `mapPos`.
211
+ *
212
+ * Applying one admits an `insert` string rather than storing it verbatim: `\r`
213
+ * and the Unicode bidi controls drop, and a line separator — VT, FF, NEL,
214
+ * U+2028, U+2029 — becomes a space. Nothing reports the substitution.
217
215
  */
218
216
  export interface Delta {
219
217
  ops: ({ retain: number } | { insert: string } | { delete: number })[];
@@ -224,24 +222,25 @@ export type Assoc = "before" | "after";
224
222
 
225
223
  /**
226
224
  * A mark edit in final-text coordinates (post-delta, post-line-op). `add` /
227
- * `remove` carry the `ContentMark` vocabulary; `removeAnchor` drops one identity
228
- * anchor by id. An `add` of an `anchor` requires a non-empty `id` not already
229
- * live in the field; a collision or the empty id throws.
225
+ * `remove` are a `ContentMark` under an op, so a held mark spreads in whole;
226
+ * `removeAnchor` drops one identity anchor by id. An `add` of an `anchor`
227
+ * requires a non-empty `id` not already live in the field; a collision or the
228
+ * empty id throws.
230
229
  */
231
230
  export type MarkOp =
232
- | ({ op: "add" | "remove"; start: number; end: number } & (
233
- | { type: "strong" | "emph" | "underline" | "strike" | "code" }
234
- | { type: "link"; url: string }
235
- | { type: "anchor"; id: string }
236
- | { type: string; attrs: unknown }
237
- ))
231
+ | ({ op: "add" | "remove" } & ContentMark)
238
232
  | { op: "removeAnchor"; id: string };
239
233
 
240
234
  /**
241
235
  * A line/block edit. `split`/`join` splice `\n` in post-`delta`,
242
236
  * post-`islandOps` coordinates; `setKind`/`setContainers`/`setContinues` touch
243
237
  * metadata. `setContinues` sets or clears a line's within-block hard-break flag
244
- * (`ContentLine.continues`); `continues: true` on line 0 is rejected.
238
+ * (`ContentLine.continues`); `continues: true` lands as `false` on line 0, which
239
+ * nothing precedes, on a line whose containers differ from the line above, and
240
+ * on one following a heading, island or rule, each a block of one line.
241
+ * `setKind` lands a kind the line's text contradicts — `island` or `rule` over
242
+ * prose, `code` over a slot — as `para`, which is what re-importing the line's
243
+ * own markdown yields. Read the content back to see where an op settled.
245
244
  */
246
245
  export type LineOp =
247
246
  | { op: "split"; at: number }
@@ -272,11 +271,19 @@ export type LineOp =
272
271
  * A `set` stores the `loss` it is given; nothing re-derives the class from the
273
272
  * new `props`.
274
273
  *
275
- * An island is *inline* (a slot inside a paragraph) unless its line says
276
- * otherwise. A **block** island is one bundle of all three channels, in the
277
- * order they apply: `delta` inserts the `\n` that opens the line, `islandOps`
278
- * inserts the slot, `lineOps` tags the line `{ op: "setKind", kind: "island" }`.
279
- * `{ op: "split" }` cannot open that line, since line ops run after island ops.
274
+ * An island is *inline* (a slot inside a paragraph) or a **block** (that slot
275
+ * alone on a line under `kind: "island"`), and for a slot alone on a line the
276
+ * type settles which: markdown writes a `table` as a block and an image inline,
277
+ * so the line's `kind` is read off the type and a `setKind` spelling it
278
+ * otherwise does not survive. Landing a block island is one bundle of all three
279
+ * channels, in the order they apply: `delta` inserts the `\n` that opens the
280
+ * line, `islandOps` inserts the slot, `lineOps` tags the line
281
+ * `{ op: "setKind", kind: "island" }`. `{ op: "split" }` cannot open that line,
282
+ * since line ops run after island ops.
283
+ *
284
+ * A `table` has no inline placement: markdown writes it as a block, so an
285
+ * `insert` whose `at` is not an empty line throws, as does a `set` retyping an
286
+ * inline island into one.
280
287
  */
281
288
  export type IslandOp =
282
289
  | ({ op: "set" } & ContentIsland)
@@ -494,16 +501,13 @@ export interface QuillMetadata {
494
501
  }
495
502
 
496
503
 
497
- /**
498
- * Diagnostic message (error or warning)
499
- */
500
504
  export interface Diagnostic {
501
505
  severity: Severity;
502
506
  code?: string;
503
507
  message: string;
504
508
  location?: Location;
505
509
  /**
506
- * Document-model path anchor (e.g. `\"cards.indorsement[0].signature_block\"`),
510
+ * Document-model path anchor (e.g. `"cards.indorsement[0].signature_block"`),
507
511
  * set on schema validation diagnostics and `undefined` otherwise.
508
512
  */
509
513
  path?: string;
@@ -516,12 +520,8 @@ export interface Diagnostic {
516
520
  * `skip_serializing_if`, so an omitted field would be declared required.
517
521
  */
518
522
  args?: Record<string, unknown>;
519
- sourceChain?: string[];
520
523
  }
521
524
 
522
- /**
523
- * Source location for errors and warnings
524
- */
525
525
  export interface Location {
526
526
  file: string;
527
527
  line: number;
@@ -531,9 +531,6 @@ export interface Location {
531
531
  export type Severity = "error" | "warning";
532
532
 
533
533
 
534
- /**
535
- * Typed in-memory Quillmark document.
536
- */
537
534
  export class Document {
538
535
  free(): void;
539
536
  [Symbol.dispose](): void;
@@ -555,8 +552,8 @@ export class Document {
555
552
  */
556
553
  applyChange(addr: Addr | string, bundle: ChangeBundle): void;
557
554
  /**
558
- * Authoring-ergonomics header introducing a blueprint to an LLM/MCP consumer
559
- * for the given `quillName`, re-exposed from core.
555
+ * A blueprint's fill obligation for the given `quillName`, re-exposed from
556
+ * core. Carries no tool name: pair it with your own next-step directive.
560
557
  */
561
558
  static blueprintInstruction(quill_name: string): string;
562
559
  /**
@@ -569,12 +566,6 @@ export class Document {
569
566
  * which interprets by declared type. An out-of-range `addr.card` throws.
570
567
  */
571
568
  bodyMarkdown(addr?: CardAddr): string;
572
- /**
573
- * A single composable card by index, so reading one need not materialize
574
- * every card via [`cards`](Self::cards). An out-of-range `index` throws
575
- * `edit::index_out_of_range`.
576
- */
577
- card(index: number): Card;
578
569
  /**
579
570
  * The composable card's own path, `cards.<kind>[index]`: the root
580
571
  * [`pathFor`](Self::path_for) extends, for anchoring the card rather than
@@ -582,9 +573,15 @@ export class Document {
582
573
  * `cards[index]`.
583
574
  */
584
575
  cardPath(index: number): string;
576
+ /**
577
+ * A single composable card by index, so reading one need not materialize
578
+ * every card via [`cards`](Self::cards). An out-of-range `index` throws
579
+ * `edit::index_out_of_range`.
580
+ */
581
+ card(index: number): Card;
585
582
  clone(): Document;
586
583
  /**
587
- * Storage version this build writes via [`toJson`](Document::to_json). The
584
+ * Storage version this build writes via [`toStored`](Document::to_stored). The
588
585
  * tag advances only when the wire format changes, not on every release.
589
586
  */
590
587
  static currentStorageVersion(): string;
@@ -592,27 +589,22 @@ export class Document {
592
589
  * Structural equality, excluding parse-time `warnings`.
593
590
  */
594
591
  equals(other: Document): boolean;
595
- /**
596
- * Render a Diagnostic as the canonical pretty-printed text, so it looks
597
- * identical whichever consumer surfaces it.
598
- */
599
- static formatDiagnostic(diag: Diagnostic): string;
600
592
  /**
601
593
  * Authoring-format rules for the card-yaml markdown surface, re-exposed from
602
594
  * core. Constant across calls; read once and cache.
603
595
  */
604
596
  static formatRules(): string;
597
+ /**
598
+ * Parse markdown into a typed Document. Throws on parse errors.
599
+ */
600
+ static fromMarkdown(markdown: string): Document;
605
601
  /**
606
602
  * Reconstruct a `Document` from a versioned storage DTO string produced by
607
- * [`toJson`](Document::to_json). The result carries no parse-time warnings.
603
+ * [`toStored`](Document::to_stored). The result carries no parse-time warnings.
608
604
  * Throws if `json` is not a valid storage DTO (malformed JSON, unknown
609
605
  * `schema`, missing fields, or unparseable quill reference).
610
606
  */
611
- static fromJson(json: string): Document;
612
- /**
613
- * Parse markdown into a typed Document. Throws on parse errors.
614
- */
615
- static fromMarkdown(markdown: string): Document;
607
+ static fromStored(json: string): Document;
616
608
  /**
617
609
  * The whole `$ext` map at `addr` (a card address, absent `card` = main), or
618
610
  * `undefined` when the card carries none: the `$ext` read that avoids
@@ -620,12 +612,6 @@ export class Document {
620
612
  * out-of-range card.
621
613
  */
622
614
  getExt(addr?: CardAddr): Record<string, unknown> | undefined;
623
- /**
624
- * The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
625
- * = main), or `undefined`. Throws on a present `field` or an out-of-range
626
- * card.
627
- */
628
- getExtNamespace(addr: CardAddr, ns: string): unknown;
629
615
  /**
630
616
  * Read the **verbatim stored value** at `addr`: a field's raw payload value,
631
617
  * or the body content when `addr.field` is absent. A bare string is `Addr`
@@ -642,9 +628,8 @@ export class Document {
642
628
  * conformed, and this read reports what is there. For the `Content` either
643
629
  * way use `reader.getContent`.
644
630
  *
645
- * The body arm is typed `Content` and answers in the seam form, spelling
646
- * every `ContentContainer.instance`. A field arm echoes the stored bytes,
647
- * which omit a zero: verbatim is the contract, and is why it is `unknown`.
631
+ * The body arm is typed `Content`; a field arm echoes the stored bytes
632
+ * unread, which is the contract and why it is `unknown`.
648
633
  */
649
634
  getStored(addr: Addr | string): unknown;
650
635
  /**
@@ -662,26 +647,12 @@ export class Document {
662
647
  isFill(addr: Addr | string): boolean;
663
648
  /**
664
649
  * Replace this document's contents **in place** from a versioned storage DTO
665
- * string: the mutating twin of [`fromJson`](Document::from_json). Parse-time
666
- * `warnings` are cleared. Throws on an invalid DTO, leaving the document
667
- * unchanged.
668
- *
669
- * The cross-WASM-memory `Document` bridge: mutate a document on a
670
- * backend-memory clone, then write the state back into the caller's
671
- * canonical document, without the caller re-binding its variable.
650
+ * string: the mutating twin of [`fromStored`](Document::from_stored).
651
+ * Parse-time `warnings` are cleared. Throws on an invalid DTO, leaving the
652
+ * document unchanged. A caller holding the document need not re-bind its
653
+ * variable.
672
654
  */
673
- loadJson(json: string): void;
674
- /**
675
- * Build a fresh `Card` from a kind and a flat field map: the ergonomic
676
- * constructor for `insertCard`, which also takes any `Card` object
677
- * directly. Each `fields` entry becomes a card field in insertion order;
678
- * `body` defaults to `""`.
679
- *
680
- * Checks only what a detached card can decide alone: field-name grammar and
681
- * value depth. Kind validity is positional, so `insertCard` is its gate and
682
- * any kind string is accepted here.
683
- */
684
- static makeCard(kind: string, fields?: Record<string, unknown>, body?: string): Card;
655
+ loadStored(json: string): void;
685
656
  /**
686
657
  * Move the card at `from` to position `to`. `from == to` is a no-op.
687
658
  */
@@ -730,17 +701,10 @@ export class Document {
730
701
  removeCard(index: number): Card | undefined;
731
702
  /**
732
703
  * Remove the `$ext` map on the card `addr` targets entirely, returning the
733
- * previous map or `undefined`. Discards every namespace at once; prefer
734
- * `removeExtNamespace`. Throws on a present `field` or an out-of-range card.
704
+ * previous map or `undefined`. Discards every namespace at once. Throws on
705
+ * a present `field` or an out-of-range card.
735
706
  */
736
707
  removeExt(addr?: CardAddr): Record<string, unknown> | undefined;
737
- /**
738
- * Remove `$ext[ns]` on the card `addr` targets, returning its value or
739
- * `undefined`; drops `$ext` once empty. `addr` is a card address (absent =
740
- * main). Preserves sibling namespaces. Throws on a present `field` or an
741
- * out-of-range card.
742
- */
743
- removeExtNamespace(addr: CardAddr, ns: string): any;
744
708
  /**
745
709
  * Remove a field at `addr`, returning the removed value or `undefined`. A
746
710
  * bare string is `Addr` shorthand for `{ field }`. A body address throws, as
@@ -770,12 +734,6 @@ export class Document {
770
734
  * and keeps `seedCard` pure: the quill never reads the document.
771
735
  */
772
736
  seedOverlay(kind: string): Record<string, unknown> | undefined;
773
- /**
774
- * Replace the kind of the card at `index`. Payload and body are untouched;
775
- * schema-aware migration is the caller's responsibility.
776
- * Throws if `index` is out of range or `newKind` is invalid.
777
- */
778
- setCardKind(index: number, new_kind: string): void;
779
737
  /**
780
738
  * Replace the QUILL reference string. Throws if `ref_str` is invalid.
781
739
  */
@@ -783,7 +741,7 @@ export class Document {
783
741
  /**
784
742
  * Read the storage version tag from a raw storage DTO string without a full
785
743
  * parse, or `undefined`. Unknown future versions come back as-is, which
786
- * distinguishes "build too old" from "payload corrupt" when `fromJson`
744
+ * distinguishes "build too old" from "payload corrupt" when `fromStored`
787
745
  * throws. This is the storage version, not a field schema, though the JSON
788
746
  * key is spelled `"schema"`: that is the DTO's serde tag.
789
747
  */
@@ -791,16 +749,12 @@ export class Document {
791
749
  /**
792
750
  * Replace the opaque `$ext` map on the card `addr` targets (absent `card` =
793
751
  * main). `value` must be a plain object. `$ext` carries out-of-band consumer
794
- * state and never reaches the rendered output. Throws on a present `field`
795
- * or an out-of-range card.
752
+ * state and never reaches the rendered output. The whole map is the write,
753
+ * so a consumer holding one namespace merges the rest:
754
+ * `{...doc.getExt(addr), [ns]: v}`. Throws on a present `field` or an
755
+ * out-of-range card.
796
756
  */
797
757
  storeExt(addr: CardAddr, value: any): void;
798
- /**
799
- * Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
800
- * sibling namespaces: the recommended `$ext` write. Throws on a present
801
- * `field` or an out-of-range card.
802
- */
803
- storeExtNamespace(addr: CardAddr, ns: string, value: any): void;
804
758
  /**
805
759
  * Store a field verbatim at `addr`, deferring coercion to render; the typed
806
760
  * write is [`commitField`](Document::commit_field). A bare string is `Addr`
@@ -830,24 +784,18 @@ export class Document {
830
784
  * with. Throws if `overlay` cannot be serialized or nests too deep.
831
785
  */
832
786
  storeSeedOverlay(card_kind: string, overlay: any): void;
833
- /**
834
- * Serialize this document to a versioned storage DTO string. Prefer it over
835
- * `toMarkdown` for persistence: the wire format is frozen per `schema`
836
- * version and the output is byte-deterministic within one, so equal
837
- * documents hash equal. Parse-time `warnings` are excluded.
838
- */
839
- toJson(): string;
840
787
  /**
841
788
  * Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
842
789
  * result produces a `Document` equal to `self` by value and by type.
843
790
  */
844
791
  toMarkdown(): string;
845
792
  /**
846
- * Like [`fromJson`](Document::from_json) but returns `undefined` instead of
847
- * throwing when `json` is not a valid storage DTO, to discriminate format
848
- * without exceptions as control flow.
793
+ * Serialize this document to a versioned storage DTO string. Prefer it over
794
+ * `toMarkdown` for persistence: the wire format is frozen per `schema`
795
+ * version and the output is byte-deterministic within one, so equal
796
+ * documents hash equal. Parse-time `warnings` are excluded.
849
797
  */
850
- static tryFromJson(json: string): Document | undefined;
798
+ toStored(): string;
851
799
  /**
852
800
  * Number of composable cards, excluding the main card.
853
801
  */
@@ -862,7 +810,7 @@ export class Document {
862
810
  * The non-fatal diagnostics of the load that produced this document: parse
863
811
  * warnings, plus `conform::*` warnings when it came through `quill.parse`.
864
812
  * Session state, not document value: `equals` and the storage DTO exclude
865
- * it, and `fromJson` / `loadJson` clear it.
813
+ * it, and `fromStored` / `loadStored` clear it.
866
814
  */
867
815
  readonly warnings: Diagnostic[];
868
816
  }
@@ -875,7 +823,7 @@ export class Quill {
875
823
  * Land `doc`'s declared content fields at their canonical rest **in
876
824
  * place**, returning the `conform::*` diagnostics for values that would not
877
825
  * commit. The read-repair verb for a document that arrived through the
878
- * transport door (`fromMarkdown`, `fromJson`, a stored row).
826
+ * transport door (`fromMarkdown`, `fromStored`, a stored row).
879
827
  *
880
828
  * Idempotent: an equal value is not rewritten, so YAML comments and stored
881
829
  * bytes survive. A `!must_fill` marker anywhere in a field's value skips
@@ -903,14 +851,6 @@ export class Quill {
903
851
  * is stale, use `Document.fromMarkdown`, `setQuillRef`, then `quill.conform`.
904
852
  */
905
853
  parse(markdown: string): Document;
906
- /**
907
- * The resolved-value view of `doc`: for every declared field, the value the
908
- * render projection would use and the `FieldSource` rung it came from
909
- * (`"authored" | "default" | "blank"`). The card body is a `body` sibling on
910
- * its card, never a row in `fields`, and `null` when the kind enables no
911
- * body. Value and provenance only; completeness stays `validate`'s.
912
- */
913
- resolve(doc: Document): Resolved;
914
854
  /**
915
855
  * Seed a starter composable `Card` of the given kind (carries `$kind`),
916
856
  * layering an optional per-kind seed `overlay` over the schema-example base
@@ -940,8 +880,8 @@ export class Quill {
940
880
  *
941
881
  * This is how a quill crosses a WASM linear-memory boundary as data: a
942
882
  * `Quill` built in one build cannot be passed to an engine in another, so
943
- * `@quillmark/wasm/runtime` re-feeds this tree to the backend build's
944
- * `Quill.fromTree` on demand.
883
+ * the `@quillmark/wasm` runtime layer re-feeds this tree to the backend
884
+ * build's `Quill.fromTree` on demand.
945
885
  */
946
886
  toTree(): Map<string, Uint8Array>;
947
887
  /**
@@ -958,9 +898,9 @@ export class Quill {
958
898
  readonly backendId: string;
959
899
  readonly blueprint: string;
960
900
  /**
961
- * Identity snapshot of the `quill:` section of `Quill.yaml` plus any extra
962
- * `quill:` keys. Pure config: output formats are a resolved-backend
963
- * capability read from `Quillmark.supportedFormats`, not part of this.
901
+ * Identity snapshot of the `quill:` section of `Quill.yaml`. Pure config:
902
+ * output formats are a resolved-backend capability read from
903
+ * `Quillmark.supportedFormats`, not part of this.
964
904
  */
965
905
  readonly metadata: QuillMetadata;
966
906
  /**
@@ -969,6 +909,12 @@ export class Quill {
969
909
  * ordering contract.
970
910
  */
971
911
  readonly schema: QuillSchema;
912
+ /**
913
+ * The advisory diagnostics of the load that produced this quill: what is
914
+ * wrong with it short of refusing it. A quill that loads clean answers
915
+ * `[]`.
916
+ */
917
+ readonly warnings: Diagnostic[];
972
918
  }
973
919
 
974
920
  /**
@@ -1065,18 +1011,15 @@ export interface InitOutput {
1065
1011
  readonly document_clone: (a: number) => number;
1066
1012
  readonly document_currentStorageVersion: (a: number) => void;
1067
1013
  readonly document_equals: (a: number, b: number) => number;
1068
- readonly document_formatDiagnostic: (a: number, b: number) => void;
1069
1014
  readonly document_formatRules: (a: number) => void;
1070
- readonly document_fromJson: (a: number, b: number, c: number) => void;
1071
1015
  readonly document_fromMarkdown: (a: number, b: number, c: number) => void;
1016
+ readonly document_fromStored: (a: number, b: number, c: number) => void;
1072
1017
  readonly document_getExt: (a: number, b: number, c: number) => void;
1073
- readonly document_getExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
1074
1018
  readonly document_getStored: (a: number, b: number, c: number) => void;
1075
1019
  readonly document_insertCard: (a: number, b: number, c: number, d: number) => void;
1076
1020
  readonly document_isFill: (a: number, b: number, c: number) => void;
1077
- readonly document_loadJson: (a: number, b: number, c: number, d: number) => void;
1021
+ readonly document_loadStored: (a: number, b: number, c: number, d: number) => void;
1078
1022
  readonly document_main: (a: number, b: number) => void;
1079
- readonly document_makeCard: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1080
1023
  readonly document_moveCard: (a: number, b: number, c: number, d: number) => void;
1081
1024
  readonly document_new: (a: number, b: number, c: number) => void;
1082
1025
  readonly document_overwrite: (a: number, b: number, c: number, d: number) => void;
@@ -1085,23 +1028,19 @@ export interface InitOutput {
1085
1028
  readonly document_quillRefHint: (a: number) => void;
1086
1029
  readonly document_removeCard: (a: number, b: number, c: number) => void;
1087
1030
  readonly document_removeExt: (a: number, b: number, c: number) => void;
1088
- readonly document_removeExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
1089
1031
  readonly document_removeField: (a: number, b: number, c: number) => void;
1090
1032
  readonly document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
1091
1033
  readonly document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
1092
1034
  readonly document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
1093
- readonly document_setCardKind: (a: number, b: number, c: number, d: number, e: number) => void;
1094
1035
  readonly document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
1095
1036
  readonly document_storageVersionOf: (a: number, b: number, c: number) => void;
1096
1037
  readonly document_storeExt: (a: number, b: number, c: number, d: number) => void;
1097
- readonly document_storeExtNamespace: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1098
1038
  readonly document_storeField: (a: number, b: number, c: number, d: number) => void;
1099
1039
  readonly document_storeFields: (a: number, b: number, c: number, d: number) => void;
1100
1040
  readonly document_storeFill: (a: number, b: number, c: number, d: number) => void;
1101
1041
  readonly document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
1102
- readonly document_toJson: (a: number, b: number) => void;
1103
1042
  readonly document_toMarkdown: (a: number, b: number) => void;
1104
- readonly document_tryFromJson: (a: number, b: number) => number;
1043
+ readonly document_toStored: (a: number, b: number) => void;
1105
1044
  readonly document_warnings: (a: number, b: number) => void;
1106
1045
  readonly exportMarkdown: (a: number, b: number) => void;
1107
1046
  readonly formatDocPath: (a: number, b: number) => void;
@@ -1109,19 +1048,20 @@ export interface InitOutput {
1109
1048
  readonly mapMarks: (a: number, b: number, c: number) => void;
1110
1049
  readonly mapPos: (a: number, b: number, c: number, d: number) => void;
1111
1050
  readonly parseDocPath: (a: number, b: number, c: number) => void;
1051
+ readonly quill__resolve: (a: number, b: number, c: number) => void;
1112
1052
  readonly quill_backendId: (a: number, b: number) => void;
1113
1053
  readonly quill_blueprint: (a: number, b: number) => void;
1114
1054
  readonly quill_conform: (a: number, b: number, c: number) => void;
1115
1055
  readonly quill_fromTree: (a: number, b: number) => void;
1116
1056
  readonly quill_metadata: (a: number, b: number) => void;
1117
1057
  readonly quill_parse: (a: number, b: number, c: number, d: number) => void;
1118
- readonly quill_resolve: (a: number, b: number, c: number) => void;
1119
1058
  readonly quill_schema: (a: number, b: number) => void;
1120
1059
  readonly quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
1121
1060
  readonly quill_seedDocument: (a: number) => number;
1122
1061
  readonly quill_seedMain: (a: number, b: number) => void;
1123
1062
  readonly quill_toTree: (a: number) => number;
1124
1063
  readonly quill_validate: (a: number, b: number, c: number) => void;
1064
+ readonly quill_warnings: (a: number, b: number) => void;
1125
1065
  readonly rebase: (a: number, b: number, c: number, d: number) => void;
1126
1066
  readonly start: () => void;
1127
1067
  readonly __wbindgen_export: (a: number, b: number) => number;