@quillmark/wasm 0.132.0 → 0.133.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.133.0 - 2026-10-29
4
+
5
+ Upgrade path: [0.132 → 0.133](docs/migrations/0.132-to-0.133.md). The
6
+ blueprint is retired: a model writes the JSON authoring document, so a prompt
7
+ built from `quill.blueprint` moves to `quill.authoringSchema`. A root
8
+ `example.md` is an ordinary file: a quill's example is what its `Quill.yaml`
9
+ declares, so move each value onto its field before upgrading.
10
+
11
+ ### LLM authoring
12
+
13
+ - feat(core,cli,wasm,python)!: **LLMs author documents as JSON; the blueprint
14
+ is retired.** The authoring document is the values form lifted to the whole
15
+ document, `{fields, body, cards: [{kind, fields, body}]}`, every rich-text
16
+ field and body a Markdown string and `null` absent.
17
+ `QuillConfig::authoring_schema()` is its JSON Schema, built by
18
+ `build_transform_schema` under the new `SchemaCodec::Text`: every cell admits
19
+ `null`, every declared object refuses an undeclared key, a variant-bearing enum is a `oneOf` per world, and each slot carries
20
+ its `title`, `description`, `default` and `examples`.
21
+ `Quill::to_authoring` exports a document, a field stored as `null` absent, and `Quill::from_authoring` imports
22
+ and conforms one, refusing a malformed shape with `authoring::invalid_shape`,
23
+ its RFC 6901 pointer in `args.pointer`. Export never fails: an undecodable
24
+ or string-held content leaf passes as stored, so every export validates
25
+ against the schema and imports back unchanged.
26
+ WASM `authoringSchema` / `toAuthoring` / `fromAuthoring`, Python
27
+ `authoring_schema` / `to_authoring` / `from_authoring`, and
28
+ `quillmark schema --authoring` expose them. `QuillConfig::blueprint()`,
29
+ `quill.blueprint`, `quillmark blueprint` and `print_blueprint` are deleted;
30
+ `quillmark validate` renders the empty and seeded documents.
31
+ `build_transform_schema` takes a `SchemaCodec`. The blueprint's load rules go
32
+ with it: a multi-line `description:` and an enum member holding `>`, `;` or
33
+ `|` load, and `quill::description_multiline` and
34
+ `quill::format_literal_reserved_char` are deleted. (#2331)
35
+
36
+ ### Examples
37
+
38
+ - feat(core)!: **`example:` and a body's `description` and `example` join the
39
+ quill schema.** A slot at any depth declares at most one `example:`, a value
40
+ of its type checked at load as `default:` is, under
41
+ `quill::example_{type_mismatch,not_in_enum,format_violation,held_stored,on_namespace,over_max,over_length}`
42
+ and `quill::richtext_example_import`. It answers no cell. A body's `description` is text for the writer and its
43
+ `example` markdown that imports without a drop; either beside
44
+ `enabled: false` is `quill::invalid_body`. `schema()` carries them,
45
+ `FieldSchema` and `BodyCardSchema` gain the fields, and WASM types them as
46
+ `QuillFieldSchema.example` and `QuillCardBody.{description,example}`. (#2329)
47
+ - feat(core,cli,wasm,python)!: **the example document is derived.**
48
+ `Quill::example_document()` returns `Option<Document>`: the seeded document
49
+ with every declared `example:` committed and each kind's `body.example` as
50
+ its body, `None` where the quill declares none. A root `example.md` is an
51
+ ordinary file: `EXAMPLE_FILE` and `quill::example_reference` are deleted,
52
+ WASM `exampleDocument()` and Python `example_document()` no longer throw, and
53
+ `quillmark validate` validates and renders the derived document, warning
54
+ `cli::example_file_ignored` while a root `example.md` remains. The
55
+ fixture quills declare the values their `example.md` held. (#2329)
56
+
57
+ ### Content
58
+
59
+ - feat(content,core,wasm): **`reviseContent` revises a body or field to a
60
+ content and keeps its prose anchors.** WASM `doc.reviseContent(addr, rt)`,
61
+ over core's `Card::revise_body_content` / `revise_field_content` and the
62
+ content crate's `delta::carry_anchors`, diffs a content built elsewhere
63
+ against the stored value, carries each prose anchor whose id `rt` does not
64
+ hold, and returns the `Revised` receipt with its text `delta`. `rt`'s own
65
+ anchors and island ids land as they are.
66
+ - feat(content)!: **normalizing content moves no text.** A table's slot
67
+ sharing its line with prose is canonical: `Content::normalize` leaves the
68
+ line as given, where it inserted a `\n` on each side, and `to_markdown`
69
+ breaks it instead. `overwrite`, `reviseContent` and
70
+ `serial::from_authored_value` take the shape where they threw `block island
71
+ in a line's prose`, an `IslandOp::Set` on such a table lands, and a stored
72
+ row holding it loads as stored under the same tag. Typst sets the table as a
73
+ block where its slot sits, closing a heading around it, and a hard break
74
+ after a line the slot ends clears. WASM gains `normalize(content)`, the form
75
+ `overwrite` stores. (#2330)
76
+
3
77
  ## v0.132.0 - 2026-10-27
4
78
 
5
79
  Upgrade path: [0.131 → 0.132](docs/migrations/0.131-to-0.132.md). A row
package/README.md CHANGED
@@ -240,8 +240,17 @@ values from the `Document` payload: there is no separate form-view projection.
240
240
  `quill.validate(doc)` scores it without invoking the backend.
241
241
 
242
242
  `quill.exampleDocument()` returns the quill's example, a filled-in page whose
243
- values are made up, pinned to the quill's `name@MAJOR.MINOR`; `undefined`
244
- when the quill has no `example.md` at its root.
243
+ values are made up: the seeded document with each `example` the schema
244
+ declares committed, a field's as its value and a body's as the body;
245
+ `undefined` when the quill declares none.
246
+
247
+ An LLM writes a document as JSON: `quill.authoringSchema` is its JSON Schema,
248
+ `quill.fromAuthoring(reply)` builds and conforms the `Document` (the JSON twin of
249
+ `quill.parse`), and `quill.toAuthoring(doc)` exports any document back, every
250
+ rich-text field and body a Markdown string. A shape error throws
251
+ `authoring::invalid_shape` at its JSON path; a value of the wrong type lands
252
+ with a `conform::*` warning and `quill.validate(doc)` reports it at its
253
+ document path.
245
254
 
246
255
  `quill.seedDocument()` returns a starter document: one card per kind, each
247
256
  carrying the kind's `seed` from `Quill.yaml` and no other field;
@@ -452,10 +461,9 @@ if (cssPxPerPt > 0) { // 0 while the canvas has no layout
452
461
 
453
462
  A field declares no `required` key: nothing is required.
454
463
 
455
- **`default:`** — what an unanswered field renders. With one, `quill.blueprint`
456
- renders that value under a type-only `# <type>` annotation and the render path
457
- uses it when the document omits the field. Without one, the blueprint leaves the
458
- cell empty and an absent field blank-fills.
464
+ **`default:`** — what an unanswered field renders. With one, the render path
465
+ uses it when the document omits the field, and `quill.authoringSchema` carries
466
+ it as the field's `default`. Without one, an absent field blank-fills.
459
467
 
460
468
  An unanswered field draws no diagnostic. Partial documents are accepted, and
461
469
  `engine.render(quill, doc)` throws only for malformed input.
@@ -2153,14 +2153,14 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE
2153
2153
 
2154
2154
  ## Apache License 2.0
2155
2155
 
2156
- - quillmark-acroform 0.132.0 (https://github.com/borb-sh/quillmark)
2157
- - quillmark-typst 0.132.0 (https://github.com/borb-sh/quillmark)
2158
- - quillmark-cli 0.132.0 (https://github.com/borb-sh/quillmark)
2159
- - quillmark-python 0.132.0
2160
- - quillmark-content 0.132.0 (https://github.com/borb-sh/quillmark)
2161
- - quillmark-core 0.132.0 (https://github.com/borb-sh/quillmark)
2162
- - quillmark 0.132.0 (https://github.com/borb-sh/quillmark)
2163
- - quillmark-pdf 0.132.0 (https://github.com/borb-sh/quillmark)
2156
+ - quillmark-acroform 0.133.0 (https://github.com/borb-sh/quillmark)
2157
+ - quillmark-typst 0.133.0 (https://github.com/borb-sh/quillmark)
2158
+ - quillmark-cli 0.133.0 (https://github.com/borb-sh/quillmark)
2159
+ - quillmark-python 0.133.0
2160
+ - quillmark-content 0.133.0 (https://github.com/borb-sh/quillmark)
2161
+ - quillmark-core 0.133.0 (https://github.com/borb-sh/quillmark)
2162
+ - quillmark 0.133.0 (https://github.com/borb-sh/quillmark)
2163
+ - quillmark-pdf 0.133.0 (https://github.com/borb-sh/quillmark)
2164
2164
  - ciborium-io 0.2.2 (https://github.com/enarx/ciborium)
2165
2165
  - ciborium-ll 0.2.2 (https://github.com/enarx/ciborium)
2166
2166
  - ciborium 0.2.2 (https://github.com/enarx/ciborium)
@@ -4523,7 +4523,7 @@ limitations under the License.
4523
4523
  - js-sys 0.3.106 (https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/js-sys)
4524
4524
  - lock_api 0.4.14 (https://github.com/Amanieu/parking_lot)
4525
4525
  - log 0.4.29 (https://github.com/rust-lang/log)
4526
- - num-bigint 0.4.6 (https://github.com/rust-num/num-bigint)
4526
+ - num-bigint 0.4.8 (https://github.com/rust-num/num-bigint)
4527
4527
  - num-integer 0.1.46 (https://github.com/rust-num/num-integer)
4528
4528
  - num-traits 0.2.19 (https://github.com/rust-num/num-traits)
4529
4529
  - once_cell 1.21.4 (https://github.com/matklad/once_cell)
@@ -4537,7 +4537,7 @@ limitations under the License.
4537
4537
  - proc-macro-hack 0.5.20+deprecated (https://github.com/dtolnay/proc-macro-hack)
4538
4538
  - rayon-core 1.13.0 (https://github.com/rayon-rs/rayon)
4539
4539
  - rayon 1.12.0 (https://github.com/rayon-rs/rayon)
4540
- - regex-automata 0.4.14 (https://github.com/rust-lang/regex)
4540
+ - regex-automata 0.4.18 (https://github.com/rust-lang/regex)
4541
4541
  - regex-syntax 0.8.10 (https://github.com/rust-lang/regex)
4542
4542
  - regex 1.12.3 (https://github.com/rust-lang/regex)
4543
4543
  - roxmltree 0.20.0 (https://github.com/RazrFalcon/roxmltree)
@@ -6248,8 +6248,8 @@ limitations under the License.
6248
6248
 
6249
6249
  ## Apache License 2.0
6250
6250
 
6251
- - quillmark-wasm 0.132.0 (https://github.com/borb-sh/quillmark)
6252
- - quillmark-fixtures 0.132.0
6251
+ - quillmark-wasm 0.133.0 (https://github.com/borb-sh/quillmark)
6252
+ - quillmark-fixtures 0.133.0
6253
6253
  - arraydeque 0.5.1 (https://github.com/andylokandy/arraydeque)
6254
6254
  - codex 0.3.0 (https://github.com/typst/codex)
6255
6255
  - color 0.3.3 (https://github.com/linebender/color)
@@ -7624,7 +7624,7 @@ SOFTWARE.
7624
7624
  ## MIT License
7625
7625
 
7626
7626
  - unsafe-libyaml 0.2.11 (https://github.com/dtolnay/unsafe-libyaml)
7627
- - zmij 1.0.21 (https://github.com/dtolnay/zmij)
7627
+ - zmij 1.0.23 (https://github.com/dtolnay/zmij)
7628
7628
 
7629
7629
  ~~~~text
7630
7630
  Permission is hereby granted, free of charge, to any
package/core/wasm.d.ts CHANGED
@@ -243,9 +243,10 @@ export interface Delta {
243
243
  }
244
244
 
245
245
  /**
246
- * The receipt of a markdown revise (`revise`, `writer.reviseBody`,
246
+ * The receipt of a revise (`revise`, `reviseContent`, `writer.reviseBody`,
247
247
  * `writer.reviseField`): the text `delta`, and one `parse::dropped_construct`
248
- * warning per construct the import dropped, anchored at the revised address.
248
+ * warning per construct a markdown import dropped, anchored at the revised
249
+ * address. `reviseContent` imports nothing, so its `warnings` is empty.
249
250
  */
250
251
  export interface Revised {
251
252
  delta: Delta;
@@ -357,7 +358,9 @@ export type LineOp =
357
358
  *
358
359
  * A `table` has no inline placement: markdown writes it as a block, so an
359
360
  * `insert` whose `at` is not an empty line throws, as does a `set` retyping an
360
- * inline island into one.
361
+ * inline island into one. A table already sharing its line, as a `join` or an
362
+ * `overwrite` of merged edits leaves one, stays there and takes its `set`;
363
+ * markdown writes it on a line of its own.
361
364
  */
362
365
  export type IslandOp =
363
366
  | ({ op: "set" } & ContentIsland)
@@ -500,6 +503,11 @@ export interface QuillCardUi {
500
503
  export interface QuillCardBody {
501
504
  /** When false, consumers must not accept or store body content for this card kind. Defaults to true. */
502
505
  enabled?: boolean;
506
+ /** What the body holds, for the writer. Never beside `enabled: false`. */
507
+ description?: string;
508
+ /** A made-up body in markdown, which `exampleDocument()` commits. Never
509
+ * beside `enabled: false`. */
510
+ example?: string;
503
511
  }
504
512
 
505
513
  export type QuillFieldType = "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "text" | "richtext" | "enum" | "matrix";
@@ -507,7 +515,8 @@ export type QuillFieldType = "number" | "integer" | "boolean" | "array" | "objec
507
515
  /** Schema entry for a single field declared in a quill's `Quill.yaml`.
508
516
  *
509
517
  * `default` is the value an unanswered cell renders. An absent field without a
510
- * `default` blank-fills.
518
+ * `default` blank-fills. `example` is a made-up value of the same type, which
519
+ * answers no cell: `exampleDocument()` commits it.
511
520
  */
512
521
  export interface QuillFieldSchema {
513
522
  /** A trailing `?` marks the cell optional: unanswered, it renders `none`
@@ -519,6 +528,7 @@ export interface QuillFieldSchema {
519
528
  title?: string;
520
529
  description?: string;
521
530
  default?: unknown;
531
+ example?: unknown;
522
532
  /** The closed set of allowed values. Required on `type: "enum"`, and valid
523
533
  * nowhere else. */
524
534
  values?: string[];
@@ -583,6 +593,26 @@ export interface QuillSchema {
583
593
  card_kinds?: Record<string, QuillCardSchema>;
584
594
  }
585
595
 
596
+ /**
597
+ * One card of an `AuthoringDocument`: its kind, its fields in the values form,
598
+ * and its body as Markdown. `null` anywhere a value goes is absent.
599
+ */
600
+ export interface AuthoringCard {
601
+ kind: string;
602
+ fields?: Record<string, unknown> | null;
603
+ body?: string | null;
604
+ }
605
+
606
+ /**
607
+ * The JSON a model reads and writes, described by `Quill.authoringSchema`:
608
+ * the main card's fields and body, and the composable cards in order.
609
+ */
610
+ export interface AuthoringDocument {
611
+ fields?: Record<string, unknown> | null;
612
+ body?: string | null;
613
+ cards?: AuthoringCard[] | null;
614
+ }
615
+
586
616
  /**
587
617
  * Identity snapshot mirroring the `quill:` section of `Quill.yaml`. The schema
588
618
  * lives on `Quill.schema`; output formats are a resolved-backend capability read
@@ -762,8 +792,9 @@ export class Document {
762
792
  /**
763
793
  * **Overwrite** the content value at `addr` with exactly `rt`: value
764
794
  * semantics, so the identity anchors of any previous value are gone. By
765
- * anchor fate `overwrite` destroys, [`revise`](Document::revise) rebases,
766
- * and [`applyChange`](Document::apply_change) preserves. An absent
795
+ * anchor fate `overwrite` destroys, [`revise`](Document::revise) and
796
+ * [`reviseContent`](Document::revise_content) rebase, and
797
+ * [`applyChange`](Document::apply_change) preserves. An absent
767
798
  * `addr.field` targets the body, an absent `addr.card` the main card.
768
799
  *
769
800
  * Throws on an out-of-range card, a malformed field name, or an `rt` that is
@@ -810,6 +841,23 @@ export class Document {
810
841
  * or `undefined`; drops `$seed` entirely once empty. Sibling kinds survive.
811
842
  */
812
843
  removeSeedOverlay(card_kind: string): any;
844
+ /**
845
+ * **Revise** the richtext value at `addr` to `rt`, keeping each stored prose
846
+ * anchor whose id `rt` does not hold: the content twin of
847
+ * [`revise`](Document::revise), for a value built elsewhere such as a
848
+ * merge's projection. Diffs `rt` against the current value, carries those
849
+ * anchors through the diff, and returns the
850
+ * `Revised` receipt, whose `delta` an editor bridge maps its own positions
851
+ * through and whose `warnings` is empty. `rt`'s own anchors and island ids
852
+ * land as they are. An absent `addr.field` targets the body, an absent
853
+ * `addr.card` the main card; an absent field diffs from empty. Richtext
854
+ * only: a `text` field takes `overwrite`.
855
+ *
856
+ * Throws on an out-of-range card, a malformed field name, a present
857
+ * non-content field value, or an `rt` that is not a canonical content
858
+ * object.
859
+ */
860
+ reviseContent(addr: Addr | string, rt: Content): Revised;
813
861
  /**
814
862
  * **Revise** the richtext value at `addr` from a markdown string: the
815
863
  * default write path. Imports the markdown, diffs it against the current
@@ -936,19 +984,28 @@ export class Quill {
936
984
  * The empty document: a main card carrying this quill's `$quill` and
937
985
  * `$kind: main`, no field committed, no composable card, no body. The
938
986
  * type-minimal valid input, and the document a plate is bound to render
939
- * (the quill authoring contract). `new Document(ref)` is the same document
987
+ * (the plate contract). `new Document(ref)` is the same document
940
988
  * reached by spelling the reference.
941
989
  */
942
990
  emptyDocument(): Document;
943
991
  /**
944
- * The quill's example document, `undefined` when the quill has no
945
- * `example.md` at its root: a filled-in page whose values are made up to show the
946
- * quill in use, never kept. It comes back pinned to this quill's
947
- * `name@MAJOR.MINOR` and conformed as `parse` conforms, its parse and
948
- * `conform::*` warnings on `doc.warnings`. Throws when the file does not
949
- * parse or its `$quill` is not this quill's bare name.
992
+ * The quill's example document, `undefined` when no slot or body declares
993
+ * an example: the seeded document with every declared `example` committed
994
+ * as its cell's value and each kind's `body.example` as its body. A
995
+ * filled-in page whose values are made up to show the quill in use, never
996
+ * kept.
950
997
  */
951
998
  exampleDocument(): Document | undefined;
999
+ /**
1000
+ * A document from an authoring document, conformed against this quill:
1001
+ * the JSON twin of `parse`. A `null` is absent; the document carries this
1002
+ * quill's `$quill`. A value the schema refuses lands with a `conform::*`
1003
+ * warning on `doc.warnings`, and `validate` reports the rest at document
1004
+ * paths. Throws, with every error found, on a value that is not the
1005
+ * authoring document's shape (`authoring::invalid_shape`) or a name or
1006
+ * kind no card can store (`edit::*`).
1007
+ */
1008
+ fromAuthoring(value: AuthoringDocument): Document;
952
1009
  /**
953
1010
  * Read a `.quill` bundle, the zip archive holding one quill's file tree.
954
1011
  * Pure, as [`fromTree`](Self::from_tree) is. A bundle outside the format
@@ -997,6 +1054,13 @@ export class Quill {
997
1054
  * `$kind: main` card of [`seedDocument`](Self::seed_document) alone.
998
1055
  */
999
1056
  seedMain(): Card;
1057
+ /**
1058
+ * `doc` as an authoring document: every field in the values form (each
1059
+ * content leaf its codec's text), every body as Markdown, each card
1060
+ * `{kind, fields, body}`. Sparse: an absent or `null` field stays absent. A
1061
+ * content leaf that decodes under neither encoding exports as stored.
1062
+ */
1063
+ toAuthoring(doc: Document): AuthoringDocument;
1000
1064
  /**
1001
1065
  * This quill's file tree as a `.quill` bundle, the bytes
1002
1066
  * [`fromBundle`](Self::from_bundle) reads.
@@ -1019,12 +1083,18 @@ export class Quill {
1019
1083
  * backend's `backend::declined_construct`.
1020
1084
  */
1021
1085
  validate(doc: Document): Diagnostic[];
1086
+ /**
1087
+ * JSON Schema (draft 2020-12) of the quill's authoring document: the
1088
+ * shape `fromAuthoring` takes and `toAuthoring` returns, every content
1089
+ * leaf a Markdown or literal string, each card kind under `$defs`
1090
+ * selected by `kind`.
1091
+ */
1092
+ readonly authoringSchema: Record<string, unknown>;
1022
1093
  /**
1023
1094
  * The *declared* backend identifier (e.g. `"typst"`): intent, not a
1024
1095
  * resolved capability. Capability is read from the engine.
1025
1096
  */
1026
1097
  readonly backendId: string;
1027
- readonly blueprint: string;
1028
1098
  /**
1029
1099
  * Identity snapshot of the `quill:` section of `Quill.yaml`. Pure config:
1030
1100
  * output formats are a resolved-backend capability read from
@@ -1124,6 +1194,14 @@ export function mapMarks(content: Content, bundle: ChangeBundle): ContentMark[];
1124
1194
  */
1125
1195
  export function mapPos(delta: Delta, pos: number, assoc: Assoc): number;
1126
1196
 
1197
+ /**
1198
+ * The canonical form of `rt`: the content `overwrite` stores from it, read
1199
+ * without a document. Normalizing rewrites structure, never the text, so the
1200
+ * answer's `text` is `rt.text`. Throws where `overwrite` would, with the same
1201
+ * error under this verb's name.
1202
+ */
1203
+ export function normalize(rt: Content): Content;
1204
+
1127
1205
  /**
1128
1206
  * Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
1129
1207
  * `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
@@ -1190,6 +1268,7 @@ export interface InitOutput {
1190
1268
  readonly document_removeField: (a: number, b: number, c: number) => void;
1191
1269
  readonly document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
1192
1270
  readonly document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
1271
+ readonly document_reviseContent: (a: number, b: number, c: number, d: number) => void;
1193
1272
  readonly document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
1194
1273
  readonly document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
1195
1274
  readonly document_storageVersionOf: (a: number, b: number, c: number) => void;
@@ -1209,13 +1288,15 @@ export interface InitOutput {
1209
1288
  readonly isPlain: (a: number, b: number) => void;
1210
1289
  readonly mapMarks: (a: number, b: number, c: number) => void;
1211
1290
  readonly mapPos: (a: number, b: number, c: number, d: number) => void;
1291
+ readonly normalize: (a: number, b: number) => void;
1212
1292
  readonly parseDocPath: (a: number, b: number, c: number) => void;
1213
1293
  readonly quill__resolve: (a: number, b: number, c: number, d: number, e: number) => void;
1294
+ readonly quill_authoringSchema: (a: number, b: number) => void;
1214
1295
  readonly quill_backendId: (a: number, b: number) => void;
1215
- readonly quill_blueprint: (a: number, b: number) => void;
1216
1296
  readonly quill_conform: (a: number, b: number, c: number) => void;
1217
1297
  readonly quill_emptyDocument: (a: number) => number;
1218
- readonly quill_exampleDocument: (a: number, b: number) => void;
1298
+ readonly quill_exampleDocument: (a: number) => number;
1299
+ readonly quill_fromAuthoring: (a: number, b: number, c: number) => void;
1219
1300
  readonly quill_fromBundle: (a: number, b: number, c: number) => void;
1220
1301
  readonly quill_fromTree: (a: number, b: number) => void;
1221
1302
  readonly quill_metadata: (a: number, b: number) => void;
@@ -1224,6 +1305,7 @@ export interface InitOutput {
1224
1305
  readonly quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
1225
1306
  readonly quill_seedDocument: (a: number) => number;
1226
1307
  readonly quill_seedMain: (a: number, b: number) => void;
1308
+ readonly quill_toAuthoring: (a: number, b: number, c: number) => void;
1227
1309
  readonly quill_toBundle: (a: number, b: number) => void;
1228
1310
  readonly quill_toTree: (a: number) => number;
1229
1311
  readonly quill_validate: (a: number, b: number, c: number) => void;
package/core/wasm.js CHANGED
@@ -714,8 +714,9 @@ export class Document {
714
714
  /**
715
715
  * **Overwrite** the content value at `addr` with exactly `rt`: value
716
716
  * semantics, so the identity anchors of any previous value are gone. By
717
- * anchor fate `overwrite` destroys, [`revise`](Document::revise) rebases,
718
- * and [`applyChange`](Document::apply_change) preserves. An absent
717
+ * anchor fate `overwrite` destroys, [`revise`](Document::revise) and
718
+ * [`reviseContent`](Document::revise_content) rebase, and
719
+ * [`applyChange`](Document::apply_change) preserves. An absent
719
720
  * `addr.field` targets the body, an absent `addr.card` the main card.
720
721
  *
721
722
  * Throws on an out-of-range card, a malformed field name, or an `rt` that is
@@ -904,6 +905,40 @@ export class Document {
904
905
  wasm.__wbindgen_add_to_stack_pointer(16);
905
906
  }
906
907
  }
908
+ /**
909
+ * **Revise** the richtext value at `addr` to `rt`, keeping each stored prose
910
+ * anchor whose id `rt` does not hold: the content twin of
911
+ * [`revise`](Document::revise), for a value built elsewhere such as a
912
+ * merge's projection. Diffs `rt` against the current value, carries those
913
+ * anchors through the diff, and returns the
914
+ * `Revised` receipt, whose `delta` an editor bridge maps its own positions
915
+ * through and whose `warnings` is empty. `rt`'s own anchors and island ids
916
+ * land as they are. An absent `addr.field` targets the body, an absent
917
+ * `addr.card` the main card; an absent field diffs from empty. Richtext
918
+ * only: a `text` field takes `overwrite`.
919
+ *
920
+ * Throws on an out-of-range card, a malformed field name, a present
921
+ * non-content field value, or an `rt` that is not a canonical content
922
+ * object.
923
+ * @param {Addr | string} addr
924
+ * @param {Content} rt
925
+ * @returns {Revised}
926
+ */
927
+ reviseContent(addr, rt) {
928
+ try {
929
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
930
+ wasm.document_reviseContent(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(rt));
931
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
932
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
933
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
934
+ if (r2) {
935
+ throw takeObject(r1);
936
+ }
937
+ return takeObject(r0);
938
+ } finally {
939
+ wasm.__wbindgen_add_to_stack_pointer(16);
940
+ }
941
+ }
907
942
  /**
908
943
  * **Revise** the richtext value at `addr` from a markdown string: the
909
944
  * default write path. Imports the markdown, diffs it against the current
@@ -1239,35 +1274,38 @@ export class Quill {
1239
1274
  }
1240
1275
  }
1241
1276
  /**
1242
- * The *declared* backend identifier (e.g. `"typst"`): intent, not a
1243
- * resolved capability. Capability is read from the engine.
1244
- * @returns {string}
1277
+ * JSON Schema (draft 2020-12) of the quill's authoring document: the
1278
+ * shape `fromAuthoring` takes and `toAuthoring` returns, every content
1279
+ * leaf a Markdown or literal string, each card kind under `$defs`
1280
+ * selected by `kind`.
1281
+ * @returns {Record<string, unknown>}
1245
1282
  */
1246
- get backendId() {
1247
- let deferred1_0;
1248
- let deferred1_1;
1283
+ get authoringSchema() {
1249
1284
  try {
1250
1285
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1251
- wasm.quill_backendId(retptr, this.__wbg_ptr);
1286
+ wasm.quill_authoringSchema(retptr, this.__wbg_ptr);
1252
1287
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1253
1288
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1254
- deferred1_0 = r0;
1255
- deferred1_1 = r1;
1256
- return getStringFromWasm0(r0, r1);
1289
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1290
+ if (r2) {
1291
+ throw takeObject(r1);
1292
+ }
1293
+ return takeObject(r0);
1257
1294
  } finally {
1258
1295
  wasm.__wbindgen_add_to_stack_pointer(16);
1259
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1260
1296
  }
1261
1297
  }
1262
1298
  /**
1299
+ * The *declared* backend identifier (e.g. `"typst"`): intent, not a
1300
+ * resolved capability. Capability is read from the engine.
1263
1301
  * @returns {string}
1264
1302
  */
1265
- get blueprint() {
1303
+ get backendId() {
1266
1304
  let deferred1_0;
1267
1305
  let deferred1_1;
1268
1306
  try {
1269
1307
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1270
- wasm.quill_blueprint(retptr, this.__wbg_ptr);
1308
+ wasm.quill_backendId(retptr, this.__wbg_ptr);
1271
1309
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1272
1310
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1273
1311
  deferred1_0 = r0;
@@ -1311,7 +1349,7 @@ export class Quill {
1311
1349
  * The empty document: a main card carrying this quill's `$quill` and
1312
1350
  * `$kind: main`, no field committed, no composable card, no body. The
1313
1351
  * type-minimal valid input, and the document a plate is bound to render
1314
- * (the quill authoring contract). `new Document(ref)` is the same document
1352
+ * (the plate contract). `new Document(ref)` is the same document
1315
1353
  * reached by spelling the reference.
1316
1354
  * @returns {Document}
1317
1355
  */
@@ -1320,25 +1358,39 @@ export class Quill {
1320
1358
  return Document.__wrap(ret);
1321
1359
  }
1322
1360
  /**
1323
- * The quill's example document, `undefined` when the quill has no
1324
- * `example.md` at its root: a filled-in page whose values are made up to show the
1325
- * quill in use, never kept. It comes back pinned to this quill's
1326
- * `name@MAJOR.MINOR` and conformed as `parse` conforms, its parse and
1327
- * `conform::*` warnings on `doc.warnings`. Throws when the file does not
1328
- * parse or its `$quill` is not this quill's bare name.
1361
+ * The quill's example document, `undefined` when no slot or body declares
1362
+ * an example: the seeded document with every declared `example` committed
1363
+ * as its cell's value and each kind's `body.example` as its body. A
1364
+ * filled-in page whose values are made up to show the quill in use, never
1365
+ * kept.
1329
1366
  * @returns {Document | undefined}
1330
1367
  */
1331
1368
  exampleDocument() {
1369
+ const ret = wasm.quill_exampleDocument(this.__wbg_ptr);
1370
+ return ret === 0 ? undefined : Document.__wrap(ret);
1371
+ }
1372
+ /**
1373
+ * A document from an authoring document, conformed against this quill:
1374
+ * the JSON twin of `parse`. A `null` is absent; the document carries this
1375
+ * quill's `$quill`. A value the schema refuses lands with a `conform::*`
1376
+ * warning on `doc.warnings`, and `validate` reports the rest at document
1377
+ * paths. Throws, with every error found, on a value that is not the
1378
+ * authoring document's shape (`authoring::invalid_shape`) or a name or
1379
+ * kind no card can store (`edit::*`).
1380
+ * @param {AuthoringDocument} value
1381
+ * @returns {Document}
1382
+ */
1383
+ fromAuthoring(value) {
1332
1384
  try {
1333
1385
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1334
- wasm.quill_exampleDocument(retptr, this.__wbg_ptr);
1386
+ wasm.quill_fromAuthoring(retptr, this.__wbg_ptr, addHeapObject(value));
1335
1387
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1336
1388
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1337
1389
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1338
1390
  if (r2) {
1339
1391
  throw takeObject(r1);
1340
1392
  }
1341
- return r0 === 0 ? undefined : Document.__wrap(r0);
1393
+ return Document.__wrap(r0);
1342
1394
  } finally {
1343
1395
  wasm.__wbindgen_add_to_stack_pointer(16);
1344
1396
  }
@@ -1523,6 +1575,30 @@ export class Quill {
1523
1575
  wasm.__wbindgen_add_to_stack_pointer(16);
1524
1576
  }
1525
1577
  }
1578
+ /**
1579
+ * `doc` as an authoring document: every field in the values form (each
1580
+ * content leaf its codec's text), every body as Markdown, each card
1581
+ * `{kind, fields, body}`. Sparse: an absent or `null` field stays absent. A
1582
+ * content leaf that decodes under neither encoding exports as stored.
1583
+ * @param {Document} doc
1584
+ * @returns {AuthoringDocument}
1585
+ */
1586
+ toAuthoring(doc) {
1587
+ try {
1588
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1589
+ _assertClass(doc, Document);
1590
+ wasm.quill_toAuthoring(retptr, this.__wbg_ptr, doc.__wbg_ptr);
1591
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1592
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1593
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1594
+ if (r2) {
1595
+ throw takeObject(r1);
1596
+ }
1597
+ return takeObject(r0);
1598
+ } finally {
1599
+ wasm.__wbindgen_add_to_stack_pointer(16);
1600
+ }
1601
+ }
1526
1602
  /**
1527
1603
  * This quill's file tree as a `.quill` bundle, the bytes
1528
1604
  * [`fromBundle`](Self::from_bundle) reads.
@@ -1847,6 +1923,30 @@ export function mapPos(delta, pos, assoc) {
1847
1923
  }
1848
1924
  }
1849
1925
 
1926
+ /**
1927
+ * The canonical form of `rt`: the content `overwrite` stores from it, read
1928
+ * without a document. Normalizing rewrites structure, never the text, so the
1929
+ * answer's `text` is `rt.text`. Throws where `overwrite` would, with the same
1930
+ * error under this verb's name.
1931
+ * @param {Content} rt
1932
+ * @returns {Content}
1933
+ */
1934
+ export function normalize(rt) {
1935
+ try {
1936
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1937
+ wasm.normalize(retptr, addHeapObject(rt));
1938
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1939
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1940
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1941
+ if (r2) {
1942
+ throw takeObject(r1);
1943
+ }
1944
+ return takeObject(r0);
1945
+ } finally {
1946
+ wasm.__wbindgen_add_to_stack_pointer(16);
1947
+ }
1948
+ }
1949
+
1850
1950
  /**
1851
1951
  * Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
1852
1952
  * `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
package/core/wasm_bg.wasm CHANGED
Binary file