@quillmark/wasm 0.62.0 → 0.64.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/README.md +14 -1
- package/bundler/wasm.d.ts +48 -9
- package/bundler/wasm_bg.js +139 -40
- package/bundler/wasm_bg.wasm +0 -0
- package/bundler/wasm_bg.wasm.d.ts +5 -2
- package/node-esm/wasm.d.ts +48 -9
- package/node-esm/wasm.js +139 -40
- package/node-esm/wasm_bg.wasm +0 -0
- package/node-esm/wasm_bg.wasm.d.ts +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,9 +63,22 @@ Render with a pre-parsed `Document`.
|
|
|
63
63
|
### `quill.open(parsed)` + `session.render(opts?)`
|
|
64
64
|
Open once, render all or selected pages (`opts.pages`).
|
|
65
65
|
|
|
66
|
+
### Errors
|
|
67
|
+
|
|
68
|
+
Every method that can fail throws a JS `Error` with a flat shape:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
{ message: string, diagnostics: Diagnostic[] }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`diagnostics` is always non-empty — length 1 for most failures, length N for
|
|
75
|
+
backend compilation errors. Read `err.diagnostics[0]` for the primary
|
|
76
|
+
diagnostic; iterate the array for compilation failures.
|
|
77
|
+
|
|
66
78
|
## Notes
|
|
67
79
|
|
|
68
|
-
- Parsed markdown requires top-level `QUILL` in frontmatter.
|
|
80
|
+
- Parsed markdown requires top-level `QUILL` in frontmatter. Empty input
|
|
81
|
+
surfaces a dedicated "Empty markdown input cannot be parsed" message.
|
|
69
82
|
- QUILL mismatch during `quill.render(parsed)` is a warning (`quill::ref_mismatch`), not an error.
|
|
70
83
|
- Output schema APIs are no longer engine-level in WASM.
|
|
71
84
|
|
package/bundler/wasm.d.ts
CHANGED
|
@@ -133,7 +133,8 @@ export class Document {
|
|
|
133
133
|
* Remove a frontmatter field on the card at `index`, returning the
|
|
134
134
|
* removed value or `undefined` if the field was absent.
|
|
135
135
|
*
|
|
136
|
-
* Throws if `index` is out of range
|
|
136
|
+
* Throws if `index` is out of range, `name` is reserved, or `name` does
|
|
137
|
+
* not match `[a-z_][a-z0-9_]*`.
|
|
137
138
|
*
|
|
138
139
|
* Mutators never modify `warnings`.
|
|
139
140
|
*/
|
|
@@ -141,6 +142,11 @@ export class Document {
|
|
|
141
142
|
/**
|
|
142
143
|
* Remove a frontmatter field on the main card, returning the removed value or `undefined`.
|
|
143
144
|
*
|
|
145
|
+
* Throws an `Error` whose message includes the `EditError` variant name
|
|
146
|
+
* and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
|
|
147
|
+
* or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
|
|
148
|
+
* name returns `undefined`.
|
|
149
|
+
*
|
|
144
150
|
* Mutators never modify `warnings`.
|
|
145
151
|
*/
|
|
146
152
|
removeField(name: string): any;
|
|
@@ -150,6 +156,20 @@ export class Document {
|
|
|
150
156
|
* Mutators never modify `warnings`.
|
|
151
157
|
*/
|
|
152
158
|
replaceBody(body: string): void;
|
|
159
|
+
/**
|
|
160
|
+
* Replace the tag of the composable card at `index`.
|
|
161
|
+
*
|
|
162
|
+
* Mutates only the sentinel — the card's frontmatter and body are
|
|
163
|
+
* untouched. Schema-aware migration (clearing orphan fields, applying
|
|
164
|
+
* new defaults) is the caller's responsibility; `setCardTag` is a
|
|
165
|
+
* structural primitive.
|
|
166
|
+
*
|
|
167
|
+
* Throws if `index` is out of range or if `newTag` does not match
|
|
168
|
+
* `[a-z_][a-z0-9_]*`.
|
|
169
|
+
*
|
|
170
|
+
* Mutators never modify `warnings`.
|
|
171
|
+
*/
|
|
172
|
+
setCardTag(index: number, new_tag: string): void;
|
|
153
173
|
/**
|
|
154
174
|
* Update a frontmatter field on the main card.
|
|
155
175
|
*
|
|
@@ -240,14 +260,30 @@ export class Quill {
|
|
|
240
260
|
free(): void;
|
|
241
261
|
[Symbol.dispose](): void;
|
|
242
262
|
/**
|
|
243
|
-
*
|
|
263
|
+
* A blank form for a card of the given type — no document values supplied.
|
|
264
|
+
*
|
|
265
|
+
* Returns `null` if `cardType` is not declared in this quill's schema.
|
|
266
|
+
* Otherwise returns a plain JS object shaped like a single entry in
|
|
267
|
+
* [`Form::cards`].
|
|
268
|
+
*
|
|
269
|
+
* [`Form::cards`]: quillmark::form::Form::cards
|
|
244
270
|
*/
|
|
245
|
-
|
|
271
|
+
blankCard(card_type: string): any;
|
|
272
|
+
/**
|
|
273
|
+
* A blank form for the main card — no document values supplied.
|
|
274
|
+
*
|
|
275
|
+
* Returns a plain JS object with the same shape as one entry in
|
|
276
|
+
* [`Form::main`]. Every declared field's `source` is `"default"` (when
|
|
277
|
+
* the schema declares a default) or `"missing"`.
|
|
278
|
+
*
|
|
279
|
+
* [`Form::main`]: quillmark::form::Form::main
|
|
280
|
+
*/
|
|
281
|
+
blankMain(): any;
|
|
246
282
|
/**
|
|
247
|
-
*
|
|
283
|
+
* The schema-aware form view of `doc`.
|
|
248
284
|
*
|
|
249
285
|
* Returns a plain JS object (not a class) that is immediately
|
|
250
|
-
* `JSON.stringify`-able. The shape mirrors [`
|
|
286
|
+
* `JSON.stringify`-able. The shape mirrors [`Form`]:
|
|
251
287
|
*
|
|
252
288
|
* ```json
|
|
253
289
|
* {
|
|
@@ -258,12 +294,15 @@ export class Quill {
|
|
|
258
294
|
* ```
|
|
259
295
|
*
|
|
260
296
|
* **Snapshot semantics.** This is a read-only snapshot of the document
|
|
261
|
-
* at call time. Subsequent edits to `doc` require calling `
|
|
262
|
-
* again.
|
|
297
|
+
* at call time. Subsequent edits to `doc` require calling `form` again.
|
|
263
298
|
*
|
|
264
|
-
* [`
|
|
299
|
+
* [`Form`]: quillmark::form::Form
|
|
265
300
|
*/
|
|
266
|
-
|
|
301
|
+
form(doc: Document): any;
|
|
302
|
+
/**
|
|
303
|
+
* Open an iterative render session for page-selective rendering.
|
|
304
|
+
*/
|
|
305
|
+
open(doc: Document): RenderSession;
|
|
267
306
|
/**
|
|
268
307
|
* Render a document to final artifacts.
|
|
269
308
|
*/
|
package/bundler/wasm_bg.js
CHANGED
|
@@ -193,7 +193,8 @@ export class Document {
|
|
|
193
193
|
* Remove a frontmatter field on the card at `index`, returning the
|
|
194
194
|
* removed value or `undefined` if the field was absent.
|
|
195
195
|
*
|
|
196
|
-
* Throws if `index` is out of range
|
|
196
|
+
* Throws if `index` is out of range, `name` is reserved, or `name` does
|
|
197
|
+
* not match `[a-z_][a-z0-9_]*`.
|
|
197
198
|
*
|
|
198
199
|
* Mutators never modify `warnings`.
|
|
199
200
|
* @param {number} index
|
|
@@ -220,15 +221,31 @@ export class Document {
|
|
|
220
221
|
/**
|
|
221
222
|
* Remove a frontmatter field on the main card, returning the removed value or `undefined`.
|
|
222
223
|
*
|
|
224
|
+
* Throws an `Error` whose message includes the `EditError` variant name
|
|
225
|
+
* and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
|
|
226
|
+
* or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
|
|
227
|
+
* name returns `undefined`.
|
|
228
|
+
*
|
|
223
229
|
* Mutators never modify `warnings`.
|
|
224
230
|
* @param {string} name
|
|
225
231
|
* @returns {any}
|
|
226
232
|
*/
|
|
227
233
|
removeField(name) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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_removeField(retptr, this.__wbg_ptr, ptr0, len0);
|
|
239
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
240
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
241
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
242
|
+
if (r2) {
|
|
243
|
+
throw takeObject(r1);
|
|
244
|
+
}
|
|
245
|
+
return takeObject(r0);
|
|
246
|
+
} finally {
|
|
247
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
248
|
+
}
|
|
232
249
|
}
|
|
233
250
|
/**
|
|
234
251
|
* Replace the main card's body (the global Markdown body).
|
|
@@ -241,6 +258,36 @@ export class Document {
|
|
|
241
258
|
const len0 = WASM_VECTOR_LEN;
|
|
242
259
|
wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
|
|
243
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Replace the tag of the composable card at `index`.
|
|
263
|
+
*
|
|
264
|
+
* Mutates only the sentinel — the card's frontmatter and body are
|
|
265
|
+
* untouched. Schema-aware migration (clearing orphan fields, applying
|
|
266
|
+
* new defaults) is the caller's responsibility; `setCardTag` is a
|
|
267
|
+
* structural primitive.
|
|
268
|
+
*
|
|
269
|
+
* Throws if `index` is out of range or if `newTag` does not match
|
|
270
|
+
* `[a-z_][a-z0-9_]*`.
|
|
271
|
+
*
|
|
272
|
+
* Mutators never modify `warnings`.
|
|
273
|
+
* @param {number} index
|
|
274
|
+
* @param {string} new_tag
|
|
275
|
+
*/
|
|
276
|
+
setCardTag(index, new_tag) {
|
|
277
|
+
try {
|
|
278
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
279
|
+
const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
280
|
+
const len0 = WASM_VECTOR_LEN;
|
|
281
|
+
wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
282
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
283
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
284
|
+
if (r1) {
|
|
285
|
+
throw takeObject(r0);
|
|
286
|
+
}
|
|
287
|
+
} finally {
|
|
288
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
244
291
|
/**
|
|
245
292
|
* Update a frontmatter field on the main card.
|
|
246
293
|
*
|
|
@@ -448,58 +495,63 @@ export class Quill {
|
|
|
448
495
|
}
|
|
449
496
|
}
|
|
450
497
|
/**
|
|
451
|
-
*
|
|
498
|
+
* A blank form for a card of the given type — no document values supplied.
|
|
452
499
|
*
|
|
453
|
-
* Returns
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
* optional `card_types` (map keyed by card name, omitted when empty),
|
|
457
|
-
* optional `example`. `main` and each card under `card_types` share
|
|
458
|
-
* the same shape: `fields` (map keyed by field name), optional
|
|
459
|
-
* `title`, `description`, `ui`.
|
|
460
|
-
* - `backend`, `version`, `author` — quill identity declared in
|
|
461
|
-
* `Quill.yaml`'s `quill:` section.
|
|
462
|
-
* - `supportedFormats` — output formats the backend produces, as
|
|
463
|
-
* lowercase strings.
|
|
464
|
-
* - Any additional unstructured keys declared under `quill:`.
|
|
465
|
-
*
|
|
466
|
-
* Consumers that need validation run their own validator against
|
|
467
|
-
* `metadata.schema`.
|
|
500
|
+
* Returns `null` if `cardType` is not declared in this quill's schema.
|
|
501
|
+
* Otherwise returns a plain JS object shaped like a single entry in
|
|
502
|
+
* [`Form::cards`].
|
|
468
503
|
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
504
|
+
* [`Form::cards`]: quillmark::form::Form::cards
|
|
505
|
+
* @param {string} card_type
|
|
471
506
|
* @returns {any}
|
|
472
507
|
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
508
|
+
blankCard(card_type) {
|
|
509
|
+
try {
|
|
510
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
511
|
+
const ptr0 = passStringToWasm0(card_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
512
|
+
const len0 = WASM_VECTOR_LEN;
|
|
513
|
+
wasm.quill_blankCard(retptr, this.__wbg_ptr, ptr0, len0);
|
|
514
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
515
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
516
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
517
|
+
if (r2) {
|
|
518
|
+
throw takeObject(r1);
|
|
519
|
+
}
|
|
520
|
+
return takeObject(r0);
|
|
521
|
+
} finally {
|
|
522
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
523
|
+
}
|
|
476
524
|
}
|
|
477
525
|
/**
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
526
|
+
* A blank form for the main card — no document values supplied.
|
|
527
|
+
*
|
|
528
|
+
* Returns a plain JS object with the same shape as one entry in
|
|
529
|
+
* [`Form::main`]. Every declared field's `source` is `"default"` (when
|
|
530
|
+
* the schema declares a default) or `"missing"`.
|
|
531
|
+
*
|
|
532
|
+
* [`Form::main`]: quillmark::form::Form::main
|
|
533
|
+
* @returns {any}
|
|
481
534
|
*/
|
|
482
|
-
|
|
535
|
+
blankMain() {
|
|
483
536
|
try {
|
|
484
537
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
485
|
-
|
|
486
|
-
wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
538
|
+
wasm.quill_blankMain(retptr, this.__wbg_ptr);
|
|
487
539
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
488
540
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
489
541
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
490
542
|
if (r2) {
|
|
491
543
|
throw takeObject(r1);
|
|
492
544
|
}
|
|
493
|
-
return
|
|
545
|
+
return takeObject(r0);
|
|
494
546
|
} finally {
|
|
495
547
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
496
548
|
}
|
|
497
549
|
}
|
|
498
550
|
/**
|
|
499
|
-
*
|
|
551
|
+
* The schema-aware form view of `doc`.
|
|
500
552
|
*
|
|
501
553
|
* Returns a plain JS object (not a class) that is immediately
|
|
502
|
-
* `JSON.stringify`-able. The shape mirrors [`
|
|
554
|
+
* `JSON.stringify`-able. The shape mirrors [`Form`]:
|
|
503
555
|
*
|
|
504
556
|
* ```json
|
|
505
557
|
* {
|
|
@@ -510,18 +562,17 @@ export class Quill {
|
|
|
510
562
|
* ```
|
|
511
563
|
*
|
|
512
564
|
* **Snapshot semantics.** This is a read-only snapshot of the document
|
|
513
|
-
* at call time. Subsequent edits to `doc` require calling `
|
|
514
|
-
* again.
|
|
565
|
+
* at call time. Subsequent edits to `doc` require calling `form` again.
|
|
515
566
|
*
|
|
516
|
-
* [`
|
|
567
|
+
* [`Form`]: quillmark::form::Form
|
|
517
568
|
* @param {Document} doc
|
|
518
569
|
* @returns {any}
|
|
519
570
|
*/
|
|
520
|
-
|
|
571
|
+
form(doc) {
|
|
521
572
|
try {
|
|
522
573
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
523
574
|
_assertClass(doc, Document);
|
|
524
|
-
wasm.
|
|
575
|
+
wasm.quill_form(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
525
576
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
526
577
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
527
578
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -533,6 +584,54 @@ export class Quill {
|
|
|
533
584
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
534
585
|
}
|
|
535
586
|
}
|
|
587
|
+
/**
|
|
588
|
+
* Read-only snapshot of the loaded quill's engine info and declared schema.
|
|
589
|
+
*
|
|
590
|
+
* Returns a plain JS object with:
|
|
591
|
+
* - `schema` — the quill's public schema contract, identical to
|
|
592
|
+
* `QuillConfig::public_schema()`. Top-level keys: `name`, `main`,
|
|
593
|
+
* optional `card_types` (map keyed by card name, omitted when empty),
|
|
594
|
+
* optional `example`. `main` and each card under `card_types` share
|
|
595
|
+
* the same shape: `fields` (map keyed by field name), optional
|
|
596
|
+
* `title`, `description`, `ui`.
|
|
597
|
+
* - `backend`, `version`, `author` — quill identity declared in
|
|
598
|
+
* `Quill.yaml`'s `quill:` section.
|
|
599
|
+
* - `supportedFormats` — output formats the backend produces, as
|
|
600
|
+
* lowercase strings.
|
|
601
|
+
* - Any additional unstructured keys declared under `quill:`.
|
|
602
|
+
*
|
|
603
|
+
* Consumers that need validation run their own validator against
|
|
604
|
+
* `metadata.schema`.
|
|
605
|
+
*
|
|
606
|
+
* Equivalent by value for the lifetime of the handle; the quill is
|
|
607
|
+
* immutable once constructed.
|
|
608
|
+
* @returns {any}
|
|
609
|
+
*/
|
|
610
|
+
get metadata() {
|
|
611
|
+
const ret = wasm.quill_metadata(this.__wbg_ptr);
|
|
612
|
+
return takeObject(ret);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Open an iterative render session for page-selective rendering.
|
|
616
|
+
* @param {Document} doc
|
|
617
|
+
* @returns {RenderSession}
|
|
618
|
+
*/
|
|
619
|
+
open(doc) {
|
|
620
|
+
try {
|
|
621
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
622
|
+
_assertClass(doc, Document);
|
|
623
|
+
wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
624
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
625
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
626
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
627
|
+
if (r2) {
|
|
628
|
+
throw takeObject(r1);
|
|
629
|
+
}
|
|
630
|
+
return RenderSession.__wrap(r0);
|
|
631
|
+
} finally {
|
|
632
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
536
635
|
/**
|
|
537
636
|
* Render a document to final artifacts.
|
|
538
637
|
* @param {Document} doc
|
package/bundler/wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -15,8 +15,9 @@ export const document_pushCard: (a: number, b: number, c: number) => void;
|
|
|
15
15
|
export const document_quillRef: (a: number, b: number) => void;
|
|
16
16
|
export const document_removeCard: (a: number, b: number) => number;
|
|
17
17
|
export const document_removeCardField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
18
|
-
export const document_removeField: (a: number, b: number, c: number) =>
|
|
18
|
+
export const document_removeField: (a: number, b: number, c: number, d: number) => void;
|
|
19
19
|
export const document_replaceBody: (a: number, b: number, c: number) => void;
|
|
20
|
+
export const document_setCardTag: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
21
|
export const document_setField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
21
22
|
export const document_setFill: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
22
23
|
export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -26,9 +27,11 @@ export const document_updateCardField: (a: number, b: number, c: number, d: numb
|
|
|
26
27
|
export const document_warnings: (a: number) => number;
|
|
27
28
|
export const init: () => void;
|
|
28
29
|
export const quill_backendId: (a: number, b: number) => void;
|
|
30
|
+
export const quill_blankCard: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
+
export const quill_blankMain: (a: number, b: number) => void;
|
|
32
|
+
export const quill_form: (a: number, b: number, c: number) => void;
|
|
29
33
|
export const quill_metadata: (a: number) => number;
|
|
30
34
|
export const quill_open: (a: number, b: number, c: number) => void;
|
|
31
|
-
export const quill_projectForm: (a: number, b: number, c: number) => void;
|
|
32
35
|
export const quill_render: (a: number, b: number, c: number, d: number) => void;
|
|
33
36
|
export const quillmark_new: () => number;
|
|
34
37
|
export const quillmark_quill: (a: number, b: number, c: number) => void;
|
package/node-esm/wasm.d.ts
CHANGED
|
@@ -133,7 +133,8 @@ export class Document {
|
|
|
133
133
|
* Remove a frontmatter field on the card at `index`, returning the
|
|
134
134
|
* removed value or `undefined` if the field was absent.
|
|
135
135
|
*
|
|
136
|
-
* Throws if `index` is out of range
|
|
136
|
+
* Throws if `index` is out of range, `name` is reserved, or `name` does
|
|
137
|
+
* not match `[a-z_][a-z0-9_]*`.
|
|
137
138
|
*
|
|
138
139
|
* Mutators never modify `warnings`.
|
|
139
140
|
*/
|
|
@@ -141,6 +142,11 @@ export class Document {
|
|
|
141
142
|
/**
|
|
142
143
|
* Remove a frontmatter field on the main card, returning the removed value or `undefined`.
|
|
143
144
|
*
|
|
145
|
+
* Throws an `Error` whose message includes the `EditError` variant name
|
|
146
|
+
* and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
|
|
147
|
+
* or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
|
|
148
|
+
* name returns `undefined`.
|
|
149
|
+
*
|
|
144
150
|
* Mutators never modify `warnings`.
|
|
145
151
|
*/
|
|
146
152
|
removeField(name: string): any;
|
|
@@ -150,6 +156,20 @@ export class Document {
|
|
|
150
156
|
* Mutators never modify `warnings`.
|
|
151
157
|
*/
|
|
152
158
|
replaceBody(body: string): void;
|
|
159
|
+
/**
|
|
160
|
+
* Replace the tag of the composable card at `index`.
|
|
161
|
+
*
|
|
162
|
+
* Mutates only the sentinel — the card's frontmatter and body are
|
|
163
|
+
* untouched. Schema-aware migration (clearing orphan fields, applying
|
|
164
|
+
* new defaults) is the caller's responsibility; `setCardTag` is a
|
|
165
|
+
* structural primitive.
|
|
166
|
+
*
|
|
167
|
+
* Throws if `index` is out of range or if `newTag` does not match
|
|
168
|
+
* `[a-z_][a-z0-9_]*`.
|
|
169
|
+
*
|
|
170
|
+
* Mutators never modify `warnings`.
|
|
171
|
+
*/
|
|
172
|
+
setCardTag(index: number, new_tag: string): void;
|
|
153
173
|
/**
|
|
154
174
|
* Update a frontmatter field on the main card.
|
|
155
175
|
*
|
|
@@ -240,14 +260,30 @@ export class Quill {
|
|
|
240
260
|
free(): void;
|
|
241
261
|
[Symbol.dispose](): void;
|
|
242
262
|
/**
|
|
243
|
-
*
|
|
263
|
+
* A blank form for a card of the given type — no document values supplied.
|
|
264
|
+
*
|
|
265
|
+
* Returns `null` if `cardType` is not declared in this quill's schema.
|
|
266
|
+
* Otherwise returns a plain JS object shaped like a single entry in
|
|
267
|
+
* [`Form::cards`].
|
|
268
|
+
*
|
|
269
|
+
* [`Form::cards`]: quillmark::form::Form::cards
|
|
244
270
|
*/
|
|
245
|
-
|
|
271
|
+
blankCard(card_type: string): any;
|
|
272
|
+
/**
|
|
273
|
+
* A blank form for the main card — no document values supplied.
|
|
274
|
+
*
|
|
275
|
+
* Returns a plain JS object with the same shape as one entry in
|
|
276
|
+
* [`Form::main`]. Every declared field's `source` is `"default"` (when
|
|
277
|
+
* the schema declares a default) or `"missing"`.
|
|
278
|
+
*
|
|
279
|
+
* [`Form::main`]: quillmark::form::Form::main
|
|
280
|
+
*/
|
|
281
|
+
blankMain(): any;
|
|
246
282
|
/**
|
|
247
|
-
*
|
|
283
|
+
* The schema-aware form view of `doc`.
|
|
248
284
|
*
|
|
249
285
|
* Returns a plain JS object (not a class) that is immediately
|
|
250
|
-
* `JSON.stringify`-able. The shape mirrors [`
|
|
286
|
+
* `JSON.stringify`-able. The shape mirrors [`Form`]:
|
|
251
287
|
*
|
|
252
288
|
* ```json
|
|
253
289
|
* {
|
|
@@ -258,12 +294,15 @@ export class Quill {
|
|
|
258
294
|
* ```
|
|
259
295
|
*
|
|
260
296
|
* **Snapshot semantics.** This is a read-only snapshot of the document
|
|
261
|
-
* at call time. Subsequent edits to `doc` require calling `
|
|
262
|
-
* again.
|
|
297
|
+
* at call time. Subsequent edits to `doc` require calling `form` again.
|
|
263
298
|
*
|
|
264
|
-
* [`
|
|
299
|
+
* [`Form`]: quillmark::form::Form
|
|
265
300
|
*/
|
|
266
|
-
|
|
301
|
+
form(doc: Document): any;
|
|
302
|
+
/**
|
|
303
|
+
* Open an iterative render session for page-selective rendering.
|
|
304
|
+
*/
|
|
305
|
+
open(doc: Document): RenderSession;
|
|
267
306
|
/**
|
|
268
307
|
* Render a document to final artifacts.
|
|
269
308
|
*/
|
package/node-esm/wasm.js
CHANGED
|
@@ -197,7 +197,8 @@ export class Document {
|
|
|
197
197
|
* Remove a frontmatter field on the card at `index`, returning the
|
|
198
198
|
* removed value or `undefined` if the field was absent.
|
|
199
199
|
*
|
|
200
|
-
* Throws if `index` is out of range
|
|
200
|
+
* Throws if `index` is out of range, `name` is reserved, or `name` does
|
|
201
|
+
* not match `[a-z_][a-z0-9_]*`.
|
|
201
202
|
*
|
|
202
203
|
* Mutators never modify `warnings`.
|
|
203
204
|
* @param {number} index
|
|
@@ -224,15 +225,31 @@ export class Document {
|
|
|
224
225
|
/**
|
|
225
226
|
* Remove a frontmatter field on the main card, returning the removed value or `undefined`.
|
|
226
227
|
*
|
|
228
|
+
* Throws an `Error` whose message includes the `EditError` variant name
|
|
229
|
+
* and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
|
|
230
|
+
* or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
|
|
231
|
+
* name returns `undefined`.
|
|
232
|
+
*
|
|
227
233
|
* Mutators never modify `warnings`.
|
|
228
234
|
* @param {string} name
|
|
229
235
|
* @returns {any}
|
|
230
236
|
*/
|
|
231
237
|
removeField(name) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
try {
|
|
239
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
240
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
241
|
+
const len0 = WASM_VECTOR_LEN;
|
|
242
|
+
wasm.document_removeField(retptr, this.__wbg_ptr, ptr0, len0);
|
|
243
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
244
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
245
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
246
|
+
if (r2) {
|
|
247
|
+
throw takeObject(r1);
|
|
248
|
+
}
|
|
249
|
+
return takeObject(r0);
|
|
250
|
+
} finally {
|
|
251
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
252
|
+
}
|
|
236
253
|
}
|
|
237
254
|
/**
|
|
238
255
|
* Replace the main card's body (the global Markdown body).
|
|
@@ -245,6 +262,36 @@ export class Document {
|
|
|
245
262
|
const len0 = WASM_VECTOR_LEN;
|
|
246
263
|
wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
|
|
247
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Replace the tag of the composable card at `index`.
|
|
267
|
+
*
|
|
268
|
+
* Mutates only the sentinel — the card's frontmatter and body are
|
|
269
|
+
* untouched. Schema-aware migration (clearing orphan fields, applying
|
|
270
|
+
* new defaults) is the caller's responsibility; `setCardTag` is a
|
|
271
|
+
* structural primitive.
|
|
272
|
+
*
|
|
273
|
+
* Throws if `index` is out of range or if `newTag` does not match
|
|
274
|
+
* `[a-z_][a-z0-9_]*`.
|
|
275
|
+
*
|
|
276
|
+
* Mutators never modify `warnings`.
|
|
277
|
+
* @param {number} index
|
|
278
|
+
* @param {string} new_tag
|
|
279
|
+
*/
|
|
280
|
+
setCardTag(index, new_tag) {
|
|
281
|
+
try {
|
|
282
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
283
|
+
const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
284
|
+
const len0 = WASM_VECTOR_LEN;
|
|
285
|
+
wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
286
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
287
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
288
|
+
if (r1) {
|
|
289
|
+
throw takeObject(r0);
|
|
290
|
+
}
|
|
291
|
+
} finally {
|
|
292
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
248
295
|
/**
|
|
249
296
|
* Update a frontmatter field on the main card.
|
|
250
297
|
*
|
|
@@ -452,58 +499,63 @@ export class Quill {
|
|
|
452
499
|
}
|
|
453
500
|
}
|
|
454
501
|
/**
|
|
455
|
-
*
|
|
502
|
+
* A blank form for a card of the given type — no document values supplied.
|
|
456
503
|
*
|
|
457
|
-
* Returns
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
* optional `card_types` (map keyed by card name, omitted when empty),
|
|
461
|
-
* optional `example`. `main` and each card under `card_types` share
|
|
462
|
-
* the same shape: `fields` (map keyed by field name), optional
|
|
463
|
-
* `title`, `description`, `ui`.
|
|
464
|
-
* - `backend`, `version`, `author` — quill identity declared in
|
|
465
|
-
* `Quill.yaml`'s `quill:` section.
|
|
466
|
-
* - `supportedFormats` — output formats the backend produces, as
|
|
467
|
-
* lowercase strings.
|
|
468
|
-
* - Any additional unstructured keys declared under `quill:`.
|
|
469
|
-
*
|
|
470
|
-
* Consumers that need validation run their own validator against
|
|
471
|
-
* `metadata.schema`.
|
|
504
|
+
* Returns `null` if `cardType` is not declared in this quill's schema.
|
|
505
|
+
* Otherwise returns a plain JS object shaped like a single entry in
|
|
506
|
+
* [`Form::cards`].
|
|
472
507
|
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
508
|
+
* [`Form::cards`]: quillmark::form::Form::cards
|
|
509
|
+
* @param {string} card_type
|
|
475
510
|
* @returns {any}
|
|
476
511
|
*/
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
512
|
+
blankCard(card_type) {
|
|
513
|
+
try {
|
|
514
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
515
|
+
const ptr0 = passStringToWasm0(card_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
516
|
+
const len0 = WASM_VECTOR_LEN;
|
|
517
|
+
wasm.quill_blankCard(retptr, this.__wbg_ptr, ptr0, len0);
|
|
518
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
519
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
520
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
521
|
+
if (r2) {
|
|
522
|
+
throw takeObject(r1);
|
|
523
|
+
}
|
|
524
|
+
return takeObject(r0);
|
|
525
|
+
} finally {
|
|
526
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
527
|
+
}
|
|
480
528
|
}
|
|
481
529
|
/**
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
530
|
+
* A blank form for the main card — no document values supplied.
|
|
531
|
+
*
|
|
532
|
+
* Returns a plain JS object with the same shape as one entry in
|
|
533
|
+
* [`Form::main`]. Every declared field's `source` is `"default"` (when
|
|
534
|
+
* the schema declares a default) or `"missing"`.
|
|
535
|
+
*
|
|
536
|
+
* [`Form::main`]: quillmark::form::Form::main
|
|
537
|
+
* @returns {any}
|
|
485
538
|
*/
|
|
486
|
-
|
|
539
|
+
blankMain() {
|
|
487
540
|
try {
|
|
488
541
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
489
|
-
|
|
490
|
-
wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
542
|
+
wasm.quill_blankMain(retptr, this.__wbg_ptr);
|
|
491
543
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
492
544
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
493
545
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
494
546
|
if (r2) {
|
|
495
547
|
throw takeObject(r1);
|
|
496
548
|
}
|
|
497
|
-
return
|
|
549
|
+
return takeObject(r0);
|
|
498
550
|
} finally {
|
|
499
551
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
500
552
|
}
|
|
501
553
|
}
|
|
502
554
|
/**
|
|
503
|
-
*
|
|
555
|
+
* The schema-aware form view of `doc`.
|
|
504
556
|
*
|
|
505
557
|
* Returns a plain JS object (not a class) that is immediately
|
|
506
|
-
* `JSON.stringify`-able. The shape mirrors [`
|
|
558
|
+
* `JSON.stringify`-able. The shape mirrors [`Form`]:
|
|
507
559
|
*
|
|
508
560
|
* ```json
|
|
509
561
|
* {
|
|
@@ -514,18 +566,17 @@ export class Quill {
|
|
|
514
566
|
* ```
|
|
515
567
|
*
|
|
516
568
|
* **Snapshot semantics.** This is a read-only snapshot of the document
|
|
517
|
-
* at call time. Subsequent edits to `doc` require calling `
|
|
518
|
-
* again.
|
|
569
|
+
* at call time. Subsequent edits to `doc` require calling `form` again.
|
|
519
570
|
*
|
|
520
|
-
* [`
|
|
571
|
+
* [`Form`]: quillmark::form::Form
|
|
521
572
|
* @param {Document} doc
|
|
522
573
|
* @returns {any}
|
|
523
574
|
*/
|
|
524
|
-
|
|
575
|
+
form(doc) {
|
|
525
576
|
try {
|
|
526
577
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
527
578
|
_assertClass(doc, Document);
|
|
528
|
-
wasm.
|
|
579
|
+
wasm.quill_form(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
529
580
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
530
581
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
531
582
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -537,6 +588,54 @@ export class Quill {
|
|
|
537
588
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
538
589
|
}
|
|
539
590
|
}
|
|
591
|
+
/**
|
|
592
|
+
* Read-only snapshot of the loaded quill's engine info and declared schema.
|
|
593
|
+
*
|
|
594
|
+
* Returns a plain JS object with:
|
|
595
|
+
* - `schema` — the quill's public schema contract, identical to
|
|
596
|
+
* `QuillConfig::public_schema()`. Top-level keys: `name`, `main`,
|
|
597
|
+
* optional `card_types` (map keyed by card name, omitted when empty),
|
|
598
|
+
* optional `example`. `main` and each card under `card_types` share
|
|
599
|
+
* the same shape: `fields` (map keyed by field name), optional
|
|
600
|
+
* `title`, `description`, `ui`.
|
|
601
|
+
* - `backend`, `version`, `author` — quill identity declared in
|
|
602
|
+
* `Quill.yaml`'s `quill:` section.
|
|
603
|
+
* - `supportedFormats` — output formats the backend produces, as
|
|
604
|
+
* lowercase strings.
|
|
605
|
+
* - Any additional unstructured keys declared under `quill:`.
|
|
606
|
+
*
|
|
607
|
+
* Consumers that need validation run their own validator against
|
|
608
|
+
* `metadata.schema`.
|
|
609
|
+
*
|
|
610
|
+
* Equivalent by value for the lifetime of the handle; the quill is
|
|
611
|
+
* immutable once constructed.
|
|
612
|
+
* @returns {any}
|
|
613
|
+
*/
|
|
614
|
+
get metadata() {
|
|
615
|
+
const ret = wasm.quill_metadata(this.__wbg_ptr);
|
|
616
|
+
return takeObject(ret);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Open an iterative render session for page-selective rendering.
|
|
620
|
+
* @param {Document} doc
|
|
621
|
+
* @returns {RenderSession}
|
|
622
|
+
*/
|
|
623
|
+
open(doc) {
|
|
624
|
+
try {
|
|
625
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
626
|
+
_assertClass(doc, Document);
|
|
627
|
+
wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
628
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
629
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
630
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
631
|
+
if (r2) {
|
|
632
|
+
throw takeObject(r1);
|
|
633
|
+
}
|
|
634
|
+
return RenderSession.__wrap(r0);
|
|
635
|
+
} finally {
|
|
636
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
540
639
|
/**
|
|
541
640
|
* Render a document to final artifacts.
|
|
542
641
|
* @param {Document} doc
|
package/node-esm/wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -15,8 +15,9 @@ export const document_pushCard: (a: number, b: number, c: number) => void;
|
|
|
15
15
|
export const document_quillRef: (a: number, b: number) => void;
|
|
16
16
|
export const document_removeCard: (a: number, b: number) => number;
|
|
17
17
|
export const document_removeCardField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
18
|
-
export const document_removeField: (a: number, b: number, c: number) =>
|
|
18
|
+
export const document_removeField: (a: number, b: number, c: number, d: number) => void;
|
|
19
19
|
export const document_replaceBody: (a: number, b: number, c: number) => void;
|
|
20
|
+
export const document_setCardTag: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
21
|
export const document_setField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
21
22
|
export const document_setFill: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
22
23
|
export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -26,9 +27,11 @@ export const document_updateCardField: (a: number, b: number, c: number, d: numb
|
|
|
26
27
|
export const document_warnings: (a: number) => number;
|
|
27
28
|
export const init: () => void;
|
|
28
29
|
export const quill_backendId: (a: number, b: number) => void;
|
|
30
|
+
export const quill_blankCard: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
+
export const quill_blankMain: (a: number, b: number) => void;
|
|
32
|
+
export const quill_form: (a: number, b: number, c: number) => void;
|
|
29
33
|
export const quill_metadata: (a: number) => number;
|
|
30
34
|
export const quill_open: (a: number, b: number, c: number) => void;
|
|
31
|
-
export const quill_projectForm: (a: number, b: number, c: number) => void;
|
|
32
35
|
export const quill_render: (a: number, b: number, c: number, d: number) => void;
|
|
33
36
|
export const quillmark_new: () => number;
|
|
34
37
|
export const quillmark_quill: (a: number, b: number, c: number) => void;
|