@quillmark/wasm 0.11.0 → 0.12.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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/nibsbin/quillmark"
9
+ "url": "git+https://github.com/nibsbin/quillmark.git"
10
10
  },
11
11
  "files": [
12
12
  "wasm_bg.wasm",
package/wasm.d.ts CHANGED
@@ -4,38 +4,27 @@
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
- export type Severity = "error" | "warning" | "note";
10
-
11
- export interface Location {
12
- file: string;
13
- line: number;
14
- column: number;
15
- }
16
-
17
- export interface Diagnostic {
18
- severity: Severity;
19
- code?: string;
20
- message: string;
21
- location?: Location;
22
- hint?: string;
23
- sourceChain: string[];
24
- }
25
-
26
7
  export interface Artifact {
27
8
  format: OutputFormat;
28
9
  bytes: Uint8Array;
29
10
  mimeType: string;
30
11
  }
31
12
 
32
- export interface RenderResult {
33
- artifacts: Artifact[];
34
- warnings: Diagnostic[];
35
- outputFormat: OutputFormat;
36
- renderTimeMs: number;
13
+ export type Severity = "error" | "warning" | "note";
14
+
15
+ export interface ParsedDocument {
16
+ fields: Record<string, any>;
17
+ quillTag: string;
37
18
  }
38
19
 
20
+ export interface RenderOptions {
21
+ format?: OutputFormat;
22
+ assets?: Record<string, Uint8Array | number[]>;
23
+ quillName?: string;
24
+ }
25
+
26
+ export type OutputFormat = "pdf" | "svg" | "txt";
27
+
39
28
  export interface QuillInfo {
40
29
  name: string;
41
30
  backend: string;
@@ -47,15 +36,26 @@ export interface QuillInfo {
47
36
  supportedFormats: OutputFormat[];
48
37
  }
49
38
 
50
- export interface ParsedDocument {
51
- fields: Record<string, any>;
52
- quillTag: string;
39
+ export interface RenderResult {
40
+ artifacts: Artifact[];
41
+ warnings: Diagnostic[];
42
+ outputFormat: OutputFormat;
43
+ renderTimeMs: number;
53
44
  }
54
45
 
55
- export interface RenderOptions {
56
- format?: OutputFormat;
57
- assets?: Record<string, Uint8Array | number[]>;
58
- quillName?: string;
46
+ export interface Diagnostic {
47
+ severity: Severity;
48
+ code?: string;
49
+ message: string;
50
+ location?: Location;
51
+ hint?: string;
52
+ sourceChain: string[];
53
+ }
54
+
55
+ export interface Location {
56
+ file: string;
57
+ line: number;
58
+ column: number;
59
59
  }
60
60
 
61
61
  /**
@@ -67,9 +67,22 @@ 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
+ * Process markdown through template engine (debugging)
75
+ *
76
+ * Returns template source code (Typst, LaTeX, etc.)
77
+ */
78
+ processPlate(quill_name: string, markdown: string): string;
79
+ /**
80
+ * Get shallow information about a registered Quill
81
+ *
82
+ * This returns metadata, backend info, field schemas, and supported formats
83
+ * that consumers need to configure render options for the next step.
84
+ */
85
+ getQuillInfo(name: string): QuillInfo;
73
86
  /**
74
87
  * Parse markdown into a ParsedDocument
75
88
  *
@@ -85,18 +98,13 @@ export class Quillmark {
85
98
  */
86
99
  registerQuill(quill_json: any): QuillInfo;
87
100
  /**
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.
101
+ * Unregister a Quill (free memory)
92
102
  */
93
- getQuillInfo(name: string): QuillInfo;
103
+ unregisterQuill(name: string): void;
94
104
  /**
95
- * Process markdown through template engine (debugging)
96
- *
97
- * Returns template source code (Typst, LaTeX, etc.)
105
+ * JavaScript constructor: `new Quillmark()`
98
106
  */
99
- processPlate(quill_name: string, markdown: string): string;
107
+ constructor();
100
108
  /**
101
109
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
102
110
  *
@@ -104,12 +112,4 @@ export class Quillmark {
104
112
  * otherwise infers it from the ParsedDocument's quill_tag field.
105
113
  */
106
114
  render(parsed_wasm: ParsedDocument, opts: RenderOptions): RenderResult;
107
- /**
108
- * List registered Quill names
109
- */
110
- listQuills(): string[];
111
- /**
112
- * Unregister a Quill (free memory)
113
- */
114
- unregisterQuill(name: string): void;
115
115
  }
package/wasm_bg.js CHANGED
@@ -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,60 +246,56 @@ 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
+ * Process markdown through template engine (debugging)
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
+ * Returns template source code (Typst, LaTeX, etc.)
269
+ * @param {string} quill_name
270
+ * @param {string} markdown
271
+ * @returns {string}
289
272
  */
290
- registerQuill(quill_json) {
273
+ processPlate(quill_name, markdown) {
274
+ let deferred4_0;
275
+ let deferred4_1;
291
276
  try {
292
277
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
293
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
278
+ const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
279
+ const len0 = WASM_VECTOR_LEN;
280
+ const ptr1 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
281
+ const len1 = WASM_VECTOR_LEN;
282
+ wasm.quillmark_processPlate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
294
283
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
295
284
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
296
285
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
297
- if (r2) {
298
- throw takeObject(r1);
286
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
287
+ var ptr3 = r0;
288
+ var len3 = r1;
289
+ if (r3) {
290
+ ptr3 = 0; len3 = 0;
291
+ throw takeObject(r2);
299
292
  }
300
- return takeObject(r0);
293
+ deferred4_0 = ptr3;
294
+ deferred4_1 = len3;
295
+ return getStringFromWasm0(ptr3, len3);
301
296
  } finally {
302
297
  wasm.__wbindgen_add_to_stack_pointer(16);
298
+ wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
303
299
  }
304
300
  }
305
301
  /**
@@ -328,54 +324,42 @@ export class Quillmark {
328
324
  }
329
325
  }
330
326
  /**
331
- * Process markdown through template engine (debugging)
327
+ * Parse markdown into a ParsedDocument
332
328
  *
333
- * Returns template source code (Typst, LaTeX, etc.)
334
- * @param {string} quill_name
329
+ * This is the first step in the workflow. The returned ParsedDocument contains
330
+ * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
335
331
  * @param {string} markdown
336
- * @returns {string}
332
+ * @returns {ParsedDocument}
337
333
  */
338
- processPlate(quill_name, markdown) {
339
- let deferred4_0;
340
- let deferred4_1;
334
+ static parseMarkdown(markdown) {
341
335
  try {
342
336
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
343
- const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
337
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
344
338
  const len0 = WASM_VECTOR_LEN;
345
- const ptr1 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
346
- const len1 = WASM_VECTOR_LEN;
347
- wasm.quillmark_processPlate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
339
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
348
340
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
349
341
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
350
342
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
351
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
352
- var ptr3 = r0;
353
- var len3 = r1;
354
- if (r3) {
355
- ptr3 = 0; len3 = 0;
356
- throw takeObject(r2);
343
+ if (r2) {
344
+ throw takeObject(r1);
357
345
  }
358
- deferred4_0 = ptr3;
359
- deferred4_1 = len3;
360
- return getStringFromWasm0(ptr3, len3);
346
+ return takeObject(r0);
361
347
  } finally {
362
348
  wasm.__wbindgen_add_to_stack_pointer(16);
363
- wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
364
349
  }
365
350
  }
366
351
  /**
367
- * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
352
+ * Register a Quill template bundle
368
353
  *
369
- * Uses the Quill specified in options.quill_name if provided,
370
- * otherwise infers it from the ParsedDocument's quill_tag field.
371
- * @param {ParsedDocument} parsed_wasm
372
- * @param {RenderOptions} opts
373
- * @returns {RenderResult}
354
+ * Accepts either a JSON string or a JsValue object representing the Quill file tree.
355
+ * Validation happens automatically on registration.
356
+ * @param {any} quill_json
357
+ * @returns {QuillInfo}
374
358
  */
375
- render(parsed_wasm, opts) {
359
+ registerQuill(quill_json) {
376
360
  try {
377
361
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
378
- wasm.quillmark_render(retptr, this.__wbg_ptr, addHeapObject(parsed_wasm), addHeapObject(opts));
362
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
379
363
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
380
364
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
381
365
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -388,31 +372,47 @@ export class Quillmark {
388
372
  }
389
373
  }
390
374
  /**
391
- * List registered Quill names
392
- * @returns {string[]}
375
+ * Unregister a Quill (free memory)
376
+ * @param {string} name
393
377
  */
394
- listQuills() {
378
+ unregisterQuill(name) {
379
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
380
+ const len0 = WASM_VECTOR_LEN;
381
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
382
+ }
383
+ /**
384
+ * JavaScript constructor: `new Quillmark()`
385
+ */
386
+ constructor() {
387
+ const ret = wasm.quillmark_new();
388
+ this.__wbg_ptr = ret >>> 0;
389
+ QuillmarkFinalization.register(this, this.__wbg_ptr, this);
390
+ return this;
391
+ }
392
+ /**
393
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
394
+ *
395
+ * Uses the Quill specified in options.quill_name if provided,
396
+ * otherwise infers it from the ParsedDocument's quill_tag field.
397
+ * @param {ParsedDocument} parsed_wasm
398
+ * @param {RenderOptions} opts
399
+ * @returns {RenderResult}
400
+ */
401
+ render(parsed_wasm, opts) {
395
402
  try {
396
403
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
397
- wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
404
+ wasm.quillmark_render(retptr, this.__wbg_ptr, addHeapObject(parsed_wasm), addHeapObject(opts));
398
405
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
399
406
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
400
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
401
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
402
- return v1;
407
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
408
+ if (r2) {
409
+ throw takeObject(r1);
410
+ }
411
+ return takeObject(r0);
403
412
  } finally {
404
413
  wasm.__wbindgen_add_to_stack_pointer(16);
405
414
  }
406
415
  }
407
- /**
408
- * Unregister a Quill (free memory)
409
- * @param {string} name
410
- */
411
- unregisterQuill(name) {
412
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
413
- const len0 = WASM_VECTOR_LEN;
414
- wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
415
- }
416
416
  }
417
417
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
418
418
 
package/wasm_bg.wasm CHANGED
Binary file
package/wasm_bg.wasm.d.ts CHANGED
@@ -2,28 +2,28 @@
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_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
7
+ export const quillmark_listQuills: (a: number, b: number) => void;
5
8
  export const quillmark_new: () => number;
6
9
  export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
7
- 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
10
  export const quillmark_processPlate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
11
+ export const quillmark_registerQuill: (a: number, b: number, c: number) => void;
10
12
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
11
- export const quillmark_listQuills: (a: number, b: number) => void;
12
13
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
13
- export const init: () => void;
14
- export const qcms_profile_is_bogus: (a: number) => number;
15
- export const qcms_white_point_sRGB: (a: number) => void;
14
+ export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
16
15
  export const qcms_profile_precache_output_transform: (a: number) => void;
17
- export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
18
- export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
19
- export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
16
+ export const qcms_white_point_sRGB: (a: number) => void;
20
17
  export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
21
18
  export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
22
19
  export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
23
- export const qcms_transform_release: (a: number) => void;
24
- export const qcms_enable_iccv4: () => void;
20
+ export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
21
+ export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
22
+ export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
25
23
  export const lut_interp_linear16: (a: number, b: number, c: number) => number;
26
- export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
24
+ export const qcms_enable_iccv4: () => void;
25
+ export const qcms_profile_is_bogus: (a: number) => number;
26
+ export const qcms_transform_release: (a: number) => void;
27
27
  export const __wbindgen_export_0: (a: number, b: number) => number;
28
28
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
29
29
  export const __wbindgen_export_2: (a: number) => void;