@quillmark/wasm 0.68.0 → 0.69.1

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
@@ -79,6 +79,18 @@ O(1) getter for the number of composable cards (excluding the main card).
79
79
  Use this to validate indices before calling card mutators (`removeCard`,
80
80
  `updateCardField`, etc.) without allocating the full `cards` array.
81
81
 
82
+ ### `quill.form(doc)`
83
+
84
+ Returns `{ main, cards, diagnostics }` — a schema-aware snapshot of `doc`
85
+ without invoking the backend. `diagnostics` contains validation errors and
86
+ warnings; an empty array means the document is valid. Useful for validating
87
+ content without rendering:
88
+
89
+ ```ts
90
+ const form = quill.form(Document.fromMarkdown(markdown));
91
+ const errors = form.diagnostics.filter(d => d.severity === "error");
92
+ ```
93
+
82
94
  ### `quill.render(parsed, opts?)` vs. `quill.open(parsed)`
83
95
 
84
96
  Use **`Quill.render`** for one-shot exports (PDF/SVG/PNG) — compiles, emits
package/bundler/wasm.d.ts CHANGED
@@ -84,6 +84,113 @@ export interface PaintResult {
84
84
  }
85
85
 
86
86
 
87
+
88
+ /** UI layout hints for a single field. */
89
+ export interface QuillFieldUi {
90
+ group?: string;
91
+ order?: number;
92
+ compact?: boolean;
93
+ multiline?: boolean;
94
+ }
95
+
96
+ /** UI layout hints for a card (main or named card type). */
97
+ export interface QuillCardUi {
98
+ hide_body?: boolean;
99
+ default_title?: string;
100
+ }
101
+
102
+ /** Schema entry for a single field declared in a quill's `Quill.yaml`. */
103
+ export interface QuillFieldSchema {
104
+ type: "string" | "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "markdown";
105
+ title?: string;
106
+ description?: string;
107
+ default?: unknown;
108
+ examples?: unknown;
109
+ required?: boolean;
110
+ enum?: string[];
111
+ ui?: QuillFieldUi;
112
+ properties?: Record<string, QuillFieldSchema>;
113
+ items?: QuillFieldSchema;
114
+ }
115
+
116
+ /** Schema entry for the main card or a named card type. */
117
+ export interface QuillCardSchema {
118
+ title?: string;
119
+ description?: string;
120
+ fields: Record<string, QuillFieldSchema>;
121
+ ui?: QuillCardUi;
122
+ }
123
+
124
+ /**
125
+ * Public schema contract returned as `QuillMetadata.schema`.
126
+ *
127
+ * Identical to `QuillConfig::public_schema()` on the Rust side.
128
+ */
129
+ export interface QuillSchema {
130
+ name: string;
131
+ main: QuillCardSchema;
132
+ /** Present only when the quill declares at least one named card type. */
133
+ card_types?: Record<string, QuillCardSchema>;
134
+ /** The quill's bundled example document, if declared. */
135
+ example?: string;
136
+ }
137
+
138
+ /**
139
+ * Read-only snapshot of the loaded quill's engine info and declared schema.
140
+ * Returned by `Quill.metadata`.
141
+ *
142
+ * Well-known keys are strongly typed; any additional keys declared under
143
+ * `quill:` in `Quill.yaml` appear as `unknown`.
144
+ */
145
+ export interface QuillMetadata {
146
+ schema: QuillSchema;
147
+ backend: string;
148
+ version: string;
149
+ author: string;
150
+ description: string;
151
+ supportedFormats: OutputFormat[];
152
+ [key: string]: unknown;
153
+ }
154
+
155
+ /** Source of a field's effective value in a form view. */
156
+ export type FormFieldSource = "document" | "default" | "missing";
157
+
158
+ /**
159
+ * A single field's view within a `FormCard`.
160
+ *
161
+ * - `value` — the document-supplied value (`null` when absent).
162
+ * - `default` — the schema default (`null` when no default is declared).
163
+ * - `source` — where the effective value comes from.
164
+ */
165
+ export interface FormFieldValue {
166
+ value: unknown;
167
+ default: unknown;
168
+ source: FormFieldSource;
169
+ }
170
+
171
+ /**
172
+ * A card viewed through its schema, as returned by `Quill.form`,
173
+ * `Quill.blankMain`, and `Quill.blankCard`.
174
+ */
175
+ export interface FormCard {
176
+ schema: QuillCardSchema;
177
+ values: Record<string, FormFieldValue>;
178
+ }
179
+
180
+ /**
181
+ * Schema-aware form view of a document, returned by `Quill.form`.
182
+ *
183
+ * - `main` — the main card viewed through the quill's main schema.
184
+ * - `cards` — composable card blocks, in document order (unknown tags excluded).
185
+ * - `diagnostics` — diagnostics from unknown card tags and validation.
186
+ */
187
+ export interface Form {
188
+ main: FormCard;
189
+ cards: FormCard[];
190
+ diagnostics: Diagnostic[];
191
+ }
192
+
193
+
87
194
  export interface Artifact {
88
195
  format: OutputFormat;
89
196
  bytes: Uint8Array;
@@ -357,7 +464,7 @@ export class Quill {
357
464
  *
358
465
  * [`Form::cards`]: quillmark::form::Form::cards
359
466
  */
360
- blankCard(card_type: string): any;
467
+ blankCard(card_type: string): FormCard | null;
361
468
  /**
362
469
  * A blank form for the main card — no document values supplied.
363
470
  *
@@ -367,7 +474,7 @@ export class Quill {
367
474
  *
368
475
  * [`Form::main`]: quillmark::form::Form::main
369
476
  */
370
- blankMain(): any;
477
+ blankMain(): FormCard;
371
478
  /**
372
479
  * The schema-aware form view of `doc`.
373
480
  *
@@ -387,7 +494,7 @@ export class Quill {
387
494
  *
388
495
  * [`Form`]: quillmark::form::Form
389
496
  */
390
- form(doc: Document): any;
497
+ form(doc: Document): Form;
391
498
  /**
392
499
  * Open an iterative render session for page-selective rendering.
393
500
  */
@@ -425,7 +532,7 @@ export class Quill {
425
532
  * Equivalent by value for the lifetime of the handle; the quill is
426
533
  * immutable once constructed.
427
534
  */
428
- readonly metadata: any;
535
+ readonly metadata: QuillMetadata;
429
536
  /**
430
537
  * Whether this quill's backend supports canvas preview.
431
538
  *
@@ -531,7 +531,7 @@ export class Quill {
531
531
  *
532
532
  * [`Form::cards`]: quillmark::form::Form::cards
533
533
  * @param {string} card_type
534
- * @returns {any}
534
+ * @returns {FormCard | null}
535
535
  */
536
536
  blankCard(card_type) {
537
537
  try {
@@ -558,7 +558,7 @@ export class Quill {
558
558
  * the schema declares a default) or `"missing"`.
559
559
  *
560
560
  * [`Form::main`]: quillmark::form::Form::main
561
- * @returns {any}
561
+ * @returns {FormCard}
562
562
  */
563
563
  blankMain() {
564
564
  try {
@@ -594,7 +594,7 @@ export class Quill {
594
594
  *
595
595
  * [`Form`]: quillmark::form::Form
596
596
  * @param {Document} doc
597
- * @returns {any}
597
+ * @returns {Form}
598
598
  */
599
599
  form(doc) {
600
600
  try {
@@ -636,7 +636,7 @@ export class Quill {
636
636
  *
637
637
  * Equivalent by value for the lifetime of the handle; the quill is
638
638
  * immutable once constructed.
639
- * @returns {any}
639
+ * @returns {QuillMetadata}
640
640
  */
641
641
  get metadata() {
642
642
  const ret = wasm.quill_metadata(this.__wbg_ptr);
Binary file
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.68.0",
3
+ "version": "0.69.1",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",
7
+ "engines": {
8
+ "node": ">=24"
9
+ },
7
10
  "repository": {
8
11
  "type": "git",
9
12
  "url": "git+https://github.com/nibsbin/quillmark.git"
@@ -13,20 +16,14 @@
13
16
  "bundler/wasm_bg.js",
14
17
  "bundler/wasm_bg.wasm.d.ts",
15
18
  "bundler/wasm.js",
16
- "bundler/wasm.d.ts",
17
- "node-esm/wasm_bg.wasm",
18
- "node-esm/wasm_bg.js",
19
- "node-esm/wasm_bg.wasm.d.ts",
20
- "node-esm/wasm.js",
21
- "node-esm/wasm.d.ts"
19
+ "bundler/wasm.d.ts"
22
20
  ],
23
- "main": "./node-esm/wasm.js",
21
+ "main": "./bundler/wasm.js",
24
22
  "module": "./bundler/wasm.js",
25
23
  "types": "./bundler/wasm.d.ts",
26
24
  "exports": {
27
25
  ".": {
28
26
  "types": "./bundler/wasm.d.ts",
29
- "node": "./node-esm/wasm.js",
30
27
  "import": "./bundler/wasm.js",
31
28
  "default": "./bundler/wasm.js"
32
29
  }
@@ -34,4 +31,4 @@
34
31
  "sideEffects": [
35
32
  "./bundler/wasm.js"
36
33
  ]
37
- }
34
+ }