@quillmark/wasm 0.29.0 → 0.31.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
@@ -54,7 +54,7 @@ import { Quillmark } from '@quillmark-test/wasm';
54
54
  const markdown = `---
55
55
  title: My Document
56
56
  author: Alice
57
- QUILL: my-quill
57
+ QUILL: my_quill
58
58
  ---
59
59
 
60
60
  # Hello World
@@ -70,7 +70,7 @@ const engine = new Quillmark();
70
70
  const quillJson = {
71
71
  files: {
72
72
  'Quill.toml': {
73
- contents: '[Quill]\nname = "my-quill"\nbackend = "typst"\nplate_file = "plate.typ"\ndescription = "My template"\n'
73
+ contents: '[Quill]\nname = "my_quill"\nversion = "1.0"\nbackend = "typst"\nplate_file = "plate.typ"\ndescription = "My template"\n'
74
74
  },
75
75
  'plate.typ': {
76
76
  contents: '= {{ title }}\n\n{{ body | Content }}'
@@ -123,7 +123,7 @@ Additional methods for managing the engine and debugging:
123
123
  {
124
124
  format?: 'pdf' | 'svg' | 'txt', // Output format (default: 'pdf')
125
125
  assets?: Record<string, Uint8Array>, // Additional assets to inject as plain object (not Map)
126
- quillName?: string // Override quill_tag from ParsedDocument
126
+ quillName?: string // Override quillName from ParsedDocument
127
127
  }
128
128
  ```
129
129
 
@@ -134,7 +134,7 @@ Returned by `parseMarkdown()`:
134
134
  ```typescript
135
135
  {
136
136
  fields: object, // YAML frontmatter fields
137
- quillTag?: string // Value of QUILL field (if present)
137
+ quillName: string // Template name from QUILL field (or "__default__")
138
138
  }
139
139
  ```
140
140
 
package/bundler/wasm.d.ts CHANGED
@@ -4,14 +4,19 @@
4
4
  * Initialize the WASM module with panic hooks for better error messages
5
5
  */
6
6
  export function init(): void;
7
- export type OutputFormat = "pdf" | "svg" | "txt";
8
-
9
7
  export type Severity = "error" | "warning" | "note";
10
8
 
