@quillmark/wasm 0.62.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
@@ -133,7 +133,8 @@ export class Document {
133
133
  * Remove a frontmatter field on the card at `index`, returning the
134
134
  * removed value or `undefined` if the field was absent.
135
135
  *
136
- * Throws if `index` is out of range.
136
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
137
+ * not match `[a-z_][a-z0-9_]*`.
137
138
  *
138
139
  * Mutators never modify `warnings`.
139
140
  */
@@ -141,6 +142,11 @@ export class Document {
141
142
  /**
142
143
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
143
144
  *
145
+ * Throws an `Error` whose message includes the `EditError` variant name
146
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
147
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
148
+ * name returns `undefined`.
149
+ *
144
150
  * Mutators never modify `warnings`.
145
151
  */
146
152
  removeField(name: string): any;
@@ -150,6 +156,20 @@ export class Document {
150
156
  * Mutators never modify `warnings`.
151
157
  */
152
158
  replaceBody(body: string): void;
159
+ /**
160
+ * Replace the tag of the composable card at `index`.
161
+ *
162
+ * Mutates only the sentinel — the card's frontmatter and body are
163
+ * untouched. Schema-aware migration (clearing orphan fields, applying
164
+ * new defaults) is the caller's responsibility; `setCardTag` is a
165
+ * structural primitive.
166
+ *
167
+ * Throws if `index` is out of range or if `newTag` does not match
168
+ * `[a-z_][a-z0-9_]*`.
169
+ *
170
+ * Mutators never modify `warnings`.
171
+ */
172
+ setCardTag(index: number, new_tag: string): void;
153
173
  /**
154
174
  * Update a frontmatter field on the main card.
155
175
  *
@@ -193,7 +193,8 @@ export class Document {
193
193
  * Remove a frontmatter field on the card at `index`, returning the
194
194
  * removed value or `undefined` if the field was absent.
195
195
  *
196
- * Throws if `index` is out of range.
196
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
197
+ * not match `[a-z_][a-z0-9_]*`.
197
198
  *
198
199
  * Mutators never modify `warnings`.
199
200
  * @param {number} index
@@ -220,15 +221,31 @@ export class Document {
220
221
  /**
221
222
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
222
223
  *
224
+ * Throws an `Error` whose message includes the `EditError` variant name
225
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
226
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
227
+ * name returns `undefined`.
228
+ *
223
229
  * Mutators never modify `warnings`.
224
230
  * @param {string} name
225
231
  * @returns {any}
226
232
  */
227
233
  removeField(name) {
228
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
229
- const len0 = WASM_VECTOR_LEN;
230
- const ret = wasm.document_removeField(this.__wbg_ptr, ptr0, len0);
231
- 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
+ }
232
249
  }
233
250
  /**
234
251
  * Replace the main card's body (the global Markdown body).
@@ -241,6 +258,36 @@ export class Document {
241
258
  const len0 = WASM_VECTOR_LEN;
242
259
  wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
243
260
  }
261
+ /**
262
+ * Replace the tag of the composable card at `index`.
263
+ *
264
+ * Mutates only the sentinel — the card's frontmatter and body are
265
+ * untouched. Schema-aware migration (clearing orphan fields, applying
266
+ * new defaults) is the caller's responsibility; `setCardTag` is a
267
+ * structural primitive.
268
+ *
269
+ * Throws if `index` is out of range or if `newTag` does not match
270
+ * `[a-z_][a-z0-9_]*`.
271
+ *
272
+ * Mutators never modify `warnings`.
273
+ * @param {number} index
274
+ * @param {string} new_tag
275
+ */
276
+ setCardTag(index, new_tag) {
277
+ try {
278
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
279
+ const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
280
+ const len0 = WASM_VECTOR_LEN;
281
+ wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
282
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
283
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
284
+ if (r1) {
285
+ throw takeObject(r0);
286
+ }
287
+ } finally {
288
+ wasm.__wbindgen_add_to_stack_pointer(16);
289
+ }
290
+ }
244
291
  /**
245
292
  * Update a frontmatter field on the main card.
246
293
  *
Binary file
@@ -15,8 +15,9 @@ export const document_pushCard: (a: number, b: number, c: number) => void;
15
15
  export const document_quillRef: (a: number, b: number) => void;
16
16
  export const document_removeCard: (a: number, b: number) => number;
17
17
  export const document_removeCardField: (a: number, b: number, c: number, d: number, e: number) => void;
18
- export const document_removeField: (a: number, b: number, c: number) => number;
18
+ export const document_removeField: (a: number, b: number, c: number, d: number) => void;
19
19
  export const document_replaceBody: (a: number, b: number, c: number) => void;
20
+ export const document_setCardTag: (a: number, b: number, c: number, d: number, e: number) => void;
20
21
  export const document_setField: (a: number, b: number, c: number, d: number, e: number) => void;
21
22
  export const document_setFill: (a: number, b: number, c: number, d: number, e: number) => void;
22
23
  export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
@@ -133,7 +133,8 @@ export class Document {
133
133
  * Remove a frontmatter field on the card at `index`, returning the
134
134
  * removed value or `undefined` if the field was absent.
135
135
  *
136
- * Throws if `index` is out of range.
136
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
137
+ * not match `[a-z_][a-z0-9_]*`.
137
138
  *
138
139
  * Mutators never modify `warnings`.
139
140
  */
@@ -141,6 +142,11 @@ export class Document {
141
142
  /**
142
143
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
143
144
  *
145
+ * Throws an `Error` whose message includes the `EditError` variant name
146
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
147
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
148
+ * name returns `undefined`.
149
+ *
144
150
  * Mutators never modify `warnings`.
145
151
  */
146
152
  removeField(name: string): any;
@@ -150,6 +156,20 @@ export class Document {
150
156
  * Mutators never modify `warnings`.
151
157
  */
152
158
  replaceBody(body: string): void;
159
+ /**
160
+ * Replace the tag of the composable card at `index`.
161
+ *
162
+ * Mutates only the sentinel — the card's frontmatter and body are
163
+ * untouched. Schema-aware migration (clearing orphan fields, applying
164
+ * new defaults) is the caller's responsibility; `setCardTag` is a
165
+ * structural primitive.
166
+ *
167
+ * Throws if `index` is out of range or if `newTag` does not match
168
+ * `[a-z_][a-z0-9_]*`.
169
+ *
170
+ * Mutators never modify `warnings`.
171
+ */
172
+ setCardTag(index: number, new_tag: string): void;
153
173
  /**
154
174
  * Update a frontmatter field on the main card.
155
175
  *
package/node-esm/wasm.js CHANGED
@@ -197,7 +197,8 @@ export class Document {
197
197
  * Remove a frontmatter field on the card at `index`, returning the
198
198
  * removed value or `undefined` if the field was absent.
199
199
  *
200
- * Throws if `index` is out of range.
200
+ * Throws if `index` is out of range, `name` is reserved, or `name` does
201
+ * not match `[a-z_][a-z0-9_]*`.
201
202
  *
202
203
  * Mutators never modify `warnings`.
203
204
  * @param {number} index
@@ -224,15 +225,31 @@ export class Document {
224
225
  /**
225
226
  * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
226
227
  *
228
+ * Throws an `Error` whose message includes the `EditError` variant name
229
+ * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
230
+ * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
231
+ * name returns `undefined`.
232
+ *
227
233
  * Mutators never modify `warnings`.
228
234
  * @param {string} name
229
235
  * @returns {any}
230
236
  */
231
237
  removeField(name) {
232
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
233
- const len0 = WASM_VECTOR_LEN;
234
- const ret = wasm.document_removeField(this.__wbg_ptr, ptr0, len0);
235
- 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
+ }
236
253
  }
237
254
  /**
238
255
  * Replace the main card's body (the global Markdown body).
@@ -245,6 +262,36 @@ export class Document {
245
262
  const len0 = WASM_VECTOR_LEN;
246
263
  wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
247
264
  }
265
+ /**
266
+ * Replace the tag of the composable card at `index`.
267
+ *
268
+ * Mutates only the sentinel — the card's frontmatter and body are
269
+ * untouched. Schema-aware migration (clearing orphan fields, applying
270
+ * new defaults) is the caller's responsibility; `setCardTag` is a
271
+ * structural primitive.
272
+ *
273
+ * Throws if `index` is out of range or if `newTag` does not match
274
+ * `[a-z_][a-z0-9_]*`.
275
+ *
276
+ * Mutators never modify `warnings`.
277
+ * @param {number} index
278
+ * @param {string} new_tag
279
+ */
280
+ setCardTag(index, new_tag) {
281
+ try {
282
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
283
+ const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
284
+ const len0 = WASM_VECTOR_LEN;
285
+ wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
286
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
287
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
288
+ if (r1) {
289
+ throw takeObject(r0);
290
+ }
291
+ } finally {
292
+ wasm.__wbindgen_add_to_stack_pointer(16);
293
+ }
294
+ }
248
295
  /**
249
296
  * Update a frontmatter field on the main card.
250
297
  *
Binary file
@@ -15,8 +15,9 @@ export const document_pushCard: (a: number, b: number, c: number) => void;
15
15
  export const document_quillRef: (a: number, b: number) => void;
16
16
  export const document_removeCard: (a: number, b: number) => number;
17
17
  export const document_removeCardField: (a: number, b: number, c: number, d: number, e: number) => void;
18
- export const document_removeField: (a: number, b: number, c: number) => number;
18
+ export const document_removeField: (a: number, b: number, c: number, d: number) => void;
19
19
  export const document_replaceBody: (a: number, b: number, c: number) => void;
20
+ export const document_setCardTag: (a: number, b: number, c: number, d: number, e: number) => void;
20
21
  export const document_setField: (a: number, b: number, c: number, d: number, e: number) => void;
21
22
  export const document_setFill: (a: number, b: number, c: number, d: number, e: number) => void;
22
23
  export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.62.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",