@quillmark/wasm 0.114.0 → 0.116.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
@@ -294,30 +294,6 @@ export class Document {
294
294
  wasm.__wbindgen_add_to_stack_pointer(16);
295
295
  }
296
296
  }
297
- /**
298
- * A blueprint's fill obligation for the given `quillName`, re-exposed from
299
- * core. Carries no tool name: pair it with your own next-step directive.
300
- * @param {string} quill_name
301
- * @returns {string}
302
- */
303
- static blueprintInstruction(quill_name) {
304
- let deferred2_0;
305
- let deferred2_1;
306
- try {
307
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
308
- const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
309
- const len0 = WASM_VECTOR_LEN;
310
- wasm.document_blueprintInstruction(retptr, ptr0, len0);
311
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
312
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
313
- deferred2_0 = r0;
314
- deferred2_1 = r1;
315
- return getStringFromWasm0(r0, r1);
316
- } finally {
317
- wasm.__wbindgen_add_to_stack_pointer(16);
318
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
319
- }
320
- }
321
297
  /**
322
298
  * The **body** markdown projection: an on-demand, lossy export (content-only
323
299
  * marks do not survive markdown). A body's type is a format fact, not a
@@ -454,27 +430,6 @@ export class Document {
454
430
  const ret = wasm.document_equals(this.__wbg_ptr, other.__wbg_ptr);
455
431
  return ret !== 0;
456
432
  }
457
- /**
458
- * Authoring-format rules for the card-yaml markdown surface, re-exposed from
459
- * core. Constant across calls; read once and cache.
460
- * @returns {string}
461
- */
462
- static formatRules() {
463
- let deferred1_0;
464
- let deferred1_1;
465
- try {
466
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
467
- wasm.document_formatRules(retptr);
468
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
469
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
470
- deferred1_0 = r0;
471
- deferred1_1 = r1;
472
- return getStringFromWasm0(r0, r1);
473
- } finally {
474
- wasm.__wbindgen_add_to_stack_pointer(16);
475
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
476
- }
477
- }
478
433
  /**
479
434
  * Parse markdown into a typed Document. Throws on parse errors.
480
435
  * @param {string} markdown
@@ -602,28 +557,6 @@ export class Document {
602
557
  wasm.__wbindgen_add_to_stack_pointer(16);
603
558
  }
604
559
  }
605
- /**
606
- * Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
607
- * shorthand for `{ field }`. `false` for an absent field and for a body
608
- * address; only an out-of-range `addr.card` throws.
609
- * @param {Addr | string} addr
610
- * @returns {boolean}
611
- */
612
- isFill(addr) {
613
- try {
614
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
615
- wasm.document_isFill(retptr, this.__wbg_ptr, addHeapObject(addr));
616
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
617
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
618
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
619
- if (r2) {
620
- throw takeObject(r1);
621
- }
622
- return r0 !== 0;
623
- } finally {
624
- wasm.__wbindgen_add_to_stack_pointer(16);
625
- }
626
- }
627
560
  /**
628
561
  * Replace this document's contents **in place** from a versioned storage DTO
629
562
  * string: the mutating twin of [`fromStored`](Document::from_stored).
@@ -666,6 +599,27 @@ export class Document {
666
599
  wasm.__wbindgen_add_to_stack_pointer(16);
667
600
  }
668
601
  }
602
+ /**
603
+ * The Quillmark Markdown rules, re-exposed from core. Constant across
604
+ * calls; read once and cache.
605
+ * @returns {string}
606
+ */
607
+ static markdownRules() {
608
+ let deferred1_0;
609
+ let deferred1_1;
610
+ try {
611
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
612
+ wasm.document_markdownRules(retptr);
613
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
614
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
615
+ deferred1_0 = r0;
616
+ deferred1_1 = r1;
617
+ return getStringFromWasm0(r0, r1);
618
+ } finally {
619
+ wasm.__wbindgen_add_to_stack_pointer(16);
620
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
621
+ }
622
+ }
669
623
  /**
670
624
  * Move the card at `from` to position `to`. `from == to` is a no-op.
671
625
  * @param {number} from
@@ -688,8 +642,8 @@ export class Document {
688
642
  * A blank document: a main card carrying only `$quill`, an empty body, and
689
643
  * no composable cards. Absent fields resolve at render time (`default`, else
690
644
  * the field's blank), so nothing the caller did not set reaches the output.
691
- * For an example-filled starter use `Quill.seedDocument()`. Throws on an
692
- * invalid quill reference.
645
+ * For one instance of every card kind use `Quill.seedDocument()`. Throws on
646
+ * an invalid quill reference.
693
647
  * @param {string} quill_ref
694
648
  */
