@quillmark/wasm 0.94.0 → 0.95.1
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 +77 -316
- package/README.md +58 -42
- package/backends/pdfform/wasm.d.ts +213 -246
- package/backends/pdfform/wasm_bg.js +436 -452
- package/backends/pdfform/wasm_bg.wasm +0 -0
- package/backends/pdfform/wasm_bg.wasm.d.ts +22 -25
- package/backends/typst/wasm.d.ts +213 -246
- package/backends/typst/wasm_bg.js +436 -452
- package/backends/typst/wasm_bg.wasm +0 -0
- package/backends/typst/wasm_bg.wasm.d.ts +22 -25
- package/core/wasm.d.ts +206 -239
- package/core/wasm_bg.js +430 -446
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +22 -25
- package/package.json +1 -1
- package/runtime/runtime.d.ts +154 -22
- package/runtime/runtime.js +210 -29
package/core/wasm_bg.js
CHANGED
|
@@ -21,20 +21,24 @@ 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
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `
|
|
31
|
-
*
|
|
24
|
+
* body from optional markdown, and place it — the ABI under `writer.addCard`.
|
|
25
|
+
* `at` picks the position: absent appends, a number inserts at that index
|
|
26
|
+
* (`0..=cards.length`), so a positioned typed insert is one atomic call
|
|
27
|
+
* rather than `addCard` + `moveCard`. Fuses `makeCard` + typed commit +
|
|
28
|
+
* insertion transactionally: the card is committed in full before it joins
|
|
29
|
+
* the document, so a rejected field (or an invalid kind, body, or
|
|
30
|
+
* out-of-range `at`) leaves the document untouched. Field errors throw the
|
|
31
|
+
* same per-field diagnostic bundle as [`commitFields`](Self::commit_fields),
|
|
32
|
+
* including an `[EditError::UnknownField]` per undeclared name; an invalid
|
|
33
|
+
* kind or body, or an out-of-range position, throws a single-entry bundle
|
|
34
|
+
* keyed `$kind` / `$body`.
|
|
32
35
|
* @param {Quill} quill
|
|
33
36
|
* @param {string} kind
|
|
34
37
|
* @param {Record<string, unknown>} [fields]
|
|
35
38
|
* @param {string} [body]
|
|
39
|
+
* @param {number} [at]
|
|
36
40
|
*/
|
|
37
|
-
|
|
41
|
+
_addCard(quill, kind, fields, body, at) {
|
|
38
42
|
try {
|
|
39
43
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
40
44
|
_assertClass(quill, Quill);
|
|
@@ -42,7 +46,7 @@ export class Document {
|
|
|
42
46
|
const len0 = WASM_VECTOR_LEN;
|
|
43
47
|
var ptr1 = isLikeNone(body) ? 0 : passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
44
48
|
var len1 = WASM_VECTOR_LEN;
|
|
45
|
-
wasm.
|
|
49
|
+
wasm.document__addCard(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0, isLikeNone(fields) ? 0 : addHeapObject(fields), ptr1, len1, isLikeNone(at) ? 0x100000001 : (at) >>> 0);
|
|
46
50
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
47
51
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
48
52
|
if (r1) {
|
|
@@ -53,21 +57,39 @@ export class Document {
|
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
+
* Typed field write at `addr`, resolving the field's schema `type` from
|
|
61
|
+
* `quill` — the stable ABI under the runtime `writer.set` / `writer.card(i).set`.
|
|
62
|
+
* The one write verb for **every** field type (richtext, scalar, array,
|
|
63
|
+
* object); the schema carries the `inline` constraint, so no type token or
|
|
64
|
+
* flag is passed. A richtext-typed field stores the canonical content, so
|
|
65
|
+
* identity marks (anchors, island ids) and content-only marks (e.g.
|
|
66
|
+
* `underline`) live on it and survive compiles and the storage DTO. Values
|
|
67
|
+
* use the encoding the seam already speaks: a content object or markdown
|
|
68
|
+
* string for richtext, a scalar/array/object otherwise.
|
|
60
69
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
70
|
+
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
71
|
+
* targets a composable card (its `$kind` resolves the schema). A body
|
|
72
|
+
* address throws — a body has no field schema; write it with `writer.setBody`
|
|
73
|
+
* / `revise`. A field declared in the schema is strict-committed (a mismatch
|
|
74
|
+
* throws now, not at render); a name the schema does not declare throws
|
|
75
|
+
* `[EditError::UnknownField]` rather than falling to the opaque store — on
|
|
76
|
+
* the typed path it is a typo. Use [`storeField`](Document::store_field) for
|
|
77
|
+
* opaque storage. Also throws `[EditError::FieldConform]` /
|
|
78
|
+
* `[EditError::FieldRichtextDecode]` / `[EditError::FieldRichtextNotInline]`
|
|
79
|
+
* on a typed mismatch, `[EditError::InvalidFieldName]` on a malformed name,
|
|
80
|
+
* and `[EditError::IndexOutOfRange]` on an out-of-range card.
|
|
81
|
+
*
|
|
82
|
+
* The `quill` handle is passed per call because a `Document` carries only a
|
|
83
|
+
* `$quill` reference, not the resolved schema.
|
|
84
|
+
* @param {Quill} quill
|
|
85
|
+
* @param {Addr | string} addr
|
|
86
|
+
* @param {any} value
|
|
66
87
|
*/
|
|
67
|
-
|
|
88
|
+
_commitField(quill, addr, value) {
|
|
68
89
|
try {
|
|
69
90
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
70
|
-
|
|
91
|
+
_assertClass(quill, Quill);
|
|
92
|
+
wasm.document__commitField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
71
93
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
72
94
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
73
95
|
if (r1) {
|
|
@@ -78,46 +100,61 @@ export class Document {
|
|
|
78
100
|
}
|
|
79
101
|
}
|
|
80
102
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
103
|
+
* Batched twin of [`commitField`](Document::commit_field): typed-commit
|
|
104
|
+
* several fields on the card `addr` targets atomically, resolving each
|
|
105
|
+
* field's schema `type` from `quill`. `addr` is a **card address**
|
|
106
|
+
* (`{ card }`, absent = main; a present `field` throws). All-or-nothing with
|
|
107
|
+
* the same per-field-diagnostic error contract as
|
|
108
|
+
* [`storeFields`](Document::store_fields) — nothing is applied on error and
|
|
109
|
+
* the thrown error's `diagnostics` carry one entry per offending field,
|
|
110
|
+
* including an `[EditError::UnknownField]` for any name the schema does not
|
|
111
|
+
* declare, so a whole-form submit sees every typo in one pass. Throws on an
|
|
112
|
+
* out-of-range card.
|
|
113
|
+
* @param {Quill} quill
|
|
114
|
+
* @param {CardAddr} addr
|
|
115
|
+
* @param {Record<string, unknown>} fields
|
|
87
116
|
*/
|
|
88
|
-
|
|
89
|
-
let deferred2_0;
|
|
90
|
-
let deferred2_1;
|
|
117
|
+
_commitFields(quill, addr, fields) {
|
|
91
118
|
try {
|
|
92
119
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
wasm.document_blueprintInstruction(retptr, ptr0, len0);
|
|
120
|
+
_assertClass(quill, Quill);
|
|
121
|
+
wasm.document__commitFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
|
|
96
122
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
97
123
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
124
|
+
if (r1) {
|
|
125
|
+
throw takeObject(r0);
|
|
126
|
+
}
|
|
101
127
|
} finally {
|
|
102
128
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
103
|
-
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
104
129
|
}
|
|
105
130
|
}
|
|
106
131
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*
|
|
132
|
+
* Revise the richtext field at `addr` from markdown, typed *and*
|
|
133
|
+
* anchor-preserving — the ABI under `writer.reviseField`. Resolves the
|
|
134
|
+
* field's schema from `quill` (main card, or the addressed card's `$kind`)
|
|
135
|
+
* and defers to [`TypedWriter::revise_field`](quillmark_core::TypedWriter::revise_field):
|
|
136
|
+
* surviving anchors rebase (as [`revise`](Self::revise)), then the diffed
|
|
137
|
+
* result is schema-conformed, so a `richtext(inline)` field rejects a
|
|
138
|
+
* multi-block result with `[EditError::FieldRichtextNotInline]`. Returns the
|
|
139
|
+
* text [`Delta`].
|
|
140
|
+
*
|
|
141
|
+
* `addr` must name a field (a bare string is `{ field }`); a body address
|
|
142
|
+
* throws (a body carries no field schema — use [`revise`](Self::revise)). A
|
|
143
|
+
* name the schema does not declare throws `[EditError::UnknownField]`. Throws
|
|
144
|
+
* on an out-of-range card. Hidden from the `.d.ts`; the visible verb is
|
|
145
|
+
* `writer.reviseField` in the runtime layer.
|
|
146
|
+
* @param {Quill} quill
|
|
147
|
+
* @param {Addr | string} addr
|
|
148
|
+
* @param {string} markdown
|
|
149
|
+
* @returns {Delta}
|
|
116
150
|
*/
|
|
117
|
-
|
|
151
|
+
_reviseField(quill, addr, markdown) {
|
|
118
152
|
try {
|
|
119
153
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
120
|
-
|
|
154
|
+
_assertClass(quill, Quill);
|
|
155
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
156
|
+
const len0 = WASM_VECTOR_LEN;
|
|
157
|
+
wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
121
158
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
122
159
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
123
160
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -130,59 +167,61 @@ export class Document {
|
|
|
130
167
|
}
|
|
131
168
|
}
|
|
132
169
|
/**
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Typed field write on the composable card at `index` — the card-indexed
|
|
141
|
-
* twin of [`commitField`](Document::commit_field). Resolves the field's
|
|
142
|
-
* type from the card's `$kind` schema in `quill` and strict-commits it.
|
|
170
|
+
* Interpreted read at `addr`, resolving the field's declared `type` from
|
|
171
|
+
* `quill` — the stable ABI under the runtime `view.get` / `view.card(i).get`.
|
|
172
|
+
* The schema-plane twin of the quill-free [`get`](Self::get): a `richtext`
|
|
173
|
+
* field returns its markdown projection, every other declared type its
|
|
174
|
+
* canonical value verbatim, so a consumer holding the quill reads by field
|
|
175
|
+
* meaning rather than by wire shape.
|
|
143
176
|
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* `
|
|
147
|
-
*
|
|
177
|
+
* A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
|
|
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.
|
|
186
|
+
*
|
|
187
|
+
* The `quill` handle is passed per call because a `Document` carries only a
|
|
188
|
+
* `$quill` reference, not the resolved schema.
|
|
148
189
|
* @param {Quill} quill
|
|
149
|
-
* @param {
|
|
150
|
-
* @
|
|
151
|
-
* @param {any} value
|
|
190
|
+
* @param {Addr | string} addr
|
|
191
|
+
* @returns {unknown}
|
|
152
192
|
*/
|
|
153
|
-
|
|
193
|
+
_viewGet(quill, addr) {
|
|
154
194
|
try {
|
|
155
195
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
156
196
|
_assertClass(quill, Quill);
|
|
157
|
-
|
|
158
|
-
const len0 = WASM_VECTOR_LEN;
|
|
159
|
-
wasm.document_commitCardField(retptr, this.__wbg_ptr, quill.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
|
|
197
|
+
wasm.document__viewGet(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr));
|
|
160
198
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
161
199
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
162
|
-
|
|
163
|
-
|
|
200
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
201
|
+
if (r2) {
|
|
202
|
+
throw takeObject(r1);
|
|
164
203
|
}
|
|
204
|
+
return takeObject(r0);
|
|
165
205
|
} finally {
|
|
166
206
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
167
207
|
}
|
|
168
208
|
}
|
|
169
209
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* @param {
|
|
179
|
-
* @param {
|
|
210
|
+
* **Apply** a committed content edit `bundle` (`{ delta?, lineOps?, markOps? }`)
|
|
211
|
+
* at `addr` — the editor splice: text delta first, then line ops, then mark
|
|
212
|
+
* ops (mark ranges in final-text coordinates), each all-or-nothing. An absent
|
|
213
|
+
* `addr.field` targets the body, an absent `addr.card` the main card.
|
|
214
|
+
*
|
|
215
|
+
* Throws on an out-of-range card, a field that is not richtext, a malformed
|
|
216
|
+
* bundle, or an op that applies out of bounds (the value is unchanged on a
|
|
217
|
+
* failed apply).
|
|
218
|
+
* @param {Addr | string} addr
|
|
219
|
+
* @param {ChangeBundle} bundle
|
|
180
220
|
*/
|
|
181
|
-
|
|
221
|
+
applyChange(addr, bundle) {
|
|
182
222
|
try {
|
|
183
223
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
184
|
-
|
|
185
|
-
wasm.document_commitCardFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, index, addHeapObject(fields));
|
|
224
|
+
wasm.document_applyChange(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(bundle));
|
|
186
225
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
187
226
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
188
227
|
if (r1) {
|
|
@@ -193,71 +232,102 @@ export class Document {
|
|
|
193
232
|
}
|
|
194
233
|
}
|
|
195
234
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* Values use the encoding the seam already speaks: a corpus object
|
|
203
|
-
* or markdown string for richtext, a scalar/array/object otherwise.
|
|
204
|
-
*
|
|
205
|
-
* A field declared in the schema is strict-committed — a mismatch throws
|
|
206
|
-
* now, not at render. A name the schema does not declare throws
|
|
207
|
-
* `[EditError::UnknownField]` rather than falling to the opaque store: on
|
|
208
|
-
* the typed path it is a typo. Use [`setField`](Document::set_field) when
|
|
209
|
-
* opaque storage is the intent. Also throws `[EditError::FieldConform]` /
|
|
210
|
-
* `[EditError::FieldRichtextDecode]` / `[EditError::FieldRichtextNotInline]`
|
|
211
|
-
* on a typed mismatch and `[EditError::InvalidFieldName]` on a malformed
|
|
212
|
-
* name.
|
|
213
|
-
*
|
|
214
|
-
* The `quill` handle is passed per call because a `Document` carries only a
|
|
215
|
-
* `$quill` reference, not the resolved schema.
|
|
216
|
-
* @param {Quill} quill
|
|
217
|
-
* @param {string} name
|
|
218
|
-
* @param {any} value
|
|
235
|
+
* Authoring-ergonomics header introducing a blueprint to an LLM/MCP
|
|
236
|
+
* consumer for the given `quillName`. Re-exposes core's canonical text for
|
|
237
|
+
* JS consumers; any surface that draws from the same core source stays
|
|
238
|
+
* uniform.
|
|
239
|
+
* @param {string} quill_name
|
|
240
|
+
* @returns {string}
|
|
219
241
|
*/
|
|
220
|
-
|
|
242
|
+
static blueprintInstruction(quill_name) {
|
|
243
|
+
let deferred2_0;
|
|
244
|
+
let deferred2_1;
|
|
221
245
|
try {
|
|
222
246
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
223
|
-
|
|
224
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
247
|
+
const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
225
248
|
const len0 = WASM_VECTOR_LEN;
|
|
226
|
-
wasm.
|
|
249
|
+
wasm.document_blueprintInstruction(retptr, ptr0, len0);
|
|
227
250
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
228
251
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
229
|
-
|
|
230
|
-
|
|
252
|
+
deferred2_0 = r0;
|
|
253
|
+
deferred2_1 = r1;
|
|
254
|
+
return getStringFromWasm0(r0, r1);
|
|
255
|
+
} finally {
|
|
256
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
257
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* A single composable card by index — the whole `Card`, the card-indexed
|
|
262
|
+
* twin of the [`main`](Self::main) getter, so reading one card need not
|
|
263
|
+
* materialize every card via [`cards`](Self::cards). An out-of-range
|
|
264
|
+
* `index` throws `[EditError::IndexOutOfRange]`, matching the card write
|
|
265
|
+
* verbs.
|
|
266
|
+
* @param {number} index
|
|
267
|
+
* @returns {Card}
|
|
268
|
+
*/
|
|
269
|
+
card(index) {
|
|
270
|
+
try {
|
|
271
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
272
|
+
wasm.document_card(retptr, this.__wbg_ptr, index);
|
|
273
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
274
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
275
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
276
|
+
if (r2) {
|
|
277
|
+
throw takeObject(r1);
|
|
231
278
|
}
|
|
279
|
+
return takeObject(r0);
|
|
232
280
|
} finally {
|
|
233
281
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
234
282
|
}
|
|
235
283
|
}
|
|
236
284
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
*
|
|
285
|
+
* Number of composable cards (excludes the main card). O(1).
|
|
286
|
+
* @returns {number}
|
|
287
|
+
*/
|
|
288
|
+
get cardCount() {
|
|
289
|
+
const ret = wasm.document_cardCount(this.__wbg_ptr);
|
|
290
|
+
return ret >>> 0;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* The index of the first composable card whose `$id` equals `id`, or
|
|
294
|
+
* `undefined` when none carries it. Resolves the canonical durable address
|
|
295
|
+
* without a hand-rolled scan over [`cards`](Self::cards); `$id` is
|
|
296
|
+
* non-unique by design, so the first match wins.
|
|
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
|
+
/**
|
|
307
|
+
* @returns {Card[]}
|
|
246
308
|
*/
|
|
247
|
-
|
|
309
|
+
get cards() {
|
|
248
310
|
try {
|
|
249
311
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
250
|
-
|
|
251
|
-
wasm.document_commitFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(fields));
|
|
312
|
+
wasm.document_cards(retptr, this.__wbg_ptr);
|
|
252
313
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
253
314
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
254
|
-
|
|
255
|
-
|
|
315
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
316
|
+
if (r2) {
|
|
317
|
+
throw takeObject(r1);
|
|
256
318
|
}
|
|
319
|
+
return takeObject(r0);
|
|
257
320
|
} finally {
|
|
258
321
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
259
322
|
}
|
|
260
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* @returns {Document}
|
|
326
|
+
*/
|
|
327
|
+
clone() {
|
|
328
|
+
const ret = wasm.document_clone(this.__wbg_ptr);
|
|
329
|
+
return Document.__wrap(ret);
|
|
330
|
+
}
|
|
261
331
|
/**
|
|
262
332
|
* Schema version this build writes via [`toJson`](Document::to_json).
|
|
263
333
|
* Tracks the `Document` model version (not the running crate version):
|
|
@@ -388,20 +458,70 @@ export class Document {
|
|
|
388
458
|
}
|
|
389
459
|
}
|
|
390
460
|
/**
|
|
391
|
-
* Read
|
|
392
|
-
* object for a richtext field, a scalar/array/object otherwise), or
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
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
|
+
/**
|
|
488
|
+
* The whole `$ext` map at `addr` (a card address, absent `card` = main), or
|
|
489
|
+
* `undefined` when the card carries none. The fine-grained `$ext` read —
|
|
490
|
+
* your own state without serializing the whole card. Throws on a present
|
|
491
|
+
* `field` (a card address takes only `card`) or an out-of-range card.
|
|
492
|
+
* @param {CardAddr} [addr]
|
|
493
|
+
* @returns {Record<string, unknown> | undefined}
|
|
494
|
+
*/
|
|
495
|
+
getExt(addr) {
|
|
496
|
+
try {
|
|
497
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
498
|
+
wasm.document_getExt(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
499
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
500
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
501
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
502
|
+
if (r2) {
|
|
503
|
+
throw takeObject(r1);
|
|
504
|
+
}
|
|
505
|
+
return takeObject(r0);
|
|
506
|
+
} finally {
|
|
507
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
|
|
512
|
+
* = main), or `undefined`. The namespace-scoped `$ext` read — your own slot
|
|
513
|
+
* without a whole-card serialize, and non-destructive (unlike
|
|
514
|
+
* `removeExtNamespace`). Throws on a present `field` or an out-of-range card.
|
|
515
|
+
* @param {CardAddr} addr
|
|
516
|
+
* @param {string} ns
|
|
517
|
+
* @returns {unknown}
|
|
398
518
|
*/
|
|
399
|
-
|
|
519
|
+
getExtNamespace(addr, ns) {
|
|
400
520
|
try {
|
|
401
521
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
402
|
-
const ptr0 = passStringToWasm0(
|
|
522
|
+
const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
403
523
|
const len0 = WASM_VECTOR_LEN;
|
|
404
|
-
wasm.
|
|
524
|
+
wasm.document_getExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
405
525
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
406
526
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
407
527
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -414,43 +534,47 @@ export class Document {
|
|
|
414
534
|
}
|
|
415
535
|
}
|
|
416
536
|
/**
|
|
417
|
-
* The markdown projection
|
|
418
|
-
* body (`
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
537
|
+
* The **body** markdown projection — the main body, or a composable card's
|
|
538
|
+
* body (`{ card }`) — the on-demand, lossy export (content-only marks do not
|
|
539
|
+
* survive markdown). A body's type is a format fact, not a schema fact, so
|
|
540
|
+
* this read stays quill-free; a body is never absent.
|
|
541
|
+
*
|
|
542
|
+
* `addr` is an optional **card address** (`{ card }`, absent = main). A
|
|
543
|
+
* present `field` throws — a field's markdown is read through the
|
|
544
|
+
* schema-plane `quill.view(doc).get(field)`, which interprets by declared
|
|
545
|
+
* type (#978). An out-of-range `addr.card` throws.
|
|
546
|
+
* @param {CardAddr} [addr]
|
|
424
547
|
* @returns {string}
|
|
425
548
|
*/
|
|
426
|
-
getMarkdown(
|
|
427
|
-
let deferred2_0;
|
|
428
|
-
let deferred2_1;
|
|
549
|
+
getMarkdown(addr) {
|
|
429
550
|
try {
|
|
430
551
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
431
|
-
|
|
432
|
-
var len0 = WASM_VECTOR_LEN;
|
|
433
|
-
wasm.document_getMarkdown(retptr, this.__wbg_ptr, ptr0, len0);
|
|
552
|
+
wasm.document_getMarkdown(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
434
553
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
435
554
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
555
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
556
|
+
if (r2) {
|
|
557
|
+
throw takeObject(r1);
|
|
558
|
+
}
|
|
559
|
+
return takeObject(r0);
|
|
439
560
|
} finally {
|
|
440
561
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
441
|
-
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
442
562
|
}
|
|
443
563
|
}
|
|
444
564
|
/**
|
|
445
|
-
* Insert a card
|
|
446
|
-
*
|
|
447
|
-
*
|
|
565
|
+
* Insert a card — the single insertion verb: `at` absent appends, a number
|
|
566
|
+
* inserts at that index (must be in `0..=cards.length`). Accepts a
|
|
567
|
+
* `CardInput` — a card read back (`cards` / `removeCard` / `quill.seedCard`),
|
|
568
|
+
* a [`makeCard`](Document::make_card) result, or a bare `{ kind, body }`
|
|
569
|
+
* (every returned `Card` is a valid `CardInput`). Throws if `card.kind` is
|
|
570
|
+
* not a valid kind name, or if `at` is out of range.
|
|
448
571
|
* @param {CardInput} card
|
|
572
|
+
* @param {number} [at]
|
|
449
573
|
*/
|
|
450
|
-
insertCard(
|
|
574
|
+
insertCard(card, at) {
|
|
451
575
|
try {
|
|
452
576
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
453
|
-
wasm.document_insertCard(retptr, this.__wbg_ptr,
|
|
577
|
+
wasm.document_insertCard(retptr, this.__wbg_ptr, addHeapObject(card), isLikeNone(at) ? 0x100000001 : (at) >>> 0);
|
|
454
578
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
455
579
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
456
580
|
if (r1) {
|
|
@@ -461,8 +585,8 @@ export class Document {
|
|
|
461
585
|
}
|
|
462
586
|
}
|
|
463
587
|
/**
|
|
464
|
-
* **Install** a richtext value at `addr` — **value semantics**,
|
|
465
|
-
* Stores exactly `rt` (a canonical `
|
|
588
|
+
* **Install** a richtext value at `addr` — **value semantics**, content only.
|
|
589
|
+
* Stores exactly `rt` (a canonical `Content` content object); the identity
|
|
466
590
|
* anchors of any previous value are gone. An absent `addr.field` targets the
|
|
467
591
|
* body, an absent `addr.card` the main card. For "here's new markdown," use
|
|
468
592
|
* [`revise`](Document::revise); the cold-import path is spelled at the call
|
|
@@ -470,9 +594,9 @@ export class Document {
|
|
|
470
594
|
* source.
|
|
471
595
|
*
|
|
472
596
|
* Throws on an out-of-range card, a malformed field name, or an `rt` that is
|
|
473
|
-
* not a canonical
|
|
474
|
-
* @param {Addr} addr
|
|
475
|
-
* @param {
|
|
597
|
+
* not a canonical content object.
|
|
598
|
+
* @param {Addr | string} addr
|
|
599
|
+
* @param {Content} rt
|
|
476
600
|
*/
|
|
477
601
|
install(addr, rt) {
|
|
478
602
|
try {
|
|
@@ -487,6 +611,29 @@ export class Document {
|
|
|
487
611
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
488
612
|
}
|
|
489
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
|
|
616
|
+
* shorthand for `{ field }`. `false` for an absent field (truthful — it isn't
|
|
617
|
+
* marked) and for a body address (a body is never a fill). Only an
|
|
618
|
+
* out-of-range `addr.card` throws.
|
|
619
|
+
* @param {Addr | string} addr
|
|
620
|
+
* @returns {boolean}
|
|
621
|
+
*/
|
|
622
|
+
isFill(addr) {
|
|
623
|
+
try {
|
|
624
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
625
|
+
wasm.document_isFill(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
626
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
627
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
628
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
629
|
+
if (r2) {
|
|
630
|
+
throw takeObject(r1);
|
|
631
|
+
}
|
|
632
|
+
return r0 !== 0;
|
|
633
|
+
} finally {
|
|
634
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
490
637
|
/**
|
|
491
638
|
* Replace this document's contents **in place** from a versioned storage
|
|
492
639
|
* DTO string — the mutating twin of the static
|
|
@@ -536,10 +683,10 @@ export class Document {
|
|
|
536
683
|
}
|
|
537
684
|
/**
|
|
538
685
|
* Build a fresh `Card` from a kind and a flat field map — the ergonomic
|
|
539
|
-
* constructor for `
|
|
686
|
+
* constructor for `insertCard`. `fields` is an optional
|
|
540
687
|
* `Record<string, unknown>` (each entry becomes a card field, in
|
|
541
688
|
* insertion order); `body` defaults to `""`. Kind validity is checked by
|
|
542
|
-
* `
|
|
689
|
+
* `insertCard`, not here.
|
|
543
690
|
* @param {string} kind
|
|
544
691
|
* @param {Record<string, unknown>} [fields]
|
|
545
692
|
* @param {string} [body]
|
|
@@ -610,27 +757,6 @@ export class Document {
|
|
|
610
757
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
611
758
|
}
|
|
612
759
|
}
|
|
613
|
-
/**
|
|
614
|
-
* Append a card to the end of the card list. Accepts a `CardInput` — a card
|
|
615
|
-
* read back (`cards` / `removeCard` / `quill.seedCard`), a
|
|
616
|
-
* [`makeCard`](Document::make_card) result, or a bare `{ kind, body }`
|
|
617
|
-
* (every returned `Card` is a valid `CardInput`). Throws if `card.kind` is
|
|
618
|
-
* not a valid kind name.
|
|
619
|
-
* @param {CardInput} card
|
|
620
|
-
*/
|
|
621
|
-
pushCard(card) {
|
|
622
|
-
try {
|
|
623
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
624
|
-
wasm.document_pushCard(retptr, this.__wbg_ptr, addHeapObject(card));
|
|
625
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
626
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
627
|
-
if (r1) {
|
|
628
|
-
throw takeObject(r0);
|
|
629
|
-
}
|
|
630
|
-
} finally {
|
|
631
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
760
|
/**
|
|
635
761
|
* @returns {string}
|
|
636
762
|
*/
|
|
@@ -694,87 +820,17 @@ export class Document {
|
|
|
694
820
|
}
|
|
695
821
|
}
|
|
696
822
|
/**
|
|
697
|
-
* Remove the `$ext` map
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* @
|
|
702
|
-
*/
|
|
703
|
-
removeCardExt(index) {
|
|
704
|
-
try {
|
|
705
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
706
|
-
wasm.document_removeCardExt(retptr, this.__wbg_ptr, index);
|
|
707
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
708
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
709
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
710
|
-
if (r2) {
|
|
711
|
-
throw takeObject(r1);
|
|
712
|
-
}
|
|
713
|
-
return takeObject(r0);
|
|
714
|
-
} finally {
|
|
715
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Remove `namespace` from the composable card's `$ext` map, returning the
|
|
720
|
-
* value stored there or `undefined`; clears `$ext` entirely once empty.
|
|
721
|
-
* The card-indexed twin of `removeExtNamespace`. Throws if out of range.
|
|
722
|
-
* @param {number} index
|
|
723
|
-
* @param {string} namespace
|
|
724
|
-
* @returns {any}
|
|
725
|
-
*/
|
|
726
|
-
removeCardExtNamespace(index, namespace) {
|
|
727
|
-
try {
|
|
728
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
729
|
-
const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
730
|
-
const len0 = WASM_VECTOR_LEN;
|
|
731
|
-
wasm.document_removeCardExtNamespace(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
732
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
733
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
734
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
735
|
-
if (r2) {
|
|
736
|
-
throw takeObject(r1);
|
|
737
|
-
}
|
|
738
|
-
return takeObject(r0);
|
|
739
|
-
} finally {
|
|
740
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* Remove a field on the card at `index`. Returns the removed value or
|
|
745
|
-
* `undefined`. Throws if `index` is out of range or `name` is invalid.
|
|
746
|
-
* @param {number} index
|
|
747
|
-
* @param {string} name
|
|
748
|
-
* @returns {any}
|
|
749
|
-
*/
|
|
750
|
-
removeCardField(index, name) {
|
|
751
|
-
try {
|
|
752
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
753
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
754
|
-
const len0 = WASM_VECTOR_LEN;
|
|
755
|
-
wasm.document_removeCardField(retptr, this.__wbg_ptr, index, ptr0, len0);
|
|
756
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
757
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
758
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
759
|
-
if (r2) {
|
|
760
|
-
throw takeObject(r1);
|
|
761
|
-
}
|
|
762
|
-
return takeObject(r0);
|
|
763
|
-
} finally {
|
|
764
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* Remove the `$ext` map from the main card *entirely*, returning the
|
|
769
|
-
* previous map or `undefined`. This is a blunt escape hatch that discards
|
|
770
|
-
* every namespace at once — prefer `removeExtNamespace` to clear only your
|
|
771
|
-
* own slot while leaving sibling consumers' state intact.
|
|
823
|
+
* Remove the `$ext` map on the card `addr` targets *entirely*, returning the
|
|
824
|
+
* previous map or `undefined` — a blunt escape hatch that discards every
|
|
825
|
+
* namespace at once (prefer `removeExtNamespace`). `addr` is a card address
|
|
826
|
+
* (absent = main). Throws on a present `field` or an out-of-range card.
|
|
827
|
+
* @param {CardAddr} [addr]
|
|
772
828
|
* @returns {Record<string, unknown> | undefined}
|
|
773
829
|
*/
|
|
774
|
-
removeExt() {
|
|
830
|
+
removeExt(addr) {
|
|
775
831
|
try {
|
|
776
832
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
777
|
-
wasm.document_removeExt(retptr, this.__wbg_ptr);
|
|
833
|
+
wasm.document_removeExt(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
778
834
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
779
835
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
780
836
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -787,19 +843,20 @@ export class Document {
|
|
|
787
843
|
}
|
|
788
844
|
}
|
|
789
845
|
/**
|
|
790
|
-
* Remove `
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
* @param {
|
|
846
|
+
* Remove `$ext[ns]` on the card `addr` targets, returning its value or
|
|
847
|
+
* `undefined`; drops `$ext` once empty. `addr` is a card address (absent =
|
|
848
|
+
* main). Preserves sibling namespaces. Throws on a present `field` or an
|
|
849
|
+
* out-of-range card.
|
|
850
|
+
* @param {CardAddr} addr
|
|
851
|
+
* @param {string} ns
|
|
795
852
|
* @returns {any}
|
|
796
853
|
*/
|
|
797
|
-
removeExtNamespace(
|
|
854
|
+
removeExtNamespace(addr, ns) {
|
|
798
855
|
try {
|
|
799
856
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
800
|
-
const ptr0 = passStringToWasm0(
|
|
857
|
+
const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
801
858
|
const len0 = WASM_VECTOR_LEN;
|
|
802
|
-
wasm.document_removeExtNamespace(retptr, this.__wbg_ptr, ptr0, len0);
|
|
859
|
+
wasm.document_removeExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
|
|
803
860
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
804
861
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
805
862
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -812,17 +869,17 @@ export class Document {
|
|
|
812
869
|
}
|
|
813
870
|
}
|
|
814
871
|
/**
|
|
815
|
-
* Remove a
|
|
816
|
-
*
|
|
817
|
-
*
|
|
872
|
+
* Remove a field at `addr`, returning the removed value or `undefined`. A
|
|
873
|
+
* bare string is `Addr` shorthand for `{ field }`. One `remove` verb serves
|
|
874
|
+
* every write lane. A body address throws; throws on an out-of-range card or
|
|
875
|
+
* a malformed name.
|
|
876
|
+
* @param {Addr | string} addr
|
|
818
877
|
* @returns {any}
|
|
819
878
|
*/
|
|
820
|
-
removeField(
|
|
879
|
+
removeField(addr) {
|
|
821
880
|
try {
|
|
822
881
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
823
|
-
|
|
824
|
-
const len0 = WASM_VECTOR_LEN;
|
|
825
|
-
wasm.document_removeField(retptr, this.__wbg_ptr, ptr0, len0);
|
|
882
|
+
wasm.document_removeField(retptr, this.__wbg_ptr, addHeapObject(addr));
|
|
826
883
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
827
884
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
828
885
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -836,8 +893,8 @@ export class Document {
|
|
|
836
893
|
}
|
|
837
894
|
/**
|
|
838
895
|
* Remove `cardKind` from the main card's `$seed` map, returning its
|
|
839
|
-
* overlay or `undefined`; drops `$seed` entirely once empty. Sibling
|
|
840
|
-
*
|
|
896
|
+
* overlay or `undefined`; drops `$seed` entirely once empty. Sibling kinds
|
|
897
|
+
* survive. `$seed` is main-only, so this takes no address.
|
|
841
898
|
* @param {string} card_kind
|
|
842
899
|
* @returns {any}
|
|
843
900
|
*/
|
|
@@ -858,28 +915,6 @@ export class Document {
|
|
|
858
915
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
859
916
|
}
|
|
860
917
|
}
|
|
861
|
-
/**
|
|
862
|
-
* **Deprecated** — alias for `revise({}, markdown)`, kept one release cycle.
|
|
863
|
-
* Revise the main card's body from a markdown string (edit semantics: a
|
|
864
|
-
* `diff_import` that rebases surviving anchors). Discards the text delta;
|
|
865
|
-
* call [`revise`](Document::revise) to receive it.
|
|
866
|
-
* @param {string} body
|
|
867
|
-
*/
|
|
868
|
-
replaceBody(body) {
|
|
869
|
-
try {
|
|
870
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
871
|
-
const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
872
|
-
const len0 = WASM_VECTOR_LEN;
|
|
873
|
-
wasm.document_replaceBody(retptr, this.__wbg_ptr, ptr0, len0);
|
|
874
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
875
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
876
|
-
if (r1) {
|
|
877
|
-
throw takeObject(r0);
|
|
878
|
-
}
|
|
879
|
-
} finally {
|
|
880
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
918
|
/**
|
|
884
919
|
* **Revise** the richtext value at `addr` from a markdown string — **edit
|
|
885
920
|
* semantics**, the default write path, returning the text [`Delta`]. Imports
|
|
@@ -889,8 +924,8 @@ export class Document {
|
|
|
889
924
|
* absent `addr.card` the main card; an absent field cold-imports from empty.
|
|
890
925
|
*
|
|
891
926
|
* Throws on an out-of-range card, a malformed field name, a present
|
|
892
|
-
* non-
|
|
893
|
-
* @param {Addr} addr
|
|
927
|
+
* non-content field value, or an over-nested markdown input.
|
|
928
|
+
* @param {Addr | string} addr
|
|
894
929
|
* @param {string} markdown
|
|
895
930
|
* @returns {Delta}
|
|
896
931
|
*/
|
|
@@ -938,88 +973,27 @@ export class Document {
|
|
|
938
973
|
}
|
|
939
974
|
}
|
|
940
975
|
/**
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
*
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
try {
|
|
949
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
950
|
-
wasm.document_setCardExt(retptr, this.__wbg_ptr, index, addHeapObject(value));
|
|
951
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
952
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
953
|
-
if (r1) {
|
|
954
|
-
throw takeObject(r0);
|
|
955
|
-
}
|
|
956
|
-
} finally {
|
|
957
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Merge `value` into the composable card's `$ext` map under `namespace`,
|
|
962
|
-
* preserving sibling namespaces. The card-indexed twin of `setExtNamespace`.
|
|
963
|
-
* Throws if out of range or `value` cannot be serialized.
|
|
964
|
-
* @param {number} index
|
|
965
|
-
* @param {string} namespace
|
|
966
|
-
* @param {any} value
|
|
967
|
-
*/
|
|
968
|
-
setCardExtNamespace(index, namespace, value) {
|
|
969
|
-
try {
|
|
970
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
971
|
-
const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
972
|
-
const len0 = WASM_VECTOR_LEN;
|
|
973
|
-
wasm.document_setCardExtNamespace(retptr, this.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
|
|
974
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
975
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
976
|
-
if (r1) {
|
|
977
|
-
throw takeObject(r0);
|
|
978
|
-
}
|
|
979
|
-
} finally {
|
|
980
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Set a field on the card at `index` — the card-indexed twin of
|
|
985
|
-
* [`setField`](Document::set_field). Stores the value opaquely.
|
|
986
|
-
* Throws if `index` is out of range, `name` is reserved or invalid.
|
|
987
|
-
* @param {number} index
|
|
988
|
-
* @param {string} name
|
|
989
|
-
* @param {any} value
|
|
976
|
+
* The main card's `$seed` overlay object for `kind` (the `$seed[kind]`
|
|
977
|
+
* entry), or `undefined` when absent. The cheap read that feeds
|
|
978
|
+
* `quill.seedCard(kind, overlay)` without serializing the whole main card
|
|
979
|
+
* via [`main`](Self::main) to fish out one key — and it keeps `seedCard`
|
|
980
|
+
* pure: the quill still never reads the document.
|
|
981
|
+
* @param {string} kind
|
|
982
|
+
* @returns {Record<string, unknown> | undefined}
|
|
990
983
|
*/
|
|
991
|
-
|
|
984
|
+
seedOverlay(kind) {
|
|
992
985
|
try {
|
|
993
986
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
994
|
-
const ptr0 = passStringToWasm0(
|
|
987
|
+
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
995
988
|
const len0 = WASM_VECTOR_LEN;
|
|
996
|
-
wasm.
|
|
997
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
998
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
999
|
-
if (r1) {
|
|
1000
|
-
throw takeObject(r0);
|
|
1001
|
-
}
|
|
1002
|
-
} finally {
|
|
1003
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Batched twin of [`setCardField`](Document::set_card_field): set
|
|
1008
|
-
* several fields on the card at `index` atomically. Same all-or-nothing,
|
|
1009
|
-
* one-diagnostic-per-field contract as [`setFields`](Document::set_fields).
|
|
1010
|
-
* Throws if `index` is out of range.
|
|
1011
|
-
* @param {number} index
|
|
1012
|
-
* @param {Record<string, unknown>} fields
|
|
1013
|
-
*/
|
|
1014
|
-
setCardFields(index, fields) {
|
|
1015
|
-
try {
|
|
1016
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1017
|
-
wasm.document_setCardFields(retptr, this.__wbg_ptr, index, addHeapObject(fields));
|
|
989
|
+
wasm.document_seedOverlay(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1018
990
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1019
991
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1020
|
-
|
|
1021
|
-
|
|
992
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
993
|
+
if (r2) {
|
|
994
|
+
throw takeObject(r1);
|
|
1022
995
|
}
|
|
996
|
+
return takeObject(r0);
|
|
1023
997
|
} finally {
|
|
1024
998
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1025
999
|
}
|
|
@@ -1047,16 +1021,15 @@ export class Document {
|
|
|
1047
1021
|
}
|
|
1048
1022
|
}
|
|
1049
1023
|
/**
|
|
1050
|
-
* Replace the
|
|
1051
|
-
*
|
|
1052
|
-
* never reaches the rendered output. Pass `{}` to record an explicit
|
|
1053
|
-
* empty `$ext`.
|
|
1054
|
-
* @param {any} value
|
|
1024
|
+
* Replace the QUILL reference string. Throws if `ref_str` is invalid.
|
|
1025
|
+
* @param {string} ref_str
|
|
1055
1026
|
*/
|
|
1056
|
-
|
|
1027
|
+
setQuillRef(ref_str) {
|
|
1057
1028
|
try {
|
|
1058
1029
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1059
|
-
|
|
1030
|
+
const ptr0 = passStringToWasm0(ref_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1031
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1032
|
+
wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1060
1033
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1061
1034
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1062
1035
|
if (r1) {
|
|
@@ -1067,19 +1040,18 @@ export class Document {
|
|
|
1067
1040
|
}
|
|
1068
1041
|
}
|
|
1069
1042
|
/**
|
|
1070
|
-
*
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
* `$ext
|
|
1074
|
-
*
|
|
1043
|
+
* Replace the opaque `$ext` map on the card `addr` targets (a card address,
|
|
1044
|
+
* absent `card` = main). `value` must be a plain object. `$ext` carries
|
|
1045
|
+
* out-of-band consumer state and never reaches the rendered output; pass
|
|
1046
|
+
* `{}` for an explicit empty `$ext`. Quill-free and verbatim — an opaque
|
|
1047
|
+
* `store` verb. Throws on a present `field` or an out-of-range card.
|
|
1048
|
+
* @param {CardAddr} addr
|
|
1075
1049
|
* @param {any} value
|
|
1076
1050
|
*/
|
|
1077
|
-
|
|
1051
|
+
storeExt(addr, value) {
|
|
1078
1052
|
try {
|
|
1079
1053
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1080
|
-
|
|
1081
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1082
|
-
wasm.document_setExtNamespace(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
|
|
1054
|
+
wasm.document_storeExt(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
1083
1055
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1084
1056
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1085
1057
|
if (r1) {
|
|
@@ -1090,18 +1062,20 @@ export class Document {
|
|
|
1090
1062
|
}
|
|
1091
1063
|
}
|
|
1092
1064
|
/**
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1065
|
+
* Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
|
|
1066
|
+
* sibling namespaces — the recommended `$ext` write. `addr` is a card
|
|
1067
|
+
* address (absent = main). Quill-free and verbatim — an opaque `store` verb.
|
|
1068
|
+
* Throws on a present `field` or an out-of-range card.
|
|
1069
|
+
* @param {CardAddr} addr
|
|
1070
|
+
* @param {string} ns
|
|
1097
1071
|
* @param {any} value
|
|
1098
1072
|
*/
|
|
1099
|
-
|
|
1073
|
+
storeExtNamespace(addr, ns, value) {
|
|
1100
1074
|
try {
|
|
1101
1075
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1102
|
-
const ptr0 = passStringToWasm0(
|
|
1076
|
+
const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1103
1077
|
const len0 = WASM_VECTOR_LEN;
|
|
1104
|
-
wasm.
|
|
1078
|
+
wasm.document_storeExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0, addHeapObject(value));
|
|
1105
1079
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1106
1080
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1107
1081
|
if (r1) {
|
|
@@ -1112,18 +1086,21 @@ export class Document {
|
|
|
1112
1086
|
}
|
|
1113
1087
|
}
|
|
1114
1088
|
/**
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1089
|
+
* Store a field verbatim at `addr` — the opaque store (**store** = verbatim,
|
|
1090
|
+
* coercion deferred to render; the typed write is
|
|
1091
|
+
* [`commitField`](Document::commit_field)). A bare string is `Addr`
|
|
1092
|
+
* shorthand for `{ field }`, so `doc.storeField("qty", 3)` reads as written;
|
|
1093
|
+
* `{ card: 2, field: "qty" }` targets a composable card. Clears any
|
|
1094
|
+
* `!must_fill` marker. A body address (no `field`) throws — a body is never
|
|
1095
|
+
* opaque; write it with `revise` / `install` / `writer.setBody`. Throws on
|
|
1096
|
+
* an out-of-range card or a malformed name.
|
|
1097
|
+
* @param {Addr | string} addr
|
|
1098
|
+
* @param {any} value
|
|
1122
1099
|
*/
|
|
1123
|
-
|
|
1100
|
+
storeField(addr, value) {
|
|
1124
1101
|
try {
|
|
1125
1102
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1126
|
-
wasm.
|
|
1103
|
+
wasm.document_storeField(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
1127
1104
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1128
1105
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1129
1106
|
if (r1) {
|
|
@@ -1134,17 +1111,21 @@ export class Document {
|
|
|
1134
1111
|
}
|
|
1135
1112
|
}
|
|
1136
1113
|
/**
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
*
|
|
1114
|
+
* Store several fields verbatim and atomically on the card `addr` targets —
|
|
1115
|
+
* the opaque store's batch. `addr` is a **card address** (`{ card }`, absent
|
|
1116
|
+
* = main); a present `field` throws. The batch verb takes the address first
|
|
1117
|
+
* and is never shape-overloaded, because `card` is a legal field name:
|
|
1118
|
+
* `storeFields({}, fields)` is the main card, `storeFields({ card: 2 },
|
|
1119
|
+
* fields)` a composable one — never ambiguous with "set field `card`".
|
|
1120
|
+
* Nothing is applied on error; the thrown error's `diagnostics` carry one
|
|
1121
|
+
* entry per offending field. Throws on an out-of-range card.
|
|
1122
|
+
* @param {CardAddr} addr
|
|
1123
|
+
* @param {Record<string, unknown>} fields
|
|
1141
1124
|
*/
|
|
1142
|
-
|
|
1125
|
+
storeFields(addr, fields) {
|
|
1143
1126
|
try {
|
|
1144
1127
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1145
|
-
|
|
1146
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1147
|
-
wasm.document_setFill(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
|
|
1128
|
+
wasm.document_storeFields(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
|
|
1148
1129
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1149
1130
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1150
1131
|
if (r1) {
|
|
@@ -1155,15 +1136,17 @@ export class Document {
|
|
|
1155
1136
|
}
|
|
1156
1137
|
}
|
|
1157
1138
|
/**
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1139
|
+
* Store a field verbatim at `addr` and mark it `!must_fill` — the opaque
|
|
1140
|
+
* store's fill variant, card-capable (a bare string or `{ field }` for main,
|
|
1141
|
+
* `{ card, field }` for a composable card). A body address throws. Same
|
|
1142
|
+
* validation as [`storeField`](Document::store_field).
|
|
1143
|
+
* @param {Addr | string} addr
|
|
1144
|
+
* @param {any} value
|
|
1160
1145
|
*/
|
|
1161
|
-
|
|
1146
|
+
storeFill(addr, value) {
|
|
1162
1147
|
try {
|
|
1163
1148
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1164
|
-
|
|
1165
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1166
|
-
wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1149
|
+
wasm.document_storeFill(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
|
|
1167
1150
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1168
1151
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1169
1152
|
if (r1) {
|
|
@@ -1174,19 +1157,20 @@ export class Document {
|
|
|
1174
1157
|
}
|
|
1175
1158
|
}
|
|
1176
1159
|
/**
|
|
1177
|
-
* Merge a card-kind's seed `overlay` into the main card's `$seed` map
|
|
1178
|
-
* under `cardKind`, preserving sibling kinds
|
|
1179
|
-
*
|
|
1180
|
-
*
|
|
1160
|
+
* Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
|
|
1161
|
+
* under `cardKind`, preserving sibling kinds — `$seed` lives on the main
|
|
1162
|
+
* card by model, so this takes no address. Sets the starting values new
|
|
1163
|
+
* cards of that kind spawn with. Quill-free and verbatim — an opaque `store`
|
|
1164
|
+
* verb. Throws if `overlay` cannot be serialized or nests too deep.
|
|
1181
1165
|
* @param {string} card_kind
|
|
1182
1166
|
* @param {any} overlay
|
|
1183
1167
|
*/
|
|
1184
|
-
|
|
1168
|
+
storeSeedNamespace(card_kind, overlay) {
|
|
1185
1169
|
try {
|
|
1186
1170
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1187
1171
|
const ptr0 = passStringToWasm0(card_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1188
1172
|
const len0 = WASM_VECTOR_LEN;
|
|
1189
|
-
wasm.
|
|
1173
|
+
wasm.document_storeSeedNamespace(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(overlay));
|
|
1190
1174
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1191
1175
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1192
1176
|
if (r1) {
|
|
@@ -1415,9 +1399,9 @@ export class Quill {
|
|
|
1415
1399
|
* layering an optional per-kind seed `overlay` over the schema-example
|
|
1416
1400
|
* base (`overlay › example › absent`). Returns `undefined` if `cardKind`
|
|
1417
1401
|
* is not declared in this quill's schema, else a `Card` that feeds
|
|
1418
|
-
* straight into `Document.
|
|
1402
|
+
* straight into `Document.insertCard`.
|
|
1419
1403
|
*
|
|
1420
|
-
* Pass `document.
|
|
1404
|
+
* Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
|
|
1421
1405
|
* template-derived document inherits its curated starting values; omit it
|
|
1422
1406
|
* (or pass `undefined` / `null`) for the bare schema seed. `overlay` is a
|
|
1423
1407
|
* plain object — this reads the document, it does not mutate it.
|
|
@@ -1527,10 +1511,10 @@ export class Quill {
|
|
|
1527
1511
|
if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
|
|
1528
1512
|
|
|
1529
1513
|
/**
|
|
1530
|
-
* Export a canonical `
|
|
1531
|
-
* codec
|
|
1532
|
-
*
|
|
1533
|
-
* @param {
|
|
1514
|
+
* Export a canonical `Content` content to its markdown projection — the pure
|
|
1515
|
+
* on-demand codec behind `exportMarkdown(card.body)`. Throws if `rt` is not a
|
|
1516
|
+
* canonical content.
|
|
1517
|
+
* @param {Content} rt
|
|
1534
1518
|
* @returns {string}
|
|
1535
1519
|
*/
|
|
1536
1520
|
export function exportMarkdown(rt) {
|
|
@@ -1559,12 +1543,12 @@ export function exportMarkdown(rt) {
|
|
|
1559
1543
|
}
|
|
1560
1544
|
|
|
1561
1545
|
/**
|
|
1562
|
-
* Import a markdown string to a canonical `
|
|
1546
|
+
* Import a markdown string to a canonical `Content` content — the pure,
|
|
1563
1547
|
* document-free codec. Pair with `install(addr, importMarkdown(md))` to spell
|
|
1564
1548
|
* the cold (anchor-losing) write at the call site; prefer `revise` for edit
|
|
1565
1549
|
* semantics. Throws on an over-nested input.
|
|
1566
1550
|
* @param {string} markdown
|
|
1567
|
-
* @returns {
|
|
1551
|
+
* @returns {Content}
|
|
1568
1552
|
*/
|
|
1569
1553
|
export function importMarkdown(markdown) {
|
|
1570
1554
|
try {
|
|
@@ -1592,7 +1576,7 @@ export function init() {
|
|
|
1592
1576
|
}
|
|
1593
1577
|
|
|
1594
1578
|
/**
|
|
1595
|
-
* Map a base
|
|
1579
|
+
* Map a base content position through a `delta` to its new position — the pure
|
|
1596
1580
|
* position-mapping codec an editor bridge composes to hold a caret stable
|
|
1597
1581
|
* across a `revise`. `assoc` decides the side of a same-position insertion
|
|
1598
1582
|
* (`"after"` moves past it). Throws on a malformed `delta`.
|
|
@@ -1618,14 +1602,14 @@ export function mapPos(delta, pos, assoc) {
|
|
|
1618
1602
|
}
|
|
1619
1603
|
|
|
1620
1604
|
/**
|
|
1621
|
-
* Rebase `markdown` onto a `base`
|
|
1622
|
-
* `revise`: cold-import + `diff_import`, returning the new `
|
|
1605
|
+
* Rebase `markdown` onto a `base` content — the pure, document-free twin of
|
|
1606
|
+
* `revise`: cold-import + `diff_import`, returning the new `content` and the
|
|
1623
1607
|
* text `delta` (surviving anchors rebased). Use it to compute a revise without
|
|
1624
1608
|
* a document in hand; `revise(addr, md)` fuses this with the store for
|
|
1625
|
-
* atomicity. Throws on an over-nested markdown input or a non-
|
|
1626
|
-
* @param {
|
|
1609
|
+
* atomicity. Throws on an over-nested markdown input or a non-content `base`.
|
|
1610
|
+
* @param {Content} base
|
|
1627
1611
|
* @param {string} markdown
|
|
1628
|
-
* @returns {{
|
|
1612
|
+
* @returns {{ content: Content; delta: Delta }}
|
|
1629
1613
|
*/
|
|
1630
1614
|
export function rebase(base, markdown) {
|
|
1631
1615
|
try {
|