@quillmark/wasm 0.30.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,12 +99,9 @@ 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
106
  * Get the stripped JSON schema of a Quill (removes UI metadata)
96
107
  *
@@ -98,6 +109,17 @@ export class Quillmark {
98
109
  * other consumers that don't need the UI configuration "x-ui" fields.
99
110
  */
100
111
  getStrippedSchema(name: string): any;
112
+ /**
113
+ * JavaScript constructor: `new Quillmark()`
114
+ */
115
+ constructor();
116
+ /**
117
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
118
+ *
119
+ * Uses the Quill specified in options.quill_name if provided,
120
+ * otherwise infers it from the ParsedDocument's quill_name field.
121
+ */
122
+ render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
101
123
  /**
102
124
  * Perform a dry run validation without backend compilation.
103
125
  *
@@ -110,26 +132,4 @@ export class Quillmark {
110
132
  * This is useful for fast feedback loops in LLM-driven document generation.
111
133
  */
112
134
  dryRun(markdown: string): void;
113
- /**
114
- * Compile markdown to JSON data without rendering artifacts.
115
- *
116
- * This exposes the intermediate data structure that would be passed to the backend.
117
- * Useful for debugging and validation.
118
- */
119
- compileData(markdown: string): any;
120
- /**
121
- * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
122
- *
123
- * Uses the Quill specified in options.quill_name if provided,
124
- * otherwise infers it from the ParsedDocument's quill_tag field.
125
- */
126
- render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
127
- /**
128
- * List registered Quill names
129
- */
130
- listQuills(): string[];
131
- /**
132
- * Unregister a Quill (free memory)
133
- */
134
- unregisterQuill(name: string): void;
135
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,51 +246,36 @@ export class Quillmark {
246
246
  wasm.__wbg_quillmark_free(ptr, 0);
247
247
  }
248
248
  /**
249
- * JavaScript constructor: `new Quillmark()`
250
- */
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;
256
- }
257
- /**
258
- * Parse markdown into a ParsedDocument
259
- *
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__").
262
- * @param {string} markdown
263
- * @returns {ParsedDocument}
249
+ * List registered Quill names
250
+ * @returns {string[]}
264
251
  */
