@quillmark/wasm 0.68.0 → 0.69.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/node-esm/wasm.js DELETED
@@ -1,1577 +0,0 @@
1
- /* @ts-self-types="./wasm.d.ts" */
2
- import { readFileSync } from 'node:fs';
3
-
4
-
5
- /**
6
- * Typed in-memory Quillmark document.
7
- *
8
- * Created via `Document.fromMarkdown(markdown)`. Exposes:
9
- * - `quillRef` (string)
10
- * - `frontmatter` (JS object/Record)
11
- * - `body` (string)
12
- * - `cards` (array of Card objects)
13
- * - `warnings` (array of Diagnostic objects)
14
- *
15
- * `toMarkdown()` emits canonical Quillmark Markdown that round-trips back to
16
- * an equal `Document` by value and by type.
17
- */
18
- export class Document {
19
- static __wrap(ptr) {
20
- ptr = ptr >>> 0;
21
- const obj = Object.create(Document.prototype);
22
- obj.__wbg_ptr = ptr;
23
- DocumentFinalization.register(obj, obj.__wbg_ptr, obj);
24
- return obj;
25
- }
26
- __destroy_into_raw() {
27
- const ptr = this.__wbg_ptr;
28
- this.__wbg_ptr = 0;
29
- DocumentFinalization.unregister(this);
30
- return ptr;
31
- }
32
- free() {
33
- const ptr = this.__destroy_into_raw();
34
- wasm.__wbg_document_free(ptr, 0);
35
- }
36
- /**
37
- * Number of composable cards (excludes the main card).
38
- *
39
- * O(1). Use this to validate indices before calling card mutators
40
- * instead of allocating the full `cards` array.
41
- * @returns {number}
42
- */
43
- get cardCount() {
44
- const ret = wasm.document_cardCount(this.__wbg_ptr);
45
- return ret >>> 0;
46
- }
47
- /**
48
- * Ordered list of composable card blocks as typed `Card` objects.
49
- * @returns {Card[]}
50
- */
51
- get cards() {
52
- const ret = wasm.document_cards(this.__wbg_ptr);
53
- return takeObject(ret);
54
- }
55
- /**
56
- * Return a fresh `Document` handle with the same parse state.
57
- *
58
- * Mutations on the returned handle do not affect the original and
59
- * vice versa. Parse-time warnings are snapshotted alongside the
60
- * document — they describe the original parse, not the edit
61
- * history of either handle.
62
- * @returns {Document}
63
- */
64
- clone() {
65
- const ret = wasm.document_clone(this.__wbg_ptr);
66
- return Document.__wrap(ret);
67
- }
68
- /**
69
- * Structural equality against another `Document`.
70
- *
71
- * Compares `main` and `cards` by value (matching core's [`PartialEq`]).
72
- * Parse-time `warnings` are intentionally excluded — they describe the
73
- * source text, not the document's content.
74
- *
75
- * Use this to debounce upstream prop updates: keep the last parsed
76
- * `Document` and compare instead of re-parsing on every keystroke.
77
- * @param {Document} other
78
- * @returns {boolean}
79
- */
80
- equals(other) {
81
- _assertClass(other, Document);
82
- const ret = wasm.document_equals(this.__wbg_ptr, other.__wbg_ptr);
83
- return ret !== 0;
84
- }
85
- /**
86
- * Parse markdown into a typed Document.
87
- *
88
- * Returns the document with any parse-time warnings accessible via `.warnings`.
89
- * Throws on parse errors.
90
- * @param {string} markdown
91
- * @returns {Document}
92
- */
93
- static fromMarkdown(markdown) {
94
- try {
95
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
96
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
97
- const len0 = WASM_VECTOR_LEN;
98
- wasm.document_fromMarkdown(retptr, ptr0, len0);
99
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
100
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
101
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
102
- if (r2) {
103
- throw takeObject(r1);
104
- }
105
- return Document.__wrap(r0);
106
- } finally {
107
- wasm.__wbindgen_add_to_stack_pointer(16);
108
- }
109
- }
110
- /**
111
- * Insert a card at the given index.
112
- *
113
- * `index` must be in `0..=cards.length`. Out-of-range throws an `Error`.
114
- *
115
- * Mutators never modify `warnings`.
116
- * @param {number} index
117
- * @param {CardInput} card
118
- */
119
- insertCard(index, card) {
120
- try {
121
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
122
- wasm.document_insertCard(retptr, this.__wbg_ptr, index, addHeapObject(card));
123
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
124
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
125
- if (r1) {
126
- throw takeObject(r0);
127
- }
128
- } finally {
129
- wasm.__wbindgen_add_to_stack_pointer(16);
130
- }
131
- }
132
- /**
133
- * The document's main (entry) card.
134
- *
135
- * Carries the QUILL sentinel, the document-level frontmatter, and the
136
- * global body. Frontmatter/body reads and mutations go through this
137
- * handle — there are no document-level shortcuts after the rework.
138
- *
139
- * Allocates and serializes on each call — cache locally if read in a hot loop.
140
- * @returns {Card}
141
- */
142
- get main() {
143
- const ret = wasm.document_main(this.__wbg_ptr);
144
- return takeObject(ret);
145
- }
146
- /**
147
- * Move the card at `from` to position `to`.
148
- *
149
- * `from == to` is a no-op. Both indices must be in `0..cards.length`.
150
- * Out-of-range throws an `Error`.
151
- *
152
- * Mutators never modify `warnings`.
153
- * @param {number} from
154
- * @param {number} to
155
- */
156
- moveCard(from, to) {
157
- try {
158
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
159
- wasm.document_moveCard(retptr, this.__wbg_ptr, from, to);
160
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
161
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
162
- if (r1) {
163
- throw takeObject(r0);
164
- }
165
- } finally {
166
- wasm.__wbindgen_add_to_stack_pointer(16);
167
- }
168
- }
169
- /**
170
- * Append a card to the end of the card list.
171
- *
172
- * `card` must be a JS object with a `tag` string field and optional
173
- * `fields` (object) and `body` (string).
174
- *
175
- * Throws an `Error` if `card.tag` is not a valid tag name.
176
- *
177
- * Mutators never modify `warnings`.
178
- * @param {CardInput} card
179
- */
180
- pushCard(card) {
181
- try {
182
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
183
- wasm.document_pushCard(retptr, this.__wbg_ptr, addHeapObject(card));
184
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
185
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
186
- if (r1) {
187
- throw takeObject(r0);
188
- }
189
- } finally {
190
- wasm.__wbindgen_add_to_stack_pointer(16);
191
- }
192
- }
193
- /**
194
- * The QUILL reference string (e.g. `"usaf_memo@0.1"`).
195
- * @returns {string}
196
- */
197
- get quillRef() {
198
- let deferred1_0;
199
- let deferred1_1;
200
- try {
201
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
202
- wasm.document_quillRef(retptr, this.__wbg_ptr);
203
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
204
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
205
- deferred1_0 = r0;
206
- deferred1_1 = r1;
207
- return getStringFromWasm0(r0, r1);
208
- } finally {
209
- wasm.__wbindgen_add_to_stack_pointer(16);
210
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
211
- }
212
- }
213
- /**
214
- * Remove the card at `index` and return it, or `undefined` if out of range.
215
- *
216
- * Mutators never modify `warnings`.
217
- * @param {number} index
218
- * @returns {Card | undefined}
219
- */
220
- removeCard(index) {
221
- const ret = wasm.document_removeCard(this.__wbg_ptr, index);
222
- return takeObject(ret);
223
- }
224
- /**
225
- * Remove a frontmatter field on the card at `index`, returning the
226
- * removed value or `undefined` if the field was absent.
227
- *
228
- * Throws if `index` is out of range, `name` is reserved, or `name` does
229
- * not match `[a-z_][a-z0-9_]*`.
230
- *
231
- * Mutators never modify `warnings`.
232
- * @param {number} index
233
- * @param {string} name
234
- * @returns {any}
235
- */
236
- removeCardField(index, name) {
237
- try {
238
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
239
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
240
- const len0 = WASM_VECTOR_LEN;
241
- wasm.document_removeCardField(retptr, this.__wbg_ptr, index, ptr0, len0);
242
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
243
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
244
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
245
- if (r2) {
246
- throw takeObject(r1);
247
- }
248
- return takeObject(r0);
249
- } finally {
250
- wasm.__wbindgen_add_to_stack_pointer(16);
251
- }
252
- }
253
- /**
254
- * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
255
- *
256
- * Throws an `Error` whose message includes the `EditError` variant name
257
- * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
258
- * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
259
- * name returns `undefined`.
260
- *
261
- * Mutators never modify `warnings`.
262
- * @param {string} name
263
- * @returns {any}
264
- */
265
- removeField(name) {
266
- try {
267
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
268
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
269
- const len0 = WASM_VECTOR_LEN;
270
- wasm.document_removeField(retptr, this.__wbg_ptr, ptr0, len0);
271
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
272
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
273
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
274
- if (r2) {
275
- throw takeObject(r1);
276
- }
277
- return takeObject(r0);
278
- } finally {
279
- wasm.__wbindgen_add_to_stack_pointer(16);
280
- }
281
- }
282
- /**
283
- * Replace the main card's body (the global Markdown body).
284
- *
285
- * Mutators never modify `warnings`.
286
- * @param {string} body
287
- */
288
- replaceBody(body) {
289
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
290
- const len0 = WASM_VECTOR_LEN;
291
- wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
292
- }
293
- /**
294
- * Replace the tag of the composable card at `index`.
295
- *
296
- * Mutates only the sentinel — the card's frontmatter and body are
297
- * untouched. Schema-aware migration (clearing orphan fields, applying
298
- * new defaults) is the caller's responsibility; `setCardTag` is a
299
- * structural primitive.
300
- *
301
- * Throws if `index` is out of range or if `newTag` does not match
302
- * `[a-z_][a-z0-9_]*`.
303
- *
304
- * Mutators never modify `warnings`.
305
- * @param {number} index
306
- * @param {string} new_tag
307
- */
308
- setCardTag(index, new_tag) {
309
- try {
310
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
311
- const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
312
- const len0 = WASM_VECTOR_LEN;
313
- wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
314
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
315
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
316
- if (r1) {
317
- throw takeObject(r0);
318
- }
319
- } finally {
320
- wasm.__wbindgen_add_to_stack_pointer(16);
321
- }
322
- }
323
- /**
324
- * Update a frontmatter field on the main card.
325
- *
326
- * Convenience method: equivalent to `doc.mainMut().setField(name, value)`.
327
- * Clears any existing `!fill` marker on the field.
328
- *
329
- * Throws an `Error` whose message includes the `EditError` variant name and
330
- * details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`) or does
331
- * not match `[a-z_][a-z0-9_]*`.
332
- *
333
- * Mutators never modify `warnings`.
334
- * @param {string} name
335
- * @param {any} value
336
- */
337
- setField(name, value) {
338
- try {
339
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
340
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
341
- const len0 = WASM_VECTOR_LEN;
342
- wasm.document_setField(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
343
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
344
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
345
- if (r1) {
346
- throw takeObject(r0);
347
- }
348
- } finally {
349
- wasm.__wbindgen_add_to_stack_pointer(16);
350
- }
351
- }
352
- /**
353
- * Update a frontmatter field on the main card AND mark it as `!fill`.
354
- *
355
- * Convenience method: equivalent to `doc.mainMut().setFill(name, value)`.
356
- *
357
- * Throws on invalid name (see [`setField`](Document::set_field)).
358
- *
359
- * Mutators never modify `warnings`.
360
- * @param {string} name
361
- * @param {any} value
362
- */
363
- setFill(name, value) {
364
- try {
365
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
366
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
367
- const len0 = WASM_VECTOR_LEN;
368
- wasm.document_setFill(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
369
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
370
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
371
- if (r1) {
372
- throw takeObject(r0);
373
- }
374
- } finally {
375
- wasm.__wbindgen_add_to_stack_pointer(16);
376
- }
377
- }
378
- /**
379
- * Replace the QUILL reference string.
380
- *
381
- * Throws if `ref_str` is not a valid `QuillReference`.
382
- *
383
- * Mutators never modify `warnings`.
384
- * @param {string} ref_str
385
- */
386
- setQuillRef(ref_str) {
387
- try {
388
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
389
- const ptr0 = passStringToWasm0(ref_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
390
- const len0 = WASM_VECTOR_LEN;
391
- wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
392
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
393
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
394
- if (r1) {
395
- throw takeObject(r0);
396
- }
397
- } finally {
398
- wasm.__wbindgen_add_to_stack_pointer(16);
399
- }
400
- }
401
- /**
402
- * Emit canonical Quillmark Markdown.
403
- *
404
- * Returns the document serialised as a Quillmark Markdown string.
405
- * The output is type-fidelity round-trip safe: re-parsing the result
406
- * produces a `Document` equal to `self` by value and by type.
407
- * @returns {string}
408
- */
409
- toMarkdown() {
410
- let deferred1_0;
411
- let deferred1_1;
412
- try {
413
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
414
- wasm.document_toMarkdown(retptr, this.__wbg_ptr);
415
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
416
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
417
- deferred1_0 = r0;
418
- deferred1_1 = r1;
419
- return getStringFromWasm0(r0, r1);
420
- } finally {
421
- wasm.__wbindgen_add_to_stack_pointer(16);
422
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
423
- }
424
- }
425
- /**
426
- * Replace the body of the card at `index`.
427
- *
428
- * Throws if `index` is out of range.
429
- *
430
- * Mutators never modify `warnings`.
431
- * @param {number} index
432
- * @param {string} body
433
- */
434
- updateCardBody(index, body) {
435
- try {
436
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
437
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
438
- const len0 = WASM_VECTOR_LEN;
439
- wasm.document_updateCardBody(retptr, this.__wbg_ptr, index, ptr0, len0);
440
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
441
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
442
- if (r1) {
443
- throw takeObject(r0);
444
- }
445
- } finally {
446
- wasm.__wbindgen_add_to_stack_pointer(16);
447
- }
448
- }
449
- /**
450
- * Update a field on the card at `index`.
451
- *
452
- * Convenience method: equivalent to `doc.card_mut(index)?.set_field(name, value)`.
453
- *
454
- * Throws if `index` is out of range, `name` is reserved or invalid, or
455
- * `value` cannot be serialized.
456
- *
457
- * Mutators never modify `warnings`.
458
- * @param {number} index
459
- * @param {string} name
460
- * @param {any} value
461
- */
462
- updateCardField(index, name, value) {
463
- try {
464
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
465
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
466
- const len0 = WASM_VECTOR_LEN;
467
- wasm.document_updateCardField(retptr, this.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
468
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
469
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
470
- if (r1) {
471
- throw takeObject(r0);
472
- }
473
- } finally {
474
- wasm.__wbindgen_add_to_stack_pointer(16);
475
- }
476
- }
477
- /**
478
- * Non-fatal parse-time warnings as an array of typed `Diagnostic` objects.
479
- * @returns {Diagnostic[]}
480
- */
481
- get warnings() {
482
- const ret = wasm.document_warnings(this.__wbg_ptr);
483
- return takeObject(ret);
484
- }
485
- }
486
- if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free;
487
-
488
- /**
489
- * Opaque, shareable Quill handle.
490
- */
491
- export class Quill {
492
- static __wrap(ptr) {
493
- ptr = ptr >>> 0;
494
- const obj = Object.create(Quill.prototype);
495
- obj.__wbg_ptr = ptr;
496
- QuillFinalization.register(obj, obj.__wbg_ptr, obj);
497
- return obj;
498
- }
499
- __destroy_into_raw() {
500
- const ptr = this.__wbg_ptr;
501
- this.__wbg_ptr = 0;
502
- QuillFinalization.unregister(this);
503
- return ptr;
504
- }
505
- free() {
506
- const ptr = this.__destroy_into_raw();
507
- wasm.__wbg_quill_free(ptr, 0);
508
- }
509
- /**
510
- * The resolved backend identifier (e.g. `"typst"`).
511
- * @returns {string}
512
- */
513
- get backendId() {
514
- let deferred1_0;
515
- let deferred1_1;
516
- try {
517
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
518
- wasm.quill_backendId(retptr, this.__wbg_ptr);
519
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
520
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
521
- deferred1_0 = r0;
522
- deferred1_1 = r1;
523
- return getStringFromWasm0(r0, r1);
524
- } finally {
525
- wasm.__wbindgen_add_to_stack_pointer(16);
526
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
527
- }
528
- }
529
- /**
530
- * A blank form for a card of the given type — no document values supplied.
531
- *
532
- * Returns `null` if `cardType` is not declared in this quill's schema.
533
- * Otherwise returns a plain JS object shaped like a single entry in
534
- * [`Form::cards`].
535
- *
536
- * [`Form::cards`]: quillmark::form::Form::cards
537
- * @param {string} card_type
538
- * @returns {any}
539
- */
540
- blankCard(card_type) {
541
- try {
542
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
543
- const ptr0 = passStringToWasm0(card_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
544
- const len0 = WASM_VECTOR_LEN;
545
- wasm.quill_blankCard(retptr, this.__wbg_ptr, ptr0, len0);
546
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
547
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
548
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
549
- if (r2) {
550
- throw takeObject(r1);
551
- }
552
- return takeObject(r0);
553
- } finally {
554
- wasm.__wbindgen_add_to_stack_pointer(16);
555
- }
556
- }
557
- /**
558
- * A blank form for the main card — no document values supplied.
559
- *
560
- * Returns a plain JS object with the same shape as one entry in
561
- * [`Form::main`]. Every declared field's `source` is `"default"` (when
562
- * the schema declares a default) or `"missing"`.
563
- *
564
- * [`Form::main`]: quillmark::form::Form::main
565
- * @returns {any}
566
- */
567
- blankMain() {
568
- try {
569
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
570
- wasm.quill_blankMain(retptr, this.__wbg_ptr);
571
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
572
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
573
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
574
- if (r2) {
575
- throw takeObject(r1);
576
- }
577
- return takeObject(r0);
578
- } finally {
579
- wasm.__wbindgen_add_to_stack_pointer(16);
580
- }
581
- }
582
- /**
583
- * The schema-aware form view of `doc`.
584
- *
585
- * Returns a plain JS object (not a class) that is immediately
586
- * `JSON.stringify`-able. The shape mirrors [`Form`]:
587
- *
588
- * ```json
589
- * {
590
- * "main": { "schema": {...}, "values": { "field": {...} } },
591
- * "cards": [ ... ],
592
- * "diagnostics": [ ... ]
593
- * }
594
- * ```
595
- *
596
- * **Snapshot semantics.** This is a read-only snapshot of the document
597
- * at call time. Subsequent edits to `doc` require calling `form` again.
598
- *
599
- * [`Form`]: quillmark::form::Form
600
- * @param {Document} doc
601
- * @returns {any}
602
- */
603
- form(doc) {
604
- try {
605
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
606
- _assertClass(doc, Document);
607
- wasm.quill_form(retptr, this.__wbg_ptr, doc.__wbg_ptr);
608
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
609
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
610
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
611
- if (r2) {
612
- throw takeObject(r1);
613
- }
614
- return takeObject(r0);
615
- } finally {
616
- wasm.__wbindgen_add_to_stack_pointer(16);
617
- }
618
- }
619
- /**
620
- * Read-only snapshot of the loaded quill's engine info and declared schema.
621
- *
622
- * Returns a plain JS object with:
623
- * - `schema` — the quill's public schema contract, identical to
624
- * `QuillConfig::public_schema()`. Top-level keys: `name`, `main`,
625
- * optional `card_types` (map keyed by card name, omitted when empty),
626
- * optional `example`. `main` and each card under `card_types` share
627
- * the same shape: `fields` (map keyed by field name), optional
628
- * `title`, `description`, `ui`.
629
- * - `backend`, `version`, `author`, `description` — quill identity
630
- * declared in `Quill.yaml`'s `quill:` section. `description` describes
631
- * the quill itself; if the author also declared `main.description` (the
632
- * schema description of the entry-point card), it lives at
633
- * `schema.main.description` and is independent.
634
- * - `supportedFormats` — output formats the backend produces, as
635
- * lowercase strings.
636
- * - Any additional unstructured keys declared under `quill:`.
637
- *
638
- * Consumers that need validation run their own validator against
639
- * `metadata.schema`.
640
- *
641
- * Equivalent by value for the lifetime of the handle; the quill is
642
- * immutable once constructed.
643
- * @returns {any}
644
- */
645
- get metadata() {
646
- const ret = wasm.quill_metadata(this.__wbg_ptr);
647
- return takeObject(ret);
648
- }
649
- /**
650
- * Open an iterative render session for page-selective rendering.
651
- * @param {Document} doc
652
- * @returns {RenderSession}
653
- */
654
- open(doc) {
655
- try {
656
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
657
- _assertClass(doc, Document);
658
- wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
659
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
660
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
661
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
662
- if (r2) {
663
- throw takeObject(r1);
664
- }
665
- return RenderSession.__wrap(r0);
666
- } finally {
667
- wasm.__wbindgen_add_to_stack_pointer(16);
668
- }
669
- }
670
- /**
671
- * Render a document to final artifacts.
672
- * @param {Document} doc
673
- * @param {RenderOptions | null} [opts]
674
- * @returns {RenderResult}
675
- */
676
- render(doc, opts) {
677
- try {
678
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
679
- _assertClass(doc, Document);
680
- wasm.quill_render(retptr, this.__wbg_ptr, doc.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
681
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
682
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
683
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
684
- if (r2) {
685
- throw takeObject(r1);
686
- }
687
- return takeObject(r0);
688
- } finally {
689
- wasm.__wbindgen_add_to_stack_pointer(16);
690
- }
691
- }
692
- /**
693
- * Whether this quill's backend supports canvas preview.
694
- *
695
- * `true` iff `RenderSession.paint` and `RenderSession.pageSize` will
696
- * succeed for sessions opened by this quill. Use this as a precondition
697
- * probe before mounting a canvas-based preview UI; the throw on `paint`
698
- * remains the enforcement contract.
699
- * @returns {boolean}
700
- */
701
- get supportsCanvas() {
702
- const ret = wasm.quill_supportsCanvas(this.__wbg_ptr);
703
- return ret !== 0;
704
- }
705
- }
706
- if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
707
-
708
- /**
709
- * Quillmark WASM Engine
710
- */
711
- export class Quillmark {
712
- __destroy_into_raw() {
713
- const ptr = this.__wbg_ptr;
714
- this.__wbg_ptr = 0;
715
- QuillmarkFinalization.unregister(this);
716
- return ptr;
717
- }
718
- free() {
719
- const ptr = this.__destroy_into_raw();
720
- wasm.__wbg_quillmark_free(ptr, 0);
721
- }
722
- /**
723
- * JavaScript constructor: `new Quillmark()`
724
- */
725
- constructor() {
726
- const ret = wasm.quillmark_new();
727
- this.__wbg_ptr = ret >>> 0;
728
- QuillmarkFinalization.register(this, this.__wbg_ptr, this);
729
- return this;
730
- }
731
- /**
732
- * Load a quill from a file tree and attach the appropriate backend.
733
- *
734
- * Accepts either a `Map<string, Uint8Array>` or a plain object
735
- * (`Record<string, Uint8Array>`). Plain objects are walked via
736
- * `Object.entries` at the boundary; the Rust side sees a single
737
- * canonical shape.
738
- * @param {Map<string, Uint8Array>} tree
739
- * @returns {Quill}
740
- */
741
- quill(tree) {
742
- try {
743
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
744
- wasm.quillmark_quill(retptr, this.__wbg_ptr, addHeapObject(tree));
745
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
746
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
747
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
748
- if (r2) {
749
- throw takeObject(r1);
750
- }
751
- return Quill.__wrap(r0);
752
- } finally {
753
- wasm.__wbindgen_add_to_stack_pointer(16);
754
- }
755
- }
756
- }
757
- if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
758
-
759
- /**
760
- * An iterative render handle backed by an immutable compiled snapshot.
761
- *
762
- * Created via [`Quill::open`]. Holds the compiled output so that
763
- * [`RenderSession::render`], [`RenderSession::paint`], and
764
- * [`RenderSession::page_size`] can be called repeatedly without
765
- * recompiling.
766
- *
767
- * **Empty documents.** A document that compiles to zero pages still
768
- * produces a valid session (`pageCount === 0`). Iterating
769
- * `0..pageCount` is then a no-op; calling `paint(ctx, 0)` or
770
- * `pageSize(0)` throws `"... page index 0 out of range
771
- * (pageCount=0)"`. Hosts that surface "no pages to preview" UI should
772
- * branch on `pageCount === 0` rather than on a thrown error.
773
- */
774
- export class RenderSession {
775
- static __wrap(ptr) {
776
- ptr = ptr >>> 0;
777
- const obj = Object.create(RenderSession.prototype);
778
- obj.__wbg_ptr = ptr;
779
- RenderSessionFinalization.register(obj, obj.__wbg_ptr, obj);
780
- return obj;
781
- }
782
- __destroy_into_raw() {
783
- const ptr = this.__wbg_ptr;
784
- this.__wbg_ptr = 0;
785
- RenderSessionFinalization.unregister(this);
786
- return ptr;
787
- }
788
- free() {
789
- const ptr = this.__destroy_into_raw();
790
- wasm.__wbg_rendersession_free(ptr, 0);
791
- }
792
- /**
793
- * The backend that produced this session (e.g. `"typst"`).
794
- *
795
- * Equal to the `backendId` of the [`Quill`] that opened this session
796
- * (sessions inherit their quill's backend), so checking either is fine.
797
- * @returns {string}
798
- */
799
- get backendId() {
800
- let deferred1_0;
801
- let deferred1_1;
802
- try {
803
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
804
- wasm.rendersession_backendId(retptr, this.__wbg_ptr);
805
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
806
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
807
- deferred1_0 = r0;
808
- deferred1_1 = r1;
809
- return getStringFromWasm0(r0, r1);
810
- } finally {
811
- wasm.__wbindgen_add_to_stack_pointer(16);
812
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
813
- }
814
- }
815
- /**
816
- * Number of pages in this render session.
817
- *
818
- * Stable for the lifetime of the session — the underlying compiled
819
- * document is an immutable snapshot.
820
- * @returns {number}
821
- */
822
- get pageCount() {
823
- const ret = wasm.rendersession_pageCount(this.__wbg_ptr);
824
- return ret >>> 0;
825
- }
826
- /**
827
- * Page dimensions in Typst points (1 pt = 1/72 inch).
828
- *
829
- * Report-only: the painter sizes the canvas itself based on
830
- * `PaintOptions`. Exposed for consumers that need page geometry
831
- * up-front (e.g. to lay out a scrollable list of canvases before
832
- * any pixels are rendered).
833
- *
834
- * Stable for a given `page` across the session's lifetime — the
835
- * compiled document is an immutable snapshot, so callers can cache
836
- * results.
837
- *
838
- * Throws if the underlying backend has no canvas painter (i.e. is not
839
- * the Typst backend) or if `page` is out of range.
840
- * @param {number} page
841
- * @returns {PageSize}
842
- */
843
- pageSize(page) {
844
- try {
845
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
846
- wasm.rendersession_pageSize(retptr, this.__wbg_ptr, page);
847
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
848
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
849
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
850
- if (r2) {
851
- throw takeObject(r1);
852
- }
853
- return takeObject(r0);
854
- } finally {
855
- wasm.__wbindgen_add_to_stack_pointer(16);
856
- }
857
- }
858
- /**
859
- * Paint `page` into a 2D canvas context.
860
- *
861
- * Accepts either a `CanvasRenderingContext2D` (main thread) or an
862
- * `OffscreenCanvasRenderingContext2D` (Worker / off-DOM rasterization).
863
- * Both dispatch to the same Rust rasterizer; the dispatch happens at
864
- * the JS boundary so neither context type is privileged.
865
- *
866
- * The painter owns `canvas.width` / `canvas.height` and writes them
867
- * itself; consumers must not. The painter does not touch
868
- * `canvas.style.*` — that's layout, owned by the consumer (see
869
- * `PaintResult.layoutWidth` / `layoutHeight`).
870
- *
871
- * `opts.layoutScale` (default 1.0) is layout-space pixels per Typst
872
- * point and determines the canvas's display-box size. `opts.densityScale`
873
- * (default 1.0) is the rasterization density multiplier the consumer
874
- * folds `window.devicePixelRatio`, in-app zoom, and
875
- * `visualViewport.scale` (pinch-zoom) into. The effective
876
- * rasterization scale is `layoutScale * densityScale`.
877
- *
878
- * If `layoutScale * densityScale` would exceed the safe backing-store
879
- * maximum (16384 px per side), `densityScale` is clamped
880
- * proportionally so the largest dimension fits. The actual
881
- * backing-store dimensions are reported in the returned
882
- * `PaintResult` — compare against
883
- * `round(layoutWidth * densityScale)` to detect clamping.
884
- *
885
- * Each call resets the backing store (`paint` is always a full
886
- * repaint). Consumers do not need to call `clearRect`.
887
- *
888
- * Throws when:
889
- * - the backend does not support canvas preview (message includes the
890
- * resolved `backendId`),
891
- * - `page` is out of range,
892
- * - `ctx` is neither `CanvasRenderingContext2D` nor
893
- * `OffscreenCanvasRenderingContext2D`,
894
- * - `opts.layoutScale` or `opts.densityScale` is non-finite or `<= 0`.
895
- * @param {CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D} ctx
896
- * @param {number} page
897
- * @param {PaintOptions | undefined} opts
898
- * @returns {PaintResult}
899
- */
900
- paint(ctx, page, opts) {
901
- try {
902
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
903
- wasm.rendersession_paint(retptr, this.__wbg_ptr, addHeapObject(ctx), page, addHeapObject(opts));
904
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
905
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
906
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
907
- if (r2) {
908
- throw takeObject(r1);
909
- }
910
- return takeObject(r0);
911
- } finally {
912
- wasm.__wbindgen_add_to_stack_pointer(16);
913
- }
914
- }
915
- /**
916
- * Render all or selected pages from this session.
917
- * @param {RenderOptions | null} [opts]
918
- * @returns {RenderResult}
919
- */
920
- render(opts) {
921
- try {
922
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
923
- wasm.rendersession_render(retptr, this.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
924
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
925
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
926
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
927
- if (r2) {
928
- throw takeObject(r1);
929
- }
930
- return takeObject(r0);
931
- } finally {
932
- wasm.__wbindgen_add_to_stack_pointer(16);
933
- }
934
- }
935
- /**
936
- * Whether this session's backend supports canvas preview.
937
- *
938
- * `true` iff [`paint`](Self::paint) and [`page_size`](Self::page_size)
939
- * will succeed. Equal to `Quill.supportsCanvas` for the quill that
940
- * opened this session.
941
- * @returns {boolean}
942
- */
943
- get supportsCanvas() {
944
- const ret = wasm.rendersession_supportsCanvas(this.__wbg_ptr);
945
- return ret !== 0;
946
- }
947
- /**
948
- * Session-level warnings attached at `quill.open(...)` time.
949
- *
950
- * Snapshot of any non-fatal diagnostics emitted while opening the
951
- * session (e.g. version compatibility shims). Stable across the
952
- * session's lifetime. These are also appended to
953
- * [`RenderResult.warnings`] on every `render()` call; the accessor
954
- * surfaces them to canvas-preview consumers that don't go through
955
- * `render()`.
956
- * @returns {Diagnostic[]}
957
- */
958
- get warnings() {
959
- const ret = wasm.rendersession_warnings(this.__wbg_ptr);
960
- return takeObject(ret);
961
- }
962
- }
963
- if (Symbol.dispose) RenderSession.prototype[Symbol.dispose] = RenderSession.prototype.free;
964
-
965
- /**
966
- * Initialize the WASM module with panic hooks for better error messages
967
- */
968
- export function init() {
969
- wasm.init();
970
- }
971
- function __wbg_get_imports() {
972
- const import0 = {
973
- __proto__: null,
974
- __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
975
- const ret = Error(getStringFromWasm0(arg0, arg1));
976
- return addHeapObject(ret);
977
- },
978
- __wbg_Number_32bf70a599af1d4b: function(arg0) {
979
- const ret = Number(getObject(arg0));
980
- return ret;
981
- },
982
- __wbg_String_8564e559799eccda: function(arg0, arg1) {
983
- const ret = String(getObject(arg1));
984
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
985
- const len1 = WASM_VECTOR_LEN;
986
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
987
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
988
- },
989
- __wbg_String_b51de6b05a10845b: function(arg0, arg1) {
990
- const ret = String(getObject(arg1));
991
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
992
- const len1 = WASM_VECTOR_LEN;
993
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
994
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
995
- },
996
- __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51: function(arg0, arg1) {
997
- const v = getObject(arg1);
998
- const ret = typeof(v) === 'bigint' ? v : undefined;
999
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1000
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1001
- },
1002
- __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
1003
- const v = getObject(arg0);
1004
- const ret = typeof(v) === 'boolean' ? v : undefined;
1005
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1006
- },
1007
- __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
1008
- const ret = debugString(getObject(arg1));
1009
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1010
- const len1 = WASM_VECTOR_LEN;
1011
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1012
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1013
- },
1014
- __wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
1015
- const ret = getObject(arg0) in getObject(arg1);
1016
- return ret;
1017
- },
1018
- __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93: function(arg0) {
1019
- const ret = typeof(getObject(arg0)) === 'bigint';
1020
- return ret;
1021
- },
1022
- __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
1023
- const ret = typeof(getObject(arg0)) === 'function';
1024
- return ret;
1025
- },
1026
- __wbg___wbindgen_is_null_52ff4ec04186736f: function(arg0) {
1027
- const ret = getObject(arg0) === null;
1028
- return ret;
1029
- },
1030
- __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
1031
- const val = getObject(arg0);
1032
- const ret = typeof(val) === 'object' && val !== null;
1033
- return ret;
1034
- },
1035
- __wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
1036
- const ret = typeof(getObject(arg0)) === 'string';
1037
- return ret;
1038
- },
1039
- __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
1040
- const ret = getObject(arg0) === undefined;
1041
- return ret;
1042
- },
1043
- __wbg___wbindgen_jsval_eq_d3465d8a07697228: function(arg0, arg1) {
1044
- const ret = getObject(arg0) === getObject(arg1);
1045
- return ret;
1046
- },
1047
- __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
1048
- const ret = getObject(arg0) == getObject(arg1);
1049
- return ret;
1050
- },
1051
- __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
1052
- const obj = getObject(arg1);
1053
- const ret = typeof(obj) === 'number' ? obj : undefined;
1054
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1055
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1056
- },
1057
- __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
1058
- const obj = getObject(arg1);
1059
- const ret = typeof(obj) === 'string' ? obj : undefined;
1060
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1061
- var len1 = WASM_VECTOR_LEN;
1062
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1063
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1064
- },
1065
- __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
1066
- throw new Error(getStringFromWasm0(arg0, arg1));
1067
- },
1068
- __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
1069
- const ret = getObject(arg0).call(getObject(arg1));
1070
- return addHeapObject(ret);
1071
- }, arguments); },
1072
- __wbg_canvas_2c0c6d263d4c52ad: function(arg0) {
1073
- const ret = getObject(arg0).canvas;
1074
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1075
- },
1076
- __wbg_canvas_374da9f3c5b3dd0e: function(arg0) {
1077
- const ret = getObject(arg0).canvas;
1078
- return addHeapObject(ret);
1079
- },
1080
- __wbg_done_9158f7cc8751ba32: function(arg0) {
1081
- const ret = getObject(arg0).done;
1082
- return ret;
1083
- },
1084
- __wbg_entries_2bf997cf82353e47: function(arg0) {
1085
- const ret = getObject(arg0).entries();
1086
- return addHeapObject(ret);
1087
- },
1088
- __wbg_entries_e0b73aa8571ddb56: function(arg0) {
1089
- const ret = Object.entries(getObject(arg0));
1090
- return addHeapObject(ret);
1091
- },
1092
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
1093
- let deferred0_0;
1094
- let deferred0_1;
1095
- try {
1096
- deferred0_0 = arg0;
1097
- deferred0_1 = arg1;
1098
- console.error(getStringFromWasm0(arg0, arg1));
1099
- } finally {
1100
- wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
1101
- }
1102
- },
1103
- __wbg_from_0dbf29f09e7fb200: function(arg0) {
1104
- const ret = Array.from(getObject(arg0));
1105
- return addHeapObject(ret);
1106
- },
1107
- __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
1108
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1109
- }, arguments); },
1110
- __wbg_getTime_da7c55f52b71e8c6: function(arg0) {
1111
- const ret = getObject(arg0).getTime();
1112
- return ret;
1113
- },
1114
- __wbg_getUTCDate_5cd8b68e971333f7: function(arg0) {
1115
- const ret = getObject(arg0).getUTCDate();
1116
- return ret;
1117
- },
1118
- __wbg_getUTCFullYear_f3b3950a0ccb9165: function(arg0) {
1119
- const ret = getObject(arg0).getUTCFullYear();
1120
- return ret;
1121
- },
1122
- __wbg_getUTCMonth_62fa72a7522ef806: function(arg0) {
1123
- const ret = getObject(arg0).getUTCMonth();
1124
- return ret;
1125
- },
1126
- __wbg_get_1affdbdd5573b16a: function() { return handleError(function (arg0, arg1) {
1127
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1128
- return addHeapObject(ret);
1129
- }, arguments); },
1130
- __wbg_get_8360291721e2339f: function(arg0, arg1) {
1131
- const ret = getObject(arg0)[arg1 >>> 0];
1132
- return addHeapObject(ret);
1133
- },
1134
- __wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
1135
- const ret = getObject(arg0)[arg1 >>> 0];
1136
- return addHeapObject(ret);
1137
- },
1138
- __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
1139
- const ret = getObject(arg0)[getObject(arg1)];
1140
- return addHeapObject(ret);
1141
- },
1142
- __wbg_get_with_ref_key_f64427178466f623: function(arg0, arg1) {
1143
- const ret = getObject(arg0)[getObject(arg1)];
1144
- return addHeapObject(ret);
1145
- },
1146
- __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
1147
- let result;
1148
- try {
1149
- result = getObject(arg0) instanceof ArrayBuffer;
1150
- } catch (_) {
1151
- result = false;
1152
- }
1153
- const ret = result;
1154
- return ret;
1155
- },
1156
- __wbg_instanceof_CanvasRenderingContext2d_24a3fe06e62b98d7: function(arg0) {
1157
- let result;
1158
- try {
1159
- result = getObject(arg0) instanceof CanvasRenderingContext2D;
1160
- } catch (_) {
1161
- result = false;
1162
- }
1163
- const ret = result;
1164
- return ret;
1165
- },
1166
- __wbg_instanceof_Map_1b76fd4635be43eb: function(arg0) {
1167
- let result;
1168
- try {
1169
- result = getObject(arg0) instanceof Map;
1170
- } catch (_) {
1171
- result = false;
1172
- }
1173
- const ret = result;
1174
- return ret;
1175
- },
1176
- __wbg_instanceof_OffscreenCanvasRenderingContext2d_285a274020b4f230: function(arg0) {
1177
- let result;
1178
- try {
1179
- result = getObject(arg0) instanceof OffscreenCanvasRenderingContext2D;
1180
- } catch (_) {
1181
- result = false;
1182
- }
1183
- const ret = result;
1184
- return ret;
1185
- },
1186
- __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
1187
- let result;
1188
- try {
1189
- result = getObject(arg0) instanceof Uint8Array;
1190
- } catch (_) {
1191
- result = false;
1192
- }
1193
- const ret = result;
1194
- return ret;
1195
- },
1196
- __wbg_isArray_c3109d14ffc06469: function(arg0) {
1197
- const ret = Array.isArray(getObject(arg0));
1198
- return ret;
1199
- },
1200
- __wbg_isSafeInteger_4fc213d1989d6d2a: function(arg0) {
1201
- const ret = Number.isSafeInteger(getObject(arg0));
1202
- return ret;
1203
- },
1204
- __wbg_iterator_013bc09ec998c2a7: function() {
1205
- const ret = Symbol.iterator;
1206
- return addHeapObject(ret);
1207
- },
1208
- __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
1209
- const ret = getObject(arg0).length;
1210
- return ret;
1211
- },
1212
- __wbg_length_9f1775224cf1d815: function(arg0) {
1213
- const ret = getObject(arg0).length;
1214
- return ret;
1215
- },
1216
- __wbg_new_0_4d657201ced14de3: function() {
1217
- const ret = new Date();
1218
- return addHeapObject(ret);
1219
- },
1220
- __wbg_new_0c7403db6e782f19: function(arg0) {
1221
- const ret = new Uint8Array(getObject(arg0));
1222
- return addHeapObject(ret);
1223
- },
1224
- __wbg_new_227d7c05414eb861: function() {
1225
- const ret = new Error();
1226
- return addHeapObject(ret);
1227
- },
1228
- __wbg_new_34d45cc8e36aaead: function() {
1229
- const ret = new Map();
1230
- return addHeapObject(ret);
1231
- },
1232
- __wbg_new_5e360d2ff7b9e1c3: function(arg0, arg1) {
1233
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1234
- return addHeapObject(ret);
1235
- },
1236
- __wbg_new_682678e2f47e32bc: function() {
1237
- const ret = new Array();
1238
- return addHeapObject(ret);
1239
- },
1240
- __wbg_new_7913666fe5070684: function(arg0) {
1241
- const ret = new Date(getObject(arg0));
1242
- return addHeapObject(ret);
1243
- },
1244
- __wbg_new_aa8d0fa9762c29bd: function() {
1245
- const ret = new Object();
1246
- return addHeapObject(ret);
1247
- },
1248
- __wbg_new_with_u8_clamped_array_and_sh_fe957411824b5158: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1249
- const ret = new ImageData(getClampedArrayU8FromWasm0(arg0, arg1), arg2 >>> 0, arg3 >>> 0);
1250
- return addHeapObject(ret);
1251
- }, arguments); },
1252
- __wbg_next_0340c4ae324393c3: function() { return handleError(function (arg0) {
1253
- const ret = getObject(arg0).next();
1254
- return addHeapObject(ret);
1255
- }, arguments); },
1256
- __wbg_next_7646edaa39458ef7: function(arg0) {
1257
- const ret = getObject(arg0).next;
1258
- return addHeapObject(ret);
1259
- },
1260
- __wbg_now_a9b7df1cbee90986: function() {
1261
- const ret = Date.now();
1262
- return ret;
1263
- },
1264
- __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
1265
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1266
- },
1267
- __wbg_putImageData_c810e62ea70e761d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1268
- getObject(arg0).putImageData(getObject(arg1), arg2, arg3);
1269
- }, arguments); },
1270
- __wbg_putImageData_cb4de9afd58963be: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1271
- getObject(arg0).putImageData(getObject(arg1), arg2, arg3);
1272
- }, arguments); },
1273
- __wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
1274
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1275
- return ret;
1276
- }, arguments); },
1277
- __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
1278
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1279
- },
1280
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1281
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1282
- },
1283
- __wbg_set_f071dbb3bd088e0e: function(arg0, arg1, arg2) {
1284
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1285
- },
1286
- __wbg_set_fde2cec06c23692b: function(arg0, arg1, arg2) {
1287
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1288
- return addHeapObject(ret);
1289
- },
1290
- __wbg_set_height_24d07d982f176ac6: function(arg0, arg1) {
1291
- getObject(arg0).height = arg1 >>> 0;
1292
- },
1293
- __wbg_set_height_be9b2b920bd68401: function(arg0, arg1) {
1294
- getObject(arg0).height = arg1 >>> 0;
1295
- },
1296
- __wbg_set_width_5cda41d4d06a14dd: function(arg0, arg1) {
1297
- getObject(arg0).width = arg1 >>> 0;
1298
- },
1299
- __wbg_set_width_adc925bca9c5351a: function(arg0, arg1) {
1300
- getObject(arg0).width = arg1 >>> 0;
1301
- },
1302
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1303
- const ret = getObject(arg1).stack;
1304
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1305
- const len1 = WASM_VECTOR_LEN;
1306
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1307
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1308
- },
1309
- __wbg_value_ee3a06f4579184fa: function(arg0) {
1310
- const ret = getObject(arg0).value;
1311
- return addHeapObject(ret);
1312
- },
1313
- __wbindgen_cast_0000000000000001: function(arg0) {
1314
- // Cast intrinsic for `F64 -> Externref`.
1315
- const ret = arg0;
1316
- return addHeapObject(ret);
1317
- },
1318
- __wbindgen_cast_0000000000000002: function(arg0) {
1319
- // Cast intrinsic for `I64 -> Externref`.
1320
- const ret = arg0;
1321
- return addHeapObject(ret);
1322
- },
1323
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1324
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1325
- const ret = getArrayU8FromWasm0(arg0, arg1);
1326
- return addHeapObject(ret);
1327
- },
1328
- __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1329
- // Cast intrinsic for `Ref(String) -> Externref`.
1330
- const ret = getStringFromWasm0(arg0, arg1);
1331
- return addHeapObject(ret);
1332
- },
1333
- __wbindgen_cast_0000000000000005: function(arg0) {
1334
- // Cast intrinsic for `U64 -> Externref`.
1335
- const ret = BigInt.asUintN(64, arg0);
1336
- return addHeapObject(ret);
1337
- },
1338
- __wbindgen_object_clone_ref: function(arg0) {
1339
- const ret = getObject(arg0);
1340
- return addHeapObject(ret);
1341
- },
1342
- __wbindgen_object_drop_ref: function(arg0) {
1343
- takeObject(arg0);
1344
- },
1345
- };
1346
- return {
1347
- __proto__: null,
1348
- "./wasm_bg.js": import0,
1349
- };
1350
- }
1351
-
1352
- const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
1353
- ? { register: () => {}, unregister: () => {} }
1354
- : new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr >>> 0, 1));
1355
- const QuillFinalization = (typeof FinalizationRegistry === 'undefined')
1356
- ? { register: () => {}, unregister: () => {} }
1357
- : new FinalizationRegistry(ptr => wasm.__wbg_quill_free(ptr >>> 0, 1));
1358
- const QuillmarkFinalization = (typeof FinalizationRegistry === 'undefined')
1359
- ? { register: () => {}, unregister: () => {} }
1360
- : new FinalizationRegistry(ptr => wasm.__wbg_quillmark_free(ptr >>> 0, 1));
1361
- const RenderSessionFinalization = (typeof FinalizationRegistry === 'undefined')
1362
- ? { register: () => {}, unregister: () => {} }
1363
- : new FinalizationRegistry(ptr => wasm.__wbg_rendersession_free(ptr >>> 0, 1));
1364
-
1365
- function addHeapObject(obj) {
1366
- if (heap_next === heap.length) heap.push(heap.length + 1);
1367
- const idx = heap_next;
1368
- heap_next = heap[idx];
1369
-
1370
- heap[idx] = obj;
1371
- return idx;
1372
- }
1373
-
1374
- function _assertClass(instance, klass) {
1375
- if (!(instance instanceof klass)) {
1376
- throw new Error(`expected instance of ${klass.name}`);
1377
- }
1378
- }
1379
-
1380
- function debugString(val) {
1381
- // primitive types
1382
- const type = typeof val;
1383
- if (type == 'number' || type == 'boolean' || val == null) {
1384
- return `${val}`;
1385
- }
1386
- if (type == 'string') {
1387
- return `"${val}"`;
1388
- }
1389
- if (type == 'symbol') {
1390
- const description = val.description;
1391
- if (description == null) {
1392
- return 'Symbol';
1393
- } else {
1394
- return `Symbol(${description})`;
1395
- }
1396
- }
1397
- if (type == 'function') {
1398
- const name = val.name;
1399
- if (typeof name == 'string' && name.length > 0) {
1400
- return `Function(${name})`;
1401
- } else {
1402
- return 'Function';
1403
- }
1404
- }
1405
- // objects
1406
- if (Array.isArray(val)) {
1407
- const length = val.length;
1408
- let debug = '[';
1409
- if (length > 0) {
1410
- debug += debugString(val[0]);
1411
- }
1412
- for(let i = 1; i < length; i++) {
1413
- debug += ', ' + debugString(val[i]);
1414
- }
1415
- debug += ']';
1416
- return debug;
1417
- }
1418
- // Test for built-in
1419
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1420
- let className;
1421
- if (builtInMatches && builtInMatches.length > 1) {
1422
- className = builtInMatches[1];
1423
- } else {
1424
- // Failed to match the standard '[object ClassName]'
1425
- return toString.call(val);
1426
- }
1427
- if (className == 'Object') {
1428
- // we're a user defined class or Object
1429
- // JSON.stringify avoids problems with cycles, and is generally much
1430
- // easier than looping through ownProperties of `val`.
1431
- try {
1432
- return 'Object(' + JSON.stringify(val) + ')';
1433
- } catch (_) {
1434
- return 'Object';
1435
- }
1436
- }
1437
- // errors
1438
- if (val instanceof Error) {
1439
- return `${val.name}: ${val.message}\n${val.stack}`;
1440
- }
1441
- // TODO we could test for more things here, like `Set`s and `Map`s.
1442
- return className;
1443
- }
1444
-
1445
- function dropObject(idx) {
1446
- if (idx < 1028) return;
1447
- heap[idx] = heap_next;
1448
- heap_next = idx;
1449
- }
1450
-
1451
- function getArrayU8FromWasm0(ptr, len) {
1452
- ptr = ptr >>> 0;
1453
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1454
- }
1455
-
1456
- function getClampedArrayU8FromWasm0(ptr, len) {
1457
- ptr = ptr >>> 0;
1458
- return getUint8ClampedArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1459
- }
1460
-
1461
- let cachedDataViewMemory0 = null;
1462
- function getDataViewMemory0() {
1463
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1464
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1465
- }
1466
- return cachedDataViewMemory0;
1467
- }
1468
-
1469
- function getStringFromWasm0(ptr, len) {
1470
- ptr = ptr >>> 0;
1471
- return decodeText(ptr, len);
1472
- }
1473
-
1474
- let cachedUint8ArrayMemory0 = null;
1475
- function getUint8ArrayMemory0() {
1476
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1477
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1478
- }
1479
- return cachedUint8ArrayMemory0;
1480
- }
1481
-
1482
- let cachedUint8ClampedArrayMemory0 = null;
1483
- function getUint8ClampedArrayMemory0() {
1484
- if (cachedUint8ClampedArrayMemory0 === null || cachedUint8ClampedArrayMemory0.byteLength === 0) {
1485
- cachedUint8ClampedArrayMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
1486
- }
1487
- return cachedUint8ClampedArrayMemory0;
1488
- }
1489
-
1490
- function getObject(idx) { return heap[idx]; }
1491
-
1492
- function handleError(f, args) {
1493
- try {
1494
- return f.apply(this, args);
1495
- } catch (e) {
1496
- wasm.__wbindgen_export3(addHeapObject(e));
1497
- }
1498
- }
1499
-
1500
- let heap = new Array(1024).fill(undefined);
1501
- heap.push(undefined, null, true, false);
1502
-
1503
- let heap_next = heap.length;
1504
-
1505
- function isLikeNone(x) {
1506
- return x === undefined || x === null;
1507
- }
1508
-
1509
- function passStringToWasm0(arg, malloc, realloc) {
1510
- if (realloc === undefined) {
1511
- const buf = cachedTextEncoder.encode(arg);
1512
- const ptr = malloc(buf.length, 1) >>> 0;
1513
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1514
- WASM_VECTOR_LEN = buf.length;
1515
- return ptr;
1516
- }
1517
-
1518
- let len = arg.length;
1519
- let ptr = malloc(len, 1) >>> 0;
1520
-
1521
- const mem = getUint8ArrayMemory0();
1522
-
1523
- let offset = 0;
1524
-
1525
- for (; offset < len; offset++) {
1526
- const code = arg.charCodeAt(offset);
1527
- if (code > 0x7F) break;
1528
- mem[ptr + offset] = code;
1529
- }
1530
- if (offset !== len) {
1531
- if (offset !== 0) {
1532
- arg = arg.slice(offset);
1533
- }
1534
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1535
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1536
- const ret = cachedTextEncoder.encodeInto(arg, view);
1537
-
1538
- offset += ret.written;
1539
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1540
- }
1541
-
1542
- WASM_VECTOR_LEN = offset;
1543
- return ptr;
1544
- }
1545
-
1546
- function takeObject(idx) {
1547
- const ret = getObject(idx);
1548
- dropObject(idx);
1549
- return ret;
1550
- }
1551
-
1552
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1553
- cachedTextDecoder.decode();
1554
- function decodeText(ptr, len) {
1555
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1556
- }
1557
-
1558
- const cachedTextEncoder = new TextEncoder();
1559
-
1560
- if (!('encodeInto' in cachedTextEncoder)) {
1561
- cachedTextEncoder.encodeInto = function (arg, view) {
1562
- const buf = cachedTextEncoder.encode(arg);
1563
- view.set(buf);
1564
- return {
1565
- read: arg.length,
1566
- written: buf.length
1567
- };
1568
- };
1569
- }
1570
-
1571
- let WASM_VECTOR_LEN = 0;
1572
-
1573
- const wasmUrl = new URL('wasm_bg.wasm', import.meta.url);
1574
- const wasmBytes = readFileSync(wasmUrl);
1575
- const wasmModule = new WebAssembly.Module(wasmBytes);
1576
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1577
- wasm.__wbindgen_start();