695
649
  constructor(quill_ref) {
@@ -1032,7 +986,7 @@ export class Document {
1032
986
  * Store a field verbatim at `addr`, deferring coercion to render; the typed
1033
987
  * write is [`commitField`](Document::commit_field). A bare string is `Addr`
1034
988
  * shorthand for `{ field }`; `{ card: 2, field: "qty" }` targets a
1035
- * composable card. Clears any `!must_fill` marker. A body address throws:
989
+ * composable card. A body address throws:
1036
990
  * write a body with `revise` / `overwrite`. Throws on an out-of-range card
1037
991
  * or a malformed name.
1038
992
  * @param {Addr | string} addr
@@ -1073,25 +1027,6 @@ export class Document {
1073
1027
  wasm.__wbindgen_add_to_stack_pointer(16);
1074
1028
  }
1075
1029
  }
1076
- /**
1077
- * Store a field verbatim at `addr` and mark it `!must_fill`. A body address
1078
- * throws; same validation as [`storeField`](Document::store_field).
1079
- * @param {Addr | string} addr
1080
- * @param {any} value
1081
- */
1082
- storeFill(addr, value) {
1083
- try {
1084
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1085
- wasm.document_storeFill(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
1086
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1087
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1088
- if (r1) {
1089
- throw takeObject(r0);
1090
- }
1091
- } finally {
1092
- wasm.__wbindgen_add_to_stack_pointer(16);
1093
- }
1094
- }
1095
1030
  /**
1096
1031
  * Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
1097
1032
  * under `cardKind`, preserving sibling kinds; `$seed` is main-only, so this
@@ -1207,15 +1142,18 @@ export class Quill {
1207
1142
  * `FieldSource` rung it came from (`"authored" | "default" | "blank"`). The
1208
1143
  * card body is a `body` sibling on its card, never a row in `fields`, and
1209
1144
  * `null` when the kind enables no body. Value and provenance only;
1210
- * completeness stays `validate`'s.
1145
+ * diagnostics stay `validate`'s. `today` reads as on `Quillmark.open`.
1211
1146
  * @param {Document} doc
1147
+ * @param {string | null} [today]
1212
1148
  * @returns {Resolved}
1213
1149
  */
1214
- _resolve(doc) {
1150
+ _resolve(doc, today) {
1215
1151
  try {
1216
1152
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1217
1153
  _assertClass(doc, Document);
1218
- wasm.quill__resolve(retptr, this.__wbg_ptr, doc.__wbg_ptr);
1154
+ var ptr0 = isLikeNone(today) ? 0 : passStringToWasm0(today, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1155
+ var len0 = WASM_VECTOR_LEN;
1156
+ wasm.quill__resolve(retptr, this.__wbg_ptr, doc.__wbg_ptr, ptr0, len0);
1219
1157
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1220
1158
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1221
1159
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1274,8 +1212,7 @@ export class Quill {
1274
1212
  * transport door (`fromMarkdown`, `fromStored`, a stored row).
1275
1213
  *
1276
1214
  * Idempotent: an equal value is not rewritten, so YAML comments and stored
1277
- * bytes survive. A `!must_fill` marker anywhere in a field's value skips
1278
- * that field, and a value the strict write refuses stays as authored with a
1215
+ * bytes survive. A value the strict write refuses stays as authored with a
1279
1216
  * diagnostic. Throws when `doc` declares a different `$quill`, before any
1280
1217
  * mutation.
1281
1218
  * @param {Document} doc
@@ -1297,6 +1234,18 @@ export class Quill {
1297
1234
  wasm.__wbindgen_add_to_stack_pointer(16);
1298
1235
  }
1299
1236
  }
1237
+ /**
1238
+ * The empty document: a main card carrying this quill's `$quill` and
1239
+ * `$kind: main`, no field committed, no composable card, no body. The
1240
+ * type-minimal valid input, and the document a plate is bound to render
1241
+ * (the quill authoring contract). `new Document(ref)` is the same document
1242
+ * reached by spelling the reference.
1243
+ * @returns {Document}
1244
+ */
1245
+ emptyDocument() {
1246
+ const ret = wasm.quill_emptyDocument(this.__wbg_ptr);
1247
+ return Document.__wrap(ret);
1248
+ }
1300
1249
  /**
1301
1250
  * Build a quill from a file tree. Pure: the declared backend is resolved
1302
1251
  * later, at render time. Accepts a `Map<string, Uint8Array>` or a plain
@@ -1394,9 +1343,9 @@ export class Quill {
1394
1343
  }
1395
1344
  /**
1396
1345
  * Seed a starter composable `Card` of the given kind (carries `$kind`),
1397
- * layering an optional per-kind seed `overlay` over the schema-example base
1398
- * (`overlay › example › absent`). `undefined` when `cardKind` is not
1399
- * declared in this quill's schema.
1346
+ * committing an optional per-kind seed `overlay`'s fields and `$body`
1347
+ * (`overlay › absent`, body `overlay › empty`). `undefined` when
1348
+ * `cardKind` is not declared in this quill's schema.
1400
1349
  *
1401
1350
  * Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
1402
1351
  * template-derived document inherits its curated starting values; omit it
@@ -1424,9 +1373,9 @@ export class Quill {
1424
1373
  }
1425
1374
  /**
1426
1375
  * Seed a starter `Document` from the schema: the main card plus one instance
1427
- * of each composable card kind, each committing its fields' `example:`
1428
- * values and leaving every other field absent (interpolated at render as
1429
- * `default:`, else the field's blank). A field with both renders its example.
1376
+ * of each composable card kind, each body empty and every field absent
1377
+ * (interpolated at render as `default:`, else the field's blank). No
1378
+ * `example:` is committed (a field's or `body.example`).
1430
1379
  * @returns {Document}
1431
1380
  */
1432
1381
  seedDocument() {
@@ -1470,8 +1419,7 @@ export class Quill {
1470
1419
  /**
1471
1420
  * Validate `doc` against this quill's schema, returning every diagnostic
1472
1421
  * (empty when the document is valid). Forwards the canonical
1473
- * `validation::*` diagnostics the engine emits, including the non-fatal
1474
- * `validation::must_fill` warning per `!must_fill` marker left behind.
1422
+ * `validation::*` diagnostics the engine emits.
1475
1423
  * @param {Document} doc
1476
1424
  * @returns {Diagnostic[]}
1477
1425
  */
@@ -1641,6 +1589,54 @@ export function importMarkdown(markdown) {
1641
1589
  }
1642
1590
  }
1643
1591
 
1592
+ /**
1593
+ * Whether `content` satisfies the `inline` constraint of `richtext` and
1594
+ * `plaintext`: one `Para` line, in no container, with no islands. Judged on
1595
+ * the normalized content, which is what a write stores. Throws if `content` is
1596
+ * not canonical content.
1597
+ * @param {Content} content
1598
+ * @returns {boolean}
1599
+ */
1600
+ export function isInline(content) {
1601
+ try {
1602
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1603
+ wasm.isInline(retptr, addHeapObject(content));
1604
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1605
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1606
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1607
+ if (r2) {
1608
+ throw takeObject(r1);
1609
+ }
1610
+ return r0 !== 0;
1611
+ } finally {
1612
+ wasm.__wbindgen_add_to_stack_pointer(16);
1613
+ }
1614
+ }
1615
+
1616
+ /**
1617
+ * Whether `content` satisfies the `plaintext` constraint: no marks, no
1618
+ * islands, every line a `Para` in no container. Judged on the normalized
1619
+ * content, which is what a write stores. Throws if `content` is not canonical
1620
+ * content.
1621
+ * @param {Content} content
1622
+ * @returns {boolean}
1623
+ */
1624
+ export function isPlain(content) {
1625
+ try {
1626
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1627
+ wasm.isPlain(retptr, addHeapObject(content));
1628
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1629
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1630
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1631
+ if (r2) {
1632
+ throw takeObject(r1);
1633
+ }
1634
+ return r0 !== 0;
1635
+ } finally {
1636
+ wasm.__wbindgen_add_to_stack_pointer(16);
1637
+ }
1638
+ }
1639
+
1644
1640
  /**
1645
1641
  * Where `bundle`'s text-moving channels (`delta`, then `islandOps`, then
1646
1642
  * `lineOps`) leave `content`'s marks: the final-text coordinates the bundle's
@@ -1886,6 +1882,18 @@ function __wbg_get_imports() {
1886
1882
  const ret = Array.from(getObject(arg0));
1887
1883
  return addHeapObject(ret);
1888
1884
  },
1885
+ __wbg_getDate_8e7807f062ade36a: function(arg0) {
1886
+ const ret = getObject(arg0).getDate();
1887
+ return ret;
1888
+ },
1889
+ __wbg_getFullYear_0cfd5a75cf3d5856: function(arg0) {
1890
+ const ret = getObject(arg0).getFullYear();
1891
+ return ret;
1892
+ },
1893
+ __wbg_getMonth_01ce17d889ed7e5e: function(arg0) {
1894
+ const ret = getObject(arg0).getMonth();
1895
+ return ret;
1896
+ },
1889
1897
  __wbg_get_6cf5a4d4d8ad3c5a: function() { return handleError(function (arg0, arg1) {
1890
1898
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
1891
1899
  return addHeapObject(ret);
@@ -1966,6 +1974,10 @@ function __wbg_get_imports() {
1966
1974
  const ret = getObject(arg0).length;
1967
1975
  return ret;
1968
1976
  },
1977
+ __wbg_new_0_35540e542ba689d2: function() {
1978
+ const ret = new Date();
1979
+ return addHeapObject(ret);
1980
+ },
1969
1981
  __wbg_new_1da3429bc3c4541c: function(arg0) {
1970
1982
  const ret = new Uint8Array(getObject(arg0));
1971
1983
  return addHeapObject(ret);
package/core/wasm_bg.wasm CHANGED
Binary file
@@ -11,7 +11,6 @@ export const document__readerGetContent: (a: number, b: number, c: number, d: nu
11
11
  export const document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
12
12
  export const document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
13
  export const document_applyChange: (a: number, b: number, c: number, d: number) => void;
14
- export const document_blueprintInstruction: (a: number, b: number, c: number) => void;
15
14
  export const document_bodyMarkdown: (a: number, b: number, c: number) => void;
16
15
  export const document_card: (a: number, b: number, c: number) => void;
17
16
  export const document_cardCount: (a: number) => number;
@@ -20,15 +19,14 @@ export const document_cards: (a: number, b: number) => void;
20
19
  export const document_clone: (a: number) => number;
21
20
  export const document_currentStorageVersion: (a: number) => void;
22
21
  export const document_equals: (a: number, b: number) => number;
23
- export const document_formatRules: (a: number) => void;
24
22
  export const document_fromMarkdown: (a: number, b: number, c: number) => void;
25
23
  export const document_fromStored: (a: number, b: number, c: number) => void;
26
24
  export const document_getExt: (a: number, b: number, c: number) => void;
27
25
  export const document_getStored: (a: number, b: number, c: number) => void;
28
26
  export const document_insertCard: (a: number, b: number, c: number, d: number) => void;
29
- export const document_isFill: (a: number, b: number, c: number) => void;
30
27
  export const document_loadStored: (a: number, b: number, c: number, d: number) => void;
31
28
  export const document_main: (a: number, b: number) => void;
29
+ export const document_markdownRules: (a: number) => void;
32
30
  export const document_moveCard: (a: number, b: number, c: number, d: number) => void;
33
31
  export const document_new: (a: number, b: number, c: number) => void;
34
32
  export const document_overwrite: (a: number, b: number, c: number, d: number) => void;
@@ -46,7 +44,6 @@ export const document_storageVersionOf: (a: number, b: number, c: number) => voi
46
44
  export const document_storeExt: (a: number, b: number, c: number, d: number) => void;
47
45
  export const document_storeField: (a: number, b: number, c: number, d: number) => void;
48
46
  export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
49
- export const document_storeFill: (a: number, b: number, c: number, d: number) => void;
50
47
  export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
51
48
  export const document_toMarkdown: (a: number, b: number) => void;
52
49
  export const document_toStored: (a: number, b: number) => void;
@@ -55,13 +52,16 @@ export const exportMarkdown: (a: number, b: number) => void;
55
52
  export const formatDiagnostic: (a: number, b: number) => void;
56
53
  export const formatDocPath: (a: number, b: number) => void;
57
54
  export const importMarkdown: (a: number, b: number, c: number) => void;
55
+ export const isInline: (a: number, b: number) => void;
56
+ export const isPlain: (a: number, b: number) => void;
58
57
  export const mapMarks: (a: number, b: number, c: number) => void;
59
58
  export const mapPos: (a: number, b: number, c: number, d: number) => void;
60
59
  export const parseDocPath: (a: number, b: number, c: number) => void;
61
- export const quill__resolve: (a: number, b: number, c: number) => void;
60
+ export const quill__resolve: (a: number, b: number, c: number, d: number, e: number) => void;
62
61
  export const quill_backendId: (a: number, b: number) => void;
63
62
  export const quill_blueprint: (a: number, b: number) => void;
64
63
  export const quill_conform: (a: number, b: number, c: number) => void;
64
+ export const quill_emptyDocument: (a: number) => number;
65
65
  export const quill_fromTree: (a: number, b: number) => void;
66
66
  export const quill_metadata: (a: number, b: number) => void;
67
67
  export const quill_parse: (a: number, b: number, c: number, d: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.114.0",
3
+ "version": "0.116.0",
4
4
  "description": "WebAssembly bindings for Quillmark, a schema-driven document engine",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",