@quillmark/wasm 0.61.0 → 0.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,9 +63,22 @@ Render with a pre-parsed `Document`.
63
63
  ### `quill.open(parsed)` + `session.render(opts?)`
64
64
  Open once, render all or selected pages (`opts.pages`).
65
65
 
66
+ ### Errors
67
+
68
+ Every method that can fail throws a JS `Error` with a flat shape:
69
+
70
+ ```ts
71
+ { message: string, diagnostics: Diagnostic[] }
72
+ ```
73
+
74
+ `diagnostics` is always non-empty — length 1 for most failures, length N for
75
+ backend compilation errors. Read `err.diagnostics[0]` for the primary
76
+ diagnostic; iterate the array for compilation failures.
77
+
66
78
  ## Notes
67
79
 
68
- - Parsed markdown requires top-level `QUILL` in frontmatter.
80
+ - Parsed markdown requires top-level `QUILL` in frontmatter. Empty input
81
+ surfaces a dedicated "Empty markdown input cannot be parsed" message.
69
82
  - QUILL mismatch during `quill.render(parsed)` is a warning (`quill::ref_mismatch`), not an error.
70
83
  - Output schema APIs are no longer engine-level in WASM.
71
84
 
package/bundler/wasm.d.ts CHANGED
@@ -129,9 +129,24 @@ export class Document {
129
129
  * Mutators never modify `warnings`.
130
130
  */
131
131
  removeCard(index: number): Card | undefined;
132
+ /**
133
+ * Remove a frontmatter field on the card at `index`, returning the
134
+ * removed value or `undefined` if the field was absent.
135
+ *
136
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
137
+ * not match `[a-z_][a-z0-9_]*`.
138
+ *
139
+ * Mutators never modify `warnings`.
140
+ */
141
+ removeCardField(index: number, name: string): any;
132
142
  /**
133
143
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
134
144
  *
145
+ * Throws an `Error` whose message includes the `EditError` variant name
146
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
147
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
148
+ * name returns `undefined`.
149
+ *
135
150
  * Mutators never modify `warnings`.
136
151
  */
137
152
  removeField(name: string): any;
@@ -141,6 +156,20 @@ export class Document {
141
156
  * Mutators never modify `warnings`.
142
157
  */
143
158
  replaceBody(body: string): void;
159
+ /**
160
+ * Replace the tag of the composable card at `index`.
161
+ *
162
+ * Mutates only the sentinel — the card's frontmatter and body are
163
+ * untouched. Schema-aware migration (clearing orphan fields, applying
164
+ * new defaults) is the caller's responsibility; `setCardTag` is a
165
+ * structural primitive.
166
+ *
167
+ * Throws if `index` is out of range or if `newTag` does not match
168
+ * `[a-z_][a-z0-9_]*`.
169
+ *
170
+ * Mutators never modify `warnings`.
171
+ */
172
+ setCardTag(index: number, new_tag: string): void;
144
173
  /**
145
174
  * Update a frontmatter field on the main card.
146
175
  *
@@ -189,18 +189,63 @@ export class Document {
189
189
  const ret = wasm.document_removeCard(this.__wbg_ptr, index);
190
190
  return takeObject(ret);
191
191
  }
192
+ /**
193
+ * Remove a frontmatter field on the card at `index`, returning the
194
+ * removed value or `undefined` if the field was absent.
195
+ *
196
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
197
+ * not match `[a-z_][a-z0-9_]*`.
198
+ *
199
+ * Mutators never modify `warnings`.
200
+ * @param {number} index
201
+ * @param {string} name
202
+ * @returns {any}
203
+ */
204
+ removeCardField(index, name) {
205
+ try {
206
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
207
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
208
+ const len0 = WASM_VECTOR_LEN;
209
+ wasm.document_removeCardField(retptr, this.__wbg_ptr, index, ptr0, len0);
210
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
211
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
212
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
213
+ if (r2) {
214
+ throw takeObject(r1);
215
+ }
216
+ return takeObject(r0);
217
+ } finally {
218
+ wasm.__wbindgen_add_to_stack_pointer(16);
219
+ }
220
+ }
192
221
  /**
193
222
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
194
223
  *
224
+ * Throws an `Error` whose message includes the `EditError` variant name
225
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
226
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
227
+ * name returns `undefined`.
228
+ *
195
229
  * Mutators never modify `warnings`.
196
230
  * @param {string} name
197
231
  * @returns {any}
198
232
  */
199
233
  removeField(name) {
200
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
201
- const len0 = WASM_VECTOR_LEN;
202
- const ret = wasm.document_removeField(this.__wbg_ptr, ptr0, len0);
203
- return takeObject(ret);
234
+ try {
235
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
236
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
237
+ const len0 = WASM_VECTOR_LEN;
238
+ wasm.document_removeField(retptr, this.__wbg_ptr, ptr0, len0);
239
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
240
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
241
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
242
+ if (r2) {
243
+ throw takeObject(r1);
244
+ }
245
+ return takeObject(r0);
246
+ } finally {
247
+ wasm.__wbindgen_add_to_stack_pointer(16);
248
+ }
204
249
  }
205
250
  /**
206
251
  * Replace the main card's body (the global Markdown body).
@@ -213,6 +258,36 @@ export class Document {
213
258
  const len0 = WASM_VECTOR_LEN;
214
259
  wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
215
260
  }
261
+ /**
262
+ * Replace the tag of the composable card at `index`.
263
+ *
264
+ * Mutates only the sentinel — the card's frontmatter and body are
265
+ * untouched. Schema-aware migration (clearing orphan fields, applying
266
+ * new defaults) is the caller's responsibility; `setCardTag` is a
267
+ * structural primitive.
268
+ *
269
+ * Throws if `index` is out of range or if `newTag` does not match
270
+ * `[a-z_][a-z0-9_]*`.
271
+ *
272
+ * Mutators never modify `warnings`.
273
+ * @param {number} index
274
+ * @param {string} new_tag
275
+ */
276
+ setCardTag(index, new_tag) {
277
+ try {
278
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
279
+ const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
280
+ const len0 = WASM_VECTOR_LEN;
281
+ wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
282
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
283
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
284
+ if (r1) {
285
+ throw takeObject(r0);
286
+ }
287
+ } finally {
288
+ wasm.__wbindgen_add_to_stack_pointer(16);
289
+ }
290
+ }
216
291
  /**
217
292
  * Update a frontmatter field on the main card.
218
293
  *
@@ -936,11 +1011,16 @@ export function __wbindgen_cast_0000000000000002(arg0) {
936
1011
  return addHeapObject(ret);
937
1012
  }
938
1013
  export function __wbindgen_cast_0000000000000003(arg0, arg1) {
1014
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1015
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1016
+ return addHeapObject(ret);
1017
+ }
1018
+ export function __wbindgen_cast_0000000000000004(arg0, arg1) {
939
1019
  // Cast intrinsic for `Ref(String) -> Externref`.
940
1020
  const ret = getStringFromWasm0(arg0, arg1);
941
1021
  return addHeapObject(ret);
942
1022
  }
943
- export function __wbindgen_cast_0000000000000004(arg0) {
1023
+ export function __wbindgen_cast_0000000000000005(arg0) {
944
1024
  // Cast intrinsic for `U64 -> Externref`.
945
1025
  const ret = BigInt.asUintN(64, arg0);
946
1026
  return addHeapObject(ret);
Binary file
@@ -14,8 +14,10 @@ export const document_moveCard: (a: number, b: number, c: number, d: number) =>
14
14
  export const document_pushCard: (a: number, b: number, c: number) => void;
15
15
  export const document_quillRef: (a: number, b: number) => void;
16
16
  export const document_removeCard: (a: number, b: number) => number;
17
- export const document_removeField: (a: number, b: number, c: number) => number;
17
+ export const document_removeCardField: (a: number, b: number, c: number, d: number, e: number) => void;
18
+ export const document_removeField: (a: number, b: number, c: number, d: number) => void;
18
19
  export const document_replaceBody: (a: number, b: number, c: number) => void;
20
+ export const document_setCardTag: (a: number, b: number, c: number, d: number, e: number) => void;
19
21
  export const document_setField: (a: number, b: number, c: number, d: number, e: number) => void;
20
22
  export const document_setFill: (a: number, b: number, c: number, d: number, e: number) => void;
21
23
  export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
@@ -129,9 +129,24 @@ export class Document {
129
129
  * Mutators never modify `warnings`.
130
130
  */
131
131
  removeCard(index: number): Card | undefined;
132
+ /**
133
+ * Remove a frontmatter field on the card at `index`, returning the
134
+ * removed value or `undefined` if the field was absent.
135
+ *
136
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
137
+ * not match `[a-z_][a-z0-9_]*`.
138
+ *
139
+ * Mutators never modify `warnings`.
140
+ */
141
+ removeCardField(index: number, name: string): any;
132
142
  /**
133
143
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
134
144
  *
145
+ * Throws an `Error` whose message includes the `EditError` variant name
146
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
147
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
148
+ * name returns `undefined`.
149
+ *
135
150
  * Mutators never modify `warnings`.
136
151
  */
137
152
  removeField(name: string): any;
@@ -141,6 +156,20 @@ export class Document {
141
156
  * Mutators never modify `warnings`.
142
157
  */
143
158
  replaceBody(body: string): void;
159
+ /**
160
+ * Replace the tag of the composable card at `index`.
161
+ *
162
+ * Mutates only the sentinel — the card's frontmatter and body are
163
+ * untouched. Schema-aware migration (clearing orphan fields, applying
164
+ * new defaults) is the caller's responsibility; `setCardTag` is a
165
+ * structural primitive.
166
+ *
167
+ * Throws if `index` is out of range or if `newTag` does not match
168
+ * `[a-z_][a-z0-9_]*`.
169
+ *
170
+ * Mutators never modify `warnings`.
171
+ */
172
+ setCardTag(index: number, new_tag: string): void;
144
173
  /**
145
174
  * Update a frontmatter field on the main card.
146
175
  *
package/node-esm/wasm.js CHANGED
@@ -193,18 +193,63 @@ export class Document {
193
193
  const ret = wasm.document_removeCard(this.__wbg_ptr, index);
194
194
  return takeObject(ret);
195
195
  }
196
+ /**
197
+ * Remove a frontmatter field on the card at `index`, returning the
198
+ * removed value or `undefined` if the field was absent.
199
+ *
200
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
201
+ * not match `[a-z_][a-z0-9_]*`.
202
+ *
203
+ * Mutators never modify `warnings`.
204
+ * @param {number} index
205
+ * @param {string} name
206
+ * @returns {any}
207
+ */
208
+ removeCardField(index, name) {
209
+ try {
210
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
211
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
212
+ const len0 = WASM_VECTOR_LEN;
213
+ wasm.document_removeCardField(retptr, this.__wbg_ptr, index, ptr0, len0);
214
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
215
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
216
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
217
+ if (r2) {
218
+ throw takeObject(r1);
219
+ }
220
+ return takeObject(r0);
221
+ } finally {
222
+ wasm.__wbindgen_add_to_stack_pointer(16);
223
+ }
224
+ }
196
225
  /**
197
226
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
198
227
  *
228
+ * Throws an `Error` whose message includes the `EditError` variant name
229
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
230
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
231
+ * name returns `undefined`.
232
+ *
199
233
  * Mutators never modify `warnings`.
200
234
  * @param {string} name
201
235
  * @returns {any}
202
236
  */
203
237
  removeField(name) {
204
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
205
- const len0 = WASM_VECTOR_LEN;
206
- const ret = wasm.document_removeField(this.__wbg_ptr, ptr0, len0);
207
- return takeObject(ret);
238
+ try {
239
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
240
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
241
+ const len0 = WASM_VECTOR_LEN;
242
+ wasm.document_removeField(retptr, this.__wbg_ptr, ptr0, len0);
243
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
244
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
245
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
246
+ if (r2) {
247
+ throw takeObject(r1);
248
+ }
249
+ return takeObject(r0);
250
+ } finally {
251
+ wasm.__wbindgen_add_to_stack_pointer(16);
252
+ }
208
253
  }
209
254
  /**
210
255
  * Replace the main card's body (the global Markdown body).
@@ -217,6 +262,36 @@ export class Document {
217
262
  const len0 = WASM_VECTOR_LEN;
218
263
  wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
219
264
  }
265
+ /**
266
+ * Replace the tag of the composable card at `index`.
267
+ *
268
+ * Mutates only the sentinel — the card's frontmatter and body are
269
+ * untouched. Schema-aware migration (clearing orphan fields, applying
270
+ * new defaults) is the caller's responsibility; `setCardTag` is a
271
+ * structural primitive.
272
+ *
273
+ * Throws if `index` is out of range or if `newTag` does not match
274
+ * `[a-z_][a-z0-9_]*`.
275
+ *
276
+ * Mutators never modify `warnings`.
277
+ * @param {number} index
278
+ * @param {string} new_tag
279
+ */
280
+ setCardTag(index, new_tag) {
281
+ try {
282
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
283
+ const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
284
+ const len0 = WASM_VECTOR_LEN;
285
+ wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
286
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
287
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
288
+ if (r1) {
289
+ throw takeObject(r0);
290
+ }
291
+ } finally {
292
+ wasm.__wbindgen_add_to_stack_pointer(16);
293
+ }
294
+ }
220
295
  /**
221
296
  * Update a frontmatter field on the main card.
222
297
  *
@@ -943,11 +1018,16 @@ function __wbg_get_imports() {
943
1018
  return addHeapObject(ret);
944
1019
  },
945
1020
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1021
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1022
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1023
+ return addHeapObject(ret);
1024
+ },
1025
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
946
1026
  // Cast intrinsic for `Ref(String) -> Externref`.
947
1027
  const ret = getStringFromWasm0(arg0, arg1);
948
1028
  return addHeapObject(ret);
949
1029
  },
950
- __wbindgen_cast_0000000000000004: function(arg0) {
1030
+ __wbindgen_cast_0000000000000005: function(arg0) {
951
1031
  // Cast intrinsic for `U64 -> Externref`.
952
1032
  const ret = BigInt.asUintN(64, arg0);
953
1033
  return addHeapObject(ret);
Binary file
@@ -14,8 +14,10 @@ export const document_moveCard: (a: number, b: number, c: number, d: number) =>
14
14
  export const document_pushCard: (a: number, b: number, c: number) => void;
15
15
  export const document_quillRef: (a: number, b: number) => void;
16
16
  export const document_removeCard: (a: number, b: number) => number;
17
- export const document_removeField: (a: number, b: number, c: number) => number;
17
+ export const document_removeCardField: (a: number, b: number, c: number, d: number, e: number) => void;
18
+ export const document_removeField: (a: number, b: number, c: number, d: number) => void;
18
19
  export const document_replaceBody: (a: number, b: number, c: number) => void;
20
+ export const document_setCardTag: (a: number, b: number, c: number, d: number, e: number) => void;
19
21
  export const document_setField: (a: number, b: number, c: number, d: number, e: number) => void;
20
22
  export const document_setFill: (a: number, b: number, c: number, d: number, e: number) => void;
21
23
  export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.61.0",
3
+ "version": "0.63.0",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",