@quillmark/wasm 0.98.0 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +208 -1
- package/LICENSE +13 -0
- package/README.md +116 -64
- package/backends/pdfform/wasm.d.ts +336 -146
- package/backends/pdfform/wasm_bg.js +223 -122
- package/backends/pdfform/wasm_bg.wasm +0 -0
- package/backends/pdfform/wasm_bg.wasm.d.ts +3 -1
- package/backends/typst/wasm.d.ts +336 -146
- package/backends/typst/wasm_bg.js +223 -122
- package/backends/typst/wasm_bg.wasm +0 -0
- package/backends/typst/wasm_bg.wasm.d.ts +3 -1
- package/core/wasm.d.ts +163 -96
- package/core/wasm_bg.js +206 -102
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +3 -1
- package/package.json +2 -2
- package/runtime/runtime.d.ts +151 -76
- package/runtime/runtime.js +381 -100
|
@@ -21,7 +21,7 @@ export class Document {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Build a composable card of `kind`, typed-commit `fields` onto it, set its
|
|
24
|
-
* body from optional markdown, and place it
|
|
24
|
+
* body from optional markdown, and place it: the ABI under `writer.addCard`.
|
|
25
25
|
* `at` picks the position: absent appends, a number inserts at that index
|
|
26
26
|
* (`0..=cards.length`), so a positioned typed insert is one atomic call
|
|
27
27
|
* rather than `addCard` + `moveCard`. Fuses `makeCard` + typed commit +
|
|
@@ -58,7 +58,7 @@ export class Document {
|
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Typed field write at `addr`, resolving the field's schema `type` from
|
|
61
|
-
* `quill
|
|
61
|
+
* `quill`: the stable ABI under the runtime `writer.set` / `writer.card(i).set`.
|
|
62
62
|
* The one write verb for **every** field type (richtext, scalar, array,
|
|
63
63
|
* object); the schema carries the `inline` constraint, so no type token or
|
|
64
64
|
* flag is passed. A richtext-typed field stores the canonical content, so
|
|
@@ -69,10 +69,10 @@ export class Document {
|
|
|
69
69
|
*
|
|
70
70
|
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
71
71
|
* targets a composable card (its `$kind` resolves the schema). A body
|
|
72
|
-
* address throws
|
|
72
|
+
* address throws: a body has no field schema; write it with `writer.setBody`
|
|
73
73
|
* / `revise`. A field declared in the schema is strict-committed (a mismatch
|
|
74
74
|
* throws now, not at render); a name the schema does not declare throws
|
|
75
|
-
* `edit::unknown_field` rather than falling to the opaque store
|
|
75
|
+
* `edit::unknown_field` rather than falling to the opaque store: on
|
|
76
76
|
* the typed path it is a typo. Use [`storeField`](Document::store_field) for
|
|
77
77
|
* opaque storage. Also throws `edit::field_conform` /
|
|
78
78
|
* `edit::field_richtext_decode` / `edit::field_richtext_not_inline`
|
|
@@ -105,7 +105,7 @@ export class Document {
|
|
|
105
105
|
* field's schema `type` from `quill`. `addr` is a **card address**
|
|
106
106
|
* (`{ card }`, absent = main; a present `field` throws). All-or-nothing with
|
|
107
107
|
* the same per-field-diagnostic error contract as
|
|
108
|
-
* [`storeFields`](Document::store_fields)
|
|
108
|
+
* [`storeFields`](Document::store_fields): nothing is applied on error and
|
|
109
109
|
* the thrown error's `diagnostics` carry one entry per offending field,
|
|
110
110
|
* including an `edit::unknown_field` for any name the schema does not
|
|
111
111
|
* declare, so a whole-form submit sees every typo in one pass. Throws on an
|
|
@@ -130,7 +130,7 @@ export class Document {
|
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Interpreted read at `addr`, resolving the field's declared `type` from
|
|
133
|
-
* `quill
|
|
133
|
+
* `quill`: the stable ABI under the runtime `reader.get` / `reader.card(i).get`.
|
|
134
134
|
* The schema-plane twin of the quill-free [`getStored`](Self::get_stored): a `richtext`
|
|
135
135
|
* field returns its markdown projection, every other declared type its
|
|
136
136
|
* canonical value verbatim, so a consumer holding the quill reads by field
|
|
@@ -139,10 +139,10 @@ export class Document {
|
|
|
139
139
|
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
140
140
|
* targets a composable card (its `$kind` resolves the schema). Returns
|
|
141
141
|
* `undefined` for an **absent** field. An absent `addr.field` reads the body
|
|
142
|
-
* markdown
|
|
142
|
+
* markdown: quill-free, mirroring [`getMarkdown`](Self::get_markdown), since
|
|
143
143
|
* a body's type is a format fact, not a schema fact. A name the schema does
|
|
144
144
|
* not declare throws `edit::unknown_field` (the authority `getMarkdown`
|
|
145
|
-
* lacks
|
|
145
|
+
* lacks: there an unknown name reads back `undefined`); a `richtext` field
|
|
146
146
|
* holding a value that does not decode throws `edit::field_richtext_decode`;
|
|
147
147
|
* an out-of-range `addr.card` throws.
|
|
148
148
|
*
|
|
@@ -169,8 +169,49 @@ export class Document {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
172
|
+
* Interpreted **corpus** read at `addr`: the stable ABI under the runtime
|
|
173
|
+
* `reader.getContent` / `reader.card(i).getContent`. The corpus twin of
|
|
174
|
+
* [`reader.get`](Self::reader_get), which projects; this decodes the stored
|
|
175
|
+
* value through the codec the field's declared type names (`richtext` as
|
|
176
|
+
* markdown, `plaintext` as literal text) and returns the canonical `Content`.
|
|
177
|
+
*
|
|
178
|
+
* Total over the storage form: a committed field holds a content object and
|
|
179
|
+
* a parsed one holds the authored string, and both read back as a corpus
|
|
180
|
+
* here, so a consumer mounting a corpus editor stops branching on how the
|
|
181
|
+
* document was built.
|
|
182
|
+
*
|
|
183
|
+
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
184
|
+
* targets a composable card. Returns `undefined` for an **absent** field. An
|
|
185
|
+
* absent `addr.field` reads the **body** corpus, quill-free, mirroring
|
|
186
|
+
* [`getStored`](Self::get_stored). Throws `edit::unknown_field` for a name
|
|
187
|
+
* the schema does not declare, `edit::field_not_content` for a declared type
|
|
188
|
+
* that is not a content leaf (`array<richtext>` carries content and still has
|
|
189
|
+
* no one corpus), `edit::field_richtext_decode` for a stored value
|
|
190
|
+
* that decodes under neither encoding, and `edit::index_out_of_range` for a
|
|
191
|
+
* bad `addr.card`.
|
|
192
|
+
* @param {Quill} quill
|
|
193
|
+
* @param {Addr | string} addr
|
|
194
|
+
* @returns {Content | undefined}
|
|
195
|
+
*/
|
|
196
|
+
_readerGetContent(quill, addr) {
|
|
197
|
+
try {
|
|
198
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
199
|
+
_assertClass(quill, Quill);
|
|
200
|
+
wasm.document__readerGetContent(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr));
|
|
201
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
202
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
203
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
204
|
+
if (r2) {
|
|
205
|
+
throw takeObject(r1);
|
|
206
|
+
}
|
|
207
|
+
return takeObject(r0);
|
|
208
|
+
} finally {
|
|
209
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Revise the content field at `addr` from authored text, typed *and*
|
|
214
|
+
* anchor-preserving: the ABI under `writer.reviseField`. Resolves the
|
|
174
215
|
* field's schema from `quill` (main card, or the addressed card's `$kind`)
|
|
175
216
|
* and defers to [`TypedWriter::revise_field`](quillmark_core::TypedWriter::revise_field):
|
|
176
217
|
* surviving anchors rebase (as [`revise`](Self::revise)), then the diffed
|
|
@@ -178,21 +219,24 @@ export class Document {
|
|
|
178
219
|
* multi-block result with `edit::field_richtext_not_inline`. Returns the
|
|
179
220
|
* text `Delta`.
|
|
180
221
|
*
|
|
222
|
+
* The codec is the declared type's: `richtext` diffs markdown, `plaintext`
|
|
223
|
+
* the literal text.
|
|
224
|
+
*
|
|
181
225
|
* `addr` must name a field (a bare string is `{ field }`); a body address
|
|
182
|
-
* throws (a body carries no field schema
|
|
226
|
+
* throws (a body carries no field schema: use [`revise`](Self::revise)). A
|
|
183
227
|
* name the schema does not declare throws `edit::unknown_field`. Throws
|
|
184
228
|
* on an out-of-range card. Hidden from the `.d.ts`; the visible verb is
|
|
185
229
|
* `writer.reviseField` in the runtime layer.
|
|
186
230
|
* @param {Quill} quill
|
|
187
231
|
* @param {Addr | string} addr
|
|
188
|
-
* @param {string}
|
|
232
|
+
* @param {string} text
|
|
189
233
|
* @returns {Delta}
|
|
190
234
|
*/
|
|
191
|
-
_reviseField(quill, addr,
|
|
235
|
+
_reviseField(quill, addr, text) {
|
|
192
236
|
try {
|
|
193
237
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
194
238
|
_assertClass(quill, Quill);
|
|
195
|
-
const ptr0 = passStringToWasm0(
|
|
239
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
196
240
|
const len0 = WASM_VECTOR_LEN;
|
|
197
241
|
wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
198
242
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
@@ -208,7 +252,7 @@ export class Document {
|
|
|
208
252
|
}
|
|
209
253
|
/**
|
|
210
254
|
* **Apply** a committed content edit `bundle` (`{ delta?, lineOps?, markOps? }`)
|
|
211
|
-
* at `addr
|
|
255
|
+
* at `addr`, the editor splice: text delta first, then line ops, then mark
|
|
212
256
|
* ops (mark ranges in final-text coordinates), each all-or-nothing. An absent
|
|
213
257
|
* `addr.field` targets the body, an absent `addr.card` the main card.
|
|
214
258
|
*
|
|
@@ -258,7 +302,7 @@ export class Document {
|
|
|
258
302
|
}
|
|
259
303
|
}
|
|
260
304
|
/**
|
|
261
|
-
* A single composable card by index
|
|
305
|
+
* A single composable card by index: the whole `Card`, the card-indexed
|
|
262
306
|
* twin of the [`main`](Self::main) getter, so reading one card need not
|
|
263
307
|
* materialize every card via [`cards`](Self::cards). An out-of-range
|
|
264
308
|
* `index` throws `edit::index_out_of_range`, matching the card write
|
|
@@ -289,20 +333,6 @@ export class Document {
|
|
|
289
333
|
const ret = wasm.document_cardCount(this.__wbg_ptr);
|
|
290
334
|
return ret >>> 0;
|
|
291
335
|
}
|
|
292
|
-
/**
|
|
293
|
-
* The index of the composable card whose `$id` equals `id`, or
|
|
294
|
-
* `undefined` when none carries it. Resolves the durable card handle
|
|
295
|
-
* without a hand-rolled scan over [`cards`](Self::cards); `$id` is
|
|
296
|
-
* unique per document, so at most one card matches.
|
|
297
|
-
* @param {string} id
|
|
298
|
-
* @returns {number | undefined}
|
|
299
|
-
*/
|
|
300
|
-
cardIndexById(id) {
|
|
301
|
-
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
302
|
-
const len0 = WASM_VECTOR_LEN;
|
|
303
|
-
const ret = wasm.document_cardIndexById(this.__wbg_ptr, ptr0, len0);
|
|
304
|
-
return takeObject(ret);
|
|
305
|
-
}
|
|
306
336
|
/**
|
|
307
337
|
* @returns {Card[]}
|
|
308
338
|
*/
|
|
@@ -459,7 +489,7 @@ export class Document {
|
|
|
459
489
|
}
|
|
460
490
|
/**
|
|
461
491
|
* The whole `$ext` map at `addr` (a card address, absent `card` = main), or
|
|
462
|
-
* `undefined` when the card carries none. The fine-grained `$ext` read
|
|
492
|
+
* `undefined` when the card carries none. The fine-grained `$ext` read:
|
|
463
493
|
* your own state without serializing the whole card. Throws on a present
|
|
464
494
|
* `field` (a card address takes only `card`) or an out-of-range card.
|
|
465
495
|
* @param {CardAddr} [addr]
|
|
@@ -482,7 +512,7 @@ export class Document {
|
|
|
482
512
|
}
|
|
483
513
|
/**
|
|
484
514
|
* The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
|
|
485
|
-
* = main), or `undefined`. The namespace-scoped `$ext` read
|
|
515
|
+
* = main), or `undefined`. The namespace-scoped `$ext` read: your own slot
|
|
486
516
|
* without a whole-card serialize, and non-destructive (unlike
|
|
487
517
|
* `removeExtNamespace`). Throws on a present `field` or an out-of-range card.
|
|
488
518
|
* @param {CardAddr} addr
|
|
@@ -507,15 +537,15 @@ export class Document {
|
|
|
507
537
|
}
|
|
508
538
|
}
|
|
509
539
|
/**
|
|
510
|
-
* The **body** markdown projection
|
|
511
|
-
* body (`{ card }`)
|
|
540
|
+
* The **body** markdown projection (the main body, or a composable card's
|
|
541
|
+
* body (`{ card }`)) the on-demand, lossy export (content-only marks do not
|
|
512
542
|
* survive markdown). A body's type is a format fact, not a schema fact, so
|
|
513
543
|
* this read stays quill-free; a body is never absent.
|
|
514
544
|
*
|
|
515
545
|
* `addr` is an optional **card address** (`{ card }`, absent = main). A
|
|
516
|
-
* present `field` throws
|
|
546
|
+
* present `field` throws: a field's markdown is read through the
|
|
517
547
|
* schema-plane `quill.reader(doc).get(field)`, which interprets by declared
|
|
518
|
-
* type
|
|
548
|
+
* type. An out-of-range `addr.card` throws.
|
|
519
549
|
* @param {CardAddr} [addr]
|
|
520
550
|
* @returns {string}
|
|
521
551
|
*/
|
|
@@ -535,16 +565,25 @@ export class Document {
|
|
|
535
565
|
}
|
|
536
566
|
}
|
|
537
567
|
/**
|
|
538
|
-
* Read the **verbatim stored value** at `addr
|
|
539
|
-
* field
|
|
540
|
-
* otherwise), or the **body content** when `addr.field` is absent. A bare
|
|
568
|
+
* Read the **verbatim stored value** at `addr`: the raw payload value of a
|
|
569
|
+
* field, or the **body content** when `addr.field` is absent. A bare
|
|
541
570
|
* string is `Addr` shorthand for `{ field }`. Reads are total over the field
|
|
542
571
|
* axis: an absent field is `undefined`; only an out-of-range `addr.card`
|
|
543
572
|
* throws `edit::index_out_of_range`. Needs no schema, so it lives on
|
|
544
|
-
* `Document
|
|
573
|
+
* `Document`: the read echo of the verbatim `store*` write, distinct from
|
|
545
574
|
* the interpreted schema-plane [`reader.get`](Self::reader_get). For the
|
|
546
575
|
* markdown projection use [`getMarkdown`](Self::get_markdown) (body) or
|
|
547
576
|
* `reader.get` (a field's declared type).
|
|
577
|
+
*
|
|
578
|
+
* **A content field at rest has one stored form per codec**: a `richtext`
|
|
579
|
+
* field holds the canonical content object, a `plaintext` field its literal
|
|
580
|
+
* string. A document that came through the bound door (`quill.parse` /
|
|
581
|
+
* `quill.conform`) is at rest, so this read no longer depends on which lane
|
|
582
|
+
* built it. A document that came through the transport door
|
|
583
|
+
* (`Document.fromMarkdown`, a legacy stored row) may rest as authored until
|
|
584
|
+
* it is conformed, and this read reports what is there. For the corpus
|
|
585
|
+
* either way, use the schema-plane `reader.getContent`, which decodes
|
|
586
|
+
* through the codec the field's declared type names.
|
|
548
587
|
* @param {Addr | string} addr
|
|
549
588
|
* @returns {unknown}
|
|
550
589
|
*/
|
|
@@ -564,9 +603,9 @@ export class Document {
|
|
|
564
603
|
}
|
|
565
604
|
}
|
|
566
605
|
/**
|
|
567
|
-
* Insert a card
|
|
606
|
+
* Insert a card, the single insertion verb: `at` absent appends, a number
|
|
568
607
|
* inserts at that index (must be in `0..=cards.length`). Accepts a
|
|
569
|
-
* `CardInput
|
|
608
|
+
* `CardInput`: a card read back (`cards` / `removeCard` / `quill.seedCard`),
|
|
570
609
|
* a [`makeCard`](Document::make_card) result, or a bare `{ kind, body }`
|
|
571
610
|
* (every returned `Card` is a valid `CardInput`). Throws if `card.kind` is
|
|
572
611
|
* not a valid kind name, or if `at` is out of range.
|
|
@@ -587,7 +626,7 @@ export class Document {
|
|
|
587
626
|
}
|
|
588
627
|
}
|
|
589
628
|
/**
|
|
590
|
-
* **Install** a richtext value at `addr
|
|
629
|
+
* **Install** a richtext value at `addr`: **value semantics**, content only.
|
|
591
630
|
* Stores exactly `rt` (a canonical `Content` content object); the identity
|
|
592
631
|
* anchors of any previous value are gone. An absent `addr.field` targets the
|
|
593
632
|
* body, an absent `addr.card` the main card. For "here's new markdown," use
|
|
@@ -615,7 +654,7 @@ export class Document {
|
|
|
615
654
|
}
|
|
616
655
|
/**
|
|
617
656
|
* Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
|
|
618
|
-
* shorthand for `{ field }`. `false` for an absent field (truthful
|
|
657
|
+
* shorthand for `{ field }`. `false` for an absent field (truthful: it isn't
|
|
619
658
|
* marked) and for a body address (a body is never a fill). Only an
|
|
620
659
|
* out-of-range `addr.card` throws.
|
|
621
660
|
* @param {Addr | string} addr
|
|
@@ -638,13 +677,13 @@ export class Document {
|
|
|
638
677
|
}
|
|
639
678
|
/**
|
|
640
679
|
* Replace this document's contents **in place** from a versioned storage
|
|
641
|
-
* DTO string
|
|
680
|
+
* DTO string: the mutating twin of the static
|
|
642
681
|
* [`fromJson`](Document::from_json) constructor. Parse-time `warnings` are
|
|
643
682
|
* cleared. Throws (leaving the document unchanged) on an invalid DTO.
|
|
644
683
|
*
|
|
645
684
|
* The cross-WASM-memory `Document` bridge: mutate a document on a
|
|
646
685
|
* backend-memory clone, then write the mutated state back into the caller's
|
|
647
|
-
* canonical document with this
|
|
686
|
+
* canonical document with this, the one way to update a live handle across
|
|
648
687
|
* the linear-memory seam without the caller re-binding its variable.
|
|
649
688
|
* @param {string} json
|
|
650
689
|
*/
|
|
@@ -665,7 +704,7 @@ export class Document {
|
|
|
665
704
|
}
|
|
666
705
|
/**
|
|
667
706
|
* The document's main (entry) card. Allocates and serializes on each
|
|
668
|
-
* call
|
|
707
|
+
* call: cache locally if read in a hot loop.
|
|
669
708
|
* @returns {Card}
|
|
670
709
|
*/
|
|
671
710
|
get main() {
|
|
@@ -684,7 +723,7 @@ export class Document {
|
|
|
684
723
|
}
|
|
685
724
|
}
|
|
686
725
|
/**
|
|
687
|
-
* Build a fresh `Card` from a kind and a flat field map
|
|
726
|
+
* Build a fresh `Card` from a kind and a flat field map: the ergonomic
|
|
688
727
|
* constructor for `insertCard`. `fields` is an optional
|
|
689
728
|
* `Record<string, unknown>` (each entry becomes a card field, in
|
|
690
729
|
* insertion order); `body` defaults to `""`.
|
|
@@ -694,8 +733,8 @@ export class Document {
|
|
|
694
733
|
* here.
|
|
695
734
|
*
|
|
696
735
|
* Checks only what a detached card can decide alone: field-name grammar
|
|
697
|
-
* and value depth. Kind validity is positional
|
|
698
|
-
* root, reserved for a composable card
|
|
736
|
+
* and value depth. Kind validity is positional (`main` is right for the
|
|
737
|
+
* root, reserved for a composable card) so `insertCard` is its gate, and
|
|
699
738
|
* any kind string is accepted here.
|
|
700
739
|
* @param {string} kind
|
|
701
740
|
* @param {Record<string, unknown>} [fields]
|
|
@@ -740,7 +779,7 @@ export class Document {
|
|
|
740
779
|
}
|
|
741
780
|
}
|
|
742
781
|
/**
|
|
743
|
-
* `new Document(quillRef)
|
|
782
|
+
* `new Document(quillRef)`, a blank document: a main card carrying only
|
|
744
783
|
* `$quill`, an empty body, and no composable cards. The programmatic
|
|
745
784
|
* blank canvas: absent fields resolve at render time (`default`, else
|
|
746
785
|
* type-empty zero), so nothing the caller did not set reaches the
|
|
@@ -789,7 +828,7 @@ export class Document {
|
|
|
789
828
|
/**
|
|
790
829
|
* The canonical `$quill` reference grammar as author-facing text. Core is
|
|
791
830
|
* the single source of truth: drive schema `describe` and validation
|
|
792
|
-
* messages from this instead of re-stating the rule
|
|
831
|
+
* messages from this instead of re-stating the rule; it matches the
|
|
793
832
|
* `hint` on `parse::invalid_quill_reference`. Cache it; the value never
|
|
794
833
|
* changes.
|
|
795
834
|
* @returns {string}
|
|
@@ -831,7 +870,7 @@ export class Document {
|
|
|
831
870
|
}
|
|
832
871
|
/**
|
|
833
872
|
* Remove the `$ext` map on the card `addr` targets *entirely*, returning the
|
|
834
|
-
* previous map or `undefined
|
|
873
|
+
* previous map or `undefined`: a blunt escape hatch that discards every
|
|
835
874
|
* namespace at once (prefer `removeExtNamespace`). `addr` is a card address
|
|
836
875
|
* (absent = main). Throws on a present `field` or an out-of-range card.
|
|
837
876
|
* @param {CardAddr} [addr]
|
|
@@ -926,7 +965,7 @@ export class Document {
|
|
|
926
965
|
}
|
|
927
966
|
}
|
|
928
967
|
/**
|
|
929
|
-
* **Revise** the richtext value at `addr` from a markdown string
|
|
968
|
+
* **Revise** the richtext value at `addr` from a markdown string: **edit
|
|
930
969
|
* semantics**, the default write path, returning the text `Delta`. Imports
|
|
931
970
|
* the markdown, diffs it against the current value, rebases surviving
|
|
932
971
|
* identity anchors, and returns the change an editor bridge maps its own
|
|
@@ -958,7 +997,7 @@ export class Document {
|
|
|
958
997
|
}
|
|
959
998
|
/**
|
|
960
999
|
* Read the `schema` version tag from a raw storage DTO string without a
|
|
961
|
-
* full parse, or `undefined`. Returns unknown future versions as-is
|
|
1000
|
+
* full parse, or `undefined`. Returns unknown future versions as-is:
|
|
962
1001
|
* useful to distinguish "build too old" from "payload corrupt" when
|
|
963
1002
|
* `fromJson` throws.
|
|
964
1003
|
* @param {string} json
|
|
@@ -986,7 +1025,7 @@ export class Document {
|
|
|
986
1025
|
* The main card's `$seed` overlay object for `kind` (the `$seed[kind]`
|
|
987
1026
|
* entry), or `undefined` when absent. The cheap read that feeds
|
|
988
1027
|
* `quill.seedCard(kind, overlay)` without serializing the whole main card
|
|
989
|
-
* via [`main`](Self::main) to fish out one key
|
|
1028
|
+
* via [`main`](Self::main) to fish out one key, and it keeps `seedCard`
|
|
990
1029
|
* pure: the quill still never reads the document.
|
|
991
1030
|
* @param {string} kind
|
|
992
1031
|
* @returns {Record<string, unknown> | undefined}
|
|
@@ -1053,7 +1092,7 @@ export class Document {
|
|
|
1053
1092
|
* Replace the opaque `$ext` map on the card `addr` targets (a card address,
|
|
1054
1093
|
* absent `card` = main). `value` must be a plain object. `$ext` carries
|
|
1055
1094
|
* out-of-band consumer state and never reaches the rendered output; pass
|
|
1056
|
-
* `{}` for an explicit empty `$ext`. Quill-free and verbatim
|
|
1095
|
+
* `{}` for an explicit empty `$ext`. Quill-free and verbatim: an opaque
|
|
1057
1096
|
* `store` verb. Throws on a present `field` or an out-of-range card.
|
|
1058
1097
|
* @param {CardAddr} addr
|
|
1059
1098
|
* @param {any} value
|
|
@@ -1073,8 +1112,8 @@ export class Document {
|
|
|
1073
1112
|
}
|
|
1074
1113
|
/**
|
|
1075
1114
|
* Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
|
|
1076
|
-
* sibling namespaces
|
|
1077
|
-
* address (absent = main). Quill-free and verbatim
|
|
1115
|
+
* sibling namespaces: the recommended `$ext` write. `addr` is a card
|
|
1116
|
+
* address (absent = main). Quill-free and verbatim: an opaque `store` verb.
|
|
1078
1117
|
* Throws on a present `field` or an out-of-range card.
|
|
1079
1118
|
* @param {CardAddr} addr
|
|
1080
1119
|
* @param {string} ns
|
|
@@ -1096,12 +1135,12 @@ export class Document {
|
|
|
1096
1135
|
}
|
|
1097
1136
|
}
|
|
1098
1137
|
/**
|
|
1099
|
-
* Store a field verbatim at `addr
|
|
1138
|
+
* Store a field verbatim at `addr`: the opaque store (**store** = verbatim,
|
|
1100
1139
|
* coercion deferred to render; the typed write is
|
|
1101
1140
|
* [`commitField`](Document::commit_field)). A bare string is `Addr`
|
|
1102
1141
|
* shorthand for `{ field }`, so `doc.storeField("qty", 3)` reads as written;
|
|
1103
1142
|
* `{ card: 2, field: "qty" }` targets a composable card. Clears any
|
|
1104
|
-
* `!must_fill` marker. A body address (no `field`) throws
|
|
1143
|
+
* `!must_fill` marker. A body address (no `field`) throws: a body is never
|
|
1105
1144
|
* opaque; write it with `revise` / `install` / `writer.setBody`. Throws on
|
|
1106
1145
|
* an out-of-range card or a malformed name.
|
|
1107
1146
|
* @param {Addr | string} addr
|
|
@@ -1121,12 +1160,12 @@ export class Document {
|
|
|
1121
1160
|
}
|
|
1122
1161
|
}
|
|
1123
1162
|
/**
|
|
1124
|
-
* Store several fields verbatim and atomically on the card `addr` targets
|
|
1163
|
+
* Store several fields verbatim and atomically on the card `addr` targets:
|
|
1125
1164
|
* the opaque store's batch. `addr` is a **card address** (`{ card }`, absent
|
|
1126
1165
|
* = main); a present `field` throws. The batch verb takes the address first
|
|
1127
1166
|
* and is never shape-overloaded, because `card` is a legal field name:
|
|
1128
1167
|
* `storeFields({}, fields)` is the main card, `storeFields({ card: 2 },
|
|
1129
|
-
* fields)` a composable one
|
|
1168
|
+
* fields)` a composable one, never ambiguous with "set field `card`".
|
|
1130
1169
|
* Nothing is applied on error; the thrown error's `diagnostics` carry one
|
|
1131
1170
|
* entry per offending field. Throws on an out-of-range card.
|
|
1132
1171
|
* @param {CardAddr} addr
|
|
@@ -1146,7 +1185,7 @@ export class Document {
|
|
|
1146
1185
|
}
|
|
1147
1186
|
}
|
|
1148
1187
|
/**
|
|
1149
|
-
* Store a field verbatim at `addr` and mark it `!must_fill
|
|
1188
|
+
* Store a field verbatim at `addr` and mark it `!must_fill`: the opaque
|
|
1150
1189
|
* store's fill variant, card-capable (a bare string or `{ field }` for main,
|
|
1151
1190
|
* `{ card, field }` for a composable card). A body address throws. Same
|
|
1152
1191
|
* validation as [`storeField`](Document::store_field).
|
|
@@ -1168,9 +1207,9 @@ export class Document {
|
|
|
1168
1207
|
}
|
|
1169
1208
|
/**
|
|
1170
1209
|
* Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
|
|
1171
|
-
* under `cardKind`, preserving sibling kinds
|
|
1210
|
+
* under `cardKind`, preserving sibling kinds: `$seed` lives on the main
|
|
1172
1211
|
* card by model, so this takes no address. Sets the starting values new
|
|
1173
|
-
* cards of that kind spawn with. Quill-free and verbatim
|
|
1212
|
+
* cards of that kind spawn with. Quill-free and verbatim: an opaque `store`
|
|
1174
1213
|
* verb. Throws if `overlay` cannot be serialized or nests too deep.
|
|
1175
1214
|
* @param {string} card_kind
|
|
1176
1215
|
* @param {any} overlay
|
|
@@ -1194,7 +1233,7 @@ export class Document {
|
|
|
1194
1233
|
* Serialize this document to a versioned storage DTO string.
|
|
1195
1234
|
*
|
|
1196
1235
|
* Prefer this over `toMarkdown` for persistence across restarts or crate
|
|
1197
|
-
* upgrades
|
|
1236
|
+
* upgrades: the wire format is frozen per `schema` version. Parse-time
|
|
1198
1237
|
* `warnings` are excluded from the DTO.
|
|
1199
1238
|
*
|
|
1200
1239
|
* Output is **byte-deterministic** within a `schema` version: equal
|
|
@@ -1240,7 +1279,7 @@ export class Document {
|
|
|
1240
1279
|
}
|
|
1241
1280
|
/**
|
|
1242
1281
|
* Like [`fromJson`](Document::from_json) but returns `undefined` instead
|
|
1243
|
-
* of throwing when `json` is not a valid storage DTO
|
|
1282
|
+
* of throwing when `json` is not a valid storage DTO: use to
|
|
1244
1283
|
* discriminate format without exceptions as control flow.
|
|
1245
1284
|
* `undefined` means "not a storage DTO"; `fromMarkdown` still throws on
|
|
1246
1285
|
* genuinely malformed markdown.
|
|
@@ -1254,6 +1293,10 @@ export class Document {
|
|
|
1254
1293
|
return ret === 0 ? undefined : Document.__wrap(ret);
|
|
1255
1294
|
}
|
|
1256
1295
|
/**
|
|
1296
|
+
* The non-fatal diagnostics of the load that produced this document: parse
|
|
1297
|
+
* warnings, plus the `conform::*` warnings when it came through
|
|
1298
|
+
* `quill.parse`. Session state, not document value: `equals` and the
|
|
1299
|
+
* storage DTO exclude it, and `fromJson` / `loadJson` clear it.
|
|
1257
1300
|
* @returns {Diagnostic[]}
|
|
1258
1301
|
*/
|
|
1259
1302
|
get warnings() {
|
|
@@ -1279,7 +1322,7 @@ if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free
|
|
|
1279
1322
|
* `fieldAt`, `positionAt`, `locate`) serve the current compile. `apply(doc)`
|
|
1280
1323
|
* recompiles a whole document in place, transactionally (on throw every read
|
|
1281
1324
|
* keeps serving the last-good compile). Geometry reads reflect the current
|
|
1282
|
-
* compile; anchoring a caret across edits is the editor's job
|
|
1325
|
+
* compile; anchoring a caret across edits is the editor's job: re-read
|
|
1283
1326
|
* geometry after each committed `apply`.
|
|
1284
1327
|
*
|
|
1285
1328
|
* **Empty documents.** A zero-page document yields a valid session
|
|
@@ -1306,7 +1349,7 @@ export class LiveSession {
|
|
|
1306
1349
|
wasm.__wbg_livesession_free(ptr, 0);
|
|
1307
1350
|
}
|
|
1308
1351
|
/**
|
|
1309
|
-
* Recompile the session against `doc
|
|
1352
|
+
* Recompile the session against `doc`: the edit verb of a live preview.
|
|
1310
1353
|
* The document is compiled through the same schema pipeline as `open`
|
|
1311
1354
|
* (same quill), then applied transactionally: on throw every read
|
|
1312
1355
|
* (`render`, `paint`, `pageSize`, `regions`, `fieldAt`) keeps serving the last-good
|
|
@@ -1352,11 +1395,11 @@ export class LiveSession {
|
|
|
1352
1395
|
}
|
|
1353
1396
|
}
|
|
1354
1397
|
/**
|
|
1355
|
-
* The schema field whose content is under a point on `page
|
|
1398
|
+
* The schema field whose content is under a point on `page`, the
|
|
1356
1399
|
* forward (click → field) direction: hit-test a click against the
|
|
1357
1400
|
* compiled document and get back the `DocPath` field address to focus in
|
|
1358
1401
|
* the editor, or `undefined` off any field's ink. `x`/`y` are PDF points
|
|
1359
|
-
* with a **bottom-left** origin, the same space as `FieldRegion.rect
|
|
1402
|
+
* with a **bottom-left** origin, the same space as `FieldRegion.rect`,
|
|
1360
1403
|
* from a canvas click, invert the overlay transform documented on
|
|
1361
1404
|
* `FieldRegion`: `x = clickPx.x / renderScale`,
|
|
1362
1405
|
* `y = pageHeightPt - clickPx.y / renderScale`. Unlike `regions()`,
|
|
@@ -1383,12 +1426,12 @@ export class LiveSession {
|
|
|
1383
1426
|
}
|
|
1384
1427
|
}
|
|
1385
1428
|
/**
|
|
1386
|
-
* The whole-field highlight boxes for `field
|
|
1429
|
+
* The whole-field highlight boxes for `field`: one union rect per page,
|
|
1387
1430
|
* over the field's `span`-bearing content segments. The convenience that
|
|
1388
1431
|
* owns the union `regions()` leaves derived: it keeps `regions()` the
|
|
1389
|
-
* low-level disjoint truth
|
|
1432
|
+
* low-level disjoint truth and folds the span-filter + per-page
|
|
1390
1433
|
* union here, so a "highlight the focused field" consumer stops
|
|
1391
|
-
* reimplementing it. **Content only
|
|
1434
|
+
* reimplementing it. **Content only**: a field placed solely as a scalar
|
|
1392
1435
|
* reference or a bound widget carries no `span` and returns `[]`; its box
|
|
1393
1436
|
* is a single `regions()` rect. Reflects the current compile, like
|
|
1394
1437
|
* `regions()`.
|
|
@@ -1413,7 +1456,7 @@ export class LiveSession {
|
|
|
1413
1456
|
}
|
|
1414
1457
|
}
|
|
1415
1458
|
/**
|
|
1416
|
-
* A content position → **caret rect
|
|
1459
|
+
* A content position → **caret rect**, the reverse of `positionAt`: given
|
|
1417
1460
|
* a field and a USV offset into its `Content`, return the box (in the
|
|
1418
1461
|
* same bottom-left PDF-point space as `FieldRegion.rect`) to draw a caret
|
|
1419
1462
|
* at, its `span` collapsed to `[pos, pos]`; `undefined` when the field
|
|
@@ -1461,12 +1504,12 @@ export class LiveSession {
|
|
|
1461
1504
|
* `OffscreenCanvasRenderingContext2D`. The painter owns
|
|
1462
1505
|
* `canvas.width`/`height` (no `clearRect` needed); consumers own
|
|
1463
1506
|
* `canvas.style.*`. If `layoutScale * densityScale` exceeds 16384 px
|
|
1464
|
-
* per side, `densityScale` is clamped
|
|
1507
|
+
* per side, `densityScale` is clamped: `PaintResult.clamped` reports it and
|
|
1465
1508
|
* `PaintResult.effectiveDensityScale` carries the density actually applied.
|
|
1466
1509
|
*
|
|
1467
1510
|
* `put_image_data` writes the whole backing store, bypassing the 2D
|
|
1468
1511
|
* context's transform, `globalAlpha`, and clip: the painter owns the entire
|
|
1469
|
-
* canvas, so each visible page needs its own
|
|
1512
|
+
* canvas, so each visible page needs its own `<canvas>`; you cannot composite
|
|
1470
1513
|
* two pages, a sub-rect, or a context transform through this call.
|
|
1471
1514
|
*
|
|
1472
1515
|
* Throws if the backend has no canvas painter, `page` is out of range,
|
|
@@ -1492,11 +1535,11 @@ export class LiveSession {
|
|
|
1492
1535
|
}
|
|
1493
1536
|
}
|
|
1494
1537
|
/**
|
|
1495
|
-
* A point → **content position
|
|
1538
|
+
* A point → **content position**, the fine-grained click direction:
|
|
1496
1539
|
* hit-test a point and get back the field *and* a USV offset into its
|
|
1497
1540
|
* `Content` (for placing a caret or mapping a selection into the content
|
|
1498
1541
|
* model), or `undefined` off all content ink. `x`/`y` are PDF points,
|
|
1499
|
-
* bottom-left origin
|
|
1542
|
+
* bottom-left origin: the same space as `fieldAt`. The offset is
|
|
1500
1543
|
* cluster-exact and degrades to the containing segment's start on
|
|
1501
1544
|
* origin-less ink (list markers, a code fence's interior). See
|
|
1502
1545
|
* `ContentHit`.
|
|
@@ -1510,7 +1553,7 @@ export class LiveSession {
|
|
|
1510
1553
|
return takeObject(ret);
|
|
1511
1554
|
}
|
|
1512
1555
|
/**
|
|
1513
|
-
* Schema-field geometry for this compiled session
|
|
1556
|
+
* Schema-field geometry for this compiled session: each content field's
|
|
1514
1557
|
* **first placement** (one region per page it touches) plus widget and
|
|
1515
1558
|
* scalar-reference-site regions, keyed on the canonical `DocPath` address
|
|
1516
1559
|
* (`parseDocPath`-routable; the session resolves the backend's plate-space
|
|
@@ -1558,7 +1601,7 @@ export class LiveSession {
|
|
|
1558
1601
|
/**
|
|
1559
1602
|
* `true` iff `paint` and `pageSize` will succeed for this session. Derived
|
|
1560
1603
|
* from the session's canvas seam, so it reflects exactly what `paint` will
|
|
1561
|
-
* do
|
|
1604
|
+
* do: no separately captured flag.
|
|
1562
1605
|
* @returns {boolean}
|
|
1563
1606
|
*/
|
|
1564
1607
|
get supportsCanvas() {
|
|
@@ -1567,7 +1610,7 @@ export class LiveSession {
|
|
|
1567
1610
|
}
|
|
1568
1611
|
/**
|
|
1569
1612
|
* Non-fatal diagnostics of the session's **current compile** (e.g. Typst
|
|
1570
|
-
* font fallback)
|
|
1613
|
+
* font fallback): set at open and refreshed by each committed `apply`;
|
|
1571
1614
|
* a failed apply keeps the last-good compile's warnings. Also appended
|
|
1572
1615
|
* to `RenderResult.warnings` on each `render()` call.
|
|
1573
1616
|
* @returns {Diagnostic[]}
|
|
@@ -1610,7 +1653,7 @@ export class Quill {
|
|
|
1610
1653
|
}
|
|
1611
1654
|
/**
|
|
1612
1655
|
* The *declared* backend identifier (`config.backend`, e.g. `"typst"`).
|
|
1613
|
-
* Intent, not a resolved capability
|
|
1656
|
+
* Intent, not a resolved capability: capability (`supportedFormats` /
|
|
1614
1657
|
* `supportsCanvas`) is read from the engine.
|
|
1615
1658
|
* @returns {string}
|
|
1616
1659
|
*/
|
|
@@ -1650,7 +1693,41 @@ export class Quill {
|
|
|
1650
1693
|
}
|
|
1651
1694
|
}
|
|
1652
1695
|
/**
|
|
1653
|
-
*
|
|
1696
|
+
* Land `doc`'s declared content fields at their canonical rest **in
|
|
1697
|
+
* place**, returning the `conform::*` diagnostics for the values that would
|
|
1698
|
+
* not commit (an empty array when everything rested).
|
|
1699
|
+
*
|
|
1700
|
+
* The read-repair verb: a document that arrived through the transport door
|
|
1701
|
+
* (`fromMarkdown`, `fromJson`, a stored row) converges here, and is then
|
|
1702
|
+
* eligible for rewrite under its current schema tag. Idempotent, and a
|
|
1703
|
+
* no-op on an already-canonical document: an equal value is not rewritten,
|
|
1704
|
+
* so YAML comments and stored bytes survive.
|
|
1705
|
+
*
|
|
1706
|
+
* A `!must_fill` marker anywhere in a field's value skips that field (the
|
|
1707
|
+
* marker is the state), and a value the strict write refuses stays as
|
|
1708
|
+
* authored with a diagnostic. Throws when `doc` declares a different
|
|
1709
|
+
* `$quill`, before any mutation.
|
|
1710
|
+
* @param {Document} doc
|
|
1711
|
+
* @returns {Diagnostic[]}
|
|
1712
|
+
*/
|
|
1713
|
+
conform(doc) {
|
|
1714
|
+
try {
|
|
1715
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1716
|
+
_assertClass(doc, Document);
|
|
1717
|
+
wasm.quill_conform(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
1718
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1719
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1720
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1721
|
+
if (r2) {
|
|
1722
|
+
throw takeObject(r1);
|
|
1723
|
+
}
|
|
1724
|
+
return takeObject(r0);
|
|
1725
|
+
} finally {
|
|
1726
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Build a quill from a file tree. Pure: no backend, no engine; the
|
|
1654
1731
|
* declared backend is resolved later, at render time.
|
|
1655
1732
|
*
|
|
1656
1733
|
* Accepts either a `Map<string, Uint8Array>` or a plain object
|
|
@@ -1677,7 +1754,7 @@ export class Quill {
|
|
|
1677
1754
|
}
|
|
1678
1755
|
/**
|
|
1679
1756
|
* Identity snapshot of the `quill:` section of `Quill.yaml` plus any extra
|
|
1680
|
-
* `quill:` keys. Pure config
|
|
1757
|
+
* `quill:` keys. Pure config: the backend's output formats are a
|
|
1681
1758
|
* resolved-backend capability read from the engine
|
|
1682
1759
|
* (`Quillmark.supportedFormats`), not part of this snapshot.
|
|
1683
1760
|
* @returns {QuillMetadata}
|
|
@@ -1698,11 +1775,44 @@ export class Quill {
|
|
|
1698
1775
|
}
|
|
1699
1776
|
}
|
|
1700
1777
|
/**
|
|
1701
|
-
*
|
|
1778
|
+
* Parse `markdown` and conform it against this quill: the **primary
|
|
1779
|
+
* ingestion path**, and the bound twin of the schema-free
|
|
1780
|
+
* `Document.fromMarkdown`. The returned document rests at its canonical
|
|
1781
|
+
* form (a `richtext` field as a content object, a `plaintext` field as its
|
|
1782
|
+
* literal string), so `getStored` no longer answers "corpus or string?"
|
|
1783
|
+
* with "depends how this document was built".
|
|
1784
|
+
*
|
|
1785
|
+
* Parse warnings and the `conform::*` diagnostics both land on
|
|
1786
|
+
* `doc.warnings`. Throws on a parse failure, or when `markdown` declares a
|
|
1787
|
+
* `$quill` this quill does not answer to: nothing conforms under the wrong
|
|
1788
|
+
* schema. To open a document whose `$quill` is stale, use the transport
|
|
1789
|
+
* door (`Document.fromMarkdown`, `setQuillRef`, then `quill.conform`).
|
|
1790
|
+
* @param {string} markdown
|
|
1791
|
+
* @returns {Document}
|
|
1792
|
+
*/
|
|
1793
|
+
parse(markdown) {
|
|
1794
|
+
try {
|
|
1795
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1796
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1797
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1798
|
+
wasm.quill_parse(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1799
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1800
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1801
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1802
|
+
if (r2) {
|
|
1803
|
+
throw takeObject(r1);
|
|
1804
|
+
}
|
|
1805
|
+
return Document.__wrap(r0);
|
|
1806
|
+
} finally {
|
|
1807
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* The resolved-value view of `doc` against this quill's schema: for every
|
|
1702
1812
|
* declared field the value the render projection would use and the
|
|
1703
1813
|
* `FieldSource` rung it came from (`"authored" | "default" | "zero"`), in
|
|
1704
1814
|
* one call. The card body is a `body` sibling on its card (row `name`
|
|
1705
|
-
* `"body"`), never a row in `fields
|
|
1815
|
+
* `"body"`), never a row in `fields`: `null` when the kind enables no body.
|
|
1706
1816
|
*
|
|
1707
1817
|
* Value and provenance only: completeness and errors stay `validate`'s
|
|
1708
1818
|
* (a consumer merges it with its own diagnostic producers regardless), and
|
|
@@ -1729,8 +1839,8 @@ export class Quill {
|
|
|
1729
1839
|
/**
|
|
1730
1840
|
* Document schema for the quill: the user-fillable fields plus their
|
|
1731
1841
|
* `ui` hints (title / group / compact / multiline). The single
|
|
1732
|
-
* field-metadata surface
|
|
1733
|
-
* alike. Key order in `fields`/`properties` is declaration order
|
|
1842
|
+
* field-metadata surface: drives form editors and LLM/MCP consumers
|
|
1843
|
+
* alike. Key order in `fields`/`properties` is declaration order: the
|
|
1734
1844
|
* ordering contract. Returns the `QuillSchema` shape.
|
|
1735
1845
|
* @returns {QuillSchema}
|
|
1736
1846
|
*/
|
|
@@ -1759,7 +1869,7 @@ export class Quill {
|
|
|
1759
1869
|
* Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
|
|
1760
1870
|
* template-derived document inherits its curated starting values; omit it
|
|
1761
1871
|
* (or pass `undefined` / `null`) for the bare schema seed. `overlay` is a
|
|
1762
|
-
* plain object
|
|
1872
|
+
* plain object: this reads the document, it does not mutate it.
|
|
1763
1873
|
* @param {string} card_kind
|
|
1764
1874
|
* @param {Record<string, unknown> | undefined} overlay
|
|
1765
1875
|
* @returns {Card | undefined}
|
|
@@ -1782,7 +1892,7 @@ export class Quill {
|
|
|
1782
1892
|
}
|
|
1783
1893
|
}
|
|
1784
1894
|
/**
|
|
1785
|
-
* Seed a starter `Document` from the schema
|
|
1895
|
+
* Seed a starter `Document` from the schema, the main card plus one
|
|
1786
1896
|
* instance of each composable card kind, each committing its fields'
|
|
1787
1897
|
* `example:` values and leaving every other field absent (interpolated at
|
|
1788
1898
|
* render: `default:`, else type-empty zero). Illustration-first: a field
|
|
@@ -1795,7 +1905,7 @@ export class Quill {
|
|
|
1795
1905
|
return Document.__wrap(ret);
|
|
1796
1906
|
}
|
|
1797
1907
|
/**
|
|
1798
|
-
* Seed a starter main `Card` (carries `$quill`) from the schema
|
|
1908
|
+
* Seed a starter main `Card` (carries `$quill`) from the schema: the
|
|
1799
1909
|
* `$kind: main` card of [`seedDocument`](Self::seed_document) in
|
|
1800
1910
|
* isolation, committing each field's `example:` value. Returns the same
|
|
1801
1911
|
* `Card` shape as the `Document.main` getter.
|
|
@@ -1817,7 +1927,7 @@ export class Quill {
|
|
|
1817
1927
|
}
|
|
1818
1928
|
}
|
|
1819
1929
|
/**
|
|
1820
|
-
* Flatten this quill back into its canonical file tree
|
|
1930
|
+
* Flatten this quill back into its canonical file tree: the inverse of
|
|
1821
1931
|
* [`fromTree`](Self::from_tree). Round-trips: `Quill.fromTree(q.toTree())`
|
|
1822
1932
|
* reproduces an equivalent quill.
|
|
1823
1933
|
*
|
|
@@ -1837,8 +1947,8 @@ export class Quill {
|
|
|
1837
1947
|
* Validate `doc` against this quill's schema, returning every diagnostic
|
|
1838
1948
|
* (an empty array when the document is valid).
|
|
1839
1949
|
*
|
|
1840
|
-
* Forwards the canonical `validation::*` diagnostics
|
|
1841
|
-
* `path`, and `hint` the engine emits
|
|
1950
|
+
* Forwards the canonical `validation::*` diagnostics (same `code`,
|
|
1951
|
+
* `path`, and `hint` the engine emits) including the non-fatal
|
|
1842
1952
|
* `validation::must_fill` warning for each `!must_fill` marker left in
|
|
1843
1953
|
* the document. Field values, defaults, and order are not part of this
|
|
1844
1954
|
* surface: read them from the `Document` payload and `Quill.schema`
|
|
@@ -1866,7 +1976,7 @@ export class Quill {
|
|
|
1866
1976
|
if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
|
|
1867
1977
|
|
|
1868
1978
|
/**
|
|
1869
|
-
* Render engine: a backend registry and render dispatcher. Render build only
|
|
1979
|
+
* Render engine: a backend registry and render dispatcher. Render build only:
|
|
1870
1980
|
* the core build constructs and validates quills without it.
|
|
1871
1981
|
*/
|
|
1872
1982
|
export class Quillmark {
|
|
@@ -1936,7 +2046,7 @@ export class Quillmark {
|
|
|
1936
2046
|
}
|
|
1937
2047
|
}
|
|
1938
2048
|
/**
|
|
1939
|
-
* The output formats `quill`'s backend can emit. Static capability
|
|
2049
|
+
* The output formats `quill`'s backend can emit. Static capability:
|
|
1940
2050
|
* resolves the backend but compiles nothing. Throws `engine::backend_not_found`
|
|
1941
2051
|
* if no registered backend matches the quill's declared backend.
|
|
1942
2052
|
* @param {Quill} quill
|
|
@@ -1976,7 +2086,7 @@ export class Quillmark {
|
|
|
1976
2086
|
if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
|
|
1977
2087
|
|
|
1978
2088
|
/**
|
|
1979
|
-
* Export a canonical `Content` content to its markdown projection
|
|
2089
|
+
* Export a canonical `Content` content to its markdown projection: the pure
|
|
1980
2090
|
* on-demand codec behind `exportMarkdown(card.body)`. Throws if `rt` is not a
|
|
1981
2091
|
* canonical content.
|
|
1982
2092
|
* @param {Content} rt
|
|
@@ -2009,7 +2119,7 @@ export function exportMarkdown(rt) {
|
|
|
2009
2119
|
|
|
2010
2120
|
/**
|
|
2011
2121
|
* Serialize structured [`DocPathSeg`] segments back to the canonical path
|
|
2012
|
-
* string
|
|
2122
|
+
* string: the inverse of `parseDocPath`, for a consumer that builds a path
|
|
2013
2123
|
* rather than reads one. Throws on a segment array the deserializer rejects,
|
|
2014
2124
|
* and on an empty segment array (symmetric with `parseDocPath("")`, which
|
|
2015
2125
|
* throws "empty path").
|
|
@@ -2042,7 +2152,7 @@ export function formatDocPath(segs) {
|
|
|
2042
2152
|
}
|
|
2043
2153
|
|
|
2044
2154
|
/**
|
|
2045
|
-
* Import a markdown string to a canonical `Content` content
|
|
2155
|
+
* Import a markdown string to a canonical `Content` content: the pure,
|
|
2046
2156
|
* document-free codec. Pair with `install(addr, importMarkdown(md))` to spell
|
|
2047
2157
|
* the cold (anchor-losing) write at the call site; prefer `revise` for edit
|
|
2048
2158
|
* semantics. Throws on an over-nested input.
|
|
@@ -2075,8 +2185,8 @@ export function init() {
|
|
|
2075
2185
|
}
|
|
2076
2186
|
|
|
2077
2187
|
/**
|
|
2078
|
-
* Map a base content position
|
|
2079
|
-
* offset
|
|
2188
|
+
* Map a base content position (a USV index into `Content.text`, not a UTF-16
|
|
2189
|
+
* offset) through a `delta` to its new USV position: the pure position-mapping
|
|
2080
2190
|
* codec an editor bridge composes to hold a caret stable across a `revise`.
|
|
2081
2191
|
* `assoc` decides the side of a same-position insertion (`"after"` moves past
|
|
2082
2192
|
* it). Throws on a malformed `delta`.
|
|
@@ -2104,7 +2214,7 @@ export function mapPos(delta, pos, assoc) {
|
|
|
2104
2214
|
/**
|
|
2105
2215
|
* Parse a canonical document-model `Diagnostic.path`
|
|
2106
2216
|
* (`cards.<kind>[<i>].<field>`, `main.body`, `recipients[0].name`) into its
|
|
2107
|
-
* structured [`DocPathSeg`] segments
|
|
2217
|
+
* structured [`DocPathSeg`] segments: the exported inverse of the engine's
|
|
2108
2218
|
* one path serializer, so a consumer routes on segments instead of regexing
|
|
2109
2219
|
* the string. Throws on a malformed path.
|
|
2110
2220
|
* @param {string} path
|
|
@@ -2129,7 +2239,7 @@ export function parseDocPath(path) {
|
|
|
2129
2239
|
}
|
|
2130
2240
|
|
|
2131
2241
|
/**
|
|
2132
|
-
* Rebase `markdown` onto a `base` content
|
|
2242
|
+
* Rebase `markdown` onto a `base` content, the pure, document-free twin of
|
|
2133
2243
|
* `revise`: cold-import + `diff_import`, returning the new `content` and the
|
|
2134
2244
|
* text `delta` (its offsets USV indices into `Content.text`, surviving anchors
|
|
2135
2245
|
* rebased). Use it to compute a revise without a document in hand; `revise(addr,
|
|
@@ -2171,13 +2281,6 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
2171
2281
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2172
2282
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2173
2283
|
}
|
|
2174
|
-
export function __wbg_String_b51de6b05a10845b(arg0, arg1) {
|
|
2175
|
-
const ret = String(getObject(arg1));
|
|
2176
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2177
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2178
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2179
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2180
|
-
}
|
|
2181
2284
|
export function __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51(arg0, arg1) {
|
|
2182
2285
|
const v = getObject(arg1);
|
|
2183
2286
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
@@ -2289,9 +2392,6 @@ export function __wbg_from_0dbf29f09e7fb200(arg0) {
|
|
|
2289
2392
|
const ret = Array.from(getObject(arg0));
|
|
2290
2393
|
return addHeapObject(ret);
|
|
2291
2394
|
}
|
|
2292
|
-
export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
|
|
2293
|
-
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
2294
|
-
}, arguments); }
|
|
2295
2395
|
export function __wbg_getTime_da7c55f52b71e8c6(arg0) {
|
|
2296
2396
|
const ret = getObject(arg0).getTime();
|
|
2297
2397
|
return ret;
|
|
@@ -2324,10 +2424,6 @@ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
|
2324
2424
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
2325
2425
|
return addHeapObject(ret);
|
|
2326
2426
|
}
|
|
2327
|
-
export function __wbg_get_with_ref_key_f64427178466f623(arg0, arg1) {
|
|
2328
|
-
const ret = getObject(arg0)[getObject(arg1)];
|
|
2329
|
-
return addHeapObject(ret);
|
|
2330
|
-
}
|
|
2331
2427
|
export function __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3(arg0) {
|
|
2332
2428
|
let result;
|
|
2333
2429
|
try {
|
|
@@ -2483,9 +2579,6 @@ export function __wbg_set_3bf1de9fab0cd644(arg0, arg1, arg2) {
|
|
|
2483
2579
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
2484
2580
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
2485
2581
|
}
|
|
2486
|
-
export function __wbg_set_f071dbb3bd088e0e(arg0, arg1, arg2) {
|
|
2487
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
2488
|
-
}
|
|
2489
2582
|
export function __wbg_set_fde2cec06c23692b(arg0, arg1, arg2) {
|
|
2490
2583
|
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
2491
2584
|
return addHeapObject(ret);
|
|
@@ -2513,6 +2606,14 @@ export function __wbg_value_ee3a06f4579184fa(arg0) {
|
|
|
2513
2606
|
const ret = getObject(arg0).value;
|
|
2514
2607
|
return addHeapObject(ret);
|
|
2515
2608
|
}
|
|
2609
|
+
export function __wbg_values_1e6d547ce555ce44(arg0) {
|
|
2610
|
+
const ret = getObject(arg0).values();
|
|
2611
|
+
return addHeapObject(ret);
|
|
2612
|
+
}
|
|
2613
|
+
export function __wbg_values_301a77363cf6c773(arg0) {
|
|
2614
|
+
const ret = Object.values(getObject(arg0));
|
|
2615
|
+
return addHeapObject(ret);
|
|
2616
|
+
}
|
|
2516
2617
|
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
2517
2618
|
// Cast intrinsic for `F64 -> Externref`.
|
|
2518
2619
|
const ret = arg0;
|