@quillmark/wasm 0.95.1 → 0.97.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 +53 -43
- package/README.md +9 -7
- package/backends/pdfform/wasm.d.ts +192 -38
- package/backends/pdfform/wasm.js +1 -1
- package/backends/pdfform/wasm_bg.js +189 -94
- package/backends/pdfform/wasm_bg.wasm +0 -0
- package/backends/pdfform/wasm_bg.wasm.d.ts +5 -2
- package/backends/typst/wasm.d.ts +192 -38
- package/backends/typst/wasm.js +1 -1
- package/backends/typst/wasm_bg.js +189 -94
- package/backends/typst/wasm_bg.wasm +0 -0
- package/backends/typst/wasm_bg.wasm.d.ts +5 -2
- package/core/wasm.d.ts +184 -31
- package/core/wasm.js +1 -1
- package/core/wasm_bg.js +181 -87
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +5 -2
- package/package.json +1 -1
- package/runtime/runtime.d.ts +95 -27
- package/runtime/runtime.js +71 -24
|
@@ -29,7 +29,7 @@ export class Document {
|
|
|
29
29
|
* the document, so a rejected field (or an invalid kind, body, or
|
|
30
30
|
* out-of-range `at`) leaves the document untouched. Field errors throw the
|
|
31
31
|
* same per-field diagnostic bundle as [`commitFields`](Self::commit_fields),
|
|
32
|
-
* including an `
|
|
32
|
+
* including an `edit::unknown_field` per undeclared name; an invalid
|
|
33
33
|
* kind or body, or an out-of-range position, throws a single-entry bundle
|
|
34
34
|
* keyed `$kind` / `$body`.
|
|
35
35
|
* @param {Quill} quill
|
|
@@ -72,12 +72,12 @@ export class Document {
|
|
|
72
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
|
-
* `
|
|
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
|
-
* opaque storage. Also throws `
|
|
78
|
-
* `
|
|
79
|
-
* on a typed mismatch, `
|
|
80
|
-
* and `
|
|
77
|
+
* opaque storage. Also throws `edit::field_conform` /
|
|
78
|
+
* `edit::field_richtext_decode` / `edit::field_richtext_not_inline`
|
|
79
|
+
* on a typed mismatch, `edit::invalid_field_name` on a malformed name,
|
|
80
|
+
* and `edit::index_out_of_range` on an out-of-range card.
|
|
81
81
|
*
|
|
82
82
|
* The `quill` handle is passed per call because a `Document` carries only a
|
|
83
83
|
* `$quill` reference, not the resolved schema.
|
|
@@ -107,7 +107,7 @@ export class Document {
|
|
|
107
107
|
* the same per-field-diagnostic error contract as
|
|
108
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
|
-
* including an `
|
|
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
|
|
112
112
|
* out-of-range card.
|
|
113
113
|
* @param {Quill} quill
|
|
@@ -129,32 +129,34 @@ export class Document {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* multi-block result with `[EditError::FieldRichtextNotInline]`. Returns the
|
|
139
|
-
* text [`Delta`].
|
|
132
|
+
* Interpreted read at `addr`, resolving the field's declared `type` from
|
|
133
|
+
* `quill` — the stable ABI under the runtime `reader.get` / `reader.card(i).get`.
|
|
134
|
+
* The schema-plane twin of the quill-free [`getStored`](Self::get_stored): a `richtext`
|
|
135
|
+
* field returns its markdown projection, every other declared type its
|
|
136
|
+
* canonical value verbatim, so a consumer holding the quill reads by field
|
|
137
|
+
* meaning rather than by wire shape.
|
|
140
138
|
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
139
|
+
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
140
|
+
* targets a composable card (its `$kind` resolves the schema). Returns
|
|
141
|
+
* `undefined` for an **absent** field. An absent `addr.field` reads the body
|
|
142
|
+
* markdown — quill-free, mirroring [`getMarkdown`](Self::get_markdown), since
|
|
143
|
+
* a body's type is a format fact, not a schema fact. A name the schema does
|
|
144
|
+
* not declare throws `edit::unknown_field` (the authority `getMarkdown`
|
|
145
|
+
* lacks — there an unknown name reads back `undefined`); a `richtext` field
|
|
146
|
+
* holding a value that does not decode throws `edit::field_richtext_decode`;
|
|
147
|
+
* an out-of-range `addr.card` throws.
|
|
148
|
+
*
|
|
149
|
+
* The `quill` handle is passed per call because a `Document` carries only a
|
|
150
|
+
* `$quill` reference, not the resolved schema.
|
|
146
151
|
* @param {Quill} quill
|
|
147
152
|
* @param {Addr | string} addr
|
|
148
|
-
* @
|
|
149
|
-
* @returns {Delta}
|
|
153
|
+
* @returns {unknown}
|
|
150
154
|
*/
|
|
151
|
-
|
|
155
|
+
_readerGet(quill, addr) {
|
|
152
156
|
try {
|
|
153
157
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
154
158
|
_assertClass(quill, Quill);
|
|
155
|
-
|
|
156
|
-
const len0 = WASM_VECTOR_LEN;
|
|
157
|
-
wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
159
|
+
wasm.document__readerGet(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr));
|
|
158
160
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
159
161
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
160
162
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -167,34 +169,32 @@ export class Document {
|
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
171
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* targets a composable card (its `$kind` resolves the schema). Returns
|
|
179
|
-
* `undefined` for an **absent** field. An absent `addr.field` reads the body
|
|
180
|
-
* markdown — quill-free, mirroring [`getMarkdown`](Self::get_markdown), since
|
|
181
|
-
* a body's type is a format fact, not a schema fact. A name the schema does
|
|
182
|
-
* not declare throws `[EditError::UnknownField]` (the authority `getMarkdown`
|
|
183
|
-
* lacks — there an unknown name reads back `undefined`); a `richtext` field
|
|
184
|
-
* holding a value that does not decode throws `[EditError::FieldRichtextDecode]`;
|
|
185
|
-
* an out-of-range `addr.card` throws.
|
|
172
|
+
* Revise the richtext field at `addr` from markdown, typed *and*
|
|
173
|
+
* anchor-preserving — the ABI under `writer.reviseField`. Resolves the
|
|
174
|
+
* field's schema from `quill` (main card, or the addressed card's `$kind`)
|
|
175
|
+
* and defers to [`TypedWriter::revise_field`](quillmark_core::TypedWriter::revise_field):
|
|
176
|
+
* surviving anchors rebase (as [`revise`](Self::revise)), then the diffed
|
|
177
|
+
* result is schema-conformed, so a `richtext(inline)` field rejects a
|
|
178
|
+
* multi-block result with `edit::field_richtext_not_inline`. Returns the
|
|
179
|
+
* text `Delta`.
|
|
186
180
|
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
181
|
+
* `addr` must name a field (a bare string is `{ field }`); a body address
|
|
182
|
+
* throws (a body carries no field schema — use [`revise`](Self::revise)). A
|
|
183
|
+
* name the schema does not declare throws `edit::unknown_field`. Throws
|
|
184
|
+
* on an out-of-range card. Hidden from the `.d.ts`; the visible verb is
|
|
185
|
+
* `writer.reviseField` in the runtime layer.
|
|
189
186
|
* @param {Quill} quill
|
|
190
187
|
* @param {Addr | string} addr
|
|
191
|
-
* @
|
|
188
|
+
* @param {string} markdown
|
|
189
|
+
* @returns {Delta}
|
|
192
190
|
*/
|
|
193
|
-
|
|
191
|
+
_reviseField(quill, addr, markdown) {
|
|
194
192
|
try {
|
|
195
193
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
196
194
|
_assertClass(quill, Quill);
|
|
197
|
-
|
|
195
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
196
|
+
const len0 = WASM_VECTOR_LEN;
|
|
197
|
+
wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
198
198
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
199
199
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
200
200
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -261,7 +261,7 @@ export class Document {
|
|
|
261
261
|
* A single composable card by index — the whole `Card`, the card-indexed
|
|
262
262
|
* twin of the [`main`](Self::main) getter, so reading one card need not
|
|
263
263
|
* materialize every card via [`cards`](Self::cards). An out-of-range
|
|
264
|
-
* `index` throws `
|
|
264
|
+
* `index` throws `edit::index_out_of_range`, matching the card write
|
|
265
265
|
* verbs.
|
|
266
266
|
* @param {number} index
|
|
267
267
|
* @returns {Card}
|
|
@@ -290,10 +290,10 @@ export class Document {
|
|
|
290
290
|
return ret >>> 0;
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
|
-
* The index of the
|
|
294
|
-
* `undefined` when none carries it. Resolves the
|
|
293
|
+
* The index of the composable card whose `$id` equals `id`, or
|
|
294
|
+
* `undefined` when none carries it. Resolves the durable card handle
|
|
295
295
|
* without a hand-rolled scan over [`cards`](Self::cards); `$id` is
|
|
296
|
-
*
|
|
296
|
+
* unique per document, so at most one card matches.
|
|
297
297
|
* @param {string} id
|
|
298
298
|
* @returns {number | undefined}
|
|
299
299
|
*/
|
|
@@ -457,33 +457,6 @@ export class Document {
|
|
|
457
457
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
/**
|
|
461
|
-
* Read the value at `addr` — the raw stored payload value of a field (a
|
|
462
|
-
* content object for a richtext field, a scalar/array/object otherwise), or
|
|
463
|
-
* the **body content** when `addr.field` is absent. A bare string is `Addr`
|
|
464
|
-
* shorthand for `{ field }`. Reads are total over the field axis: an absent
|
|
465
|
-
* field is `undefined`; only an out-of-range `addr.card` throws
|
|
466
|
-
* `[EditError::IndexOutOfRange]`. Reads need no schema, so they live on
|
|
467
|
-
* `Document`, not the typed writer; for the markdown projection of a
|
|
468
|
-
* richtext value use [`getMarkdown`](Self::get_markdown).
|
|
469
|
-
* @param {Addr | string} addr
|
|
470
|
-
* @returns {unknown}
|
|
471
|
-
*/
|
|
472
|
-
get(addr) {
|
|
473
|
-
try {
|
|
474
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
475
|
-
wasm.document_get(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
476
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
477
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
478
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
479
|
-
if (r2) {
|
|
480
|
-
throw takeObject(r1);
|
|
481
|
-
}
|
|
482
|
-
return takeObject(r0);
|
|
483
|
-
} finally {
|
|
484
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
460
|
/**
|
|
488
461
|
* The whole `$ext` map at `addr` (a card address, absent `card` = main), or
|
|
489
462
|
* `undefined` when the card carries none. The fine-grained `$ext` read —
|
|
@@ -541,7 +514,7 @@ export class Document {
|
|
|
541
514
|
*
|
|
542
515
|
* `addr` is an optional **card address** (`{ card }`, absent = main). A
|
|
543
516
|
* present `field` throws — a field's markdown is read through the
|
|
544
|
-
* schema-plane `quill.
|
|
517
|
+
* schema-plane `quill.reader(doc).get(field)`, which interprets by declared
|
|
545
518
|
* type (#978). An out-of-range `addr.card` throws.
|
|
546
519
|
* @param {CardAddr} [addr]
|
|
547
520
|
* @returns {string}
|
|
@@ -561,6 +534,35 @@ export class Document {
|
|
|
561
534
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
562
535
|
}
|
|
563
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Read the **verbatim stored value** at `addr` — the raw payload value of a
|
|
539
|
+
* field (a content object for a richtext field, a scalar/array/object
|
|
540
|
+
* otherwise), or the **body content** when `addr.field` is absent. A bare
|
|
541
|
+
* string is `Addr` shorthand for `{ field }`. Reads are total over the field
|
|
542
|
+
* axis: an absent field is `undefined`; only an out-of-range `addr.card`
|
|
543
|
+
* throws `edit::index_out_of_range`. Needs no schema, so it lives on
|
|
544
|
+
* `Document` — the read echo of the verbatim `store*` write, distinct from
|
|
545
|
+
* the interpreted schema-plane [`reader.get`](Self::reader_get). For the
|
|
546
|
+
* markdown projection use [`getMarkdown`](Self::get_markdown) (body) or
|
|
547
|
+
* `reader.get` (a field's declared type).
|
|
548
|
+
* @param {Addr | string} addr
|
|
549
|
+
* @returns {unknown}
|
|
550
|
+
*/
|
|
551
|
+
getStored(addr) {
|
|
552
|
+
try {
|
|
553
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
554
|
+
wasm.document_getStored(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
555
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
556
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
557
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
558
|
+
if (r2) {
|
|
559
|
+
throw takeObject(r1);
|
|
560
|
+
}
|
|
561
|
+
return takeObject(r0);
|
|
562
|
+
} finally {
|
|
563
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
564
566
|
/**
|
|
565
567
|
* Insert a card — the single insertion verb: `at` absent appends, a number
|
|
566
568
|
* inserts at that index (must be in `0..=cards.length`). Accepts a
|
|
@@ -917,7 +919,7 @@ export class Document {
|
|
|
917
919
|
}
|
|
918
920
|
/**
|
|
919
921
|
* **Revise** the richtext value at `addr` from a markdown string — **edit
|
|
920
|
-
* semantics**, the default write path, returning the text
|
|
922
|
+
* semantics**, the default write path, returning the text `Delta`. Imports
|
|
921
923
|
* the markdown, diffs it against the current value, rebases surviving
|
|
922
924
|
* identity anchors, and returns the change an editor bridge maps its own
|
|
923
925
|
* positions through (`mapPos`). An absent `addr.field` targets the body, an
|
|
@@ -1344,8 +1346,8 @@ export class LiveSession {
|
|
|
1344
1346
|
/**
|
|
1345
1347
|
* The schema field whose content is under a point on `page` — the
|
|
1346
1348
|
* forward (click → field) direction: hit-test a click against the
|
|
1347
|
-
* compiled document and get back the field address to focus in
|
|
1348
|
-
* editor, or `undefined` off any field's ink. `x`/`y` are PDF points
|
|
1349
|
+
* compiled document and get back the `DocPath` field address to focus in
|
|
1350
|
+
* the editor, or `undefined` off any field's ink. `x`/`y` are PDF points
|
|
1349
1351
|
* with a **bottom-left** origin, the same space as `FieldRegion.rect` —
|
|
1350
1352
|
* from a canvas click, invert the overlay transform documented on
|
|
1351
1353
|
* `FieldRegion`: `x = clickPx.x / renderScale`,
|
|
@@ -1502,11 +1504,12 @@ export class LiveSession {
|
|
|
1502
1504
|
/**
|
|
1503
1505
|
* Schema-field geometry for this compiled session — each content field's
|
|
1504
1506
|
* **first placement** (one region per page it touches) plus widget and
|
|
1505
|
-
* scalar-reference-site regions, keyed on the
|
|
1506
|
-
*
|
|
1507
|
-
*
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1507
|
+
* scalar-reference-site regions, keyed on the canonical `DocPath` address
|
|
1508
|
+
* (`parseDocPath`-routable; the session resolves the backend's plate-space
|
|
1509
|
+
* per-kind ordinal to it); a field may still appear more than once (group
|
|
1510
|
+
* by `field`, see `FieldRegion`). A session-level query: no render, no byte
|
|
1511
|
+
* artifact. An interactive preview reads it to scroll to / highlight the
|
|
1512
|
+
* focused field over a `paint`-ed canvas; the click direction is `fieldAt`.
|
|
1510
1513
|
* Empty for backends that place no schema fields.
|
|
1511
1514
|
* @returns {FieldRegion[]}
|
|
1512
1515
|
*/
|
|
@@ -1686,6 +1689,35 @@ export class Quill {
|
|
|
1686
1689
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1687
1690
|
}
|
|
1688
1691
|
}
|
|
1692
|
+
/**
|
|
1693
|
+
* The resolved-value view of `doc` against this quill's schema — for every
|
|
1694
|
+
* declared field the value the render projection would use and the
|
|
1695
|
+
* `FieldSource` rung it came from (`"authored" | "default" | "zero"`), in
|
|
1696
|
+
* one call. The card body is a `body` sibling on its card (row `name`
|
|
1697
|
+
* `"body"`), never a row in `fields` — `null` when the kind enables no body.
|
|
1698
|
+
*
|
|
1699
|
+
* Value and provenance only: completeness and errors stay `validate`'s
|
|
1700
|
+
* (a consumer merges it with its own diagnostic producers regardless), and
|
|
1701
|
+
* schema guidance reads from `Quill.schema`.
|
|
1702
|
+
* @param {Document} doc
|
|
1703
|
+
* @returns {Resolved}
|
|
1704
|
+
*/
|
|
1705
|
+
resolve(doc) {
|
|
1706
|
+
try {
|
|
1707
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1708
|
+
_assertClass(doc, Document);
|
|
1709
|
+
wasm.quill_resolve(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
1710
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1711
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1712
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1713
|
+
if (r2) {
|
|
1714
|
+
throw takeObject(r1);
|
|
1715
|
+
}
|
|
1716
|
+
return takeObject(r0);
|
|
1717
|
+
} finally {
|
|
1718
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1689
1721
|
/**
|
|
1690
1722
|
* Document schema for the quill: the user-fillable fields plus their
|
|
1691
1723
|
* `ui` hints (title / group / compact / multiline). The single
|
|
@@ -1967,6 +1999,40 @@ export function exportMarkdown(rt) {
|
|
|
1967
1999
|
}
|
|
1968
2000
|
}
|
|
1969
2001
|
|
|
2002
|
+
/**
|
|
2003
|
+
* Serialize structured [`DocPathSeg`] segments back to the canonical path
|
|
2004
|
+
* string — the inverse of `parseDocPath`, for a consumer that builds a path
|
|
2005
|
+
* rather than reads one. Throws on a segment array the deserializer rejects,
|
|
2006
|
+
* and on an empty segment array (symmetric with `parseDocPath("")`, which
|
|
2007
|
+
* throws "empty path").
|
|
2008
|
+
* @param {DocPathSeg[]} segs
|
|
2009
|
+
* @returns {string}
|
|
2010
|
+
*/
|
|
2011
|
+
export function formatDocPath(segs) {
|
|
2012
|
+
let deferred2_0;
|
|
2013
|
+
let deferred2_1;
|
|
2014
|
+
try {
|
|
2015
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2016
|
+
wasm.formatDocPath(retptr, addHeapObject(segs));
|
|
2017
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2018
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2019
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2020
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
2021
|
+
var ptr1 = r0;
|
|
2022
|
+
var len1 = r1;
|
|
2023
|
+
if (r3) {
|
|
2024
|
+
ptr1 = 0; len1 = 0;
|
|
2025
|
+
throw takeObject(r2);
|
|
2026
|
+
}
|
|
2027
|
+
deferred2_0 = ptr1;
|
|
2028
|
+
deferred2_1 = len1;
|
|
2029
|
+
return getStringFromWasm0(ptr1, len1);
|
|
2030
|
+
} finally {
|
|
2031
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2032
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
|
|
1970
2036
|
/**
|
|
1971
2037
|
* Import a markdown string to a canonical `Content` content — the pure,
|
|
1972
2038
|
* document-free codec. Pair with `install(addr, importMarkdown(md))` to spell
|
|
@@ -2001,10 +2067,11 @@ export function init() {
|
|
|
2001
2067
|
}
|
|
2002
2068
|
|
|
2003
2069
|
/**
|
|
2004
|
-
* Map a base content position
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2070
|
+
* Map a base content position — a USV index into `Content.text`, not a UTF-16
|
|
2071
|
+
* offset — through a `delta` to its new USV position: the pure position-mapping
|
|
2072
|
+
* codec an editor bridge composes to hold a caret stable across a `revise`.
|
|
2073
|
+
* `assoc` decides the side of a same-position insertion (`"after"` moves past
|
|
2074
|
+
* it). Throws on a malformed `delta`.
|
|
2008
2075
|
* @param {Delta} delta
|
|
2009
2076
|
* @param {number} pos
|
|
2010
2077
|
* @param {Assoc} assoc
|
|
@@ -2026,12 +2093,40 @@ export function mapPos(delta, pos, assoc) {
|
|
|
2026
2093
|
}
|
|
2027
2094
|
}
|
|
2028
2095
|
|
|
2096
|
+
/**
|
|
2097
|
+
* Parse a canonical document-model `Diagnostic.path`
|
|
2098
|
+
* (`cards.<kind>[<i>].<field>`, `main.body`, `recipients[0].name`) into its
|
|
2099
|
+
* structured [`DocPathSeg`] segments — the exported inverse of the engine's
|
|
2100
|
+
* one path serializer, so a consumer routes on segments instead of regexing
|
|
2101
|
+
* the string. Throws on a malformed path.
|
|
2102
|
+
* @param {string} path
|
|
2103
|
+
* @returns {DocPathSeg[]}
|
|
2104
|
+
*/
|
|
2105
|
+
export function parseDocPath(path) {
|
|
2106
|
+
try {
|
|
2107
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2108
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2110
|
+
wasm.parseDocPath(retptr, ptr0, len0);
|
|
2111
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2112
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2113
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2114
|
+
if (r2) {
|
|
2115
|
+
throw takeObject(r1);
|
|
2116
|
+
}
|
|
2117
|
+
return takeObject(r0);
|
|
2118
|
+
} finally {
|
|
2119
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2029
2123
|
/**
|
|
2030
2124
|
* Rebase `markdown` onto a `base` content — the pure, document-free twin of
|
|
2031
2125
|
* `revise`: cold-import + `diff_import`, returning the new `content` and the
|
|
2032
|
-
* text `delta` (
|
|
2033
|
-
* a document in hand; `revise(addr,
|
|
2034
|
-
* atomicity. Throws on an over-nested
|
|
2126
|
+
* text `delta` (its offsets USV indices into `Content.text`, surviving anchors
|
|
2127
|
+
* rebased). Use it to compute a revise without a document in hand; `revise(addr,
|
|
2128
|
+
* md)` fuses this with the store for atomicity. Throws on an over-nested
|
|
2129
|
+
* markdown input or a non-content `base`.
|
|
2035
2130
|
* @param {Content} base
|
|
2036
2131
|
* @param {string} markdown
|
|
2037
2132
|
* @returns {{ content: Content; delta: Delta }}
|
|
Binary file
|
|
@@ -8,8 +8,8 @@ export const __wbg_quillmark_free: (a: number, b: number) => void;
|
|
|
8
8
|
export const document__addCard: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
9
9
|
export const document__commitField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
10
10
|
export const document__commitFields: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
11
|
+
export const document__readerGet: (a: number, b: number, c: number, d: number) => void;
|
|
11
12
|
export const document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
12
|
-
export const document__viewGet: (a: number, b: number, c: number, d: number) => void;
|
|
13
13
|
export const document_applyChange: (a: number, b: number, c: number, d: number) => void;
|
|
14
14
|
export const document_blueprintInstruction: (a: number, b: number, c: number) => void;
|
|
15
15
|
export const document_card: (a: number, b: number, c: number) => void;
|
|
@@ -23,10 +23,10 @@ export const document_formatDiagnostic: (a: number, b: number) => void;
|
|
|
23
23
|
export const document_formatRules: (a: number) => void;
|
|
24
24
|
export const document_fromJson: (a: number, b: number, c: number) => void;
|
|
25
25
|
export const document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
26
|
-
export const document_get: (a: number, b: number, c: number) => void;
|
|
27
26
|
export const document_getExt: (a: number, b: number, c: number) => void;
|
|
28
27
|
export const document_getExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
29
28
|
export const document_getMarkdown: (a: number, b: number, c: number) => void;
|
|
29
|
+
export const document_getStored: (a: number, b: number, c: number) => void;
|
|
30
30
|
export const document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
31
31
|
export const document_install: (a: number, b: number, c: number, d: number) => void;
|
|
32
32
|
export const document_isFill: (a: number, b: number, c: number) => void;
|
|
@@ -58,6 +58,7 @@ export const document_toMarkdown: (a: number, b: number) => void;
|
|
|
58
58
|
export const document_tryFromJson: (a: number, b: number) => number;
|
|
59
59
|
export const document_warnings: (a: number, b: number) => void;
|
|
60
60
|
export const exportMarkdown: (a: number, b: number) => void;
|
|
61
|
+
export const formatDocPath: (a: number, b: number) => void;
|
|
61
62
|
export const importMarkdown: (a: number, b: number, c: number) => void;
|
|
62
63
|
export const init: () => void;
|
|
63
64
|
export const livesession_apply: (a: number, b: number, c: number) => void;
|
|
@@ -74,10 +75,12 @@ export const livesession_render: (a: number, b: number, c: number) => void;
|
|
|
74
75
|
export const livesession_supportsCanvas: (a: number) => number;
|
|
75
76
|
export const livesession_warnings: (a: number, b: number) => void;
|
|
76
77
|
export const mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
78
|
+
export const parseDocPath: (a: number, b: number, c: number) => void;
|
|
77
79
|
export const quill_backendId: (a: number, b: number) => void;
|
|
78
80
|
export const quill_blueprint: (a: number, b: number) => void;
|
|
79
81
|
export const quill_fromTree: (a: number, b: number) => void;
|
|
80
82
|
export const quill_metadata: (a: number, b: number) => void;
|
|
83
|
+
export const quill_resolve: (a: number, b: number, c: number) => void;
|
|
81
84
|
export const quill_schema: (a: number, b: number) => void;
|
|
82
85
|
export const quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
83
86
|
export const quill_seedDocument: (a: number) => number;
|