11
- export interface Location {
12
- file: string;
13
- line: number;
14
- column: number;
9
+ export interface Artifact {
10
+ format: OutputFormat;
11
+ bytes: Uint8Array;
12
+ mimeType: string;
13
+ }
14
+
15
+ export interface RenderResult {
16
+ artifacts: Artifact[];
17
+ warnings: Diagnostic[];
18
+ outputFormat: OutputFormat;
19
+ renderTimeMs: number;
15
20
  }
16
21
 
17
22
  export interface Diagnostic {
@@ -23,17 +28,17 @@ export interface Diagnostic {
23
28
  sourceChain: string[];
24
29
  }
25
30
 
26
- export interface Artifact {
27
- format: OutputFormat;
28
- bytes: Uint8Array;
29
- mimeType: string;
31
+ export type OutputFormat = "pdf" | "svg" | "txt";
32
+
33
+ export interface Location {
34
+ file: string;
35
+ line: number;
36
+ column: number;
30
37
  }
31
38
 
32
- export interface RenderResult {
33
- artifacts: Artifact[];
34
- warnings: Diagnostic[];
35
- outputFormat: OutputFormat;
36
- renderTimeMs: number;
39
+ export interface ParsedDocument {
40
+ fields: Record<string, any>;
41
+ quillName: string;
37
42
  }
38
43
 
39
44
  export interface QuillInfo {
@@ -47,11 +52,6 @@ export interface QuillInfo {
47
52
  supportedFormats: OutputFormat[];
48
53
  }
49
54
 
50
- export interface ParsedDocument {
51
- fields: Record<string, any>;
52
- quillTag: string;
53
- }
54
-
55
55
  export interface RenderOptions {
56
56
  format?: OutputFormat;
57
57
  assets?: Record<string, Uint8Array | number[]>;
@@ -67,14 +67,28 @@ export class Quillmark {
67
67
  free(): void;
68
68
  [Symbol.dispose](): void;
69
69
  /**
70
- * JavaScript constructor: `new Quillmark()`
70
+ * List registered Quill names
71
71
  */
72
- constructor();
72
+ listQuills(): string[];
73
+ /**
74
+ * Compile markdown to JSON data without rendering artifacts.
75
+ *
76
+ * This exposes the intermediate data structure that would be passed to the backend.
77
+ * Useful for debugging and validation.
78
+ */
79
+ compileData(markdown: string): any;
80
+ /**
81
+ * Get shallow information about a registered Quill
82
+ *
83
+ * This returns metadata, backend info, field schemas, and supported formats
84
+ * that consumers need to configure render options for the next step.
85
+ */
86
+ getQuillInfo(name: string): QuillInfo;
73
87
  /**
74
88
  * Parse markdown into a ParsedDocument
75
89
  *
76
90
  * This is the first step in the workflow. The returned ParsedDocument contains
77
- * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
91
+ * the parsed YAML frontmatter fields and the quill_name (from QUILL field or "__default__").
78
92
  */
79
93
  static parseMarkdown(markdown: string): ParsedDocument;
80
94
  /**
@@ -85,44 +99,37 @@ export class Quillmark {
85
99
  */
86
100
  registerQuill(quill_json: any): QuillInfo;
87
101
  /**
88
- * Get shallow information about a registered Quill
89
- *
90
- * This returns metadata, backend info, field schemas, and supported formats
91
- * that consumers need to configure render options for the next step.
102
+ * Unregister a Quill (free memory)
92
103
  */
93
- getQuillInfo(name: string): QuillInfo;
104
+ unregisterQuill(name: string): void;
94
105
  /**
95
- * Perform a dry run validation without backend compilation.
96
- *
97
- * Executes parsing, schema validation, and template composition to
98
- * surface input errors quickly. Returns successfully on valid input,
99
- * or throws an error with diagnostic payload on failure.
100
- *
101
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
106
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
102
107
  *
103
- * This is useful for fast feedback loops in LLM-driven document generation.
108
+ * This returns the schema in a format suitable for feeding to LLMs or
109
+ * other consumers that don't need the UI configuration "x-ui" fields.
104
110
  */
105
- dryRun(markdown: string): void;
111
+ getStrippedSchema(name: string): any;
106
112
  /**
107
- * Compile markdown to JSON data without rendering artifacts.
108
- *
109
- * This exposes the intermediate data structure that would be passed to the backend.
110
- * Useful for debugging and validation.
113
+ * JavaScript constructor: `new Quillmark()`
111
114
  */
112
- compileData(markdown: string): any;
115
+ constructor();
113
116
  /**
114
117
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
115
118
  *
116
119
  * Uses the Quill specified in options.quill_name if provided,
117
- * otherwise infers it from the ParsedDocument's quill_tag field.
120
+ * otherwise infers it from the ParsedDocument's quill_name field.
118
121
  */
119
122
  render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
120
123
  /**
121
- * List registered Quill names
122
- */
123
- listQuills(): string[];
124
- /**
125
- * Unregister a Quill (free memory)
124
+ * Perform a dry run validation without backend compilation.
125
+ *
126
+ * Executes parsing, schema validation, and template composition to
127
+ * surface input errors quickly. Returns successfully on valid input,
128
+ * or throws an error with diagnostic payload on failure.
129
+ *
130
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
131
+ *
132
+ * This is useful for fast feedback loops in LLM-driven document generation.
126
133
  */
127
- unregisterQuill(name: string): void;
134
+ dryRun(markdown: string): void;
128
135
  }
@@ -207,6 +207,12 @@ function debugString(val) {
207
207
  // TODO we could test for more things here, like `Set`s and `Map`s.
208
208
  return className;
209
209
  }
210
+ /**
211
+ * Initialize the WASM module with panic hooks for better error messages
212
+ */
213
+ export function init() {
214
+ wasm.init();
215
+ }
210
216
 
211
217
  function getArrayJsValueFromWasm0(ptr, len) {
212
218
  ptr = ptr >>> 0;
@@ -217,12 +223,6 @@ function getArrayJsValueFromWasm0(ptr, len) {
217
223
  }
218
224
  return result;
219
225
  }
220
- /**
221
- * Initialize the WASM module with panic hooks for better error messages
222
- */
223
- export function init() {
224
- wasm.init();
225
- }
226
226
 
227
227
  const QuillmarkFinalization = (typeof FinalizationRegistry === 'undefined')
228
228
  ? { register: () => {}, unregister: () => {} }
@@ -246,28 +246,36 @@ export class Quillmark {
246
246
  wasm.__wbg_quillmark_free(ptr, 0);
247
247
  }
248
248
  /**
249
- * JavaScript constructor: `new Quillmark()`
249
+ * List registered Quill names
250
+ * @returns {string[]}
250
251
  */
251
- constructor() {
252
- const ret = wasm.quillmark_new();
253
- this.__wbg_ptr = ret >>> 0;
254
- QuillmarkFinalization.register(this, this.__wbg_ptr, this);
255
- return this;
252
+ listQuills() {
253
+ try {
254
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
255
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
256
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
257
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
258
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
259
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
260
+ return v1;
261
+ } finally {
262
+ wasm.__wbindgen_add_to_stack_pointer(16);
263
+ }
256
264
  }
257
265
  /**
258
- * Parse markdown into a ParsedDocument
266
+ * Compile markdown to JSON data without rendering artifacts.
259
267
  *
260
- * This is the first step in the workflow. The returned ParsedDocument contains
261
- * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
268
+ * This exposes the intermediate data structure that would be passed to the backend.
269
+ * Useful for debugging and validation.
262
270
  * @param {string} markdown
263
- * @returns {ParsedDocument}
271
+ * @returns {any}
264
272
  */
265
- static parseMarkdown(markdown) {
273
+ compileData(markdown) {
266
274
  try {
267
275
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
268
276
  const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
269
277
  const len0 = WASM_VECTOR_LEN;
270
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
278
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
271
279
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
272
280
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
273
281
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -280,17 +288,19 @@ export class Quillmark {
280
288
  }
281
289
  }
282
290
  /**
283
- * Register a Quill template bundle
291
+ * Get shallow information about a registered Quill
284
292
  *
285
- * Accepts either a JSON string or a JsValue object representing the Quill file tree.
286
- * Validation happens automatically on registration.
287
- * @param {any} quill_json
293
+ * This returns metadata, backend info, field schemas, and supported formats
294
+ * that consumers need to configure render options for the next step.
295
+ * @param {string} name
288
296
  * @returns {QuillInfo}
289
297
  */
290
- registerQuill(quill_json) {
298
+ getQuillInfo(name) {
291
299
  try {
292
300
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
293
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
301
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
302
+ const len0 = WASM_VECTOR_LEN;
303
+ wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
294
304
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
295
305
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
296
306
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -303,19 +313,19 @@ export class Quillmark {
303
313
  }
304
314
  }
305
315
  /**
306
- * Get shallow information about a registered Quill
316
+ * Parse markdown into a ParsedDocument
307
317
  *
308
- * This returns metadata, backend info, field schemas, and supported formats
309
- * that consumers need to configure render options for the next step.
310
- * @param {string} name
311
- * @returns {QuillInfo}
318
+ * This is the first step in the workflow. The returned ParsedDocument contains
319
+ * the parsed YAML frontmatter fields and the quill_name (from QUILL field or "__default__").
320
+ * @param {string} markdown
321
+ * @returns {ParsedDocument}
312
322
  */
313
- getQuillInfo(name) {
323
+ static parseMarkdown(markdown) {
314
324
  try {
315
325
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
316
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
326
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
317
327
  const len0 = WASM_VECTOR_LEN;
318
- wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
328
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
319
329
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
320
330
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
321
331
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -328,46 +338,51 @@ export class Quillmark {
328
338
  }
329
339
  }
330
340
  /**
331
- * Perform a dry run validation without backend compilation.
332
- *
333
- * Executes parsing, schema validation, and template composition to
334
- * surface input errors quickly. Returns successfully on valid input,
335
- * or throws an error with diagnostic payload on failure.
336
- *
337
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
341
+ * Register a Quill template bundle
338
342
  *
339
- * This is useful for fast feedback loops in LLM-driven document generation.
340
- * @param {string} markdown
343
+ * Accepts either a JSON string or a JsValue object representing the Quill file tree.
344
+ * Validation happens automatically on registration.
345
+ * @param {any} quill_json
346
+ * @returns {QuillInfo}
341
347
  */
342
- dryRun(markdown) {
348
+ registerQuill(quill_json) {
343
349
  try {
344
350
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
345
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
346
- const len0 = WASM_VECTOR_LEN;
347
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
351
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
348
352
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
349
353
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
350
- if (r1) {
351
- throw takeObject(r0);
354
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
355
+ if (r2) {
356
+ throw takeObject(r1);
352
357
  }
358
+ return takeObject(r0);
353
359
  } finally {
354
360
  wasm.__wbindgen_add_to_stack_pointer(16);
355
361
  }
356
362
  }
357
363
  /**
358
- * Compile markdown to JSON data without rendering artifacts.
364
+ * Unregister a Quill (free memory)
365
+ * @param {string} name
366
+ */
367
+ unregisterQuill(name) {
368
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
369
+ const len0 = WASM_VECTOR_LEN;
370
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
371
+ }
372
+ /**
373
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
359
374
  *
360
- * This exposes the intermediate data structure that would be passed to the backend.
361
- * Useful for debugging and validation.
362
- * @param {string} markdown
375
+ * This returns the schema in a format suitable for feeding to LLMs or
376
+ * other consumers that don't need the UI configuration "x-ui" fields.
377
+ * @param {string} name
363
378
  * @returns {any}
364
379
  */
365
- compileData(markdown) {
380
+ getStrippedSchema(name) {
366
381
  try {
367
382
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
368
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
383
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
369
384
  const len0 = WASM_VECTOR_LEN;
370
- wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
385
+ wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
371
386
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
372
387
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
373
388
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -379,11 +394,20 @@ export class Quillmark {
379
394
  wasm.__wbindgen_add_to_stack_pointer(16);
380
395
  }
381
396
  }
397
+ /**
398
+ * JavaScript constructor: `new Quillmark()`
399
+ */
400
+ constructor() {
401
+ const ret = wasm.quillmark_new();
402
+ this.__wbg_ptr = ret >>> 0;
403
+ QuillmarkFinalization.register(this, this.__wbg_ptr, this);
404
+ return this;
405
+ }
382
406
  /**
383
407
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
384
408
  *
385
409
  * Uses the Quill specified in options.quill_name if provided,
386
- * otherwise infers it from the ParsedDocument's quill_tag field.
410
+ * otherwise infers it from the ParsedDocument's quill_name field.
387
411
  * @param {ParsedDocument} parsed
388
412
  * @param {RenderOptions} opts
389
413
  * @returns {RenderResult}
@@ -404,31 +428,32 @@ export class Quillmark {
404
428
  }
405
429
  }
406
430
  /**
407
- * List registered Quill names
408
- * @returns {string[]}
431
+ * Perform a dry run validation without backend compilation.
432
+ *
433
+ * Executes parsing, schema validation, and template composition to
434
+ * surface input errors quickly. Returns successfully on valid input,
435
+ * or throws an error with diagnostic payload on failure.
436
+ *
437
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
438
+ *
439
+ * This is useful for fast feedback loops in LLM-driven document generation.
440
+ * @param {string} markdown
409
441
  */
410
- listQuills() {
442
+ dryRun(markdown) {
411
443
  try {
412
444
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
413
- wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
445
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
446
+ const len0 = WASM_VECTOR_LEN;
447
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
414
448
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
415
449
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
416
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
417
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
418
- return v1;
450
+ if (r1) {
451
+ throw takeObject(r0);
452
+ }
419
453
  } finally {
420
454
  wasm.__wbindgen_add_to_stack_pointer(16);
421
455
  }
422
456
  }
423
- /**
424
- * Unregister a Quill (free memory)
425
- * @param {string} name
426
- */
427
- unregisterQuill(name) {
428
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
429
- const len0 = WASM_VECTOR_LEN;
430
- wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
431
- }
432
457
  }
433
458
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
434
459
 
Binary file
@@ -2,29 +2,30 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_quillmark_free: (a: number, b: number) => void;
5
+ export const init: () => void;
6
+ export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
7
+ export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
8
+ export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
9
+ export const quillmark_getStrippedSchema: (a: number, b: number, c: number, d: number) => void;
10
+ export const quillmark_listQuills: (a: number, b: number) => void;
5
11
  export const quillmark_new: () => number;
6
12
  export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
7
13
  export const quillmark_registerQuill: (a: number, b: number, c: number) => void;
8
- export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
9
- export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
10
- export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
11
14
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
12
- export const quillmark_listQuills: (a: number, b: number) => void;
13
15
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
14
- export const init: () => void;
15
- export const qcms_profile_is_bogus: (a: number) => number;
16
- export const qcms_white_point_sRGB: (a: number) => void;
16
+ export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
17
17
  export const qcms_profile_precache_output_transform: (a: number) => void;
18
- export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
19
- export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
20
- export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
18
+ export const qcms_white_point_sRGB: (a: number) => void;
21
19
  export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
22
20
  export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
23
21
  export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
24
- export const qcms_transform_release: (a: number) => void;
25
- export const qcms_enable_iccv4: () => void;
22
+ export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
+ export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
+ export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
26
25
  export const lut_interp_linear16: (a: number, b: number, c: number) => number;
27
- export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
26
+ export const qcms_enable_iccv4: () => void;
27
+ export const qcms_profile_is_bogus: (a: number) => number;
28
+ export const qcms_transform_release: (a: number) => void;
28
29
  export const __wbindgen_export_0: (a: number, b: number) => number;
29
30
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
30
31
  export const __wbindgen_export_2: (a: number) => void;
@@ -4,14 +4,19 @@
4
4
  * Initialize the WASM module with panic hooks for better error messages
5
5
  */
6
6
  export function init(): void;
7
- export type OutputFormat = "pdf" | "svg" | "txt";
8
-
9
7
  export type Severity = "error" | "warning" | "note";
10
8
 
11
- export interface Location {
12
- file: string;
13
- line: number;
14
- column: number;
9
+ export interface Artifact {
10
+ format: OutputFormat;
11
+ bytes: Uint8Array;
12
+ mimeType: string;
13
+ }
14
+
15
+ export interface RenderResult {
16
+ artifacts: Artifact[];
17
+ warnings: Diagnostic[];
18
+ outputFormat: OutputFormat;
19
+ renderTimeMs: number;
15
20
  }
16
21
 
17
22
  export interface Diagnostic {
@@ -23,17 +28,17 @@ export interface Diagnostic {
23
28
  sourceChain: string[];
24
29
  }
25
30
 
26
- export interface Artifact {
27
- format: OutputFormat;
28
- bytes: Uint8Array;
29
- mimeType: string;
31
+ export type OutputFormat = "pdf" | "svg" | "txt";
32
+
33
+ export interface Location {
34
+ file: string;
35
+ line: number;
36
+ column: number;
30
37
  }
31
38
 
32
- export interface RenderResult {
33
- artifacts: Artifact[];
34
- warnings: Diagnostic[];
35
- outputFormat: OutputFormat;
36
- renderTimeMs: number;
39
+ export interface ParsedDocument {
40
+ fields: Record<string, any>;
41
+ quillName: string;
37
42
  }
38
43
 
39
44
  export interface QuillInfo {
@@ -47,11 +52,6 @@ export interface QuillInfo {
47
52
  supportedFormats: OutputFormat[];
48
53
  }
49
54
 
50
- export interface ParsedDocument {
51
- fields: Record<string, any>;
52
- quillTag: string;
53
- }
54
-
55
55
  export interface RenderOptions {
56
56
  format?: OutputFormat;
57
57
  assets?: Record<string, Uint8Array | number[]>;
@@ -67,14 +67,28 @@ export class Quillmark {
67
67
  free(): void;
68
68
  [Symbol.dispose](): void;
69
69
  /**
70
- * JavaScript constructor: `new Quillmark()`
70
+ * List registered Quill names
71
71
  */
72
- constructor();
72
+ listQuills(): string[];
73
+ /**
74
+ * Compile markdown to JSON data without rendering artifacts.
75
+ *
76
+ * This exposes the intermediate data structure that would be passed to the backend.
77
+ * Useful for debugging and validation.
78
+ */
79
+ compileData(markdown: string): any;
80
+ /**
81
+ * Get shallow information about a registered Quill
82
+ *
83
+ * This returns metadata, backend info, field schemas, and supported formats
84
+ * that consumers need to configure render options for the next step.
85
+ */
86
+ getQuillInfo(name: string): QuillInfo;
73
87
  /**
74
88
  * Parse markdown into a ParsedDocument
75
89
  *
76
90
  * This is the first step in the workflow. The returned ParsedDocument contains
77
- * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
91
+ * the parsed YAML frontmatter fields and the quill_name (from QUILL field or "__default__").
78
92
  */
79
93
  static parseMarkdown(markdown: string): ParsedDocument;
80
94
  /**
@@ -85,44 +99,37 @@ export class Quillmark {
85
99
  */
86
100
  registerQuill(quill_json: any): QuillInfo;
87
101
  /**
88
- * Get shallow information about a registered Quill
89
- *
90
- * This returns metadata, backend info, field schemas, and supported formats
91
- * that consumers need to configure render options for the next step.
102
+ * Unregister a Quill (free memory)
92
103
  */
93
- getQuillInfo(name: string): QuillInfo;
104
+ unregisterQuill(name: string): void;
94
105
  /**
95
- * Perform a dry run validation without backend compilation.
96
- *
97
- * Executes parsing, schema validation, and template composition to
98
- * surface input errors quickly. Returns successfully on valid input,
99
- * or throws an error with diagnostic payload on failure.
100
- *
101
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
106
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
102
107
  *
103
- * This is useful for fast feedback loops in LLM-driven document generation.
108
+ * This returns the schema in a format suitable for feeding to LLMs or
109
+ * other consumers that don't need the UI configuration "x-ui" fields.
104
110
  */
105
- dryRun(markdown: string): void;
111
+ getStrippedSchema(name: string): any;
106
112
  /**
107
- * Compile markdown to JSON data without rendering artifacts.
108
- *
109
- * This exposes the intermediate data structure that would be passed to the backend.
110
- * Useful for debugging and validation.
113
+ * JavaScript constructor: `new Quillmark()`
111
114
  */
112
- compileData(markdown: string): any;
115
+ constructor();
113
116
  /**
114
117
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
115
118
  *
116
119
  * Uses the Quill specified in options.quill_name if provided,
117
- * otherwise infers it from the ParsedDocument's quill_tag field.
120
+ * otherwise infers it from the ParsedDocument's quill_name field.
118
121
  */
119
122
  render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
120
123
  /**
121
- * List registered Quill names
122
- */
123
- listQuills(): string[];
124
- /**
125
- * Unregister a Quill (free memory)
124
+ * Perform a dry run validation without backend compilation.
125
+ *
126
+ * Executes parsing, schema validation, and template composition to
127
+ * surface input errors quickly. Returns successfully on valid input,
128
+ * or throws an error with diagnostic payload on failure.
129
+ *
130
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
131
+ *
132
+ * This is useful for fast feedback loops in LLM-driven document generation.
126
133
  */
127
- unregisterQuill(name: string): void;
134
+ dryRun(markdown: string): void;
128
135
  }
@@ -201,6 +201,12 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
204
+ /**
205
+ * Initialize the WASM module with panic hooks for better error messages
206
+ */
207
+ export function init() {
208
+ wasm.init();
209
+ }
204
210
 
205
211
  function getArrayJsValueFromWasm0(ptr, len) {
206
212
  ptr = ptr >>> 0;
@@ -211,12 +217,6 @@ function getArrayJsValueFromWasm0(ptr, len) {
211
217
  }
212
218
  return result;
213
219
  }
214
- /**
215
- * Initialize the WASM module with panic hooks for better error messages
216
- */
217
- export function init() {
218
- wasm.init();
219
- }
220
220
 
221
221
  const QuillmarkFinalization = (typeof FinalizationRegistry === 'undefined')
222
222
  ? { register: () => {}, unregister: () => {} }
@@ -240,28 +240,36 @@ export class Quillmark {
240
240
  wasm.__wbg_quillmark_free(ptr, 0);
241
241
  }
242
242
  /**
243
- * JavaScript constructor: `new Quillmark()`
243
+ * List registered Quill names
244
+ * @returns {string[]}
244
245
  */
245
- constructor() {
246
- const ret = wasm.quillmark_new();
247
- this.__wbg_ptr = ret >>> 0;
248
- QuillmarkFinalization.register(this, this.__wbg_ptr, this);
249
- return this;
246
+ listQuills() {
247
+ try {
248
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
249
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
250
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
251
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
252
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
253
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
254
+ return v1;
255
+ } finally {
256
+ wasm.__wbindgen_add_to_stack_pointer(16);
257
+ }
250
258
  }
251
259
  /**
252
- * Parse markdown into a ParsedDocument
260
+ * Compile markdown to JSON data without rendering artifacts.
253
261
  *
254
- * This is the first step in the workflow. The returned ParsedDocument contains
255
- * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
262
+ * This exposes the intermediate data structure that would be passed to the backend.
263
+ * Useful for debugging and validation.
256
264
  * @param {string} markdown
257
- * @returns {ParsedDocument}
265
+ * @returns {any}
258
266
  */
259
- static parseMarkdown(markdown) {
267
+ compileData(markdown) {
260
268
  try {
261
269
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
262
270
  const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
263
271
  const len0 = WASM_VECTOR_LEN;
264
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
272
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
265
273
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
266
274
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
267
275
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -274,17 +282,19 @@ export class Quillmark {
274
282
  }
275
283
  }
276
284
  /**
277
- * Register a Quill template bundle
285
+ * Get shallow information about a registered Quill
278
286
  *
279
- * Accepts either a JSON string or a JsValue object representing the Quill file tree.
280
- * Validation happens automatically on registration.
281
- * @param {any} quill_json
287
+ * This returns metadata, backend info, field schemas, and supported formats
288
+ * that consumers need to configure render options for the next step.
289
+ * @param {string} name
282
290
  * @returns {QuillInfo}
283
291
  */
284
- registerQuill(quill_json) {
292
+ getQuillInfo(name) {
285
293
  try {
286
294
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
287
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
295
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
296
+ const len0 = WASM_VECTOR_LEN;
297
+ wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
288
298
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
289
299
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
290
300
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -297,19 +307,19 @@ export class Quillmark {
297
307
  }
298
308
  }
299
309
  /**
300
- * Get shallow information about a registered Quill
310
+ * Parse markdown into a ParsedDocument
301
311
  *
302
- * This returns metadata, backend info, field schemas, and supported formats
303
- * that consumers need to configure render options for the next step.
304
- * @param {string} name
305
- * @returns {QuillInfo}
312
+ * This is the first step in the workflow. The returned ParsedDocument contains
313
+ * the parsed YAML frontmatter fields and the quill_name (from QUILL field or "__default__").
314
+ * @param {string} markdown
315
+ * @returns {ParsedDocument}
306
316
  */
307
- getQuillInfo(name) {
317
+ static parseMarkdown(markdown) {
308
318
  try {
309
319
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
310
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
320
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
311
321
  const len0 = WASM_VECTOR_LEN;
312
- wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
322
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
313
323
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
314
324
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
315
325
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -322,46 +332,51 @@ export class Quillmark {
322
332
  }
323
333
  }
324
334
  /**
325
- * Perform a dry run validation without backend compilation.
326
- *
327
- * Executes parsing, schema validation, and template composition to
328
- * surface input errors quickly. Returns successfully on valid input,
329
- * or throws an error with diagnostic payload on failure.
330
- *
331
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
335
+ * Register a Quill template bundle
332
336
  *
333
- * This is useful for fast feedback loops in LLM-driven document generation.
334
- * @param {string} markdown
337
+ * Accepts either a JSON string or a JsValue object representing the Quill file tree.
338
+ * Validation happens automatically on registration.
339
+ * @param {any} quill_json
340
+ * @returns {QuillInfo}
335
341
  */
336
- dryRun(markdown) {
342
+ registerQuill(quill_json) {
337
343
  try {
338
344
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
339
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
340
- const len0 = WASM_VECTOR_LEN;
341
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
345
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
342
346
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
343
347
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
344
- if (r1) {
345
- throw takeObject(r0);
348
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
349
+ if (r2) {
350
+ throw takeObject(r1);
346
351
  }
352
+ return takeObject(r0);
347
353
  } finally {
348
354
  wasm.__wbindgen_add_to_stack_pointer(16);
349
355
  }
350
356
  }
351
357
  /**
352
- * Compile markdown to JSON data without rendering artifacts.
358
+ * Unregister a Quill (free memory)
359
+ * @param {string} name
360
+ */
361
+ unregisterQuill(name) {
362
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
363
+ const len0 = WASM_VECTOR_LEN;
364
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
365
+ }
366
+ /**
367
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
353
368
  *
354
- * This exposes the intermediate data structure that would be passed to the backend.
355
- * Useful for debugging and validation.
356
- * @param {string} markdown
369
+ * This returns the schema in a format suitable for feeding to LLMs or
370
+ * other consumers that don't need the UI configuration "x-ui" fields.
371
+ * @param {string} name
357
372
  * @returns {any}
358
373
  */
359
- compileData(markdown) {
374
+ getStrippedSchema(name) {
360
375
  try {
361
376
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
362
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
377
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
363
378
  const len0 = WASM_VECTOR_LEN;
364
- wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
379
+ wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
365
380
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
366
381
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
367
382
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -373,11 +388,20 @@ export class Quillmark {
373
388
  wasm.__wbindgen_add_to_stack_pointer(16);
374
389
  }
375
390
  }
391
+ /**
392
+ * JavaScript constructor: `new Quillmark()`
393
+ */
394
+ constructor() {
395
+ const ret = wasm.quillmark_new();
396
+ this.__wbg_ptr = ret >>> 0;
397
+ QuillmarkFinalization.register(this, this.__wbg_ptr, this);
398
+ return this;
399
+ }
376
400
  /**
377
401
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
378
402
  *
379
403
  * Uses the Quill specified in options.quill_name if provided,
380
- * otherwise infers it from the ParsedDocument's quill_tag field.
404
+ * otherwise infers it from the ParsedDocument's quill_name field.
381
405
  * @param {ParsedDocument} parsed
382
406
  * @param {RenderOptions} opts
383
407
  * @returns {RenderResult}
@@ -398,31 +422,32 @@ export class Quillmark {
398
422
  }
399
423
  }
400
424
  /**
401
- * List registered Quill names
402
- * @returns {string[]}
425
+ * Perform a dry run validation without backend compilation.
426
+ *
427
+ * Executes parsing, schema validation, and template composition to
428
+ * surface input errors quickly. Returns successfully on valid input,
429
+ * or throws an error with diagnostic payload on failure.
430
+ *
431
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
432
+ *
433
+ * This is useful for fast feedback loops in LLM-driven document generation.
434
+ * @param {string} markdown
403
435
  */
404
- listQuills() {
436
+ dryRun(markdown) {
405
437
  try {
406
438
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
407
- wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
439
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
440
+ const len0 = WASM_VECTOR_LEN;
441
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
408
442
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
409
443
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
410
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
411
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
412
- return v1;
444
+ if (r1) {
445
+ throw takeObject(r0);
446
+ }
413
447
  } finally {
414
448
  wasm.__wbindgen_add_to_stack_pointer(16);
415
449
  }
416
450
  }
417
- /**
418
- * Unregister a Quill (free memory)
419
- * @param {string} name
420
- */
421
- unregisterQuill(name) {
422
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
423
- const len0 = WASM_VECTOR_LEN;
424
- wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
425
- }
426
451
  }
427
452
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
428
453
 
Binary file
@@ -2,29 +2,30 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_quillmark_free: (a: number, b: number) => void;
5
+ export const init: () => void;
6
+ export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
7
+ export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
8
+ export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
9
+ export const quillmark_getStrippedSchema: (a: number, b: number, c: number, d: number) => void;
10
+ export const quillmark_listQuills: (a: number, b: number) => void;
5
11
  export const quillmark_new: () => number;
6
12
  export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
7
13
  export const quillmark_registerQuill: (a: number, b: number, c: number) => void;
8
- export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
9
- export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
10
- export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
11
14
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
12
- export const quillmark_listQuills: (a: number, b: number) => void;
13
15
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
14
- export const init: () => void;
15
- export const qcms_profile_is_bogus: (a: number) => number;
16
- export const qcms_white_point_sRGB: (a: number) => void;
16
+ export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
17
17
  export const qcms_profile_precache_output_transform: (a: number) => void;
18
- export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
19
- export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
20
- export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
18
+ export const qcms_white_point_sRGB: (a: number) => void;
21
19
  export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
22
20
  export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
23
21
  export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
24
- export const qcms_transform_release: (a: number) => void;
25
- export const qcms_enable_iccv4: () => void;
22
+ export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
+ export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
+ export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
26
25
  export const lut_interp_linear16: (a: number, b: number, c: number) => number;
27
- export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
26
+ export const qcms_enable_iccv4: () => void;
27
+ export const qcms_profile_is_bogus: (a: number) => number;
28
+ export const qcms_transform_release: (a: number) => void;
28
29
  export const __wbindgen_export_0: (a: number, b: number) => number;
29
30
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
30
31
  export const __wbindgen_export_2: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",