265
- static parseMarkdown(markdown) {
252
+ listQuills() {
266
253
  try {
267
254
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
268
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
269
- const len0 = WASM_VECTOR_LEN;
270
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
255
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
271
256
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
272
257
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
273
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
274
- if (r2) {
275
- throw takeObject(r1);
276
- }
277
- return takeObject(r0);
258
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
259
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
260
+ return v1;
278
261
  } finally {
279
262
  wasm.__wbindgen_add_to_stack_pointer(16);
280
263
  }
281
264
  }
282
265
  /**
283
- * Register a Quill template bundle
266
+ * Compile markdown to JSON data without rendering artifacts.
284
267
  *
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
288
- * @returns {QuillInfo}
268
+ * This exposes the intermediate data structure that would be passed to the backend.
269
+ * Useful for debugging and validation.
270
+ * @param {string} markdown
271
+ * @returns {any}
289
272
  */
290
- registerQuill(quill_json) {
273
+ compileData(markdown) {
291
274
  try {
292
275
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
293
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
276
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
277
+ const len0 = WASM_VECTOR_LEN;
278
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
294
279
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
295
280
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
296
281
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -328,19 +313,19 @@ export class Quillmark {
328
313
  }
329
314
  }
330
315
  /**
331
- * Get the stripped JSON schema of a Quill (removes UI metadata)
316
+ * Parse markdown into a ParsedDocument
332
317
  *
333
- * This returns the schema in a format suitable for feeding to LLMs or
334
- * other consumers that don't need the UI configuration "x-ui" fields.
335
- * @param {string} name
336
- * @returns {any}
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}
337
322
  */
338
- getStrippedSchema(name) {
323
+ static parseMarkdown(markdown) {
339
324
  try {
340
325
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
341
- 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);
342
327
  const len0 = WASM_VECTOR_LEN;
343
- wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
328
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
344
329
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
345
330
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
346
331
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -353,46 +338,51 @@ export class Quillmark {
353
338
  }
354
339
  }
355
340
  /**
356
- * Perform a dry run validation without backend compilation.
357
- *
358
- * Executes parsing, schema validation, and template composition to
359
- * surface input errors quickly. Returns successfully on valid input,
360
- * or throws an error with diagnostic payload on failure.
361
- *
362
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
341
+ * Register a Quill template bundle
363
342
  *
364
- * This is useful for fast feedback loops in LLM-driven document generation.
365
- * @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}
366
347
  */
367
- dryRun(markdown) {
348
+ registerQuill(quill_json) {
368
349
  try {
369
350
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
370
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
371
- const len0 = WASM_VECTOR_LEN;
372
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
351
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
373
352
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
374
353
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
375
- if (r1) {
376
- throw takeObject(r0);
354
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
355
+ if (r2) {
356
+ throw takeObject(r1);
377
357
  }
358
+ return takeObject(r0);
378
359
  } finally {
379
360
  wasm.__wbindgen_add_to_stack_pointer(16);
380
361
  }
381
362
  }
382
363
  /**
383
- * 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)
384
374
  *
385
- * This exposes the intermediate data structure that would be passed to the backend.
386
- * Useful for debugging and validation.
387
- * @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
388
378
  * @returns {any}
389
379
  */
390
- compileData(markdown) {
380
+ getStrippedSchema(name) {
391
381
  try {
392
382
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
- 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);
394
384
  const len0 = WASM_VECTOR_LEN;
395
- wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
385
+ wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
396
386
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
397
387
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
398
388
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -404,11 +394,20 @@ export class Quillmark {
404
394
  wasm.__wbindgen_add_to_stack_pointer(16);
405
395
  }
406
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
+ }
407
406
  /**
408
407
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
409
408
  *
410
409
  * Uses the Quill specified in options.quill_name if provided,
411
- * otherwise infers it from the ParsedDocument's quill_tag field.
410
+ * otherwise infers it from the ParsedDocument's quill_name field.
412
411
  * @param {ParsedDocument} parsed
413
412
  * @param {RenderOptions} opts
414
413
  * @returns {RenderResult}
@@ -429,31 +428,32 @@ export class Quillmark {
429
428
  }
430
429
  }
431
430
  /**
432
- * List registered Quill names
433
- * @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
434
441
  */
435
- listQuills() {
442
+ dryRun(markdown) {
436
443
  try {
437
444
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
438
- 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);
439
448
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
440
449
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
441
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
442
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
443
- return v1;
450
+ if (r1) {
451
+ throw takeObject(r0);
452
+ }
444
453
  } finally {
445
454
  wasm.__wbindgen_add_to_stack_pointer(16);
446
455
  }
447
456
  }
448
- /**
449
- * Unregister a Quill (free memory)
450
- * @param {string} name
451
- */
452
- unregisterQuill(name) {
453
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
454
- const len0 = WASM_VECTOR_LEN;
455
- wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
456
- }
457
457
  }
458
458
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
459
459
 
Binary file
@@ -2,30 +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_getStrippedSchema: (a: number, b: number, c: number, d: number) => void;
10
- export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
11
- export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
12
14
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
13
- export const quillmark_listQuills: (a: number, b: number) => void;
14
15
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
15
- export const init: () => void;
16
- export const qcms_profile_is_bogus: (a: number) => number;
17
- export const qcms_white_point_sRGB: (a: number) => void;
16
+ export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
18
17
  export const qcms_profile_precache_output_transform: (a: number) => void;
19
- export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
20
- export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
21
- 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;
22
19
  export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
23
20
  export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
24
21
  export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
25
- export const qcms_transform_release: (a: number) => void;
26
- 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;
27
25
  export const lut_interp_linear16: (a: number, b: number, c: number) => number;
28
- 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;
29
29
  export const __wbindgen_export_0: (a: number, b: number) => number;
30
30
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
31
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,12 +99,9 @@ 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
106
  * Get the stripped JSON schema of a Quill (removes UI metadata)
96
107
  *
@@ -98,6 +109,17 @@ export class Quillmark {
98
109
  * other consumers that don't need the UI configuration "x-ui" fields.
99
110
  */
100
111
  getStrippedSchema(name: string): any;
112
+ /**
113
+ * JavaScript constructor: `new Quillmark()`
114
+ */
115
+ constructor();
116
+ /**
117
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
118
+ *
119
+ * Uses the Quill specified in options.quill_name if provided,
120
+ * otherwise infers it from the ParsedDocument's quill_name field.
121
+ */
122
+ render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
101
123
  /**
102
124
  * Perform a dry run validation without backend compilation.
103
125
  *
@@ -110,26 +132,4 @@ export class Quillmark {
110
132
  * This is useful for fast feedback loops in LLM-driven document generation.
111
133
  */
112
134
  dryRun(markdown: string): void;
113
- /**
114
- * Compile markdown to JSON data without rendering artifacts.
115
- *
116
- * This exposes the intermediate data structure that would be passed to the backend.
117
- * Useful for debugging and validation.
118
- */
119
- compileData(markdown: string): any;
120
- /**
121
- * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
122
- *
123
- * Uses the Quill specified in options.quill_name if provided,
124
- * otherwise infers it from the ParsedDocument's quill_tag field.
125
- */
126
- render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
127
- /**
128
- * List registered Quill names
129
- */
130
- listQuills(): string[];
131
- /**
132
- * Unregister a Quill (free memory)
133
- */
134
- unregisterQuill(name: string): void;
135
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,51 +240,36 @@ export class Quillmark {
240
240
  wasm.__wbg_quillmark_free(ptr, 0);
241
241
  }
242
242
  /**
243
- * JavaScript constructor: `new Quillmark()`
244
- */
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;
250
- }
251
- /**
252
- * Parse markdown into a ParsedDocument
253
- *
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__").
256
- * @param {string} markdown
257
- * @returns {ParsedDocument}
243
+ * List registered Quill names
244
+ * @returns {string[]}
258
245
  */
259
- static parseMarkdown(markdown) {
246
+ listQuills() {
260
247
  try {
261
248
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
262
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
263
- const len0 = WASM_VECTOR_LEN;
264
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
249
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
265
250
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
266
251
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
267
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
268
- if (r2) {
269
- throw takeObject(r1);
270
- }
271
- return takeObject(r0);
252
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
253
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
254
+ return v1;
272
255
  } finally {
273
256
  wasm.__wbindgen_add_to_stack_pointer(16);
274
257
  }
275
258
  }
276
259
  /**
277
- * Register a Quill template bundle
260
+ * Compile markdown to JSON data without rendering artifacts.
278
261
  *
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
282
- * @returns {QuillInfo}
262
+ * This exposes the intermediate data structure that would be passed to the backend.
263
+ * Useful for debugging and validation.
264
+ * @param {string} markdown
265
+ * @returns {any}
283
266
  */
284
- registerQuill(quill_json) {
267
+ compileData(markdown) {
285
268
  try {
286
269
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
287
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
270
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
271
+ const len0 = WASM_VECTOR_LEN;
272
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
288
273
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
289
274
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
290
275
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -322,19 +307,19 @@ export class Quillmark {
322
307
  }
323
308
  }
324
309
  /**
325
- * Get the stripped JSON schema of a Quill (removes UI metadata)
310
+ * Parse markdown into a ParsedDocument
326
311
  *
327
- * This returns the schema in a format suitable for feeding to LLMs or
328
- * other consumers that don't need the UI configuration "x-ui" fields.
329
- * @param {string} name
330
- * @returns {any}
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}
331
316
  */
332
- getStrippedSchema(name) {
317
+ static parseMarkdown(markdown) {
333
318
  try {
334
319
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
- 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);
336
321
  const len0 = WASM_VECTOR_LEN;
337
- wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
322
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
338
323
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
339
324
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
340
325
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -347,46 +332,51 @@ export class Quillmark {
347
332
  }
348
333
  }
349
334
  /**
350
- * Perform a dry run validation without backend compilation.
351
- *
352
- * Executes parsing, schema validation, and template composition to
353
- * surface input errors quickly. Returns successfully on valid input,
354
- * or throws an error with diagnostic payload on failure.
355
- *
356
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
335
+ * Register a Quill template bundle
357
336
  *
358
- * This is useful for fast feedback loops in LLM-driven document generation.
359
- * @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}
360
341
  */
361
- dryRun(markdown) {
342
+ registerQuill(quill_json) {
362
343
  try {
363
344
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
364
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
365
- const len0 = WASM_VECTOR_LEN;
366
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
345
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
367
346
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
368
347
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
369
- if (r1) {
370
- throw takeObject(r0);
348
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
349
+ if (r2) {
350
+ throw takeObject(r1);
371
351
  }
352
+ return takeObject(r0);
372
353
  } finally {
373
354
  wasm.__wbindgen_add_to_stack_pointer(16);
374
355
  }
375
356
  }
376
357
  /**
377
- * 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)
378
368
  *
379
- * This exposes the intermediate data structure that would be passed to the backend.
380
- * Useful for debugging and validation.
381
- * @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
382
372
  * @returns {any}
383
373
  */
384
- compileData(markdown) {
374
+ getStrippedSchema(name) {
385
375
  try {
386
376
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
387
- 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);
388
378
  const len0 = WASM_VECTOR_LEN;
389
- wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
379
+ wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
390
380
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
391
381
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
392
382
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -398,11 +388,20 @@ export class Quillmark {
398
388
  wasm.__wbindgen_add_to_stack_pointer(16);
399
389
  }
400
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
+ }
401
400
  /**
402
401
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
403
402
  *
404
403
  * Uses the Quill specified in options.quill_name if provided,
405
- * otherwise infers it from the ParsedDocument's quill_tag field.
404
+ * otherwise infers it from the ParsedDocument's quill_name field.
406
405
  * @param {ParsedDocument} parsed
407
406
  * @param {RenderOptions} opts
408
407
  * @returns {RenderResult}
@@ -423,31 +422,32 @@ export class Quillmark {
423
422
  }
424
423
  }
425
424
  /**
426
- * List registered Quill names
427
- * @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
428
435
  */
429
- listQuills() {
436
+ dryRun(markdown) {
430
437
  try {
431
438
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
432
- 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);
433
442
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
434
443
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
435
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
436
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
437
- return v1;
444
+ if (r1) {
445
+ throw takeObject(r0);
446
+ }
438
447
  } finally {
439
448
  wasm.__wbindgen_add_to_stack_pointer(16);
440
449
  }
441
450
  }
442
- /**
443
- * Unregister a Quill (free memory)
444
- * @param {string} name
445
- */
446
- unregisterQuill(name) {
447
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
448
- const len0 = WASM_VECTOR_LEN;
449
- wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
450
- }
451
451
  }
452
452
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
453
453
 
Binary file
@@ -2,30 +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_getStrippedSchema: (a: number, b: number, c: number, d: number) => void;
10
- export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
11
- export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
12
14
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
13
- export const quillmark_listQuills: (a: number, b: number) => void;
14
15
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
15
- export const init: () => void;
16
- export const qcms_profile_is_bogus: (a: number) => number;
17
- export const qcms_white_point_sRGB: (a: number) => void;
16
+ export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
18
17
  export const qcms_profile_precache_output_transform: (a: number) => void;
19
- export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
20
- export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
21
- 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;
22
19
  export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
23
20
  export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
24
21
  export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
25
- export const qcms_transform_release: (a: number) => void;
26
- 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;
27
25
  export const lut_interp_linear16: (a: number, b: number, c: number) => number;
28
- 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;
29
29
  export const __wbindgen_export_0: (a: number, b: number) => number;
30
30
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
31
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.30.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",