@quillmark/wasm 0.123.1 → 0.125.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 +208 -0
- package/README.md +15 -10
- package/core/wasm.d.ts +125 -33
- package/core/wasm.js +122 -36
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +2 -0
- package/package.json +3 -2
- package/render/wasm.d.ts +162 -43
- package/render/wasm.js +154 -45
- package/render/wasm_bg.wasm +0 -0
- package/render/wasm_bg.wasm.d.ts +3 -0
- package/runtime/runtime.d.ts +79 -32
- package/runtime/runtime.js +80 -41
- package/sbom.cdx.json +12266 -0
package/core/wasm.js
CHANGED
|
@@ -26,11 +26,14 @@ export class Document {
|
|
|
26
26
|
* leaves the document untouched. Field errors throw the same per-field
|
|
27
27
|
* bundle as [`commitFields`](Self::commit_fields); an invalid kind or body,
|
|
28
28
|
* or a bad position, throws a single-entry bundle keyed `$kind` / `$body`.
|
|
29
|
+
* Returns the fields' `parse::dropped_construct` warnings, then the body
|
|
30
|
+
* import's, anchored under the placed card.
|
|
29
31
|
* @param {Quill} quill
|
|
30
32
|
* @param {string} kind
|
|
31
33
|
* @param {Record<string, unknown>} [fields]
|
|
32
34
|
* @param {string} [body]
|
|
33
35
|
* @param {number} [at]
|
|
36
|
+
* @returns {Diagnostic[]}
|
|
34
37
|
*/
|
|
35
38
|
_addCard(quill, kind, fields, body, at) {
|
|
36
39
|
try {
|
|
@@ -43,9 +46,11 @@ export class Document {
|
|
|
43
46
|
wasm.document__addCard(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0, isLikeNone(fields) ? 0 : addHeapObject(fields), ptr1, len1, isLikeNone(at) ? Number.MAX_SAFE_INTEGER : (at) >>> 0);
|
|
44
47
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
45
48
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
50
|
+
if (r2) {
|
|
51
|
+
throw takeObject(r1);
|
|
48
52
|
}
|
|
53
|
+
return takeObject(r0);
|
|
49
54
|
} finally {
|
|
50
55
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
51
56
|
}
|
|
@@ -68,9 +73,13 @@ export class Document {
|
|
|
68
73
|
*
|
|
69
74
|
* The `quill` handle is passed per call because a `Document` carries only a
|
|
70
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.
|
|
71
79
|
* @param {Quill} quill
|
|
72
80
|
* @param {Addr | string} addr
|
|
73
81
|
* @param {any} value
|
|
82
|
+
* @returns {Diagnostic[]}
|
|
74
83
|
*/
|
|
75
84
|
_commitField(quill, addr, value) {
|
|
76
85
|
try {
|
|
@@ -79,9 +88,11 @@ export class Document {
|
|
|
79
88
|
wasm.document__commitField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
80
89
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
81
90
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
92
|
+
if (r2) {
|
|
93
|
+
throw takeObject(r1);
|
|
84
94
|
}
|
|
95
|
+
return takeObject(r0);
|
|
85
96
|
} finally {
|
|
86
97
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
87
98
|
}
|
|
@@ -93,10 +104,12 @@ export class Document {
|
|
|
93
104
|
* diagnostic contract as [`storeFields`](Document::store_fields) — nothing
|
|
94
105
|
* applied on error, one `diagnostics` entry per offending field, including
|
|
95
106
|
* `edit::unknown_field` for undeclared names. Throws on an out-of-range
|
|
96
|
-
* card.
|
|
107
|
+
* card. Returns [`commitField`](Document::commit_field)'s warnings for
|
|
108
|
+
* every field, in batch order.
|
|
97
109
|
* @param {Quill} quill
|
|
98
110
|
* @param {CardAddr} addr
|
|
99
111
|
* @param {Record<string, unknown>} fields
|
|
112
|
+
* @returns {Diagnostic[]}
|
|
100
113
|
*/
|
|
101
114
|
_commitFields(quill, addr, fields) {
|
|
102
115
|
try {
|
|
@@ -105,9 +118,11 @@ export class Document {
|
|
|
105
118
|
wasm.document__commitFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
|
|
106
119
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
107
120
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
108
|
-
|
|
109
|
-
|
|
121
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
122
|
+
if (r2) {
|
|
123
|
+
throw takeObject(r1);
|
|
110
124
|
}
|
|
125
|
+
return takeObject(r0);
|
|
111
126
|
} finally {
|
|
112
127
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
113
128
|
}
|
|
@@ -228,14 +243,40 @@ export class Document {
|
|
|
228
243
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
229
244
|
}
|
|
230
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* The ABI under `writer.reviseDocument`: a whole-document revise, then
|
|
248
|
+
* conform against `quill`. Throws when `markdown` declares a `$quill` this quill
|
|
249
|
+
* does not answer to, before any mutation.
|
|
250
|
+
* @param {Quill} quill
|
|
251
|
+
* @param {string} markdown
|
|
252
|
+
* @returns {DocumentRevised}
|
|
253
|
+
*/
|
|
254
|
+
_reviseDocument(quill, markdown) {
|
|
255
|
+
try {
|
|
256
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
257
|
+
_assertClass(quill, Quill);
|
|
258
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
259
|
+
const len0 = WASM_VECTOR_LEN;
|
|
260
|
+
wasm.document__reviseDocument(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0);
|
|
261
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
262
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
263
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
264
|
+
if (r2) {
|
|
265
|
+
throw takeObject(r1);
|
|
266
|
+
}
|
|
267
|
+
return takeObject(r0);
|
|
268
|
+
} finally {
|
|
269
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
231
272
|
/**
|
|
232
273
|
* Revise the content field at `addr` from authored text, typed *and*
|
|
233
274
|
* anchor-preserving: the ABI under `writer.reviseField`. Surviving anchors
|
|
234
275
|
* rebase as in [`revise`](Self::revise), then the diffed result is
|
|
235
276
|
* schema-conformed, so a `richtext(inline)` field rejects a multi-block
|
|
236
|
-
* result with `edit::field_not_inline`. Returns the
|
|
237
|
-
* is the declared type's:
|
|
238
|
-
* text.
|
|
277
|
+
* result with `edit::field_not_inline`. Returns the `Revised` receipt, its
|
|
278
|
+
* warnings anchored at the field. The codec is the declared type's:
|
|
279
|
+
* `richtext` diffs markdown, `plaintext` literal text, which drops nothing.
|
|
239
280
|
*
|
|
240
281
|
* `addr` must name a field; a body address throws, since a body carries no
|
|
241
282
|
* field schema (use [`revise`](Self::revise)). An undeclared name throws
|
|
@@ -243,7 +284,7 @@ export class Document {
|
|
|
243
284
|
* @param {Quill} quill
|
|
244
285
|
* @param {Addr | string} addr
|
|
245
286
|
* @param {string} text
|
|
246
|
-
* @returns {
|
|
287
|
+
* @returns {Revised}
|
|
247
288
|
*/
|
|
248
289
|
_reviseField(quill, addr, text) {
|
|
249
290
|
try {
|
|
@@ -861,16 +902,18 @@ export class Document {
|
|
|
861
902
|
/**
|
|
862
903
|
* **Revise** the richtext value at `addr` from a markdown string: the
|
|
863
904
|
* default write path. Imports the markdown, diffs it against the current
|
|
864
|
-
* value, rebases surviving identity anchors, and returns the
|
|
865
|
-
* editor bridge maps its own positions through
|
|
866
|
-
* `
|
|
867
|
-
*
|
|
905
|
+
* value, rebases surviving identity anchors, and returns the `Revised`
|
|
906
|
+
* receipt: the text `delta` an editor bridge maps its own positions through
|
|
907
|
+
* (`mapPos`), and a `parse::dropped_construct` warning per construct the
|
|
908
|
+
* import dropped, its `path` the address written. An absent `addr.field`
|
|
909
|
+
* targets the body, an absent `addr.card` the main card; an absent field
|
|
910
|
+
* cold-imports from empty.
|
|
868
911
|
*
|
|
869
912
|
* Throws on an out-of-range card, a malformed field name, a present
|
|
870
913
|
* non-content field value, or an over-nested markdown input.
|
|
871
914
|
* @param {Addr | string} addr
|
|
872
915
|
* @param {string} markdown
|
|
873
|
-
* @returns {
|
|
916
|
+
* @returns {Revised}
|
|
874
917
|
*/
|
|
875
918
|
revise(addr, markdown) {
|
|
876
919
|
try {
|
|
@@ -1051,8 +1094,33 @@ export class Document {
|
|
|
1051
1094
|
}
|
|
1052
1095
|
}
|
|
1053
1096
|
/**
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1097
|
+
* `toMarkdown` with each prose anchor of every body and content field
|
|
1098
|
+
* spelled read-only at its start where its line can hold the tag, and
|
|
1099
|
+
* listed with its field's path and line either way. An import drops every
|
|
1100
|
+
* tag, so `writer.reviseDocument` with the markdown keeps the anchors it keeps
|
|
1101
|
+
* with `toMarkdown`'s.
|
|
1102
|
+
* @returns {AnnotatedMarkdown}
|
|
1103
|
+
*/
|
|
1104
|
+
toAnnotatedMarkdown() {
|
|
1105
|
+
try {
|
|
1106
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1107
|
+
wasm.document_toAnnotatedMarkdown(retptr, this.__wbg_ptr);
|
|
1108
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1109
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1110
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1111
|
+
if (r2) {
|
|
1112
|
+
throw takeObject(r1);
|
|
1113
|
+
}
|
|
1114
|
+
return takeObject(r0);
|
|
1115
|
+
} finally {
|
|
1116
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Emit canonical Quillmark Markdown. Re-parsing the result produces a
|
|
1121
|
+
* `Document` equal to `self` by value and by type, but for content: a body
|
|
1122
|
+
* or content field holds what its markdown spells, so its anchors drop and
|
|
1123
|
+
* its island ids re-mint. `toStored` keeps both.
|
|
1056
1124
|
* @returns {string}
|
|
1057
1125
|
*/
|
|
1058
1126
|
toMarkdown() {
|
|
@@ -1098,7 +1166,7 @@ export class Document {
|
|
|
1098
1166
|
* The non-fatal diagnostics of the load that produced this document: parse
|
|
1099
1167
|
* warnings, plus `conform::*` warnings when it came through `quill.parse`.
|
|
1100
1168
|
* Session state, not document value: `equals` and the storage DTO exclude
|
|
1101
|
-
* it, and `fromStored` / `loadStored` clear it.
|
|
1169
|
+
* it, and `fromStored` / `loadStored` / `writer.reviseDocument` clear it.
|
|
1102
1170
|
* @returns {Diagnostic[]}
|
|
1103
1171
|
*/
|
|
1104
1172
|
get warnings() {
|
|
@@ -1441,9 +1509,10 @@ export class Quill {
|
|
|
1441
1509
|
return takeObject(ret);
|
|
1442
1510
|
}
|
|
1443
1511
|
/**
|
|
1444
|
-
* Validate `doc` against this quill's schema, returning every diagnostic
|
|
1445
|
-
*
|
|
1446
|
-
* `validation
|
|
1512
|
+
* Validate `doc` against this quill's schema, returning every diagnostic:
|
|
1513
|
+
* an error blocks a render, a warning does not. Forwards the engine's
|
|
1514
|
+
* `validation::*`, a markdown string's `parse::dropped_construct` and the
|
|
1515
|
+
* backend's `backend::declined_construct`.
|
|
1447
1516
|
* @param {Document} doc
|
|
1448
1517
|
* @returns {Diagnostic[]}
|
|
1449
1518
|
*/
|
|
@@ -1557,7 +1626,7 @@ export function formatDiagnostic(diagnostic) {
|
|
|
1557
1626
|
}
|
|
1558
1627
|
|
|
1559
1628
|
/**
|
|
1560
|
-
* Serialize structured
|
|
1629
|
+
* Serialize structured `DocPathSeg` segments back to the canonical path
|
|
1561
1630
|
* string: the inverse of `parseDocPath`. Throws on a segment array the
|
|
1562
1631
|
* deserializer rejects, and on an empty one.
|
|
1563
1632
|
* @param {DocPathSeg[]} segs
|
|
@@ -1589,11 +1658,13 @@ export function formatDocPath(segs) {
|
|
|
1589
1658
|
}
|
|
1590
1659
|
|
|
1591
1660
|
/**
|
|
1592
|
-
* Import a markdown string
|
|
1593
|
-
*
|
|
1594
|
-
*
|
|
1661
|
+
* Import a markdown string: the pure, document-free codec. Returns the
|
|
1662
|
+
* canonical `content` and a `parse::dropped_construct` warning per construct
|
|
1663
|
+
* the import dropped, with no `path`. `overwrite(addr, importMarkdown(md).content)`
|
|
1664
|
+
* spells the cold, anchor-losing write; prefer `revise` for edit semantics.
|
|
1665
|
+
* Throws on an over-nested input.
|
|
1595
1666
|
* @param {string} markdown
|
|
1596
|
-
* @returns {
|
|
1667
|
+
* @returns {Imported}
|
|
1597
1668
|
*/
|
|
1598
1669
|
export function importMarkdown(markdown) {
|
|
1599
1670
|
try {
|
|
@@ -1726,7 +1797,7 @@ export function mapPos(delta, pos, assoc) {
|
|
|
1726
1797
|
|
|
1727
1798
|
/**
|
|
1728
1799
|
* Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
|
|
1729
|
-
* `main.body`, `recipients[0].name`) into structured
|
|
1800
|
+
* `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
|
|
1730
1801
|
* a consumer routes on segments instead of regexing the string. Throws on a
|
|
1731
1802
|
* malformed path.
|
|
1732
1803
|
* @param {string} path
|
|
@@ -1752,12 +1823,13 @@ export function parseDocPath(path) {
|
|
|
1752
1823
|
|
|
1753
1824
|
/**
|
|
1754
1825
|
* Rebase `markdown` onto a `base` content: the document-free twin of `revise`,
|
|
1755
|
-
* returning the new `content
|
|
1756
|
-
* `Content.text`, surviving anchors rebased)
|
|
1757
|
-
*
|
|
1826
|
+
* returning the new `content`, the text `delta` (offsets are USV indices into
|
|
1827
|
+
* `Content.text`, surviving anchors rebased), and the import's
|
|
1828
|
+
* `parse::dropped_construct` warnings, with no `path`. Throws on an
|
|
1829
|
+
* over-nested markdown input or a non-content `base`.
|
|
1758
1830
|
* @param {Content} base
|
|
1759
1831
|
* @param {string} markdown
|
|
1760
|
-
* @returns {{ content: Content; delta: Delta }}
|
|
1832
|
+
* @returns {{ content: Content; delta: Delta; warnings: Diagnostic[] }}
|
|
1761
1833
|
*/
|
|
1762
1834
|
export function rebase(base, markdown) {
|
|
1763
1835
|
try {
|
|
@@ -1918,10 +1990,6 @@ function __wbg_get_imports() {
|
|
|
1918
1990
|
const ret = getObject(arg0).getMonth();
|
|
1919
1991
|
return ret;
|
|
1920
1992
|
},
|
|
1921
|
-
__wbg_getOwnPropertyNames_f8299644de14134c: function(arg0) {
|
|
1922
|
-
const ret = Object.getOwnPropertyNames(getObject(arg0));
|
|
1923
|
-
return addHeapObject(ret);
|
|
1924
|
-
},
|
|
1925
1993
|
__wbg_getPrototypeOf_4e7d85b5bf38d546: function() { return handleError(function (arg0) {
|
|
1926
1994
|
const ret = Reflect.getPrototypeOf(getObject(arg0));
|
|
1927
1995
|
return addHeapObject(ret);
|
|
@@ -1952,6 +2020,16 @@ function __wbg_get_imports() {
|
|
|
1952
2020
|
const ret = result;
|
|
1953
2021
|
return ret;
|
|
1954
2022
|
},
|
|
2023
|
+
__wbg_instanceof_Error_80a725f81f2e102d: function(arg0) {
|
|
2024
|
+
let result;
|
|
2025
|
+
try {
|
|
2026
|
+
result = getObject(arg0) instanceof Error;
|
|
2027
|
+
} catch (_) {
|
|
2028
|
+
result = false;
|
|
2029
|
+
}
|
|
2030
|
+
const ret = result;
|
|
2031
|
+
return ret;
|
|
2032
|
+
},
|
|
1955
2033
|
__wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
|
|
1956
2034
|
let result;
|
|
1957
2035
|
try {
|
|
@@ -1992,6 +2070,10 @@ function __wbg_get_imports() {
|
|
|
1992
2070
|
const ret = getObject(arg0).length;
|
|
1993
2071
|
return ret;
|
|
1994
2072
|
},
|
|
2073
|
+
__wbg_message_5f8387f0c32b90a7: function(arg0) {
|
|
2074
|
+
const ret = getObject(arg0).message;
|
|
2075
|
+
return addHeapObject(ret);
|
|
2076
|
+
},
|
|
1995
2077
|
__wbg_new_0_72d020f0c63443d4: function() {
|
|
1996
2078
|
const ret = new Date();
|
|
1997
2079
|
return addHeapObject(ret);
|
|
@@ -2032,6 +2114,10 @@ function __wbg_get_imports() {
|
|
|
2032
2114
|
const ret = getObject(arg0).next();
|
|
2033
2115
|
return addHeapObject(ret);
|
|
2034
2116
|
}, arguments); },
|
|
2117
|
+
__wbg_ownKeys_7f46b96dc7311fe8: function() { return handleError(function (arg0) {
|
|
2118
|
+
const ret = Reflect.ownKeys(getObject(arg0));
|
|
2119
|
+
return addHeapObject(ret);
|
|
2120
|
+
}, arguments); },
|
|
2035
2121
|
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
2036
2122
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
2037
2123
|
},
|
package/core/wasm_bg.wasm
CHANGED
|
Binary file
|
package/core/wasm_bg.wasm.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const document__commitFields: (a: number, b: number, c: number, d: number
|
|
|
9
9
|
export const document__readerGet: (a: number, b: number, c: number, d: number) => void;
|
|
10
10
|
export const document__readerGetContent: (a: number, b: number, c: number, d: number) => void;
|
|
11
11
|
export const document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
|
+
export const document__reviseDocument: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
13
|
export const document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
13
14
|
export const document_applyChange: (a: number, b: number, c: number, d: number) => void;
|
|
14
15
|
export const document_bodyMarkdown: (a: number, b: number, c: number) => void;
|
|
@@ -45,6 +46,7 @@ export const document_storeExt: (a: number, b: number, c: number, d: number) =>
|
|
|
45
46
|
export const document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
46
47
|
export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
47
48
|
export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
49
|
+
export const document_toAnnotatedMarkdown: (a: number, b: number) => void;
|
|
48
50
|
export const document_toMarkdown: (a: number, b: number) => void;
|
|
49
51
|
export const document_toStored: (a: number, b: number) => void;
|
|
50
52
|
export const document_warnings: (a: number, b: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillmark/wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.125.0",
|
|
4
4
|
"description": "WebAssembly bindings for Quillmark, a schema-driven document engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"core",
|
|
16
16
|
"render",
|
|
17
17
|
"runtime",
|
|
18
|
-
"CHANGELOG.md"
|
|
18
|
+
"CHANGELOG.md",
|
|
19
|
+
"sbom.cdx.json"
|
|
19
20
|
],
|
|
20
21
|
"main": "./runtime/runtime.js",
|
|
21
22
|
"module": "./runtime/runtime.js",
|