@quillmark/wasm 0.58.0 → 0.58.2-rc.5
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/README.md +8 -4
- package/bundler/wasm.d.ts +176 -9
- package/bundler/wasm.js +1 -1
- package/bundler/wasm_bg.js +429 -19
- package/bundler/wasm_bg.wasm +0 -0
- package/bundler/wasm_bg.wasm.d.ts +32 -13
- package/node-esm/wasm.d.ts +176 -9
- package/node-esm/wasm.js +429 -19
- package/node-esm/wasm_bg.wasm +0 -0
- package/node-esm/wasm_bg.wasm.d.ts +32 -13
- package/package.json +1 -1
- package/node-esm/wasm_bg.js +0 -908
package/bundler/wasm_bg.js
CHANGED
|
@@ -1,38 +1,359 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Typed in-memory Quillmark document.
|
|
3
|
+
*
|
|
4
|
+
* Created via `Document.fromMarkdown(markdown)`. Exposes:
|
|
5
|
+
* - `quillRef` (string)
|
|
6
|
+
* - `frontmatter` (JS object/Record)
|
|
7
|
+
* - `body` (string)
|
|
8
|
+
* - `cards` (array of Card objects)
|
|
9
|
+
* - `warnings` (array of Diagnostic objects)
|
|
10
|
+
*
|
|
11
|
+
* `toMarkdown()` emits canonical Quillmark Markdown that round-trips back to
|
|
12
|
+
* an equal `Document` by value and by type.
|
|
13
|
+
*/
|
|
14
|
+
export class Document {
|
|
15
|
+
static __wrap(ptr) {
|
|
16
|
+
ptr = ptr >>> 0;
|
|
17
|
+
const obj = Object.create(Document.prototype);
|
|
18
|
+
obj.__wbg_ptr = ptr;
|
|
19
|
+
DocumentFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
2
22
|
__destroy_into_raw() {
|
|
3
23
|
const ptr = this.__wbg_ptr;
|
|
4
24
|
this.__wbg_ptr = 0;
|
|
5
|
-
|
|
25
|
+
DocumentFinalization.unregister(this);
|
|
6
26
|
return ptr;
|
|
7
27
|
}
|
|
8
28
|
free() {
|
|
9
29
|
const ptr = this.__destroy_into_raw();
|
|
10
|
-
wasm.
|
|
30
|
+
wasm.__wbg_document_free(ptr, 0);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Global Markdown body between frontmatter and the first card.
|
|
34
|
+
*
|
|
35
|
+
* Trailing newlines are stripped — those are structural separators in
|
|
36
|
+
* the Markdown wire format, not content the consumer wrote.
|
|
37
|
+
*
|
|
38
|
+
* Empty string when no body is present.
|
|
39
|
+
* @returns {string}
|
|
40
|
+
*/
|
|
41
|
+
get body() {
|
|
42
|
+
let deferred1_0;
|
|
43
|
+
let deferred1_1;
|
|
44
|
+
try {
|
|
45
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
46
|
+
wasm.document_body(retptr, this.__wbg_ptr);
|
|
47
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
48
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
49
|
+
deferred1_0 = r0;
|
|
50
|
+
deferred1_1 = r1;
|
|
51
|
+
return getStringFromWasm0(r0, r1);
|
|
52
|
+
} finally {
|
|
53
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
54
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
55
|
+
}
|
|
11
56
|
}
|
|
12
57
|
/**
|
|
13
|
-
*
|
|
58
|
+
* Ordered list of card blocks as JS objects with `tag`, `fields`, and `body`.
|
|
59
|
+
* @returns {any}
|
|
60
|
+
*/
|
|
61
|
+
get cards() {
|
|
62
|
+
const ret = wasm.document_cards(this.__wbg_ptr);
|
|
63
|
+
return takeObject(ret);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Parse markdown into a typed Document.
|
|
67
|
+
*
|
|
68
|
+
* Returns the document with any parse-time warnings accessible via `.warnings`.
|
|
69
|
+
* Throws on parse errors.
|
|
14
70
|
* @param {string} markdown
|
|
15
|
-
* @returns {
|
|
71
|
+
* @returns {Document}
|
|
16
72
|
*/
|
|
17
73
|
static fromMarkdown(markdown) {
|
|
18
74
|
try {
|
|
19
75
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
20
76
|
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
21
77
|
const len0 = WASM_VECTOR_LEN;
|
|
22
|
-
wasm.
|
|
78
|
+
wasm.document_fromMarkdown(retptr, ptr0, len0);
|
|
23
79
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
24
80
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
25
81
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
26
82
|
if (r2) {
|
|
27
83
|
throw takeObject(r1);
|
|
28
84
|
}
|
|
29
|
-
return
|
|
85
|
+
return Document.__wrap(r0);
|
|
86
|
+
} finally {
|
|
87
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Typed YAML frontmatter fields as a JS object (no QUILL, BODY, or CARDS keys).
|
|
92
|
+
* @returns {any}
|
|
93
|
+
*/
|
|
94
|
+
get frontmatter() {
|
|
95
|
+
const ret = wasm.document_frontmatter(this.__wbg_ptr);
|
|
96
|
+
return takeObject(ret);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Insert a card at the given index.
|
|
100
|
+
*
|
|
101
|
+
* `index` must be in `0..=cards.length`. Out-of-range throws an `Error`.
|
|
102
|
+
*
|
|
103
|
+
* Mutators never modify `warnings`.
|
|
104
|
+
* @param {number} index
|
|
105
|
+
* @param {any} card
|
|
106
|
+
*/
|
|
107
|
+
insertCard(index, card) {
|
|
108
|
+
try {
|
|
109
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
110
|
+
wasm.document_insertCard(retptr, this.__wbg_ptr, index, addHeapObject(card));
|
|
111
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
112
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
113
|
+
if (r1) {
|
|
114
|
+
throw takeObject(r0);
|
|
115
|
+
}
|
|
116
|
+
} finally {
|
|
117
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Move the card at `from` to position `to`.
|
|
122
|
+
*
|
|
123
|
+
* `from == to` is a no-op. Both indices must be in `0..cards.length`.
|
|
124
|
+
* Out-of-range throws an `Error`.
|
|
125
|
+
*
|
|
126
|
+
* Mutators never modify `warnings`.
|
|
127
|
+
* @param {number} from
|
|
128
|
+
* @param {number} to
|
|
129
|
+
*/
|
|
130
|
+
moveCard(from, to) {
|
|
131
|
+
try {
|
|
132
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
133
|
+
wasm.document_moveCard(retptr, this.__wbg_ptr, from, to);
|
|
134
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
135
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
136
|
+
if (r1) {
|
|
137
|
+
throw takeObject(r0);
|
|
138
|
+
}
|
|
139
|
+
} finally {
|
|
140
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Append a card to the end of the card list.
|
|
145
|
+
*
|
|
146
|
+
* `card` must be a JS object with a `tag` string field and optional
|
|
147
|
+
* `fields` (object) and `body` (string).
|
|
148
|
+
*
|
|
149
|
+
* Throws an `Error` if `card.tag` is not a valid tag name.
|
|
150
|
+
*
|
|
151
|
+
* Mutators never modify `warnings`.
|
|
152
|
+
* @param {any} card
|
|
153
|
+
*/
|
|
154
|
+
pushCard(card) {
|
|
155
|
+
try {
|
|
156
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
157
|
+
wasm.document_pushCard(retptr, this.__wbg_ptr, addHeapObject(card));
|
|
158
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
159
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
160
|
+
if (r1) {
|
|
161
|
+
throw takeObject(r0);
|
|
162
|
+
}
|
|
163
|
+
} finally {
|
|
164
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The QUILL reference string (e.g. `"usaf_memo@0.1"`).
|
|
169
|
+
* @returns {string}
|
|
170
|
+
*/
|
|
171
|
+
get quillRef() {
|
|
172
|
+
let deferred1_0;
|
|
173
|
+
let deferred1_1;
|
|
174
|
+
try {
|
|
175
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
176
|
+
wasm.document_quillRef(retptr, this.__wbg_ptr);
|
|
177
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
178
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
179
|
+
deferred1_0 = r0;
|
|
180
|
+
deferred1_1 = r1;
|
|
181
|
+
return getStringFromWasm0(r0, r1);
|
|
182
|
+
} finally {
|
|
183
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
184
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Remove the card at `index` and return it, or `undefined` if out of range.
|
|
189
|
+
*
|
|
190
|
+
* Mutators never modify `warnings`.
|
|
191
|
+
* @param {number} index
|
|
192
|
+
* @returns {any}
|
|
193
|
+
*/
|
|
194
|
+
removeCard(index) {
|
|
195
|
+
const ret = wasm.document_removeCard(this.__wbg_ptr, index);
|
|
196
|
+
return takeObject(ret);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Remove a frontmatter field, returning the removed value or `undefined`.
|
|
200
|
+
*
|
|
201
|
+
* Mutators never modify `warnings`.
|
|
202
|
+
* @param {string} name
|
|
203
|
+
* @returns {any}
|
|
204
|
+
*/
|
|
205
|
+
removeField(name) {
|
|
206
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
208
|
+
const ret = wasm.document_removeField(this.__wbg_ptr, ptr0, len0);
|
|
209
|
+
return takeObject(ret);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Replace the global Markdown body.
|
|
213
|
+
*
|
|
214
|
+
* Mutators never modify `warnings`.
|
|
215
|
+
* @param {string} body
|
|
216
|
+
*/
|
|
217
|
+
replaceBody(body) {
|
|
218
|
+
const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
219
|
+
const len0 = WASM_VECTOR_LEN;
|
|
220
|
+
wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Set a frontmatter field.
|
|
224
|
+
*
|
|
225
|
+
* Throws an `Error` whose message includes the `EditError` variant name and
|
|
226
|
+
* details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`) or does
|
|
227
|
+
* not match `[a-z_][a-z0-9_]*`.
|
|
228
|
+
*
|
|
229
|
+
* Mutators never modify `warnings`.
|
|
230
|
+
* @param {string} name
|
|
231
|
+
* @param {any} value
|
|
232
|
+
*/
|
|
233
|
+
setField(name, value) {
|
|
234
|
+
try {
|
|
235
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
236
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
237
|
+
const len0 = WASM_VECTOR_LEN;
|
|
238
|
+
wasm.document_setField(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
|
|
239
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
240
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
241
|
+
if (r1) {
|
|
242
|
+
throw takeObject(r0);
|
|
243
|
+
}
|
|
30
244
|
} finally {
|
|
31
245
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
32
246
|
}
|
|
33
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Replace the QUILL reference string.
|
|
250
|
+
*
|
|
251
|
+
* Throws if `ref_str` is not a valid `QuillReference`.
|
|
252
|
+
*
|
|
253
|
+
* Mutators never modify `warnings`.
|
|
254
|
+
* @param {string} ref_str
|
|
255
|
+
*/
|
|
256
|
+
setQuillRef(ref_str) {
|
|
257
|
+
try {
|
|
258
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
259
|
+
const ptr0 = passStringToWasm0(ref_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
260
|
+
const len0 = WASM_VECTOR_LEN;
|
|
261
|
+
wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
|
|
262
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
263
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
264
|
+
if (r1) {
|
|
265
|
+
throw takeObject(r0);
|
|
266
|
+
}
|
|
267
|
+
} finally {
|
|
268
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Emit canonical Quillmark Markdown.
|
|
273
|
+
*
|
|
274
|
+
* Returns the document serialised as a Quillmark Markdown string.
|
|
275
|
+
* The output is type-fidelity round-trip safe: re-parsing the result
|
|
276
|
+
* produces a `Document` equal to `self` by value and by type.
|
|
277
|
+
* @returns {string}
|
|
278
|
+
*/
|
|
279
|
+
toMarkdown() {
|
|
280
|
+
let deferred1_0;
|
|
281
|
+
let deferred1_1;
|
|
282
|
+
try {
|
|
283
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
284
|
+
wasm.document_toMarkdown(retptr, this.__wbg_ptr);
|
|
285
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
286
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
287
|
+
deferred1_0 = r0;
|
|
288
|
+
deferred1_1 = r1;
|
|
289
|
+
return getStringFromWasm0(r0, r1);
|
|
290
|
+
} finally {
|
|
291
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
292
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Replace the body of the card at `index`.
|
|
297
|
+
*
|
|
298
|
+
* Throws if `index` is out of range.
|
|
299
|
+
*
|
|
300
|
+
* Mutators never modify `warnings`.
|
|
301
|
+
* @param {number} index
|
|
302
|
+
* @param {string} body
|
|
303
|
+
*/
|
|
304
|
+
updateCardBody(index, body) {
|
|
305
|
+
try {
|
|
306
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
307
|
+
const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
308
|
+
const len0 = WASM_VECTOR_LEN;
|
|
309
|
+
wasm.document_updateCardBody(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
310
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
311
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
312
|
+
if (r1) {
|
|
313
|
+
throw takeObject(r0);
|
|
314
|
+
}
|
|
315
|
+
} finally {
|
|
316
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Update a field on the card at `index`.
|
|
321
|
+
*
|
|
322
|
+
* Convenience method: equivalent to `doc.card_mut(index)?.set_field(name, value)`.
|
|
323
|
+
*
|
|
324
|
+
* Throws if `index` is out of range, `name` is reserved or invalid, or
|
|
325
|
+
* `value` cannot be serialized.
|
|
326
|
+
*
|
|
327
|
+
* Mutators never modify `warnings`.
|
|
328
|
+
* @param {number} index
|
|
329
|
+
* @param {string} name
|
|
330
|
+
* @param {any} value
|
|
331
|
+
*/
|
|
332
|
+
updateCardField(index, name, value) {
|
|
333
|
+
try {
|
|
334
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
335
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
337
|
+
wasm.document_updateCardField(retptr, this.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
|
|
338
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
339
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
340
|
+
if (r1) {
|
|
341
|
+
throw takeObject(r0);
|
|
342
|
+
}
|
|
343
|
+
} finally {
|
|
344
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Non-fatal parse-time warnings as a JS array of Diagnostic objects.
|
|
349
|
+
* @returns {any}
|
|
350
|
+
*/
|
|
351
|
+
get warnings() {
|
|
352
|
+
const ret = wasm.document_warnings(this.__wbg_ptr);
|
|
353
|
+
return takeObject(ret);
|
|
354
|
+
}
|
|
34
355
|
}
|
|
35
|
-
if (Symbol.dispose)
|
|
356
|
+
if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free;
|
|
36
357
|
|
|
37
358
|
/**
|
|
38
359
|
* Opaque, shareable Quill handle.
|
|
@@ -55,15 +376,36 @@ export class Quill {
|
|
|
55
376
|
const ptr = this.__destroy_into_raw();
|
|
56
377
|
wasm.__wbg_quill_free(ptr, 0);
|
|
57
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* The resolved backend identifier (e.g. `"typst"`).
|
|
381
|
+
* @returns {string}
|
|
382
|
+
*/
|
|
383
|
+
get backendId() {
|
|
384
|
+
let deferred1_0;
|
|
385
|
+
let deferred1_1;
|
|
386
|
+
try {
|
|
387
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
388
|
+
wasm.quill_backendId(retptr, this.__wbg_ptr);
|
|
389
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
390
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
391
|
+
deferred1_0 = r0;
|
|
392
|
+
deferred1_1 = r1;
|
|
393
|
+
return getStringFromWasm0(r0, r1);
|
|
394
|
+
} finally {
|
|
395
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
396
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
58
399
|
/**
|
|
59
400
|
* Open an iterative render session for page-selective rendering.
|
|
60
|
-
* @param {
|
|
401
|
+
* @param {Document} doc
|
|
61
402
|
* @returns {RenderSession}
|
|
62
403
|
*/
|
|
63
|
-
open(
|
|
404
|
+
open(doc) {
|
|
64
405
|
try {
|
|
65
406
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
66
|
-
|
|
407
|
+
_assertClass(doc, Document);
|
|
408
|
+
wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
67
409
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
68
410
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
69
411
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -75,16 +417,55 @@ export class Quill {
|
|
|
75
417
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
76
418
|
}
|
|
77
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Project a document through this quill's schema.
|
|
422
|
+
*
|
|
423
|
+
* Returns a plain JS object (not a class) that is immediately
|
|
424
|
+
* `JSON.stringify`-able. The shape mirrors [`FormProjection`]:
|
|
425
|
+
*
|
|
426
|
+
* ```json
|
|
427
|
+
* {
|
|
428
|
+
* "main": { "schema": {...}, "values": { "field": {...} } },
|
|
429
|
+
* "cards": [ ... ],
|
|
430
|
+
* "diagnostics": [ ... ]
|
|
431
|
+
* }
|
|
432
|
+
* ```
|
|
433
|
+
*
|
|
434
|
+
* **Snapshot semantics.** This is a read-only snapshot of the document
|
|
435
|
+
* at call time. Subsequent edits to `doc` require calling `projectForm`
|
|
436
|
+
* again.
|
|
437
|
+
*
|
|
438
|
+
* [`FormProjection`]: quillmark::form::FormProjection
|
|
439
|
+
* @param {Document} doc
|
|
440
|
+
* @returns {any}
|
|
441
|
+
*/
|
|
442
|
+
projectForm(doc) {
|
|
443
|
+
try {
|
|
444
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
445
|
+
_assertClass(doc, Document);
|
|
446
|
+
wasm.quill_projectForm(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
447
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
448
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
449
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
450
|
+
if (r2) {
|
|
451
|
+
throw takeObject(r1);
|
|
452
|
+
}
|
|
453
|
+
return takeObject(r0);
|
|
454
|
+
} finally {
|
|
455
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
78
458
|
/**
|
|
79
459
|
* Render a document to final artifacts.
|
|
80
|
-
* @param {
|
|
81
|
-
* @param {RenderOptions} opts
|
|
460
|
+
* @param {Document} doc
|
|
461
|
+
* @param {RenderOptions | null} [opts]
|
|
82
462
|
* @returns {RenderResult}
|
|
83
463
|
*/
|
|
84
|
-
render(
|
|
464
|
+
render(doc, opts) {
|
|
85
465
|
try {
|
|
86
466
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
87
|
-
|
|
467
|
+
_assertClass(doc, Document);
|
|
468
|
+
wasm.quill_render(retptr, this.__wbg_ptr, doc.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
|
|
88
469
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
89
470
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
90
471
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -175,13 +556,13 @@ export class RenderSession {
|
|
|
175
556
|
}
|
|
176
557
|
/**
|
|
177
558
|
* Render all or selected pages from this session.
|
|
178
|
-
* @param {RenderOptions} opts
|
|
559
|
+
* @param {RenderOptions | null} [opts]
|
|
179
560
|
* @returns {RenderResult}
|
|
180
561
|
*/
|
|
181
562
|
render(opts) {
|
|
182
563
|
try {
|
|
183
564
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
184
|
-
wasm.rendersession_render(retptr, this.__wbg_ptr, addHeapObject(opts));
|
|
565
|
+
wasm.rendersession_render(retptr, this.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
|
|
185
566
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
186
567
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
187
568
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -206,6 +587,17 @@ export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
|
|
|
206
587
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
207
588
|
return addHeapObject(ret);
|
|
208
589
|
}
|
|
590
|
+
export function __wbg_Number_32bf70a599af1d4b(arg0) {
|
|
591
|
+
const ret = Number(getObject(arg0));
|
|
592
|
+
return ret;
|
|
593
|
+
}
|
|
594
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
595
|
+
const ret = String(getObject(arg1));
|
|
596
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
597
|
+
const len1 = WASM_VECTOR_LEN;
|
|
598
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
599
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
600
|
+
}
|
|
209
601
|
export function __wbg_String_b51de6b05a10845b(arg0, arg1) {
|
|
210
602
|
const ret = String(getObject(arg1));
|
|
211
603
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -343,6 +735,10 @@ export function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {
|
|
|
343
735
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
344
736
|
return addHeapObject(ret);
|
|
345
737
|
}
|
|
738
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
739
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
740
|
+
return addHeapObject(ret);
|
|
741
|
+
}
|
|
346
742
|
export function __wbg_get_with_ref_key_f64427178466f623(arg0, arg1) {
|
|
347
743
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
348
744
|
return addHeapObject(ret);
|
|
@@ -413,6 +809,10 @@ export function __wbg_new_34d45cc8e36aaead() {
|
|
|
413
809
|
const ret = new Map();
|
|
414
810
|
return addHeapObject(ret);
|
|
415
811
|
}
|
|
812
|
+
export function __wbg_new_5e360d2ff7b9e1c3(arg0, arg1) {
|
|
813
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
814
|
+
return addHeapObject(ret);
|
|
815
|
+
}
|
|
416
816
|
export function __wbg_new_682678e2f47e32bc() {
|
|
417
817
|
const ret = new Array();
|
|
418
818
|
return addHeapObject(ret);
|
|
@@ -440,6 +840,10 @@ export function __wbg_now_a9b7df1cbee90986() {
|
|
|
440
840
|
export function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {
|
|
441
841
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
442
842
|
}
|
|
843
|
+
export function __wbg_set_022bee52d0b05b19() { return handleError(function (arg0, arg1, arg2) {
|
|
844
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
845
|
+
return ret;
|
|
846
|
+
}, arguments); }
|
|
443
847
|
export function __wbg_set_3bf1de9fab0cd644(arg0, arg1, arg2) {
|
|
444
848
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
445
849
|
}
|
|
@@ -491,9 +895,9 @@ export function __wbindgen_object_clone_ref(arg0) {
|
|
|
491
895
|
export function __wbindgen_object_drop_ref(arg0) {
|
|
492
896
|
takeObject(arg0);
|
|
493
897
|
}
|
|
494
|
-
const
|
|
898
|
+
const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
495
899
|
? { register: () => {}, unregister: () => {} }
|
|
496
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
900
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr >>> 0, 1));
|
|
497
901
|
const QuillFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
498
902
|
? { register: () => {}, unregister: () => {} }
|
|
499
903
|
: new FinalizationRegistry(ptr => wasm.__wbg_quill_free(ptr >>> 0, 1));
|
|
@@ -513,6 +917,12 @@ function addHeapObject(obj) {
|
|
|
513
917
|
return idx;
|
|
514
918
|
}
|
|
515
919
|
|
|
920
|
+
function _assertClass(instance, klass) {
|
|
921
|
+
if (!(instance instanceof klass)) {
|
|
922
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
516
926
|
function debugString(val) {
|
|
517
927
|
// primitive types
|
|
518
928
|
const type = typeof val;
|
package/bundler/wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,30 +1,49 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
4
|
+
export const __wbg_document_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_quill_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_quillmark_free: (a: number, b: number) => void;
|
|
6
7
|
export const __wbg_rendersession_free: (a: number, b: number) => void;
|
|
8
|
+
export const document_body: (a: number, b: number) => void;
|
|
9
|
+
export const document_cards: (a: number) => number;
|
|
10
|
+
export const document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
11
|
+
export const document_frontmatter: (a: number) => number;
|
|
12
|
+
export const document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
13
|
+
export const document_moveCard: (a: number, b: number, c: number, d: number) => void;
|
|
14
|
+
export const document_pushCard: (a: number, b: number, c: number) => void;
|
|
15
|
+
export const document_quillRef: (a: number, b: number) => void;
|
|
16
|
+
export const document_removeCard: (a: number, b: number) => number;
|
|
17
|
+
export const document_removeField: (a: number, b: number, c: number) => number;
|
|
18
|
+
export const document_replaceBody: (a: number, b: number, c: number) => void;
|
|
19
|
+
export const document_setField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
|
+
export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
21
|
+
export const document_toMarkdown: (a: number, b: number) => void;
|
|
22
|
+
export const document_updateCardBody: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
23
|
+
export const document_updateCardField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
24
|
+
export const document_warnings: (a: number) => number;
|
|
25
|
+
export const init: () => void;
|
|
26
|
+
export const quill_backendId: (a: number, b: number) => void;
|
|
27
|
+
export const quill_open: (a: number, b: number, c: number) => void;
|
|
28
|
+
export const quill_projectForm: (a: number, b: number, c: number) => void;
|
|
29
|
+
export const quill_render: (a: number, b: number, c: number, d: number) => void;
|
|
7
30
|
export const quillmark_new: () => number;
|
|
8
31
|
export const quillmark_quill: (a: number, b: number, c: number) => void;
|
|
9
|
-
export const quill_render: (a: number, b: number, c: number, d: number) => void;
|
|
10
|
-
export const quill_open: (a: number, b: number, c: number) => void;
|
|
11
|
-
export const parseddocument_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
12
32
|
export const rendersession_pageCount: (a: number) => number;
|
|
13
33
|
export const rendersession_render: (a: number, b: number, c: number) => void;
|
|
14
|
-
export const
|
|
15
|
-
export const qcms_profile_is_bogus: (a: number) => number;
|
|
16
|
-
export const qcms_white_point_sRGB: (a: number) => void;
|
|
34
|
+
export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
|
|
17
35
|
export const qcms_profile_precache_output_transform: (a: number) => void;
|
|
18
|
-
export const
|
|
19
|
-
export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
20
|
-
export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
36
|
+
export const qcms_white_point_sRGB: (a: number) => void;
|
|
21
37
|
export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
22
38
|
export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
23
39
|
export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
40
|
+
export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
41
|
+
export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
42
|
+
export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
26
43
|
export const lut_interp_linear16: (a: number, b: number, c: number) => number;
|
|
27
|
-
export const
|
|
44
|
+
export const qcms_enable_iccv4: () => void;
|
|
45
|
+
export const qcms_profile_is_bogus: (a: number) => number;
|
|
46
|
+
export const qcms_transform_release: (a: number) => void;
|
|
28
47
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
29
48
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
30
49
|
export const __wbindgen_export3: (a: number) => void;
|