@quillmark/wasm 0.124.0 → 0.126.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
@@ -146,7 +146,8 @@ export interface TableCell {
146
146
 
147
147
  /** `props` of a `type: "table"` island: a pipe table normalized to one column
148
148
  * count that `header`, every row of `rows`, `aligns` and `widths` all share.
149
- * A layout key at its default is absent. */
149
+ * A layout key at its default is absent; one holding a value outside its type
150
+ * stays as written and reads as absent. */
150
151
  export interface TableProps {
151
152
  header: TableCell[];
152
153
  rows: TableCell[][];
@@ -154,7 +155,7 @@ export interface TableProps {
154
155
  aligns: ("none" | "left" | "center" | "right")[];
155
156
  /** Per-column relative weights; `null` is an auto-fit column. Absent when
156
157
  * 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
+ * `Number.MAX_SAFE_INTEGER`. */
158
159
  widths?: (number | null)[];
159
160
  /** The table's placement; absent is the quill's. */
160
161
  align?: "left" | "center" | "right";
@@ -237,14 +238,14 @@ export interface Revised {
237
238
 
238
239
  /**
239
240
  * 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
+ * anchor the write did not carry, at its path and line in the stored document; a table
241
242
  * cell's anchors drop unnamed. `warnings` are the parse's, then each revised
242
243
  * content field's `parse::dropped_construct`, then the writer's `conform::*`.
243
244
  * A field that lands rather than revises, on an inserted card or over no stored
244
245
  * content, reports no drop.
245
246
  */
246
247
  export interface DocumentRevised {
247
- droppedAnchors: { path: string; id: string }[];
248
+ droppedAnchors: DocumentAnchor[];
248
249
  warnings: Diagnostic[];
249
250
  }
250
251
 
@@ -258,7 +259,13 @@ export interface DocumentRevised {
258
259
  */
259
260
  export interface AnnotatedMarkdown {
260
261
  markdown: string;
261
- anchors: { id: string; path: string; line: string }[];
262
+ anchors: DocumentAnchor[];
263
+ }
264
+
265
+ export interface DocumentAnchor {
266
+ id: string;
267
+ path: string;
268
+ line: string;
262
269
  }
263
270
 
264
271
  /**
@@ -439,9 +446,10 @@ export interface Resolved {
439
446
  /** UI layout hints for a single field. Display order is not a hint: key order
440
447
  * in the schema's `fields`/`properties` objects is the ordering contract. */
441
448
  export interface QuillFieldUi {
449
+ /** The id of the card group holding the field, a key of the card's
450
+ * `ui.groups`. */
442
451
  group?: string;
443
452
  compact?: boolean;
444
- multiline?: boolean;
445
453
  /** Label for an `enum`'s blank option. Absent, the consumer supplies a
446
454
  * conventional label of its own. */
447
455
  blank_title?: string;
@@ -455,18 +463,18 @@ export interface QuillFieldUi {
455
463
  layout?: "table" | "flat";
456
464
  }
457
465
 
458
- /** One entry in a card's `ui.groups` registry: a display-label override for the
459
- * group id (the map key). An empty object carries no override, and the consumer
460
- * derives the label from the id (`memo_for` → "Memo For"). */
466
+ /** One group in a card's `ui.groups`: a display-label override for the
467
+ * group id (the map key). An empty object carries no override, and the
468
+ * consumer derives the label from the id (`memo_for` → "Memo For"). */
461
469
  export interface QuillGroupUi {
462
470
  title?: string;
463
471
  }
464
472
 
465
473
  /** UI layout hints for a card (main or named card kind). */
466
474
  export interface QuillCardUi {
467
- /** The groups a field's `ui.group` may reference, keyed by group id. Key
468
- * order is the display-order contract, as with `fields`. Absent when the
469
- * card declares no groups. */
475
+ /** The card's groups keyed by id, each holding at least one field, which
476
+ * names it in its `ui.group`. Key order is the display-order contract, as
477
+ * with `fields`. Absent when the card declares no groups. */
470
478
  groups?: Record<string, QuillGroupUi>;
471
479
  }
472
480
 
@@ -476,7 +484,7 @@ export interface QuillCardBody {
476
484
  enabled?: boolean;
477
485
  }
478
486
 
479
- export type QuillFieldType = "string" | "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "richtext" | "plaintext" | "enum" | "matrix";
487
+ export type QuillFieldType = "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "text" | "richtext" | "enum" | "matrix";
480
488
 
481
489
  /** Schema entry for a single field declared in a quill's `Quill.yaml`.
482
490
  *
@@ -521,9 +529,12 @@ export interface QuillFieldSchema {
521
529
  * out on. Valid only on an `array`. Never gates render: a document over
522
530
  * the cap warns `validation::cardinality` and renders. */
523
531
  max?: number;
524
- /** `true` on a `richtext` or `plaintext` field declared `inline`: the
525
- * single-paragraph, container-free, island-free constraint. */
526
- inline?: boolean;
532
+ /** The line shape of a `text` or `richtext` field, valid nowhere else.
533
+ * Absent or `false`, the field is one line (`text`) or one paragraph with
534
+ * no container or island (`richtext`); `true` admits line breaks
535
+ * (`text`) or block structure (`richtext`). A `richtext` always carries
536
+ * it. */
537
+ multiline?: boolean;
527
538
  }
528
539
 
529
540
  /** Schema entry for the main card or a named card kind. */
@@ -563,6 +574,10 @@ export interface QuillMetadata {
563
574
  backend: string;
564
575
  author: string;
565
576
  description: string;
577
+ /** An SPDX license expression; absent when the quill declares none. */
578
+ license?: string;
579
+ /** An absolute `http(s)` URL; absent when the quill declares none. */
580
+ homepage?: string;
566
581
  }
567
582
 
568
583
 
@@ -677,7 +692,7 @@ export class Document {
677
692
  * `edit::index_out_of_range`.
678
693
  *
679
694
  * A content field at rest has one stored form per codec: a `richtext` field
680
- * holds the canonical content object, a `plaintext` field its literal
695
+ * holds the canonical content object, a `text` field its literal
681
696
  * string. A document from the bound door (`quill.parse` / `quill.conform`)
682
697
  * is at rest; one from the transport door may rest as authored until it is
683
698
  * conformed, and this read reports what is there. For the `Content` either
@@ -690,8 +705,9 @@ export class Document {
690
705
  /**
691
706
  * Insert a card: `at` absent appends, a number inserts at that index (in
692
707
  * `0..=cards.length`). Accepts any `CardInput`, including a card read back
693
- * out of a document. Throws if `card.kind` is not a valid kind name, or if
694
- * `at` is out of range.
708
+ * out of a document. Throws if `card.kind` is not a valid kind name, if
709
+ * `at` is out of range, or `edit::too_many_cards` if the document holds
710
+ * 1,000 cards.
695
711
  */
696
712
  insertCard(card: CardInput, at?: number): void;
697
713
  /**
@@ -904,7 +920,7 @@ export class Quill {
904
920
  * The quill's example document, `undefined` when the quill has no
905
921
  * `example.md` at its root: a filled-in page whose values are made up to show the
906
922
  * quill in use, never kept. It comes back pinned to this quill's
907
- * `name@version` and conformed as `parse` conforms, its parse and
923
+ * `name@MAJOR.MINOR` and conformed as `parse` conforms, its parse and
908
924
  * `conform::*` warnings on `doc.warnings`. Throws when the file does not
909
925
  * parse or its `$quill` is not this quill's bare name.
910
926
  */
@@ -919,7 +935,7 @@ export class Quill {
919
935
  * Parse `markdown` and conform it against this quill: the primary ingestion
920
936
  * path, and the bound twin of the schema-free `Document.fromMarkdown`. The
921
937
  * returned document rests at its canonical form (a `richtext` field as a
922
- * content object, a `plaintext` field as its literal string), so `getStored`
938
+ * content object, a `text` field as its literal string), so `getStored`
923
939
  * answers by the field's declared codec, not by how the document was built.
924
940
  *
925
941
  * Parse warnings and the `conform::*` diagnostics both land on
@@ -963,8 +979,9 @@ export class Quill {
963
979
  toTree(): Map<string, Uint8Array>;
964
980
  /**
965
981
  * Validate `doc` against this quill's schema, returning every diagnostic:
966
- * an error blocks a render, a warning does not. Forwards the canonical
967
- * `validation::*` diagnostics the engine emits.
982
+ * an error blocks a render, a warning does not. Forwards the engine's
983
+ * `validation::*`, a markdown string's `parse::dropped_construct` and the
984
+ * backend's `backend::declined_construct`.
968
985
  */
969
986
  validate(doc: Document): Diagnostic[];
970
987
  /**
@@ -1029,15 +1046,15 @@ export function formatDocPath(segs: DocPathSeg[]): string;
1029
1046
  export function importMarkdown(markdown: string): Imported;
1030
1047
 
1031
1048
  /**
1032
- * Whether `content` satisfies the `inline` constraint of `richtext` and
1033
- * `plaintext`: one `Para` line, in no container, with no islands. Judged on
1049
+ * Whether `content` satisfies the one-line constraint of `text` and
1050
+ * `richtext`: one `Para` line, in no container, with no islands. Judged on
1034
1051
  * the normalized content, which is what a write stores. Throws if `content` is
1035
1052
  * not canonical content.
1036
1053
  */
1037
1054
  export function isInline(content: Content): boolean;
1038
1055
 
1039
1056
  /**
1040
- * Whether `content` satisfies the `plaintext` constraint: no marks, no
1057
+ * Whether `content` satisfies the `text` constraint: no marks, no
1041
1058
  * islands, every line a `Para` in no container. Judged on the normalized
1042
1059
  * content, which is what a write stores. Throws if `content` is not canonical
1043
1060
  * content.
package/core/wasm.js CHANGED
@@ -26,8 +26,8 @@ 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
+ * Returns the fields' `parse::dropped_construct` warnings, then the body
30
+ * import's, anchored under the placed card.
31
31
  * @param {Quill} quill
32
32
  * @param {string} kind
33
33
  * @param {Record<string, unknown>} [fields]
@@ -58,7 +58,7 @@ export class Document {
58
58
  /**
59
59
  * Typed field write at `addr`, resolving the field's schema `type` from
60
60
  * `quill`: the stable ABI under the runtime `writer.set`. One verb for every
61
- * field type; the schema carries the `inline` constraint, so no type token
61
+ * field type; the schema carries the one-line constraint, so no type token
62
62
  * is passed.
63
63
  *
64
64
  * A bare string is `Addr` shorthand for `{ field }`. A body address throws,
@@ -67,15 +67,19 @@ export class Document {
67
67
  * `edit::unknown_field` rather than falling to the opaque store — use
68
68
  * [`storeField`](Document::store_field) for that. Also throws
69
69
  * `edit::field_coercion_failed` / `edit::field_decode` /
70
- * `edit::field_not_inline` on a typed mismatch,
70
+ * `edit::field_not_single_line` on a typed mismatch,
71
71
  * `edit::invalid_field_name` on a malformed name, and
72
72
  * `edit::index_out_of_range` on an out-of-range card.
73
73
  *
74
74
  * The `quill` handle is passed per call because a `Document` carries only a
75
75
  * `$quill` reference, not the resolved schema.
76
+ *
77
+ * Returns a `parse::dropped_construct` warning per construct a `richtext`
78
+ * markdown string in the value dropped, at the string's path.
76
79
  * @param {Quill} quill
77
80
  * @param {Addr | string} addr
78
81
  * @param {any} value
82
+ * @returns {Diagnostic[]}
79
83
  */
80
84
  _commitField(quill, addr, value) {
81
85
  try {
@@ -84,9 +88,11 @@ export class Document {
84
88
  wasm.document__commitField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
85
89
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
86
90
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
87
- if (r1) {
88
- throw takeObject(r0);
91
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
92
+ if (r2) {
93
+ throw takeObject(r1);
89
94
  }
95
+ return takeObject(r0);
90
96
  } finally {
91
97
  wasm.__wbindgen_add_to_stack_pointer(16);
92
98
  }
@@ -98,10 +104,12 @@ export class Document {
98
104
  * diagnostic contract as [`storeFields`](Document::store_fields) — nothing
99
105
  * applied on error, one `diagnostics` entry per offending field, including
100
106
  * `edit::unknown_field` for undeclared names. Throws on an out-of-range
101
- * card.
107
+ * card. Returns [`commitField`](Document::commit_field)'s warnings for
108
+ * every field, in batch order.
102
109
  * @param {Quill} quill
103
110
  * @param {CardAddr} addr
104
111
  * @param {Record<string, unknown>} fields
112
+ * @returns {Diagnostic[]}
105
113
  */
106
114
  _commitFields(quill, addr, fields) {
107
115
  try {
@@ -110,9 +118,11 @@ export class Document {
110
118
  wasm.document__commitFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
111
119
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
112
120
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
113
- if (r1) {
114
- throw takeObject(r0);
121
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
122
+ if (r2) {
123
+ throw takeObject(r1);
115
124
  }
125
+ return takeObject(r0);
116
126
  } finally {
117
127
  wasm.__wbindgen_add_to_stack_pointer(16);
118
128
  }
@@ -263,10 +273,10 @@ export class Document {
263
273
  * Revise the content field at `addr` from authored text, typed *and*
264
274
  * anchor-preserving: the ABI under `writer.reviseField`. Surviving anchors
265
275
  * rebase as in [`revise`](Self::revise), then the diffed result is
266
- * schema-conformed, so a `richtext(inline)` field rejects a multi-block
267
- * result with `edit::field_not_inline`. Returns the `Revised` receipt, its
276
+ * schema-conformed, so a one-paragraph `richtext` field rejects a multi-block
277
+ * result with `edit::field_not_single_line`. Returns the `Revised` receipt, its
268
278
  * warnings anchored at the field. The codec is the declared type's:
269
- * `richtext` diffs markdown, `plaintext` literal text, which drops nothing.
279
+ * `richtext` diffs markdown, `text` literal text, which drops nothing.
270
280
  *
271
281
  * `addr` must name a field; a body address throws, since a body carries no
272
282
  * field schema (use [`revise`](Self::revise)). An undeclared name throws
@@ -541,7 +551,7 @@ export class Document {
541
551
  * `edit::index_out_of_range`.
542
552
  *
543
553
  * A content field at rest has one stored form per codec: a `richtext` field
544
- * holds the canonical content object, a `plaintext` field its literal
554
+ * holds the canonical content object, a `text` field its literal
545
555
  * string. A document from the bound door (`quill.parse` / `quill.conform`)
546
556
  * is at rest; one from the transport door may rest as authored until it is
547
557
  * conformed, and this read reports what is there. For the `Content` either
@@ -570,8 +580,9 @@ export class Document {
570
580
  /**
571
581
  * Insert a card: `at` absent appends, a number inserts at that index (in
572
582
  * `0..=cards.length`). Accepts any `CardInput`, including a card read back
573
- * out of a document. Throws if `card.kind` is not a valid kind name, or if
574
- * `at` is out of range.
583
+ * out of a document. Throws if `card.kind` is not a valid kind name, if
584
+ * `at` is out of range, or `edit::too_many_cards` if the document holds
585
+ * 1,000 cards.
575
586
  * @param {CardInput} card
576
587
  * @param {number} [at]
577
588
  */
@@ -1308,7 +1319,7 @@ export class Quill {
1308
1319
  * The quill's example document, `undefined` when the quill has no
1309
1320
  * `example.md` at its root: a filled-in page whose values are made up to show the
1310
1321
  * quill in use, never kept. It comes back pinned to this quill's
1311
- * `name@version` and conformed as `parse` conforms, its parse and
1322
+ * `name@MAJOR.MINOR` and conformed as `parse` conforms, its parse and
1312
1323
  * `conform::*` warnings on `doc.warnings`. Throws when the file does not
1313
1324
  * parse or its `$quill` is not this quill's bare name.
1314
1325
  * @returns {Document | undefined}
@@ -1375,7 +1386,7 @@ export class Quill {
1375
1386
  * Parse `markdown` and conform it against this quill: the primary ingestion
1376
1387
  * path, and the bound twin of the schema-free `Document.fromMarkdown`. The
1377
1388
  * returned document rests at its canonical form (a `richtext` field as a
1378
- * content object, a `plaintext` field as its literal string), so `getStored`
1389
+ * content object, a `text` field as its literal string), so `getStored`
1379
1390
  * answers by the field's declared codec, not by how the document was built.
1380
1391
  *
1381
1392
  * Parse warnings and the `conform::*` diagnostics both land on
@@ -1500,8 +1511,9 @@ export class Quill {
1500
1511
  }
1501
1512
  /**
1502
1513
  * Validate `doc` against this quill's schema, returning every diagnostic:
1503
- * an error blocks a render, a warning does not. Forwards the canonical
1504
- * `validation::*` diagnostics the engine emits.
1514
+ * an error blocks a render, a warning does not. Forwards the engine's
1515
+ * `validation::*`, a markdown string's `parse::dropped_construct` and the
1516
+ * backend's `backend::declined_construct`.
1505
1517
  * @param {Document} doc
1506
1518
  * @returns {Diagnostic[]}
1507
1519
  */
@@ -1674,8 +1686,8 @@ export function importMarkdown(markdown) {
1674
1686
  }
1675
1687
 
1676
1688
  /**
1677
- * Whether `content` satisfies the `inline` constraint of `richtext` and
1678
- * `plaintext`: one `Para` line, in no container, with no islands. Judged on
1689
+ * Whether `content` satisfies the one-line constraint of `text` and
1690
+ * `richtext`: one `Para` line, in no container, with no islands. Judged on
1679
1691
  * the normalized content, which is what a write stores. Throws if `content` is
1680
1692
  * not canonical content.
1681
1693
  * @param {Content} content
@@ -1698,7 +1710,7 @@ export function isInline(content) {
1698
1710
  }
1699
1711
 
1700
1712
  /**
1701
- * Whether `content` satisfies the `plaintext` constraint: no marks, no
1713
+ * Whether `content` satisfies the `text` constraint: no marks, no
1702
1714
  * islands, every line a `Para` in no container. Judged on the normalized
1703
1715
  * content, which is what a write stores. Throws if `content` is not canonical
1704
1716
  * content.
package/core/wasm_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,11 +1,26 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.124.0",
3
+ "version": "0.126.0",
4
4
  "description": "WebAssembly bindings for Quillmark, a schema-driven document engine",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
+ "author": "Quillmark Contributors",
8
+ "homepage": "https://quillmark.dev/",
9
+ "bugs": {
10
+ "url": "https://github.com/borb-sh/quillmark/issues"
11
+ },
12
+ "keywords": [
13
+ "markdown",
14
+ "pdf",
15
+ "typst",
16
+ "document",
17
+ "template",
18
+ "schema",
19
+ "forms",
20
+ "wasm"
21
+ ],
7
22
  "engines": {
8
- "node": ">=24"
23
+ "node": ">=22"
9
24
  },
10
25
  "repository": {
11
26
  "type": "git",
@@ -15,7 +30,10 @@
15
30
  "core",
16
31
  "render",
17
32
  "runtime",
18
- "CHANGELOG.md"
33
+ "CHANGELOG.md",
34
+ "NOTICE",
35
+ "THIRD_PARTY_LICENSES.md",
36
+ "sbom.cdx.json"
19
37
  ],
20
38
  "main": "./runtime/runtime.js",
21
39
  "module": "./runtime/runtime.js",