@quillmark/wasm 0.92.1 → 0.95.1
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 +301 -4
- package/README.md +167 -66
- package/backends/pdfform/wasm.d.ts +1066 -0
- package/backends/pdfform/wasm.js +9 -0
- package/backends/pdfform/wasm_bg.js +2654 -0
- package/backends/pdfform/wasm_bg.wasm +0 -0
- package/backends/pdfform/wasm_bg.wasm.d.ts +98 -0
- package/backends/typst/wasm.d.ts +584 -167
- package/backends/typst/wasm.js +1 -1
- package/backends/typst/wasm_bg.js +1047 -397
- package/backends/typst/wasm_bg.wasm +0 -0
- package/backends/typst/wasm_bg.wasm.d.ts +45 -25
- package/core/wasm.d.ts +412 -110
- package/core/wasm.js +1 -1
- package/core/wasm_bg.js +713 -226
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +31 -17
- package/package.json +4 -3
- package/runtime/runtime.d.ts +459 -21
- package/runtime/runtime.js +536 -30
package/core/wasm_bg.js
CHANGED
|
@@ -19,6 +19,218 @@ export class Document {
|
|
|
19
19
|
const ptr = this.__destroy_into_raw();
|
|
20
20
|
wasm.__wbg_document_free(ptr, 0);
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Build a composable card of `kind`, typed-commit `fields` onto it, set its
|
|
24
|
+
* body from optional markdown, and place it — the ABI under `writer.addCard`.
|
|
25
|
+
* `at` picks the position: absent appends, a number inserts at that index
|
|
26
|
+
* (`0..=cards.length`), so a positioned typed insert is one atomic call
|
|
27
|
+
* rather than `addCard` + `moveCard`. Fuses `makeCard` + typed commit +
|
|
28
|
+
* insertion transactionally: the card is committed in full before it joins
|
|
29
|
+
* the document, so a rejected field (or an invalid kind, body, or
|
|
30
|
+
* out-of-range `at`) leaves the document untouched. Field errors throw the
|
|
31
|
+
* same per-field diagnostic bundle as [`commitFields`](Self::commit_fields),
|
|
32
|
+
* including an `[EditError::UnknownField]` per undeclared name; an invalid
|
|
33
|
+
* kind or body, or an out-of-range position, throws a single-entry bundle
|
|
34
|
+
* keyed `$kind` / `$body`.
|
|
35
|
+
* @param {Quill} quill
|
|
36
|
+
* @param {string} kind
|
|
37
|
+
* @param {Record<string, unknown>} [fields]
|
|
38
|
+
* @param {string} [body]
|
|
39
|
+
* @param {number} [at]
|
|
40
|
+
*/
|
|
41
|
+
_addCard(quill, kind, fields, body, at) {
|
|
42
|
+
try {
|
|
43
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
44
|
+
_assertClass(quill, Quill);
|
|
45
|
+
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
46
|
+
const len0 = WASM_VECTOR_LEN;
|
|
47
|
+
var ptr1 = isLikeNone(body) ? 0 : passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
48
|
+
var len1 = WASM_VECTOR_LEN;
|
|
49
|
+
wasm.document__addCard(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0, isLikeNone(fields) ? 0 : addHeapObject(fields), ptr1, len1, isLikeNone(at) ? 0x100000001 : (at) >>> 0);
|
|
50
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
51
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
52
|
+
if (r1) {
|
|
53
|
+
throw takeObject(r0);
|
|
54
|
+
}
|
|
55
|
+
} finally {
|
|
56
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Typed field write at `addr`, resolving the field's schema `type` from
|
|
61
|
+
* `quill` — the stable ABI under the runtime `writer.set` / `writer.card(i).set`.
|
|
62
|
+
* The one write verb for **every** field type (richtext, scalar, array,
|
|
63
|
+
* object); the schema carries the `inline` constraint, so no type token or
|
|
64
|
+
* flag is passed. A richtext-typed field stores the canonical content, so
|
|
65
|
+
* identity marks (anchors, island ids) and content-only marks (e.g.
|
|
66
|
+
* `underline`) live on it and survive compiles and the storage DTO. Values
|
|
67
|
+
* use the encoding the seam already speaks: a content object or markdown
|
|
68
|
+
* string for richtext, a scalar/array/object otherwise.
|
|
69
|
+
*
|
|
70
|
+
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
71
|
+
* targets a composable card (its `$kind` resolves the schema). A body
|
|
72
|
+
* address throws — a body has no field schema; write it with `writer.setBody`
|
|
73
|
+
* / `revise`. A field declared in the schema is strict-committed (a mismatch
|
|
74
|
+
* throws now, not at render); a name the schema does not declare throws
|
|
75
|
+
* `[EditError::UnknownField]` rather than falling to the opaque store — on
|
|
76
|
+
* the typed path it is a typo. Use [`storeField`](Document::store_field) for
|
|
77
|
+
* opaque storage. Also throws `[EditError::FieldConform]` /
|
|
78
|
+
* `[EditError::FieldRichtextDecode]` / `[EditError::FieldRichtextNotInline]`
|
|
79
|
+
* on a typed mismatch, `[EditError::InvalidFieldName]` on a malformed name,
|
|
80
|
+
* and `[EditError::IndexOutOfRange]` on an out-of-range card.
|
|
81
|
+
*
|
|
82
|
+
* The `quill` handle is passed per call because a `Document` carries only a
|
|
83
|
+
* `$quill` reference, not the resolved schema.
|
|
84
|
+
* @param {Quill} quill
|
|
85
|
+
* @param {Addr | string} addr
|
|
86
|
+
* @param {any} value
|
|
87
|
+
*/
|
|
88
|
+
_commitField(quill, addr, value) {
|
|
89
|
+
try {
|
|
90
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
91
|
+
_assertClass(quill, Quill);
|
|
92
|
+
wasm.document__commitField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
93
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
94
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
95
|
+
if (r1) {
|
|
96
|
+
throw takeObject(r0);
|
|
97
|
+
}
|
|
98
|
+
} finally {
|
|
99
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Batched twin of [`commitField`](Document::commit_field): typed-commit
|
|
104
|
+
* several fields on the card `addr` targets atomically, resolving each
|
|
105
|
+
* field's schema `type` from `quill`. `addr` is a **card address**
|
|
106
|
+
* (`{ card }`, absent = main; a present `field` throws). All-or-nothing with
|
|
107
|
+
* the same per-field-diagnostic error contract as
|
|
108
|
+
* [`storeFields`](Document::store_fields) — nothing is applied on error and
|
|
109
|
+
* the thrown error's `diagnostics` carry one entry per offending field,
|
|
110
|
+
* including an `[EditError::UnknownField]` for any name the schema does not
|
|
111
|
+
* declare, so a whole-form submit sees every typo in one pass. Throws on an
|
|
112
|
+
* out-of-range card.
|
|
113
|
+
* @param {Quill} quill
|
|
114
|
+
* @param {CardAddr} addr
|
|
115
|
+
* @param {Record<string, unknown>} fields
|
|
116
|
+
*/
|
|
117
|
+
_commitFields(quill, addr, fields) {
|
|
118
|
+
try {
|
|
119
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
120
|
+
_assertClass(quill, Quill);
|
|
121
|
+
wasm.document__commitFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
|
|
122
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
123
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
124
|
+
if (r1) {
|
|
125
|
+
throw takeObject(r0);
|
|
126
|
+
}
|
|
127
|
+
} finally {
|
|
128
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Revise the richtext field at `addr` from markdown, typed *and*
|
|
133
|
+
* anchor-preserving — the ABI under `writer.reviseField`. Resolves the
|
|
134
|
+
* field's schema from `quill` (main card, or the addressed card's `$kind`)
|
|
135
|
+
* and defers to [`TypedWriter::revise_field`](quillmark_core::TypedWriter::revise_field):
|
|
136
|
+
* surviving anchors rebase (as [`revise`](Self::revise)), then the diffed
|
|
137
|
+
* result is schema-conformed, so a `richtext(inline)` field rejects a
|
|
138
|
+
* multi-block result with `[EditError::FieldRichtextNotInline]`. Returns the
|
|
139
|
+
* text [`Delta`].
|
|
140
|
+
*
|
|
141
|
+
* `addr` must name a field (a bare string is `{ field }`); a body address
|
|
142
|
+
* throws (a body carries no field schema — use [`revise`](Self::revise)). A
|
|
143
|
+
* name the schema does not declare throws `[EditError::UnknownField]`. Throws
|
|
144
|
+
* on an out-of-range card. Hidden from the `.d.ts`; the visible verb is
|
|
145
|
+
* `writer.reviseField` in the runtime layer.
|
|
146
|
+
* @param {Quill} quill
|
|
147
|
+
* @param {Addr | string} addr
|
|
148
|
+
* @param {string} markdown
|
|
149
|
+
* @returns {Delta}
|
|
150
|
+
*/
|
|
151
|
+
_reviseField(quill, addr, markdown) {
|
|
152
|
+
try {
|
|
153
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
154
|
+
_assertClass(quill, Quill);
|
|
155
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
156
|
+
const len0 = WASM_VECTOR_LEN;
|
|
157
|
+
wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
158
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
159
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
160
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
161
|
+
if (r2) {
|
|
162
|
+
throw takeObject(r1);
|
|
163
|
+
}
|
|
164
|
+
return takeObject(r0);
|
|
165
|
+
} finally {
|
|
166
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Interpreted read at `addr`, resolving the field's declared `type` from
|
|
171
|
+
* `quill` — the stable ABI under the runtime `view.get` / `view.card(i).get`.
|
|
172
|
+
* The schema-plane twin of the quill-free [`get`](Self::get): a `richtext`
|
|
173
|
+
* field returns its markdown projection, every other declared type its
|
|
174
|
+
* canonical value verbatim, so a consumer holding the quill reads by field
|
|
175
|
+
* meaning rather than by wire shape.
|
|
176
|
+
*
|
|
177
|
+
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
178
|
+
* targets a composable card (its `$kind` resolves the schema). Returns
|
|
179
|
+
* `undefined` for an **absent** field. An absent `addr.field` reads the body
|
|
180
|
+
* markdown — quill-free, mirroring [`getMarkdown`](Self::get_markdown), since
|
|
181
|
+
* a body's type is a format fact, not a schema fact. A name the schema does
|
|
182
|
+
* not declare throws `[EditError::UnknownField]` (the authority `getMarkdown`
|
|
183
|
+
* lacks — there an unknown name reads back `undefined`); a `richtext` field
|
|
184
|
+
* holding a value that does not decode throws `[EditError::FieldRichtextDecode]`;
|
|
185
|
+
* an out-of-range `addr.card` throws.
|
|
186
|
+
*
|
|
187
|
+
* The `quill` handle is passed per call because a `Document` carries only a
|
|
188
|
+
* `$quill` reference, not the resolved schema.
|
|
189
|
+
* @param {Quill} quill
|
|
190
|
+
* @param {Addr | string} addr
|
|
191
|
+
* @returns {unknown}
|
|
192
|
+
*/
|
|
193
|
+
_viewGet(quill, addr) {
|
|
194
|
+
try {
|
|
195
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
196
|
+
_assertClass(quill, Quill);
|
|
197
|
+
wasm.document__viewGet(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr));
|
|
198
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
199
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
200
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
201
|
+
if (r2) {
|
|
202
|
+
throw takeObject(r1);
|
|
203
|
+
}
|
|
204
|
+
return takeObject(r0);
|
|
205
|
+
} finally {
|
|
206
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* **Apply** a committed content edit `bundle` (`{ delta?, lineOps?, markOps? }`)
|
|
211
|
+
* at `addr` — the editor splice: text delta first, then line ops, then mark
|
|
212
|
+
* ops (mark ranges in final-text coordinates), each all-or-nothing. An absent
|
|
213
|
+
* `addr.field` targets the body, an absent `addr.card` the main card.
|
|
214
|
+
*
|
|
215
|
+
* Throws on an out-of-range card, a field that is not richtext, a malformed
|
|
216
|
+
* bundle, or an op that applies out of bounds (the value is unchanged on a
|
|
217
|
+
* failed apply).
|
|
218
|
+
* @param {Addr | string} addr
|
|
219
|
+
* @param {ChangeBundle} bundle
|
|
220
|
+
*/
|
|
221
|
+
applyChange(addr, bundle) {
|
|
222
|
+
try {
|
|
223
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
224
|
+
wasm.document_applyChange(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(bundle));
|
|
225
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
226
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
227
|
+
if (r1) {
|
|
228
|
+
throw takeObject(r0);
|
|
229
|
+
}
|
|
230
|
+
} finally {
|
|
231
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
22
234
|
/**
|
|
23
235
|
* Authoring-ergonomics header introducing a blueprint to an LLM/MCP
|
|
24
236
|
* consumer for the given `quillName`. Re-exposes core's canonical text for
|
|
@@ -45,6 +257,30 @@ export class Document {
|
|
|
45
257
|
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
46
258
|
}
|
|
47
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* A single composable card by index — the whole `Card`, the card-indexed
|
|
262
|
+
* twin of the [`main`](Self::main) getter, so reading one card need not
|
|
263
|
+
* materialize every card via [`cards`](Self::cards). An out-of-range
|
|
264
|
+
* `index` throws `[EditError::IndexOutOfRange]`, matching the card write
|
|
265
|
+
* verbs.
|
|
266
|
+
* @param {number} index
|
|
267
|
+
* @returns {Card}
|
|
268
|
+
*/
|
|
269
|
+
card(index) {
|
|
270
|
+
try {
|
|
271
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
272
|
+
wasm.document_card(retptr, this.__wbg_ptr, index);
|
|
273
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
274
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
275
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
276
|
+
if (r2) {
|
|
277
|
+
throw takeObject(r1);
|
|
278
|
+
}
|
|
279
|
+
return takeObject(r0);
|
|
280
|
+
} finally {
|
|
281
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
48
284
|
/**
|
|
49
285
|
* Number of composable cards (excludes the main card). O(1).
|
|
50
286
|
* @returns {number}
|
|
@@ -53,6 +289,20 @@ export class Document {
|
|
|
53
289
|
const ret = wasm.document_cardCount(this.__wbg_ptr);
|
|
54
290
|
return ret >>> 0;
|
|
55
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* The index of the first composable card whose `$id` equals `id`, or
|
|
294
|
+
* `undefined` when none carries it. Resolves the canonical durable address
|
|
295
|
+
* without a hand-rolled scan over [`cards`](Self::cards); `$id` is
|
|
296
|
+
* non-unique by design, so the first match wins.
|
|
297
|
+
* @param {string} id
|
|
298
|
+
* @returns {number | undefined}
|
|
299
|
+
*/
|
|
300
|
+
cardIndexById(id) {
|
|
301
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
302
|
+
const len0 = WASM_VECTOR_LEN;
|
|
303
|
+
const ret = wasm.document_cardIndexById(this.__wbg_ptr, ptr0, len0);
|
|
304
|
+
return takeObject(ret);
|
|
305
|
+
}
|
|
56
306
|
/**
|
|
57
307
|
* @returns {Card[]}
|
|
58
308
|
*/
|
|
@@ -208,15 +458,200 @@ export class Document {
|
|
|
208
458
|
}
|
|
209
459
|
}
|
|
210
460
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
461
|
+
* Read the value at `addr` — the raw stored payload value of a field (a
|
|
462
|
+
* content object for a richtext field, a scalar/array/object otherwise), or
|
|
463
|
+
* the **body content** when `addr.field` is absent. A bare string is `Addr`
|
|
464
|
+
* shorthand for `{ field }`. Reads are total over the field axis: an absent
|
|
465
|
+
* field is `undefined`; only an out-of-range `addr.card` throws
|
|
466
|
+
* `[EditError::IndexOutOfRange]`. Reads need no schema, so they live on
|
|
467
|
+
* `Document`, not the typed writer; for the markdown projection of a
|
|
468
|
+
* richtext value use [`getMarkdown`](Self::get_markdown).
|
|
469
|
+
* @param {Addr | string} addr
|
|
470
|
+
* @returns {unknown}
|
|
471
|
+
*/
|
|
472
|
+
get(addr) {
|
|
473
|
+
try {
|
|
474
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
475
|
+
wasm.document_get(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
476
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
477
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
478
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
479
|
+
if (r2) {
|
|
480
|
+
throw takeObject(r1);
|
|
481
|
+
}
|
|
482
|
+
return takeObject(r0);
|
|
483
|
+
} finally {
|
|
484
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* The whole `$ext` map at `addr` (a card address, absent `card` = main), or
|
|
489
|
+
* `undefined` when the card carries none. The fine-grained `$ext` read —
|
|
490
|
+
* your own state without serializing the whole card. Throws on a present
|
|
491
|
+
* `field` (a card address takes only `card`) or an out-of-range card.
|
|
492
|
+
* @param {CardAddr} [addr]
|
|
493
|
+
* @returns {Record<string, unknown> | undefined}
|
|
494
|
+
*/
|
|
495
|
+
getExt(addr) {
|
|
496
|
+
try {
|
|
497
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
498
|
+
wasm.document_getExt(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
499
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
500
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
501
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
502
|
+
if (r2) {
|
|
503
|
+
throw takeObject(r1);
|
|
504
|
+
}
|
|
505
|
+
return takeObject(r0);
|
|
506
|
+
} finally {
|
|
507
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
|
|
512
|
+
* = main), or `undefined`. The namespace-scoped `$ext` read — your own slot
|
|
513
|
+
* without a whole-card serialize, and non-destructive (unlike
|
|
514
|
+
* `removeExtNamespace`). Throws on a present `field` or an out-of-range card.
|
|
515
|
+
* @param {CardAddr} addr
|
|
516
|
+
* @param {string} ns
|
|
517
|
+
* @returns {unknown}
|
|
518
|
+
*/
|
|
519
|
+
getExtNamespace(addr, ns) {
|
|
520
|
+
try {
|
|
521
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
522
|
+
const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
523
|
+
const len0 = WASM_VECTOR_LEN;
|
|
524
|
+
wasm.document_getExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
525
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
526
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
527
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
528
|
+
if (r2) {
|
|
529
|
+
throw takeObject(r1);
|
|
530
|
+
}
|
|
531
|
+
return takeObject(r0);
|
|
532
|
+
} finally {
|
|
533
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* The **body** markdown projection — the main body, or a composable card's
|
|
538
|
+
* body (`{ card }`) — the on-demand, lossy export (content-only marks do not
|
|
539
|
+
* survive markdown). A body's type is a format fact, not a schema fact, so
|
|
540
|
+
* this read stays quill-free; a body is never absent.
|
|
541
|
+
*
|
|
542
|
+
* `addr` is an optional **card address** (`{ card }`, absent = main). A
|
|
543
|
+
* present `field` throws — a field's markdown is read through the
|
|
544
|
+
* schema-plane `quill.view(doc).get(field)`, which interprets by declared
|
|
545
|
+
* type (#978). An out-of-range `addr.card` throws.
|
|
546
|
+
* @param {CardAddr} [addr]
|
|
547
|
+
* @returns {string}
|
|
548
|
+
*/
|
|
549
|
+
getMarkdown(addr) {
|
|
550
|
+
try {
|
|
551
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
552
|
+
wasm.document_getMarkdown(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
553
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
554
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
555
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
556
|
+
if (r2) {
|
|
557
|
+
throw takeObject(r1);
|
|
558
|
+
}
|
|
559
|
+
return takeObject(r0);
|
|
560
|
+
} finally {
|
|
561
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Insert a card — the single insertion verb: `at` absent appends, a number
|
|
566
|
+
* inserts at that index (must be in `0..=cards.length`). Accepts a
|
|
567
|
+
* `CardInput` — a card read back (`cards` / `removeCard` / `quill.seedCard`),
|
|
568
|
+
* a [`makeCard`](Document::make_card) result, or a bare `{ kind, body }`
|
|
569
|
+
* (every returned `Card` is a valid `CardInput`). Throws if `card.kind` is
|
|
570
|
+
* not a valid kind name, or if `at` is out of range.
|
|
571
|
+
* @param {CardInput} card
|
|
572
|
+
* @param {number} [at]
|
|
573
|
+
*/
|
|
574
|
+
insertCard(card, at) {
|
|
575
|
+
try {
|
|
576
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
577
|
+
wasm.document_insertCard(retptr, this.__wbg_ptr, addHeapObject(card), isLikeNone(at) ? 0x100000001 : (at) >>> 0);
|
|
578
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
579
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
580
|
+
if (r1) {
|
|
581
|
+
throw takeObject(r0);
|
|
582
|
+
}
|
|
583
|
+
} finally {
|
|
584
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* **Install** a richtext value at `addr` — **value semantics**, content only.
|
|
589
|
+
* Stores exactly `rt` (a canonical `Content` content object); the identity
|
|
590
|
+
* anchors of any previous value are gone. An absent `addr.field` targets the
|
|
591
|
+
* body, an absent `addr.card` the main card. For "here's new markdown," use
|
|
592
|
+
* [`revise`](Document::revise); the cold-import path is spelled at the call
|
|
593
|
+
* site as `install(addr, importMarkdown(md))`, so anchor loss is visible in
|
|
594
|
+
* source.
|
|
595
|
+
*
|
|
596
|
+
* Throws on an out-of-range card, a malformed field name, or an `rt` that is
|
|
597
|
+
* not a canonical content object.
|
|
598
|
+
* @param {Addr | string} addr
|
|
599
|
+
* @param {Content} rt
|
|
600
|
+
*/
|
|
601
|
+
install(addr, rt) {
|
|
602
|
+
try {
|
|
603
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
604
|
+
wasm.document_install(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(rt));
|
|
605
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
606
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
607
|
+
if (r1) {
|
|
608
|
+
throw takeObject(r0);
|
|
609
|
+
}
|
|
610
|
+
} finally {
|
|
611
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
|
|
616
|
+
* shorthand for `{ field }`. `false` for an absent field (truthful — it isn't
|
|
617
|
+
* marked) and for a body address (a body is never a fill). Only an
|
|
618
|
+
* out-of-range `addr.card` throws.
|
|
619
|
+
* @param {Addr | string} addr
|
|
620
|
+
* @returns {boolean}
|
|
215
621
|
*/
|
|
216
|
-
|
|
622
|
+
isFill(addr) {
|
|
217
623
|
try {
|
|
218
624
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
219
|
-
wasm.
|
|
625
|
+
wasm.document_isFill(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
626
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
627
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
628
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
629
|
+
if (r2) {
|
|
630
|
+
throw takeObject(r1);
|
|
631
|
+
}
|
|
632
|
+
return r0 !== 0;
|
|
633
|
+
} finally {
|
|
634
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Replace this document's contents **in place** from a versioned storage
|
|
639
|
+
* DTO string — the mutating twin of the static
|
|
640
|
+
* [`fromJson`](Document::from_json) constructor. Parse-time `warnings` are
|
|
641
|
+
* cleared. Throws (leaving the document unchanged) on an invalid DTO.
|
|
642
|
+
*
|
|
643
|
+
* The cross-WASM-memory `Document` bridge: mutate a document on a
|
|
644
|
+
* backend-memory clone, then write the mutated state back into the caller's
|
|
645
|
+
* canonical document with this — the one way to update a live handle across
|
|
646
|
+
* the linear-memory seam without the caller re-binding its variable.
|
|
647
|
+
* @param {string} json
|
|
648
|
+
*/
|
|
649
|
+
loadJson(json) {
|
|
650
|
+
try {
|
|
651
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
652
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
653
|
+
const len0 = WASM_VECTOR_LEN;
|
|
654
|
+
wasm.document_loadJson(retptr, this.__wbg_ptr, ptr0, len0);
|
|
220
655
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
221
656
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
222
657
|
if (r1) {
|
|
@@ -248,10 +683,10 @@ export class Document {
|
|
|
248
683
|
}
|
|
249
684
|
/**
|
|
250
685
|
* Build a fresh `Card` from a kind and a flat field map — the ergonomic
|
|
251
|
-
* constructor for `
|
|
686
|
+
* constructor for `insertCard`. `fields` is an optional
|
|
252
687
|
* `Record<string, unknown>` (each entry becomes a card field, in
|
|
253
688
|
* insertion order); `body` defaults to `""`. Kind validity is checked by
|
|
254
|
-
* `
|
|
689
|
+
* `insertCard`, not here.
|
|
255
690
|
* @param {string} kind
|
|
256
691
|
* @param {Record<string, unknown>} [fields]
|
|
257
692
|
* @param {string} [body]
|
|
@@ -295,21 +730,29 @@ export class Document {
|
|
|
295
730
|
}
|
|
296
731
|
}
|
|
297
732
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
733
|
+
* `new Document(quillRef)` — a blank document: a main card carrying only
|
|
734
|
+
* `$quill`, an empty body, and no composable cards. The programmatic
|
|
735
|
+
* blank canvas: absent fields resolve at render time (`default`, else
|
|
736
|
+
* type-empty zero), so nothing the caller did not set reaches the
|
|
737
|
+
* output. For an example-filled starter use `Quill.seedDocument()`.
|
|
738
|
+
* Throws on an invalid quill reference. Mirrors Python `Document(quill_ref)`.
|
|
739
|
+
* @param {string} quill_ref
|
|
303
740
|
*/
|
|
304
|
-
|
|
741
|
+
constructor(quill_ref) {
|
|
305
742
|
try {
|
|
306
743
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
307
|
-
|
|
744
|
+
const ptr0 = passStringToWasm0(quill_ref, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
745
|
+
const len0 = WASM_VECTOR_LEN;
|
|
746
|
+
wasm.document_new(retptr, ptr0, len0);
|
|
308
747
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
309
748
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
310
|
-
|
|
311
|
-
|
|
749
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
750
|
+
if (r2) {
|
|
751
|
+
throw takeObject(r1);
|
|
312
752
|
}
|
|
753
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
754
|
+
DocumentFinalization.register(this, this.__wbg_ptr, this);
|
|
755
|
+
return this;
|
|
313
756
|
} finally {
|
|
314
757
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
315
758
|
}
|
|
@@ -377,16 +820,17 @@ export class Document {
|
|
|
377
820
|
}
|
|
378
821
|
}
|
|
379
822
|
/**
|
|
380
|
-
* Remove the `$ext` map
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
823
|
+
* Remove the `$ext` map on the card `addr` targets *entirely*, returning the
|
|
824
|
+
* previous map or `undefined` — a blunt escape hatch that discards every
|
|
825
|
+
* namespace at once (prefer `removeExtNamespace`). `addr` is a card address
|
|
826
|
+
* (absent = main). Throws on a present `field` or an out-of-range card.
|
|
827
|
+
* @param {CardAddr} [addr]
|
|
384
828
|
* @returns {Record<string, unknown> | undefined}
|
|
385
829
|
*/
|
|
386
|
-
|
|
830
|
+
removeExt(addr) {
|
|
387
831
|
try {
|
|
388
832
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
389
|
-
wasm.
|
|
833
|
+
wasm.document_removeExt(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
390
834
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
391
835
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
392
836
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -399,19 +843,20 @@ export class Document {
|
|
|
399
843
|
}
|
|
400
844
|
}
|
|
401
845
|
/**
|
|
402
|
-
* Remove `
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* @param {
|
|
846
|
+
* Remove `$ext[ns]` on the card `addr` targets, returning its value or
|
|
847
|
+
* `undefined`; drops `$ext` once empty. `addr` is a card address (absent =
|
|
848
|
+
* main). Preserves sibling namespaces. Throws on a present `field` or an
|
|
849
|
+
* out-of-range card.
|
|
850
|
+
* @param {CardAddr} addr
|
|
851
|
+
* @param {string} ns
|
|
407
852
|
* @returns {any}
|
|
408
853
|
*/
|
|
409
|
-
|
|
854
|
+
removeExtNamespace(addr, ns) {
|
|
410
855
|
try {
|
|
411
856
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
412
|
-
const ptr0 = passStringToWasm0(
|
|
857
|
+
const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
413
858
|
const len0 = WASM_VECTOR_LEN;
|
|
414
|
-
wasm.
|
|
859
|
+
wasm.document_removeExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
415
860
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
416
861
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
417
862
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -424,18 +869,17 @@ export class Document {
|
|
|
424
869
|
}
|
|
425
870
|
}
|
|
426
871
|
/**
|
|
427
|
-
* Remove a field
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
872
|
+
* Remove a field at `addr`, returning the removed value or `undefined`. A
|
|
873
|
+
* bare string is `Addr` shorthand for `{ field }`. One `remove` verb serves
|
|
874
|
+
* every write lane. A body address throws; throws on an out-of-range card or
|
|
875
|
+
* a malformed name.
|
|
876
|
+
* @param {Addr | string} addr
|
|
431
877
|
* @returns {any}
|
|
432
878
|
*/
|
|
433
|
-
|
|
879
|
+
removeField(addr) {
|
|
434
880
|
try {
|
|
435
881
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
436
|
-
|
|
437
|
-
const len0 = WASM_VECTOR_LEN;
|
|
438
|
-
wasm.document_removeCardField(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
882
|
+
wasm.document_removeField(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
439
883
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
440
884
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
441
885
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -448,64 +892,18 @@ export class Document {
|
|
|
448
892
|
}
|
|
449
893
|
}
|
|
450
894
|
/**
|
|
451
|
-
* Remove
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
* @returns {Record<string, unknown> | undefined}
|
|
456
|
-
*/
|
|
457
|
-
removeExt() {
|
|
458
|
-
try {
|
|
459
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
460
|
-
wasm.document_removeExt(retptr, this.__wbg_ptr);
|
|
461
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
462
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
463
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
464
|
-
if (r2) {
|
|
465
|
-
throw takeObject(r1);
|
|
466
|
-
}
|
|
467
|
-
return takeObject(r0);
|
|
468
|
-
} finally {
|
|
469
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Remove `namespace` from the main card's `$ext` map, returning the value
|
|
474
|
-
* stored there or `undefined`. This is the recommended way to clear `$ext`
|
|
475
|
-
* state: sibling namespaces survive, and when the last namespace is removed
|
|
476
|
-
* the `$ext` entry is dropped entirely (not left as `$ext: {}`).
|
|
477
|
-
* @param {string} namespace
|
|
478
|
-
* @returns {any}
|
|
479
|
-
*/
|
|
480
|
-
removeExtNamespace(namespace) {
|
|
481
|
-
try {
|
|
482
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
483
|
-
const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
484
|
-
const len0 = WASM_VECTOR_LEN;
|
|
485
|
-
wasm.document_removeExtNamespace(retptr, this.__wbg_ptr, ptr0, len0);
|
|
486
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
487
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
488
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
489
|
-
if (r2) {
|
|
490
|
-
throw takeObject(r1);
|
|
491
|
-
}
|
|
492
|
-
return takeObject(r0);
|
|
493
|
-
} finally {
|
|
494
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* Remove a payload field on the main card, returning the removed value or
|
|
499
|
-
* `undefined`. Throws if `name` does not match `[A-Za-z_][A-Za-z0-9_]*`.
|
|
500
|
-
* @param {string} name
|
|
895
|
+
* Remove `cardKind` from the main card's `$seed` map, returning its
|
|
896
|
+
* overlay or `undefined`; drops `$seed` entirely once empty. Sibling kinds
|
|
897
|
+
* survive. `$seed` is main-only, so this takes no address.
|
|
898
|
+
* @param {string} card_kind
|
|
501
899
|
* @returns {any}
|
|
502
900
|
*/
|
|
503
|
-
|
|
901
|
+
removeSeedNamespace(card_kind) {
|
|
504
902
|
try {
|
|
505
903
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
506
|
-
const ptr0 = passStringToWasm0(
|
|
904
|
+
const ptr0 = passStringToWasm0(card_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
507
905
|
const len0 = WASM_VECTOR_LEN;
|
|
508
|
-
wasm.
|
|
906
|
+
wasm.document_removeSeedNamespace(retptr, this.__wbg_ptr, ptr0, len0);
|
|
509
907
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
510
908
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
511
909
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -518,18 +916,25 @@ export class Document {
|
|
|
518
916
|
}
|
|
519
917
|
}
|
|
520
918
|
/**
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
*
|
|
919
|
+
* **Revise** the richtext value at `addr` from a markdown string — **edit
|
|
920
|
+
* semantics**, the default write path, returning the text [`Delta`]. Imports
|
|
921
|
+
* the markdown, diffs it against the current value, rebases surviving
|
|
922
|
+
* identity anchors, and returns the change an editor bridge maps its own
|
|
923
|
+
* positions through (`mapPos`). An absent `addr.field` targets the body, an
|
|
924
|
+
* absent `addr.card` the main card; an absent field cold-imports from empty.
|
|
925
|
+
*
|
|
926
|
+
* Throws on an out-of-range card, a malformed field name, a present
|
|
927
|
+
* non-content field value, or an over-nested markdown input.
|
|
928
|
+
* @param {Addr | string} addr
|
|
929
|
+
* @param {string} markdown
|
|
930
|
+
* @returns {Delta}
|
|
526
931
|
*/
|
|
527
|
-
|
|
932
|
+
revise(addr, markdown) {
|
|
528
933
|
try {
|
|
529
934
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
530
|
-
const ptr0 = passStringToWasm0(
|
|
935
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
531
936
|
const len0 = WASM_VECTOR_LEN;
|
|
532
|
-
wasm.
|
|
937
|
+
wasm.document_revise(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
533
938
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
534
939
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
535
940
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -541,14 +946,6 @@ export class Document {
|
|
|
541
946
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
542
947
|
}
|
|
543
948
|
}
|
|
544
|
-
/**
|
|
545
|
-
* @param {string} body
|
|
546
|
-
*/
|
|
547
|
-
replaceBody(body) {
|
|
548
|
-
const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
549
|
-
const len0 = WASM_VECTOR_LEN;
|
|
550
|
-
wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
|
|
551
|
-
}
|
|
552
949
|
/**
|
|
553
950
|
* Read the `schema` version tag from a raw storage DTO string without a
|
|
554
951
|
* full parse, or `undefined`. Returns unknown future versions as-is —
|
|
@@ -576,39 +973,44 @@ export class Document {
|
|
|
576
973
|
}
|
|
577
974
|
}
|
|
578
975
|
/**
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
*
|
|
976
|
+
* The main card's `$seed` overlay object for `kind` (the `$seed[kind]`
|
|
977
|
+
* entry), or `undefined` when absent. The cheap read that feeds
|
|
978
|
+
* `quill.seedCard(kind, overlay)` without serializing the whole main card
|
|
979
|
+
* via [`main`](Self::main) to fish out one key — and it keeps `seedCard`
|
|
980
|
+
* pure: the quill still never reads the document.
|
|
981
|
+
* @param {string} kind
|
|
982
|
+
* @returns {Record<string, unknown> | undefined}
|
|
584
983
|
*/
|
|
585
|
-
|
|
984
|
+
seedOverlay(kind) {
|
|
586
985
|
try {
|
|
587
986
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
588
|
-
|
|
987
|
+
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
988
|
+
const len0 = WASM_VECTOR_LEN;
|
|
989
|
+
wasm.document_seedOverlay(retptr, this.__wbg_ptr, ptr0, len0);
|
|
589
990
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
590
991
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
591
|
-
|
|
592
|
-
|
|
992
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
993
|
+
if (r2) {
|
|
994
|
+
throw takeObject(r1);
|
|
593
995
|
}
|
|
996
|
+
return takeObject(r0);
|
|
594
997
|
} finally {
|
|
595
998
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
596
999
|
}
|
|
597
1000
|
}
|
|
598
1001
|
/**
|
|
599
|
-
*
|
|
600
|
-
*
|
|
601
|
-
* Throws if out of range or `
|
|
1002
|
+
* Replace the kind of the card at `index`. Payload and body are untouched;
|
|
1003
|
+
* schema-aware migration is the caller's responsibility.
|
|
1004
|
+
* Throws if `index` is out of range or `newKind` is invalid.
|
|
602
1005
|
* @param {number} index
|
|
603
|
-
* @param {string}
|
|
604
|
-
* @param {any} value
|
|
1006
|
+
* @param {string} new_kind
|
|
605
1007
|
*/
|
|
606
|
-
|
|
1008
|
+
setCardKind(index, new_kind) {
|
|
607
1009
|
try {
|
|
608
1010
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
609
|
-
const ptr0 = passStringToWasm0(
|
|
1011
|
+
const ptr0 = passStringToWasm0(new_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
610
1012
|
const len0 = WASM_VECTOR_LEN;
|
|
611
|
-
wasm.
|
|
1013
|
+
wasm.document_setCardKind(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
612
1014
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
613
1015
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
614
1016
|
if (r1) {
|
|
@@ -619,18 +1021,15 @@ export class Document {
|
|
|
619
1021
|
}
|
|
620
1022
|
}
|
|
621
1023
|
/**
|
|
622
|
-
* Replace the
|
|
623
|
-
*
|
|
624
|
-
* Throws if `index` is out of range or `newKind` is invalid.
|
|
625
|
-
* @param {number} index
|
|
626
|
-
* @param {string} new_kind
|
|
1024
|
+
* Replace the QUILL reference string. Throws if `ref_str` is invalid.
|
|
1025
|
+
* @param {string} ref_str
|
|
627
1026
|
*/
|
|
628
|
-
|
|
1027
|
+
setQuillRef(ref_str) {
|
|
629
1028
|
try {
|
|
630
1029
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
631
|
-
const ptr0 = passStringToWasm0(
|
|
1030
|
+
const ptr0 = passStringToWasm0(ref_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
632
1031
|
const len0 = WASM_VECTOR_LEN;
|
|
633
|
-
wasm.
|
|
1032
|
+
wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
|
|
634
1033
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
635
1034
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
636
1035
|
if (r1) {
|
|
@@ -641,16 +1040,18 @@ export class Document {
|
|
|
641
1040
|
}
|
|
642
1041
|
}
|
|
643
1042
|
/**
|
|
644
|
-
* Replace the opaque `$ext` map on the
|
|
645
|
-
*
|
|
646
|
-
* never reaches the rendered output
|
|
647
|
-
* empty `$ext`.
|
|
1043
|
+
* Replace the opaque `$ext` map on the card `addr` targets (a card address,
|
|
1044
|
+
* absent `card` = main). `value` must be a plain object. `$ext` carries
|
|
1045
|
+
* out-of-band consumer state and never reaches the rendered output; pass
|
|
1046
|
+
* `{}` for an explicit empty `$ext`. Quill-free and verbatim — an opaque
|
|
1047
|
+
* `store` verb. Throws on a present `field` or an out-of-range card.
|
|
1048
|
+
* @param {CardAddr} addr
|
|
648
1049
|
* @param {any} value
|
|
649
1050
|
*/
|
|
650
|
-
|
|
1051
|
+
storeExt(addr, value) {
|
|
651
1052
|
try {
|
|
652
1053
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
653
|
-
wasm.
|
|
1054
|
+
wasm.document_storeExt(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
654
1055
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
655
1056
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
656
1057
|
if (r1) {
|
|
@@ -661,19 +1062,20 @@ export class Document {
|
|
|
661
1062
|
}
|
|
662
1063
|
}
|
|
663
1064
|
/**
|
|
664
|
-
* Merge `value` into
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
* @param {
|
|
1065
|
+
* Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
|
|
1066
|
+
* sibling namespaces — the recommended `$ext` write. `addr` is a card
|
|
1067
|
+
* address (absent = main). Quill-free and verbatim — an opaque `store` verb.
|
|
1068
|
+
* Throws on a present `field` or an out-of-range card.
|
|
1069
|
+
* @param {CardAddr} addr
|
|
1070
|
+
* @param {string} ns
|
|
669
1071
|
* @param {any} value
|
|
670
1072
|
*/
|
|
671
|
-
|
|
1073
|
+
storeExtNamespace(addr, ns, value) {
|
|
672
1074
|
try {
|
|
673
1075
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
674
|
-
const ptr0 = passStringToWasm0(
|
|
1076
|
+
const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
675
1077
|
const len0 = WASM_VECTOR_LEN;
|
|
676
|
-
wasm.
|
|
1078
|
+
wasm.document_storeExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0, addHeapObject(value));
|
|
677
1079
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
678
1080
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
679
1081
|
if (r1) {
|
|
@@ -684,18 +1086,21 @@ export class Document {
|
|
|
684
1086
|
}
|
|
685
1087
|
}
|
|
686
1088
|
/**
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
1089
|
+
* Store a field verbatim at `addr` — the opaque store (**store** = verbatim,
|
|
1090
|
+
* coercion deferred to render; the typed write is
|
|
1091
|
+
* [`commitField`](Document::commit_field)). A bare string is `Addr`
|
|
1092
|
+
* shorthand for `{ field }`, so `doc.storeField("qty", 3)` reads as written;
|
|
1093
|
+
* `{ card: 2, field: "qty" }` targets a composable card. Clears any
|
|
1094
|
+
* `!must_fill` marker. A body address (no `field`) throws — a body is never
|
|
1095
|
+
* opaque; write it with `revise` / `install` / `writer.setBody`. Throws on
|
|
1096
|
+
* an out-of-range card or a malformed name.
|
|
1097
|
+
* @param {Addr | string} addr
|
|
691
1098
|
* @param {any} value
|
|
692
1099
|
*/
|
|
693
|
-
|
|
1100
|
+
storeField(addr, value) {
|
|
694
1101
|
try {
|
|
695
1102
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
696
|
-
|
|
697
|
-
const len0 = WASM_VECTOR_LEN;
|
|
698
|
-
wasm.document_setField(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
|
|
1103
|
+
wasm.document_storeField(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
699
1104
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
700
1105
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
701
1106
|
if (r1) {
|
|
@@ -706,17 +1111,21 @@ export class Document {
|
|
|
706
1111
|
}
|
|
707
1112
|
}
|
|
708
1113
|
/**
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
1114
|
+
* Store several fields verbatim and atomically on the card `addr` targets —
|
|
1115
|
+
* the opaque store's batch. `addr` is a **card address** (`{ card }`, absent
|
|
1116
|
+
* = main); a present `field` throws. The batch verb takes the address first
|
|
1117
|
+
* and is never shape-overloaded, because `card` is a legal field name:
|
|
1118
|
+
* `storeFields({}, fields)` is the main card, `storeFields({ card: 2 },
|
|
1119
|
+
* fields)` a composable one — never ambiguous with "set field `card`".
|
|
1120
|
+
* Nothing is applied on error; the thrown error's `diagnostics` carry one
|
|
1121
|
+
* entry per offending field. Throws on an out-of-range card.
|
|
1122
|
+
* @param {CardAddr} addr
|
|
1123
|
+
* @param {Record<string, unknown>} fields
|
|
713
1124
|
*/
|
|
714
|
-
|
|
1125
|
+
storeFields(addr, fields) {
|
|
715
1126
|
try {
|
|
716
1127
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
717
|
-
|
|
718
|
-
const len0 = WASM_VECTOR_LEN;
|
|
719
|
-
wasm.document_setFill(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
|
|
1128
|
+
wasm.document_storeFields(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
|
|
720
1129
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
721
1130
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
722
1131
|
if (r1) {
|
|
@@ -727,15 +1136,17 @@ export class Document {
|
|
|
727
1136
|
}
|
|
728
1137
|
}
|
|
729
1138
|
/**
|
|
730
|
-
*
|
|
731
|
-
*
|
|
1139
|
+
* Store a field verbatim at `addr` and mark it `!must_fill` — the opaque
|
|
1140
|
+
* store's fill variant, card-capable (a bare string or `{ field }` for main,
|
|
1141
|
+
* `{ card, field }` for a composable card). A body address throws. Same
|
|
1142
|
+
* validation as [`storeField`](Document::store_field).
|
|
1143
|
+
* @param {Addr | string} addr
|
|
1144
|
+
* @param {any} value
|
|
732
1145
|
*/
|
|
733
|
-
|
|
1146
|
+
storeFill(addr, value) {
|
|
734
1147
|
try {
|
|
735
1148
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
736
|
-
|
|
737
|
-
const len0 = WASM_VECTOR_LEN;
|
|
738
|
-
wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1149
|
+
wasm.document_storeFill(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
739
1150
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
740
1151
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
741
1152
|
if (r1) {
|
|
@@ -746,19 +1157,20 @@ export class Document {
|
|
|
746
1157
|
}
|
|
747
1158
|
}
|
|
748
1159
|
/**
|
|
749
|
-
* Merge a card-kind's seed `overlay` into the main card's `$seed` map
|
|
750
|
-
* under `cardKind`, preserving sibling kinds
|
|
751
|
-
*
|
|
752
|
-
*
|
|
1160
|
+
* Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
|
|
1161
|
+
* under `cardKind`, preserving sibling kinds — `$seed` lives on the main
|
|
1162
|
+
* card by model, so this takes no address. Sets the starting values new
|
|
1163
|
+
* cards of that kind spawn with. Quill-free and verbatim — an opaque `store`
|
|
1164
|
+
* verb. Throws if `overlay` cannot be serialized or nests too deep.
|
|
753
1165
|
* @param {string} card_kind
|
|
754
1166
|
* @param {any} overlay
|
|
755
1167
|
*/
|
|
756
|
-
|
|
1168
|
+
storeSeedNamespace(card_kind, overlay) {
|
|
757
1169
|
try {
|
|
758
1170
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
759
1171
|
const ptr0 = passStringToWasm0(card_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
760
1172
|
const len0 = WASM_VECTOR_LEN;
|
|
761
|
-
wasm.
|
|
1173
|
+
wasm.document_storeSeedNamespace(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(overlay));
|
|
762
1174
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
763
1175
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
764
1176
|
if (r1) {
|
|
@@ -831,48 +1243,6 @@ export class Document {
|
|
|
831
1243
|
const ret = wasm.document_tryFromJson(ptr0, len0);
|
|
832
1244
|
return ret === 0 ? undefined : Document.__wrap(ret);
|
|
833
1245
|
}
|
|
834
|
-
/**
|
|
835
|
-
* Replace the body of the card at `index`. Throws if out of range.
|
|
836
|
-
* @param {number} index
|
|
837
|
-
* @param {string} body
|
|
838
|
-
*/
|
|
839
|
-
updateCardBody(index, body) {
|
|
840
|
-
try {
|
|
841
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
842
|
-
const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
843
|
-
const len0 = WASM_VECTOR_LEN;
|
|
844
|
-
wasm.document_updateCardBody(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
845
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
846
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
847
|
-
if (r1) {
|
|
848
|
-
throw takeObject(r0);
|
|
849
|
-
}
|
|
850
|
-
} finally {
|
|
851
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Update a field on the card at `index`.
|
|
856
|
-
* Throws if `index` is out of range, `name` is reserved or invalid.
|
|
857
|
-
* @param {number} index
|
|
858
|
-
* @param {string} name
|
|
859
|
-
* @param {any} value
|
|
860
|
-
*/
|
|
861
|
-
updateCardField(index, name, value) {
|
|
862
|
-
try {
|
|
863
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
864
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
865
|
-
const len0 = WASM_VECTOR_LEN;
|
|
866
|
-
wasm.document_updateCardField(retptr, this.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
|
|
867
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
868
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
869
|
-
if (r1) {
|
|
870
|
-
throw takeObject(r0);
|
|
871
|
-
}
|
|
872
|
-
} finally {
|
|
873
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
1246
|
/**
|
|
877
1247
|
* @returns {Diagnostic[]}
|
|
878
1248
|
*/
|
|
@@ -1003,9 +1373,10 @@ export class Quill {
|
|
|
1003
1373
|
}
|
|
1004
1374
|
/**
|
|
1005
1375
|
* Document schema for the quill: the user-fillable fields plus their
|
|
1006
|
-
* `ui` hints (group /
|
|
1007
|
-
* surface — drives form editors and LLM/MCP consumers
|
|
1008
|
-
* `
|
|
1376
|
+
* `ui` hints (title / group / compact / multiline). The single
|
|
1377
|
+
* field-metadata surface — drives form editors and LLM/MCP consumers
|
|
1378
|
+
* alike. Key order in `fields`/`properties` is declaration order — the
|
|
1379
|
+
* ordering contract. Returns the `QuillSchema` shape.
|
|
1009
1380
|
* @returns {QuillSchema}
|
|
1010
1381
|
*/
|
|
1011
1382
|
get schema() {
|
|
@@ -1028,9 +1399,9 @@ export class Quill {
|
|
|
1028
1399
|
* layering an optional per-kind seed `overlay` over the schema-example
|
|
1029
1400
|
* base (`overlay › example › absent`). Returns `undefined` if `cardKind`
|
|
1030
1401
|
* is not declared in this quill's schema, else a `Card` that feeds
|
|
1031
|
-
* straight into `Document.
|
|
1402
|
+
* straight into `Document.insertCard`.
|
|
1032
1403
|
*
|
|
1033
|
-
* Pass `document.
|
|
1404
|
+
* Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
|
|
1034
1405
|
* template-derived document inherits its curated starting values; omit it
|
|
1035
1406
|
* (or pass `undefined` / `null`) for the bare schema seed. `overlay` is a
|
|
1036
1407
|
* plain object — this reads the document, it does not mutate it.
|
|
@@ -1113,10 +1484,10 @@ export class Quill {
|
|
|
1113
1484
|
*
|
|
1114
1485
|
* Forwards the canonical `validation::*` diagnostics — same `code`,
|
|
1115
1486
|
* `path`, and `hint` the engine emits — including the non-fatal
|
|
1116
|
-
* `validation::
|
|
1117
|
-
* Field values, defaults, and order are not part of this
|
|
1118
|
-
* them from the `Document` payload and `Quill.schema`
|
|
1119
|
-
*
|
|
1487
|
+
* `validation::must_fill` warning for each `!must_fill` marker left in
|
|
1488
|
+
* the document. Field values, defaults, and order are not part of this
|
|
1489
|
+
* surface: read them from the `Document` payload and `Quill.schema`
|
|
1490
|
+
* (schema key order is display order).
|
|
1120
1491
|
* @param {Document} doc
|
|
1121
1492
|
* @returns {Diagnostic[]}
|
|
1122
1493
|
*/
|
|
@@ -1139,16 +1510,132 @@ export class Quill {
|
|
|
1139
1510
|
}
|
|
1140
1511
|
if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
|
|
1141
1512
|
|
|
1513
|
+
/**
|
|
1514
|
+
* Export a canonical `Content` content to its markdown projection — the pure
|
|
1515
|
+
* on-demand codec behind `exportMarkdown(card.body)`. Throws if `rt` is not a
|
|
1516
|
+
* canonical content.
|
|
1517
|
+
* @param {Content} rt
|
|
1518
|
+
* @returns {string}
|
|
1519
|
+
*/
|
|
1520
|
+
export function exportMarkdown(rt) {
|
|
1521
|
+
let deferred2_0;
|
|
1522
|
+
let deferred2_1;
|
|
1523
|
+
try {
|
|
1524
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1525
|
+
wasm.exportMarkdown(retptr, addHeapObject(rt));
|
|
1526
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1527
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1528
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1529
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1530
|
+
var ptr1 = r0;
|
|
1531
|
+
var len1 = r1;
|
|
1532
|
+
if (r3) {
|
|
1533
|
+
ptr1 = 0; len1 = 0;
|
|
1534
|
+
throw takeObject(r2);
|
|
1535
|
+
}
|
|
1536
|
+
deferred2_0 = ptr1;
|
|
1537
|
+
deferred2_1 = len1;
|
|
1538
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1539
|
+
} finally {
|
|
1540
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1541
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Import a markdown string to a canonical `Content` content — the pure,
|
|
1547
|
+
* document-free codec. Pair with `install(addr, importMarkdown(md))` to spell
|
|
1548
|
+
* the cold (anchor-losing) write at the call site; prefer `revise` for edit
|
|
1549
|
+
* semantics. Throws on an over-nested input.
|
|
1550
|
+
* @param {string} markdown
|
|
1551
|
+
* @returns {Content}
|
|
1552
|
+
*/
|
|
1553
|
+
export function importMarkdown(markdown) {
|
|
1554
|
+
try {
|
|
1555
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1556
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1557
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1558
|
+
wasm.importMarkdown(retptr, ptr0, len0);
|
|
1559
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1560
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1561
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1562
|
+
if (r2) {
|
|
1563
|
+
throw takeObject(r1);
|
|
1564
|
+
}
|
|
1565
|
+
return takeObject(r0);
|
|
1566
|
+
} finally {
|
|
1567
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1142
1571
|
/**
|
|
1143
1572
|
* Initialize the WASM module with panic hooks for better error messages
|
|
1144
1573
|
*/
|
|
1145
1574
|
export function init() {
|
|
1146
1575
|
wasm.init();
|
|
1147
1576
|
}
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Map a base content position through a `delta` to its new position — the pure
|
|
1580
|
+
* position-mapping codec an editor bridge composes to hold a caret stable
|
|
1581
|
+
* across a `revise`. `assoc` decides the side of a same-position insertion
|
|
1582
|
+
* (`"after"` moves past it). Throws on a malformed `delta`.
|
|
1583
|
+
* @param {Delta} delta
|
|
1584
|
+
* @param {number} pos
|
|
1585
|
+
* @param {Assoc} assoc
|
|
1586
|
+
* @returns {number}
|
|
1587
|
+
*/
|
|
1588
|
+
export function mapPos(delta, pos, assoc) {
|
|
1589
|
+
try {
|
|
1590
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1591
|
+
wasm.mapPos(retptr, addHeapObject(delta), pos, addHeapObject(assoc));
|
|
1592
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1593
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1594
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1595
|
+
if (r2) {
|
|
1596
|
+
throw takeObject(r1);
|
|
1597
|
+
}
|
|
1598
|
+
return r0 >>> 0;
|
|
1599
|
+
} finally {
|
|
1600
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* Rebase `markdown` onto a `base` content — the pure, document-free twin of
|
|
1606
|
+
* `revise`: cold-import + `diff_import`, returning the new `content` and the
|
|
1607
|
+
* text `delta` (surviving anchors rebased). Use it to compute a revise without
|
|
1608
|
+
* a document in hand; `revise(addr, md)` fuses this with the store for
|
|
1609
|
+
* atomicity. Throws on an over-nested markdown input or a non-content `base`.
|
|
1610
|
+
* @param {Content} base
|
|
1611
|
+
* @param {string} markdown
|
|
1612
|
+
* @returns {{ content: Content; delta: Delta }}
|
|
1613
|
+
*/
|
|
1614
|
+
export function rebase(base, markdown) {
|
|
1615
|
+
try {
|
|
1616
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1617
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1618
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1619
|
+
wasm.rebase(retptr, addHeapObject(base), ptr0, len0);
|
|
1620
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1621
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1622
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1623
|
+
if (r2) {
|
|
1624
|
+
throw takeObject(r1);
|
|
1625
|
+
}
|
|
1626
|
+
return takeObject(r0);
|
|
1627
|
+
} finally {
|
|
1628
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1148
1631
|
export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
|
|
1149
1632
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1150
1633
|
return addHeapObject(ret);
|
|
1151
1634
|
}
|
|
1635
|
+
export function __wbg_Number_32bf70a599af1d4b(arg0) {
|
|
1636
|
+
const ret = Number(getObject(arg0));
|
|
1637
|
+
return ret;
|
|
1638
|
+
}
|
|
1152
1639
|
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
1153
1640
|
const ret = String(getObject(arg1));
|
|
1154
1641
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|